@loaders.gl/arrow 4.4.0-alpha.9 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.min.js CHANGED
@@ -4,20 +4,20 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var ku=Object.create;var Wn=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var Vu=Object.getOwnPropertyNames;var ju=Object.getPrototypeOf,zu=Object.prototype.hasOwnProperty;var Wu=(r,t,e)=>t in r?Wn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Gu=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),br=(r,t)=>{for(var e in t)Wn(r,e,{get:t[e],enumerable:!0})},Vi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vu(t))!zu.call(r,i)&&i!==e&&Wn(r,i,{get:()=>t[i],enumerable:!(n=Pu(t,i))||n.enumerable});return r},ji=(r,t,e)=>(Vi(r,t,"default"),e&&Vi(e,t,"default")),$u=(r,t,e)=>(e=r!=null?ku(ju(r)):{},Vi(t||!r||!r.__esModule?Wn(e,"default",{value:r,enumerable:!0}):e,r)),Yu=r=>Vi(Wn({},"__esModule",{value:!0}),r);var $a=(r,t,e)=>(Wu(r,typeof t!="symbol"?t+"":t,e),e);var Ha=Gu((Bp,Ya)=>{Ya.exports=globalThis.loaders});var Pi={};br(Pi,{ArrowFormat:()=>Ja,ArrowLoader:()=>uu,ArrowWorkerLoader:()=>cn,ArrowWriter:()=>fu,GeoArrowLoader:()=>Uu,GeoArrowWorkerLoader:()=>ps,TriangulationWorker:()=>bs,VECTOR_TYPES:()=>Fr,hardClone:()=>ki,parseGeoArrowOnWorker:()=>Ru,triangulateOnWorker:()=>Eu});ji(Pi,$u(Ha(),1));var Fr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(Fr||(Fr={}));var Ja={name:"Apache Arrow",id:"arrow",module:"arrow",category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"]};var Hu="4.4.0-alpha.9",cn={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:Hu,category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"],options:{arrow:{shape:"columnar-table"}}};function Za(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function m(r,t,e,n){function i(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(f){try{l(n.next(f))}catch(d){s(d)}}function c(f){try{l(n.throw(f))}catch(d){s(d)}}function l(f){f.done?o(f.value):i(f.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Ka(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(r){return this instanceof L?(this.v=r,this):new L(r)}function qt(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(N){return function(st){return Promise.resolve(st).then(N,d)}}function a(N,st){n[N]&&(i[N]=function(yr){return new Promise(function(ws,gr){o.push([N,yr,ws,gr])>1||c(N,yr)})},st&&(i[N]=st(i[N])))}function c(N,st){try{l(n[N](st))}catch(yr){V(o[0][3],yr)}}function l(N){N.value instanceof L?Promise.resolve(N.value.v).then(f,d):V(o[0][2],N)}function f(N){c("next",N)}function d(N){c("throw",N)}function V(N,st){N(st),o.shift(),o.length&&c(o[0][0],o[0][1])}}function ln(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=r[i]?function(s){return(e=!e)?{value:L(r[i](s)),done:!1}:o?o(s):s}:o}}function he(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Ka=="function"?Ka(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(o){e[o]=r[o]&&function(s){return new Promise(function(a,c){s=r[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Bs={};br(Bs,{compareArrayLike:()=>xs,joinUint8Arrays:()=>te,memcpy:()=>Yn,rebaseValueOffsets:()=>Ki,toArrayBufferView:()=>E,toArrayBufferViewAsyncIterator:()=>me,toArrayBufferViewIterator:()=>Ae,toBigInt64Array:()=>Ji,toBigUint64Array:()=>rf,toFloat32Array:()=>nf,toFloat32ArrayAsyncIterator:()=>_f,toFloat32ArrayIterator:()=>df,toFloat64Array:()=>of,toFloat64ArrayAsyncIterator:()=>vf,toFloat64ArrayIterator:()=>hf,toInt16Array:()=>Qu,toInt16ArrayAsyncIterator:()=>yf,toInt16ArrayIterator:()=>cf,toInt32Array:()=>Mr,toInt32ArrayAsyncIterator:()=>gf,toInt32ArrayIterator:()=>lf,toInt8Array:()=>qu,toInt8ArrayAsyncIterator:()=>mf,toInt8ArrayIterator:()=>af,toUint16Array:()=>tf,toUint16ArrayAsyncIterator:()=>bf,toUint16ArrayIterator:()=>uf,toUint32Array:()=>ef,toUint32ArrayAsyncIterator:()=>wf,toUint32ArrayIterator:()=>ff,toUint8Array:()=>B,toUint8ArrayAsyncIterator:()=>Ss,toUint8ArrayIterator:()=>Is,toUint8ClampedArray:()=>sf,toUint8ClampedArrayAsyncIterator:()=>If,toUint8ClampedArrayIterator:()=>pf});var Ju=new TextDecoder("utf-8"),Gn=r=>Ju.decode(r),Ku=new TextEncoder,Be=r=>Ku.encode(r);var Zu=r=>typeof r=="number",Xa=r=>typeof r=="boolean",dt=r=>typeof r=="function",Ot=r=>r!=null&&Object(r)===r,Qt=r=>Ot(r)&&dt(r.then);var pe=r=>Ot(r)&&dt(r[Symbol.iterator]),oe=r=>Ot(r)&&dt(r[Symbol.asyncIterator]),zi=r=>Ot(r)&&Ot(r.schema);var Wi=r=>Ot(r)&&"done"in r&&"value"in r;var Gi=r=>Ot(r)&&dt(r.stat)&&Zu(r.fd);var $i=r=>Ot(r)&&$n(r.body),Yi=r=>"_getDOMStream"in r&&"_getNodeStream"in r,qa=r=>Ot(r)&&dt(r.abort)&&dt(r.getWriter)&&!Yi(r),$n=r=>Ot(r)&&dt(r.cancel)&&dt(r.getReader)&&!Yi(r),Qa=r=>Ot(r)&&dt(r.end)&&dt(r.write)&&Xa(r.writable)&&!Yi(r),Hi=r=>Ot(r)&&dt(r.read)&&dt(r.pipe)&&Xa(r.readable)&&!Yi(r),tc=r=>Ot(r)&&dt(r.clear)&&dt(r.bytes)&&dt(r.position)&&dt(r.setPosition)&&dt(r.capacity)&&dt(r.getBufferIdentifier)&&dt(r.createLong);var vs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Xu(r){let t=r[0]?[r[0]]:[],e,n,i,o;for(let s,a,c=0,l=0,f=r.length;++c<f;){if(s=t[l],a=r[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,e+i<n||n+o<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,e,n-e+o)}return t}function Yn(r,t,e=0,n=t.byteLength){let i=r.byteLength,o=new Uint8Array(r.buffer,r.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,e),r}function te(r,t){let e=Xu(r),n=e.reduce((f,d)=>f+d.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let f=e.length;++c<f;){if(i=e[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?e[c]=i.subarray(o.length):o.length===i.length&&c++,s?Yn(s,o,a):s=o;break}Yn(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),e.slice(c),n-(s?s.byteLength:0)]}function E(r,t){let e=Wi(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Be(e)),e instanceof ArrayBuffer?new r(e):e instanceof vs?new r(e):tc(e)?E(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var qu=r=>E(Int8Array,r),Qu=r=>E(Int16Array,r),Mr=r=>E(Int32Array,r),Ji=r=>E(BigInt64Array,r),B=r=>E(Uint8Array,r),tf=r=>E(Uint16Array,r),ef=r=>E(Uint32Array,r),rf=r=>E(BigUint64Array,r),nf=r=>E(Float32Array,r),of=r=>E(Float64Array,r),sf=r=>E(Uint8ClampedArray,r),_s=r=>(r.next(),r);function*Ae(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vs?e(t):pe(t)?t:e(t);return yield*_s(function*(i){let o=null;do o=i.next(yield E(r,o));while(!o.done)}(n[Symbol.iterator]())),new r}var af=r=>Ae(Int8Array,r),cf=r=>Ae(Int16Array,r),lf=r=>Ae(Int32Array,r),Is=r=>Ae(Uint8Array,r),uf=r=>Ae(Uint16Array,r),ff=r=>Ae(Uint32Array,r),df=r=>Ae(Float32Array,r),hf=r=>Ae(Float64Array,r),pf=r=>Ae(Uint8ClampedArray,r);function me(r,t){return qt(this,arguments,function*(){if(Qt(t))return yield L(yield L(yield*ln(he(me(r,yield L(t))))));let n=function(s){return qt(this,arguments,function*(){yield yield L(yield L(s))})},i=function(s){return qt(this,arguments,function*(){yield L(yield*ln(he(_s(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vs?n(t):pe(t)?i(t):oe(t)?t:n(t);return yield L(yield*ln(he(_s(function(s){return qt(this,arguments,function*(){let a=null;do a=yield L(s.next(yield yield L(E(r,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield L(new r)})}var mf=r=>me(Int8Array,r),yf=r=>me(Int16Array,r),gf=r=>me(Int32Array,r),Ss=r=>me(Uint8Array,r),bf=r=>me(Uint16Array,r),wf=r=>me(Uint32Array,r),_f=r=>me(Float32Array,r),vf=r=>me(Float64Array,r),If=r=>me(Uint8ClampedArray,r);function Ki(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function xs(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var bt={fromIterable(r){return Zi(Sf(r))},fromAsyncIterable(r){return Zi(xf(r))},fromDOMStream(r){return Zi(Bf(r))},fromNodeStream(r){return Zi(Af(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Zi=r=>(r.next(),r);function*Sf(r){let t,e=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?te(n,s)[0]:([i,n,a]=te(n,s),i)}({cmd:o,size:s}=(yield(()=>null)())||{cmd:"read",size:0});let l=Is(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(f){(e=!0)&&typeof l.throw=="function"&&l.throw(f)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function xf(r){return qt(this,arguments,function*(){let e,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?te(i,a)[0]:([o,i,c]=te(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=Ss(r)[Symbol.asyncIterator]();try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.next()):yield L(f.next(a-c)),!e&&o.byteLength>0&&(i.push(o),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){(n=!0)&&typeof f.throw=="function"&&(yield L(f.throw(d)))}finally{n===!1&&typeof f.return=="function"&&(yield L(f.return(new Uint8Array(0))))}return yield L(null)})}function Bf(r){return qt(this,arguments,function*(){let e=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?te(i,a)[0]:([o,i,c]=te(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=new Ts(r);try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.read()):yield L(f.read(a-c)),!e&&o.byteLength>0&&(i.push(B(o)),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){(n=!0)&&(yield L(f.cancel(d)))}finally{n===!1?yield L(f.cancel()):r.locked&&f.releaseLock()}return yield L(null)})}var Ts=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return m(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return m(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=B(e)),e})}},As=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function Af(r){return qt(this,arguments,function*(){let e=[],n="error",i=!1,o=null,s,a,c=0,l=[],f;function d(){return s==="peek"?te(l,a)[0]:([f,l,c]=te(l,a),f)}if({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield L(new Uint8Array(0)),yield L(null);try{e[0]=As(r,"end"),e[1]=As(r,"error");do{if(e[2]=As(r,"readable"),[n,o]=yield L(Promise.race(e.map(N=>N[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(f=B(r.read(a-c)),f.byteLength<a-c&&(f=B(r.read()))):f=B(r.read()),f.byteLength>0&&(l.push(f),c+=f.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield L(d()));while(a<c)}while(!i)}finally{yield L(V(e,n==="error"?o:null))}return yield L(null);function V(N,st){return f=l=null,new Promise((yr,ws)=>{for(let[gr,Cu]of N)r.off(gr,Cu);try{let gr=r.destroy;gr&&gr.call(r,st),st=void 0}catch(gr){st=gr||st}finally{st!=null?ws(st):yr()}})}})}var z;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(z||(z={}));var Y;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Y||(Y={}));var P;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(P||(P={}));var J;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(J||(J={}));var h;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(h||(h={}));var Q;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Q||(Q={}));var Te=new Int32Array(2),Xi=new Float32Array(Te.buffer),qi=new Float64Array(Te.buffer),un=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hn;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Hn||(Hn={}));var Ft=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ft(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Te[0]=this.readInt32(t),Xi[0]}readFloat64(t){return Te[un?0:1]=this.readInt32(t),Te[un?1:0]=this.readInt32(t+4),qi[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){Xi[0]=e,this.writeInt32(t,Te[0])}writeFloat64(t,e){qi[0]=e,this.writeInt32(t,Te[un?0:1]),this.writeInt32(t+4,Te[un?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===Hn.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var tr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Ft.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=tr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=Ft.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let o=e;if(this.prep(this.minalign,4+4+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=4-1;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Jn;(function(r){r[r.BUFFER=0]="BUFFER"})(Jn||(Jn={}));var Kn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Kn||(Kn={}));var ge=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Kn.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Jn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Kn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Jn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return ge.startBodyCompression(t),ge.addCodec(t,e),ge.addMethod(t,n),ge.endBodyCompression(t)}};var fn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var dn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var It=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new It).__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):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new fn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new ge).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var ae=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new It).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var wr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(wr||(wr={}));var Zn;(function(r){r[r.DenseArray=0]="DenseArray"})(Zn||(Zn={}));var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return ht.startInt(t),ht.addBitWidth(t,e),ht.addIsSigned(t,n),ht.endInt(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new ee).__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):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ht).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Zn.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Zn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var K=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new K).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new K).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return K.startKeyValue(t),K.addKey(t,e),K.addValue(t,n),K.endKeyValue(t)}};var De=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return De.startBinary(t),De.endBinary(t)}};var Oe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Oe.startBool(t),Oe.endBool(t)}};var kt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):J.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,J.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return kt.startDate(t),kt.addUnit(t,e),kt.endDate(t)}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return pt.startDecimal(t),pt.addPrecision(t,e),pt.addScale(t,n),pt.addBitWidth(t,i),pt.endDecimal(t)}};var Pt=class{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 Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return Pt.startDuration(t),Pt.addUnit(t,e),Pt.endDuration(t)}};var Vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(t),Vt.addByteWidth(t,e),Vt.endFixedSizeBinary(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return jt.startFixedSizeList(t),jt.addListSize(t,e),jt.endFixedSizeList(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):P.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,P.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return zt.startFloatingPoint(t),zt.addPrecision(t,e),zt.endFloatingPoint(t)}};var Wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Q.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Q.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Wt.startInterval(t),Wt.addUnit(t,e),Wt.endInterval(t)}};var Fe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Fe.startLargeBinary(t),Fe.endLargeBinary(t)}};var Me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Me.startLargeUtf8(t),Me.endLargeUtf8(t)}};var Le=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Le.startList(t),Le.endList(t)}};var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Gt.startMap(t),Gt.addKeysSorted(t,e),Gt.endMap(t)}};var Ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ne.startNull(t),Ne.endNull(t)}};var Ue=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ue.startStruct_(t),Ue.endStruct_(t)}};var St=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return St.startTime(t),St.addUnit(t,e),St.addBitWidth(t,n),St.endTime(t)}};var xt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return xt.startTimestamp(t),xt.addUnit(t,e),xt.addTimezone(t,n),xt.endTimestamp(t)}};var mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Y.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return mt.startUnion(t),mt.addMode(t,e),mt.addTypeIds(t,n),mt.endUnion(t)}};var Ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ee.startUtf8(t),Ee.endUtf8(t)}};var H;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(H||(H={}));var at=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ee).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,H.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,wr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,o){return tt.startSchema(t),tt.addEndianness(t,e),tt.addFields(t,n),tt.addCustomMetadata(t,i),tt.addFeatures(t,o),tt.endSchema(t)}};var R;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(R||(R={}));var u;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(u||(u={}));var rt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(rt||(rt={}));var Hs={};br(Hs,{clampRange:()=>Qn,createElementComparator:()=>xr,wrapIndex:()=>Gr});var Ds={};br(Ds,{valueToString:()=>be});function be(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>be(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Ls={};br(Ls,{BN:()=>Lr,bigNumToBigInt:()=>rc,bigNumToNumber:()=>Ms,bigNumToString:()=>mn,isArrowBigNumSymbol:()=>ec});function C(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Os(r,t){return C(r/t)+C(r%t)/C(t)}var ec=Symbol.for("isArrowBigNum");function we(r,...t){return t.length===0?Object.setPrototypeOf(E(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}we.prototype[ec]=!0;we.prototype.toJSON=function(){return`"${mn(this)}"`};we.prototype.valueOf=function(r){return Ms(this,r)};we.prototype.toString=function(){return mn(this)};we.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Ms(this);case"string":return mn(this);case"default":return rc(this)}return mn(this)};function hn(...r){return we.apply(this,r)}function pn(...r){return we.apply(this,r)}function Xn(...r){return we.apply(this,r)}Object.setPrototypeOf(hn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(pn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Xn.prototype,Object.create(Uint32Array.prototype));Object.assign(hn.prototype,we.prototype,{constructor:hn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(pn.prototype,we.prototype,{constructor:pn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Xn.prototype,we.prototype,{constructor:Xn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Tf=BigInt(4294967296)*BigInt(4294967296),Df=Tf-BigInt(1);function Ms(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:o}=r,s=new BigUint64Array(e,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let f of s)c|=(f^Df)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let f of s)c|=f*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let f=BigInt(Math.pow(10,t)),d=c/f,V=c%f;return C(d)+C(V)/C(f)}return C(c)}function mn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Fs(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Fs(r);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Fs(t)}`}function rc(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:mn(r)}function Fs(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(e[0]=n[o=0];o<s;)n[o++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[o];n[o]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Lr=class{static new(t,e){switch(e){case!0:return new hn(t);case!1:return new pn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new hn(t)}return t.byteLength===16?new Xn(t):new pn(t)}static signed(t){return new hn(t)}static unsigned(t){return new pn(t)}static decimal(t){return new Xn(t)}constructor(t,e){return Lr.new(t,e)}};var nc,ic,oc,sc,ac,cc,lc,uc,fc,dc,hc,pc,mc,yc,gc,bc,wc,_c,vc,Ic,Sc,xc,p=class{static isNull(t){return t?.typeId===u.Null}static isInt(t){return t?.typeId===u.Int}static isFloat(t){return t?.typeId===u.Float}static isBinary(t){return t?.typeId===u.Binary}static isLargeBinary(t){return t?.typeId===u.LargeBinary}static isUtf8(t){return t?.typeId===u.Utf8}static isLargeUtf8(t){return t?.typeId===u.LargeUtf8}static isBool(t){return t?.typeId===u.Bool}static isDecimal(t){return t?.typeId===u.Decimal}static isDate(t){return t?.typeId===u.Date}static isTime(t){return t?.typeId===u.Time}static isTimestamp(t){return t?.typeId===u.Timestamp}static isInterval(t){return t?.typeId===u.Interval}static isDuration(t){return t?.typeId===u.Duration}static isList(t){return t?.typeId===u.List}static isStruct(t){return t?.typeId===u.Struct}static isUnion(t){return t?.typeId===u.Union}static isFixedSizeBinary(t){return t?.typeId===u.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===u.FixedSizeList}static isMap(t){return t?.typeId===u.Map}static isDictionary(t){return t?.typeId===u.Dictionary}static isDenseUnion(t){return p.isUnion(t)&&t.mode===Y.Dense}static isSparseUnion(t){return p.isUnion(t)&&t.mode===Y.Sparse}constructor(t){this.typeId=t}};nc=Symbol.toStringTag;p[nc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(p.prototype);var nt=class extends p{constructor(){super(u.Null)}toString(){return"Null"}};ic=Symbol.toStringTag;nt[ic]=(r=>r[Symbol.toStringTag]="Null")(nt.prototype);var et=class extends p{constructor(t,e){super(u.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};oc=Symbol.toStringTag;et[oc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(et.prototype);var Re=class extends et{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ce=class extends et{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},yt=class extends et{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ce=class extends et{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ke=class extends et{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Pe=class extends et{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ve=class extends et{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},je=class extends et{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Re.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ce.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(yt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ce.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(ke.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Pe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(je.prototype,"ArrayType",{value:BigUint64Array});var Mt=class extends p{constructor(t){super(u.Float),this.precision=t}get ArrayType(){switch(this.precision){case P.HALF:return Uint16Array;case P.SINGLE:return Float32Array;case P.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};sc=Symbol.toStringTag;Mt[sc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Mt.prototype);var _r=class extends Mt{constructor(){super(P.HALF)}},ze=class extends Mt{constructor(){super(P.SINGLE)}},le=class extends Mt{constructor(){super(P.DOUBLE)}};Object.defineProperty(_r.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(le.prototype,"ArrayType",{value:Float64Array});var re=class extends p{constructor(){super(u.Binary)}toString(){return"Binary"}};ac=Symbol.toStringTag;re[ac]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(re.prototype);var We=class extends p{constructor(){super(u.LargeBinary)}toString(){return"LargeBinary"}};cc=Symbol.toStringTag;We[cc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(We.prototype);var Lt=class extends p{constructor(){super(u.Utf8)}toString(){return"Utf8"}};lc=Symbol.toStringTag;Lt[lc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Lt.prototype);var Ge=class extends p{constructor(){super(u.LargeUtf8)}toString(){return"LargeUtf8"}};uc=Symbol.toStringTag;Ge[uc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Ge.prototype);var Nt=class extends p{constructor(){super(u.Bool)}toString(){return"Bool"}};fc=Symbol.toStringTag;Nt[fc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Nt.prototype);var ne=class extends p{constructor(t,e,n=128){super(u.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};dc=Symbol.toStringTag;ne[dc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ne.prototype);var $t=class extends p{constructor(t){super(u.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${J[this.unit]}>`}get ArrayType(){return this.unit===J.DAY?Int32Array:BigInt64Array}};hc=Symbol.toStringTag;$t[hc]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))($t.prototype);var Nr=class extends $t{constructor(){super(J.DAY)}},Ur=class extends $t{constructor(){super(J.MILLISECOND)}},Bt=class extends p{constructor(t,e){super(u.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${h[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};pc=Symbol.toStringTag;Bt[pc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Bt.prototype);var Er=class extends Bt{constructor(){super(h.SECOND,32)}},Rr=class extends Bt{constructor(){super(h.MILLISECOND,32)}},Cr=class extends Bt{constructor(){super(h.MICROSECOND,64)}},kr=class extends Bt{constructor(){super(h.NANOSECOND,64)}},At=class extends p{constructor(t,e){super(u.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${h[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};mc=Symbol.toStringTag;At[mc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(At.prototype);var Pr=class extends At{constructor(t){super(h.SECOND,t)}},er=class extends At{constructor(t){super(h.MILLISECOND,t)}},Vr=class extends At{constructor(t){super(h.MICROSECOND,t)}},jr=class extends At{constructor(t){super(h.NANOSECOND,t)}},Yt=class extends p{constructor(t){super(u.Interval),this.unit=t}toString(){return`Interval<${Q[this.unit]}>`}};yc=Symbol.toStringTag;Yt[yc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Yt.prototype);var zr=class extends Yt{constructor(){super(Q.DAY_TIME)}},Wr=class extends Yt{constructor(){super(Q.YEAR_MONTH)}},$e=class extends p{constructor(t){super(u.Duration),this.unit=t}toString(){return`Duration<${h[this.unit]}>`}};gc=Symbol.toStringTag;$e[gc]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))($e.prototype);var wt=class extends p{constructor(t){super(u.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};bc=Symbol.toStringTag;wt[bc]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(wt.prototype);var k=class extends p{constructor(t){super(u.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};wc=Symbol.toStringTag;k[wc]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(k.prototype);var ue=class extends p{constructor(t,e,n){super(u.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};_c=Symbol.toStringTag;ue[_c]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ue.prototype);var Ye=class extends p{constructor(t){super(u.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};vc=Symbol.toStringTag;Ye[vc]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ye.prototype);var Ut=class extends p{constructor(t,e){super(u.FixedSizeList),this.listSize=t,this.children=[e]}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}>`}};Ic=Symbol.toStringTag;Ut[Ic]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ut.prototype);var Et=class extends p{constructor(t,e=!1){var n,i,o;if(super(u.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Sc=Symbol.toStringTag;Et[Sc]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Et.prototype);var Of=(r=>()=>++r)(-1),Tt=class extends p{constructor(t,e,n,i){super(u.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?Of():C(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};xc=Symbol.toStringTag;Tt[xc]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Tt.prototype);function ie(r){let t=r;switch(r.typeId){case u.Decimal:return r.bitWidth/32;case u.Interval:return 1+t.unit;case u.FixedSizeList:return t.listSize;case u.FixedSizeBinary:return t.byteWidth;default:return 1}}var w=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Ff(this,t,e)}getVisitFnByTypeId(t,e=!0){return yn(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}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(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}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function Ff(r,t,e=!0){return typeof t=="number"?yn(r,t,e):typeof t=="string"&&t in u?yn(r,u[t],e):t&&t instanceof p?yn(r,Ac(t),e):t?.type&&t.type instanceof p?yn(r,Ac(t.type),e):yn(r,u.NONE,e)}function yn(r,t,e=!0){let n=null;switch(t){case u.Null:n=r.visitNull;break;case u.Bool:n=r.visitBool;break;case u.Int:n=r.visitInt;break;case u.Int8:n=r.visitInt8||r.visitInt;break;case u.Int16:n=r.visitInt16||r.visitInt;break;case u.Int32:n=r.visitInt32||r.visitInt;break;case u.Int64:n=r.visitInt64||r.visitInt;break;case u.Uint8:n=r.visitUint8||r.visitInt;break;case u.Uint16:n=r.visitUint16||r.visitInt;break;case u.Uint32:n=r.visitUint32||r.visitInt;break;case u.Uint64:n=r.visitUint64||r.visitInt;break;case u.Float:n=r.visitFloat;break;case u.Float16:n=r.visitFloat16||r.visitFloat;break;case u.Float32:n=r.visitFloat32||r.visitFloat;break;case u.Float64:n=r.visitFloat64||r.visitFloat;break;case u.Utf8:n=r.visitUtf8;break;case u.LargeUtf8:n=r.visitLargeUtf8;break;case u.Binary:n=r.visitBinary;break;case u.LargeBinary:n=r.visitLargeBinary;break;case u.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case u.Date:n=r.visitDate;break;case u.DateDay:n=r.visitDateDay||r.visitDate;break;case u.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case u.Timestamp:n=r.visitTimestamp;break;case u.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case u.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case u.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case u.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case u.Time:n=r.visitTime;break;case u.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case u.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case u.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case u.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case u.Decimal:n=r.visitDecimal;break;case u.List:n=r.visitList;break;case u.Struct:n=r.visitStruct;break;case u.Union:n=r.visitUnion;break;case u.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case u.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case u.Dictionary:n=r.visitDictionary;break;case u.Interval:n=r.visitInterval;break;case u.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case u.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case u.Duration:n=r.visitDuration;break;case u.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case u.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case u.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case u.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case u.FixedSizeList:n=r.visitFixedSizeList;break;case u.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${u[t]}'`)}function Ac(r){switch(r.typeId){case u.Null:return u.Null;case u.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?u.Int8:u.Uint8;case 16:return e?u.Int16:u.Uint16;case 32:return e?u.Int32:u.Uint32;case 64:return e?u.Int64:u.Uint64}return u.Int}case u.Float:switch(r.precision){case P.HALF:return u.Float16;case P.SINGLE:return u.Float32;case P.DOUBLE:return u.Float64}return u.Float;case u.Binary:return u.Binary;case u.LargeBinary:return u.LargeBinary;case u.Utf8:return u.Utf8;case u.LargeUtf8:return u.LargeUtf8;case u.Bool:return u.Bool;case u.Decimal:return u.Decimal;case u.Time:switch(r.unit){case h.SECOND:return u.TimeSecond;case h.MILLISECOND:return u.TimeMillisecond;case h.MICROSECOND:return u.TimeMicrosecond;case h.NANOSECOND:return u.TimeNanosecond}return u.Time;case u.Timestamp:switch(r.unit){case h.SECOND:return u.TimestampSecond;case h.MILLISECOND:return u.TimestampMillisecond;case h.MICROSECOND:return u.TimestampMicrosecond;case h.NANOSECOND:return u.TimestampNanosecond}return u.Timestamp;case u.Date:switch(r.unit){case J.DAY:return u.DateDay;case J.MILLISECOND:return u.DateMillisecond}return u.Date;case u.Interval:switch(r.unit){case Q.DAY_TIME:return u.IntervalDayTime;case Q.YEAR_MONTH:return u.IntervalYearMonth}return u.Interval;case u.Duration:switch(r.unit){case h.SECOND:return u.DurationSecond;case h.MILLISECOND:return u.DurationMillisecond;case h.MICROSECOND:return u.DurationMicrosecond;case h.NANOSECOND:return u.DurationNanosecond}return u.Duration;case u.Map:return u.Map;case u.List:return u.List;case u.Struct:return u.Struct;case u.Union:switch(r.mode){case Y.Dense:return u.DenseUnion;case Y.Sparse:return u.SparseUnion}return u.Union;case u.FixedSizeBinary:return u.FixedSizeBinary;case u.FixedSizeList:return u.FixedSizeList;case u.Dictionary:return u.Dictionary}throw new Error(`Unrecognized type '${u[r.typeId]}'`)}w.prototype.visitInt8=null;w.prototype.visitInt16=null;w.prototype.visitInt32=null;w.prototype.visitInt64=null;w.prototype.visitUint8=null;w.prototype.visitUint16=null;w.prototype.visitUint32=null;w.prototype.visitUint64=null;w.prototype.visitFloat16=null;w.prototype.visitFloat32=null;w.prototype.visitFloat64=null;w.prototype.visitDateDay=null;w.prototype.visitDateMillisecond=null;w.prototype.visitTimestampSecond=null;w.prototype.visitTimestampMillisecond=null;w.prototype.visitTimestampMicrosecond=null;w.prototype.visitTimestampNanosecond=null;w.prototype.visitTimeSecond=null;w.prototype.visitTimeMillisecond=null;w.prototype.visitTimeMicrosecond=null;w.prototype.visitTimeNanosecond=null;w.prototype.visitDenseUnion=null;w.prototype.visitSparseUnion=null;w.prototype.visitIntervalDayTime=null;w.prototype.visitIntervalYearMonth=null;w.prototype.visitDuration=null;w.prototype.visitDurationSecond=null;w.prototype.visitDurationMillisecond=null;w.prototype.visitDurationMicrosecond=null;w.prototype.visitDurationNanosecond=null;var Ns={};br(Ns,{float64ToUint16:()=>qn,uint16ToFloat64:()=>to});var Tc=new Float64Array(1),gn=new Uint32Array(Tc.buffer);function to(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function qn(r){if(r!==r)return 32256;Tc[0]=r;let t=(gn[1]&2147483648)>>16&65535,e=gn[1]&2146435072,n=0;return e>=1089470464?gn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(gn[1]&1048575)>>10):e<=1056964608?(n=1048576+(gn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(gn[1]&1048575)+512>>10),t|e|n&65535}var x=class extends w{};function D(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var Mf=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Dc=(r,t,e,n)=>{if(e+1<t.length){let i=C(t[e]),o=C(t[e+1]);r.set(n.subarray(0,o-i),i)}},Lf=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},rr=({values:r},t,e)=>{r[t]=e},Us=({values:r},t,e)=>{r[t]=e},Oc=({values:r},t,e)=>{r[t]=qn(e)},Nf=(r,t,e)=>{switch(r.type.precision){case P.HALF:return Oc(r,t,e);case P.SINGLE:case P.DOUBLE:return Us(r,t,e)}},eo=({values:r},t,e)=>{Mf(r,t,e.valueOf())},ro=({values:r},t,e)=>{r[t]=BigInt(e)},Es=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Fc=({values:r,valueOffsets:t},e,n)=>Dc(r,t,e,n),Mc=({values:r,valueOffsets:t},e,n)=>Dc(r,t,e,Be(n)),Rs=(r,t,e)=>{r.type.unit===J.DAY?eo(r,t,e):ro(r,t,e)},no=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},io=({values:r},t,e)=>{r[t]=BigInt(e)},oo=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},so=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Cs=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return no(r,t,e);case h.MILLISECOND:return io(r,t,e);case h.MICROSECOND:return oo(r,t,e);case h.NANOSECOND:return so(r,t,e)}},ao=({values:r},t,e)=>{r[t]=e},co=({values:r},t,e)=>{r[t]=e},lo=({values:r},t,e)=>{r[t]=e},uo=({values:r},t,e)=>{r[t]=e},ks=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return ao(r,t,e);case h.MILLISECOND:return co(r,t,e);case h.MICROSECOND:return lo(r,t,e);case h.NANOSECOND:return uo(r,t,e)}},Ps=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Uf=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,o=_t.getVisitFn(n);if(Array.isArray(e))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e.get(++s))},Ef=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,o=_t.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(o(n,s,l),++s>=a)break},Rf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[o]),Cf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(o)),kf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(i.name)),Pf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[i.name]),Vf=(r,t,e)=>{let n=r.type.children.map(o=>_t.getVisitFn(o.type)),i=e instanceof Map?kf(t,e):e instanceof y?Cf(t,e):Array.isArray(e)?Rf(t,e):Pf(t,e);r.type.children.forEach((o,s)=>i(n[s],r.children[s],o,s))},jf=(r,t,e)=>{r.type.mode===Y.Dense?Lc(r,t,e):Nc(r,t,e)},Lc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,r.valueOffsets[t],e)},Nc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,t,e)},zf=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Vs=(r,t,e)=>{r.type.unit===Q.DAY_TIME?fo(r,t,e):ho(r,t,e)},fo=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},ho=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},po=({values:r},t,e)=>{r[t]=e},mo=({values:r},t,e)=>{r[t]=e},yo=({values:r},t,e)=>{r[t]=e},go=({values:r},t,e)=>{r[t]=e},js=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return po(r,t,e);case h.MILLISECOND:return mo(r,t,e);case h.MICROSECOND:return yo(r,t,e);case h.NANOSECOND:return go(r,t,e)}},Wf=(r,t,e)=>{let{stride:n}=r,i=r.children[0],o=_t.getVisitFn(i);if(Array.isArray(e))for(let s=-1,a=t*n;++s<n;)o(i,a+s,e[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,e.get(s))};x.prototype.visitBool=D(Lf);x.prototype.visitInt=D(rr);x.prototype.visitInt8=D(rr);x.prototype.visitInt16=D(rr);x.prototype.visitInt32=D(rr);x.prototype.visitInt64=D(rr);x.prototype.visitUint8=D(rr);x.prototype.visitUint16=D(rr);x.prototype.visitUint32=D(rr);x.prototype.visitUint64=D(rr);x.prototype.visitFloat=D(Nf);x.prototype.visitFloat16=D(Oc);x.prototype.visitFloat32=D(Us);x.prototype.visitFloat64=D(Us);x.prototype.visitUtf8=D(Mc);x.prototype.visitLargeUtf8=D(Mc);x.prototype.visitBinary=D(Fc);x.prototype.visitLargeBinary=D(Fc);x.prototype.visitFixedSizeBinary=D(Es);x.prototype.visitDate=D(Rs);x.prototype.visitDateDay=D(eo);x.prototype.visitDateMillisecond=D(ro);x.prototype.visitTimestamp=D(Cs);x.prototype.visitTimestampSecond=D(no);x.prototype.visitTimestampMillisecond=D(io);x.prototype.visitTimestampMicrosecond=D(oo);x.prototype.visitTimestampNanosecond=D(so);x.prototype.visitTime=D(ks);x.prototype.visitTimeSecond=D(ao);x.prototype.visitTimeMillisecond=D(co);x.prototype.visitTimeMicrosecond=D(lo);x.prototype.visitTimeNanosecond=D(uo);x.prototype.visitDecimal=D(Ps);x.prototype.visitList=D(Uf);x.prototype.visitStruct=D(Vf);x.prototype.visitUnion=D(jf);x.prototype.visitDenseUnion=D(Lc);x.prototype.visitSparseUnion=D(Nc);x.prototype.visitDictionary=D(zf);x.prototype.visitInterval=D(Vs);x.prototype.visitIntervalDayTime=D(fo);x.prototype.visitIntervalYearMonth=D(ho);x.prototype.visitDuration=D(js);x.prototype.visitDurationSecond=D(po);x.prototype.visitDurationMillisecond=D(mo);x.prototype.visitDurationMicrosecond=D(yo);x.prototype.visitDurationNanosecond=D(go);x.prototype.visitFixedSizeList=D(Wf);x.prototype.visitMap=D(Ef);var _t=new x;var _e=Symbol.for("parent"),bn=Symbol.for("rowIndex"),vr=class{constructor(t,e){return this[_e]=t,this[bn]=e,new Proxy(this,new Ws)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[bn],e=this[_e],n=e.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=ct.visit(e.children[o],t);return i}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new zs(this[_e],this[bn])}},zs=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ct.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(vr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_e]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Ws=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_e].type.children.map(e=>e.name)}has(t,e){return t[_e].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[_e].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[_e].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=ct.visit(t[_e].children[n],t[bn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[_e].type.children.findIndex(o=>o.name===e);return i!==-1?(_t.visit(t[_e].children[i],t[bn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var _=class extends w{};function A(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Gf=(r,t)=>864e5*r[t],$f=(r,t)=>null,Uc=(r,t,e)=>{if(e+1>=t.length)return null;let n=C(t[e]),i=C(t[e+1]);return r.subarray(n,i)},Yf=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Ec=({values:r},t)=>Gf(r,t),Rc=({values:r},t)=>C(r[t]),Ir=({stride:r,values:t},e)=>t[r*e],Hf=({stride:r,values:t},e)=>to(t[r*e]),Cc=({values:r},t)=>r[t],Jf=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),kc=({values:r,valueOffsets:t},e)=>Uc(r,t,e),Pc=({values:r,valueOffsets:t},e)=>{let n=Uc(r,t,e);return n!==null?Gn(n):null},Kf=({values:r},t)=>r[t],Zf=({type:r,values:t},e)=>r.precision!==P.HALF?t[e]:to(t[e]),Xf=(r,t)=>r.type.unit===J.DAY?Ec(r,t):Rc(r,t),Vc=({values:r},t)=>1e3*C(r[t]),jc=({values:r},t)=>C(r[t]),zc=({values:r},t)=>Os(r[t],BigInt(1e3)),Wc=({values:r},t)=>Os(r[t],BigInt(1e6)),qf=(r,t)=>{switch(r.type.unit){case h.SECOND:return Vc(r,t);case h.MILLISECOND:return jc(r,t);case h.MICROSECOND:return zc(r,t);case h.NANOSECOND:return Wc(r,t)}},Gc=({values:r},t)=>r[t],$c=({values:r},t)=>r[t],Yc=({values:r},t)=>r[t],Hc=({values:r},t)=>r[t],Qf=(r,t)=>{switch(r.type.unit){case h.SECOND:return Gc(r,t);case h.MILLISECOND:return $c(r,t);case h.MICROSECOND:return Yc(r,t);case h.NANOSECOND:return Hc(r,t)}},td=({values:r,stride:t},e)=>Lr.decimal(r.subarray(t*e,t*(e+1))),ed=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:o,[t*n+1]:s}=e,c=i[0].slice(o,s-o);return new y([c])},rd=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:o}=e,s=n[0];return new He(s.slice(i,o-i))},nd=(r,t)=>new vr(r,t),id=(r,t)=>r.type.mode===Y.Dense?Jc(r,t):Kc(r,t),Jc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,r.valueOffsets[t])},Kc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,t)},od=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},sd=(r,t)=>r.type.unit===Q.DAY_TIME?Zc(r,t):Xc(r,t),Zc=({values:r},t)=>r.subarray(2*t,2*(t+1)),Xc=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},qc=({values:r},t)=>r[t],Qc=({values:r},t)=>r[t],tl=({values:r},t)=>r[t],el=({values:r},t)=>r[t],ad=(r,t)=>{switch(r.type.unit){case h.SECOND:return qc(r,t);case h.MILLISECOND:return Qc(r,t);case h.MICROSECOND:return tl(r,t);case h.NANOSECOND:return el(r,t)}},cd=(r,t)=>{let{stride:e,children:n}=r,o=n[0].slice(t*e,e);return new y([o])};_.prototype.visitNull=A($f);_.prototype.visitBool=A(Yf);_.prototype.visitInt=A(Kf);_.prototype.visitInt8=A(Ir);_.prototype.visitInt16=A(Ir);_.prototype.visitInt32=A(Ir);_.prototype.visitInt64=A(Cc);_.prototype.visitUint8=A(Ir);_.prototype.visitUint16=A(Ir);_.prototype.visitUint32=A(Ir);_.prototype.visitUint64=A(Cc);_.prototype.visitFloat=A(Zf);_.prototype.visitFloat16=A(Hf);_.prototype.visitFloat32=A(Ir);_.prototype.visitFloat64=A(Ir);_.prototype.visitUtf8=A(Pc);_.prototype.visitLargeUtf8=A(Pc);_.prototype.visitBinary=A(kc);_.prototype.visitLargeBinary=A(kc);_.prototype.visitFixedSizeBinary=A(Jf);_.prototype.visitDate=A(Xf);_.prototype.visitDateDay=A(Ec);_.prototype.visitDateMillisecond=A(Rc);_.prototype.visitTimestamp=A(qf);_.prototype.visitTimestampSecond=A(Vc);_.prototype.visitTimestampMillisecond=A(jc);_.prototype.visitTimestampMicrosecond=A(zc);_.prototype.visitTimestampNanosecond=A(Wc);_.prototype.visitTime=A(Qf);_.prototype.visitTimeSecond=A(Gc);_.prototype.visitTimeMillisecond=A($c);_.prototype.visitTimeMicrosecond=A(Yc);_.prototype.visitTimeNanosecond=A(Hc);_.prototype.visitDecimal=A(td);_.prototype.visitList=A(ed);_.prototype.visitStruct=A(nd);_.prototype.visitUnion=A(id);_.prototype.visitDenseUnion=A(Jc);_.prototype.visitSparseUnion=A(Kc);_.prototype.visitDictionary=A(od);_.prototype.visitInterval=A(sd);_.prototype.visitIntervalDayTime=A(Zc);_.prototype.visitIntervalYearMonth=A(Xc);_.prototype.visitDuration=A(ad);_.prototype.visitDurationSecond=A(qc);_.prototype.visitDurationMillisecond=A(Qc);_.prototype.visitDurationMicrosecond=A(tl);_.prototype.visitDurationNanosecond=A(el);_.prototype.visitFixedSizeList=A(cd);_.prototype.visitMap=A(rd);var ct=new _;var Sr=Symbol.for("keys"),_n=Symbol.for("vals"),wn=Symbol.for("kKeysAsStrings"),Gs=Symbol.for("_kKeysAsStrings"),He=class{constructor(t){return this[Sr]=new y([t.children[0]]).memoize(),this[_n]=t.children[1],new Proxy(this,new Ys)}get[wn](){return this[Gs]||(this[Gs]=Array.from(this[Sr].toArray(),String))}[Symbol.iterator](){return new $s(this[Sr],this[_n])}get size(){return this[Sr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Sr],e=this[_n],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=ct.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},$s=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ct.visit(this.vals,t)]})}},Ys=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wn]}has(t,e){return t[wn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[wn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[wn].indexOf(e);if(n!==-1){let i=ct.visit(Reflect.get(t,_n),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[wn].indexOf(e);return i!==-1?(_t.visit(Reflect.get(t,_n),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(He.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Sr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_n]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Gs]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var rl;function Qn(r,t,e,n){let{length:i=0}=r,o=typeof t!="number"?0:t,s=typeof e!="number"?i:e;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(rl=o,o=s,s=rl),s>i&&(s=i),n?n(r,o,s):[o,s]}var Gr=(r,t)=>r<0?t+r:r,nl=r=>r!==r;function xr(r){if(typeof r!=="object"||r===null)return nl(r)?nl:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?xs(r,e):!1:r instanceof Map?ud(r):Array.isArray(r)?ld(r):r instanceof y?fd(r):dd(r,!0)}function ld(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r[e]);return bo(t)}function ud(r){let t=-1,e=[];for(let n of r.values())e[++t]=xr(n);return bo(e)}function fd(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r.get(e));return bo(t)}function dd(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,o=e.length;++i<o;)n[i]=xr(r[e[i]]);return bo(n,e)}function bo(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return hd(r,e);case Map:return il(r,e,e.keys());case He:case vr:case Object:case void 0:return il(r,e,t||Object.keys(e))}return e instanceof y?pd(r,e):!1}}function hd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function pd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function il(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=r.length,c=o.next(),l=n.next(),f=i.next();for(;s<a&&!l.done&&!f.done&&!c.done&&!(l.value!==f.value||!r[s](c.value));++s,l=n.next(),f=i.next(),c=o.next());return s===a&&l.done&&f.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var Js={};br(Js,{BitIterator:()=>$r,getBit:()=>ol,getBool:()=>_o,packBools:()=>Hr,popcnt_array:()=>sl,popcnt_bit_range:()=>ti,popcnt_uint32:()=>wo,setBool:()=>md,truncateBitmap:()=>Yr});function _o(r,t,e,n){return(e&1<<n)!==0}function ol(r,t,e,n){return(e&1<<n)>>n}function md(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Yr(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Hr(new $r(e,r,t,null,_o)).subarray(0,n)),i}return e}function Hr(r){let t=[],e=0,n=0,i=0;for(let s of r)s&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var $r=class{constructor(t,e,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ti(r,t,e){if(e-t<=0)return 0;if(e-t<8){let o=0;for(let s of new $r(r,t,e-t,r,ol))o+=s;return o}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ti(r,t,i)+ti(r,n,e)+sl(r,i>>3,n-i>>3)}function sl(r,t,e){let n=0,i=Math.trunc(t),o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=e===void 0?r.byteLength:i+e;for(;s-i>=4;)n+=wo(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=wo(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=wo(o.getUint8(i)),i+=1;return n}function wo(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var yd=-1,M=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return p.isSparseUnion(t)?this.children.some(e=>e.nullable):p.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(p.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=yd&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ti(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof M?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=ie(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(p.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Y.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(p.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Y.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,e)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,f=c>>3;(!o||o.byteLength<=f)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Yr(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let d=o[f];n=(d&l)!==0,o[f]=e?d|l:d&~l}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new M(t,e,n,i,o,s,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===u.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Yr(this.offset,e,this.nullBitmap),0);let o=this.buffers;return o[rt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),o)}_sliceBuffers(t,e,n,i){let o,{buffers:s}=this;return(o=s[rt.TYPE])&&(s[rt.TYPE]=o.subarray(t,t+e)),(o=s[rt.OFFSET])&&(s[rt.OFFSET]=o.subarray(t,t+e+1))||(o=s[rt.DATA])&&(s[rt.DATA]=i===6?o:o.subarray(n*t,n*(t+e))),s}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};M.prototype.children=Object.freeze([]);var Jr=class extends w{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new M(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Ji(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Ji(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=B(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=E(e.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(p.isSparseUnion(e))return new M(e,n,s,a,[void 0,void 0,void 0,o],i);let c=Mr(t.valueOffsets);return new M(e,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.indices.ArrayType,t.data),{["dictionary"]:s=new y([new Jr().visit({type:e.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.valueType})}=t,o=B(t.nullBitmap),{["length"]:s=i.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.childType})}=t,o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,void 0,o],[i])}},gd=new Jr;function b(r){return gd.visit(r)}var ei=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function al(r){return r.some(t=>t.nullable)}function vo(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Io(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function So(r,t,e,n){let i=[];for(let o=-1,s=r.length;++o<s;){let a=r[o],c=t[o],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let f=Math.max(0,e-c),d=Math.min(n-c,l);i.push(a.slice(f,d-f))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ks(r,t,e,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return e<t[s]?n(r,i,e-t[i]):null;o=i+Math.trunc((s-i)*.5),e<t[o]?s=o:i=o}while(i<s)}function ri(r,t){return r.getValid(t)}function vn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ks(n,this._offsets,e,t)}}function xo(r){let t;function e(n,i,o){return r(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=Ks(o,this._offsets,n,e);return t=void 0,s}}function Bo(r){let t;function e(n,i,o){let s=o,a=0,c=0;for(let l=i-1,f=n.length;++l<f;){let d=n[l];if(~(a=r(d,t,s)))return c+a;s=0,c+=d.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?e(o,0,0):Ks(o,this._offsets,i,e);return t=void 0,s}}var v=class extends w{};function bd(r,t){return t===null&&r.length>0?0:-1}function wd(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new $r(e,r.offset+(t||0),r.length,e,_o)){if(!i)return n;++n}return-1}function F(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case u.Union:break;case u.Dictionary:break;default:return wd(r,e)}let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}function cl(r,t,e){let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}v.prototype.visitNull=bd;v.prototype.visitBool=F;v.prototype.visitInt=F;v.prototype.visitInt8=F;v.prototype.visitInt16=F;v.prototype.visitInt32=F;v.prototype.visitInt64=F;v.prototype.visitUint8=F;v.prototype.visitUint16=F;v.prototype.visitUint32=F;v.prototype.visitUint64=F;v.prototype.visitFloat=F;v.prototype.visitFloat16=F;v.prototype.visitFloat32=F;v.prototype.visitFloat64=F;v.prototype.visitUtf8=F;v.prototype.visitLargeUtf8=F;v.prototype.visitBinary=F;v.prototype.visitLargeBinary=F;v.prototype.visitFixedSizeBinary=F;v.prototype.visitDate=F;v.prototype.visitDateDay=F;v.prototype.visitDateMillisecond=F;v.prototype.visitTimestamp=F;v.prototype.visitTimestampSecond=F;v.prototype.visitTimestampMillisecond=F;v.prototype.visitTimestampMicrosecond=F;v.prototype.visitTimestampNanosecond=F;v.prototype.visitTime=F;v.prototype.visitTimeSecond=F;v.prototype.visitTimeMillisecond=F;v.prototype.visitTimeMicrosecond=F;v.prototype.visitTimeNanosecond=F;v.prototype.visitDecimal=F;v.prototype.visitList=F;v.prototype.visitStruct=F;v.prototype.visitUnion=F;v.prototype.visitDenseUnion=cl;v.prototype.visitSparseUnion=cl;v.prototype.visitDictionary=F;v.prototype.visitInterval=F;v.prototype.visitIntervalDayTime=F;v.prototype.visitIntervalYearMonth=F;v.prototype.visitDuration=F;v.prototype.visitDurationSecond=F;v.prototype.visitDurationMillisecond=F;v.prototype.visitDurationMicrosecond=F;v.prototype.visitDurationNanosecond=F;v.prototype.visitFixedSizeList=F;v.prototype.visitMap=F;var Kr=new v;var I=class extends w{};function T(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(p.isInt(t)&&t.bitWidth!==64||p.isTime(t)&&t.bitWidth!==64||p.isFloat(t)&&t.precision!==P.HALF))return new ei(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ei(r.data.length,n=>{let o=r.data[n].length,s=r.slice(e,e+o);return e+=o,new Zs(s)})}var Zs=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};I.prototype.visitNull=T;I.prototype.visitBool=T;I.prototype.visitInt=T;I.prototype.visitInt8=T;I.prototype.visitInt16=T;I.prototype.visitInt32=T;I.prototype.visitInt64=T;I.prototype.visitUint8=T;I.prototype.visitUint16=T;I.prototype.visitUint32=T;I.prototype.visitUint64=T;I.prototype.visitFloat=T;I.prototype.visitFloat16=T;I.prototype.visitFloat32=T;I.prototype.visitFloat64=T;I.prototype.visitUtf8=T;I.prototype.visitLargeUtf8=T;I.prototype.visitBinary=T;I.prototype.visitLargeBinary=T;I.prototype.visitFixedSizeBinary=T;I.prototype.visitDate=T;I.prototype.visitDateDay=T;I.prototype.visitDateMillisecond=T;I.prototype.visitTimestamp=T;I.prototype.visitTimestampSecond=T;I.prototype.visitTimestampMillisecond=T;I.prototype.visitTimestampMicrosecond=T;I.prototype.visitTimestampNanosecond=T;I.prototype.visitTime=T;I.prototype.visitTimeSecond=T;I.prototype.visitTimeMillisecond=T;I.prototype.visitTimeMicrosecond=T;I.prototype.visitTimeNanosecond=T;I.prototype.visitDecimal=T;I.prototype.visitList=T;I.prototype.visitStruct=T;I.prototype.visitUnion=T;I.prototype.visitDenseUnion=T;I.prototype.visitSparseUnion=T;I.prototype.visitDictionary=T;I.prototype.visitInterval=T;I.prototype.visitIntervalDayTime=T;I.prototype.visitIntervalYearMonth=T;I.prototype.visitDuration=T;I.prototype.visitDurationSecond=T;I.prototype.visitDurationMillisecond=T;I.prototype.visitDurationMicrosecond=T;I.prototype.visitDurationNanosecond=T;I.prototype.visitFixedSizeList=T;I.prototype.visitMap=T;var In=new I;var ll,ul={},fl={},y=class{constructor(t){var e,n,i;let o=t[0]instanceof y?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof M)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(e=o[0])===null||e===void 0?void 0:e.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=ul[s.typeId],f=o[0];this.isValid=d=>ri(f,d),this.get=d=>a(f,d),this.set=(d,V)=>c(f,d,V),this.indexOf=d=>l(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,fl[s.typeId]),this._offsets=Io(o);break}this.data=o,this.type=s,this.stride=ie(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return al(this.data)}get nullCount(){return vo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${u[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return In.visit(this)}concat(...t){return new y(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new y(Qn(this,t,e,({data:n,_offsets:i},o,s)=>So(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case u.Int:case u.Float:case u.Decimal:case u.Time:case u.Timestamp:switch(e.length){case 0:return new o;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new y(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return p.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(p.isDictionary(this.type)){let t=new Sn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return new Sn(this)}unmemoize(){if(p.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return this}};ll=Symbol.toStringTag;y[ll]=(r=>{r.type=p.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(u).map(e=>u[e]).filter(e=>typeof e=="number"&&e!==u.NONE);for(let e of t){let n=ct.getVisitFnByTypeId(e),i=_t.getVisitFnByTypeId(e),o=Kr.getVisitFnByTypeId(e);ul[e]={get:n,set:i,indexOf:o},fl[e]=Object.create(r,{isValid:{value:vn(ri)},get:{value:vn(ct.getVisitFnByTypeId(e))},set:{value:xo(_t.getVisitFnByTypeId(e))},indexOf:{value:Bo(Kr.getVisitFnByTypeId(e))}})}return"Vector"})(y.prototype);var Sn=class extends y{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=e.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new Sn(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new y(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function xn(r){if(r){if(r instanceof M)return new y([r]);if(r instanceof y)return new y(r.data);if(r.type instanceof p)return new y([b(r)]);if(Array.isArray(r))return new y(r.flatMap(t=>_d(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new y([b(Object.assign(Object.assign({},t),{type:new Re}))]);if(r instanceof Int16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ce}))]);if(r instanceof Int32Array)return new y([b(Object.assign(Object.assign({},t),{type:new yt}))]);if(r instanceof BigInt64Array)return new y([b(Object.assign(Object.assign({},t),{type:new ce}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new y([b(Object.assign(Object.assign({},t),{type:new ke}))]);if(r instanceof Uint16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Pe}))]);if(r instanceof Uint32Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ve}))]);if(r instanceof BigUint64Array)return new y([b(Object.assign(Object.assign({},t),{type:new je}))]);if(r instanceof Float32Array)return new y([b(Object.assign(Object.assign({},t),{type:new ze}))]);if(r instanceof Float64Array)return new y([b(Object.assign(Object.assign({},t),{type:new le}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function _d(r){return r instanceof M?[r]:r instanceof y?r.data:xn(r).data}function dl(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
7
+ "use strict";var __exports__=(()=>{var rf=Object.create;var Jn=Object.defineProperty;var nf=Object.getOwnPropertyDescriptor;var of=Object.getOwnPropertyNames;var sf=Object.getPrototypeOf,af=Object.prototype.hasOwnProperty;var cf=(r,t,e)=>t in r?Jn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var lf=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),rr=(r,t)=>{for(var e in t)Jn(r,e,{get:t[e],enumerable:!0})},Wi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of of(t))!af.call(r,i)&&i!==e&&Jn(r,i,{get:()=>t[i],enumerable:!(n=nf(t,i))||n.enumerable});return r},Gi=(r,t,e)=>(Wi(r,t,"default"),e&&Wi(e,t,"default")),uf=(r,t,e)=>(e=r!=null?rf(sf(r)):{},Wi(t||!r||!r.__esModule?Jn(e,"default",{value:r,enumerable:!0}):e,r)),ff=r=>Wi(Jn({},"__esModule",{value:!0}),r);var rc=(r,t,e)=>(cf(r,typeof t!="symbol"?t+"":t,e),e);var ic=lf((Hp,nc)=>{nc.exports=globalThis.loaders});var zi={};rr(zi,{ArrowFormat:()=>oc,ArrowLoader:()=>Du,ArrowWorkerLoader:()=>fn,ArrowWriter:()=>Ou,GeoArrowLoader:()=>qu,GeoArrowWorkerLoader:()=>_s,TriangulationWorker:()=>Bs,VECTOR_TYPES:()=>Nr,hardClone:()=>ji,parseGeoArrowOnWorker:()=>tf,triangulateOnWorker:()=>Qu});Gi(zi,uf(ic(),1));var Nr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(Nr||(Nr={}));var oc={name:"Apache Arrow",id:"arrow",module:"arrow",category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"]};var df="4.4.0",fn={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:df,category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"],options:{arrow:{shape:"columnar-table"}}};function ac(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function m(r,t,e,n){function i(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(f){try{l(n.next(f))}catch(d){s(d)}}function c(f){try{l(n.throw(f))}catch(d){s(d)}}function l(f){f.done?o(f.value):i(f.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function sc(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(r){return this instanceof L?(this.v=r,this):new L(r)}function te(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(D){return function(tt){return Promise.resolve(tt).then(D,d)}}function a(D,tt){n[D]&&(i[D]=function(ae){return new Promise(function(xs,wr){o.push([D,ae,xs,wr])>1||c(D,ae)})},tt&&(i[D]=tt(i[D])))}function c(D,tt){try{l(n[D](tt))}catch(ae){R(o[0][3],ae)}}function l(D){D.value instanceof L?Promise.resolve(D.value.v).then(f,d):R(o[0][2],D)}function f(D){c("next",D)}function d(D){c("throw",D)}function R(D,tt){D(tt),o.shift(),o.length&&c(o[0][0],o[0][1])}}function dn(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=r[i]?function(s){return(e=!e)?{value:L(r[i](s)),done:!1}:o?o(s):s}:o}}function ye(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof sc=="function"?sc(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(o){e[o]=r[o]&&function(s){return new Promise(function(a,c){s=r[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Ms={};rr(Ms,{compareArrayLike:()=>Fs,joinUint8Arrays:()=>re,memcpy:()=>Xn,rebaseValueOffsets:()=>qi,toArrayBufferView:()=>E,toArrayBufferViewAsyncIterator:()=>be,toArrayBufferViewIterator:()=>De,toBigInt64Array:()=>Xi,toBigUint64Array:()=>_f,toFloat32Array:()=>vf,toFloat32ArrayAsyncIterator:()=>Cf,toFloat32ArrayIterator:()=>Of,toFloat64Array:()=>If,toFloat64ArrayAsyncIterator:()=>Pf,toFloat64ArrayIterator:()=>Ff,toInt16Array:()=>gf,toInt16ArrayAsyncIterator:()=>Lf,toInt16ArrayIterator:()=>xf,toInt32Array:()=>Lr,toInt32ArrayAsyncIterator:()=>Uf,toInt32ArrayIterator:()=>Af,toInt8Array:()=>yf,toInt8ArrayAsyncIterator:()=>Nf,toInt8ArrayIterator:()=>Bf,toUint16Array:()=>bf,toUint16ArrayAsyncIterator:()=>Ef,toUint16ArrayIterator:()=>Tf,toUint32Array:()=>wf,toUint32ArrayAsyncIterator:()=>Rf,toUint32ArrayIterator:()=>Df,toUint8Array:()=>x,toUint8ArrayAsyncIterator:()=>Os,toUint8ArrayIterator:()=>Ds,toUint8ClampedArray:()=>Sf,toUint8ClampedArrayAsyncIterator:()=>kf,toUint8ClampedArrayIterator:()=>Mf});var cc=new TextDecoder("utf-8"),Kn=cc.decode.bind(cc),hf=new TextEncoder,Te=r=>hf.encode(r);var pf=r=>typeof r=="number",lc=r=>typeof r=="boolean",pt=r=>typeof r=="function",Lt=r=>r!=null&&Object(r)===r,ee=r=>Lt(r)&&pt(r.then);var ge=r=>Lt(r)&&pt(r[Symbol.iterator]),ce=r=>Lt(r)&&pt(r[Symbol.asyncIterator]),$i=r=>Lt(r)&&Lt(r.schema);var Hi=r=>Lt(r)&&"done"in r&&"value"in r;var Yi=r=>Lt(r)&&pt(r.stat)&&pf(r.fd);var Ji=r=>Lt(r)&&Zn(r.body),Ki=r=>"_getDOMStream"in r&&"_getNodeStream"in r,uc=r=>Lt(r)&&pt(r.abort)&&pt(r.getWriter)&&!Ki(r),Zn=r=>Lt(r)&&pt(r.cancel)&&pt(r.getReader)&&!Ki(r),fc=r=>Lt(r)&&pt(r.end)&&pt(r.write)&&lc(r.writable)&&!Ki(r),Zi=r=>Lt(r)&&pt(r.read)&&pt(r.pipe)&&lc(r.readable)&&!Ki(r),dc=r=>Lt(r)&&pt(r.clear)&&pt(r.bytes)&&pt(r.position)&&pt(r.setPosition)&&pt(r.capacity)&&pt(r.getBufferIdentifier)&&pt(r.createLong);var Ts=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function mf(r){let t=r[0]?[r[0]]:[],e,n,i,o;for(let s,a,c=0,l=0,f=r.length;++c<f;){if(s=t[l],a=r[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,e+i<n||n+o<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,e,n-e+o)}return t}function Xn(r,t,e=0,n=t.byteLength){let i=r.byteLength,o=new Uint8Array(r.buffer,r.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,e),r}function re(r,t){let e=mf(r),n=e.reduce((f,d)=>f+d.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let f=e.length;++c<f;){if(i=e[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?e[c]=i.subarray(o.length):o.length===i.length&&c++,s?Xn(s,o,a):s=o;break}Xn(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),e.slice(c),n-(s?s.byteLength:0)]}function E(r,t){let e=Hi(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Te(e)),e instanceof ArrayBuffer?new r(e):e instanceof Ts?new r(e):dc(e)?E(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var yf=r=>E(Int8Array,r),gf=r=>E(Int16Array,r),Lr=r=>E(Int32Array,r),Xi=r=>E(BigInt64Array,r),x=r=>E(Uint8Array,r),bf=r=>E(Uint16Array,r),wf=r=>E(Uint32Array,r),_f=r=>E(BigUint64Array,r),vf=r=>E(Float32Array,r),If=r=>E(Float64Array,r),Sf=r=>E(Uint8ClampedArray,r),As=r=>(r.next(),r);function*De(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ts?e(t):ge(t)?t:e(t);return yield*As(function*(i){let o=null;do o=i.next(yield E(r,o));while(!o.done)}(n[Symbol.iterator]())),new r}var Bf=r=>De(Int8Array,r),xf=r=>De(Int16Array,r),Af=r=>De(Int32Array,r),Ds=r=>De(Uint8Array,r),Tf=r=>De(Uint16Array,r),Df=r=>De(Uint32Array,r),Of=r=>De(Float32Array,r),Ff=r=>De(Float64Array,r),Mf=r=>De(Uint8ClampedArray,r);function be(r,t){return te(this,arguments,function*(){if(ee(t))return yield L(yield L(yield*dn(ye(be(r,yield L(t))))));let n=function(s){return te(this,arguments,function*(){yield yield L(yield L(s))})},i=function(s){return te(this,arguments,function*(){yield L(yield*dn(ye(As(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ts?n(t):ge(t)?i(t):ce(t)?t:n(t);return yield L(yield*dn(ye(As(function(s){return te(this,arguments,function*(){let a=null;do a=yield L(s.next(yield yield L(E(r,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield L(new r)})}var Nf=r=>be(Int8Array,r),Lf=r=>be(Int16Array,r),Uf=r=>be(Int32Array,r),Os=r=>be(Uint8Array,r),Ef=r=>be(Uint16Array,r),Rf=r=>be(Uint32Array,r),Cf=r=>be(Float32Array,r),Pf=r=>be(Float64Array,r),kf=r=>be(Uint8ClampedArray,r);function qi(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function Fs(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var vt={fromIterable(r){return Qi(Vf(r))},fromAsyncIterable(r){return Qi(jf(r))},fromDOMStream(r){return Qi(zf(r))},fromNodeStream(r){return Qi(Wf(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Qi=r=>(r.next(),r);function*Vf(r){let t,e=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?re(n,s)[0]:([i,n,a]=re(n,s),i)}({cmd:o,size:s}=(yield(()=>null)())||{cmd:"read",size:0});let l=Ds(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(f){e=!0,typeof l.throw=="function"&&l.throw(f)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function jf(r){return te(this,arguments,function*(){let e,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?re(i,a)[0]:([o,i,c]=re(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=Os(r)[Symbol.asyncIterator]();try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.next()):yield L(f.next(a-c)),!e&&o.byteLength>0&&(i.push(o),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){n=!0,typeof f.throw=="function"&&(yield L(f.throw(d)))}finally{n===!1&&typeof f.return=="function"&&(yield L(f.return(new Uint8Array(0))))}return yield L(null)})}function zf(r){return te(this,arguments,function*(){let e=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?re(i,a)[0]:([o,i,c]=re(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=new Ls(r);try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.read()):yield L(f.read(a-c)),!e&&o.byteLength>0&&(i.push(x(o)),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){n=!0,yield L(f.cancel(d))}finally{n===!1?yield L(f.cancel()):r.locked&&f.releaseLock()}return yield L(null)})}var Ls=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return m(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return m(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=x(e)),e})}},Ns=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function Wf(r){return te(this,arguments,function*(){let e=[],n="error",i=!1,o=null,s,a,c=0,l=[],f;function d(){return s==="peek"?re(l,a)[0]:([f,l,c]=re(l,a),f)}if({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield L(new Uint8Array(0)),yield L(null);try{e[0]=Ns(r,"end"),e[1]=Ns(r,"error");do{if(e[2]=Ns(r,"readable"),[n,o]=yield L(Promise.race(e.map(D=>D[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(f=x(r.read(a-c)),f.byteLength<a-c&&(f=x(r.read()))):f=x(r.read()),f.byteLength>0&&(l.push(f),c+=f.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield L(d()));while(a<c)}while(!i)}finally{yield L(R(e,n==="error"?o:null))}return yield L(null);function R(D,tt){return f=l=null,new Promise((ae,xs)=>{for(let[wr,ef]of D)r.off(wr,ef);try{let wr=r.destroy;wr&&wr.call(r,tt),tt=void 0}catch(wr){tt=wr||tt}finally{tt!=null?xs(tt):ae()}})}})}var G;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(G||(G={}));var Y;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Y||(Y={}));var V;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(V||(V={}));var K;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(K||(K={}));var h;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(h||(h={}));var z;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(z||(z={}));var Oe=new Int32Array(2),to=new Float32Array(Oe.buffer),eo=new Float64Array(Oe.buffer),hn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var qn;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(qn||(qn={}));var mt=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new mt(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Oe[0]=this.readInt32(t),to[0]}readFloat64(t){return Oe[hn?0:1]=this.readInt32(t),Oe[hn?1:0]=this.readInt32(t+4),eo[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){to[0]=e,this.writeInt32(t,Oe[0])}writeFloat64(t,e){eo[0]=e,this.writeInt32(t,Oe[hn?0:1]),this.writeInt32(t+4,Oe[hn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===qn.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var nr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=mt.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=nr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=mt.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let o=e;if(this.prep(this.minalign,4+4+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=4-1;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Ur;(function(r){r[r.BUFFER=0]="BUFFER"})(Ur||(Ur={}));var Ut;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Ut||(Ut={}));var xt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Ut.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Ur.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Ut.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Ur.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return xt.startBodyCompression(t),xt.addCodec(t,e),xt.addMethod(t,n),xt.endBodyCompression(t)}};var pn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var mn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var It=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new It).__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):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new mn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new pn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new xt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var ue=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new ue).__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):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new It).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var _r;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(_r||(_r={}));var Qn;(function(r){r[r.DenseArray=0]="DenseArray"})(Qn||(Qn={}));var yt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new yt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return yt.startInt(t),yt.addBitWidth(t,e),yt.addIsSigned(t,n),yt.endInt(t)}};var ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new ne).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new yt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Qn.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Qn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Z=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new Z).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new Z).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return Z.startKeyValue(t),Z.addKey(t,e),Z.addValue(t,n),Z.endKeyValue(t)}};var Fe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Fe.startBinary(t),Fe.endBinary(t)}};var Me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Me.startBool(t),Me.endBool(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):K.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,K.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return zt.startDate(t),zt.addUnit(t,e),zt.endDate(t)}};var gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return gt.startDecimal(t),gt.addPrecision(t,e),gt.addScale(t,n),gt.addBitWidth(t,i),gt.endDecimal(t)}};var Wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return Wt.startDuration(t),Wt.addUnit(t,e),Wt.endDuration(t)}};var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return Gt.startFixedSizeBinary(t),Gt.addByteWidth(t,e),Gt.endFixedSizeBinary(t)}};var $t=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new $t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new $t).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return $t.startFixedSizeList(t),$t.addListSize(t,e),$t.endFixedSizeList(t)}};var Ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new Ht).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):V.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,V.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Ht.startFloatingPoint(t),Ht.addPrecision(t,e),Ht.endFloatingPoint(t)}};var Yt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Yt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,z.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Yt.startInterval(t),Yt.addUnit(t,e),Yt.endInterval(t)}};var Ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Ne.startLargeBinary(t),Ne.endLargeBinary(t)}};var Le=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Le.startLargeUtf8(t),Le.endLargeUtf8(t)}};var Ue=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Ue.startList(t),Ue.endList(t)}};var Jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Jt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Jt.startMap(t),Jt.addKeysSorted(t,e),Jt.endMap(t)}};var Ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ee.startNull(t),Ee.endNull(t)}};var Re=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Re).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Re.startStruct_(t),Re.endStruct_(t)}};var At=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new At).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new At).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return At.startTime(t),At.addUnit(t,e),At.addBitWidth(t,n),At.endTime(t)}};var Tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Tt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Tt.startTimestamp(t),Tt.addUnit(t,e),Tt.addTimezone(t,n),Tt.endTimestamp(t)}};var bt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new bt).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Y.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return bt.startUnion(t),bt.addMode(t,e),bt.addTypeIds(t,n),bt.endUnion(t)}};var Ce=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ce.startUtf8(t),Ce.endUtf8(t)}};var J;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(J||(J={}));var at=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):J.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ne).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new Z).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,J.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var et=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new et).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):_r.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Z).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,_r.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,o){return et.startSchema(t),et.addEndianness(t,e),et.addFields(t,n),et.addCustomMetadata(t,i),et.addFeatures(t,o),et.endSchema(t)}};var C;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(C||(C={}));var u;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond",r[r.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(u||(u={}));var nt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(nt||(nt={}));var Qs={};rr(Qs,{clampRange:()=>ri,createElementComparator:()=>xr,wrapIndex:()=>Yr});var Us={};rr(Us,{valueToString:()=>_e});function _e(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>_e(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Ps={};rr(Ps,{BN:()=>Er,bigNumToBigInt:()=>pc,bigNumToNumber:()=>Cs,bigNumToString:()=>bn,isArrowBigNumSymbol:()=>hc});function P(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Es(r,t){return P(r/t)+P(r%t)/P(t)}var hc=Symbol.for("isArrowBigNum");function ve(r,...t){return t.length===0?Object.setPrototypeOf(E(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}ve.prototype[hc]=!0;ve.prototype.toJSON=function(){return`"${bn(this)}"`};ve.prototype.valueOf=function(r){return Cs(this,r)};ve.prototype.toString=function(){return bn(this)};ve.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Cs(this);case"string":return bn(this);case"default":return pc(this)}return bn(this)};function yn(...r){return ve.apply(this,r)}function gn(...r){return ve.apply(this,r)}function ti(...r){return ve.apply(this,r)}Object.setPrototypeOf(yn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(gn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ti.prototype,Object.create(Uint32Array.prototype));Object.assign(yn.prototype,ve.prototype,{constructor:yn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(gn.prototype,ve.prototype,{constructor:gn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ti.prototype,ve.prototype,{constructor:ti,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Gf=BigInt(4294967296)*BigInt(4294967296),$f=Gf-BigInt(1);function Cs(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:o}=r,s=new BigUint64Array(e,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let f of s)c|=(f^$f)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let f of s)c|=f*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let f=BigInt("1".padEnd(t+1,"0")),d=c/f,R=a?-(c%f):c%f,D=P(d),tt=`${R}`.padStart(t,"0");return+`${a&&D===0?"-":""}${D}.${tt}`}return P(c)}function bn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Rs(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Rs(r);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Rs(t)}`}function pc(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:bn(r)}function Rs(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(e[0]=n[o=0];o<s;)n[o++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[o];n[o]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Er=class{static new(t,e){switch(e){case!0:return new yn(t);case!1:return new gn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new yn(t)}return t.byteLength===16?new ti(t):new gn(t)}static signed(t){return new yn(t)}static unsigned(t){return new gn(t)}static decimal(t){return new ti(t)}constructor(t,e){return Er.new(t,e)}};var mc,yc,gc,bc,wc,_c,vc,Ic,Sc,Bc,xc,Ac,Tc,Dc,Oc,Fc,Mc,Nc,Lc,Uc,Ec,Rc,p=class{static isNull(t){return t?.typeId===u.Null}static isInt(t){return t?.typeId===u.Int}static isFloat(t){return t?.typeId===u.Float}static isBinary(t){return t?.typeId===u.Binary}static isLargeBinary(t){return t?.typeId===u.LargeBinary}static isUtf8(t){return t?.typeId===u.Utf8}static isLargeUtf8(t){return t?.typeId===u.LargeUtf8}static isBool(t){return t?.typeId===u.Bool}static isDecimal(t){return t?.typeId===u.Decimal}static isDate(t){return t?.typeId===u.Date}static isTime(t){return t?.typeId===u.Time}static isTimestamp(t){return t?.typeId===u.Timestamp}static isInterval(t){return t?.typeId===u.Interval}static isDuration(t){return t?.typeId===u.Duration}static isList(t){return t?.typeId===u.List}static isStruct(t){return t?.typeId===u.Struct}static isUnion(t){return t?.typeId===u.Union}static isFixedSizeBinary(t){return t?.typeId===u.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===u.FixedSizeList}static isMap(t){return t?.typeId===u.Map}static isDictionary(t){return t?.typeId===u.Dictionary}static isDenseUnion(t){return p.isUnion(t)&&t.mode===Y.Dense}static isSparseUnion(t){return p.isUnion(t)&&t.mode===Y.Sparse}constructor(t){this.typeId=t}};mc=Symbol.toStringTag;p[mc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(p.prototype);var it=class extends p{constructor(){super(u.Null)}toString(){return"Null"}};yc=Symbol.toStringTag;it[yc]=(r=>r[Symbol.toStringTag]="Null")(it.prototype);var rt=class extends p{constructor(t,e){super(u.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};gc=Symbol.toStringTag;rt[gc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(rt.prototype);var Pe=class extends rt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ke=class extends rt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},wt=class extends rt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},fe=class extends rt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ve=class extends rt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},je=class extends rt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ze=class extends rt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},We=class extends rt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Pe.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ke.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(wt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(fe.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(je.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(We.prototype,"ArrayType",{value:BigUint64Array});var Et=class extends p{constructor(t){super(u.Float),this.precision=t}get ArrayType(){switch(this.precision){case V.HALF:return Uint16Array;case V.SINGLE:return Float32Array;case V.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};bc=Symbol.toStringTag;Et[bc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Et.prototype);var vr=class extends Et{constructor(){super(V.HALF)}},Ge=class extends Et{constructor(){super(V.SINGLE)}},de=class extends Et{constructor(){super(V.DOUBLE)}};Object.defineProperty(vr.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ge.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(de.prototype,"ArrayType",{value:Float64Array});var ie=class extends p{constructor(){super(u.Binary)}toString(){return"Binary"}};wc=Symbol.toStringTag;ie[wc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ie.prototype);var $e=class extends p{constructor(){super(u.LargeBinary)}toString(){return"LargeBinary"}};_c=Symbol.toStringTag;$e[_c]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))($e.prototype);var Rt=class extends p{constructor(){super(u.Utf8)}toString(){return"Utf8"}};vc=Symbol.toStringTag;Rt[vc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Rt.prototype);var He=class extends p{constructor(){super(u.LargeUtf8)}toString(){return"LargeUtf8"}};Ic=Symbol.toStringTag;He[Ic]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(He.prototype);var Ct=class extends p{constructor(){super(u.Bool)}toString(){return"Bool"}};Sc=Symbol.toStringTag;Ct[Sc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Ct.prototype);var oe=class extends p{constructor(t,e,n=128){super(u.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Bc=Symbol.toStringTag;oe[Bc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(oe.prototype);var Kt=class extends p{constructor(t){super(u.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${K[this.unit]}>`}get ArrayType(){return this.unit===K.DAY?Int32Array:BigInt64Array}};xc=Symbol.toStringTag;Kt[xc]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Kt.prototype);var Rr=class extends Kt{constructor(){super(K.DAY)}},Cr=class extends Kt{constructor(){super(K.MILLISECOND)}},Dt=class extends p{constructor(t,e){super(u.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${h[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Ac=Symbol.toStringTag;Dt[Ac]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Dt.prototype);var Pr=class extends Dt{constructor(){super(h.SECOND,32)}},kr=class extends Dt{constructor(){super(h.MILLISECOND,32)}},Vr=class extends Dt{constructor(){super(h.MICROSECOND,64)}},jr=class extends Dt{constructor(){super(h.NANOSECOND,64)}},Ot=class extends p{constructor(t,e){super(u.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${h[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Tc=Symbol.toStringTag;Ot[Tc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Ot.prototype);var zr=class extends Ot{constructor(t){super(h.SECOND,t)}},ir=class extends Ot{constructor(t){super(h.MILLISECOND,t)}},Wr=class extends Ot{constructor(t){super(h.MICROSECOND,t)}},Gr=class extends Ot{constructor(t){super(h.NANOSECOND,t)}},Zt=class extends p{constructor(t){super(u.Interval),this.unit=t}toString(){return`Interval<${z[this.unit]}>`}};Dc=Symbol.toStringTag;Zt[Dc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Zt.prototype);var $r=class extends Zt{constructor(){super(z.DAY_TIME)}},Hr=class extends Zt{constructor(){super(z.YEAR_MONTH)}};var Ye=class extends p{constructor(t){super(u.Duration),this.unit=t}toString(){return`Duration<${h[this.unit]}>`}};Oc=Symbol.toStringTag;Ye[Oc]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Ye.prototype);var St=class extends p{constructor(t){super(u.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Fc=Symbol.toStringTag;St[Fc]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(St.prototype);var k=class extends p{constructor(t){super(u.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Mc=Symbol.toStringTag;k[Mc]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(k.prototype);var he=class extends p{constructor(t,e,n){super(u.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Nc=Symbol.toStringTag;he[Nc]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(he.prototype);var Je=class extends p{constructor(t){super(u.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Lc=Symbol.toStringTag;Je[Lc]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Je.prototype);var Pt=class extends p{constructor(t,e){super(u.FixedSizeList),this.listSize=t,this.children=[e]}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}>`}};Uc=Symbol.toStringTag;Pt[Uc]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Pt.prototype);var kt=class extends p{constructor(t,e=!1){var n,i,o;if(super(u.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Ec=Symbol.toStringTag;kt[Ec]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(kt.prototype);var Hf=(r=>()=>++r)(-1),Ft=class extends p{constructor(t,e,n,i){super(u.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?Hf():P(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Rc=Symbol.toStringTag;Ft[Rc]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ft.prototype);function se(r){let t=r;switch(r.typeId){case u.Decimal:return r.bitWidth/32;case u.Interval:return t.unit===z.MONTH_DAY_NANO?4:1+t.unit;case u.FixedSizeList:return t.listSize;case u.FixedSizeBinary:return t.byteWidth;default:return 1}}var w=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Yf(this,t,e)}getVisitFnByTypeId(t,e=!0){return wn(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}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(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}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function Yf(r,t,e=!0){return typeof t=="number"?wn(r,t,e):typeof t=="string"&&t in u?wn(r,u[t],e):t&&t instanceof p?wn(r,Pc(t),e):t?.type&&t.type instanceof p?wn(r,Pc(t.type),e):wn(r,u.NONE,e)}function wn(r,t,e=!0){let n=null;switch(t){case u.Null:n=r.visitNull;break;case u.Bool:n=r.visitBool;break;case u.Int:n=r.visitInt;break;case u.Int8:n=r.visitInt8||r.visitInt;break;case u.Int16:n=r.visitInt16||r.visitInt;break;case u.Int32:n=r.visitInt32||r.visitInt;break;case u.Int64:n=r.visitInt64||r.visitInt;break;case u.Uint8:n=r.visitUint8||r.visitInt;break;case u.Uint16:n=r.visitUint16||r.visitInt;break;case u.Uint32:n=r.visitUint32||r.visitInt;break;case u.Uint64:n=r.visitUint64||r.visitInt;break;case u.Float:n=r.visitFloat;break;case u.Float16:n=r.visitFloat16||r.visitFloat;break;case u.Float32:n=r.visitFloat32||r.visitFloat;break;case u.Float64:n=r.visitFloat64||r.visitFloat;break;case u.Utf8:n=r.visitUtf8;break;case u.LargeUtf8:n=r.visitLargeUtf8;break;case u.Binary:n=r.visitBinary;break;case u.LargeBinary:n=r.visitLargeBinary;break;case u.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case u.Date:n=r.visitDate;break;case u.DateDay:n=r.visitDateDay||r.visitDate;break;case u.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case u.Timestamp:n=r.visitTimestamp;break;case u.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case u.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case u.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case u.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case u.Time:n=r.visitTime;break;case u.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case u.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case u.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case u.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case u.Decimal:n=r.visitDecimal;break;case u.List:n=r.visitList;break;case u.Struct:n=r.visitStruct;break;case u.Union:n=r.visitUnion;break;case u.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case u.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case u.Dictionary:n=r.visitDictionary;break;case u.Interval:n=r.visitInterval;break;case u.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case u.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case u.IntervalMonthDayNano:n=r.visitIntervalMonthDayNano||r.visitInterval;break;case u.Duration:n=r.visitDuration;break;case u.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case u.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case u.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case u.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case u.FixedSizeList:n=r.visitFixedSizeList;break;case u.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${u[t]}'`)}function Pc(r){switch(r.typeId){case u.Null:return u.Null;case u.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?u.Int8:u.Uint8;case 16:return e?u.Int16:u.Uint16;case 32:return e?u.Int32:u.Uint32;case 64:return e?u.Int64:u.Uint64}return u.Int}case u.Float:switch(r.precision){case V.HALF:return u.Float16;case V.SINGLE:return u.Float32;case V.DOUBLE:return u.Float64}return u.Float;case u.Binary:return u.Binary;case u.LargeBinary:return u.LargeBinary;case u.Utf8:return u.Utf8;case u.LargeUtf8:return u.LargeUtf8;case u.Bool:return u.Bool;case u.Decimal:return u.Decimal;case u.Time:switch(r.unit){case h.SECOND:return u.TimeSecond;case h.MILLISECOND:return u.TimeMillisecond;case h.MICROSECOND:return u.TimeMicrosecond;case h.NANOSECOND:return u.TimeNanosecond}return u.Time;case u.Timestamp:switch(r.unit){case h.SECOND:return u.TimestampSecond;case h.MILLISECOND:return u.TimestampMillisecond;case h.MICROSECOND:return u.TimestampMicrosecond;case h.NANOSECOND:return u.TimestampNanosecond}return u.Timestamp;case u.Date:switch(r.unit){case K.DAY:return u.DateDay;case K.MILLISECOND:return u.DateMillisecond}return u.Date;case u.Interval:switch(r.unit){case z.DAY_TIME:return u.IntervalDayTime;case z.YEAR_MONTH:return u.IntervalYearMonth;case z.MONTH_DAY_NANO:return u.IntervalMonthDayNano}return u.Interval;case u.Duration:switch(r.unit){case h.SECOND:return u.DurationSecond;case h.MILLISECOND:return u.DurationMillisecond;case h.MICROSECOND:return u.DurationMicrosecond;case h.NANOSECOND:return u.DurationNanosecond}return u.Duration;case u.Map:return u.Map;case u.List:return u.List;case u.Struct:return u.Struct;case u.Union:switch(r.mode){case Y.Dense:return u.DenseUnion;case Y.Sparse:return u.SparseUnion}return u.Union;case u.FixedSizeBinary:return u.FixedSizeBinary;case u.FixedSizeList:return u.FixedSizeList;case u.Dictionary:return u.Dictionary}throw new Error(`Unrecognized type '${u[r.typeId]}'`)}w.prototype.visitInt8=null;w.prototype.visitInt16=null;w.prototype.visitInt32=null;w.prototype.visitInt64=null;w.prototype.visitUint8=null;w.prototype.visitUint16=null;w.prototype.visitUint32=null;w.prototype.visitUint64=null;w.prototype.visitFloat16=null;w.prototype.visitFloat32=null;w.prototype.visitFloat64=null;w.prototype.visitDateDay=null;w.prototype.visitDateMillisecond=null;w.prototype.visitTimestampSecond=null;w.prototype.visitTimestampMillisecond=null;w.prototype.visitTimestampMicrosecond=null;w.prototype.visitTimestampNanosecond=null;w.prototype.visitTimeSecond=null;w.prototype.visitTimeMillisecond=null;w.prototype.visitTimeMicrosecond=null;w.prototype.visitTimeNanosecond=null;w.prototype.visitDenseUnion=null;w.prototype.visitSparseUnion=null;w.prototype.visitIntervalDayTime=null;w.prototype.visitIntervalYearMonth=null;w.prototype.visitIntervalMonthDayNano=null;w.prototype.visitDuration=null;w.prototype.visitDurationSecond=null;w.prototype.visitDurationMillisecond=null;w.prototype.visitDurationMicrosecond=null;w.prototype.visitDurationNanosecond=null;var ks={};rr(ks,{float64ToUint16:()=>ei,uint16ToFloat64:()=>no});var kc=new Float64Array(1),_n=new Uint32Array(kc.buffer);function no(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function ei(r){if(r!==r)return 32256;kc[0]=r;let t=(_n[1]&2147483648)>>16&65535,e=_n[1]&2146435072,n=0;return e>=1089470464?_n[0]>0?e=31744:(e=(e&2080374784)>>16,n=(_n[1]&1048575)>>10):e<=1056964608?(n=1048576+(_n[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(_n[1]&1048575)+512>>10),t|e|n&65535}var B=class extends w{};function O(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var Jf=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Vc=(r,t,e,n)=>{if(e+1<t.length){let i=P(t[e]),o=P(t[e+1]);r.set(n.subarray(0,o-i),i)}},Kf=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},or=({values:r},t,e)=>{r[t]=e},Vs=({values:r},t,e)=>{r[t]=e},jc=({values:r},t,e)=>{r[t]=ei(e)},Zf=(r,t,e)=>{switch(r.type.precision){case V.HALF:return jc(r,t,e);case V.SINGLE:case V.DOUBLE:return Vs(r,t,e)}},io=({values:r},t,e)=>{Jf(r,t,e.valueOf())},oo=({values:r},t,e)=>{r[t]=BigInt(e)},js=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},zc=({values:r,valueOffsets:t},e,n)=>Vc(r,t,e,n),Wc=({values:r,valueOffsets:t},e,n)=>Vc(r,t,e,Te(n)),zs=(r,t,e)=>{r.type.unit===K.DAY?io(r,t,e):oo(r,t,e)},so=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},ao=({values:r},t,e)=>{r[t]=BigInt(e)},co=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},lo=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Ws=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return so(r,t,e);case h.MILLISECOND:return ao(r,t,e);case h.MICROSECOND:return co(r,t,e);case h.NANOSECOND:return lo(r,t,e)}},uo=({values:r},t,e)=>{r[t]=e},fo=({values:r},t,e)=>{r[t]=e},ho=({values:r},t,e)=>{r[t]=e},po=({values:r},t,e)=>{r[t]=e},Gs=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return uo(r,t,e);case h.MILLISECOND:return fo(r,t,e);case h.MICROSECOND:return ho(r,t,e);case h.NANOSECOND:return po(r,t,e)}},$s=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Xf=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,o=Bt.getVisitFn(n);if(Array.isArray(e))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e.get(++s))},qf=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,o=Bt.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(o(n,s,l),++s>=a)break},Qf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[o]),td=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(o)),ed=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(i.name)),rd=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[i.name]),nd=(r,t,e)=>{let n=r.type.children.map(o=>Bt.getVisitFn(o.type)),i=e instanceof Map?ed(t,e):e instanceof y?td(t,e):Array.isArray(e)?Qf(t,e):rd(t,e);r.type.children.forEach((o,s)=>i(n[s],r.children[s],o,s))},id=(r,t,e)=>{r.type.mode===Y.Dense?Gc(r,t,e):$c(r,t,e)},Gc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Bt.visit(i,r.valueOffsets[t],e)},$c=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Bt.visit(i,t,e)},od=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Hs=(r,t,e)=>{switch(r.type.unit){case z.YEAR_MONTH:return yo(r,t,e);case z.DAY_TIME:return mo(r,t,e);case z.MONTH_DAY_NANO:return go(r,t,e)}},mo=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},yo=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},go=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},bo=({values:r},t,e)=>{r[t]=e},wo=({values:r},t,e)=>{r[t]=e},_o=({values:r},t,e)=>{r[t]=e},vo=({values:r},t,e)=>{r[t]=e},Ys=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return bo(r,t,e);case h.MILLISECOND:return wo(r,t,e);case h.MICROSECOND:return _o(r,t,e);case h.NANOSECOND:return vo(r,t,e)}},sd=(r,t,e)=>{let{stride:n}=r,i=r.children[0],o=Bt.getVisitFn(i);if(Array.isArray(e))for(let s=-1,a=t*n;++s<n;)o(i,a+s,e[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,e.get(s))};B.prototype.visitBool=O(Kf);B.prototype.visitInt=O(or);B.prototype.visitInt8=O(or);B.prototype.visitInt16=O(or);B.prototype.visitInt32=O(or);B.prototype.visitInt64=O(or);B.prototype.visitUint8=O(or);B.prototype.visitUint16=O(or);B.prototype.visitUint32=O(or);B.prototype.visitUint64=O(or);B.prototype.visitFloat=O(Zf);B.prototype.visitFloat16=O(jc);B.prototype.visitFloat32=O(Vs);B.prototype.visitFloat64=O(Vs);B.prototype.visitUtf8=O(Wc);B.prototype.visitLargeUtf8=O(Wc);B.prototype.visitBinary=O(zc);B.prototype.visitLargeBinary=O(zc);B.prototype.visitFixedSizeBinary=O(js);B.prototype.visitDate=O(zs);B.prototype.visitDateDay=O(io);B.prototype.visitDateMillisecond=O(oo);B.prototype.visitTimestamp=O(Ws);B.prototype.visitTimestampSecond=O(so);B.prototype.visitTimestampMillisecond=O(ao);B.prototype.visitTimestampMicrosecond=O(co);B.prototype.visitTimestampNanosecond=O(lo);B.prototype.visitTime=O(Gs);B.prototype.visitTimeSecond=O(uo);B.prototype.visitTimeMillisecond=O(fo);B.prototype.visitTimeMicrosecond=O(ho);B.prototype.visitTimeNanosecond=O(po);B.prototype.visitDecimal=O($s);B.prototype.visitList=O(Xf);B.prototype.visitStruct=O(nd);B.prototype.visitUnion=O(id);B.prototype.visitDenseUnion=O(Gc);B.prototype.visitSparseUnion=O($c);B.prototype.visitDictionary=O(od);B.prototype.visitInterval=O(Hs);B.prototype.visitIntervalDayTime=O(mo);B.prototype.visitIntervalYearMonth=O(yo);B.prototype.visitIntervalMonthDayNano=O(go);B.prototype.visitDuration=O(Ys);B.prototype.visitDurationSecond=O(bo);B.prototype.visitDurationMillisecond=O(wo);B.prototype.visitDurationMicrosecond=O(_o);B.prototype.visitDurationNanosecond=O(vo);B.prototype.visitFixedSizeList=O(sd);B.prototype.visitMap=O(qf);var Bt=new B;var Ie=Symbol.for("parent"),vn=Symbol.for("rowIndex"),Ir=class{constructor(t,e){return this[Ie]=t,this[vn]=e,new Proxy(this,ad)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[vn],e=this[Ie],n=e.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=ct.visit(e.children[o],t);return i}toString(){return`{${[...this].map(([t,e])=>`${_e(t)}: ${_e(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Js(this[Ie],this[vn])}},Js=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ct.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ir.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ie]:{writable:!0,enumerable:!1,configurable:!1,value:null},[vn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Ks=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ie].type.children.map(e=>e.name)}has(t,e){return t[Ie].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[Ie].type.children.some(n=>n.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Ie].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=ct.visit(t[Ie].children[n],t[vn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ie].type.children.findIndex(o=>o.name===e);return i!==-1?(Bt.visit(t[Ie].children[i],t[vn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}},ad=new Ks;var _=class extends w{};function A(r){return(t,e)=>t.getValid(e)?r(t,e):null}var cd=(r,t)=>864e5*r[t],ld=(r,t)=>null,Hc=(r,t,e)=>{if(e+1>=t.length)return null;let n=P(t[e]),i=P(t[e+1]);return r.subarray(n,i)},ud=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Yc=({values:r},t)=>cd(r,t),Jc=({values:r},t)=>P(r[t]),Sr=({stride:r,values:t},e)=>t[r*e],fd=({stride:r,values:t},e)=>no(t[r*e]),Kc=({values:r},t)=>r[t],dd=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Zc=({values:r,valueOffsets:t},e)=>Hc(r,t,e),Xc=({values:r,valueOffsets:t},e)=>{let n=Hc(r,t,e);return n!==null?Kn(n):null},hd=({values:r},t)=>r[t],pd=({type:r,values:t},e)=>r.precision!==V.HALF?t[e]:no(t[e]),md=(r,t)=>r.type.unit===K.DAY?Yc(r,t):Jc(r,t),qc=({values:r},t)=>1e3*P(r[t]),Qc=({values:r},t)=>P(r[t]),tl=({values:r},t)=>Es(r[t],BigInt(1e3)),el=({values:r},t)=>Es(r[t],BigInt(1e6)),yd=(r,t)=>{switch(r.type.unit){case h.SECOND:return qc(r,t);case h.MILLISECOND:return Qc(r,t);case h.MICROSECOND:return tl(r,t);case h.NANOSECOND:return el(r,t)}},rl=({values:r},t)=>r[t],nl=({values:r},t)=>r[t],il=({values:r},t)=>r[t],ol=({values:r},t)=>r[t],gd=(r,t)=>{switch(r.type.unit){case h.SECOND:return rl(r,t);case h.MILLISECOND:return nl(r,t);case h.MICROSECOND:return il(r,t);case h.NANOSECOND:return ol(r,t)}},bd=({values:r,stride:t},e)=>Er.decimal(r.subarray(t*e,t*(e+1))),wd=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:o,[t*n+1]:s}=e,c=i[0].slice(o,s-o);return new y([c])},_d=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:o}=e,s=n[0];return new Ke(s.slice(i,o-i))},vd=(r,t)=>new Ir(r,t),Id=(r,t)=>r.type.mode===Y.Dense?sl(r,t):al(r,t),sl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,r.valueOffsets[t])},al=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,t)},Sd=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Bd=(r,t)=>r.type.unit===z.MONTH_DAY_NANO?ul(r,t):r.type.unit===z.DAY_TIME?cl(r,t):ll(r,t),cl=({values:r},t)=>r.subarray(2*t,2*(t+1)),ll=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},ul=({values:r},t)=>r.subarray(4*t,4*(t+1)),fl=({values:r},t)=>r[t],dl=({values:r},t)=>r[t],hl=({values:r},t)=>r[t],pl=({values:r},t)=>r[t],xd=(r,t)=>{switch(r.type.unit){case h.SECOND:return fl(r,t);case h.MILLISECOND:return dl(r,t);case h.MICROSECOND:return hl(r,t);case h.NANOSECOND:return pl(r,t)}},Ad=(r,t)=>{let{stride:e,children:n}=r,o=n[0].slice(t*e,e);return new y([o])};_.prototype.visitNull=A(ld);_.prototype.visitBool=A(ud);_.prototype.visitInt=A(hd);_.prototype.visitInt8=A(Sr);_.prototype.visitInt16=A(Sr);_.prototype.visitInt32=A(Sr);_.prototype.visitInt64=A(Kc);_.prototype.visitUint8=A(Sr);_.prototype.visitUint16=A(Sr);_.prototype.visitUint32=A(Sr);_.prototype.visitUint64=A(Kc);_.prototype.visitFloat=A(pd);_.prototype.visitFloat16=A(fd);_.prototype.visitFloat32=A(Sr);_.prototype.visitFloat64=A(Sr);_.prototype.visitUtf8=A(Xc);_.prototype.visitLargeUtf8=A(Xc);_.prototype.visitBinary=A(Zc);_.prototype.visitLargeBinary=A(Zc);_.prototype.visitFixedSizeBinary=A(dd);_.prototype.visitDate=A(md);_.prototype.visitDateDay=A(Yc);_.prototype.visitDateMillisecond=A(Jc);_.prototype.visitTimestamp=A(yd);_.prototype.visitTimestampSecond=A(qc);_.prototype.visitTimestampMillisecond=A(Qc);_.prototype.visitTimestampMicrosecond=A(tl);_.prototype.visitTimestampNanosecond=A(el);_.prototype.visitTime=A(gd);_.prototype.visitTimeSecond=A(rl);_.prototype.visitTimeMillisecond=A(nl);_.prototype.visitTimeMicrosecond=A(il);_.prototype.visitTimeNanosecond=A(ol);_.prototype.visitDecimal=A(bd);_.prototype.visitList=A(wd);_.prototype.visitStruct=A(vd);_.prototype.visitUnion=A(Id);_.prototype.visitDenseUnion=A(sl);_.prototype.visitSparseUnion=A(al);_.prototype.visitDictionary=A(Sd);_.prototype.visitInterval=A(Bd);_.prototype.visitIntervalDayTime=A(cl);_.prototype.visitIntervalYearMonth=A(ll);_.prototype.visitIntervalMonthDayNano=A(ul);_.prototype.visitDuration=A(xd);_.prototype.visitDurationSecond=A(fl);_.prototype.visitDurationMillisecond=A(dl);_.prototype.visitDurationMicrosecond=A(hl);_.prototype.visitDurationNanosecond=A(pl);_.prototype.visitFixedSizeList=A(Ad);_.prototype.visitMap=A(_d);var ct=new _;var Br=Symbol.for("keys"),Sn=Symbol.for("vals"),In=Symbol.for("kKeysAsStrings"),Zs=Symbol.for("_kKeysAsStrings"),Ke=class{constructor(t){return this[Br]=new y([t.children[0]]).memoize(),this[Sn]=t.children[1],new Proxy(this,new qs)}get[In](){return this[Zs]||(this[Zs]=Array.from(this[Br].toArray(),String))}[Symbol.iterator](){return new Xs(this[Br],this[Sn])}get size(){return this[Br].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Br],e=this[Sn],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=ct.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${_e(t)}: ${_e(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Xs=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ct.visit(this.vals,t)]})}},qs=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[In]}has(t,e){return t[In].includes(e)}getOwnPropertyDescriptor(t,e){if(t[In].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[In].indexOf(e);if(n!==-1){let i=ct.visit(Reflect.get(t,Sn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[In].indexOf(e);return i!==-1?(Bt.visit(Reflect.get(t,Sn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(Ke.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Br]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Sn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Zs]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var ml;function ri(r,t,e,n){let{length:i=0}=r,o=typeof t!="number"?0:t,s=typeof e!="number"?i:e;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(ml=o,o=s,s=ml),s>i&&(s=i),n?n(r,o,s):[o,s]}var Yr=(r,t)=>r<0?t+r:r,yl=r=>r!==r;function xr(r){if(typeof r!=="object"||r===null)return yl(r)?yl:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?Fs(r,e):!1:r instanceof Map?Dd(r):Array.isArray(r)?Td(r):r instanceof y?Od(r):Fd(r,!0)}function Td(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r[e]);return Io(t)}function Dd(r){let t=-1,e=[];for(let n of r.values())e[++t]=xr(n);return Io(e)}function Od(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r.get(e));return Io(t)}function Fd(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,o=e.length;++i<o;)n[i]=xr(r[e[i]]);return Io(n,e)}function Io(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Md(r,e);case Map:return gl(r,e,e.keys());case Ke:case Ir:case Object:case void 0:return gl(r,e,t||Object.keys(e))}return e instanceof y?Nd(r,e):!1}}function Md(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function Nd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function gl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=r.length,c=o.next(),l=n.next(),f=i.next();for(;s<a&&!l.done&&!f.done&&!c.done&&!(l.value!==f.value||!r[s](c.value));++s,l=n.next(),f=i.next(),c=o.next());return s===a&&l.done&&f.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var ta={};rr(ta,{BitIterator:()=>Jr,getBit:()=>bl,getBool:()=>Bo,packBools:()=>Zr,popcnt_array:()=>wl,popcnt_bit_range:()=>ni,popcnt_uint32:()=>So,setBool:()=>Ld,truncateBitmap:()=>Kr});function Bo(r,t,e,n){return(e&1<<n)!==0}function bl(r,t,e,n){return(e&1<<n)>>n}function Ld(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Kr(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Zr(new Jr(e,r,t,null,Bo)).subarray(0,n)),i}return e}function Zr(r){let t=[],e=0,n=0,i=0;for(let s of r)s&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var Jr=class{constructor(t,e,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ni(r,t,e){if(e-t<=0)return 0;if(e-t<8){let o=0;for(let s of new Jr(r,t,e-t,r,bl))o+=s;return o}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ni(r,t,i)+ni(r,n,e)+wl(r,i>>3,n-i>>3)}function wl(r,t,e){let n=0,i=Math.trunc(t),o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=e===void 0?r.byteLength:i+e;for(;s-i>=4;)n+=So(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=So(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=So(o.getUint8(i)),i+=1;return n}function So(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Ud=-1,N=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return p.isSparseUnion(t)?this.children.some(e=>e.nullable):p.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(p.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=Ud&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ni(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof N?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=se(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(p.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Y.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(p.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Y.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,e)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,f=c>>3;(!o||o.byteLength<=f)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Kr(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let d=o[f];n=(d&l)!==0,o[f]=e?d|l:d&~l}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new N(t,e,n,i,o,s,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===u.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Kr(this.offset,e,this.nullBitmap),0);let o=this.buffers;return o[nt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),o)}_sliceBuffers(t,e,n,i){let o,{buffers:s}=this;return(o=s[nt.TYPE])&&(s[nt.TYPE]=o.subarray(t,t+e)),(o=s[nt.OFFSET])&&(s[nt.OFFSET]=o.subarray(t,t+e+1))||(o=s[nt.DATA])&&(s[nt.DATA]=i===6?o:o.subarray(n*t,n*(t+e))),s}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};N.prototype.children=Object.freeze([]);var Xr=class extends w{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new N(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.data),o=x(t.nullBitmap),s=Lr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.data),o=x(t.nullBitmap),s=Xi(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.data),o=x(t.nullBitmap),s=Lr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.data),o=x(t.nullBitmap),s=Xi(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,o=x(t.nullBitmap),s=Lr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=x(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=E(e.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(p.isSparseUnion(e))return new N(e,n,s,a,[void 0,void 0,void 0,o],i);let c=Lr(t.valueOffsets);return new N(e,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.indices.ArrayType,t.data),{["dictionary"]:s=new y([new Xr().visit({type:e.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=x(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Xr().visit({type:e.valueType})}=t,o=x(t.nullBitmap),{["length"]:s=i.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new N(e,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Xr().visit({type:e.childType})}=t,o=x(t.nullBitmap),s=Lr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new N(e,n,a,c,[s,void 0,o],[i])}},Ed=new Xr;function b(r){return Ed.visit(r)}var ii=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function _l(r){return r.some(t=>t.nullable)}function xo(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Ao(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function To(r,t,e,n){let i=[];for(let o=-1,s=r.length;++o<s;){let a=r[o],c=t[o],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let f=Math.max(0,e-c),d=Math.min(n-c,l);i.push(a.slice(f,d-f))}return i.length===0&&i.push(r[0].slice(0,0)),i}function ea(r,t,e,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return e<t[s]?n(r,i,e-t[i]):null;o=i+Math.trunc((s-i)*.5),e<t[o]?s=o:i=o}while(i<s)}function oi(r,t){return r.getValid(t)}function Bn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return ea(n,this._offsets,e,t)}}function Do(r){let t;function e(n,i,o){return r(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=ea(o,this._offsets,n,e);return t=void 0,s}}function Oo(r){let t;function e(n,i,o){let s=o,a=0,c=0;for(let l=i-1,f=n.length;++l<f;){let d=n[l];if(~(a=r(d,t,s)))return c+a;s=0,c+=d.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?e(o,0,0):ea(o,this._offsets,i,e);return t=void 0,s}}var v=class extends w{};function Rd(r,t){return t===null&&r.length>0?0:-1}function Cd(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new Jr(e,r.offset+(t||0),r.length,e,Bo)){if(!i)return n;++n}return-1}function M(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case u.Union:break;case u.Dictionary:break;default:return Cd(r,e)}let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}function vl(r,t,e){let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}v.prototype.visitNull=Rd;v.prototype.visitBool=M;v.prototype.visitInt=M;v.prototype.visitInt8=M;v.prototype.visitInt16=M;v.prototype.visitInt32=M;v.prototype.visitInt64=M;v.prototype.visitUint8=M;v.prototype.visitUint16=M;v.prototype.visitUint32=M;v.prototype.visitUint64=M;v.prototype.visitFloat=M;v.prototype.visitFloat16=M;v.prototype.visitFloat32=M;v.prototype.visitFloat64=M;v.prototype.visitUtf8=M;v.prototype.visitLargeUtf8=M;v.prototype.visitBinary=M;v.prototype.visitLargeBinary=M;v.prototype.visitFixedSizeBinary=M;v.prototype.visitDate=M;v.prototype.visitDateDay=M;v.prototype.visitDateMillisecond=M;v.prototype.visitTimestamp=M;v.prototype.visitTimestampSecond=M;v.prototype.visitTimestampMillisecond=M;v.prototype.visitTimestampMicrosecond=M;v.prototype.visitTimestampNanosecond=M;v.prototype.visitTime=M;v.prototype.visitTimeSecond=M;v.prototype.visitTimeMillisecond=M;v.prototype.visitTimeMicrosecond=M;v.prototype.visitTimeNanosecond=M;v.prototype.visitDecimal=M;v.prototype.visitList=M;v.prototype.visitStruct=M;v.prototype.visitUnion=M;v.prototype.visitDenseUnion=vl;v.prototype.visitSparseUnion=vl;v.prototype.visitDictionary=M;v.prototype.visitInterval=M;v.prototype.visitIntervalDayTime=M;v.prototype.visitIntervalYearMonth=M;v.prototype.visitIntervalMonthDayNano=M;v.prototype.visitDuration=M;v.prototype.visitDurationSecond=M;v.prototype.visitDurationMillisecond=M;v.prototype.visitDurationMicrosecond=M;v.prototype.visitDurationNanosecond=M;v.prototype.visitFixedSizeList=M;v.prototype.visitMap=M;var qr=new v;var I=class extends w{};function T(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(p.isInt(t)&&t.bitWidth!==64||p.isTime(t)&&t.bitWidth!==64||p.isFloat(t)&&t.precision!==V.HALF))return new ii(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ii(r.data.length,n=>{let o=r.data[n].length,s=r.slice(e,e+o);return e+=o,new ra(s)})}var ra=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};I.prototype.visitNull=T;I.prototype.visitBool=T;I.prototype.visitInt=T;I.prototype.visitInt8=T;I.prototype.visitInt16=T;I.prototype.visitInt32=T;I.prototype.visitInt64=T;I.prototype.visitUint8=T;I.prototype.visitUint16=T;I.prototype.visitUint32=T;I.prototype.visitUint64=T;I.prototype.visitFloat=T;I.prototype.visitFloat16=T;I.prototype.visitFloat32=T;I.prototype.visitFloat64=T;I.prototype.visitUtf8=T;I.prototype.visitLargeUtf8=T;I.prototype.visitBinary=T;I.prototype.visitLargeBinary=T;I.prototype.visitFixedSizeBinary=T;I.prototype.visitDate=T;I.prototype.visitDateDay=T;I.prototype.visitDateMillisecond=T;I.prototype.visitTimestamp=T;I.prototype.visitTimestampSecond=T;I.prototype.visitTimestampMillisecond=T;I.prototype.visitTimestampMicrosecond=T;I.prototype.visitTimestampNanosecond=T;I.prototype.visitTime=T;I.prototype.visitTimeSecond=T;I.prototype.visitTimeMillisecond=T;I.prototype.visitTimeMicrosecond=T;I.prototype.visitTimeNanosecond=T;I.prototype.visitDecimal=T;I.prototype.visitList=T;I.prototype.visitStruct=T;I.prototype.visitUnion=T;I.prototype.visitDenseUnion=T;I.prototype.visitSparseUnion=T;I.prototype.visitDictionary=T;I.prototype.visitInterval=T;I.prototype.visitIntervalDayTime=T;I.prototype.visitIntervalYearMonth=T;I.prototype.visitIntervalMonthDayNano=T;I.prototype.visitDuration=T;I.prototype.visitDurationSecond=T;I.prototype.visitDurationMillisecond=T;I.prototype.visitDurationMicrosecond=T;I.prototype.visitDurationNanosecond=T;I.prototype.visitFixedSizeList=T;I.prototype.visitMap=T;var xn=new I;var Il,Sl={},Bl={},y=class{constructor(t){var e,n,i;let o=t[0]instanceof y?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof N)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(e=o[0])===null||e===void 0?void 0:e.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=Sl[s.typeId],f=o[0];this.isValid=d=>oi(f,d),this.get=d=>a(f,d),this.set=(d,R)=>c(f,d,R),this.indexOf=d=>l(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,Bl[s.typeId]),this._offsets=Ao(o);break}this.data=o,this.type=s,this.stride=se(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return _l(this.data)}get nullCount(){return xo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${u[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Yr(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return xn.visit(this)}concat(...t){return new y(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new y(ri(this,t,e,({data:n,_offsets:i},o,s)=>To(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case u.Int:case u.Float:case u.Decimal:case u.Time:case u.Timestamp:switch(e.length){case 0:return new o;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new y(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return p.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(p.isDictionary(this.type)){let t=new An(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return new An(this)}unmemoize(){if(p.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return this}};Il=Symbol.toStringTag;y[Il]=(r=>{r.type=p.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(u).map(e=>u[e]).filter(e=>typeof e=="number"&&e!==u.NONE);for(let e of t){let n=ct.getVisitFnByTypeId(e),i=Bt.getVisitFnByTypeId(e),o=qr.getVisitFnByTypeId(e);Sl[e]={get:n,set:i,indexOf:o},Bl[e]=Object.create(r,{isValid:{value:Bn(oi)},get:{value:Bn(ct.getVisitFnByTypeId(e))},set:{value:Do(Bt.getVisitFnByTypeId(e))},indexOf:{value:Oo(qr.getVisitFnByTypeId(e))}})}return"Vector"})(y.prototype);var An=class extends y{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=e.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new An(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new y(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Tn(r){if(r){if(r instanceof N)return new y([r]);if(r instanceof y)return new y(r.data);if(r.type instanceof p)return new y([b(r)]);if(Array.isArray(r))return new y(r.flatMap(t=>Pd(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new y([b(Object.assign(Object.assign({},t),{type:new Pe}))]);if(r instanceof Int16Array)return new y([b(Object.assign(Object.assign({},t),{type:new ke}))]);if(r instanceof Int32Array)return new y([b(Object.assign(Object.assign({},t),{type:new wt}))]);if(r instanceof BigInt64Array)return new y([b(Object.assign(Object.assign({},t),{type:new fe}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new y([b(Object.assign(Object.assign({},t),{type:new Ve}))]);if(r instanceof Uint16Array)return new y([b(Object.assign(Object.assign({},t),{type:new je}))]);if(r instanceof Uint32Array)return new y([b(Object.assign(Object.assign({},t),{type:new ze}))]);if(r instanceof BigUint64Array)return new y([b(Object.assign(Object.assign({},t),{type:new We}))]);if(r instanceof Float32Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ge}))]);if(r instanceof Float64Array)return new y([b(Object.assign(Object.assign({},t),{type:new de}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function Pd(r){return r instanceof N?[r]:r instanceof y?r.data:Tn(r).data}function xl(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
8
8
  switch (x) {${e.map(n=>`
9
- case ${vd(n)}:`).join("")}
9
+ case ${kd(n)}:`).join("")}
10
10
  return false;
11
11
  }`),r.length!==e.length&&(t=`if (x !== x) return false;
12
12
  ${t}`),new Function("x",`${t}
13
- return true;`)}function vd(r){return typeof r!="bigint"?be(r):`${be(r)}n`}function Xs(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function hl(r,t=0){return r.length>=t?r.subarray(0,t):Yn(new r.constructor(t),r,0)}var ve=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?Xs(n*1,this.BYTES_PER_ELEMENT):Xs(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Xs(t*this.stride,this.BYTES_PER_ELEMENT);let e=hl(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=hl(this.buffer,t)}},nr=class extends ve{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}},Bn=class extends nr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return e?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},An=class extends nr{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var q=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=ie(t),this._nulls=new Bn,e&&e.length>0&&(this._isValid=dl(e))}toVector(){return new y([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:o,children:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:f,_nulls:d}=this;(e=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=f?.flush(l.last()):t=f?.flush(s),a>0&&(n=d?.flush(s));let V=this.children.map(N=>N.flush());return this.clear(),b({type:o,length:s,nullCount:a,children:V,child:V[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};q.prototype.length=1;q.prototype.stride=1;q.prototype.children=null;q.prototype.finished=!1;q.prototype.nullValues=null;q.prototype._isValid=()=>!0;var lt=class extends q{constructor(t){super(t),this._values=new nr(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Ht=class extends q{constructor(t){super(t),this._pendingLength=0,this._offsets=new An(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof He?e[Sr].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var Zr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}};var Dt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Dt).__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):z.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new tt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Zr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new Zr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var U=class{constructor(t=[],e,n,i=z.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=qs(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new U(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new U(e,this.metadata)}assign(...t){let e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),n=[...this.fields],i=Ao(Ao(new Map,this.metadata),e.metadata),o=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Ao(Ao(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=qs(o,new Map);return new U([...n,...o],i,new Map([...this.dictionaries,...s]))}};U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;var O=class{static new(...t){let[e,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new O(`${e}`,n,i,o)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],O.new(e,n,i,o)}};O.prototype.type=null;O.prototype.name=null;O.prototype.nullable=null;O.prototype.metadata=null;function Ao(r,t){return new Map([...r||new Map,...t||new Map])}function qs(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let o=r[e].type;if(p.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&qs(o.children,t)}return t}var Id=tr,Sd=Ft,ir=class{static decode(t){t=new Sd(B(t));let e=Dt.getRootAsFooter(t),n=U.decode(e.schema(),new Map,e.version());return new Qs(n,e)}static encode(t){let e=new Id,n=U.encode(e,t.schema);Dt.startRecordBatchesVector(e,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Ie.encode(e,s);let i=e.endVector();Dt.startDictionariesVector(e,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Ie.encode(e,s);let o=e.endVector();return Dt.startFooter(e),Dt.addSchema(e,n),Dt.addVersion(e,z.V5),Dt.addRecordBatches(e,i),Dt.addDictionaries(e,o),Dt.finishFooterBuffer(e,Dt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=z.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Qs=class extends ir{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ie.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ie.decode(e)}return null}},Ie=class{static decode(t){return new Ie(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),o=BigInt(e.bodyLength);return Zr.createBlock(t,i,n,o)}constructor(t,e,n){this.metaDataLength=t,this.offset=C(n),this.bodyLength=C(e)}};var Z=Object.freeze({done:!0,value:void 0}),ni=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Xr=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},To=class extends Xr{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Z);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return bt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return m(this,void 0,void 0,function*(){return yield this.abort(t),Z})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),Z})}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(Z)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Je=class extends To{write(t){if((t=B(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Gn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Gn)}toUint8Array(t=!1){return t?te(this._values)[0]:(()=>m(this,void 0,void 0,function*(){var e,n,i,o;let s=[],a=0;try{for(var c=!0,l=he(this),f;f=yield l.next(),e=f.done,!e;c=!0){o=f.value,c=!1;let d=o;s.push(d),a+=d.byteLength}}catch(d){n={error:d}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return te(s,a)[0]}))()}},Ke=class{constructor(t){t&&(this.source=new ta(bt.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)}},Jt=class{constructor(t){t instanceof Jt?this.source=t.source:t instanceof Je?this.source=new or(bt.fromAsyncIterable(t)):Hi(t)?this.source=new or(bt.fromNodeStream(t)):$n(t)?this.source=new or(bt.fromDOMStream(t)):$i(t)?this.source=new or(bt.fromDOMStream(t.body)):pe(t)?this.source=new or(bt.fromIterable(t)):Qt(t)?this.source=new or(bt.fromAsyncIterable(t)):oe(t)&&(this.source=new or(bt.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)}},ta=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Z)}return(t){return Object.create(this.source.return&&this.source.return(t)||Z)}},or=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return m(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return m(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return m(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var ii=class extends Ke{constructor(t,e){super(),this.position=0,this.buffer=B(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Br=class extends Jt{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>m(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return m(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return m(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,e){return m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let o=Math.min(i,t+e),s=new Uint8Array(o-t);return(yield n.read(s,0,e,t)).buffer}return new Uint8Array(e)})}close(){return m(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ra={};br(ra,{BaseInt64:()=>oi,Int128:()=>Kt,Int64:()=>gt,Uint64:()=>j});function Tn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Dn=8,ea=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],oi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=e[2]*n[3],o+=i,i=e[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Tn(this.buffer[1])} ${Tn(this.buffer[0])}`}},j=class extends oi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return j.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return j.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new j(e);for(let o=0;o<n;){let s=Dn<n-o?Dn:n-o,a=new j(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new j(new Uint32Array([ea[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)j.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new j(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new j(new Uint32Array(t.buffer)).plus(e)}},gt=class extends oi{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return gt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return gt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new gt(e);for(let s=n?1:0;s<i;){let a=Dn<i-s?Dn:i-s,c=new gt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new gt(new Uint32Array([ea[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)gt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new gt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new gt(new Uint32Array(t.buffer)).plus(e)}},Kt=class{constructor(t){this.buffer=t}high(){return new gt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new gt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new j(new Uint32Array([this.buffer[3],0])),n=new j(new Uint32Array([this.buffer[2],0])),i=new j(new Uint32Array([this.buffer[1],0])),o=new j(new Uint32Array([this.buffer[0],0])),s=new j(new Uint32Array([t.buffer[3],0])),a=new j(new Uint32Array([t.buffer[2],0])),c=new j(new Uint32Array([t.buffer[1],0])),l=new j(new Uint32Array([t.buffer[0],0])),f=j.multiply(o,l);this.buffer[0]=f.low();let d=new j(new Uint32Array([f.high(),0]));return f=j.multiply(i,l),d.plus(f),f=j.multiply(o,c),d.plus(f),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(f)?1:0,this.buffer[2]=d.high(),new j(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(j.multiply(n,l)).plus(j.multiply(i,c)).plus(j.multiply(o,a)),this.buffer[3]+=j.multiply(e,l).plus(j.multiply(n,c)).plus(j.multiply(i,a)).plus(j.multiply(o,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`${Tn(this.buffer[3])} ${Tn(this.buffer[2])} ${Tn(this.buffer[1])} ${Tn(this.buffer[0])}`}static multiply(t,e){return new Kt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Kt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Kt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Kt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new Kt(e);for(let s=n?1:0;s<i;){let a=Dn<i-s?Dn:i-s,c=new Kt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new Kt(new Uint32Array([ea[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)Kt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var si=class extends w{constructor(t,e,n,i,o=z.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof O?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return b({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<z.V5&&this.readNullBitmap(t,n),t.mode===Y.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},Do=class extends si{constructor(t,e,n,i,o){super(new Uint8Array(0),e,n,i,o),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Hr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return p.isTimestamp(t)?E(Uint8Array,gt.convertArray(n[e])):(p.isInt(t)||p.isTime(t))&&t.bitWidth===64||p.isDuration(t)?E(Uint8Array,gt.convertArray(n[e])):p.isDate(t)&&t.unit===J.MILLISECOND?E(Uint8Array,gt.convertArray(n[e])):p.isDecimal(t)?E(Uint8Array,Kt.convertArray(n[e])):p.isBinary(t)||p.isLargeBinary(t)||p.isFixedSizeBinary(t)?xd(n[e]):p.isBool(t)?Hr(n[e]):p.isUtf8(t)||p.isLargeUtf8(t)?Be(n[e].join("")):E(Uint8Array,E(t.ArrayType,n[e].map(i=>+i)))}};function xd(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var On=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,B(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var Fn=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,B(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var Oo=class extends q{constructor(t){super(t),this._values=new Bn}setValue(t,e){this._values.set(t,+e)}};var qr=class extends lt{};qr.prototype._setValue=Rs;var ai=class extends qr{};ai.prototype._setValue=eo;var ci=class extends qr{};ci.prototype._setValue=ro;var li=class extends lt{};li.prototype._setValue=Ps;var Fo=class extends q{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Tt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Se({type:this.type.indices,nullValues:e}),this.dictionary=Se({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var ui=class extends lt{};ui.prototype._setValue=Es;var Mo=class extends q{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let o=-1,s=e.length;++o<s;)n.set(i+o,e[o])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Ut(this.type.listSize,new O(e,t.type,!0)),n}};var Qr=class extends lt{setValue(t,e){this._values.set(t,e)}},Lo=class extends Qr{setValue(t,e){super.setValue(t,qn(e))}},No=class extends Qr{},Uo=class extends Qr{};var tn=class extends lt{};tn.prototype._setValue=Vs;var fi=class extends tn{};fi.prototype._setValue=fo;var di=class extends tn{};di.prototype._setValue=ho;var sr=class extends lt{};sr.prototype._setValue=js;var hi=class extends sr{};hi.prototype._setValue=po;var pi=class extends sr{};pi.prototype._setValue=mo;var mi=class extends sr{};mi.prototype._setValue=yo;var yi=class extends sr{};yi.prototype._setValue=go;var fe=class extends lt{setValue(t,e){this._values.set(t,e)}},Eo=class extends fe{},Ro=class extends fe{},Co=class extends fe{},ko=class extends fe{},Po=class extends fe{},Vo=class extends fe{},jo=class extends fe{},zo=class extends fe{};var Wo=class extends Ht{constructor(t){super(t),this._offsets=new An(t.type)}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 wt(new O(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")e.set(i,0);else{let s=o,a=s.length,c=e.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var Go=class extends Ht{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Et(new O(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)e.set(i,0);else{let{[i]:s,[i+1]:a}=e.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var $o=class extends q{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Yo=class extends q{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,e[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,e.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,e[o.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new k([...this.type.children,new O(e,t.type,!0)]),n}};var ar=class extends lt{};ar.prototype._setValue=Cs;var gi=class extends ar{};gi.prototype._setValue=no;var bi=class extends ar{};bi.prototype._setValue=io;var wi=class extends ar{};wi.prototype._setValue=oo;var _i=class extends ar{};_i.prototype._setValue=so;var cr=class extends lt{};cr.prototype._setValue=ks;var vi=class extends cr{};vi.prototype._setValue=ao;var Ii=class extends cr{};Ii.prototype._setValue=co;var Si=class extends cr{};Si.prototype._setValue=lo;var xi=class extends cr{};xi.prototype._setValue=uo;var Mn=class extends q{constructor(t){super(t),this._typeIds=new nr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,e)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new O(e,t.type)];return this.type=new ue(o,[...s,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Ho=class extends Mn{},Jo=class extends Mn{constructor(t){super(t),this._offsets=new nr(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,e)}};var Bi=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Be(e))}_flushPending(t,e){}};Bi.prototype._flushPending=On.prototype._flushPending;var Ai=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Be(e))}_flushPending(t,e){}};Ai.prototype._flushPending=Fn.prototype._flushPending;var na=class extends w{visitNull(){return $o}visitBool(){return Oo}visitInt(){return fe}visitInt8(){return Eo}visitInt16(){return Ro}visitInt32(){return Co}visitInt64(){return ko}visitUint8(){return Po}visitUint16(){return Vo}visitUint32(){return jo}visitUint64(){return zo}visitFloat(){return Qr}visitFloat16(){return Lo}visitFloat32(){return No}visitFloat64(){return Uo}visitUtf8(){return Bi}visitLargeUtf8(){return Ai}visitBinary(){return On}visitLargeBinary(){return Fn}visitFixedSizeBinary(){return ui}visitDate(){return qr}visitDateDay(){return ai}visitDateMillisecond(){return ci}visitTimestamp(){return ar}visitTimestampSecond(){return gi}visitTimestampMillisecond(){return bi}visitTimestampMicrosecond(){return wi}visitTimestampNanosecond(){return _i}visitTime(){return cr}visitTimeSecond(){return vi}visitTimeMillisecond(){return Ii}visitTimeMicrosecond(){return Si}visitTimeNanosecond(){return xi}visitDecimal(){return li}visitList(){return Wo}visitStruct(){return Yo}visitUnion(){return Mn}visitDenseUnion(){return Jo}visitSparseUnion(){return Ho}visitDictionary(){return Fo}visitInterval(){return tn}visitIntervalDayTime(){return fi}visitIntervalYearMonth(){return di}visitDuration(){return sr}visitDurationSecond(){return hi}visitDurationMillisecond(){return pi}visitDurationMicrosecond(){return mi}visitDurationNanosecond(){return yi}visitFixedSizeList(){return Mo}visitMap(){return Go}},pl=new na;var S=class extends w{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function Rt(r,t){return t instanceof r.constructor}function en(r,t){return r===t||Rt(r,t)}function lr(r,t){return r===t||Rt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Ko(r,t){return r===t||Rt(r,t)&&r.precision===t.precision}function Bd(r,t){return r===t||Rt(r,t)&&r.byteWidth===t.byteWidth}function ia(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Ti(r,t){return r===t||Rt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Di(r,t){return r===t||Rt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function Ad(r,t){return r===t||Rt(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function Td(r,t){return r===t||Rt(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function oa(r,t){return r===t||Rt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Ze.compareManyFields(r.children,t.children)}function Dd(r,t){return r===t||Rt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Ze.visit(r.indices,t.indices)&&Ze.visit(r.dictionary,t.dictionary)}function sa(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Oi(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Od(r,t){return r===t||Rt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function Fd(r,t){return r===t||Rt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}S.prototype.visitNull=en;S.prototype.visitBool=en;S.prototype.visitInt=lr;S.prototype.visitInt8=lr;S.prototype.visitInt16=lr;S.prototype.visitInt32=lr;S.prototype.visitInt64=lr;S.prototype.visitUint8=lr;S.prototype.visitUint16=lr;S.prototype.visitUint32=lr;S.prototype.visitUint64=lr;S.prototype.visitFloat=Ko;S.prototype.visitFloat16=Ko;S.prototype.visitFloat32=Ko;S.prototype.visitFloat64=Ko;S.prototype.visitUtf8=en;S.prototype.visitLargeUtf8=en;S.prototype.visitBinary=en;S.prototype.visitLargeBinary=en;S.prototype.visitFixedSizeBinary=Bd;S.prototype.visitDate=ia;S.prototype.visitDateDay=ia;S.prototype.visitDateMillisecond=ia;S.prototype.visitTimestamp=Ti;S.prototype.visitTimestampSecond=Ti;S.prototype.visitTimestampMillisecond=Ti;S.prototype.visitTimestampMicrosecond=Ti;S.prototype.visitTimestampNanosecond=Ti;S.prototype.visitTime=Di;S.prototype.visitTimeSecond=Di;S.prototype.visitTimeMillisecond=Di;S.prototype.visitTimeMicrosecond=Di;S.prototype.visitTimeNanosecond=Di;S.prototype.visitDecimal=en;S.prototype.visitList=Ad;S.prototype.visitStruct=Td;S.prototype.visitUnion=oa;S.prototype.visitDenseUnion=oa;S.prototype.visitSparseUnion=oa;S.prototype.visitDictionary=Dd;S.prototype.visitInterval=sa;S.prototype.visitIntervalDayTime=sa;S.prototype.visitIntervalYearMonth=sa;S.prototype.visitDuration=Oi;S.prototype.visitDurationSecond=Oi;S.prototype.visitDurationMillisecond=Oi;S.prototype.visitDurationMicrosecond=Oi;S.prototype.visitDurationNanosecond=Oi;S.prototype.visitFixedSizeList=Od;S.prototype.visitMap=Fd;var Ze=new S;function rn(r,t){return Ze.compareSchemas(r,t)}function ml(r,t){return Ze.compareFields(r,t)}function Zo(r,t){return Ze.visit(r,t)}function Se(r){let t=r.type,e=new(pl.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);e.children.push(Se(Object.assign(Object.assign({},l),{type:c})))}}return e}function Fi(r,t){if(r instanceof M||r instanceof y||r.type instanceof p||ArrayBuffer.isView(r))return xn(r);let e={type:t??Xo(r),nullValues:[null]},n=[...aa(e)(r)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return p.isDictionary(i.type)?i.memoize():i}function Xo(r){if(r.length===0)return new nt;let t=0,e=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++e:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===r.length)return new le;if(o+t===r.length)return new Tt(new Lt,new yt);if(s+t===r.length)return new ce;if(a+t===r.length)return new Nt;if(c+t===r.length)return new er;if(e+t===r.length){let l=r,f=Xo(l[l.findIndex(d=>d!=null)]);if(l.every(d=>d==null||Zo(f,Xo(d))))return new wt(new O("",f,!0))}else if(n+t===r.length){let l=new Map;for(let f of r)for(let d of Object.keys(f))!l.has(d)&&f[d]!=null&&l.set(d,new O(d,Xo([f[d]]),!0));return new k([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function aa(r){let{["queueingStrategy"]:t="count"}=r,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=Se(r);for(let a of i)s.append(a)[n]>=e&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function qo(r,t){return Md(r,t.map(e=>e.data.concat()))}function Md(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((d,V)=>Math.max(d,V.length),0)},o=0,s=0,a=-1,c=t.length,l,f=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)f[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(f=Ld(e,s,f,t,i),s>0&&(n[o++]=b({type:new k(e),length:s,nullCount:0,children:f.slice()})))}return[r=r.assign(e),n.map(d=>new G(r,d))]}function Ld(r,t,e,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],f=l?.length;if(f>=t)f===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,f-t))));else{let d=r[a];r[a]=d.clone({nullable:!0}),e[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:b({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return e}var yl,$=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let i,o;t[0]instanceof U&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof G)return[c];if(c instanceof $)return c.batches;if(c instanceof M){if(c.type instanceof k)return[new G(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),f=l.map(N=>new y([c[N]])),d=i??new U(l.map((N,st)=>new O(String(N),f[st].type,f[st].nullable))),[,V]=qo(d,f);return V.length===0?[new G(c)]:V}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new U([]),!(i instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof G))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!rn(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Io(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=vo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?In.visit(new y(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
13
+ return true;`)}function kd(r){return typeof r!="bigint"?_e(r):`${_e(r)}n`}function na(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function Al(r,t=0){return r.length>=t?r.subarray(0,t):Xn(new r.constructor(t),r,0)}var Se=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?na(n*1,this.BYTES_PER_ELEMENT):na(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=na(t*this.stride,this.BYTES_PER_ELEMENT);let e=Al(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Al(this.buffer,t)}},sr=class extends Se{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}},Dn=class extends sr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return e?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},On=class extends sr{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var q=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=se(t),this._nulls=new Dn,e&&e.length>0&&(this._isValid=xl(e))}toVector(){return new y([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:o,children:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:f,_nulls:d}=this;(e=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=f?.flush(l.last()):t=f?.flush(s),a>0&&(n=d?.flush(s));let R=this.children.map(D=>D.flush());return this.clear(),b({type:o,length:s,nullCount:a,children:R,child:R[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};q.prototype.length=1;q.prototype.stride=1;q.prototype.children=null;q.prototype.finished=!1;q.prototype.nullValues=null;q.prototype._isValid=()=>!0;var lt=class extends q{constructor(t){super(t),this._values=new sr(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Xt=class extends q{constructor(t){super(t),this._pendingLength=0,this._offsets=new On(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof Ke?e[Br].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var Qr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}};var Mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Mt).__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):G.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new et).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Qr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new Qr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Z).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,G.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var U=class{constructor(t=[],e,n,i=G.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=ia(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new U(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new U(e,this.metadata)}assign(...t){let e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),n=[...this.fields],i=Fo(Fo(new Map,this.metadata),e.metadata),o=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Fo(Fo(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=ia(o,new Map);return new U([...n,...o],i,new Map([...this.dictionaries,...s]))}};U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;var F=class{static new(...t){let[e,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new F(`${e}`,n,i,o)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],F.new(e,n,i,o)}};F.prototype.type=null;F.prototype.name=null;F.prototype.nullable=null;F.prototype.metadata=null;function Fo(r,t){return new Map([...r||new Map,...t||new Map])}function ia(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let o=r[e].type;if(p.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&ia(o.children,t)}return t}var Vd=nr,jd=mt,ar=class{static decode(t){t=new jd(x(t));let e=Mt.getRootAsFooter(t),n=U.decode(e.schema(),new Map,e.version());return new oa(n,e)}static encode(t){let e=new Vd,n=U.encode(e,t.schema);Mt.startRecordBatchesVector(e,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Be.encode(e,s);let i=e.endVector();Mt.startDictionariesVector(e,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Be.encode(e,s);let o=e.endVector();return Mt.startFooter(e),Mt.addSchema(e,n),Mt.addVersion(e,G.V5),Mt.addRecordBatches(e,i),Mt.addDictionaries(e,o),Mt.finishFooterBuffer(e,Mt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=G.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var oa=class extends ar{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Be.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Be.decode(e)}return null}},Be=class{static decode(t){return new Be(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),o=BigInt(e.bodyLength);return Qr.createBlock(t,i,n,o)}constructor(t,e,n){this.metaDataLength=t,this.offset=P(n),this.bodyLength=P(e)}};var ot=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new ot).__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):G.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):C.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):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Z).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,G.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,C.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,o,s){return ot.startMessage(t),ot.addVersion(t,e),ot.addHeaderType(t,n),ot.addHeader(t,i),ot.addBodyLength(t,o),ot.addCustomMetadata(t,s),ot.endMessage(t)}};var sa=class extends w{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ee.startNull(e),Ee.endNull(e)}visitInt(t,e){return yt.startInt(e),yt.addBitWidth(e,t.bitWidth),yt.addIsSigned(e,t.isSigned),yt.endInt(e)}visitFloat(t,e){return Ht.startFloatingPoint(e),Ht.addPrecision(e,t.precision),Ht.endFloatingPoint(e)}visitBinary(t,e){return Fe.startBinary(e),Fe.endBinary(e)}visitLargeBinary(t,e){return Ne.startLargeBinary(e),Ne.endLargeBinary(e)}visitBool(t,e){return Me.startBool(e),Me.endBool(e)}visitUtf8(t,e){return Ce.startUtf8(e),Ce.endUtf8(e)}visitLargeUtf8(t,e){return Le.startLargeUtf8(e),Le.endLargeUtf8(e)}visitDecimal(t,e){return gt.startDecimal(e),gt.addScale(e,t.scale),gt.addPrecision(e,t.precision),gt.addBitWidth(e,t.bitWidth),gt.endDecimal(e)}visitDate(t,e){return zt.startDate(e),zt.addUnit(e,t.unit),zt.endDate(e)}visitTime(t,e){return At.startTime(e),At.addUnit(e,t.unit),At.addBitWidth(e,t.bitWidth),At.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Tt.startTimestamp(e),Tt.addUnit(e,t.unit),n!==void 0&&Tt.addTimezone(e,n),Tt.endTimestamp(e)}visitInterval(t,e){return Yt.startInterval(e),Yt.addUnit(e,t.unit),Yt.endInterval(e)}visitDuration(t,e){return Wt.startDuration(e),Wt.addUnit(e,t.unit),Wt.endDuration(e)}visitList(t,e){return Ue.startList(e),Ue.endList(e)}visitStruct(t,e){return Re.startStruct_(e),Re.endStruct_(e)}visitUnion(t,e){bt.startTypeIdsVector(e,t.typeIds.length);let n=bt.createTypeIdsVector(e,t.typeIds);return bt.startUnion(e),bt.addMode(e,t.mode),bt.addTypeIds(e,n),bt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ne.startDictionaryEncoding(e),ne.addId(e,BigInt(t.id)),ne.addIsOrdered(e,t.isOrdered),n!==void 0&&ne.addIndexType(e,n),ne.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Gt.startFixedSizeBinary(e),Gt.addByteWidth(e,t.byteWidth),Gt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return $t.startFixedSizeList(e),$t.addListSize(e,t.listSize),$t.endFixedSizeList(e)}visitMap(t,e){return Jt.startMap(e),Jt.addKeysSorted(e,t.keysSorted),Jt.endMap(e)}},Mo=new sa;function Fl(r,t=new Map){return new U(zd(r,t),No(r.metadata),t)}function aa(r){return new ft(r.count,Nl(r.columns),Ll(r.columns),null)}function Ml(r){return new Nt(aa(r.data),r.id,r.isDelta)}function zd(r,t){return(r.fields||[]).filter(Boolean).map(e=>F.fromJSON(e,t))}function Tl(r,t){return(r.children||[]).filter(Boolean).map(e=>F.fromJSON(e,t))}function Nl(r){return(r||[]).reduce((t,e)=>[...t,new pe(e.count,Wd(e.VALIDITY)),...Nl(e.children)],[])}function Ll(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ut(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ut(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ut(t.length,i.OFFSET.length)),i.DATA&&t.push(new ut(t.length,i.DATA.length)),t=Ll(i.children,t)}return t}function Wd(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Ul(r,t){let e,n,i,o,s,a;return!t||!(o=r.dictionary)?(s=Ol(r,Tl(r,t)),i=new F(r.name,s,r.nullable,No(r.metadata))):t.has(e=o.id)?(n=(n=o.indexType)?Dl(n):new wt,a=new Ft(t.get(e),n,e,o.isOrdered),i=new F(r.name,a,r.nullable,No(r.metadata))):(n=(n=o.indexType)?Dl(n):new wt,t.set(e,s=Ol(r,Tl(r,t))),a=new Ft(s,n,e,o.isOrdered),i=new F(r.name,a,r.nullable,No(r.metadata))),i||null}function No(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function Dl(r){return new rt(r.isSigned,r.bitWidth)}function Ol(r,t){let e=r.type.name;switch(e){case"NONE":return new it;case"null":return new it;case"binary":return new ie;case"largebinary":return new $e;case"utf8":return new Rt;case"largeutf8":return new He;case"bool":return new Ct;case"list":return new St((t||[])[0]);case"struct":return new k(t||[]);case"struct_":return new k(t||[])}switch(e){case"int":{let n=r.type;return new rt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Et(V[n.precision])}case"decimal":{let n=r.type;return new oe(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Kt(K[n.unit])}case"time":{let n=r.type;return new Dt(h[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Ot(h[n.unit],n.timezone)}case"interval":{let n=r.type;return new Zt(z[n.unit])}case"duration":{let n=r.type;return new Ye(h[n.unit])}case"union":{let n=r.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new he(Y[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Je(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Pt(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new kt((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Gd=nr,$d=mt,dt=class{static fromJSON(t,e){let n=new dt(0,G.V5,e);return n._createHeader=Hd(t,e),n}static decode(t){t=new $d(x(t));let e=ot.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),o=e.headerType(),s=new dt(n,i,o);return s._createHeader=Yd(e,o),s}static encode(t){let e=new Gd,n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=ft.encode(e,t.header()):t.isDictionaryBatch()&&(n=Nt.encode(e,t.header())),ot.startMessage(e),ot.addVersion(e,G.V5),ot.addHeader(e,n),ot.addHeaderType(e,t.headerType),ot.addBodyLength(e,BigInt(t.bodyLength)),ot.finishMessageBuffer(e,ot.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new dt(0,G.V5,C.Schema,t);if(t instanceof ft)return new dt(e,G.V5,C.RecordBatch,t);if(t instanceof Nt)return new dt(e,G.V5,C.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 compression(){return this._compression}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===C.Schema}isRecordBatch(){return this.headerType===C.RecordBatch}isDictionaryBatch(){return this.headerType===C.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),this._compression=i?.compression,i&&(this._createHeader=()=>i),this._bodyLength=P(t)}},ft=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}constructor(t,e,n,i){this._nodes=e,this._buffers=n,this._length=P(t),this._compression=i}},Nt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=P(e)}},ut=class{constructor(t,e){this.offset=P(t),this.length=P(e)}},pe=class{constructor(t,e){this.length=P(t),this.nullCount=P(e)}},tn=class{constructor(t,e=Ur.BUFFER){this.type=t,this.method=e}};function Hd(r,t){return()=>{switch(t){case C.Schema:return U.fromJSON(r);case C.RecordBatch:return ft.fromJSON(r);case C.DictionaryBatch:return Nt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)}}function Yd(r,t){return()=>{switch(t){case C.Schema:return U.decode(r.header(new et),new Map,r.version());case C.RecordBatch:return ft.decode(r.header(new It),r.version());case C.DictionaryBatch:return Nt.decode(r.header(new ue),r.version())}throw new Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)}}F.encode=ih;F.decode=rh;F.fromJSON=Ul;U.encode=nh;U.decode=Jd;U.fromJSON=Fl;ft.encode=oh;ft.decode=Kd;ft.fromJSON=aa;Nt.encode=sh;Nt.decode=Zd;Nt.fromJSON=Ml;pe.encode=ah;pe.decode=qd;ut.encode=ch;ut.decode=Xd;tn.encode=kl;tn.decode=Pl;function Jd(r,t=new Map,e=G.V5){let n=eh(r,t);return new U(n,Lo(r),t,e)}function Kd(r,t=G.V5){return new ft(r.length(),Qd(r),th(r,t),Pl(r.compression()))}function Zd(r,t=G.V5){return new Nt(ft.decode(r.data(),t),r.id(),r.isDelta())}function Xd(r){return new ut(r.offset(),r.length())}function qd(r){return new pe(r.length(),r.nullCount())}function Qd(r){let t=[];for(let e,n=-1,i=-1,o=r.nodesLength();++n<o;)(e=r.nodes(n))&&(t[++i]=pe.decode(e));return t}function th(r,t){let e=[];for(let n,i=-1,o=-1,s=r.buffersLength();++i<s;)(n=r.buffers(i))&&(t<G.V4&&(n.bb_pos+=8*(i+1)),e[++o]=ut.decode(n));return e}function eh(r,t){let e=[];for(let n,i=-1,o=-1,s=r.fieldsLength();++i<s;)(n=r.fields(i))&&(e[++o]=F.decode(n,t));return e}function El(r,t){let e=[];for(let n,i=-1,o=-1,s=r.childrenLength();++i<s;)(n=r.children(i))&&(e[++o]=F.decode(n,t));return e}function rh(r,t){let e,n,i,o,s,a;return!t||!(a=r.dictionary())?(i=Cl(r,El(r,t)),n=new F(r.name(),i,r.nullable(),Lo(r))):t.has(e=P(a.id()))?(o=(o=a.indexType())?Rl(o):new wt,s=new Ft(t.get(e),o,e,a.isOrdered()),n=new F(r.name(),s,r.nullable(),Lo(r))):(o=(o=a.indexType())?Rl(o):new wt,t.set(e,i=Cl(r,El(r,t))),s=new Ft(i,o,e,a.isOrdered()),n=new F(r.name(),s,r.nullable(),Lo(r))),n||null}function Lo(r){let t=new Map;if(r)for(let e,n,i=-1,o=Math.trunc(r.customMetadataLength());++i<o;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Rl(r){return new rt(r.isSigned(),r.bitWidth())}function Cl(r,t){let e=r.typeType();switch(e){case J.NONE:return new it;case J.Null:return new it;case J.Binary:return new ie;case J.LargeBinary:return new $e;case J.Utf8:return new Rt;case J.LargeUtf8:return new He;case J.Bool:return new Ct;case J.List:return new St((t||[])[0]);case J.Struct_:return new k(t||[])}switch(e){case J.Int:{let n=r.type(new yt);return new rt(n.isSigned(),n.bitWidth())}case J.FloatingPoint:{let n=r.type(new Ht);return new Et(n.precision())}case J.Decimal:{let n=r.type(new gt);return new oe(n.scale(),n.precision(),n.bitWidth())}case J.Date:{let n=r.type(new zt);return new Kt(n.unit())}case J.Time:{let n=r.type(new At);return new Dt(n.unit(),n.bitWidth())}case J.Timestamp:{let n=r.type(new Tt);return new Ot(n.unit(),n.timezone())}case J.Interval:{let n=r.type(new Yt);return new Zt(n.unit())}case J.Duration:{let n=r.type(new Wt);return new Ye(n.unit())}case J.Union:{let n=r.type(new bt);return new he(n.mode(),n.typeIdsArray()||[],t||[])}case J.FixedSizeBinary:{let n=r.type(new Gt);return new Je(n.byteWidth())}case J.FixedSizeList:{let n=r.type(new $t);return new Pt(n.listSize(),(t||[])[0])}case J.Map:{let n=r.type(new Jt);return new kt((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${J[e]}" (${e})`)}function Pl(r){return r?new tn(r.codec(),r.method()):null}function nh(r,t){let e=t.fields.map(o=>F.encode(r,o));et.startFieldsVector(r,e.length);let n=et.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?et.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return Z.startKeyValue(r),Z.addKey(r,a),Z.addValue(r,c),Z.endKeyValue(r)})):-1;return et.startSchema(r),et.addFields(r,n),et.addEndianness(r,lh?_r.Little:_r.Big),i!==-1&&et.addCustomMetadata(r,i),et.endSchema(r)}function ih(r,t){let e=-1,n=-1,i=-1,o=t.type,s=t.typeId;p.isDictionary(o)?(s=o.dictionary.typeId,i=Mo.visit(o,r),n=Mo.visit(o.dictionary,r)):n=Mo.visit(o,r);let a=(o.children||[]).map(f=>F.encode(r,f)),c=at.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?at.createCustomMetadataVector(r,[...t.metadata].map(([f,d])=>{let R=r.createString(`${f}`),D=r.createString(`${d}`);return Z.startKeyValue(r),Z.addKey(r,R),Z.addValue(r,D),Z.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,s),at.addChildren(r,c),at.addNullable(r,!!t.nullable),e!==-1&&at.addName(r,e),i!==-1&&at.addDictionary(r,i),l!==-1&&at.addCustomMetadata(r,l),at.endField(r)}function oh(r,t){let e=t.nodes||[],n=t.buffers||[];It.startNodesVector(r,e.length);for(let a of e.slice().reverse())pe.encode(r,a);let i=r.endVector();It.startBuffersVector(r,n.length);for(let a of n.slice().reverse())ut.encode(r,a);let o=r.endVector(),s=null;return t.compression!==null&&(s=kl(r,t.compression)),It.startRecordBatch(r),It.addLength(r,BigInt(t.length)),It.addNodes(r,i),It.addBuffers(r,o),t.compression!==null&&s&&It.addCompression(r,s),It.endRecordBatch(r)}function kl(r,t){return xt.startBodyCompression(r),xt.addCodec(r,t.type),xt.addMethod(r,t.method),xt.endBodyCompression(r)}function sh(r,t){let e=ft.encode(r,t.data);return ue.startDictionaryBatch(r),ue.addId(r,BigInt(t.id)),ue.addIsDelta(r,t.isDelta),ue.addData(r,e),ue.endDictionaryBatch(r)}function ah(r,t){return mn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function ch(r,t){return pn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var lh=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var X=Object.freeze({done:!0,value:void 0}),si=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},en=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Uo=class extends en{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(X);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return vt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return vt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return m(this,void 0,void 0,function*(){return yield this.abort(t),X})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),X})}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(X)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Ze=class extends Uo{write(t){if((t=x(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Kn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Kn)}toUint8Array(t=!1){return t?re(this._values)[0]:(()=>m(this,void 0,void 0,function*(){var e,n,i,o;let s=[],a=0;try{for(var c=!0,l=ye(this),f;f=yield l.next(),e=f.done,!e;c=!0){o=f.value,c=!1;let d=o;s.push(d),a+=d.byteLength}}catch(d){n={error:d}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return re(s,a)[0]}))()}},Xe=class{constructor(t){t&&(this.source=new ca(vt.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)}},qt=class{constructor(t){t instanceof qt?this.source=t.source:t instanceof Ze?this.source=new cr(vt.fromAsyncIterable(t)):Zi(t)?this.source=new cr(vt.fromNodeStream(t)):Zn(t)?this.source=new cr(vt.fromDOMStream(t)):Ji(t)?this.source=new cr(vt.fromDOMStream(t.body)):ge(t)?this.source=new cr(vt.fromIterable(t)):ee(t)?this.source=new cr(vt.fromAsyncIterable(t)):ce(t)&&(this.source=new cr(vt.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)}},ca=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||X)}return(t){return Object.create(this.source.return&&this.source.return(t)||X)}},cr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return m(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return m(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||X;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return m(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||X;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var ai=class extends Xe{constructor(t,e){super(),this.position=0,this.buffer=x(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Ar=class extends qt{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>m(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return m(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return m(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,e){return m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let o=Math.min(i,t+e),s=new Uint8Array(o-t);return(yield n.read(s,0,e,t)).buffer}return new Uint8Array(e)})}close(){return m(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ua={};rr(ua,{BaseInt64:()=>ci,Int128:()=>Qt,Int64:()=>_t,Uint64:()=>W});function Fn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Mn=8,la=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],ci=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=e[2]*n[3],o+=i,i=e[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Fn(this.buffer[1])} ${Fn(this.buffer[0])}`}},W=class extends ci{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return W.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return W.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new W(e);for(let o=0;o<n;){let s=Mn<n-o?Mn:n-o,a=new W(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new W(new Uint32Array([la[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)W.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new W(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new W(new Uint32Array(t.buffer)).plus(e)}},_t=class extends ci{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return _t.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return _t.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new _t(e);for(let s=n?1:0;s<i;){let a=Mn<i-s?Mn:i-s,c=new _t(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new _t(new Uint32Array([la[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)_t.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new _t(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new _t(new Uint32Array(t.buffer)).plus(e)}},Qt=class{constructor(t){this.buffer=t}high(){return new _t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new _t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new W(new Uint32Array([this.buffer[3],0])),n=new W(new Uint32Array([this.buffer[2],0])),i=new W(new Uint32Array([this.buffer[1],0])),o=new W(new Uint32Array([this.buffer[0],0])),s=new W(new Uint32Array([t.buffer[3],0])),a=new W(new Uint32Array([t.buffer[2],0])),c=new W(new Uint32Array([t.buffer[1],0])),l=new W(new Uint32Array([t.buffer[0],0])),f=W.multiply(o,l);this.buffer[0]=f.low();let d=new W(new Uint32Array([f.high(),0]));return f=W.multiply(i,l),d.plus(f),f=W.multiply(o,c),d.plus(f),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(f)?1:0,this.buffer[2]=d.high(),new W(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(W.multiply(n,l)).plus(W.multiply(i,c)).plus(W.multiply(o,a)),this.buffer[3]+=W.multiply(e,l).plus(W.multiply(n,c)).plus(W.multiply(i,a)).plus(W.multiply(o,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`${Fn(this.buffer[3])} ${Fn(this.buffer[2])} ${Fn(this.buffer[1])} ${Fn(this.buffer[0])}`}static multiply(t,e){return new Qt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Qt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Qt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Qt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new Qt(e);for(let s=n?1:0;s<i;){let a=Mn<i-s?Mn:i-s,c=new Qt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new Qt(new Uint32Array([la[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)Qt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var ha={};rr(ha,{toIntervalDayTimeInt32Array:()=>fa,toIntervalDayTimeObjects:()=>uh,toIntervalMonthDayNanoInt32Array:()=>da,toIntervalMonthDayNanoObjects:()=>fh});function fa(r){var t,e;let n=r.length,i=new Int32Array(n*2);for(let o=0,s=0;o<n;o++){let a=r[o];i[s++]=(t=a.days)!==null&&t!==void 0?t:0,i[s++]=(e=a.milliseconds)!==null&&e!==void 0?e:0}return i}function da(r){var t,e;let n=r.length,i=new Int32Array(n*4);for(let o=0,s=0;o<n;o++){let a=r[o];i[s++]=(t=a.months)!==null&&t!==void 0?t:0,i[s++]=(e=a.days)!==null&&e!==void 0?e:0;let c=a.nanoseconds;c?(i[s++]=Number(BigInt(c)&BigInt(4294967295)),i[s++]=Number(BigInt(c)>>BigInt(32))):s+=2}return i}function uh(r){let t=r.length,e=new Array(t/2);for(let n=0,i=0;n<t;n+=2)e[i++]={days:r[n],milliseconds:r[n+1]};return e}function fh(r,t){let e=r.length,n=new Array(e/4);for(let i=0,o=0;i<e;i+=4){let s=BigInt(r[i+3])<<BigInt(32)|BigInt(r[i+2]>>>0);n[o++]={months:r[i],days:r[i+1],nanoseconds:t?`${s}`:s}}return n}var Nn=class extends w{constructor(t,e,n,i,o=G.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof F?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return b({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<G.V5&&this.readNullBitmap(t,n),t.mode===Y.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},Eo=class extends Nn{constructor(t,e,n,i,o){super(new Uint8Array(0),e,n,i,o),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Zr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;if(p.isTimestamp(t))return E(Uint8Array,_t.convertArray(n[e]));if((p.isInt(t)||p.isTime(t))&&t.bitWidth===64||p.isDuration(t))return E(Uint8Array,_t.convertArray(n[e]));if(p.isDate(t)&&t.unit===K.MILLISECOND)return E(Uint8Array,_t.convertArray(n[e]));if(p.isDecimal(t))return E(Uint8Array,Qt.convertArray(n[e]));if(p.isBinary(t)||p.isLargeBinary(t)||p.isFixedSizeBinary(t))return dh(n[e]);if(p.isBool(t))return Zr(n[e]);if(p.isUtf8(t)||p.isLargeUtf8(t))return Te(n[e].join(""));if(p.isInterval(t))switch(t.unit){case z.DAY_TIME:return fa(n[e]);case z.MONTH_DAY_NANO:return da(n[e]);default:break}return E(Uint8Array,E(t.ArrayType,n[e].map(i=>+i)))}};function dh(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var Ro=class extends Nn{constructor(t,e,n,i,o){super(new Uint8Array(0),e,n,i,o),this.bodyChunks=t}readData(t,e=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}};var Ln=class extends Xt{constructor(t){super(t),this._values=new Se(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,x(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var Un=class extends Xt{constructor(t){super(t),this._values=new Se(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,x(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var Co=class extends q{constructor(t){super(t),this._values=new Dn}setValue(t,e){this._values.set(t,+e)}};var rn=class extends lt{};rn.prototype._setValue=zs;var li=class extends rn{};li.prototype._setValue=io;var ui=class extends rn{};ui.prototype._setValue=oo;var fi=class extends lt{};fi.prototype._setValue=$s;var Po=class extends q{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Ft(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=xe({type:this.type.indices,nullValues:e}),this.dictionary=xe({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var di=class extends lt{};di.prototype._setValue=js;var ko=class extends q{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let o=-1,s=this.stride;++o<s;)n.set(i+o,e[o])}setValid(t,e){return super.setValid(t,e)||this.children[0].setValid((t+1)*this.stride-1,!1),e}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Pt(this.type.listSize,new F(e,t.type,!0)),n}};var nn=class extends lt{setValue(t,e){this._values.set(t,e)}},Vo=class extends nn{setValue(t,e){super.setValue(t,ei(e))}},jo=class extends nn{},zo=class extends nn{};var Tr=class extends lt{};Tr.prototype._setValue=Hs;var hi=class extends Tr{};hi.prototype._setValue=mo;var pi=class extends Tr{};pi.prototype._setValue=yo;var mi=class extends Tr{};mi.prototype._setValue=go;var lr=class extends lt{};lr.prototype._setValue=Ys;var yi=class extends lr{};yi.prototype._setValue=bo;var gi=class extends lr{};gi.prototype._setValue=wo;var bi=class extends lr{};bi.prototype._setValue=_o;var wi=class extends lr{};wi.prototype._setValue=vo;var me=class extends lt{setValue(t,e){this._values.set(t,e)}},Wo=class extends me{},Go=class extends me{},$o=class extends me{},Ho=class extends me{},Yo=class extends me{},Jo=class extends me{},Ko=class extends me{},Zo=class extends me{};var Xo=class extends Xt{constructor(t){super(t),this._offsets=new On(t.type)}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 St(new F(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")e.set(i,0);else{let s=o,a=s.length,c=e.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var qo=class extends Xt{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new kt(new F(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)e.set(i,0);else{let{[i]:s,[i+1]:a}=e.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var Qo=class extends q{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var ts=class extends q{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,e[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,e.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,e[o.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new k([...this.type.children,new F(e,t.type,!0)]),n}};var ur=class extends lt{};ur.prototype._setValue=Ws;var _i=class extends ur{};_i.prototype._setValue=so;var vi=class extends ur{};vi.prototype._setValue=ao;var Ii=class extends ur{};Ii.prototype._setValue=co;var Si=class extends ur{};Si.prototype._setValue=lo;var fr=class extends lt{};fr.prototype._setValue=Gs;var Bi=class extends fr{};Bi.prototype._setValue=uo;var xi=class extends fr{};xi.prototype._setValue=fo;var Ai=class extends fr{};Ai.prototype._setValue=ho;var Ti=class extends fr{};Ti.prototype._setValue=po;var En=class extends q{constructor(t){super(t),this._typeIds=new sr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,e),this.length=Math.max(t+1,this.length)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new F(e,t.type)];return this.type=new he(o,[...s,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},es=class extends En{},rs=class extends En{constructor(t){super(t),this._offsets=new sr(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,e),this.length=Math.max(t+1,this.length)}};var Di=class extends Xt{constructor(t){super(t),this._values=new Se(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Te(e))}_flushPending(t,e){}};Di.prototype._flushPending=Ln.prototype._flushPending;var Oi=class extends Xt{constructor(t){super(t),this._values=new Se(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Te(e))}_flushPending(t,e){}};Oi.prototype._flushPending=Un.prototype._flushPending;var pa=class extends w{visitNull(){return Qo}visitBool(){return Co}visitInt(){return me}visitInt8(){return Wo}visitInt16(){return Go}visitInt32(){return $o}visitInt64(){return Ho}visitUint8(){return Yo}visitUint16(){return Jo}visitUint32(){return Ko}visitUint64(){return Zo}visitFloat(){return nn}visitFloat16(){return Vo}visitFloat32(){return jo}visitFloat64(){return zo}visitUtf8(){return Di}visitLargeUtf8(){return Oi}visitBinary(){return Ln}visitLargeBinary(){return Un}visitFixedSizeBinary(){return di}visitDate(){return rn}visitDateDay(){return li}visitDateMillisecond(){return ui}visitTimestamp(){return ur}visitTimestampSecond(){return _i}visitTimestampMillisecond(){return vi}visitTimestampMicrosecond(){return Ii}visitTimestampNanosecond(){return Si}visitTime(){return fr}visitTimeSecond(){return Bi}visitTimeMillisecond(){return xi}visitTimeMicrosecond(){return Ai}visitTimeNanosecond(){return Ti}visitDecimal(){return fi}visitList(){return Xo}visitStruct(){return ts}visitUnion(){return En}visitDenseUnion(){return rs}visitSparseUnion(){return es}visitDictionary(){return Po}visitInterval(){return Tr}visitIntervalDayTime(){return hi}visitIntervalYearMonth(){return pi}visitIntervalMonthDayNano(){return mi}visitDuration(){return lr}visitDurationSecond(){return yi}visitDurationMillisecond(){return gi}visitDurationMicrosecond(){return bi}visitDurationNanosecond(){return wi}visitFixedSizeList(){return ko}visitMap(){return qo}},jl=new pa;var S=class extends w{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function Vt(r,t){return t instanceof r.constructor}function on(r,t){return r===t||Vt(r,t)}function dr(r,t){return r===t||Vt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function ns(r,t){return r===t||Vt(r,t)&&r.precision===t.precision}function hh(r,t){return r===t||Vt(r,t)&&r.byteWidth===t.byteWidth}function ma(r,t){return r===t||Vt(r,t)&&r.unit===t.unit}function Fi(r,t){return r===t||Vt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Mi(r,t){return r===t||Vt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function ph(r,t){return r===t||Vt(r,t)&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}function mh(r,t){return r===t||Vt(r,t)&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}function ya(r,t){return r===t||Vt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&qe.compareManyFields(r.children,t.children)}function yh(r,t){return r===t||Vt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&qe.visit(r.indices,t.indices)&&qe.visit(r.dictionary,t.dictionary)}function is(r,t){return r===t||Vt(r,t)&&r.unit===t.unit}function Ni(r,t){return r===t||Vt(r,t)&&r.unit===t.unit}function gh(r,t){return r===t||Vt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}function bh(r,t){return r===t||Vt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}S.prototype.visitNull=on;S.prototype.visitBool=on;S.prototype.visitInt=dr;S.prototype.visitInt8=dr;S.prototype.visitInt16=dr;S.prototype.visitInt32=dr;S.prototype.visitInt64=dr;S.prototype.visitUint8=dr;S.prototype.visitUint16=dr;S.prototype.visitUint32=dr;S.prototype.visitUint64=dr;S.prototype.visitFloat=ns;S.prototype.visitFloat16=ns;S.prototype.visitFloat32=ns;S.prototype.visitFloat64=ns;S.prototype.visitUtf8=on;S.prototype.visitLargeUtf8=on;S.prototype.visitBinary=on;S.prototype.visitLargeBinary=on;S.prototype.visitFixedSizeBinary=hh;S.prototype.visitDate=ma;S.prototype.visitDateDay=ma;S.prototype.visitDateMillisecond=ma;S.prototype.visitTimestamp=Fi;S.prototype.visitTimestampSecond=Fi;S.prototype.visitTimestampMillisecond=Fi;S.prototype.visitTimestampMicrosecond=Fi;S.prototype.visitTimestampNanosecond=Fi;S.prototype.visitTime=Mi;S.prototype.visitTimeSecond=Mi;S.prototype.visitTimeMillisecond=Mi;S.prototype.visitTimeMicrosecond=Mi;S.prototype.visitTimeNanosecond=Mi;S.prototype.visitDecimal=on;S.prototype.visitList=ph;S.prototype.visitStruct=mh;S.prototype.visitUnion=ya;S.prototype.visitDenseUnion=ya;S.prototype.visitSparseUnion=ya;S.prototype.visitDictionary=yh;S.prototype.visitInterval=is;S.prototype.visitIntervalDayTime=is;S.prototype.visitIntervalYearMonth=is;S.prototype.visitIntervalMonthDayNano=is;S.prototype.visitDuration=Ni;S.prototype.visitDurationSecond=Ni;S.prototype.visitDurationMillisecond=Ni;S.prototype.visitDurationMicrosecond=Ni;S.prototype.visitDurationNanosecond=Ni;S.prototype.visitFixedSizeList=gh;S.prototype.visitMap=bh;var qe=new S;function sn(r,t){return qe.compareSchemas(r,t)}function zl(r,t){return qe.compareFields(r,t)}function os(r,t){return qe.visit(r,t)}function xe(r){let t=r.type,e=new(jl.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);e.children.push(xe(Object.assign(Object.assign({},l),{type:c})))}}return e}function Li(r,t){if(r instanceof N||r instanceof y||r.type instanceof p||ArrayBuffer.isView(r))return Tn(r);let e={type:t??ss(r),nullValues:[null]},n=[...ga(e)(r)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return p.isDictionary(i.type)?i.memoize():i}function ss(r){if(r.length===0)return new it;let t=0,e=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++e:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===r.length)return new de;if(o+t===r.length)return new Ft(new Rt,new wt);if(s+t===r.length)return new fe;if(a+t===r.length)return new Ct;if(c+t===r.length)return new ir;if(e+t===r.length){let l=r,f=ss(l[l.findIndex(d=>d!=null)]);if(l.every(d=>d==null||os(f,ss(d))))return new St(new F("",f,!0))}else if(n+t===r.length){let l=new Map;for(let f of r)for(let d of Object.keys(f))!l.has(d)&&f[d]!=null&&l.set(d,new F(d,ss([f[d]]),!0));return new k([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function ga(r){let{["queueingStrategy"]:t="count"}=r,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=xe(r);for(let a of i)s.append(a)[n]>=e&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function as(r,t){return wh(r,t.map(e=>e.data.concat()))}function wh(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((d,R)=>Math.max(d,R.length),0)},o=0,s=0,a=-1,c=t.length,l,f=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)f[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(f=_h(e,s,f,t,i),s>0&&(n[o++]=b({type:new k(e),length:s,nullCount:0,children:f.slice()})))}return[r=r.assign(e),n.map(d=>new $(r,d))]}function _h(r,t,e,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],f=l?.length;if(f>=t)f===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,f-t))));else{let d=r[a];r[a]=d.clone({nullable:!0}),e[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:b({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return e}var Wl,H=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let i,o;t[0]instanceof U&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof $)return[c];if(c instanceof H)return c.batches;if(c instanceof N){if(c.type instanceof k)return[new $(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),f=l.map(D=>new y([c[D]])),d=i??new U(l.map((D,tt)=>new F(String(D),f[tt].type,f[tt].nullable))),[,R]=as(d,f);return R.length===0?[new $(c)]:R}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new U([]),!(i instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof $))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!sn(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Ao(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=xo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Yr(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?xn.visit(new y(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
14
14
  ${this.toArray().join(`,
15
15
  `)}
16
- ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new $(e,n.map(i=>new G(e,i)))}slice(t,e){let n=this.schema;[t,e]=Qn({length:this.numRows},t,e);let i=So(this.data,this._offsets,t,e);return new $(n,i.map(o=>new G(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=b({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new y(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,e],[n,i]=qo(n,a)}return new $(n,i)}select(t){let e=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new $(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[f,d]=a,V=e.findIndex(N=>N.name===c.name);return~V?d[V]=l:f.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...e.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new $(...qo(o,s))}};yl=Symbol.toStringTag;$[yl]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=vn(ri),r.get=vn(ct.getVisitFn(u.Struct)),r.set=xo(_t.getVisitFn(u.Struct)),r.indexOf=Bo(Kr.getVisitFn(u.Struct)),"Table"))($.prototype);var bl,G=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=b({nullCount:0,type:new k(this.schema.fields),children:this.schema.fields.map(e=>b({type:e.type,nullCount:0}))})]=t,!(this.data instanceof M))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=gl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:o}=Object.keys(e).reduce((c,l,f)=>(c.children[f]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[f]=O.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new U(n),a=b({type:new k(n),length:o,children:i,nullCount:0});[this.schema,this.data]=gl(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=wl(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return ct.visit(this.data,t)}at(t){return this.get(Gr(t,this.numRows))}set(t,e){return _t.visit(this.data,t,e)}indexOf(t,e){return Kr.visit(this.data,t,e)}[Symbol.iterator](){return In.visit(new y([this.data]))}toArray(){return[...this]}concat(...t){return new $(this.schema,[this,...t])}slice(t,e){let[n]=new y([this.data]).slice(t,e).data;return new G(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new y([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:e.type});[o[t],s[t]]=[a,e.data[0]],n=new U(o,new Map(this.schema.metadata)),i=b({type:new k(o),children:s})}return new G(n,i)}select(t){let e=this.schema.select(t),n=new k(e.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new G(e,b({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=b({type:new k(e.fields),length:this.numRows,children:n});return new G(e,i)}};bl=Symbol.toStringTag;G[bl]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(G.prototype);function gl(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],o=[...t],s=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:b({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)}))}return[r.assign(i),b({type:new k(i),length:e,children:o})]}function wl(r,t,e=new Map){var n,i;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let o=-1,s=r.length;++o<s;){let{type:a}=r[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])wl(a.children,l?.children,e);if(p.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var nn=class extends G{constructor(t){let e=t.fields.map(i=>b({type:i.type})),n=b({type:new k(t.fields),nullCount:0,children:e});super(t,n)}};var it=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new it).__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):z.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):R.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):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,R.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,o,s){return it.startMessage(t),it.addVersion(t,e),it.addHeaderType(t,n),it.addHeader(t,i),it.addBodyLength(t,o),it.addCustomMetadata(t,s),it.endMessage(t)}};var ca=class extends w{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ne.startNull(e),Ne.endNull(e)}visitInt(t,e){return ht.startInt(e),ht.addBitWidth(e,t.bitWidth),ht.addIsSigned(e,t.isSigned),ht.endInt(e)}visitFloat(t,e){return zt.startFloatingPoint(e),zt.addPrecision(e,t.precision),zt.endFloatingPoint(e)}visitBinary(t,e){return De.startBinary(e),De.endBinary(e)}visitLargeBinary(t,e){return Fe.startLargeBinary(e),Fe.endLargeBinary(e)}visitBool(t,e){return Oe.startBool(e),Oe.endBool(e)}visitUtf8(t,e){return Ee.startUtf8(e),Ee.endUtf8(e)}visitLargeUtf8(t,e){return Me.startLargeUtf8(e),Me.endLargeUtf8(e)}visitDecimal(t,e){return pt.startDecimal(e),pt.addScale(e,t.scale),pt.addPrecision(e,t.precision),pt.addBitWidth(e,t.bitWidth),pt.endDecimal(e)}visitDate(t,e){return kt.startDate(e),kt.addUnit(e,t.unit),kt.endDate(e)}visitTime(t,e){return St.startTime(e),St.addUnit(e,t.unit),St.addBitWidth(e,t.bitWidth),St.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return xt.startTimestamp(e),xt.addUnit(e,t.unit),n!==void 0&&xt.addTimezone(e,n),xt.endTimestamp(e)}visitInterval(t,e){return Wt.startInterval(e),Wt.addUnit(e,t.unit),Wt.endInterval(e)}visitDuration(t,e){return Pt.startDuration(e),Pt.addUnit(e,t.unit),Pt.endDuration(e)}visitList(t,e){return Le.startList(e),Le.endList(e)}visitStruct(t,e){return Ue.startStruct_(e),Ue.endStruct_(e)}visitUnion(t,e){mt.startTypeIdsVector(e,t.typeIds.length);let n=mt.createTypeIdsVector(e,t.typeIds);return mt.startUnion(e),mt.addMode(e,t.mode),mt.addTypeIds(e,n),mt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ee.startDictionaryEncoding(e),ee.addId(e,BigInt(t.id)),ee.addIsOrdered(e,t.isOrdered),n!==void 0&&ee.addIndexType(e,n),ee.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(e),Vt.addByteWidth(e,t.byteWidth),Vt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return jt.startFixedSizeList(e),jt.addListSize(e,t.listSize),jt.endFixedSizeList(e)}visitMap(t,e){return Gt.startMap(e),Gt.addKeysSorted(e,t.keysSorted),Gt.endMap(e)}},Qo=new ca;function Sl(r,t=new Map){return new U(Nd(r,t),ts(r.metadata),t)}function la(r){return new vt(r.count,Bl(r.columns),Al(r.columns))}function xl(r){return new Xt(la(r.data),r.id,r.isDelta)}function Nd(r,t){return(r.fields||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function _l(r,t){return(r.children||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function Bl(r){return(r||[]).reduce((t,e)=>[...t,new de(e.count,Ud(e.VALIDITY)),...Bl(e.children)],[])}function Al(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Zt(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Zt(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Zt(t.length,i.OFFSET.length)),i.DATA&&t.push(new Zt(t.length,i.DATA.length)),t=Al(i.children,t)}return t}function Ud(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Tl(r,t){let e,n,i,o,s,a;return!t||!(o=r.dictionary)?(s=Il(r,_l(r,t)),i=new O(r.name,s,r.nullable,ts(r.metadata))):t.has(e=o.id)?(n=(n=o.indexType)?vl(n):new yt,a=new Tt(t.get(e),n,e,o.isOrdered),i=new O(r.name,a,r.nullable,ts(r.metadata))):(n=(n=o.indexType)?vl(n):new yt,t.set(e,s=Il(r,_l(r,t))),a=new Tt(s,n,e,o.isOrdered),i=new O(r.name,a,r.nullable,ts(r.metadata))),i||null}function ts(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function vl(r){return new et(r.isSigned,r.bitWidth)}function Il(r,t){let e=r.type.name;switch(e){case"NONE":return new nt;case"null":return new nt;case"binary":return new re;case"largebinary":return new We;case"utf8":return new Lt;case"largeutf8":return new Ge;case"bool":return new Nt;case"list":return new wt((t||[])[0]);case"struct":return new k(t||[]);case"struct_":return new k(t||[])}switch(e){case"int":{let n=r.type;return new et(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Mt(P[n.precision])}case"decimal":{let n=r.type;return new ne(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new $t(J[n.unit])}case"time":{let n=r.type;return new Bt(h[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new At(h[n.unit],n.timezone)}case"interval":{let n=r.type;return new Yt(Q[n.unit])}case"duration":{let n=r.type;return new $e(h[n.unit])}case"union":{let n=r.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new ue(Y[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Ye(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ut(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Et((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ed=tr,Rd=Ft,ut=class{static fromJSON(t,e){let n=new ut(0,z.V5,e);return n._createHeader=Cd(t,e),n}static decode(t){t=new Rd(B(t));let e=it.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),o=e.headerType(),s=new ut(n,i,o);return s._createHeader=kd(e,o),s}static encode(t){let e=new Ed,n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=vt.encode(e,t.header()):t.isDictionaryBatch()&&(n=Xt.encode(e,t.header())),it.startMessage(e),it.addVersion(e,z.V5),it.addHeader(e,n),it.addHeaderType(e,t.headerType),it.addBodyLength(e,BigInt(t.bodyLength)),it.finishMessageBuffer(e,it.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new ut(0,z.V5,R.Schema,t);if(t instanceof vt)return new ut(e,z.V5,R.RecordBatch,t);if(t instanceof Xt)return new ut(e,z.V5,R.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===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=C(t)}},vt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=C(t)}},Xt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=C(e)}},Zt=class{constructor(t,e){this.offset=C(t),this.length=C(e)}},de=class{constructor(t,e){this.length=C(t),this.nullCount=C(e)}};function Cd(r,t){return()=>{switch(t){case R.Schema:return U.fromJSON(r);case R.RecordBatch:return vt.fromJSON(r);case R.DictionaryBatch:return Xt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function kd(r,t){return()=>{switch(t){case R.Schema:return U.decode(r.header(new tt),new Map,r.version());case R.RecordBatch:return vt.decode(r.header(new It),r.version());case R.DictionaryBatch:return Xt.decode(r.header(new ae),r.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}O.encode=Kd;O.decode=Hd;O.fromJSON=Tl;U.encode=Jd;U.decode=Pd;U.fromJSON=Sl;vt.encode=Zd;vt.decode=Vd;vt.fromJSON=la;Xt.encode=Xd;Xt.decode=jd;Xt.fromJSON=xl;de.encode=qd;de.decode=Wd;Zt.encode=Qd;Zt.decode=zd;function Pd(r,t=new Map,e=z.V5){let n=Yd(r,t);return new U(n,es(r),t,e)}function Vd(r,t=z.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new vt(r.length(),Gd(r),$d(r,t))}function jd(r,t=z.V5){return new Xt(vt.decode(r.data(),t),r.id(),r.isDelta())}function zd(r){return new Zt(r.offset(),r.length())}function Wd(r){return new de(r.length(),r.nullCount())}function Gd(r){let t=[];for(let e,n=-1,i=-1,o=r.nodesLength();++n<o;)(e=r.nodes(n))&&(t[++i]=de.decode(e));return t}function $d(r,t){let e=[];for(let n,i=-1,o=-1,s=r.buffersLength();++i<s;)(n=r.buffers(i))&&(t<z.V4&&(n.bb_pos+=8*(i+1)),e[++o]=Zt.decode(n));return e}function Yd(r,t){let e=[];for(let n,i=-1,o=-1,s=r.fieldsLength();++i<s;)(n=r.fields(i))&&(e[++o]=O.decode(n,t));return e}function Dl(r,t){let e=[];for(let n,i=-1,o=-1,s=r.childrenLength();++i<s;)(n=r.children(i))&&(e[++o]=O.decode(n,t));return e}function Hd(r,t){let e,n,i,o,s,a;return!t||!(a=r.dictionary())?(i=Fl(r,Dl(r,t)),n=new O(r.name(),i,r.nullable(),es(r))):t.has(e=C(a.id()))?(o=(o=a.indexType())?Ol(o):new yt,s=new Tt(t.get(e),o,e,a.isOrdered()),n=new O(r.name(),s,r.nullable(),es(r))):(o=(o=a.indexType())?Ol(o):new yt,t.set(e,i=Fl(r,Dl(r,t))),s=new Tt(i,o,e,a.isOrdered()),n=new O(r.name(),s,r.nullable(),es(r))),n||null}function es(r){let t=new Map;if(r)for(let e,n,i=-1,o=Math.trunc(r.customMetadataLength());++i<o;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Ol(r){return new et(r.isSigned(),r.bitWidth())}function Fl(r,t){let e=r.typeType();switch(e){case H.NONE:return new nt;case H.Null:return new nt;case H.Binary:return new re;case H.LargeBinary:return new We;case H.Utf8:return new Lt;case H.LargeUtf8:return new Ge;case H.Bool:return new Nt;case H.List:return new wt((t||[])[0]);case H.Struct_:return new k(t||[])}switch(e){case H.Int:{let n=r.type(new ht);return new et(n.isSigned(),n.bitWidth())}case H.FloatingPoint:{let n=r.type(new zt);return new Mt(n.precision())}case H.Decimal:{let n=r.type(new pt);return new ne(n.scale(),n.precision(),n.bitWidth())}case H.Date:{let n=r.type(new kt);return new $t(n.unit())}case H.Time:{let n=r.type(new St);return new Bt(n.unit(),n.bitWidth())}case H.Timestamp:{let n=r.type(new xt);return new At(n.unit(),n.timezone())}case H.Interval:{let n=r.type(new Wt);return new Yt(n.unit())}case H.Duration:{let n=r.type(new Pt);return new $e(n.unit())}case H.Union:{let n=r.type(new mt);return new ue(n.mode(),n.typeIdsArray()||[],t||[])}case H.FixedSizeBinary:{let n=r.type(new Vt);return new Ye(n.byteWidth())}case H.FixedSizeList:{let n=r.type(new jt);return new Ut(n.listSize(),(t||[])[0])}case H.Map:{let n=r.type(new Gt);return new Et((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${H[e]}" (${e})`)}function Jd(r,t){let e=t.fields.map(o=>O.encode(r,o));tt.startFieldsVector(r,e.length);let n=tt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?tt.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return K.startKeyValue(r),K.addKey(r,a),K.addValue(r,c),K.endKeyValue(r)})):-1;return tt.startSchema(r),tt.addFields(r,n),tt.addEndianness(r,th?wr.Little:wr.Big),i!==-1&&tt.addCustomMetadata(r,i),tt.endSchema(r)}function Kd(r,t){let e=-1,n=-1,i=-1,o=t.type,s=t.typeId;p.isDictionary(o)?(s=o.dictionary.typeId,i=Qo.visit(o,r),n=Qo.visit(o.dictionary,r)):n=Qo.visit(o,r);let a=(o.children||[]).map(f=>O.encode(r,f)),c=at.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?at.createCustomMetadataVector(r,[...t.metadata].map(([f,d])=>{let V=r.createString(`${f}`),N=r.createString(`${d}`);return K.startKeyValue(r),K.addKey(r,V),K.addValue(r,N),K.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,s),at.addChildren(r,c),at.addNullable(r,!!t.nullable),e!==-1&&at.addName(r,e),i!==-1&&at.addDictionary(r,i),l!==-1&&at.addCustomMetadata(r,l),at.endField(r)}function Zd(r,t){let e=t.nodes||[],n=t.buffers||[];It.startNodesVector(r,e.length);for(let s of e.slice().reverse())de.encode(r,s);let i=r.endVector();It.startBuffersVector(r,n.length);for(let s of n.slice().reverse())Zt.encode(r,s);let o=r.endVector();return It.startRecordBatch(r),It.addLength(r,BigInt(t.length)),It.addNodes(r,i),It.addBuffers(r,o),It.endRecordBatch(r)}function Xd(r,t){let e=vt.encode(r,t.data);return ae.startDictionaryBatch(r),ae.addId(r,BigInt(t.id)),ae.addIsDelta(r,t.isDelta),ae.addData(r,e),ae.endDictionaryBatch(r)}function qd(r,t){return dn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Qd(r,t){return fn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var th=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var fa=r=>`Expected ${R[r]} Message in stream, but was null or length 0.`,da=r=>`Header pointer of flatbuffer-encoded ${R[r]} Message is null or length 0.`,Ml=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Ll=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Ln=class{constructor(t){this.source=t instanceof Ke?t:new Ke(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Z:t.value===-1&&(t=this.readMetadataLength()).done?Z:(t=this.readMetadata(t.value)).done?Z:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=B(this.source.read(t));if(e.byteLength<t)throw new Error(Ll(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=R.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(da(e));return i}readMetadataLength(){let t=this.source.read(rs),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Ml(t,e.byteLength));return{done:!1,value:ut.decode(e)}}},Mi=class{constructor(t,e){this.source=t instanceof Jt?t:Gi(t)?new Br(t,e):new Jt(t)}[Symbol.asyncIterator](){return this}next(){return m(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Z:t.value===-1&&(t=yield this.readMetadataLength()).done?Z:(t=yield this.readMetadata(t.value)).done?Z:t})}throw(t){return m(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return m(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return m(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value})}readMessageBody(t){return m(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=B(yield this.source.read(t));if(e.byteLength<t)throw new Error(Ll(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return m(this,arguments,void 0,function*(t=!1){let e=R.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(da(e));return i})}readMetadataLength(){return m(this,void 0,void 0,function*(){let t=yield this.source.read(rs),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return m(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Ml(t,e.byteLength));return{done:!1,value:ut.decode(e)}})}},Li=class extends Ln{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ni?t:new ni(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ut.fromJSON(t.schema,R.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ut.fromJSON(e,R.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ut.fromJSON(e,R.RecordBatch)}}return this._body=[],Z}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...e(o.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value}readSchema(){let t=R.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(da(t));return n}},rs=4,ua="ARROW1",Nn=new Uint8Array(ua.length);for(let r=0;r<ua.length;r+=1)Nn[r]=ua.codePointAt(r);function ns(r,t=0){for(let e=-1,n=Nn.length;++e<n;)if(Nn[e]!==r[t+e])return!1;return!0}var Un=Nn.length,ha=Un+rs,Nl=Un*2+rs;var ft=class extends Xr{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Qt(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 bt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bt.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 ft?t:zi(t)?rh(t):Gi(t)?oh(t):Qt(t)?(()=>m(this,void 0,void 0,function*(){return yield ft.from(yield t)}))():$i(t)||$n(t)||Hi(t)||oe(t)?ih(new Jt(t)):nh(new Ke(t))}static readAll(t){return t instanceof ft?t.isSync()?Ul(t):El(t):zi(t)||ArrayBuffer.isView(t)||pe(t)||Wi(t)?Ul(t):El(t)}},Xe=class extends ft{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return qt(this,arguments,function*(){yield L(yield*ln(he(this[Symbol.iterator]())))})}},Ar=class extends ft{constructor(t){super(t),this._impl=t}readAll(){return m(this,void 0,void 0,function*(){var t,e,n,i;let o=new Array;try{for(var s=!0,a=he(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){e={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Tr=class extends Xe{constructor(t){super(t),this._impl=t}},Ni=class extends Ar{constructor(t){super(t),this._impl=t}},is=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=b({type:new k(this.schema.fields),length:t.length,children:n});return new G(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new y(l)):new y(l)).memoize()}_loadVectors(t,e,n){return new si(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},En=class extends is{constructor(t,e){super(e),this._reader=zi(t)?new Li(this._handle=t):new Ln(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=Rl(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):Z}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Z}next(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Rn=class extends is{constructor(t,e){super(e),this._reader=new Mi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return m(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return m(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Rl(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Z})}return(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Z})}next(){return m(this,void 0,void 0,function*(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},os=class extends En{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof ii?t:new ii(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-ha,n=t.readInt32(e),i=t.readAt(e-n,n);return ir.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},pa=class extends Rn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Br?t:new Br(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return m(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return m(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return m(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return m(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ha,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return ir.decode(i)})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},ma=class extends En{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Do(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Rl(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Ul(r){let t=ft.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function El(r){return qt(this,arguments,function*(){let e=yield L(ft.from(r));try{if(!(yield L(e.open({autoDestroy:!1}))).closed)do yield yield L(e);while(!(yield L(e.reset().open())).closed)}finally{yield L(e.cancel())}})}function rh(r){return new Xe(new ma(r))}function nh(r){let t=r.peek(Un+7&-8);return t&&t.byteLength>=4?ns(t)?new Tr(new os(r.read())):new Xe(new En(r)):new Xe(new En(function*(){}()))}function ih(r){return m(this,void 0,void 0,function*(){let t=yield r.peek(Un+7&-8);return t&&t.byteLength>=4?ns(t)?new Tr(new os(yield r.read())):new Ar(new Rn(r)):new Ar(new Rn(function(){return qt(this,arguments,function*(){})}()))})}function oh(r){return m(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Br(r,t);return t>=Nl&&ns(yield e.readAt(0,Un+7&-8))?new Ni(new pa(e)):new Ar(new Rn(e))})}var X=class extends w{static assemble(...t){let e=i=>i.flatMap(o=>Array.isArray(o)?e(o):o instanceof G?o.data.children:o.data),n=new X;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof y)return this.visitMany(t.data),this;let{type:e}=t;if(!p.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(p.isUnion(e))this.nodes.push(new de(n,0));else{let{nullCount:i}=t;p.isNull(e)||xe.call(this,i<=0?new Uint8Array(0):Yr(t.offset,n,t.nullBitmap)),this.nodes.push(new de(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function xe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Zt(this._byteLength,t)),this._byteLength+=t,this}function sh(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:o}=r;if(xe.call(this,i),e.mode===Y.Sparse)return ya.call(this,r);if(e.mode===Y.Dense){if(r.offset<=0)return xe.call(this,o),ya.call(this,r);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,f,d=-1;++d<n;)(l=i[d])!==void 0&&((f=a[l])===void 0&&(f=a[l]=o[d]),s[d]=o[d]-f,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);xe.call(this,s),this.visitMany(r.children.map((l,f)=>{let d=e.typeIds[f],V=a[d],N=c[d];return l.slice(V,Math.min(n,N))}))}}return this}function ah(r){let t;return r.nullCount>=r.length?xe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?xe.call(this,Yr(r.offset,r.length,t)):xe.call(this,Hr(r.values))}function ur(r){return xe.call(this,r.values.subarray(0,r.length*r.stride))}function ss(r){let{length:t,values:e,valueOffsets:n}=r,i=C(n[0]),o=C(n[t]),s=Math.min(o-i,e.byteLength-i);return xe.call(this,Ki(-i,t+1,n)),xe.call(this,e.subarray(i,i+s)),this}function ga(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return xe.call(this,Ki(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function ya(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}X.prototype.visitBool=ah;X.prototype.visitInt=ur;X.prototype.visitFloat=ur;X.prototype.visitUtf8=ss;X.prototype.visitLargeUtf8=ss;X.prototype.visitBinary=ss;X.prototype.visitLargeBinary=ss;X.prototype.visitFixedSizeBinary=ur;X.prototype.visitDate=ur;X.prototype.visitTimestamp=ur;X.prototype.visitTime=ur;X.prototype.visitDecimal=ur;X.prototype.visitList=ga;X.prototype.visitStruct=ya;X.prototype.visitUnion=sh;X.prototype.visitInterval=ur;X.prototype.visitDuration=ur;X.prototype.visitFixedSizeList=ga;X.prototype.visitMap=ga;var on=class extends Xr{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')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Je,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Ot(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Qt(t)?t.then(e=>this.writeAll(e)):oe(t)?wa(this,t):ba(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Je?this._sink=t:(this._sink=new Je,t&&qa(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Qa(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!rn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof $&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof G&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!rn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof G?t instanceof nn||this._writeRecordBatch(t):t instanceof $?this.writeAll(t.batches):pe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ut.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new Ie(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new Ie(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=B(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ut.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Nn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:o}=X.assemble(t),s=new vt(t.numRows,n,i),a=ut.from(s,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=X.assemble(new y([t])),c=new vt(t.length,o,s),l=new Xt(c,e,n),f=ut.from(l,i);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let o=-1,s=t.length;++o<s;)(e=t[o])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(let[i,o]of t.dictionaries){let s=(e=o?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,f]of s.entries())this._writeDictionaryBatch(f,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},fr=class extends on{static writeAll(t,e){let n=new fr(e);return Qt(t)?t.then(i=>n.writeAll(i)):oe(t)?wa(n,t):ba(n,t)}},dr=class extends on{static writeAll(t){let e=new dr;return Qt(t)?t.then(n=>e.writeAll(n)):oe(t)?wa(e,t):ba(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=ir.encode(new ir(t,z.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function ba(r,t){let e=t;t instanceof $&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function wa(r,t){return m(this,void 0,void 0,function*(){var e,n,i,o,s,a,c;try{for(e=!0,n=he(t);i=yield n.next(),o=i.done,!o;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){s={error:l}}finally{try{!e&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return r.finish()})}function Cl(r,t){if(oe(r))return lh(r,t);if(pe(r))return ch(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function ch(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,e||(e=r[Symbol.iterator]()))},pull(s){e?o(s,e):s.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,f=s.desiredSize||null;for(;!(l=a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()}}function lh(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return m(this,void 0,void 0,function*(){yield o(s,e||(e=r[Symbol.asyncIterator]()))})},pull(s){return m(this,void 0,void 0,function*(){e?yield o(s,e):s.close()})},cancel(){return m(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return m(this,void 0,void 0,function*(){let c,l=null,f=s.desiredSize||null;for(;!(l=yield a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()})}}function Vl(r){return new _a(r)}var _a=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=Za(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Se(o),this._getSize=i!=="bytes"?kl:Pl;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?kl:Pl}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},kl=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Pl=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function as(r,t){let e=new Je,n=null,i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield e.close()})},start(a){return m(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return m(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function o(){return m(this,void 0,void 0,function*(){return yield(yield ft.from(e)).open(t)})}function s(a,c){return m(this,void 0,void 0,function*(){let l=a.desiredSize,f=null;for(;!(f=yield c.next()).done;)if(a.enqueue(f.value),l!=null&&--l<=0)return;a.close()})}}function cs(r,t){let e=new this(r),n=new Jt(e),i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return m(this,void 0,void 0,function*(){yield o(s)})},start(s){return m(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function o(s){return m(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Ui(r){let t=ft.from(r);return Qt(t)?t.then(e=>Ui(e)):t.isAsync()?t.readAll().then(e=>new $(e)):new $(t.readAll())}function ls(r,t="stream"){return(t==="stream"?fr:dr).writeAll(r).toUint8Array(!0)}var _h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ls),ra),Js),Ns),Bs),Hs),Ds),{compareSchemas:rn,compareFields:ml,compareTypes:Zo});bt.toDOMStream=Cl;q.throughDOM=Vl;ft.throughDOM=as;Tr.throughDOM=as;Xe.throughDOM=as;on.throughDOM=cs;dr.throughDOM=cs;fr.throughDOM=cs;function us(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function jl(r){let t=vh(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=us(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function vh(r){switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function zl(r,t){if(!t)switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:break}return Array}function hr(r){return Wl(r)}function fs(r){return Gl(r)}function Wl(r){return{fields:r.fields.map(t=>kn(t)),metadata:va(r.metadata)}}function Gl(r){return new U(r.fields.map(t=>Pn(t)),Ia(r.metadata))}function va(r){return Object.fromEntries(r)}function Ia(r){return r?new Map(Object.entries(r)):new Map}function kn(r){return{name:r.name,type:$l(r.type),nullable:r.nullable,metadata:va(r.metadata)}}function Pn(r){return new O(r.name,Yl(r.type),r.nullable,Ia(r.metadata))}function $l(r){switch(r.constructor){case nt:return"null";case re:return"binary";case Nt:return"bool";case et:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case Re:return"int8";case Ce:return"int16";case yt:return"int32";case ce:return"int64";case ke:return"uint8";case Pe:return"uint16";case Ve:return"uint32";case je:return"uint64";case Mt:switch(r.precision){case P.HALF:return"float16";case P.SINGLE:return"float32";case P.DOUBLE:return"float64";default:return"float16"}case _r:return"float16";case ze:return"float32";case le:return"float64";case Lt:return"utf8";case ne:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case $t:return r.unit===J.DAY?"date-day":"date-millisecond";case Nr:return"date-day";case Ur:return"date-millisecond";case Bt:switch(r.unit){case h.SECOND:return"time-second";case h.MILLISECOND:return"time-millisecond";case h.MICROSECOND:return"time-microsecond";case h.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Rr:return"time-millisecond";case Er:return"time-second";case Cr:return"time-microsecond";case kr:return"time-nanosecond";case At:switch(r.unit){case h.SECOND:return"timestamp-second";case h.MILLISECOND:return"timestamp-millisecond";case h.MICROSECOND:return"timestamp-microsecond";case h.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Pr:return"timestamp-second";case er:return"timestamp-millisecond";case Vr:return"timestamp-microsecond";case jr:return"timestamp-nanosecond";case Yt:switch(r.unit){case Q.DAY_TIME:return"interval-daytime";case Q.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case zr:return"interval-daytime";case Wr:return"interval-yearmonth";case Et:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(N=>kn(N))};case wt:let f=r.valueField;return{type:"list",children:[kn(f)]};case Ut:let d=r;return{type:"fixed-size-list",listSize:d.listSize,children:[kn(d.children[0])]};case k:return{type:"struct",children:r.children.map(N=>kn(N))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Yl(r){if(typeof r=="object")switch(r.type){case"decimal":return new ne(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>Pn(i));return new Et(t,r.keysSorted);case"list":let e=Pn(r.children[0]);return new wt(e);case"fixed-size-list":let n=Pn(r.children[0]);return new Ut(r.listSize,n);case"struct":return t=r.children.map(i=>Pn(i)),new k(t);default:throw new Error("array type not supported")}switch(r){case"null":return new nt;case"binary":return new re;case"bool":return new Nt;case"int8":return new Re;case"int16":return new Ce;case"int32":return new yt;case"int64":return new ce;case"uint8":return new ke;case"uint16":return new Pe;case"uint32":return new Ve;case"uint64":return new je;case"float16":return new _r;case"float32":return new ze;case"float64":return new le;case"utf8":return new Lt;case"date-day":return new Nr;case"date-millisecond":return new Ur;case"time-second":return new Er;case"time-millisecond":return new Rr;case"time-microsecond":return new Cr;case"time-nanosecond":return new kr;case"timestamp-second":return new Pr;case"timestamp-millisecond":return new er;case"timestamp-microsecond":return new Vr;case"timestamp-nanosecond":return new jr;case"interval-daytime":return new zr;case"interval-yearmonth":return new Wr;default:throw new Error("array type not supported")}}function Hl(r){switch(r.shape){case"array-row-table":case"object-row-table":return Sh(r.data);case"geojson-table":return xh(r.features);case"columnar-table":return Ih(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Ih(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Bh(n,e);t.push(i)}return{fields:t,metadata:{}}}function Sh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0];for(let[n,i]of Object.entries(e))t.push(Jl(i,n));return{fields:t,metadata:{}}}function xh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0].properties||{};for(let[n,i]of Object.entries(e))t.push(Jl(i,n));return{fields:t,metadata:{}}}function Bh(r,t){if(ArrayBuffer.isView(r)){let e=jl(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=us(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Jl(r,t){let e=us(r);return{name:t,type:e,nullable:!0}}function Dr(r){switch(r.shape){case"array-row-table":case"object-row-table":return r.data.length;case"geojson-table":return r.features.length;case"arrow-table":return r.data.numRows;case"columnar-table":for(let e of Object.values(r.data))return e.length||0;return 0;default:throw new Error("table")}}function xa(r){if(r.schema)return r.schema.fields.length;if(Dr(r)===0)throw new Error("empty table");switch(r.shape){case"array-row-table":return r.data[0].length;case"object-row-table":return Object.keys(r.data[0]).length;case"geojson-table":return Object.keys(r.features[0]).length;case"columnar-table":return Object.keys(r.data).length;case"arrow-table":return r.data.numCols;default:throw new Error("table")}}function Kl(r,t,e){switch(r.shape){case"array-row-table":let n=Ah(r,e);return r.data[t][n];case"object-row-table":return r.data[t][e];case"geojson-table":return r.features[t][e];case"columnar-table":return r.data[e][t];case"arrow-table":let o=r.data,s=o.schema.fields.findIndex(a=>a.name===e);return o.getChildAt(s)?.get(t);default:throw new Error("todo")}}function Ba(r,t,e){switch(r.shape){case"array-row-table":return r.data[t][e];case"object-row-table":let n=Sa(r,e);return r.data[t][n];case"geojson-table":let i=Sa(r,e);return r.features[t][i];case"columnar-table":let o=Sa(r,e);return r.data[o][t];case"arrow-table":return r.data.getChildAt(e)?.get(t);default:throw new Error("todo")}}function Ah(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Sa(r,t){let e=r.schema?.fields[t]?.name;if(!e)throw new Error(`${t}`);return e}function Zl(r,t,e,n){switch(r.shape){case"object-row-table":return n?Object.fromEntries(Object.entries(r.data[t])):r.data[t];case"array-row-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[t][l];return c}throw new Error("no schema");case"geojson-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.features[t][l];return c}throw new Error("no schema");case"columnar-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||{};for(let[l,f]of Object.entries(r.data))c[l]=f[t];return c}case"arrow-table":let i=r.data,o=e||{},s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[a.fields[c].name]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function Xl(r,t,e,n){switch(r.shape){case"array-row-table":return n?Array.from(r.data[t]):r.data[t];case"object-row-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[t][r.schema.fields[l].name];return c}return Object.values(r.data[t]);case"geojson-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.features[t][r.schema.fields[l].name];return c}return Object.values(r.features[t]);case"columnar-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||[],l=0;for(let f of Object.values(r.data))c[l]=f[t],l++;return c}case"arrow-table":let i=r.data,o=e||[],s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[c]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function ql(r,t){let e=zl(r.type,r.nullable);return new e(t)}function*Ql(r,t){let e=fs(r.schema),n=Dr(r),i=xa(r),o=t?.batchSize||n,s=e?.fields.map(l=>Se(l)),a=new k(e.fields),c=0;for(let l=0;l<n;l++)for(let f=0;f<i;++f){let d=Ba(r,l,f);if(s[f].append(d),c++,c>=o){let N=s.map(yr=>yr.flush()),st=new M(a,0,c,0,void 0,N);yield new G(e,st),c=0}}if(c>0){let l=s.map(d=>d.flush()),f=new M(a,0,c,0,void 0,l);yield new G(e,f),c=0}s.map(l=>l.finish())}function Aa(r,t){switch(r.shape){case"arrow-table":return r.data;case"columnar-table":default:let e=Ql(r,t);return new $(e)}}function Ta(r,t){switch(t){case"arrow-table":return Th(r);case"array-row-table":return Dh(r);case"object-row-table":return Oh(r);case"columnar-table":return Da(r);case"geojson-table":return Fh(r);default:throw new Error(t)}}function Th(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function Dh(r){let t=Da(r);return sn(t,"array-row-table")}function Oh(r){let t=Da(r);return sn(t,"object-row-table")}function Da(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function Fh(r){let t=hr(r.schema),e=[];for(let n=0;n<r.numRows;n++){let i=r.get(n)?.toJSON()||{};e.push({type:"Feature",geometry:null,properties:i})}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:e}}function sn(r,t){switch(t){case"object-row-table":return Nh(r);case"array-row-table":return Lh(r);case"columnar-table":return Mh(r);case"arrow-table":return Uh(r);default:throw new Error(t)}}function Mh(r){let t=r.schema||Hl(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=Dr(r),i={};for(let o of e){let s=ql(o,n);i[o.name]=s;for(let a=0;a<n;a++)s[a]=Kl(r,a,o.name)}return{shape:"columnar-table",schema:t,data:i}}function Lh(r){if(r.shape==="array-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Xl(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Nh(r){if(r.shape==="object-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Zl(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Uh(r){let t=Aa(r);return{shape:"arrow-table",schema:r.schema,data:t}}var tu=r=>typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer;var eu="beta";function Eh(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0-alpha.9"),globalThis._loadersgl_.version}var Oa=Eh();function qe(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var Qe={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},wS=Qe.self||Qe.window||Qe.global||{},_S=Qe.window||Qe.self||Qe.global||{},vS=Qe.global||Qe.self||Qe.window||{},IS=Qe.document||{};var pr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var nu=typeof window<"u"&&typeof window.orientation<"u",ru=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),SS=ru&&parseFloat(ru[1])||0;var Ei=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,e){this.name=t,this.workerThread=e,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){qe(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){qe(this.isRunning),this.isRunning=!1,this._reject(t)}};var Vn=class{terminate(){}};var Fa=new Map;function iu(r){qe(r.source&&!r.url||!r.source&&r.url);let t=Fa.get(r.source||r.url);return t||(r.url&&(t=Rh(r.url),Fa.set(r.url,t)),r.source&&(t=ou(r.source),Fa.set(r.source,t))),qe(t),t}function Rh(r){if(!r.startsWith("http"))return r;let t=Ch(r);return ou(t)}function ou(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function Ch(r){return`try {
16
+ ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new H(e,n.map(i=>new $(e,i)))}slice(t,e){let n=this.schema;[t,e]=ri({length:this.numRows},t,e);let i=To(this.data,this._offsets,t,e);return new H(n,i.map(o=>new $(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=b({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new y(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new y([b({type:new it,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,e],[n,i]=as(n,a)}return new H(n,i)}select(t){let e=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new H(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[f,d]=a,R=e.findIndex(D=>D.name===c.name);return~R?d[R]=l:f.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...e.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new H(...as(o,s))}};Wl=Symbol.toStringTag;H[Wl]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Bn(oi),r.get=Bn(ct.getVisitFn(u.Struct)),r.set=Do(Bt.getVisitFn(u.Struct)),r.indexOf=Oo(qr.getVisitFn(u.Struct)),"Table"))(H.prototype);var $l,$=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=b({nullCount:0,type:new k(this.schema.fields),children:this.schema.fields.map(e=>b({type:e.type,nullCount:0}))})]=t,!(this.data instanceof N))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Gl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:o}=Object.keys(e).reduce((c,l,f)=>(c.children[f]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[f]=F.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new U(n),a=b({type:new k(n),length:o,children:i,nullCount:0});[this.schema,this.data]=Gl(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Hl(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return ct.visit(this.data,t)}at(t){return this.get(Yr(t,this.numRows))}set(t,e){return Bt.visit(this.data,t,e)}indexOf(t,e){return qr.visit(this.data,t,e)}[Symbol.iterator](){return xn.visit(new y([this.data]))}toArray(){return[...this]}concat(...t){return new H(this.schema,[this,...t])}slice(t,e){let[n]=new y([this.data]).slice(t,e).data;return new $(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new y([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new y([b({type:new it,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:e.type});[o[t],s[t]]=[a,e.data[0]],n=new U(o,new Map(this.schema.metadata)),i=b({type:new k(o),children:s})}return new $(n,i)}select(t){let e=this.schema.select(t),n=new k(e.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new $(e,b({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=b({type:new k(e.fields),length:this.numRows,children:n});return new $(e,i)}};$l=Symbol.toStringTag;$[$l]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))($.prototype);function Gl(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],o=[...t],s=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:b({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)}))}return[r.assign(i),b({type:new k(i),length:e,children:o})]}function Hl(r,t,e=new Map){var n,i;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let o=-1,s=r.length;++o<s;){let{type:a}=r[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])Hl(a.children,l?.children,e);if(p.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var an=class extends ${constructor(t){let e=t.fields.map(i=>b({type:i.type})),n=b({type:new k(t.fields),nullCount:0,children:e});super(t,n)}};var wa=r=>`Expected ${C[r]} Message in stream, but was null or length 0.`,_a=r=>`Header pointer of flatbuffer-encoded ${C[r]} Message is null or length 0.`,Yl=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Jl=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Rn=class{constructor(t){this.source=t instanceof Xe?t:new Xe(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?X:t.value===-1&&(t=this.readMetadataLength()).done?X:(t=this.readMetadata(t.value)).done?X:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(wa(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=x(this.source.read(t));if(e.byteLength<t)throw new Error(Jl(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=C.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(_a(e));return i}readMetadataLength(){let t=this.source.read(cs),e=t&&new mt(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return X;if(e.byteLength<t)throw new Error(Yl(t,e.byteLength));return{done:!1,value:dt.decode(e)}}},Ui=class{constructor(t,e){this.source=t instanceof qt?t:Yi(t)?new Ar(t,e):new qt(t)}[Symbol.asyncIterator](){return this}next(){return m(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?X:t.value===-1&&(t=yield this.readMetadataLength()).done?X:(t=yield this.readMetadata(t.value)).done?X:t})}throw(t){return m(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return m(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return m(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(wa(t));return e.value})}readMessageBody(t){return m(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=x(yield this.source.read(t));if(e.byteLength<t)throw new Error(Jl(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return m(this,arguments,void 0,function*(t=!1){let e=C.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(_a(e));return i})}readMetadataLength(){return m(this,void 0,void 0,function*(){let t=yield this.source.read(cs),e=t&&new mt(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return m(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return X;if(e.byteLength<t)throw new Error(Yl(t,e.byteLength));return{done:!1,value:dt.decode(e)}})}},Ei=class extends Rn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof si?t:new si(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:dt.fromJSON(t.schema,C.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:dt.fromJSON(e,C.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:dt.fromJSON(e,C.RecordBatch)}}return this._body=[],X}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...e(o.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(wa(t));return e.value}readSchema(){let t=C.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(_a(t));return n}},cs=4,ba="ARROW1",Cn=new Uint8Array(ba.length);for(let r=0;r<ba.length;r+=1)Cn[r]=ba.codePointAt(r);function ls(r,t=0){for(let e=-1,n=Cn.length;++e<n;)if(Cn[e]!==r[t+e])return!1;return!0}var Pn=Cn.length,va=Pn+cs,Kl=Pn*2+cs;var Ia=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let e=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(e);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((e,n)=>t[n]===e)}_hasValidVersion(t){return(t[4]&192)>>6===1}},Sa=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let e=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(e);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((e,n)=>t[n]===e)}},Zl={[Ut.LZ4_FRAME]:new Ia,[Ut.ZSTD]:new Sa};var Ba=class{constructor(){this.registry={}}set(t,e){if(e?.encode&&typeof e.encode=="function"&&!Zl[t].isValidCodecEncode(e))throw new Error(`Encoder for ${Ut[t]} is not valid.`);this.registry[t]=e}get(t){var e;return((e=this.registry)===null||e===void 0?void 0:e[t])||null}},kn=new Ba;var ht=class extends en{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return ee(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 vt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return vt.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 ht?t:$i(t)?Ih(t):Yi(t)?xh(t):ee(t)?(()=>m(this,void 0,void 0,function*(){return yield ht.from(yield t)}))():Ji(t)||Zn(t)||Zi(t)||ce(t)?Bh(new qt(t)):Sh(new Xe(t))}static readAll(t){return t instanceof ht?t.isSync()?Xl(t):ql(t):$i(t)||ArrayBuffer.isView(t)||ge(t)||Hi(t)?Xl(t):ql(t)}},Qe=class extends ht{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return te(this,arguments,function*(){yield L(yield*dn(ye(this[Symbol.iterator]())))})}},Dr=class extends ht{constructor(t){super(t),this._impl=t}readAll(){return m(this,void 0,void 0,function*(){var t,e,n,i;let o=new Array;try{for(var s=!0,a=ye(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){e={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Or=class extends Qe{constructor(t){super(t),this._impl=t}},Ri=class extends Dr{constructor(t){super(t),this._impl=t}},us=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n;if(t.compression!=null){let o=kn.get(t.compression.type);if(o?.decode&&typeof o.decode=="function"){let{decommpressedBody:s,buffers:a}=this._decompressBuffers(t,e,o);n=this._loadCompressedVectors(t,s,this.schema.fields),t=new ft(t.length,t.nodes,a,null)}else throw new Error("Record batch is compressed but codec not found")}else n=this._loadVectors(t,e,this.schema.fields);let i=b({type:new k(this.schema.fields),length:t.length,children:n});return new $(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l;if(t.data.compression!=null){let f=kn.get(t.data.compression.type);if(f?.decode&&typeof f.decode=="function"){let{decommpressedBody:d,buffers:R}=this._decompressBuffers(t.data,e,f);l=this._loadCompressedVectors(t.data,d,[c]),t=new Nt(new ft(t.data.length,t.data.nodes,R,null),n,i)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new y(l)):new y(l)).memoize()}_loadVectors(t,e,n){return new Nn(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}_loadCompressedVectors(t,e,n){return new Ro(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}_decompressBuffers(t,e,n){let i=[],o=[],s=0;for(let{offset:a,length:c}of t.buffers){if(c===0){i.push(new Uint8Array(0)),o.push(new ut(s,0));continue}let l=new mt(e.subarray(a,a+c)),f=P(l.readInt64(0)),d=l.bytes().subarray(8),R=f===-1?d:n.decode(d);i.push(R);let D=(s+7&-8)-s;s+=D,o.push(new ut(s,R.length)),s+=R.length}return{decommpressedBody:i,buffers:o}}},Vn=class extends us{constructor(t,e){super(e),this._reader=$i(t)?new Ei(this._handle=t):new Rn(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=tu(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):X}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):X}next(){if(this.closed)return X;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new an(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},jn=class extends us{constructor(t,e){super(e),this._reader=new Ui(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return m(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return m(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=tu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):X})}return(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):X})}next(){return m(this,void 0,void 0,function*(){if(this.closed)return X;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new an(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},fs=class extends Vn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof ai?t:new ai(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(C.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(C.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-va,n=t.readInt32(e),i=t.readAt(e-n,n);return ar.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},xa=class extends jn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Ar?t:new Ar(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return m(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return m(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(C.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return m(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(C.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return m(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-va,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return ar.decode(i)})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},Aa=class extends Vn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Eo(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function tu(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Xl(r){let t=ht.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function ql(r){return te(this,arguments,function*(){let e=yield L(ht.from(r));try{if(!(yield L(e.open({autoDestroy:!1}))).closed)do yield yield L(e);while(!(yield L(e.reset().open())).closed)}finally{yield L(e.cancel())}})}function Ih(r){return new Qe(new Aa(r))}function Sh(r){let t=r.peek(Pn+7&-8);return t&&t.byteLength>=4?ls(t)?new Or(new fs(r.read())):new Qe(new Vn(r)):new Qe(new Vn(function*(){}()))}function Bh(r){return m(this,void 0,void 0,function*(){let t=yield r.peek(Pn+7&-8);return t&&t.byteLength>=4?ls(t)?new Or(new fs(yield r.read())):new Dr(new jn(r)):new Dr(new jn(function(){return te(this,arguments,function*(){})}()))})}function xh(r){return m(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Ar(r,t);return t>=Kl&&ls(yield e.readAt(0,Pn+7&-8))?new Ri(new xa(e)):new Dr(new jn(e))})}var Q=class extends w{static assemble(...t){let e=i=>i.flatMap(o=>Array.isArray(o)?e(o):o instanceof $?o.data.children:o.data),n=new Q;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof y)return this.visitMany(t.data),this;let{type:e}=t;if(!p.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(p.isUnion(e))this.nodes.push(new pe(n,0));else{let{nullCount:i}=t;p.isNull(e)||Ae.call(this,i<=0?new Uint8Array(0):Kr(t.offset,n,t.nullBitmap)),this.nodes.push(new pe(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ae(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ut(this._byteLength,t)),this._byteLength+=t,this}function Ah(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:o}=r;if(Ae.call(this,i),e.mode===Y.Sparse)return Ta.call(this,r);if(e.mode===Y.Dense){if(r.offset<=0)return Ae.call(this,o),Ta.call(this,r);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,f,d=-1;++d<n;)(l=i[d])!==void 0&&((f=a[l])===void 0&&(f=a[l]=o[d]),s[d]=o[d]-f,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Ae.call(this,s),this.visitMany(r.children.map((l,f)=>{let d=e.typeIds[f],R=a[d],D=c[d];return l.slice(R,Math.min(n,D))}))}}return this}function Th(r){let t;return r.nullCount>=r.length?Ae.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ae.call(this,Kr(r.offset,r.length,t)):Ae.call(this,Zr(r.values))}function hr(r){return Ae.call(this,r.values.subarray(0,r.length*r.stride))}function ds(r){let{length:t,values:e,valueOffsets:n}=r,i=P(n[0]),o=P(n[t]),s=Math.min(o-i,e.byteLength-i);return Ae.call(this,qi(-i,t+1,n)),Ae.call(this,e.subarray(i,i+s)),this}function Da(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Ae.call(this,qi(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function Ta(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Q.prototype.visitBool=Th;Q.prototype.visitInt=hr;Q.prototype.visitFloat=hr;Q.prototype.visitUtf8=ds;Q.prototype.visitLargeUtf8=ds;Q.prototype.visitBinary=ds;Q.prototype.visitLargeBinary=ds;Q.prototype.visitFixedSizeBinary=hr;Q.prototype.visitDate=hr;Q.prototype.visitTimestamp=hr;Q.prototype.visitTime=hr;Q.prototype.visitDecimal=hr;Q.prototype.visitList=Da;Q.prototype.visitStruct=Ta;Q.prototype.visitUnion=Ah;Q.prototype.visitInterval=hr;Q.prototype.visitDuration=hr;Q.prototype.visitFixedSizeList=Da;Q.prototype.visitMap=Da;var cn=class extends en{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')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Ze,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Lt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(Ut).includes(t.compressionType))this._compression=new tn(t.compressionType);else{let e=Object.values(Ut).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${e.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ee(t)?t.then(e=>this.writeAll(e)):ce(t)?Fa(this,t):Oa(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Ze?this._sink=t:(this._sink=new Ze,t&&uc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&fc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!sn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof H&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof $&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!sn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof $?t instanceof an||this._writeRecordBatch(t):t instanceof H?this.writeAll(t.batches):ge(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=dt.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===C.RecordBatch?this._recordBatchBlocks.push(new Be(a,t.bodyLength,this._position)):t.headerType===C.DictionaryBatch&&this._dictionaryBlocks.push(new Be(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=x(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(dt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Cn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:o}=this._assembleRecordBatch(t),s=new ft(t.numRows,n,i,this._compression),a=dt.from(s,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_assembleRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:o}=Q.assemble(t);return this._compression!=null&&({byteLength:e,bufferRegions:i,buffers:o}=this._compressBodyBuffers(o)),{byteLength:e,nodes:n,bufferRegions:i,buffers:o}}_compressBodyBuffers(t){let e=kn.get(this._compression.type);if(!e?.encode||typeof e.encode!="function")throw new Error(`Codec for compression type "${Ut[this._compression.type]}" has invalid encode method`);let n=0,i=[],o=[];for(let a of t){let c=x(a);if(c.length===0){i.push(new Uint8Array(0),new Uint8Array(0)),o.push(new ut(n,0));continue}let l=e.encode(c),f=l.length<c.length,d=f?l:c,R=f?d.length:-1,D=new mt(new Uint8Array(8));D.writeInt64(0,BigInt(R)),i.push(D.bytes(),new Uint8Array(d));let tt=(n+7&-8)-n;n+=tt;let ae=8+d.length;o.push(new ut(n,ae)),n+=ae}let s=(n+7&-8)-n;return n+=s,{byteLength:n,bufferRegions:o,buffers:i}}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=this._assembleRecordBatch(new y([t])),c=new ft(t.length,o,s,this._compression),l=new Nt(c,e,n),f=dt.from(l,i);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e=this._compression!=null?2:1,n=new Array(e);for(let i=0;i<t.length;i+=e){let o=0;for(let a=-1;++a<e;)n[a]=t[i+a],o+=n[a].byteLength;if(o===0)continue;for(let a of n)this._write(a);let s=(o+7&-8)-o;s>0&&this._writePadding(s)}return this}_writeDictionaries(t){var e,n;for(let[i,o]of t.dictionaries){let s=(e=o?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,f]of s.entries())this._writeDictionaryBatch(f,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},pr=class extends cn{static writeAll(t,e){let n=new pr(e);return ee(t)?t.then(i=>n.writeAll(i)):ce(t)?Fa(n,t):Oa(n,t)}},mr=class extends cn{static writeAll(t,e){let n=new mr(e);return ee(t)?t.then(i=>n.writeAll(i)):ce(t)?Fa(n,t):Oa(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=ar.encode(new ar(t,G.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Oa(r,t){let e=t;t instanceof H&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Fa(r,t){return m(this,void 0,void 0,function*(){var e,n,i,o,s,a,c;try{for(e=!0,n=ye(t);i=yield n.next(),o=i.done,!o;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){s={error:l}}finally{try{!e&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return r.finish()})}function eu(r,t){if(ce(r))return Oh(r,t);if(ge(r))return Dh(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Dh(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,e||(e=r[Symbol.iterator]()))},pull(s){e?o(s,e):s.close()},cancel(){e?.return&&e.return(),e=null}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,f=s.desiredSize||null;for(;!(l=a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=x(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()}}function Oh(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return m(this,void 0,void 0,function*(){yield o(s,e||(e=r[Symbol.asyncIterator]()))})},pull(s){return m(this,void 0,void 0,function*(){e?yield o(s,e):s.close()})},cancel(){return m(this,void 0,void 0,function*(){e?.return&&(yield e.return()),e=null})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return m(this,void 0,void 0,function*(){let c,l=null,f=s.desiredSize||null;for(;!(l=yield a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=x(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()})}}function iu(r){return new Ma(r)}var Ma=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=ac(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=xe(o),this._getSize=i!=="bytes"?ru:nu;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?ru:nu}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},ru=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},nu=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function hs(r,t){let e=new Ze,n=null,i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield e.close()})},start(a){return m(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return m(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function o(){return m(this,void 0,void 0,function*(){return yield(yield ht.from(e)).open(t)})}function s(a,c){return m(this,void 0,void 0,function*(){let l=a.desiredSize,f=null;for(;!(f=yield c.next()).done;)if(a.enqueue(f.value),l!=null&&--l<=0)return;a.close()})}}function ps(r,t){let e=new this(r),n=new qt(e),i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return m(this,void 0,void 0,function*(){yield o(s)})},start(s){return m(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function o(s){return m(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Ci(r){let t=ht.from(r);return ee(t)?t.then(e=>Ci(e)):t.isAsync()?t.readAll().then(e=>new H(e)):new H(t.readAll())}function ms(r,t="stream",e=null){let n={compressionType:e};return(t==="stream"?pr:mr).writeAll(r,n).toUint8Array(!0)}var jh=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ps),ua),ta),ks),Ms),Qs),Us),ha),{compareSchemas:sn,compareFields:zl,compareTypes:os});vt.toDOMStream=eu;q.throughDOM=iu;ht.throughDOM=hs;Or.throughDOM=hs;Qe.throughDOM=hs;cn.throughDOM=ps;mr.throughDOM=ps;pr.throughDOM=ps;function ys(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function ou(r){let t=zh(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=ys(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function zh(r){switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function su(r,t){if(!t)switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:break}return Array}function yr(r){return au(r)}function gs(r){return cu(r)}function au(r){return{fields:r.fields.map(t=>Wn(t)),metadata:Na(r.metadata)}}function cu(r){return new U(r.fields.map(t=>Gn(t)),La(r.metadata))}function Na(r){return Object.fromEntries(r)}function La(r){return r?new Map(Object.entries(r)):new Map}function Wn(r){return{name:r.name,type:lu(r.type),nullable:r.nullable,metadata:Na(r.metadata)}}function Gn(r){return new F(r.name,uu(r.type),r.nullable,La(r.metadata))}function lu(r){switch(r.constructor){case it:return"null";case ie:return"binary";case Ct:return"bool";case rt:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case Pe:return"int8";case ke:return"int16";case wt:return"int32";case fe:return"int64";case Ve:return"uint8";case je:return"uint16";case ze:return"uint32";case We:return"uint64";case Et:switch(r.precision){case V.HALF:return"float16";case V.SINGLE:return"float32";case V.DOUBLE:return"float64";default:return"float16"}case vr:return"float16";case Ge:return"float32";case de:return"float64";case Rt:return"utf8";case oe:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case Kt:return r.unit===K.DAY?"date-day":"date-millisecond";case Rr:return"date-day";case Cr:return"date-millisecond";case Dt:switch(r.unit){case h.SECOND:return"time-second";case h.MILLISECOND:return"time-millisecond";case h.MICROSECOND:return"time-microsecond";case h.NANOSECOND:return"time-nanosecond";default:return"time-second"}case kr:return"time-millisecond";case Pr:return"time-second";case Vr:return"time-microsecond";case jr:return"time-nanosecond";case Ot:switch(r.unit){case h.SECOND:return"timestamp-second";case h.MILLISECOND:return"timestamp-millisecond";case h.MICROSECOND:return"timestamp-microsecond";case h.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case zr:return"timestamp-second";case ir:return"timestamp-millisecond";case Wr:return"timestamp-microsecond";case Gr:return"timestamp-nanosecond";case Zt:switch(r.unit){case z.DAY_TIME:return"interval-daytime";case z.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case $r:return"interval-daytime";case Hr:return"interval-yearmonth";case kt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(D=>Wn(D))};case St:let f=r.valueField;return{type:"list",children:[Wn(f)]};case Pt:let d=r;return{type:"fixed-size-list",listSize:d.listSize,children:[Wn(d.children[0])]};case k:return{type:"struct",children:r.children.map(D=>Wn(D))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function uu(r){if(typeof r=="object")switch(r.type){case"decimal":return new oe(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>Gn(i));return new kt(t,r.keysSorted);case"list":let e=Gn(r.children[0]);return new St(e);case"fixed-size-list":let n=Gn(r.children[0]);return new Pt(r.listSize,n);case"struct":return t=r.children.map(i=>Gn(i)),new k(t);default:throw new Error("array type not supported")}switch(r){case"null":return new it;case"binary":return new ie;case"bool":return new Ct;case"int8":return new Pe;case"int16":return new ke;case"int32":return new wt;case"int64":return new fe;case"uint8":return new Ve;case"uint16":return new je;case"uint32":return new ze;case"uint64":return new We;case"float16":return new vr;case"float32":return new Ge;case"float64":return new de;case"utf8":return new Rt;case"date-day":return new Rr;case"date-millisecond":return new Cr;case"time-second":return new Pr;case"time-millisecond":return new kr;case"time-microsecond":return new Vr;case"time-nanosecond":return new jr;case"timestamp-second":return new zr;case"timestamp-millisecond":return new ir;case"timestamp-microsecond":return new Wr;case"timestamp-nanosecond":return new Gr;case"interval-daytime":return new $r;case"interval-yearmonth":return new Hr;default:throw new Error("array type not supported")}}function fu(r){switch(r.shape){case"array-row-table":case"object-row-table":return Gh(r.data);case"geojson-table":return $h(r.features);case"columnar-table":return Wh(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Wh(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Hh(n,e);t.push(i)}return{fields:t,metadata:{}}}function Gh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0];for(let[n,i]of Object.entries(e))t.push(du(i,n));return{fields:t,metadata:{}}}function $h(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0].properties||{};for(let[n,i]of Object.entries(e))t.push(du(i,n));return{fields:t,metadata:{}}}function Hh(r,t){if(ArrayBuffer.isView(r)){let e=ou(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=ys(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function du(r,t){let e=ys(r);return{name:t,type:e,nullable:!0}}function Fr(r){switch(r.shape){case"array-row-table":case"object-row-table":return r.data.length;case"geojson-table":return r.features.length;case"arrow-table":return r.data.numRows;case"columnar-table":for(let e of Object.values(r.data))return e.length||0;return 0;default:throw new Error("table")}}function Ea(r){if(r.schema)return r.schema.fields.length;if(Fr(r)===0)throw new Error("empty table");switch(r.shape){case"array-row-table":return r.data[0].length;case"object-row-table":return Object.keys(r.data[0]).length;case"geojson-table":return Object.keys(r.features[0]).length;case"columnar-table":return Object.keys(r.data).length;case"arrow-table":return r.data.numCols;default:throw new Error("table")}}function hu(r,t,e){switch(r.shape){case"array-row-table":let n=Yh(r,e);return r.data[t][n];case"object-row-table":return r.data[t][e];case"geojson-table":return r.features[t][e];case"columnar-table":return r.data[e][t];case"arrow-table":let o=r.data,s=o.schema.fields.findIndex(a=>a.name===e);return o.getChildAt(s)?.get(t);default:throw new Error("todo")}}function Ra(r,t,e){switch(r.shape){case"array-row-table":return r.data[t][e];case"object-row-table":let n=Ua(r,e);return r.data[t][n];case"geojson-table":let i=Ua(r,e);return r.features[t][i];case"columnar-table":let o=Ua(r,e);return r.data[o][t];case"arrow-table":return r.data.getChildAt(e)?.get(t);default:throw new Error("todo")}}function Yh(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Ua(r,t){let e=r.schema?.fields[t]?.name;if(!e)throw new Error(`${t}`);return e}function pu(r,t,e,n){switch(r.shape){case"object-row-table":return n?Object.fromEntries(Object.entries(r.data[t])):r.data[t];case"array-row-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[t][l];return c}throw new Error("no schema");case"geojson-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.features[t][l];return c}throw new Error("no schema");case"columnar-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||{};for(let[l,f]of Object.entries(r.data))c[l]=f[t];return c}case"arrow-table":let i=r.data,o=e||{},s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[a.fields[c].name]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function mu(r,t,e,n){switch(r.shape){case"array-row-table":return n?Array.from(r.data[t]):r.data[t];case"object-row-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[t][r.schema.fields[l].name];return c}return Object.values(r.data[t]);case"geojson-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.features[t][r.schema.fields[l].name];return c}return Object.values(r.features[t]);case"columnar-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||[],l=0;for(let f of Object.values(r.data))c[l]=f[t],l++;return c}case"arrow-table":let i=r.data,o=e||[],s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[c]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function yu(r,t){let e=su(r.type,r.nullable);return new e(t)}function*gu(r,t){let e=gs(r.schema),n=Fr(r),i=Ea(r),o=t?.batchSize||n,s=e?.fields.map(l=>xe(l)),a=new k(e.fields),c=0;for(let l=0;l<n;l++)for(let f=0;f<i;++f){let d=Ra(r,l,f);if(s[f].append(d),c++,c>=o){let D=s.map(ae=>ae.flush()),tt=new N(a,0,c,0,void 0,D);yield new $(e,tt),c=0}}if(c>0){let l=s.map(d=>d.flush()),f=new N(a,0,c,0,void 0,l);yield new $(e,f),c=0}s.map(l=>l.finish())}function Ca(r,t){switch(r.shape){case"arrow-table":return r.data;case"columnar-table":default:let e=gu(r,t);return new H(e)}}function Pa(r,t){switch(t){case"arrow-table":return Jh(r);case"array-row-table":return Kh(r);case"object-row-table":return Zh(r);case"columnar-table":return ka(r);case"geojson-table":return Xh(r);default:throw new Error(t)}}function Jh(r){return{shape:"arrow-table",schema:yr(r.schema),data:r}}function Kh(r){let t=ka(r);return ln(t,"array-row-table")}function Zh(r){let t=ka(r);return ln(t,"object-row-table")}function ka(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:yr(r.schema),data:t}}function Xh(r){let t=yr(r.schema),e=[];for(let n=0;n<r.numRows;n++){let i=r.get(n)?.toJSON()||{};e.push({type:"Feature",geometry:null,properties:i})}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:e}}function ln(r,t){switch(t){case"object-row-table":return tp(r);case"array-row-table":return Qh(r);case"columnar-table":return qh(r);case"arrow-table":return ep(r);default:throw new Error(t)}}function qh(r){let t=r.schema||fu(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=Fr(r),i={};for(let o of e){let s=yu(o,n);i[o.name]=s;for(let a=0;a<n;a++)s[a]=hu(r,a,o.name)}return{shape:"columnar-table",schema:t,data:i}}function Qh(r){if(r.shape==="array-row-table")return r;let t=Fr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=mu(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function tp(r){if(r.shape==="object-row-table")return r;let t=Fr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=pu(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function ep(r){let t=Ca(r);return{shape:"arrow-table",schema:r.schema,data:t}}var bu=r=>typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer;var wu="beta";function rp(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0"),globalThis._loadersgl_.version}var Va=rp();function tr(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var er={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},KS=er.self||er.window||er.global||{},ZS=er.window||er.self||er.global||{},XS=er.global||er.self||er.window||{},qS=er.document||{};var gr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var vu=typeof window<"u"&&typeof window.orientation<"u",_u=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),QS=_u&&parseFloat(_u[1])||0;var Pi=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,e){this.name=t,this.workerThread=e,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){tr(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){tr(this.isRunning),this.isRunning=!1,this._reject(t)}};var $n=class{terminate(){}};var ja=new Map;function Iu(r){tr(r.source&&!r.url||!r.source&&r.url);let t=ja.get(r.source||r.url);return t||(r.url&&(t=np(r.url),ja.set(r.url,t)),r.source&&(t=Su(r.source),ja.set(r.source,t))),tr(t),t}function np(r){if(!r.startsWith("http"))return r;let t=ip(r);return Su(t)}function Su(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function ip(r){return`try {
17
17
  importScripts('${r}');
18
18
  } catch (error) {
19
19
  console.error(error);
20
20
  throw error;
21
- }`}function Ma(r,t=!0,e){let n=e||new Set;if(r){if(su(r))n.add(r);else if(su(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)Ma(r[i],t,n)}}return e===void 0?Array.from(n):[]}function su(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function La(r){if(r===null)return{};let t=Object.assign({},r);return Object.keys(t).forEach(e=>{typeof r[e]=="object"&&!ArrayBuffer.isView(r[e])&&!(r[e]instanceof Array)?t[e]=La(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var Na=()=>{},Or=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&pr||typeof Vn<"u"&&!pr}constructor(t){let{name:e,source:n,url:i}=t;qe(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=Na,this.onError=o=>console.log(o),this.worker=pr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Na,this.onError=Na,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||Ma(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=iu({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},t.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},t.onmessageerror=e=>console.error(e),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,i=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";t=new Vn(n,{eval:!1,type:i})}else if(this.source)t=new Vn(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",e=>{this.onMessage(e)}),t.on("error",e=>{this.onError(e)}),t.on("exit",e=>{}),t}};var Ri=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Or.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,e=(i,o,s)=>i.done(s),n=(i,o)=>i.error(o)){let i=new Promise(o=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:o}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});let n=new Ei(e.name,t);t.onMessage=i=>e.onMessage(n,i.type,i.payload),t.onError=i=>e.onError(n,i),e.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!pr||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Or({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return nu?this.maxMobileConcurrency:this.maxConcurrency}};var kh={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},an=class{props;workerPools=new Map;static isSupported(){return Or.isSupported()}static getWorkerFarm(t={}){return an._workerFarm=an._workerFarm||new an({}),an._workerFarm.setProps(t),an._workerFarm}constructor(t){this.props={...kh},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:e,source:n,url:i}=t,o=this.workerPools.get(e);return o||(o=new Ri({name:e,source:n,url:i}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},jn=an;$a(jn,"_workerFarm");function au(r){let t=r.version!==Oa?` (worker-utils@${Oa})`:"";return`${r.name}@${r.version}${t}`}function cu(r,t={}){let e=t[r.id]||{},n=pr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),(t._workerType||t?.core?._workerType)==="test"&&(pr?i=`modules/${r.module}/dist/${n}`:i=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!i){let s=r.version;s==="latest"&&(s=eu);let a=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${a}/dist/${n}`}return qe(i),i}async function ds(r,t,e={},n={}){let i=au(r),o=jn.getWorkerFarm(e),{source:s}=e,a={name:i,source:s};s||(a.url=cu(r,e));let c=o.getWorkerPool(a),l=e.jobName||r.name,f=await c.startJob(l,Ph.bind(null,n)),d=La(e);return f.postMessage("process",{input:t,options:d}),(await f.result).result}async function Ph(r,t,e,n){switch(e){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:i,input:o,options:s}=n;try{if(!r.process){t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});return}let a=await r.process(o,s);t.postMessage("done",{id:i,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:i,error:c})}break;default:console.warn(`process-on-worker: unknown message ${e}`)}}async function*Ua(r){for await(let t of r)yield Vh(t)}function Vh(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:t,byteOffset:e,byteLength:n}=r;return lu(t,e,n)}return lu(r)}function lu(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ra(r){if(r instanceof ArrayBuffer)return r;if(tu(r))return Ea(r);let{buffer:t,byteOffset:e,byteLength:n}=r;return t instanceof ArrayBuffer&&e===0&&n===t.byteLength?t:Ea(t,e,n)}function Ea(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ci(r,t){let e=t?.shape||"arrow-table",n=Ui([new Uint8Array(r)]);return Ta(n,e)}function hs(r,t){async function*e(){let n=ft.readAll(Ua(r));for await(let i of n){for await(let o of i)t?.arrow?.batchDebounceMs!==void 0&&t?.arrow?.batchDebounceMs>0&&await new Promise(a=>setTimeout(a,t.arrow?.batchDebounceMs||0)),yield{shape:"arrow-table",batchType:"data",data:new $([o]),length:o.data.length};break}}return e()}var uu={...cn,parse:async(r,t)=>Ci(r,t?.arrow),parseSync:(r,t)=>Ci(r,t?.arrow),parseInBatches:hs};function Ca(r){let t={};for(let i of r){let o=jh(i.array,i.type);t[i.name]=o}let e=new $(t),n=ls(e);return Ra(n)}function jh(r,t){switch(t){case Fr.DATE:return Fi(r);case Fr.FLOAT:default:return Fi(r)}}var zh="4.4.0-alpha.9",fu={name:"Apache Arrow",id:"arrow",module:"arrow",version:zh,extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,options:{},encode:async function(t,e){return Ca(t)},encodeSync(r,t){return Ca(r)}};var ps={...cn,options:{arrow:{shape:"arrow-table"}}};function ka(r,t){return r instanceof Map?r.get(t)||null:r[t]||null}var Wh=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],Gh="ARROW:extension:name",$h="ARROW:extension:metadata";function Pa(r){let t={};for(let e of r.fields||[]){let n=Yh(e?.metadata||{});n&&(t[e.name]=n)}return t}function Yh(r){let t=null,e=ka(r,Gh);e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),Wh.includes(e)?(t||={},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=ka(r,$h);if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function du(r,t,e){switch(r.type){case"Point":return Jh(r,t,e);case"LineString":return Hh(r,t,e);case"Polygon":return hu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function hu(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),o=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],d=o[l+1],V=ms(n,f,d);c.push(V)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],f=i[c+1],d=hu(r,l,f).coordinates;a.push(d)}return{type:"MultiPolygon",coordinates:a}}function Hh(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.pathIndices.value.filter(a=>a>=t&&a<=e);if(!(i.length>2))return{type:"LineString",coordinates:ms(n,i[0],i[1])};let s=[];for(let a=0;a<i.length-1;a++){let c=ms(n,i[a],i[a+1]);s.push(c)}return{type:"MultiLineString",coordinates:s}}function Jh(r,t,e){let{positions:n}=r,i=ms(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function ms(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let o=Array();for(let s=i*r.size;s<(i+1)*r.size;s++)o.push(Number(r.value[s]));n.push(o)}return n}function zn(r){let t=0;for(let i=0;i<r.length;++i)t+=r[i].byteLength;let e=new Uint8Array(t),n=0;for(let i=0;i<r.length;++i){let o=new Uint8Array(r[i].buffer);t=o.length;for(let s=0;s<t;++s)e[n++]=o[s]}return e}function pu(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(zn(e).buffer),size:t}}}function mu(r,t){let e=r.map(o=>o.positions.value),n=new Float64Array(zn(e).buffer),i=e.map(o=>o.length/t).map(gu(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function yu(r,t){let e=[],n=[];for(let a of r){let{positions:c,primitivePolygonIndices:l}=a;e.push(c.value),n.push(l.value)}let i=new Float64Array(zn(e).buffer),o=e.map(a=>a.length/t).map(gu(0));o.unshift(0);let s=[0];for(let a of n)s.push(...a.filter(c=>c>0).map(c=>c+s[s.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(o),size:1},primitivePolygonIndices:{value:new Uint32Array(s),size:1}}}var gu=r=>t=>r+=t;var mr;(function(r){r[r.Point=1]="Point",r[r.LineString=2]="LineString",r[r.Polygon=3]="Polygon",r[r.MultiPoint=4]="MultiPoint",r[r.MultiLineString=5]="MultiLineString",r[r.MultiPolygon=6]="MultiPolygon",r[r.GeometryCollection=7]="GeometryCollection"})(mr||(mr={}));var bu=2147483648,wu=1073741824,_u=536870912;var Va=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("],Kh=new TextEncoder,vu=Va.map(r=>Kh.encode(r));function Zh(r){return Xh(r)!==null}function Xh(r){if(typeof r=="string"){let n=Va.findIndex(i=>r.startsWith(i));return n>=0?n+1:null}let t=new Uint8Array(r),e=vu.findIndex(n=>n.every((i,o)=>i===t[o]));return e>=0?e+1:null}function Iu(r,t){let e=Object.assign(t||{},{type:"wkb",variant:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});if(Zh(r.buffer))throw new Error("WKB: Cannot parse WKT data");e.littleEndian=r.getUint8(e.byteOffset)===1,e.byteOffset++;let n=r.getUint32(e.byteOffset,e.littleEndian);e.byteOffset+=4,e.geometryType=n&7;let i=(n-e.geometryType)/1e3;switch(i){case 0:break;case 1:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.variant="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let o=n&bu,s=n&wu,a=n&_u;return o&&s?(e.variant="ewkb",e.dimensions=4,e.coordinates="xyzm"):o?(e.variant="ewkb",e.dimensions=3,e.coordinates="xyz"):s&&(e.variant="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.variant="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function Su(r){let t=new DataView(r),e=Iu(t),{geometryType:n,dimensions:i,littleEndian:o}=e,s=e.byteOffset;switch(n){case mr.Point:return xu(t,s,i,o).geometry;case mr.LineString:return ja(t,s,i,o).geometry;case mr.Polygon:return Bu(t,s,i,o).geometry;case mr.MultiPoint:let f=Qh(t,s,i,o);return f.type="Point",f;case mr.MultiLineString:let d=tp(t,s,i,o);return d.type="LineString",d;case mr.MultiPolygon:let V=ep(t,s,i,o);return V.type="Polygon",V;default:throw new Error(`WKB: Unsupported geometry type: ${n}`)}}function xu(r,t,e,n){let i=new Float64Array(e);for(let o=0;o<e;o++)i[o]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function ja(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=new Float64Array(i*e);for(let a=0;a<i*e;a++)o[a]=r.getFloat64(t,n),t+=8;let s=[0];return i>0&&s.push(i),{geometry:{type:"LineString",positions:{value:o,size:e},pathIndices:{value:new Uint32Array(s),size:1}},offset:t}}var qh=r=>t=>r+=t;function Bu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let l=0;l<i;l++){let f=ja(r,t,e,n),{positions:d}=f.geometry;t=f.offset,o.push(d.value)}let s=new Float64Array(zn(o).buffer),a=[0];s.length>0&&a.push(s.length/e);let c=o.map(l=>l.length/e).map(qh(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:s,size:e},polygonIndices:{value:new Uint32Array(a),size:1},primitivePolygonIndices:{value:new Uint32Array(c),size:1}},offset:t}}function Qh(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==1)throw new Error("WKB: Inner geometries of MultiPoint not of type Point");t+=4;let c=xu(r,t,e,a);t=c.offset,o.push(c.geometry)}return pu(o,e)}function tp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==2)throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");t+=4;let c=ja(r,t,e,a);t=c.offset,o.push(c.geometry)}return mu(o,e)}function ep(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==3)throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");t+=4;let c=Bu(r,t,e,a);t=c.offset,o.push(c.geometry)}return yu(o,e)}function Au(r){let t=Su(r);return du(t)}var Tu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Du=new RegExp("^"+Tu.source+"(\\s"+Tu.source+"){1,}");function Ou(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),s=Fu({parts:e,_:n,i:0});return t?.wkt?.crs?rp(s,i):s}function Fu(r){return np(r)||op(r)||ap(r)||ip(r)||sp(r)||cp(r)||lp(r)}function rp(r,t){if(r&&t?.match(/\d+/)){let e={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+t}};r.crs=e}return r}function np(r){if(!ot(/^(POINT(\sz)?)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;let t=Mu(r);return!t||(Ct(r),!ot(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function ip(r){if(!ot(/^(MULTIPOINT)/i,r))return null;Ct(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=ys(r);return e?(Ct(r),{type:"MultiPoint",coordinates:e}):null}function op(r){if(!ot(/^(LINESTRING(\sz)?)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;let t=Mu(r);return!t||!ot(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function sp(r){if(!ot(/^(MULTILINESTRING)/i,r))return null;Ct(r);let t=ys(r);return t?(Ct(r),{type:"MultiLineString",coordinates:t}):null}function ap(r){if(!ot(/^(POLYGON(\sz)?)/i,r))return null;Ct(r);let t=ys(r);return t?{type:"Polygon",coordinates:t}:null}function cp(r){if(!ot(/^(MULTIPOLYGON)/i,r))return null;Ct(r);let t=ys(r);return t?{type:"MultiPolygon",coordinates:t}:null}function lp(r){let t=[],e;if(!ot(/^(GEOMETRYCOLLECTION)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;for(;e=Fu(r);)t.push(e),Ct(r),ot(/^(,)/,r),Ct(r);return ot(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function ys(r){Ct(r);let t=0,e=[],n=[e],i=e,o;for(;o=ot(/^(\()/,r)||ot(/^(\))/,r)||ot(/^(,)/,r)||ot(Du,r);){if(o==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(o===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(o===",")i=[],n[n.length-1].push(i);else if(!o.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,o.split(/\s/g).map(parseFloat));else return null;Ct(r)}return t!==0?null:e}function Mu(r){let t=[],e,n;for(;n=ot(Du,r)||ot(/^(,)/,r);)n===","?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),Ct(r);if(e)t.push(e);else return null;return t.length?t:null}function ot(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Ct(r){ot(/^\s*/,r)}function Lu(r,t){if(t=t?.toLowerCase(),!t||!r)return null;switch(t){case"geoarrow.multipolygon":return dp(r);case"geoarrow.polygon":return hp(r);case"geoarrow.multipoint":return pp(r);case"geoarrow.point":return mp(r);case"geoarrow.multilinestring":return yp(r);case"geoarrow.linestring":return gp(r);case"geoarrow.wkb":return up(r);case"geoarrow.wkt":return fp(r);default:throw Error(`GeoArrow encoding not supported ${t}`)}}function up(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);return Au(t)}function fp(r){return Ou(r)}function dp(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i?.length;s++){let a=i?.get(s),c=[];for(let l=0;a&&l<a.length;l++){let f=a.get(l),d=Array.from(f);c.push(d)}o.push(c)}t.push(o)}return{type:"MultiPolygon",coordinates:t}}function hp(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i.length;s++){let a=i.get(s),c=Array.from(a);o.push(c)}t.push(o)}return{type:"Polygon",coordinates:t}}function pp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"MultiPoint",coordinates:t}}function mp(r){return{type:"Point",coordinates:Array.from(r)}}function yp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let o=0;n&&o<n.length;o++){let s=n.get(o);if(s){let a=Array.from(s);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function gp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"LineString",coordinates:t}}function za(r,t){switch(t){case"arrow-table":return bp(r);case"array-row-table":return wp(r);case"object-row-table":return _p(r);case"columnar-table":return Wa(r);case"geojson-table":return vp(r);default:throw new Error(t)}}function bp(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function wp(r){let t=Wa(r);return sn(t,"array-row-table")}function _p(r){let t=Wa(r);return sn(t,"object-row-table")}function Wa(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function vp(r){let t=hr(r.schema),e=Pa(t),n=e.geometry.encoding,i=[],o=r.schema.fields.map(c=>c.name).filter(c=>!(c in e)),s=r.select(o),a=r.getChild("geometry");for(let c=0;c<r.numRows;c++){let l=a?.get(c),f=Lu(l,n);if(f){let d=s.get(c)?.toJSON()||{};i.push({type:"Feature",geometry:f,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:i}}function Ga(r,t){let e=Ci(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return za(e.data,"geojson-table");default:return e}}function Nu(r){return hs(r)}var Uu={...ps,parse:async(r,t)=>Ga(r,t?.arrow),parseSync:(r,t)=>Ga(r,t?.arrow),parseInBatches:Nu};function ki(r,t=!1){if("data"in r)return new y(r.data.map(o=>ki(o,t)));let e=[];for(let o of r.children)e.push(ki(o,t));let n;r.dictionary!==void 0&&(n=ki(r.dictionary,t));let i={[rt.OFFSET]:gs(r.buffers[rt.OFFSET],t),[rt.DATA]:gs(r.buffers[rt.DATA],t),[rt.VALIDITY]:gs(r.buffers[rt.VALIDITY],t),[rt.TYPE]:gs(r.buffers[rt.TYPE],t)};return new M(r.type,r.offset,r.length,r._nullCount,i,e,n)}function Ip(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function gs(r,t){return r===void 0||!t&&!Ip(r)?r:r.slice()}var Sp="4.4.0-alpha.9",bs={id:"triangulation",name:"Triangulate",module:"arrow",version:Sp,options:{}};function Eu(r,t={}){return ds(bs,{...r,operation:"triangulate"},t)}function Ru(r,t={}){return ds(bs,{...r,operation:"parse-geoarrow"},t)}return Yu(Pi);})();
21
+ }`}function za(r,t=!0,e){let n=e||new Set;if(r){if(Bu(r))n.add(r);else if(Bu(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)za(r[i],t,n)}}return e===void 0?Array.from(n):[]}function Bu(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function Wa(r){if(r===null)return{};let t=Object.assign({},r);return Object.keys(t).forEach(e=>{typeof r[e]=="object"&&!ArrayBuffer.isView(r[e])&&!(r[e]instanceof Array)?t[e]=Wa(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var Ga=()=>{},Mr=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&gr||typeof $n<"u"&&!gr}constructor(t){let{name:e,source:n,url:i}=t;tr(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=Ga,this.onError=o=>console.log(o),this.worker=gr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Ga,this.onError=Ga,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||za(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=Iu({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},t.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},t.onmessageerror=e=>console.error(e),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,i=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";t=new $n(n,{eval:!1,type:i})}else if(this.source)t=new $n(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",e=>{this.onMessage(e)}),t.on("error",e=>{this.onError(e)}),t.on("exit",e=>{}),t}};var ki=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Mr.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,e=(i,o,s)=>i.done(s),n=(i,o)=>i.error(o)){let i=new Promise(o=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:o}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});let n=new Pi(e.name,t);t.onMessage=i=>e.onMessage(n,i.type,i.payload),t.onError=i=>e.onError(n,i),e.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!gr||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Mr({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return vu?this.maxMobileConcurrency:this.maxConcurrency}};var op={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},un=class{props;workerPools=new Map;static isSupported(){return Mr.isSupported()}static getWorkerFarm(t={}){return un._workerFarm=un._workerFarm||new un({}),un._workerFarm.setProps(t),un._workerFarm}constructor(t){this.props={...op},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:e,source:n,url:i}=t,o=this.workerPools.get(e);return o||(o=new ki({name:e,source:n,url:i}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Hn=un;rc(Hn,"_workerFarm");function xu(r){let t=r.version!==Va?` (worker-utils@${Va})`:"";return`${r.name}@${r.version}${t}`}function Au(r,t={}){let e=t[r.id]||{},n=gr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),(t._workerType||t?.core?._workerType)==="test"&&(gr?i=`modules/${r.module}/dist/${n}`:i=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!i){let s=r.version;s==="latest"&&(s=wu);let a=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${a}/dist/${n}`}return tr(i),i}async function bs(r,t,e={},n={}){let i=xu(r),o=Hn.getWorkerFarm(e),{source:s}=e,a={name:i,source:s};s||(a.url=Au(r,e));let c=o.getWorkerPool(a),l=e.jobName||r.name,f=await c.startJob(l,sp.bind(null,n)),d=Wa(e);return f.postMessage("process",{input:t,options:d}),(await f.result).result}async function sp(r,t,e,n){switch(e){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:i,input:o,options:s}=n;try{if(!r.process){t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});return}let a=await r.process(o,s);t.postMessage("done",{id:i,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:i,error:c})}break;default:console.warn(`process-on-worker: unknown message ${e}`)}}async function*$a(r){for await(let t of r)yield ap(t)}function ap(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:t,byteOffset:e,byteLength:n}=r;return Tu(t,e,n)}return Tu(r)}function Tu(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ya(r){if(r instanceof ArrayBuffer)return r;if(bu(r))return Ha(r);let{buffer:t,byteOffset:e,byteLength:n}=r;return t instanceof ArrayBuffer&&e===0&&n===t.byteLength?t:Ha(t,e,n)}function Ha(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Vi(r,t){let e=t?.shape||"arrow-table",n=Ci([new Uint8Array(r)]);return Pa(n,e)}function ws(r,t){async function*e(){let n=ht.readAll($a(r));for await(let i of n){for await(let o of i)t?.arrow?.batchDebounceMs!==void 0&&t?.arrow?.batchDebounceMs>0&&await new Promise(a=>setTimeout(a,t.arrow?.batchDebounceMs||0)),yield{shape:"arrow-table",batchType:"data",data:new H([o]),length:o.data.length};break}}return e()}var Du={...fn,parse:async(r,t)=>Vi(r,t?.arrow),parseSync:(r,t)=>Vi(r,t?.arrow),parseInBatches:ws};function Ja(r){let t={};for(let i of r){let o=cp(i.array,i.type);t[i.name]=o}let e=new H(t),n=ms(e);return Ya(n)}function cp(r,t){switch(t){case Nr.DATE:return Li(r);case Nr.FLOAT:default:return Li(r)}}var lp="4.4.0",Ou={name:"Apache Arrow",id:"arrow",module:"arrow",version:lp,extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,options:{},encode:async function(t,e){return Ja(t)},encodeSync(r,t){return Ja(r)}};var _s={...fn,options:{arrow:{shape:"arrow-table"}}};function Ka(r,t){return r instanceof Map?r.get(t)||null:r[t]||null}var up=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],fp="ARROW:extension:name",dp="ARROW:extension:metadata";function Za(r){let t={};for(let e of r.fields||[]){let n=hp(e?.metadata||{});n&&(t[e.name]=n)}return t}function hp(r){let t=null,e=Ka(r,fp);e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),up.includes(e)?(t||={},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=Ka(r,dp);if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function Fu(r,t,e){switch(r.type){case"Point":return mp(r,t,e);case"LineString":return pp(r,t,e);case"Polygon":return Mu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function Mu(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),o=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],d=o[l+1],R=vs(n,f,d);c.push(R)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],f=i[c+1],d=Mu(r,l,f).coordinates;a.push(d)}return{type:"MultiPolygon",coordinates:a}}function pp(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.pathIndices.value.filter(a=>a>=t&&a<=e);if(!(i.length>2))return{type:"LineString",coordinates:vs(n,i[0],i[1])};let s=[];for(let a=0;a<i.length-1;a++){let c=vs(n,i[a],i[a+1]);s.push(c)}return{type:"MultiLineString",coordinates:s}}function mp(r,t,e){let{positions:n}=r,i=vs(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function vs(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let o=Array();for(let s=i*r.size;s<(i+1)*r.size;s++)o.push(Number(r.value[s]));n.push(o)}return n}function Yn(r){let t=0;for(let i=0;i<r.length;++i)t+=r[i].byteLength;let e=new Uint8Array(t),n=0;for(let i=0;i<r.length;++i){let o=new Uint8Array(r[i].buffer);t=o.length;for(let s=0;s<t;++s)e[n++]=o[s]}return e}function Nu(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(Yn(e).buffer),size:t}}}function Lu(r,t){let e=r.map(o=>o.positions.value),n=new Float64Array(Yn(e).buffer),i=e.map(o=>o.length/t).map(Eu(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function Uu(r,t){let e=[],n=[];for(let a of r){let{positions:c,primitivePolygonIndices:l}=a;e.push(c.value),n.push(l.value)}let i=new Float64Array(Yn(e).buffer),o=e.map(a=>a.length/t).map(Eu(0));o.unshift(0);let s=[0];for(let a of n)s.push(...a.filter(c=>c>0).map(c=>c+s[s.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(o),size:1},primitivePolygonIndices:{value:new Uint32Array(s),size:1}}}var Eu=r=>t=>r+=t;var br;(function(r){r[r.Point=1]="Point",r[r.LineString=2]="LineString",r[r.Polygon=3]="Polygon",r[r.MultiPoint=4]="MultiPoint",r[r.MultiLineString=5]="MultiLineString",r[r.MultiPolygon=6]="MultiPolygon",r[r.GeometryCollection=7]="GeometryCollection"})(br||(br={}));var Ru=2147483648,Cu=1073741824,Pu=536870912;var Xa=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("],yp=new TextEncoder,ku=Xa.map(r=>yp.encode(r));function gp(r){return bp(r)!==null}function bp(r){if(typeof r=="string"){let n=Xa.findIndex(i=>r.startsWith(i));return n>=0?n+1:null}let t=new Uint8Array(r),e=ku.findIndex(n=>n.every((i,o)=>i===t[o]));return e>=0?e+1:null}function Vu(r,t){let e=Object.assign(t||{},{type:"wkb",variant:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});if(gp(r.buffer))throw new Error("WKB: Cannot parse WKT data");e.littleEndian=r.getUint8(e.byteOffset)===1,e.byteOffset++;let n=r.getUint32(e.byteOffset,e.littleEndian);e.byteOffset+=4,e.geometryType=n&7;let i=(n-e.geometryType)/1e3;switch(i){case 0:break;case 1:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.variant="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let o=n&Ru,s=n&Cu,a=n&Pu;return o&&s?(e.variant="ewkb",e.dimensions=4,e.coordinates="xyzm"):o?(e.variant="ewkb",e.dimensions=3,e.coordinates="xyz"):s&&(e.variant="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.variant="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function ju(r){let t=new DataView(r),e=Vu(t),{geometryType:n,dimensions:i,littleEndian:o}=e,s=e.byteOffset;switch(n){case br.Point:return zu(t,s,i,o).geometry;case br.LineString:return qa(t,s,i,o).geometry;case br.Polygon:return Wu(t,s,i,o).geometry;case br.MultiPoint:let f=_p(t,s,i,o);return f.type="Point",f;case br.MultiLineString:let d=vp(t,s,i,o);return d.type="LineString",d;case br.MultiPolygon:let R=Ip(t,s,i,o);return R.type="Polygon",R;default:throw new Error(`WKB: Unsupported geometry type: ${n}`)}}function zu(r,t,e,n){let i=new Float64Array(e);for(let o=0;o<e;o++)i[o]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function qa(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=new Float64Array(i*e);for(let a=0;a<i*e;a++)o[a]=r.getFloat64(t,n),t+=8;let s=[0];return i>0&&s.push(i),{geometry:{type:"LineString",positions:{value:o,size:e},pathIndices:{value:new Uint32Array(s),size:1}},offset:t}}var wp=r=>t=>r+=t;function Wu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let l=0;l<i;l++){let f=qa(r,t,e,n),{positions:d}=f.geometry;t=f.offset,o.push(d.value)}let s=new Float64Array(Yn(o).buffer),a=[0];s.length>0&&a.push(s.length/e);let c=o.map(l=>l.length/e).map(wp(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:s,size:e},polygonIndices:{value:new Uint32Array(a),size:1},primitivePolygonIndices:{value:new Uint32Array(c),size:1}},offset:t}}function _p(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==1)throw new Error("WKB: Inner geometries of MultiPoint not of type Point");t+=4;let c=zu(r,t,e,a);t=c.offset,o.push(c.geometry)}return Nu(o,e)}function vp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==2)throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");t+=4;let c=qa(r,t,e,a);t=c.offset,o.push(c.geometry)}return Lu(o,e)}function Ip(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==3)throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");t+=4;let c=Wu(r,t,e,a);t=c.offset,o.push(c.geometry)}return Uu(o,e)}function Gu(r){let t=ju(r);return Fu(t)}var $u=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Hu=new RegExp("^"+$u.source+"(\\s"+$u.source+"){1,}");function Yu(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),s=Ju({parts:e,_:n,i:0});return t?.wkt?.crs?Sp(s,i):s}function Ju(r){return Bp(r)||Ap(r)||Dp(r)||xp(r)||Tp(r)||Op(r)||Fp(r)}function Sp(r,t){if(r&&t?.match(/\d+/)){let e={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+t}};r.crs=e}return r}function Bp(r){if(!st(/^(POINT(\sz)?)/i,r)||(jt(r),!st(/^(\()/,r)))return null;let t=Ku(r);return!t||(jt(r),!st(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function xp(r){if(!st(/^(MULTIPOINT)/i,r))return null;jt(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=Is(r);return e?(jt(r),{type:"MultiPoint",coordinates:e}):null}function Ap(r){if(!st(/^(LINESTRING(\sz)?)/i,r)||(jt(r),!st(/^(\()/,r)))return null;let t=Ku(r);return!t||!st(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function Tp(r){if(!st(/^(MULTILINESTRING)/i,r))return null;jt(r);let t=Is(r);return t?(jt(r),{type:"MultiLineString",coordinates:t}):null}function Dp(r){if(!st(/^(POLYGON(\sz)?)/i,r))return null;jt(r);let t=Is(r);return t?{type:"Polygon",coordinates:t}:null}function Op(r){if(!st(/^(MULTIPOLYGON)/i,r))return null;jt(r);let t=Is(r);return t?{type:"MultiPolygon",coordinates:t}:null}function Fp(r){let t=[],e;if(!st(/^(GEOMETRYCOLLECTION)/i,r)||(jt(r),!st(/^(\()/,r)))return null;for(;e=Ju(r);)t.push(e),jt(r),st(/^(,)/,r),jt(r);return st(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function Is(r){jt(r);let t=0,e=[],n=[e],i=e,o;for(;o=st(/^(\()/,r)||st(/^(\))/,r)||st(/^(,)/,r)||st(Hu,r);){if(o==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(o===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(o===",")i=[],n[n.length-1].push(i);else if(!o.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,o.split(/\s/g).map(parseFloat));else return null;jt(r)}return t!==0?null:e}function Ku(r){let t=[],e,n;for(;n=st(Hu,r)||st(/^(,)/,r);)n===","?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),jt(r);if(e)t.push(e);else return null;return t.length?t:null}function st(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function jt(r){st(/^\s*/,r)}function Zu(r,t){if(t=t?.toLowerCase(),!t||!r)return null;switch(t){case"geoarrow.multipolygon":return Lp(r);case"geoarrow.polygon":return Up(r);case"geoarrow.multipoint":return Ep(r);case"geoarrow.point":return Rp(r);case"geoarrow.multilinestring":return Cp(r);case"geoarrow.linestring":return Pp(r);case"geoarrow.wkb":return Mp(r);case"geoarrow.wkt":return Np(r);default:throw Error(`GeoArrow encoding not supported ${t}`)}}function Mp(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);return Gu(t)}function Np(r){return Yu(r)}function Lp(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i?.length;s++){let a=i?.get(s),c=[];for(let l=0;a&&l<a.length;l++){let f=a.get(l),d=Array.from(f);c.push(d)}o.push(c)}t.push(o)}return{type:"MultiPolygon",coordinates:t}}function Up(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i.length;s++){let a=i.get(s),c=Array.from(a);o.push(c)}t.push(o)}return{type:"Polygon",coordinates:t}}function Ep(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"MultiPoint",coordinates:t}}function Rp(r){return{type:"Point",coordinates:Array.from(r)}}function Cp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let o=0;n&&o<n.length;o++){let s=n.get(o);if(s){let a=Array.from(s);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function Pp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"LineString",coordinates:t}}function Qa(r,t){switch(t){case"arrow-table":return kp(r);case"array-row-table":return Vp(r);case"object-row-table":return jp(r);case"columnar-table":return tc(r);case"geojson-table":return zp(r);default:throw new Error(t)}}function kp(r){return{shape:"arrow-table",schema:yr(r.schema),data:r}}function Vp(r){let t=tc(r);return ln(t,"array-row-table")}function jp(r){let t=tc(r);return ln(t,"object-row-table")}function tc(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:yr(r.schema),data:t}}function zp(r){let t=yr(r.schema),e=Za(t),n=e.geometry.encoding,i=[],o=r.schema.fields.map(c=>c.name).filter(c=>!(c in e)),s=r.select(o),a=r.getChild("geometry");for(let c=0;c<r.numRows;c++){let l=a?.get(c),f=Zu(l,n);if(f){let d=s.get(c)?.toJSON()||{};i.push({type:"Feature",geometry:f,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:i}}function ec(r,t){let e=Vi(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return Qa(e.data,"geojson-table");default:return e}}function Xu(r){return ws(r)}var qu={..._s,parse:async(r,t)=>ec(r,t?.arrow),parseSync:(r,t)=>ec(r,t?.arrow),parseInBatches:Xu};function ji(r,t=!1){if("data"in r)return new y(r.data.map(o=>ji(o,t)));let e=[];for(let o of r.children)e.push(ji(o,t));let n;r.dictionary!==void 0&&(n=ji(r.dictionary,t));let i={[nt.OFFSET]:Ss(r.buffers[nt.OFFSET],t),[nt.DATA]:Ss(r.buffers[nt.DATA],t),[nt.VALIDITY]:Ss(r.buffers[nt.VALIDITY],t),[nt.TYPE]:Ss(r.buffers[nt.TYPE],t)};return new N(r.type,r.offset,r.length,r._nullCount,i,e,n)}function Wp(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function Ss(r,t){return r===void 0||!t&&!Wp(r)?r:r.slice()}var Gp="4.4.0",Bs={id:"triangulation",name:"Triangulate",module:"arrow",version:Gp,options:{}};function Qu(r,t={}){return bs(Bs,{...r,operation:"triangulate"},t)}function tf(r,t={}){return bs(Bs,{...r,operation:"parse-geoarrow"},t)}return ff(zi);})();
22
22
  return __exports__;
23
23
  });