@loaders.gl/arrow 4.3.0-alpha.3 → 4.3.0-alpha.5
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/arrow-loader.js +1 -1
- package/dist/arrow-worker.js +77 -77
- package/dist/arrow-writer.js +1 -1
- package/dist/dist.dev.js +76 -76
- package/dist/dist.min.js +3 -3
- package/dist/geoarrow-writer.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/triangulate-on-worker.js +1 -1
- package/package.json +7 -7
package/dist/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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 ff=Object.create;var Jn=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var pf=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var yf=(r,t,e)=>t in r?Jn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var gf=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),xr=(r,t)=>{for(var e in t)Jn(r,e,{get:t[e],enumerable:!0})},ts=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of df(t))!mf.call(r,i)&&i!==e&&Jn(r,i,{get:()=>t[i],enumerable:!(n=hf(t,i))||n.enumerable});return r},es=(r,t,e)=>(ts(r,t,"default"),e&&ts(e,t,"default")),bf=(r,t,e)=>(e=r!=null?ff(pf(r)):{},ts(t||!r||!r.__esModule?Jn(e,"default",{value:r,enumerable:!0}):e,r)),wf=r=>ts(Jn({},"__esModule",{value:!0}),r);var rs=(r,t,e)=>(yf(r,typeof t!="symbol"?t+"":t,e),e);var vc=gf((Sm,_c)=>{_c.exports=globalThis.loaders});var qi={};xr(qi,{ArrowLoader:()=>Mu,ArrowWorkerLoader:()=>Wi,ArrowWriter:()=>Lu,GeoArrowLoader:()=>ju,GeoArrowWorkerLoader:()=>sc,TriangulationWorker:()=>Zo,VECTOR_TYPES:()=>fn,convertArrowToGeoJSONTable:()=>jo,deserializeArrowField:()=>dn,deserializeArrowMetadata:()=>Uo,deserializeArrowSchema:()=>Fu,deserializeArrowType:()=>Xa,getArrowType:()=>Ou,getBinaryGeometriesFromArrow:()=>zu,getBinaryGeometryTemplate:()=>Zi,getMeanCentersFromBinaryGeometries:()=>oc,getTriangleIndices:()=>ac,hardClone:()=>Ji,parseGeoArrowOnWorker:()=>uf,parseGeometryFromArrow:()=>zo,serializeArrowField:()=>hn,serializeArrowMetadata:()=>No,serializeArrowSchema:()=>Gn,serializeArrowType:()=>Ja,triangulateOnWorker:()=>lf,updateBoundsFromGeoArrowSamples:()=>Wo});es(qi,bf(vc(),1));var ns=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(t,e){if(this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function Ic(r,t){if(!r)throw new Error("null row");let e={};if(t)for(let n=0;n<t.length;n++)e[t[n]]=r[n];else for(let n=0;n<r.length;n++){let i=`column-${n}`;e[i]=r[n]}return e}function xc(r,t){if(!r)throw new Error("null row");if(t){let e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=r[t[n]];return e}return Object.values(r)}function Sc(r){let t=[];for(let e=0;e<r.length;e++){let n=`column-${e}`;t.push(n)}return t}function Bc(r){return Object.keys(r)}var Ac=100,is=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(t,e){if(this.options=e,this.schema=t,t){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=Sc(t),this.options.shape){case"object-row-table":let n=Ic(t,this._headers);this.addObjectRow(n,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Ac),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=Bc(t),this.options.shape){case"array-row-table":let n=xc(t,this._headers);this.addArrayRow(n,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Ac),this.objectRows[this.length]=t,this.length++;break}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var Er=class{schema;length=0;allocated=0;columns={};constructor(t,e){this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(let n in this.columns)this.columns[n][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(let e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();let t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let n in this.schema){let i=this.schema[n];t[i.name]=this.columns[i.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let t in this.schema){let e=this.schema[t],n=e.type||Float32Array,i=this.columns[e.index];if(i&&ArrayBuffer.isView(i)){let s=new n(this.allocated);s.set(i),this.columns[e.index]=s}else i?(i.length=this.allocated,this.columns[e.index]=i):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(let[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}};var _f={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},vf="TableBatchBuilder",ss=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(t,e){this.schema=t,this.options={..._f,...e}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),typeof t=="string"&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?t.length*8:Object.keys(t).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;t?.bytesUsed&&(this.bytesUsed=t.bytesUsed);let e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return is;case"columnar-table":return Er;case"arrow-table":if(!ss.ArrowBatch)throw new Error(vf);return ss.ArrowBatch;default:return ns}}},gn=ss;rs(gn,"ArrowBatch");function os(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 Tc(r,t,e){switch(r.shape){case"array-row-table":let n=If(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 s=r.data,o=s.schema.fields.findIndex(a=>a.name===e);return s.getChildAt(o)?.get(t);default:throw new Error("todo")}}function If(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Dc(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,u]of Object.entries(r.data))c[l]=u[t];return c}case"arrow-table":let i=r.data,s=e||{},o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[a.fields[c].name]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function Oc(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 u of Object.values(r.data))c[l]=u[t],l++;return c}case"arrow-table":let i=r.data,s=e||[],o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[c]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function as(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function Fc(r){let t=xf(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=as(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function xf(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 Mc(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 Lc(r){switch(r.shape){case"array-row-table":case"object-row-table":return Bf(r.data);case"geojson-table":return Af(r.features);case"columnar-table":return Sf(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Sf(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Tf(n,e);t.push(i)}return{fields:t,metadata:{}}}function Bf(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(Nc(i,n));return{fields:t,metadata:{}}}function Af(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(Nc(i,n));return{fields:t,metadata:{}}}function Tf(r,t){if(ArrayBuffer.isView(r)){let e=Fc(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=as(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Nc(r,t){let e=as(r);return{name:t,type:e,nullable:!0}}function Uc(r,t){let e=Mc(r.type,r.nullable);return new e(t)}function cs(r,t){switch(t){case"object-row-table":return Mf(r);case"array-row-table":return Ff(r);case"columnar-table":return Of(r);case"arrow-table":return Df(r);default:throw new Error(t)}}function Df(r){let t=globalThis.__loaders?._makeArrowTable;if(!t)throw new Error("");return t(r)}function Of(r){let t=r.schema||Lc(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=os(r),i={};for(let s of e){let o=Uc(s,n);i[s.name]=o;for(let a=0;a<n;a++)o[a]=Tc(r,a,s.name)}return{shape:"columnar-table",schema:t,data:i}}function Ff(r){if(r.shape==="array-row-table")return r;let t=os(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Oc(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Mf(r){if(r.shape==="object-row-table")return r;let t=os(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Dc(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Rc(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 y(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(n.next(u))}catch(h){o(h)}}function c(u){try{l(n.throw(u))}catch(h){o(h)}}function l(u){u.done?s(u.value):i(u.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Ec(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 U(r){return this instanceof U?(this.v=r,this):new U(r)}function oe(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){n[d]&&(i[d]=function(b){return new Promise(function(M,z){s.push([d,b,M,z])>1||a(d,b)})})}function a(d,b){try{c(n[d](b))}catch(M){h(s[0][3],M)}}function c(d){d.value instanceof U?Promise.resolve(d.value.v).then(l,u):h(s[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function h(d,b){d(b),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bn(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,s){t[i]=r[i]?function(o){return(e=!e)?{value:U(r[i](o)),done:!1}:s?s(o):o}:s}}function Te(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 Ec=="function"?Ec(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var ea={};xr(ea,{compareArrayLike:()=>ta,joinUint8Arrays:()=>ce,memcpy:()=>qn,rebaseValueOffsets:()=>ys,toArrayBufferView:()=>C,toArrayBufferViewAsyncIterator:()=>Oe,toArrayBufferViewIterator:()=>ke,toBigInt64Array:()=>ms,toBigUint64Array:()=>Vf,toFloat32Array:()=>jf,toFloat32ArrayAsyncIterator:()=>nh,toFloat32ArrayIterator:()=>Zf,toFloat64Array:()=>zf,toFloat64ArrayAsyncIterator:()=>ih,toFloat64ArrayIterator:()=>Jf,toInt16Array:()=>Cf,toInt16ArrayAsyncIterator:()=>qf,toInt16ArrayIterator:()=>$f,toInt32Array:()=>Rr,toInt32ArrayAsyncIterator:()=>th,toInt32ArrayIterator:()=>Hf,toInt8Array:()=>Rf,toInt8ArrayAsyncIterator:()=>Qf,toInt8ArrayIterator:()=>Gf,toUint16Array:()=>Pf,toUint16ArrayAsyncIterator:()=>eh,toUint16ArrayIterator:()=>Yf,toUint32Array:()=>kf,toUint32ArrayAsyncIterator:()=>rh,toUint32ArrayIterator:()=>Kf,toUint8Array:()=>T,toUint8ArrayAsyncIterator:()=>qo,toUint8ArrayIterator:()=>Qo,toUint8ClampedArray:()=>Wf,toUint8ClampedArrayAsyncIterator:()=>sh,toUint8ClampedArrayIterator:()=>Xf});var Lf=new TextDecoder("utf-8"),Xn=r=>Lf.decode(r),Nf=new TextEncoder,Pe=r=>Nf.encode(r);var Uf=r=>typeof r=="number",Cc=r=>typeof r=="boolean",wt=r=>typeof r=="function",Rt=r=>r!=null&&Object(r)===r,ae=r=>Rt(r)&&wt(r.then);var De=r=>Rt(r)&&wt(r[Symbol.iterator]),de=r=>Rt(r)&&wt(r[Symbol.asyncIterator]),ls=r=>Rt(r)&&Rt(r.schema);var us=r=>Rt(r)&&"done"in r&&"value"in r;var fs=r=>Rt(r)&&wt(r.stat)&&Uf(r.fd);var hs=r=>Rt(r)&&Qn(r.body),ds=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Pc=r=>Rt(r)&&wt(r.abort)&&wt(r.getWriter)&&!ds(r),Qn=r=>Rt(r)&&wt(r.cancel)&&wt(r.getReader)&&!ds(r),kc=r=>Rt(r)&&wt(r.end)&&wt(r.write)&&Cc(r.writable)&&!ds(r),ps=r=>Rt(r)&&wt(r.read)&&wt(r.pipe)&&Cc(r.readable)&&!ds(r),Vc=r=>Rt(r)&&wt(r.clear)&&wt(r.bytes)&&wt(r.position)&&wt(r.setPosition)&&wt(r.capacity)&&wt(r.getBufferIdentifier)&&wt(r.createLong);var Xo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ef(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,n-e+s)}return t}function qn(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function ce(r,t){let e=Ef(r),n=e.reduce((u,h)=>u+h.byteLength,0),i,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=e.length;++c<u;){if(i=e[c],s=i.subarray(0,Math.min(i.length,l-a)),l<=a+s.length){s.length<i.length?e[c]=i.subarray(s.length):s.length===i.length&&c++,o?qn(o,s,a):o=s;break}qn(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function C(r,t){let e=us(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Pe(e)),e instanceof ArrayBuffer?new r(e):e instanceof Xo?new r(e):Vc(e)?C(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 Rf=r=>C(Int8Array,r),Cf=r=>C(Int16Array,r),Rr=r=>C(Int32Array,r),ms=r=>C(BigInt64Array,r),T=r=>C(Uint8Array,r),Pf=r=>C(Uint16Array,r),kf=r=>C(Uint32Array,r),Vf=r=>C(BigUint64Array,r),jf=r=>C(Float32Array,r),zf=r=>C(Float64Array,r),Wf=r=>C(Uint8ClampedArray,r),Jo=r=>(r.next(),r);function*ke(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xo?e(t):De(t)?t:e(t);return yield*Jo(function*(i){let s=null;do s=i.next(yield C(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var Gf=r=>ke(Int8Array,r),$f=r=>ke(Int16Array,r),Hf=r=>ke(Int32Array,r),Qo=r=>ke(Uint8Array,r),Yf=r=>ke(Uint16Array,r),Kf=r=>ke(Uint32Array,r),Zf=r=>ke(Float32Array,r),Jf=r=>ke(Float64Array,r),Xf=r=>ke(Uint8ClampedArray,r);function Oe(r,t){return oe(this,arguments,function*(){if(ae(t))return yield U(yield U(yield*bn(Te(Oe(r,yield U(t))))));let n=function(o){return oe(this,arguments,function*(){yield yield U(yield U(o))})},i=function(o){return oe(this,arguments,function*(){yield U(yield*bn(Te(Jo(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xo?n(t):De(t)?i(t):de(t)?t:n(t);return yield U(yield*bn(Te(Jo(function(o){return oe(this,arguments,function*(){let a=null;do a=yield U(o.next(yield yield U(C(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield U(new r)})}var Qf=r=>Oe(Int8Array,r),qf=r=>Oe(Int16Array,r),th=r=>Oe(Int32Array,r),qo=r=>Oe(Uint8Array,r),eh=r=>Oe(Uint16Array,r),rh=r=>Oe(Uint32Array,r),nh=r=>Oe(Float32Array,r),ih=r=>Oe(Float64Array,r),sh=r=>Oe(Uint8ClampedArray,r);function ys(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 ta(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 gs(oh(r))},fromAsyncIterable(r){return gs(ah(r))},fromDOMStream(r){return gs(ch(r))},fromNodeStream(r){return gs(lh(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')}},gs=r=>(r.next(),r);function*oh(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?ce(n,o)[0]:([i,n,a]=ce(n,o),i)}({cmd:s,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Qo(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function ah(r){return oe(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=qo(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.next()):yield U(u.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&typeof u.throw=="function"&&(yield U(u.throw(h)))}finally{n===!1&&typeof u.return=="function"&&(yield U(u.return(new Uint8Array(0))))}return yield U(null)})}function ch(r){return oe(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=new na(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.read()):yield U(u.read(a-c)),!e&&s.byteLength>0&&(i.push(T(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&(yield U(u.cancel(h)))}finally{n===!1?yield U(u.cancel()):r.locked&&u.releaseLock()}return yield U(null)})}var na=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 y(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 y(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=T(e)),e})}},ra=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function lh(r){return oe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,l=[],u;function h(){return o==="peek"?ce(l,a)[0]:([u,l,c]=ce(l,a),u)}if({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield U(new Uint8Array(0)),yield U(null);try{e[0]=ra(r,"end"),e[1]=ra(r,"error");do{if(e[2]=ra(r,"readable"),[n,s]=yield U(Promise.race(e.map(b=>b[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=T(r.read(a-c)),u.byteLength<a-c&&(u=T(r.read()))):u=T(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield U(h()));while(a<c)}while(!i)}finally{yield U(d(e,n==="error"?s:null))}return yield U(null);function d(b,M){return u=l=null,new Promise((z,X)=>{for(let[st,yn]of b)r.off(st,yn);try{let st=r.destroy;st&&st.call(r,M),M=void 0}catch(st){M=st||M}finally{M!=null?X(M):z()}})}})}var $;(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"})($||($={}));var K;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(K||(K={}));var j;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(j||(j={}));var et;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(et||(et={}));var p;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(p||(p={}));var nt;(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"})(nt||(nt={}));var Ve=new Int32Array(2),bs=new Float32Array(Ve.buffer),ws=new Float64Array(Ve.buffer),wn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ti;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(ti||(ti={}));var Ct=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ct(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 Ve[0]=this.readInt32(t),bs[0]}readFloat64(t){return Ve[wn?0:1]=this.readInt32(t),Ve[wn?1:0]=this.readInt32(t+4),ws[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){bs[0]=e,this.writeInt32(t,Ve[0])}writeFloat64(t,e){ws[0]=e,this.writeInt32(t,Ve[wn?0:1]),this.writeInt32(t+4,Ve[wn?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===ti.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 s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var ar=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=Ct.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=ar.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=Ct.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=2;l<s;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(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;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);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return 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 ei;(function(r){r[r.BUFFER=0]="BUFFER"})(ei||(ei={}));var ri;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ri||(ri={}));var Me=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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new Me).__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):ri.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ei.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ri.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ei.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Me.startBodyCompression(t),Me.addCodec(t,e),Me.addMethod(t,n),Me.endBodyCompression(t)}};var _n=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 vn=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 Ft=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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Ft).__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 vn).__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 _n).__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 Me).__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 me=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 me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new me).__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 Ft).__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 Sr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Sr||(Sr={}));var ni;(function(r){r[r.DenseArray=0]="DenseArray"})(ni||(ni={}));var _t=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 _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new _t).__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 _t.startInt(t),_t.addBitWidth(t,e),_t.addIsSigned(t,n),_t.endInt(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 getRootAsDictionaryEncoding(t,e){return(e||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new le).__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 _t).__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):ni.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,ni.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Q=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 Q).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new Q).__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 Q.startKeyValue(t),Q.addKey(t,e),Q.addValue(t,n),Q.endKeyValue(t)}};var je=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 je).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new je).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return je.startBinary(t),je.endBinary(t)}};var ze=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 ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new ze).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return ze.startBool(t),ze.endBool(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 getRootAsDate(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new Gt).__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):et.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,et.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Gt.startDate(t),Gt.addUnit(t,e),Gt.endDate(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 getRootAsDecimal(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new vt).__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 vt.startDecimal(t),vt.addPrecision(t,e),vt.addScale(t,n),vt.addBitWidth(t,i),vt.endDecimal(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 getRootAsDuration(t,e){return(e||new $t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new $t).__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):p.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,p.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return $t.startDuration(t),$t.addUnit(t,e),$t.endDuration(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 getRootAsFixedSizeBinary(t,e){return(e||new Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Ht).__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 Ht.startFixedSizeBinary(t),Ht.addByteWidth(t,e),Ht.endFixedSizeBinary(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 getRootAsFixedSizeList(t,e){return(e||new Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new Yt).__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 Yt.startFixedSizeList(t),Yt.addListSize(t,e),Yt.endFixedSizeList(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 getRootAsFloatingPoint(t,e){return(e||new Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new Kt).__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):j.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,j.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Kt.startFloatingPoint(t),Kt.addPrecision(t,e),Kt.endFloatingPoint(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 getRootAsInterval(t,e){return(e||new Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(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):nt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,nt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Zt.startInterval(t),Zt.addUnit(t,e),Zt.endInterval(t)}};var We=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 We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new We).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return We.startLargeBinary(t),We.endLargeBinary(t)}};var Ge=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 Ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ge).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Ge.startLargeUtf8(t),Ge.endLargeUtf8(t)}};var $e=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 $e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new $e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return $e.startList(t),$e.endList(t)}};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 He=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 He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new He).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return He.startNull(t),He.endNull(t)}};var Ye=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 Ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ye).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ye.startStruct_(t),Ye.endStruct_(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 getRootAsTime(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new Mt).__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):p.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,p.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return Mt.startTime(t),Mt.addUnit(t,e),Mt.addBitWidth(t,n),Mt.endTime(t)}};var Lt=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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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):p.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,p.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Lt.startTimestamp(t),Lt.addUnit(t,e),Lt.addTimezone(t,n),Lt.endTimestamp(t)}};var It=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 It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new It).__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):K.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,K.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 It.startUnion(t),It.addMode(t,e),It.addTypeIds(t,n),It.endUnion(t)}};var Ke=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 Ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ke).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ke.startUtf8(t),Ke.endUtf8(t)}};var Z;(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"})(Z||(Z={}));var dt=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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new dt).__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):Z.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 le).__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 dt).__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 Q).__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,Z.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 ot=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 ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new ot).__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):Sr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dt).__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 Q).__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,Sr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return ot.startSchema(t),ot.addEndianness(t,e),ot.addFields(t,n),ot.addCustomMetadata(t,i),ot.addFeatures(t,s),ot.endSchema(t)}};var P;(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"})(P||(P={}));var f;(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"})(f||(f={}));var lt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(lt||(lt={}));var Ia={};xr(Ia,{clampIndex:()=>Jh,clampRange:()=>oi,createElementComparator:()=>Dr});var ia={};xr(ia,{valueToString:()=>Le});function Le(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=>Le(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var oa={};xr(oa,{BN:()=>Cr,bigNumToBigInt:()=>Wc,bigNumToString:()=>Sn,isArrowBigNumSymbol:()=>jc});var jc=Symbol.for("isArrowBigNum");function Ne(r,...t){return t.length===0?Object.setPrototypeOf(C(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ne.prototype[jc]=!0;Ne.prototype.toJSON=function(){return`"${Sn(this)}"`};Ne.prototype.valueOf=function(){return zc(this)};Ne.prototype.toString=function(){return Sn(this)};Ne.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return zc(this);case"string":return Sn(this);case"default":return Wc(this)}return Sn(this)};function In(...r){return Ne.apply(this,r)}function xn(...r){return Ne.apply(this,r)}function ii(...r){return Ne.apply(this,r)}Object.setPrototypeOf(In.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(xn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ii.prototype,Object.create(Uint32Array.prototype));Object.assign(In.prototype,Ne.prototype,{constructor:In,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(xn.prototype,Ne.prototype,{constructor:xn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ii.prototype,Ne.prototype,{constructor:ii,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function zc(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new BigUint64Array(t,e,n),o=i&&s.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),c=BigInt(0);if(o){for(let l of s)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of s)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var Sn=r=>{if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return sa(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return sa(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}return`-${sa(t)}`},Wc=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Sn(r);function sa(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Cr=class{static new(t,e){switch(e){case!0:return new In(t);case!1:return new xn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new In(t)}return t.byteLength===16?new ii(t):new xn(t)}static signed(t){return new In(t)}static unsigned(t){return new xn(t)}static decimal(t){return new ii(t)}constructor(t,e){return Cr.new(t,e)}};function at(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)}var Gc,$c,Hc,Yc,Kc,Zc,Jc,Xc,Qc,qc,tl,el,rl,nl,il,sl,ol,al,cl,ll,ul,fl,m=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return m.isUnion(t)&&t.mode===K.Dense}static isSparseUnion(t){return m.isUnion(t)&&t.mode===K.Sparse}constructor(t){this.typeId=t}};Gc=Symbol.toStringTag;m[Gc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(m.prototype);var ut=class extends m{constructor(){super(f.Null)}toString(){return"Null"}};$c=Symbol.toStringTag;ut[$c]=(r=>r[Symbol.toStringTag]="Null")(ut.prototype);var it=class extends m{constructor(t,e){super(f.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}`}};Hc=Symbol.toStringTag;it[Hc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(it.prototype);var ye=class extends it{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ge=class extends it{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},pt=class extends it{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},be=class extends it{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},we=class extends it{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},_e=class extends it{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ve=class extends it{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ze=class extends it{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ye.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ge.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(pt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(be.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(we.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(_e.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ze.prototype,"ArrayType",{value:BigUint64Array});var At=class extends m{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case j.HALF:return Uint16Array;case j.SINGLE:return Float32Array;case j.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Yc=Symbol.toStringTag;At[Yc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(At.prototype);var Br=class extends At{constructor(){super(j.HALF)}},Xt=class extends At{constructor(){super(j.SINGLE)}},Qt=class extends At{constructor(){super(j.DOUBLE)}};Object.defineProperty(Br.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Xt.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qt.prototype,"ArrayType",{value:Float64Array});var ue=class extends m{constructor(){super(f.Binary)}toString(){return"Binary"}};Kc=Symbol.toStringTag;ue[Kc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ue.prototype);var Je=class extends m{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Zc=Symbol.toStringTag;Je[Zc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Je.prototype);var Pt=class extends m{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Jc=Symbol.toStringTag;Pt[Jc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Pt.prototype);var Xe=class extends m{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Xc=Symbol.toStringTag;Xe[Xc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Xe.prototype);var kt=class extends m{constructor(){super(f.Bool)}toString(){return"Bool"}};Qc=Symbol.toStringTag;kt[Qc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(kt.prototype);var fe=class extends m{constructor(t,e,n=128){super(f.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};qc=Symbol.toStringTag;fe[qc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(fe.prototype);var qt=class extends m{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${et[this.unit]}>`}};tl=Symbol.toStringTag;qt[tl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(qt.prototype);var Pr=class extends qt{constructor(){super(et.DAY)}},cr=class extends qt{constructor(){super(et.MILLISECOND)}},xt=class extends m{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${p[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};el=Symbol.toStringTag;xt[el]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(xt.prototype);var kr=class extends xt{constructor(){super(p.SECOND,32)}},Vr=class extends xt{constructor(){super(p.MILLISECOND,32)}},jr=class extends xt{constructor(){super(p.MICROSECOND,64)}},zr=class extends xt{constructor(){super(p.NANOSECOND,64)}},Nt=class extends m{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${p[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};rl=Symbol.toStringTag;Nt[rl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Nt.prototype);var Wr=class extends Nt{constructor(t){super(p.SECOND,t)}},Gr=class extends Nt{constructor(t){super(p.MILLISECOND,t)}},$r=class extends Nt{constructor(t){super(p.MICROSECOND,t)}},Hr=class extends Nt{constructor(t){super(p.NANOSECOND,t)}},te=class extends m{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${nt[this.unit]}>`}};nl=Symbol.toStringTag;te[nl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(te.prototype);var Yr=class extends te{constructor(){super(nt.DAY_TIME)}},Kr=class extends te{constructor(){super(nt.YEAR_MONTH)}},Qe=class extends m{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${p[this.unit]}>`}};il=Symbol.toStringTag;Qe[il]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Qe.prototype);var Tt=class extends m{constructor(t){super(f.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}};sl=Symbol.toStringTag;Tt[sl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Tt.prototype);var V=class extends m{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ol=Symbol.toStringTag;V[ol]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(V.prototype);var Ie=class extends m{constructor(t,e,n){super(f.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};al=Symbol.toStringTag;Ie[al]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ie.prototype);var qe=class extends m{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};cl=Symbol.toStringTag;qe[cl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(qe.prototype);var Vt=class extends m{constructor(t,e){super(f.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}>`}};ll=Symbol.toStringTag;Vt[ll]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Vt.prototype);var jt=class extends m{constructor(t,e=!1){var n,i,s;if(super(f.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");let a=(s=t?.type)===null||s===void 0?void 0:s.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(", ")}}>`}};ul=Symbol.toStringTag;jt[ul]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(jt.prototype);var uh=(r=>()=>++r)(-1),Ut=class extends m{constructor(t,e,n,i){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?uh():at(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}>`}};fl=Symbol.toStringTag;Ut[fl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ut.prototype);function he(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Timestamp:return 2;case f.Date:return 1+t.unit;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var v=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return fh(this,t,e)}getVisitFnByTypeId(t,e=!0){return Bn(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 fh(r,t,e=!0){return typeof t=="number"?Bn(r,t,e):typeof t=="string"&&t in f?Bn(r,f[t],e):t&&t instanceof m?Bn(r,dl(t),e):t?.type&&t.type instanceof m?Bn(r,dl(t.type),e):Bn(r,f.NONE,e)}function Bn(r,t,e=!0){let n=null;switch(t){case f.Null:n=r.visitNull;break;case f.Bool:n=r.visitBool;break;case f.Int:n=r.visitInt;break;case f.Int8:n=r.visitInt8||r.visitInt;break;case f.Int16:n=r.visitInt16||r.visitInt;break;case f.Int32:n=r.visitInt32||r.visitInt;break;case f.Int64:n=r.visitInt64||r.visitInt;break;case f.Uint8:n=r.visitUint8||r.visitInt;break;case f.Uint16:n=r.visitUint16||r.visitInt;break;case f.Uint32:n=r.visitUint32||r.visitInt;break;case f.Uint64:n=r.visitUint64||r.visitInt;break;case f.Float:n=r.visitFloat;break;case f.Float16:n=r.visitFloat16||r.visitFloat;break;case f.Float32:n=r.visitFloat32||r.visitFloat;break;case f.Float64:n=r.visitFloat64||r.visitFloat;break;case f.Utf8:n=r.visitUtf8;break;case f.LargeUtf8:n=r.visitLargeUtf8;break;case f.Binary:n=r.visitBinary;break;case f.LargeBinary:n=r.visitLargeBinary;break;case f.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case f.Date:n=r.visitDate;break;case f.DateDay:n=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:n=r.visitTimestamp;break;case f.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:n=r.visitTime;break;case f.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:n=r.visitDecimal;break;case f.List:n=r.visitList;break;case f.Struct:n=r.visitStruct;break;case f.Union:n=r.visitUnion;break;case f.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:n=r.visitDictionary;break;case f.Interval:n=r.visitInterval;break;case f.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case f.Duration:n=r.visitDuration;break;case f.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case f.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case f.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case f.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case f.FixedSizeList:n=r.visitFixedSizeList;break;case f.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function dl(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case j.HALF:return f.Float16;case j.SINGLE:return f.Float32;case j.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case p.SECOND:return f.TimeSecond;case p.MILLISECOND:return f.TimeMillisecond;case p.MICROSECOND:return f.TimeMicrosecond;case p.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case p.SECOND:return f.TimestampSecond;case p.MILLISECOND:return f.TimestampMillisecond;case p.MICROSECOND:return f.TimestampMicrosecond;case p.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case et.DAY:return f.DateDay;case et.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case nt.DAY_TIME:return f.IntervalDayTime;case nt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case p.SECOND:return f.DurationSecond;case p.MILLISECOND:return f.DurationMillisecond;case p.MICROSECOND:return f.DurationMicrosecond;case p.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case K.Dense:return f.DenseUnion;case K.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}v.prototype.visitInt8=null;v.prototype.visitInt16=null;v.prototype.visitInt32=null;v.prototype.visitInt64=null;v.prototype.visitUint8=null;v.prototype.visitUint16=null;v.prototype.visitUint32=null;v.prototype.visitUint64=null;v.prototype.visitFloat16=null;v.prototype.visitFloat32=null;v.prototype.visitFloat64=null;v.prototype.visitDateDay=null;v.prototype.visitDateMillisecond=null;v.prototype.visitTimestampSecond=null;v.prototype.visitTimestampMillisecond=null;v.prototype.visitTimestampMicrosecond=null;v.prototype.visitTimestampNanosecond=null;v.prototype.visitTimeSecond=null;v.prototype.visitTimeMillisecond=null;v.prototype.visitTimeMicrosecond=null;v.prototype.visitTimeNanosecond=null;v.prototype.visitDenseUnion=null;v.prototype.visitSparseUnion=null;v.prototype.visitIntervalDayTime=null;v.prototype.visitIntervalYearMonth=null;v.prototype.visitDuration=null;v.prototype.visitDurationSecond=null;v.prototype.visitDurationMillisecond=null;v.prototype.visitDurationMicrosecond=null;v.prototype.visitDurationNanosecond=null;var aa={};xr(aa,{float64ToUint16:()=>si,uint16ToFloat64:()=>vs});var pl=new Float64Array(1),An=new Uint32Array(pl.buffer);function vs(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 si(r){if(r!==r)return 32256;pl[0]=r;let t=(An[1]&2147483648)>>16&65535,e=An[1]&2146435072,n=0;return e>=1089470464?An[0]>0?e=31744:(e=(e&2080374784)>>16,n=(An[1]&1048575)>>10):e<=1056964608?(n=1048576+(An[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(An[1]&1048575)+512>>10),t|e|n&65535}var A=class extends v{};function L(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var hh=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},ca=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},dh=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},ph=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},ml=(r,t,e,n)=>{if(e+1<t.length){let i=at(t[e]),s=at(t[e+1]);r.set(n.subarray(0,s-i),i)}},mh=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},lr=({values:r},t,e)=>{r[t]=e},la=({values:r},t,e)=>{r[t]=e},yl=({values:r},t,e)=>{r[t]=si(e)},yh=(r,t,e)=>{switch(r.type.precision){case j.HALF:return yl(r,t,e);case j.SINGLE:case j.DOUBLE:return la(r,t,e)}},Is=({values:r},t,e)=>{hh(r,t,e.valueOf())},xs=({values:r},t,e)=>{ca(r,t*2,e.valueOf())},ua=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},gl=({values:r,valueOffsets:t},e,n)=>ml(r,t,e,n),bl=({values:r,valueOffsets:t},e,n)=>ml(r,t,e,Pe(n)),fa=(r,t,e)=>{r.type.unit===et.DAY?Is(r,t,e):xs(r,t,e)},Ss=({values:r},t,e)=>ca(r,t*2,e/1e3),Bs=({values:r},t,e)=>ca(r,t*2,e),As=({values:r},t,e)=>dh(r,t*2,e),Ts=({values:r},t,e)=>ph(r,t*2,e),ha=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ss(r,t,e);case p.MILLISECOND:return Bs(r,t,e);case p.MICROSECOND:return As(r,t,e);case p.NANOSECOND:return Ts(r,t,e)}},Ds=({values:r},t,e)=>{r[t]=e},Os=({values:r},t,e)=>{r[t]=e},Fs=({values:r},t,e)=>{r[t]=e},Ms=({values:r},t,e)=>{r[t]=e},da=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ds(r,t,e);case p.MILLISECOND:return Os(r,t,e);case p.MICROSECOND:return Fs(r,t,e);case p.NANOSECOND:return Ms(r,t,e)}},pa=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},gh=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Dt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e.get(++o))},bh=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Dt.getVisitFn(n),{[t]:o,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(s(n,o,l),++o>=a)break},wh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),_h=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),vh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Ih=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),xh=(r,t,e)=>{let n=r.type.children.map(s=>Dt.getVisitFn(s.type)),i=e instanceof Map?vh(t,e):e instanceof g?_h(t,e):Array.isArray(e)?wh(t,e):Ih(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Sh=(r,t,e)=>{r.type.mode===K.Dense?wl(r,t,e):_l(r,t,e)},wl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,r.valueOffsets[t],e)},_l=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,t,e)},Bh=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},ma=(r,t,e)=>{r.type.unit===nt.DAY_TIME?Ls(r,t,e):Ns(r,t,e)},Ls=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Ns=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Us=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},Rs=({values:r},t,e)=>{r[t]=e},Cs=({values:r},t,e)=>{r[t]=e},ya=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Us(r,t,e);case p.MILLISECOND:return Es(r,t,e);case p.MICROSECOND:return Rs(r,t,e);case p.NANOSECOND:return Cs(r,t,e)}},Ah=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Dt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};A.prototype.visitBool=L(mh);A.prototype.visitInt=L(lr);A.prototype.visitInt8=L(lr);A.prototype.visitInt16=L(lr);A.prototype.visitInt32=L(lr);A.prototype.visitInt64=L(lr);A.prototype.visitUint8=L(lr);A.prototype.visitUint16=L(lr);A.prototype.visitUint32=L(lr);A.prototype.visitUint64=L(lr);A.prototype.visitFloat=L(yh);A.prototype.visitFloat16=L(yl);A.prototype.visitFloat32=L(la);A.prototype.visitFloat64=L(la);A.prototype.visitUtf8=L(bl);A.prototype.visitLargeUtf8=L(bl);A.prototype.visitBinary=L(gl);A.prototype.visitLargeBinary=L(gl);A.prototype.visitFixedSizeBinary=L(ua);A.prototype.visitDate=L(fa);A.prototype.visitDateDay=L(Is);A.prototype.visitDateMillisecond=L(xs);A.prototype.visitTimestamp=L(ha);A.prototype.visitTimestampSecond=L(Ss);A.prototype.visitTimestampMillisecond=L(Bs);A.prototype.visitTimestampMicrosecond=L(As);A.prototype.visitTimestampNanosecond=L(Ts);A.prototype.visitTime=L(da);A.prototype.visitTimeSecond=L(Ds);A.prototype.visitTimeMillisecond=L(Os);A.prototype.visitTimeMicrosecond=L(Fs);A.prototype.visitTimeNanosecond=L(Ms);A.prototype.visitDecimal=L(pa);A.prototype.visitList=L(gh);A.prototype.visitStruct=L(xh);A.prototype.visitUnion=L(Sh);A.prototype.visitDenseUnion=L(wl);A.prototype.visitSparseUnion=L(_l);A.prototype.visitDictionary=L(Bh);A.prototype.visitInterval=L(ma);A.prototype.visitIntervalDayTime=L(Ls);A.prototype.visitIntervalYearMonth=L(Ns);A.prototype.visitDuration=L(ya);A.prototype.visitDurationSecond=L(Us);A.prototype.visitDurationMillisecond=L(Es);A.prototype.visitDurationMicrosecond=L(Rs);A.prototype.visitDurationNanosecond=L(Cs);A.prototype.visitFixedSizeList=L(Ah);A.prototype.visitMap=L(bh);var Dt=new A;var Ue=Symbol.for("parent"),Tn=Symbol.for("rowIndex"),Ar=class{constructor(t,e){return this[Ue]=t,this[Tn]=e,new Proxy(this,new ba)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Tn],e=this[Ue],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=mt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ga(this[Ue],this[Tn])}},ga=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,mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ue]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Tn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ba=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ue].type.children.map(e=>e.name)}has(t,e){return t[Ue].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ue].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[Ue].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=mt.visit(t[Ue].children[n],t[Tn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ue].type.children.findIndex(s=>s.name===e);return i!==-1?(Dt.visit(t[Ue].children[i],t[Tn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var I=class extends v{};function O(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Th=(r,t)=>864e5*r[t],wa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Dh=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Oh=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,vl=r=>new Date(r),Fh=(r,t)=>vl(Th(r,t)),Mh=(r,t)=>vl(wa(r,t)),Lh=(r,t)=>null,Il=(r,t,e)=>{if(e+1>=t.length)return null;let n=at(t[e]),i=at(t[e+1]);return r.subarray(n,i)},Nh=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},xl=({values:r},t)=>Fh(r,t),Sl=({values:r},t)=>Mh(r,t*2),Tr=({stride:r,values:t},e)=>t[r*e],Uh=({stride:r,values:t},e)=>vs(t[r*e]),Bl=({values:r},t)=>r[t],Eh=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Al=({values:r,valueOffsets:t},e)=>Il(r,t,e),Tl=({values:r,valueOffsets:t},e)=>{let n=Il(r,t,e);return n!==null?Xn(n):null},Rh=({values:r},t)=>r[t],Ch=({type:r,values:t},e)=>r.precision!==j.HALF?t[e]:vs(t[e]),Ph=(r,t)=>r.type.unit===et.DAY?xl(r,t):Sl(r,t),Dl=({values:r},t)=>1e3*wa(r,t*2),Ol=({values:r},t)=>wa(r,t*2),Fl=({values:r},t)=>Dh(r,t*2),Ml=({values:r},t)=>Oh(r,t*2),kh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Dl(r,t);case p.MILLISECOND:return Ol(r,t);case p.MICROSECOND:return Fl(r,t);case p.NANOSECOND:return Ml(r,t)}},Ll=({values:r},t)=>r[t],Nl=({values:r},t)=>r[t],Ul=({values:r},t)=>r[t],El=({values:r},t)=>r[t],Vh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Ll(r,t);case p.MILLISECOND:return Nl(r,t);case p.MICROSECOND:return Ul(r,t);case p.NANOSECOND:return El(r,t)}},jh=({values:r,stride:t},e)=>Cr.decimal(r.subarray(t*e,t*(e+1))),zh=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,c=i[0].slice(s,o-s);return new g([c])},Wh=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new tr(o.slice(i,s-i))},Gh=(r,t)=>new Ar(r,t),$h=(r,t)=>r.type.mode===K.Dense?Rl(r,t):Cl(r,t),Rl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,r.valueOffsets[t])},Cl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,t)},Hh=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Yh=(r,t)=>r.type.unit===nt.DAY_TIME?Pl(r,t):kl(r,t),Pl=({values:r},t)=>r.subarray(2*t,2*(t+1)),kl=({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},Vl=({values:r},t)=>r[t],jl=({values:r},t)=>r[t],zl=({values:r},t)=>r[t],Wl=({values:r},t)=>r[t],Kh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Vl(r,t);case p.MILLISECOND:return jl(r,t);case p.MICROSECOND:return zl(r,t);case p.NANOSECOND:return Wl(r,t)}},Zh=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new g([s])};I.prototype.visitNull=O(Lh);I.prototype.visitBool=O(Nh);I.prototype.visitInt=O(Rh);I.prototype.visitInt8=O(Tr);I.prototype.visitInt16=O(Tr);I.prototype.visitInt32=O(Tr);I.prototype.visitInt64=O(Bl);I.prototype.visitUint8=O(Tr);I.prototype.visitUint16=O(Tr);I.prototype.visitUint32=O(Tr);I.prototype.visitUint64=O(Bl);I.prototype.visitFloat=O(Ch);I.prototype.visitFloat16=O(Uh);I.prototype.visitFloat32=O(Tr);I.prototype.visitFloat64=O(Tr);I.prototype.visitUtf8=O(Tl);I.prototype.visitLargeUtf8=O(Tl);I.prototype.visitBinary=O(Al);I.prototype.visitLargeBinary=O(Al);I.prototype.visitFixedSizeBinary=O(Eh);I.prototype.visitDate=O(Ph);I.prototype.visitDateDay=O(xl);I.prototype.visitDateMillisecond=O(Sl);I.prototype.visitTimestamp=O(kh);I.prototype.visitTimestampSecond=O(Dl);I.prototype.visitTimestampMillisecond=O(Ol);I.prototype.visitTimestampMicrosecond=O(Fl);I.prototype.visitTimestampNanosecond=O(Ml);I.prototype.visitTime=O(Vh);I.prototype.visitTimeSecond=O(Ll);I.prototype.visitTimeMillisecond=O(Nl);I.prototype.visitTimeMicrosecond=O(Ul);I.prototype.visitTimeNanosecond=O(El);I.prototype.visitDecimal=O(jh);I.prototype.visitList=O(zh);I.prototype.visitStruct=O(Gh);I.prototype.visitUnion=O($h);I.prototype.visitDenseUnion=O(Rl);I.prototype.visitSparseUnion=O(Cl);I.prototype.visitDictionary=O(Hh);I.prototype.visitInterval=O(Yh);I.prototype.visitIntervalDayTime=O(Pl);I.prototype.visitIntervalYearMonth=O(kl);I.prototype.visitDuration=O(Kh);I.prototype.visitDurationSecond=O(Vl);I.prototype.visitDurationMillisecond=O(jl);I.prototype.visitDurationMicrosecond=O(zl);I.prototype.visitDurationNanosecond=O(Wl);I.prototype.visitFixedSizeList=O(Zh);I.prototype.visitMap=O(Wh);var mt=new I;var xe=Symbol.for("keys"),Dn=Symbol.for("vals"),tr=class{constructor(t){return this[xe]=new g([t.children[0]]).memoize(),this[Dn]=t.children[1],new Proxy(this,new va)}[Symbol.iterator](){return new _a(this[xe],this[Dn])}get size(){return this[xe].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[xe],e=this[Dn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=mt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},_a=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),mt.visit(this.vals,t)]})}},va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xe].toArray().map(String)}has(t,e){return t[xe].includes(e)}getOwnPropertyDescriptor(t,e){if(t[xe].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[xe].indexOf(e);if(n!==-1){let i=mt.visit(Reflect.get(t,Dn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[xe].indexOf(e);return i!==-1?(Dt.visit(Reflect.get(t,Dn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(tr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Dn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Jh(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var Gl;function oi(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(Gl=s,s=o,o=Gl),o>i&&(o=i),n?n(r,s,o):[s,o]}var $l=r=>r!==r;function Dr(r){if(typeof r!=="object"||r===null)return $l(r)?$l: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?ta(r,e):!1:r instanceof Map?Qh(r):Array.isArray(r)?Xh(r):r instanceof g?qh(r):td(r,!0)}function Xh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r[e]);return Ps(t)}function Qh(r){let t=-1,e=[];for(let n of r.values())e[++t]=Dr(n);return Ps(e)}function qh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r.get(e));return Ps(t)}function td(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=Dr(r[e[i]]);return Ps(n,e)}function Ps(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return ed(r,e);case Map:return Hl(r,e,e.keys());case tr:case Ar:case Object:case void 0:return Hl(r,e,t||Object.keys(e))}return e instanceof g?rd(r,e):!1}}function ed(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 rd(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 Hl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),l=n.next(),u=i.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=n.next(),u=i.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var xa={};xr(xa,{BitIterator:()=>Zr,getBit:()=>Yl,getBool:()=>Vs,packBools:()=>Xr,popcnt_array:()=>Kl,popcnt_bit_range:()=>ai,popcnt_uint32:()=>ks,setBool:()=>nd,truncateBitmap:()=>Jr});function Vs(r,t,e,n){return(e&1<<n)!==0}function Yl(r,t,e,n){return(e&1<<n)>>n}function nd(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Jr(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):Xr(new Zr(e,r,t,null,Vs)).subarray(0,n)),i}return e}function Xr(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var Zr=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ai(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new Zr(r,t,e-t,r,Yl))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ai(r,t,i)+ai(r,n,e)+Kl(r,i>>3,n-i>>3)}function Kl(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=ks(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=ks(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=ks(s.getUint8(i)),i+=1;return n}function ks(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 id=-1,R=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 m.isSparseUnion(t)?this.children.some(e=>e.nullable):m.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:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(m.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=id&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-ai(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;s instanceof R?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=he(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(m.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===K.Dense?this.valueOffsets[t]:t;return i.getValid(s)}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(m.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===K.Dense?this.valueOffsets[t]:t;n=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&s.set(Jr(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));let h=s[u];n=(h&l)!==0,e?s[u]=h|l:s[u]=h&~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,s=this,o=this.children){return new R(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.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(Jr(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[lt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[lt.TYPE])&&(o[lt.TYPE]=s.subarray(t,t+e)),(s=o[lt.OFFSET])&&(o[lt.OFFSET]=s.subarray(t,t+e+1))||(s=o[lt.DATA])&&(o[lt.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};R.prototype.children=Object.freeze([]);var Qr=class extends v{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new R(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=ms(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=ms(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=T(t.nullBitmap),{length:o=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=C(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(m.isSparseUnion(e))return new R(e,n,o,a,[void 0,void 0,void 0,s],i);let c=Rr(t.valueOffsets);return new R(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.indices.ArrayType,t.data),{["dictionary"]:o=new g([new Qr().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Qr().visit({type:e.valueType})}=t,s=T(t.nullBitmap),{["length"]:o=i.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Qr().visit({type:e.childType})}=t,s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}},sd=new Qr;function w(r){return sd.visit(r)}var ci=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 Zl(r){return r.some(t=>t.nullable)}function js(r){return r.reduce((t,e)=>t+e.nullCount,0)}function zs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ws(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let u=Math.max(0,e-c),h=Math.min(n-c,l);i.push(a.slice(u,h-u))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Sa(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function li(r,t){return r.getValid(t)}function On(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Sa(n,this._offsets,e,t)}}function Gs(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=Sa(s,this._offsets,n,e);return t=void 0,o}}function $s(r){let t;function e(n,i,s){let o=s,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let h=n[l];if(~(a=r(h,t,o)))return c+a;o=0,c+=h.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Sa(s,this._offsets,i,e);return t=void 0,o}}var x=class extends v{};function od(r,t){return t===null&&r.length>0?0:-1}function ad(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new Zr(e,r.offset+(t||0),r.length,e,Vs)){if(!i)return n;++n}return-1}function N(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case f.Union:break;case f.Dictionary:break;default:return ad(r,e)}let n=mt.getVisitFn(r),i=Dr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function Jl(r,t,e){let n=mt.getVisitFn(r),i=Dr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}x.prototype.visitNull=od;x.prototype.visitBool=N;x.prototype.visitInt=N;x.prototype.visitInt8=N;x.prototype.visitInt16=N;x.prototype.visitInt32=N;x.prototype.visitInt64=N;x.prototype.visitUint8=N;x.prototype.visitUint16=N;x.prototype.visitUint32=N;x.prototype.visitUint64=N;x.prototype.visitFloat=N;x.prototype.visitFloat16=N;x.prototype.visitFloat32=N;x.prototype.visitFloat64=N;x.prototype.visitUtf8=N;x.prototype.visitLargeUtf8=N;x.prototype.visitBinary=N;x.prototype.visitLargeBinary=N;x.prototype.visitFixedSizeBinary=N;x.prototype.visitDate=N;x.prototype.visitDateDay=N;x.prototype.visitDateMillisecond=N;x.prototype.visitTimestamp=N;x.prototype.visitTimestampSecond=N;x.prototype.visitTimestampMillisecond=N;x.prototype.visitTimestampMicrosecond=N;x.prototype.visitTimestampNanosecond=N;x.prototype.visitTime=N;x.prototype.visitTimeSecond=N;x.prototype.visitTimeMillisecond=N;x.prototype.visitTimeMicrosecond=N;x.prototype.visitTimeNanosecond=N;x.prototype.visitDecimal=N;x.prototype.visitList=N;x.prototype.visitStruct=N;x.prototype.visitUnion=N;x.prototype.visitDenseUnion=Jl;x.prototype.visitSparseUnion=Jl;x.prototype.visitDictionary=N;x.prototype.visitInterval=N;x.prototype.visitIntervalDayTime=N;x.prototype.visitIntervalYearMonth=N;x.prototype.visitDuration=N;x.prototype.visitDurationSecond=N;x.prototype.visitDurationMillisecond=N;x.prototype.visitDurationMicrosecond=N;x.prototype.visitDurationNanosecond=N;x.prototype.visitFixedSizeList=N;x.prototype.visitMap=N;var qr=new x;var S=class extends v{};function F(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof it&&t.bitWidth!==64||t instanceof xt&&t.bitWidth!==64||t instanceof At&&t.precision!==j.HALF))return new ci(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ci(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Ba(o)})}var Ba=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}};S.prototype.visitNull=F;S.prototype.visitBool=F;S.prototype.visitInt=F;S.prototype.visitInt8=F;S.prototype.visitInt16=F;S.prototype.visitInt32=F;S.prototype.visitInt64=F;S.prototype.visitUint8=F;S.prototype.visitUint16=F;S.prototype.visitUint32=F;S.prototype.visitUint64=F;S.prototype.visitFloat=F;S.prototype.visitFloat16=F;S.prototype.visitFloat32=F;S.prototype.visitFloat64=F;S.prototype.visitUtf8=F;S.prototype.visitLargeUtf8=F;S.prototype.visitBinary=F;S.prototype.visitLargeBinary=F;S.prototype.visitFixedSizeBinary=F;S.prototype.visitDate=F;S.prototype.visitDateDay=F;S.prototype.visitDateMillisecond=F;S.prototype.visitTimestamp=F;S.prototype.visitTimestampSecond=F;S.prototype.visitTimestampMillisecond=F;S.prototype.visitTimestampMicrosecond=F;S.prototype.visitTimestampNanosecond=F;S.prototype.visitTime=F;S.prototype.visitTimeSecond=F;S.prototype.visitTimeMillisecond=F;S.prototype.visitTimeMicrosecond=F;S.prototype.visitTimeNanosecond=F;S.prototype.visitDecimal=F;S.prototype.visitList=F;S.prototype.visitStruct=F;S.prototype.visitUnion=F;S.prototype.visitDenseUnion=F;S.prototype.visitSparseUnion=F;S.prototype.visitDictionary=F;S.prototype.visitInterval=F;S.prototype.visitIntervalDayTime=F;S.prototype.visitIntervalYearMonth=F;S.prototype.visitDuration=F;S.prototype.visitDurationSecond=F;S.prototype.visitDurationMillisecond=F;S.prototype.visitDurationMicrosecond=F;S.prototype.visitDurationNanosecond=F;S.prototype.visitFixedSizeList=F;S.prototype.visitMap=F;var Fn=new S;var Xl,Ql={},ql={},g=class{constructor(t){var e,n,i;let s=t[0]instanceof g?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof R)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=Ql[o.typeId],u=s[0];this.isValid=h=>li(u,h),this.get=h=>a(u,h),this.set=(h,d)=>c(u,h,d),this.indexOf=h=>l(u,h),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,ql[o.typeId]),this._offsets=zs(s);break}this.data=s,this.type=o,this.stride=he(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Zl(this.data)}get nullCount(){return js(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Fn.visit(this)}concat(...t){return new g(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new g(oi(this,t,e,({data:n,_offsets:i},s,o)=>Ws(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*i),o.offset),o.offset+=c*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new g(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return m.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(m.isDictionary(this.type)){let t=new Mn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new g(e)}return new Mn(this)}unmemoize(){if(m.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 g(e)}return this}};Xl=Symbol.toStringTag;g[Xl]=(r=>{r.type=m.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(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let n=mt.getVisitFnByTypeId(e),i=Dt.getVisitFnByTypeId(e),s=qr.getVisitFnByTypeId(e);Ql[e]={get:n,set:i,indexOf:s},ql[e]=Object.create(r,{isValid:{value:On(li)},get:{value:On(mt.getVisitFnByTypeId(e))},set:{value:Gs(Dt.getVisitFnByTypeId(e))},indexOf:{value:$s(qr.getVisitFnByTypeId(e))}})}return"Vector"})(g.prototype);var Mn=class extends g{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new Mn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new g(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Or(r){if(r){if(r instanceof R)return new g([r]);if(r instanceof g)return new g(r.data);if(r.type instanceof m)return new g([w(r)]);if(Array.isArray(r))return new g(r.flatMap(t=>cd(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:0,data:r};if(r instanceof Int8Array)return new g([w(Object.assign(Object.assign({},t),{type:new ye}))]);if(r instanceof Int16Array)return new g([w(Object.assign(Object.assign({},t),{type:new ge}))]);if(r instanceof Int32Array)return new g([w(Object.assign(Object.assign({},t),{type:new pt}))]);if(r instanceof BigInt64Array)return new g([w(Object.assign(Object.assign({},t),{type:new be}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new g([w(Object.assign(Object.assign({},t),{type:new we}))]);if(r instanceof Uint16Array)return new g([w(Object.assign(Object.assign({},t),{type:new _e}))]);if(r instanceof Uint32Array)return new g([w(Object.assign(Object.assign({},t),{type:new ve}))]);if(r instanceof BigUint64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Ze}))]);if(r instanceof Float32Array)return new g([w(Object.assign(Object.assign({},t),{type:new Xt}))]);if(r instanceof Float64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Qt}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function cd(r){return r instanceof R?[r]:r instanceof g?r.data:Or(r).data}function tu(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 ff=Object.create;var Jn=Object.defineProperty;var hf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var pf=Object.getPrototypeOf,mf=Object.prototype.hasOwnProperty;var yf=(r,t,e)=>t in r?Jn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var gf=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),xr=(r,t)=>{for(var e in t)Jn(r,e,{get:t[e],enumerable:!0})},ts=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of df(t))!mf.call(r,i)&&i!==e&&Jn(r,i,{get:()=>t[i],enumerable:!(n=hf(t,i))||n.enumerable});return r},es=(r,t,e)=>(ts(r,t,"default"),e&&ts(e,t,"default")),bf=(r,t,e)=>(e=r!=null?ff(pf(r)):{},ts(t||!r||!r.__esModule?Jn(e,"default",{value:r,enumerable:!0}):e,r)),wf=r=>ts(Jn({},"__esModule",{value:!0}),r);var rs=(r,t,e)=>(yf(r,typeof t!="symbol"?t+"":t,e),e);var vc=gf((Sm,_c)=>{_c.exports=globalThis.loaders});var qi={};xr(qi,{ArrowLoader:()=>Mu,ArrowWorkerLoader:()=>Wi,ArrowWriter:()=>Lu,GeoArrowLoader:()=>ju,GeoArrowWorkerLoader:()=>sc,TriangulationWorker:()=>Zo,VECTOR_TYPES:()=>fn,convertArrowToGeoJSONTable:()=>jo,deserializeArrowField:()=>dn,deserializeArrowMetadata:()=>Uo,deserializeArrowSchema:()=>Fu,deserializeArrowType:()=>Xa,getArrowType:()=>Ou,getBinaryGeometriesFromArrow:()=>zu,getBinaryGeometryTemplate:()=>Zi,getMeanCentersFromBinaryGeometries:()=>oc,getTriangleIndices:()=>ac,hardClone:()=>Ji,parseGeoArrowOnWorker:()=>uf,parseGeometryFromArrow:()=>zo,serializeArrowField:()=>hn,serializeArrowMetadata:()=>No,serializeArrowSchema:()=>Gn,serializeArrowType:()=>Ja,triangulateOnWorker:()=>lf,updateBoundsFromGeoArrowSamples:()=>Wo});es(qi,bf(vc(),1));function ns(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function Ic(r){let t=_f(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=ns(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function _f(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 xc(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}var is=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(t,e){if(this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function Sc(r,t){if(!r)throw new Error("null row");let e={};if(t)for(let n=0;n<t.length;n++)e[t[n]]=r[n];else for(let n=0;n<r.length;n++){let i=`column-${n}`;e[i]=r[n]}return e}function Bc(r,t){if(!r)throw new Error("null row");if(t){let e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=r[t[n]];return e}return Object.values(r)}function Ac(r){let t=[];for(let e=0;e<r.length;e++){let n=`column-${e}`;t.push(n)}return t}function Tc(r){return Object.keys(r)}var Dc=100,ss=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(t,e){if(this.options=e,this.schema=t,t){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=Ac(t),this.options.shape){case"object-row-table":let n=Sc(t,this._headers);this.addObjectRow(n,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Dc),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=Tc(t),this.options.shape){case"array-row-table":let n=Bc(t,this._headers);this.addArrayRow(n,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Dc),this.objectRows[this.length]=t,this.length++;break}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var Er=class{schema;length=0;allocated=0;columns={};constructor(t,e){this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(let n in this.columns)this.columns[n][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(let e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();let t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let n in this.schema){let i=this.schema[n];t[i.name]=this.columns[i.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let t in this.schema){let e=this.schema[t],n=e.type||Float32Array,i=this.columns[e.index];if(i&&ArrayBuffer.isView(i)){let s=new n(this.allocated);s.set(i),this.columns[e.index]=s}else i?(i.length=this.allocated,this.columns[e.index]=i):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(let[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}};var vf={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},If="TableBatchBuilder",os=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(t,e){this.schema=t,this.options={...vf,...e}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),typeof t=="string"&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?t.length*8:Object.keys(t).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;t?.bytesUsed&&(this.bytesUsed=t.bytesUsed);let e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return ss;case"columnar-table":return Er;case"arrow-table":if(!os.ArrowBatch)throw new Error(If);return os.ArrowBatch;default:return is}}},gn=os;rs(gn,"ArrowBatch");function as(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 Oc(r,t,e){switch(r.shape){case"array-row-table":let n=xf(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 s=r.data,o=s.schema.fields.findIndex(a=>a.name===e);return s.getChildAt(o)?.get(t);default:throw new Error("todo")}}function xf(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Fc(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,u]of Object.entries(r.data))c[l]=u[t];return c}case"arrow-table":let i=r.data,s=e||{},o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[a.fields[c].name]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function Mc(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 u of Object.values(r.data))c[l]=u[t],l++;return c}case"arrow-table":let i=r.data,s=e||[],o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[c]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function Lc(r){switch(r.shape){case"array-row-table":case"object-row-table":return Bf(r.data);case"geojson-table":return Af(r.features);case"columnar-table":return Sf(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Sf(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Tf(n,e);t.push(i)}return{fields:t,metadata:{}}}function Bf(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(Nc(i,n));return{fields:t,metadata:{}}}function Af(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(Nc(i,n));return{fields:t,metadata:{}}}function Tf(r,t){if(ArrayBuffer.isView(r)){let e=Ic(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=ns(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Nc(r,t){let e=ns(r);return{name:t,type:e,nullable:!0}}function Uc(r,t){let e=xc(r.type,r.nullable);return new e(t)}function cs(r,t){switch(t){case"object-row-table":return Mf(r);case"array-row-table":return Ff(r);case"columnar-table":return Of(r);case"arrow-table":return Df(r);default:throw new Error(t)}}function Df(r){let t=globalThis.__loaders?._makeArrowTable;if(!t)throw new Error("");return t(r)}function Of(r){let t=r.schema||Lc(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=as(r),i={};for(let s of e){let o=Uc(s,n);i[s.name]=o;for(let a=0;a<n;a++)o[a]=Oc(r,a,s.name)}return{shape:"columnar-table",schema:t,data:i}}function Ff(r){if(r.shape==="array-row-table")return r;let t=as(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Mc(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Mf(r){if(r.shape==="object-row-table")return r;let t=as(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Fc(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Rc(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 y(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(n.next(u))}catch(h){o(h)}}function c(u){try{l(n.throw(u))}catch(h){o(h)}}function l(u){u.done?s(u.value):i(u.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Ec(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 U(r){return this instanceof U?(this.v=r,this):new U(r)}function oe(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){n[d]&&(i[d]=function(b){return new Promise(function(M,z){s.push([d,b,M,z])>1||a(d,b)})})}function a(d,b){try{c(n[d](b))}catch(M){h(s[0][3],M)}}function c(d){d.value instanceof U?Promise.resolve(d.value.v).then(l,u):h(s[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function h(d,b){d(b),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bn(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,s){t[i]=r[i]?function(o){return(e=!e)?{value:U(r[i](o)),done:!1}:s?s(o):o}:s}}function Te(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 Ec=="function"?Ec(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var ea={};xr(ea,{compareArrayLike:()=>ta,joinUint8Arrays:()=>ce,memcpy:()=>qn,rebaseValueOffsets:()=>ys,toArrayBufferView:()=>C,toArrayBufferViewAsyncIterator:()=>Oe,toArrayBufferViewIterator:()=>ke,toBigInt64Array:()=>ms,toBigUint64Array:()=>Vf,toFloat32Array:()=>jf,toFloat32ArrayAsyncIterator:()=>nh,toFloat32ArrayIterator:()=>Zf,toFloat64Array:()=>zf,toFloat64ArrayAsyncIterator:()=>ih,toFloat64ArrayIterator:()=>Jf,toInt16Array:()=>Cf,toInt16ArrayAsyncIterator:()=>qf,toInt16ArrayIterator:()=>$f,toInt32Array:()=>Rr,toInt32ArrayAsyncIterator:()=>th,toInt32ArrayIterator:()=>Hf,toInt8Array:()=>Rf,toInt8ArrayAsyncIterator:()=>Qf,toInt8ArrayIterator:()=>Gf,toUint16Array:()=>Pf,toUint16ArrayAsyncIterator:()=>eh,toUint16ArrayIterator:()=>Yf,toUint32Array:()=>kf,toUint32ArrayAsyncIterator:()=>rh,toUint32ArrayIterator:()=>Kf,toUint8Array:()=>T,toUint8ArrayAsyncIterator:()=>qo,toUint8ArrayIterator:()=>Qo,toUint8ClampedArray:()=>Wf,toUint8ClampedArrayAsyncIterator:()=>sh,toUint8ClampedArrayIterator:()=>Xf});var Lf=new TextDecoder("utf-8"),Xn=r=>Lf.decode(r),Nf=new TextEncoder,Pe=r=>Nf.encode(r);var Uf=r=>typeof r=="number",Cc=r=>typeof r=="boolean",wt=r=>typeof r=="function",Rt=r=>r!=null&&Object(r)===r,ae=r=>Rt(r)&&wt(r.then);var De=r=>Rt(r)&&wt(r[Symbol.iterator]),de=r=>Rt(r)&&wt(r[Symbol.asyncIterator]),ls=r=>Rt(r)&&Rt(r.schema);var us=r=>Rt(r)&&"done"in r&&"value"in r;var fs=r=>Rt(r)&&wt(r.stat)&&Uf(r.fd);var hs=r=>Rt(r)&&Qn(r.body),ds=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Pc=r=>Rt(r)&&wt(r.abort)&&wt(r.getWriter)&&!ds(r),Qn=r=>Rt(r)&&wt(r.cancel)&&wt(r.getReader)&&!ds(r),kc=r=>Rt(r)&&wt(r.end)&&wt(r.write)&&Cc(r.writable)&&!ds(r),ps=r=>Rt(r)&&wt(r.read)&&wt(r.pipe)&&Cc(r.readable)&&!ds(r),Vc=r=>Rt(r)&&wt(r.clear)&&wt(r.bytes)&&wt(r.position)&&wt(r.setPosition)&&wt(r.capacity)&&wt(r.getBufferIdentifier)&&wt(r.createLong);var Xo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ef(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,n-e+s)}return t}function qn(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function ce(r,t){let e=Ef(r),n=e.reduce((u,h)=>u+h.byteLength,0),i,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=e.length;++c<u;){if(i=e[c],s=i.subarray(0,Math.min(i.length,l-a)),l<=a+s.length){s.length<i.length?e[c]=i.subarray(s.length):s.length===i.length&&c++,o?qn(o,s,a):o=s;break}qn(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function C(r,t){let e=us(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Pe(e)),e instanceof ArrayBuffer?new r(e):e instanceof Xo?new r(e):Vc(e)?C(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 Rf=r=>C(Int8Array,r),Cf=r=>C(Int16Array,r),Rr=r=>C(Int32Array,r),ms=r=>C(BigInt64Array,r),T=r=>C(Uint8Array,r),Pf=r=>C(Uint16Array,r),kf=r=>C(Uint32Array,r),Vf=r=>C(BigUint64Array,r),jf=r=>C(Float32Array,r),zf=r=>C(Float64Array,r),Wf=r=>C(Uint8ClampedArray,r),Jo=r=>(r.next(),r);function*ke(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xo?e(t):De(t)?t:e(t);return yield*Jo(function*(i){let s=null;do s=i.next(yield C(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var Gf=r=>ke(Int8Array,r),$f=r=>ke(Int16Array,r),Hf=r=>ke(Int32Array,r),Qo=r=>ke(Uint8Array,r),Yf=r=>ke(Uint16Array,r),Kf=r=>ke(Uint32Array,r),Zf=r=>ke(Float32Array,r),Jf=r=>ke(Float64Array,r),Xf=r=>ke(Uint8ClampedArray,r);function Oe(r,t){return oe(this,arguments,function*(){if(ae(t))return yield U(yield U(yield*bn(Te(Oe(r,yield U(t))))));let n=function(o){return oe(this,arguments,function*(){yield yield U(yield U(o))})},i=function(o){return oe(this,arguments,function*(){yield U(yield*bn(Te(Jo(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xo?n(t):De(t)?i(t):de(t)?t:n(t);return yield U(yield*bn(Te(Jo(function(o){return oe(this,arguments,function*(){let a=null;do a=yield U(o.next(yield yield U(C(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield U(new r)})}var Qf=r=>Oe(Int8Array,r),qf=r=>Oe(Int16Array,r),th=r=>Oe(Int32Array,r),qo=r=>Oe(Uint8Array,r),eh=r=>Oe(Uint16Array,r),rh=r=>Oe(Uint32Array,r),nh=r=>Oe(Float32Array,r),ih=r=>Oe(Float64Array,r),sh=r=>Oe(Uint8ClampedArray,r);function ys(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 ta(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 gs(oh(r))},fromAsyncIterable(r){return gs(ah(r))},fromDOMStream(r){return gs(ch(r))},fromNodeStream(r){return gs(lh(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')}},gs=r=>(r.next(),r);function*oh(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?ce(n,o)[0]:([i,n,a]=ce(n,o),i)}({cmd:s,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Qo(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function ah(r){return oe(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=qo(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.next()):yield U(u.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&typeof u.throw=="function"&&(yield U(u.throw(h)))}finally{n===!1&&typeof u.return=="function"&&(yield U(u.return(new Uint8Array(0))))}return yield U(null)})}function ch(r){return oe(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=new na(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.read()):yield U(u.read(a-c)),!e&&s.byteLength>0&&(i.push(T(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&(yield U(u.cancel(h)))}finally{n===!1?yield U(u.cancel()):r.locked&&u.releaseLock()}return yield U(null)})}var na=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 y(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 y(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=T(e)),e})}},ra=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function lh(r){return oe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,l=[],u;function h(){return o==="peek"?ce(l,a)[0]:([u,l,c]=ce(l,a),u)}if({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield U(new Uint8Array(0)),yield U(null);try{e[0]=ra(r,"end"),e[1]=ra(r,"error");do{if(e[2]=ra(r,"readable"),[n,s]=yield U(Promise.race(e.map(b=>b[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=T(r.read(a-c)),u.byteLength<a-c&&(u=T(r.read()))):u=T(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield U(h()));while(a<c)}while(!i)}finally{yield U(d(e,n==="error"?s:null))}return yield U(null);function d(b,M){return u=l=null,new Promise((z,X)=>{for(let[st,yn]of b)r.off(st,yn);try{let st=r.destroy;st&&st.call(r,M),M=void 0}catch(st){M=st||M}finally{M!=null?X(M):z()}})}})}var $;(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"})($||($={}));var K;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(K||(K={}));var j;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(j||(j={}));var et;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(et||(et={}));var p;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(p||(p={}));var nt;(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"})(nt||(nt={}));var Ve=new Int32Array(2),bs=new Float32Array(Ve.buffer),ws=new Float64Array(Ve.buffer),wn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ti;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(ti||(ti={}));var Ct=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ct(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 Ve[0]=this.readInt32(t),bs[0]}readFloat64(t){return Ve[wn?0:1]=this.readInt32(t),Ve[wn?1:0]=this.readInt32(t+4),ws[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){bs[0]=e,this.writeInt32(t,Ve[0])}writeFloat64(t,e){ws[0]=e,this.writeInt32(t,Ve[wn?0:1]),this.writeInt32(t+4,Ve[wn?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===ti.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 s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var ar=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=Ct.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=ar.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=Ct.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=2;l<s;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(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;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);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return 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 ei;(function(r){r[r.BUFFER=0]="BUFFER"})(ei||(ei={}));var ri;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ri||(ri={}));var Me=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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new Me).__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):ri.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ei.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ri.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ei.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Me.startBodyCompression(t),Me.addCodec(t,e),Me.addMethod(t,n),Me.endBodyCompression(t)}};var _n=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 vn=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 Ft=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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Ft).__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 vn).__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 _n).__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 Me).__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 me=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 me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new me).__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 Ft).__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 Sr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Sr||(Sr={}));var ni;(function(r){r[r.DenseArray=0]="DenseArray"})(ni||(ni={}));var _t=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 _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new _t).__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 _t.startInt(t),_t.addBitWidth(t,e),_t.addIsSigned(t,n),_t.endInt(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 getRootAsDictionaryEncoding(t,e){return(e||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new le).__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 _t).__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):ni.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,ni.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Q=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 Q).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new Q).__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 Q.startKeyValue(t),Q.addKey(t,e),Q.addValue(t,n),Q.endKeyValue(t)}};var je=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 je).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new je).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return je.startBinary(t),je.endBinary(t)}};var ze=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 ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new ze).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return ze.startBool(t),ze.endBool(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 getRootAsDate(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new Gt).__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):et.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,et.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Gt.startDate(t),Gt.addUnit(t,e),Gt.endDate(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 getRootAsDecimal(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new vt).__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 vt.startDecimal(t),vt.addPrecision(t,e),vt.addScale(t,n),vt.addBitWidth(t,i),vt.endDecimal(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 getRootAsDuration(t,e){return(e||new $t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new $t).__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):p.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,p.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return $t.startDuration(t),$t.addUnit(t,e),$t.endDuration(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 getRootAsFixedSizeBinary(t,e){return(e||new Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Ht).__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 Ht.startFixedSizeBinary(t),Ht.addByteWidth(t,e),Ht.endFixedSizeBinary(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 getRootAsFixedSizeList(t,e){return(e||new Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new Yt).__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 Yt.startFixedSizeList(t),Yt.addListSize(t,e),Yt.endFixedSizeList(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 getRootAsFloatingPoint(t,e){return(e||new Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new Kt).__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):j.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,j.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Kt.startFloatingPoint(t),Kt.addPrecision(t,e),Kt.endFloatingPoint(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 getRootAsInterval(t,e){return(e||new Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(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):nt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,nt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Zt.startInterval(t),Zt.addUnit(t,e),Zt.endInterval(t)}};var We=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 We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new We).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return We.startLargeBinary(t),We.endLargeBinary(t)}};var Ge=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 Ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ge).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Ge.startLargeUtf8(t),Ge.endLargeUtf8(t)}};var $e=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 $e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new $e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return $e.startList(t),$e.endList(t)}};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 He=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 He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new He).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return He.startNull(t),He.endNull(t)}};var Ye=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 Ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ye).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ye.startStruct_(t),Ye.endStruct_(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 getRootAsTime(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new Mt).__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):p.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,p.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return Mt.startTime(t),Mt.addUnit(t,e),Mt.addBitWidth(t,n),Mt.endTime(t)}};var Lt=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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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):p.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,p.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Lt.startTimestamp(t),Lt.addUnit(t,e),Lt.addTimezone(t,n),Lt.endTimestamp(t)}};var It=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 It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new It).__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):K.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,K.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 It.startUnion(t),It.addMode(t,e),It.addTypeIds(t,n),It.endUnion(t)}};var Ke=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 Ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ke).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ke.startUtf8(t),Ke.endUtf8(t)}};var Z;(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"})(Z||(Z={}));var dt=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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new dt).__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):Z.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 le).__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 dt).__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 Q).__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,Z.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 ot=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 ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new ot).__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):Sr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dt).__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 Q).__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,Sr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return ot.startSchema(t),ot.addEndianness(t,e),ot.addFields(t,n),ot.addCustomMetadata(t,i),ot.addFeatures(t,s),ot.endSchema(t)}};var P;(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"})(P||(P={}));var f;(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"})(f||(f={}));var lt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(lt||(lt={}));var Ia={};xr(Ia,{clampIndex:()=>Jh,clampRange:()=>oi,createElementComparator:()=>Dr});var ia={};xr(ia,{valueToString:()=>Le});function Le(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=>Le(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var oa={};xr(oa,{BN:()=>Cr,bigNumToBigInt:()=>Wc,bigNumToString:()=>Sn,isArrowBigNumSymbol:()=>jc});var jc=Symbol.for("isArrowBigNum");function Ne(r,...t){return t.length===0?Object.setPrototypeOf(C(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ne.prototype[jc]=!0;Ne.prototype.toJSON=function(){return`"${Sn(this)}"`};Ne.prototype.valueOf=function(){return zc(this)};Ne.prototype.toString=function(){return Sn(this)};Ne.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return zc(this);case"string":return Sn(this);case"default":return Wc(this)}return Sn(this)};function In(...r){return Ne.apply(this,r)}function xn(...r){return Ne.apply(this,r)}function ii(...r){return Ne.apply(this,r)}Object.setPrototypeOf(In.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(xn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ii.prototype,Object.create(Uint32Array.prototype));Object.assign(In.prototype,Ne.prototype,{constructor:In,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(xn.prototype,Ne.prototype,{constructor:xn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ii.prototype,Ne.prototype,{constructor:ii,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function zc(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new BigUint64Array(t,e,n),o=i&&s.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),c=BigInt(0);if(o){for(let l of s)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of s)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var Sn=r=>{if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return sa(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return sa(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}return`-${sa(t)}`},Wc=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Sn(r);function sa(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Cr=class{static new(t,e){switch(e){case!0:return new In(t);case!1:return new xn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new In(t)}return t.byteLength===16?new ii(t):new xn(t)}static signed(t){return new In(t)}static unsigned(t){return new xn(t)}static decimal(t){return new ii(t)}constructor(t,e){return Cr.new(t,e)}};function at(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)}var Gc,$c,Hc,Yc,Kc,Zc,Jc,Xc,Qc,qc,tl,el,rl,nl,il,sl,ol,al,cl,ll,ul,fl,m=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return m.isUnion(t)&&t.mode===K.Dense}static isSparseUnion(t){return m.isUnion(t)&&t.mode===K.Sparse}constructor(t){this.typeId=t}};Gc=Symbol.toStringTag;m[Gc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(m.prototype);var ut=class extends m{constructor(){super(f.Null)}toString(){return"Null"}};$c=Symbol.toStringTag;ut[$c]=(r=>r[Symbol.toStringTag]="Null")(ut.prototype);var it=class extends m{constructor(t,e){super(f.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}`}};Hc=Symbol.toStringTag;it[Hc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(it.prototype);var ye=class extends it{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ge=class extends it{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},pt=class extends it{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},be=class extends it{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},we=class extends it{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},_e=class extends it{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ve=class extends it{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ze=class extends it{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ye.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ge.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(pt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(be.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(we.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(_e.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ze.prototype,"ArrayType",{value:BigUint64Array});var At=class extends m{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case j.HALF:return Uint16Array;case j.SINGLE:return Float32Array;case j.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Yc=Symbol.toStringTag;At[Yc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(At.prototype);var Br=class extends At{constructor(){super(j.HALF)}},Xt=class extends At{constructor(){super(j.SINGLE)}},Qt=class extends At{constructor(){super(j.DOUBLE)}};Object.defineProperty(Br.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Xt.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qt.prototype,"ArrayType",{value:Float64Array});var ue=class extends m{constructor(){super(f.Binary)}toString(){return"Binary"}};Kc=Symbol.toStringTag;ue[Kc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ue.prototype);var Je=class extends m{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Zc=Symbol.toStringTag;Je[Zc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Je.prototype);var Pt=class extends m{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Jc=Symbol.toStringTag;Pt[Jc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Pt.prototype);var Xe=class extends m{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Xc=Symbol.toStringTag;Xe[Xc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Xe.prototype);var kt=class extends m{constructor(){super(f.Bool)}toString(){return"Bool"}};Qc=Symbol.toStringTag;kt[Qc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(kt.prototype);var fe=class extends m{constructor(t,e,n=128){super(f.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};qc=Symbol.toStringTag;fe[qc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(fe.prototype);var qt=class extends m{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${et[this.unit]}>`}};tl=Symbol.toStringTag;qt[tl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(qt.prototype);var Pr=class extends qt{constructor(){super(et.DAY)}},cr=class extends qt{constructor(){super(et.MILLISECOND)}},xt=class extends m{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${p[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};el=Symbol.toStringTag;xt[el]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(xt.prototype);var kr=class extends xt{constructor(){super(p.SECOND,32)}},Vr=class extends xt{constructor(){super(p.MILLISECOND,32)}},jr=class extends xt{constructor(){super(p.MICROSECOND,64)}},zr=class extends xt{constructor(){super(p.NANOSECOND,64)}},Nt=class extends m{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${p[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};rl=Symbol.toStringTag;Nt[rl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Nt.prototype);var Wr=class extends Nt{constructor(t){super(p.SECOND,t)}},Gr=class extends Nt{constructor(t){super(p.MILLISECOND,t)}},$r=class extends Nt{constructor(t){super(p.MICROSECOND,t)}},Hr=class extends Nt{constructor(t){super(p.NANOSECOND,t)}},te=class extends m{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${nt[this.unit]}>`}};nl=Symbol.toStringTag;te[nl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(te.prototype);var Yr=class extends te{constructor(){super(nt.DAY_TIME)}},Kr=class extends te{constructor(){super(nt.YEAR_MONTH)}},Qe=class extends m{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${p[this.unit]}>`}};il=Symbol.toStringTag;Qe[il]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Qe.prototype);var Tt=class extends m{constructor(t){super(f.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}};sl=Symbol.toStringTag;Tt[sl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Tt.prototype);var V=class extends m{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ol=Symbol.toStringTag;V[ol]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(V.prototype);var Ie=class extends m{constructor(t,e,n){super(f.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};al=Symbol.toStringTag;Ie[al]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ie.prototype);var qe=class extends m{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};cl=Symbol.toStringTag;qe[cl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(qe.prototype);var Vt=class extends m{constructor(t,e){super(f.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}>`}};ll=Symbol.toStringTag;Vt[ll]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Vt.prototype);var jt=class extends m{constructor(t,e=!1){var n,i,s;if(super(f.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");let a=(s=t?.type)===null||s===void 0?void 0:s.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(", ")}}>`}};ul=Symbol.toStringTag;jt[ul]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(jt.prototype);var uh=(r=>()=>++r)(-1),Ut=class extends m{constructor(t,e,n,i){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?uh():at(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}>`}};fl=Symbol.toStringTag;Ut[fl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ut.prototype);function he(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Timestamp:return 2;case f.Date:return 1+t.unit;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var v=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return fh(this,t,e)}getVisitFnByTypeId(t,e=!0){return Bn(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 fh(r,t,e=!0){return typeof t=="number"?Bn(r,t,e):typeof t=="string"&&t in f?Bn(r,f[t],e):t&&t instanceof m?Bn(r,dl(t),e):t?.type&&t.type instanceof m?Bn(r,dl(t.type),e):Bn(r,f.NONE,e)}function Bn(r,t,e=!0){let n=null;switch(t){case f.Null:n=r.visitNull;break;case f.Bool:n=r.visitBool;break;case f.Int:n=r.visitInt;break;case f.Int8:n=r.visitInt8||r.visitInt;break;case f.Int16:n=r.visitInt16||r.visitInt;break;case f.Int32:n=r.visitInt32||r.visitInt;break;case f.Int64:n=r.visitInt64||r.visitInt;break;case f.Uint8:n=r.visitUint8||r.visitInt;break;case f.Uint16:n=r.visitUint16||r.visitInt;break;case f.Uint32:n=r.visitUint32||r.visitInt;break;case f.Uint64:n=r.visitUint64||r.visitInt;break;case f.Float:n=r.visitFloat;break;case f.Float16:n=r.visitFloat16||r.visitFloat;break;case f.Float32:n=r.visitFloat32||r.visitFloat;break;case f.Float64:n=r.visitFloat64||r.visitFloat;break;case f.Utf8:n=r.visitUtf8;break;case f.LargeUtf8:n=r.visitLargeUtf8;break;case f.Binary:n=r.visitBinary;break;case f.LargeBinary:n=r.visitLargeBinary;break;case f.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case f.Date:n=r.visitDate;break;case f.DateDay:n=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:n=r.visitTimestamp;break;case f.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:n=r.visitTime;break;case f.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:n=r.visitDecimal;break;case f.List:n=r.visitList;break;case f.Struct:n=r.visitStruct;break;case f.Union:n=r.visitUnion;break;case f.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:n=r.visitDictionary;break;case f.Interval:n=r.visitInterval;break;case f.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case f.Duration:n=r.visitDuration;break;case f.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case f.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case f.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case f.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case f.FixedSizeList:n=r.visitFixedSizeList;break;case f.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function dl(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case j.HALF:return f.Float16;case j.SINGLE:return f.Float32;case j.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case p.SECOND:return f.TimeSecond;case p.MILLISECOND:return f.TimeMillisecond;case p.MICROSECOND:return f.TimeMicrosecond;case p.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case p.SECOND:return f.TimestampSecond;case p.MILLISECOND:return f.TimestampMillisecond;case p.MICROSECOND:return f.TimestampMicrosecond;case p.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case et.DAY:return f.DateDay;case et.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case nt.DAY_TIME:return f.IntervalDayTime;case nt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case p.SECOND:return f.DurationSecond;case p.MILLISECOND:return f.DurationMillisecond;case p.MICROSECOND:return f.DurationMicrosecond;case p.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case K.Dense:return f.DenseUnion;case K.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}v.prototype.visitInt8=null;v.prototype.visitInt16=null;v.prototype.visitInt32=null;v.prototype.visitInt64=null;v.prototype.visitUint8=null;v.prototype.visitUint16=null;v.prototype.visitUint32=null;v.prototype.visitUint64=null;v.prototype.visitFloat16=null;v.prototype.visitFloat32=null;v.prototype.visitFloat64=null;v.prototype.visitDateDay=null;v.prototype.visitDateMillisecond=null;v.prototype.visitTimestampSecond=null;v.prototype.visitTimestampMillisecond=null;v.prototype.visitTimestampMicrosecond=null;v.prototype.visitTimestampNanosecond=null;v.prototype.visitTimeSecond=null;v.prototype.visitTimeMillisecond=null;v.prototype.visitTimeMicrosecond=null;v.prototype.visitTimeNanosecond=null;v.prototype.visitDenseUnion=null;v.prototype.visitSparseUnion=null;v.prototype.visitIntervalDayTime=null;v.prototype.visitIntervalYearMonth=null;v.prototype.visitDuration=null;v.prototype.visitDurationSecond=null;v.prototype.visitDurationMillisecond=null;v.prototype.visitDurationMicrosecond=null;v.prototype.visitDurationNanosecond=null;var aa={};xr(aa,{float64ToUint16:()=>si,uint16ToFloat64:()=>vs});var pl=new Float64Array(1),An=new Uint32Array(pl.buffer);function vs(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 si(r){if(r!==r)return 32256;pl[0]=r;let t=(An[1]&2147483648)>>16&65535,e=An[1]&2146435072,n=0;return e>=1089470464?An[0]>0?e=31744:(e=(e&2080374784)>>16,n=(An[1]&1048575)>>10):e<=1056964608?(n=1048576+(An[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(An[1]&1048575)+512>>10),t|e|n&65535}var A=class extends v{};function L(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var hh=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},ca=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},dh=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},ph=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},ml=(r,t,e,n)=>{if(e+1<t.length){let i=at(t[e]),s=at(t[e+1]);r.set(n.subarray(0,s-i),i)}},mh=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},lr=({values:r},t,e)=>{r[t]=e},la=({values:r},t,e)=>{r[t]=e},yl=({values:r},t,e)=>{r[t]=si(e)},yh=(r,t,e)=>{switch(r.type.precision){case j.HALF:return yl(r,t,e);case j.SINGLE:case j.DOUBLE:return la(r,t,e)}},Is=({values:r},t,e)=>{hh(r,t,e.valueOf())},xs=({values:r},t,e)=>{ca(r,t*2,e.valueOf())},ua=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},gl=({values:r,valueOffsets:t},e,n)=>ml(r,t,e,n),bl=({values:r,valueOffsets:t},e,n)=>ml(r,t,e,Pe(n)),fa=(r,t,e)=>{r.type.unit===et.DAY?Is(r,t,e):xs(r,t,e)},Ss=({values:r},t,e)=>ca(r,t*2,e/1e3),Bs=({values:r},t,e)=>ca(r,t*2,e),As=({values:r},t,e)=>dh(r,t*2,e),Ts=({values:r},t,e)=>ph(r,t*2,e),ha=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ss(r,t,e);case p.MILLISECOND:return Bs(r,t,e);case p.MICROSECOND:return As(r,t,e);case p.NANOSECOND:return Ts(r,t,e)}},Ds=({values:r},t,e)=>{r[t]=e},Os=({values:r},t,e)=>{r[t]=e},Fs=({values:r},t,e)=>{r[t]=e},Ms=({values:r},t,e)=>{r[t]=e},da=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ds(r,t,e);case p.MILLISECOND:return Os(r,t,e);case p.MICROSECOND:return Fs(r,t,e);case p.NANOSECOND:return Ms(r,t,e)}},pa=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},gh=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Dt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e.get(++o))},bh=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Dt.getVisitFn(n),{[t]:o,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(s(n,o,l),++o>=a)break},wh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),_h=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),vh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Ih=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),xh=(r,t,e)=>{let n=r.type.children.map(s=>Dt.getVisitFn(s.type)),i=e instanceof Map?vh(t,e):e instanceof g?_h(t,e):Array.isArray(e)?wh(t,e):Ih(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Sh=(r,t,e)=>{r.type.mode===K.Dense?wl(r,t,e):_l(r,t,e)},wl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,r.valueOffsets[t],e)},_l=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,t,e)},Bh=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},ma=(r,t,e)=>{r.type.unit===nt.DAY_TIME?Ls(r,t,e):Ns(r,t,e)},Ls=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Ns=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Us=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},Rs=({values:r},t,e)=>{r[t]=e},Cs=({values:r},t,e)=>{r[t]=e},ya=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Us(r,t,e);case p.MILLISECOND:return Es(r,t,e);case p.MICROSECOND:return Rs(r,t,e);case p.NANOSECOND:return Cs(r,t,e)}},Ah=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Dt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};A.prototype.visitBool=L(mh);A.prototype.visitInt=L(lr);A.prototype.visitInt8=L(lr);A.prototype.visitInt16=L(lr);A.prototype.visitInt32=L(lr);A.prototype.visitInt64=L(lr);A.prototype.visitUint8=L(lr);A.prototype.visitUint16=L(lr);A.prototype.visitUint32=L(lr);A.prototype.visitUint64=L(lr);A.prototype.visitFloat=L(yh);A.prototype.visitFloat16=L(yl);A.prototype.visitFloat32=L(la);A.prototype.visitFloat64=L(la);A.prototype.visitUtf8=L(bl);A.prototype.visitLargeUtf8=L(bl);A.prototype.visitBinary=L(gl);A.prototype.visitLargeBinary=L(gl);A.prototype.visitFixedSizeBinary=L(ua);A.prototype.visitDate=L(fa);A.prototype.visitDateDay=L(Is);A.prototype.visitDateMillisecond=L(xs);A.prototype.visitTimestamp=L(ha);A.prototype.visitTimestampSecond=L(Ss);A.prototype.visitTimestampMillisecond=L(Bs);A.prototype.visitTimestampMicrosecond=L(As);A.prototype.visitTimestampNanosecond=L(Ts);A.prototype.visitTime=L(da);A.prototype.visitTimeSecond=L(Ds);A.prototype.visitTimeMillisecond=L(Os);A.prototype.visitTimeMicrosecond=L(Fs);A.prototype.visitTimeNanosecond=L(Ms);A.prototype.visitDecimal=L(pa);A.prototype.visitList=L(gh);A.prototype.visitStruct=L(xh);A.prototype.visitUnion=L(Sh);A.prototype.visitDenseUnion=L(wl);A.prototype.visitSparseUnion=L(_l);A.prototype.visitDictionary=L(Bh);A.prototype.visitInterval=L(ma);A.prototype.visitIntervalDayTime=L(Ls);A.prototype.visitIntervalYearMonth=L(Ns);A.prototype.visitDuration=L(ya);A.prototype.visitDurationSecond=L(Us);A.prototype.visitDurationMillisecond=L(Es);A.prototype.visitDurationMicrosecond=L(Rs);A.prototype.visitDurationNanosecond=L(Cs);A.prototype.visitFixedSizeList=L(Ah);A.prototype.visitMap=L(bh);var Dt=new A;var Ue=Symbol.for("parent"),Tn=Symbol.for("rowIndex"),Ar=class{constructor(t,e){return this[Ue]=t,this[Tn]=e,new Proxy(this,new ba)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Tn],e=this[Ue],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=mt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ga(this[Ue],this[Tn])}},ga=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,mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ue]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Tn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ba=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ue].type.children.map(e=>e.name)}has(t,e){return t[Ue].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ue].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[Ue].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=mt.visit(t[Ue].children[n],t[Tn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ue].type.children.findIndex(s=>s.name===e);return i!==-1?(Dt.visit(t[Ue].children[i],t[Tn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var I=class extends v{};function O(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Th=(r,t)=>864e5*r[t],wa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Dh=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Oh=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,vl=r=>new Date(r),Fh=(r,t)=>vl(Th(r,t)),Mh=(r,t)=>vl(wa(r,t)),Lh=(r,t)=>null,Il=(r,t,e)=>{if(e+1>=t.length)return null;let n=at(t[e]),i=at(t[e+1]);return r.subarray(n,i)},Nh=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},xl=({values:r},t)=>Fh(r,t),Sl=({values:r},t)=>Mh(r,t*2),Tr=({stride:r,values:t},e)=>t[r*e],Uh=({stride:r,values:t},e)=>vs(t[r*e]),Bl=({values:r},t)=>r[t],Eh=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Al=({values:r,valueOffsets:t},e)=>Il(r,t,e),Tl=({values:r,valueOffsets:t},e)=>{let n=Il(r,t,e);return n!==null?Xn(n):null},Rh=({values:r},t)=>r[t],Ch=({type:r,values:t},e)=>r.precision!==j.HALF?t[e]:vs(t[e]),Ph=(r,t)=>r.type.unit===et.DAY?xl(r,t):Sl(r,t),Dl=({values:r},t)=>1e3*wa(r,t*2),Ol=({values:r},t)=>wa(r,t*2),Fl=({values:r},t)=>Dh(r,t*2),Ml=({values:r},t)=>Oh(r,t*2),kh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Dl(r,t);case p.MILLISECOND:return Ol(r,t);case p.MICROSECOND:return Fl(r,t);case p.NANOSECOND:return Ml(r,t)}},Ll=({values:r},t)=>r[t],Nl=({values:r},t)=>r[t],Ul=({values:r},t)=>r[t],El=({values:r},t)=>r[t],Vh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Ll(r,t);case p.MILLISECOND:return Nl(r,t);case p.MICROSECOND:return Ul(r,t);case p.NANOSECOND:return El(r,t)}},jh=({values:r,stride:t},e)=>Cr.decimal(r.subarray(t*e,t*(e+1))),zh=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,c=i[0].slice(s,o-s);return new g([c])},Wh=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new tr(o.slice(i,s-i))},Gh=(r,t)=>new Ar(r,t),$h=(r,t)=>r.type.mode===K.Dense?Rl(r,t):Cl(r,t),Rl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,r.valueOffsets[t])},Cl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,t)},Hh=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Yh=(r,t)=>r.type.unit===nt.DAY_TIME?Pl(r,t):kl(r,t),Pl=({values:r},t)=>r.subarray(2*t,2*(t+1)),kl=({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},Vl=({values:r},t)=>r[t],jl=({values:r},t)=>r[t],zl=({values:r},t)=>r[t],Wl=({values:r},t)=>r[t],Kh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Vl(r,t);case p.MILLISECOND:return jl(r,t);case p.MICROSECOND:return zl(r,t);case p.NANOSECOND:return Wl(r,t)}},Zh=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new g([s])};I.prototype.visitNull=O(Lh);I.prototype.visitBool=O(Nh);I.prototype.visitInt=O(Rh);I.prototype.visitInt8=O(Tr);I.prototype.visitInt16=O(Tr);I.prototype.visitInt32=O(Tr);I.prototype.visitInt64=O(Bl);I.prototype.visitUint8=O(Tr);I.prototype.visitUint16=O(Tr);I.prototype.visitUint32=O(Tr);I.prototype.visitUint64=O(Bl);I.prototype.visitFloat=O(Ch);I.prototype.visitFloat16=O(Uh);I.prototype.visitFloat32=O(Tr);I.prototype.visitFloat64=O(Tr);I.prototype.visitUtf8=O(Tl);I.prototype.visitLargeUtf8=O(Tl);I.prototype.visitBinary=O(Al);I.prototype.visitLargeBinary=O(Al);I.prototype.visitFixedSizeBinary=O(Eh);I.prototype.visitDate=O(Ph);I.prototype.visitDateDay=O(xl);I.prototype.visitDateMillisecond=O(Sl);I.prototype.visitTimestamp=O(kh);I.prototype.visitTimestampSecond=O(Dl);I.prototype.visitTimestampMillisecond=O(Ol);I.prototype.visitTimestampMicrosecond=O(Fl);I.prototype.visitTimestampNanosecond=O(Ml);I.prototype.visitTime=O(Vh);I.prototype.visitTimeSecond=O(Ll);I.prototype.visitTimeMillisecond=O(Nl);I.prototype.visitTimeMicrosecond=O(Ul);I.prototype.visitTimeNanosecond=O(El);I.prototype.visitDecimal=O(jh);I.prototype.visitList=O(zh);I.prototype.visitStruct=O(Gh);I.prototype.visitUnion=O($h);I.prototype.visitDenseUnion=O(Rl);I.prototype.visitSparseUnion=O(Cl);I.prototype.visitDictionary=O(Hh);I.prototype.visitInterval=O(Yh);I.prototype.visitIntervalDayTime=O(Pl);I.prototype.visitIntervalYearMonth=O(kl);I.prototype.visitDuration=O(Kh);I.prototype.visitDurationSecond=O(Vl);I.prototype.visitDurationMillisecond=O(jl);I.prototype.visitDurationMicrosecond=O(zl);I.prototype.visitDurationNanosecond=O(Wl);I.prototype.visitFixedSizeList=O(Zh);I.prototype.visitMap=O(Wh);var mt=new I;var xe=Symbol.for("keys"),Dn=Symbol.for("vals"),tr=class{constructor(t){return this[xe]=new g([t.children[0]]).memoize(),this[Dn]=t.children[1],new Proxy(this,new va)}[Symbol.iterator](){return new _a(this[xe],this[Dn])}get size(){return this[xe].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[xe],e=this[Dn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=mt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},_a=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),mt.visit(this.vals,t)]})}},va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xe].toArray().map(String)}has(t,e){return t[xe].includes(e)}getOwnPropertyDescriptor(t,e){if(t[xe].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[xe].indexOf(e);if(n!==-1){let i=mt.visit(Reflect.get(t,Dn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[xe].indexOf(e);return i!==-1?(Dt.visit(Reflect.get(t,Dn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(tr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Dn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Jh(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var Gl;function oi(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(Gl=s,s=o,o=Gl),o>i&&(o=i),n?n(r,s,o):[s,o]}var $l=r=>r!==r;function Dr(r){if(typeof r!=="object"||r===null)return $l(r)?$l: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?ta(r,e):!1:r instanceof Map?Qh(r):Array.isArray(r)?Xh(r):r instanceof g?qh(r):td(r,!0)}function Xh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r[e]);return Ps(t)}function Qh(r){let t=-1,e=[];for(let n of r.values())e[++t]=Dr(n);return Ps(e)}function qh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r.get(e));return Ps(t)}function td(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=Dr(r[e[i]]);return Ps(n,e)}function Ps(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return ed(r,e);case Map:return Hl(r,e,e.keys());case tr:case Ar:case Object:case void 0:return Hl(r,e,t||Object.keys(e))}return e instanceof g?rd(r,e):!1}}function ed(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 rd(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 Hl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),l=n.next(),u=i.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=n.next(),u=i.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var xa={};xr(xa,{BitIterator:()=>Zr,getBit:()=>Yl,getBool:()=>Vs,packBools:()=>Xr,popcnt_array:()=>Kl,popcnt_bit_range:()=>ai,popcnt_uint32:()=>ks,setBool:()=>nd,truncateBitmap:()=>Jr});function Vs(r,t,e,n){return(e&1<<n)!==0}function Yl(r,t,e,n){return(e&1<<n)>>n}function nd(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Jr(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):Xr(new Zr(e,r,t,null,Vs)).subarray(0,n)),i}return e}function Xr(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var Zr=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ai(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new Zr(r,t,e-t,r,Yl))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ai(r,t,i)+ai(r,n,e)+Kl(r,i>>3,n-i>>3)}function Kl(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=ks(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=ks(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=ks(s.getUint8(i)),i+=1;return n}function ks(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 id=-1,R=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 m.isSparseUnion(t)?this.children.some(e=>e.nullable):m.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:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(m.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=id&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-ai(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;s instanceof R?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=he(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(m.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===K.Dense?this.valueOffsets[t]:t;return i.getValid(s)}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(m.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===K.Dense?this.valueOffsets[t]:t;n=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&s.set(Jr(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));let h=s[u];n=(h&l)!==0,e?s[u]=h|l:s[u]=h&~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,s=this,o=this.children){return new R(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.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(Jr(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[lt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[lt.TYPE])&&(o[lt.TYPE]=s.subarray(t,t+e)),(s=o[lt.OFFSET])&&(o[lt.OFFSET]=s.subarray(t,t+e+1))||(s=o[lt.DATA])&&(o[lt.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};R.prototype.children=Object.freeze([]);var Qr=class extends v{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new R(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=ms(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=ms(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=T(t.nullBitmap),{length:o=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=C(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(m.isSparseUnion(e))return new R(e,n,o,a,[void 0,void 0,void 0,s],i);let c=Rr(t.valueOffsets);return new R(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.indices.ArrayType,t.data),{["dictionary"]:o=new g([new Qr().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Qr().visit({type:e.valueType})}=t,s=T(t.nullBitmap),{["length"]:o=i.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Qr().visit({type:e.childType})}=t,s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}},sd=new Qr;function w(r){return sd.visit(r)}var ci=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 Zl(r){return r.some(t=>t.nullable)}function js(r){return r.reduce((t,e)=>t+e.nullCount,0)}function zs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ws(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let u=Math.max(0,e-c),h=Math.min(n-c,l);i.push(a.slice(u,h-u))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Sa(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function li(r,t){return r.getValid(t)}function On(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Sa(n,this._offsets,e,t)}}function Gs(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=Sa(s,this._offsets,n,e);return t=void 0,o}}function $s(r){let t;function e(n,i,s){let o=s,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let h=n[l];if(~(a=r(h,t,o)))return c+a;o=0,c+=h.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Sa(s,this._offsets,i,e);return t=void 0,o}}var x=class extends v{};function od(r,t){return t===null&&r.length>0?0:-1}function ad(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new Zr(e,r.offset+(t||0),r.length,e,Vs)){if(!i)return n;++n}return-1}function N(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case f.Union:break;case f.Dictionary:break;default:return ad(r,e)}let n=mt.getVisitFn(r),i=Dr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function Jl(r,t,e){let n=mt.getVisitFn(r),i=Dr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}x.prototype.visitNull=od;x.prototype.visitBool=N;x.prototype.visitInt=N;x.prototype.visitInt8=N;x.prototype.visitInt16=N;x.prototype.visitInt32=N;x.prototype.visitInt64=N;x.prototype.visitUint8=N;x.prototype.visitUint16=N;x.prototype.visitUint32=N;x.prototype.visitUint64=N;x.prototype.visitFloat=N;x.prototype.visitFloat16=N;x.prototype.visitFloat32=N;x.prototype.visitFloat64=N;x.prototype.visitUtf8=N;x.prototype.visitLargeUtf8=N;x.prototype.visitBinary=N;x.prototype.visitLargeBinary=N;x.prototype.visitFixedSizeBinary=N;x.prototype.visitDate=N;x.prototype.visitDateDay=N;x.prototype.visitDateMillisecond=N;x.prototype.visitTimestamp=N;x.prototype.visitTimestampSecond=N;x.prototype.visitTimestampMillisecond=N;x.prototype.visitTimestampMicrosecond=N;x.prototype.visitTimestampNanosecond=N;x.prototype.visitTime=N;x.prototype.visitTimeSecond=N;x.prototype.visitTimeMillisecond=N;x.prototype.visitTimeMicrosecond=N;x.prototype.visitTimeNanosecond=N;x.prototype.visitDecimal=N;x.prototype.visitList=N;x.prototype.visitStruct=N;x.prototype.visitUnion=N;x.prototype.visitDenseUnion=Jl;x.prototype.visitSparseUnion=Jl;x.prototype.visitDictionary=N;x.prototype.visitInterval=N;x.prototype.visitIntervalDayTime=N;x.prototype.visitIntervalYearMonth=N;x.prototype.visitDuration=N;x.prototype.visitDurationSecond=N;x.prototype.visitDurationMillisecond=N;x.prototype.visitDurationMicrosecond=N;x.prototype.visitDurationNanosecond=N;x.prototype.visitFixedSizeList=N;x.prototype.visitMap=N;var qr=new x;var S=class extends v{};function F(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof it&&t.bitWidth!==64||t instanceof xt&&t.bitWidth!==64||t instanceof At&&t.precision!==j.HALF))return new ci(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ci(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Ba(o)})}var Ba=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}};S.prototype.visitNull=F;S.prototype.visitBool=F;S.prototype.visitInt=F;S.prototype.visitInt8=F;S.prototype.visitInt16=F;S.prototype.visitInt32=F;S.prototype.visitInt64=F;S.prototype.visitUint8=F;S.prototype.visitUint16=F;S.prototype.visitUint32=F;S.prototype.visitUint64=F;S.prototype.visitFloat=F;S.prototype.visitFloat16=F;S.prototype.visitFloat32=F;S.prototype.visitFloat64=F;S.prototype.visitUtf8=F;S.prototype.visitLargeUtf8=F;S.prototype.visitBinary=F;S.prototype.visitLargeBinary=F;S.prototype.visitFixedSizeBinary=F;S.prototype.visitDate=F;S.prototype.visitDateDay=F;S.prototype.visitDateMillisecond=F;S.prototype.visitTimestamp=F;S.prototype.visitTimestampSecond=F;S.prototype.visitTimestampMillisecond=F;S.prototype.visitTimestampMicrosecond=F;S.prototype.visitTimestampNanosecond=F;S.prototype.visitTime=F;S.prototype.visitTimeSecond=F;S.prototype.visitTimeMillisecond=F;S.prototype.visitTimeMicrosecond=F;S.prototype.visitTimeNanosecond=F;S.prototype.visitDecimal=F;S.prototype.visitList=F;S.prototype.visitStruct=F;S.prototype.visitUnion=F;S.prototype.visitDenseUnion=F;S.prototype.visitSparseUnion=F;S.prototype.visitDictionary=F;S.prototype.visitInterval=F;S.prototype.visitIntervalDayTime=F;S.prototype.visitIntervalYearMonth=F;S.prototype.visitDuration=F;S.prototype.visitDurationSecond=F;S.prototype.visitDurationMillisecond=F;S.prototype.visitDurationMicrosecond=F;S.prototype.visitDurationNanosecond=F;S.prototype.visitFixedSizeList=F;S.prototype.visitMap=F;var Fn=new S;var Xl,Ql={},ql={},g=class{constructor(t){var e,n,i;let s=t[0]instanceof g?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof R)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=Ql[o.typeId],u=s[0];this.isValid=h=>li(u,h),this.get=h=>a(u,h),this.set=(h,d)=>c(u,h,d),this.indexOf=h=>l(u,h),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,ql[o.typeId]),this._offsets=zs(s);break}this.data=s,this.type=o,this.stride=he(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Zl(this.data)}get nullCount(){return js(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Fn.visit(this)}concat(...t){return new g(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new g(oi(this,t,e,({data:n,_offsets:i},s,o)=>Ws(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*i),o.offset),o.offset+=c*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new g(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return m.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(m.isDictionary(this.type)){let t=new Mn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new g(e)}return new Mn(this)}unmemoize(){if(m.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 g(e)}return this}};Xl=Symbol.toStringTag;g[Xl]=(r=>{r.type=m.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(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let n=mt.getVisitFnByTypeId(e),i=Dt.getVisitFnByTypeId(e),s=qr.getVisitFnByTypeId(e);Ql[e]={get:n,set:i,indexOf:s},ql[e]=Object.create(r,{isValid:{value:On(li)},get:{value:On(mt.getVisitFnByTypeId(e))},set:{value:Gs(Dt.getVisitFnByTypeId(e))},indexOf:{value:$s(qr.getVisitFnByTypeId(e))}})}return"Vector"})(g.prototype);var Mn=class extends g{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new Mn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new g(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Or(r){if(r){if(r instanceof R)return new g([r]);if(r instanceof g)return new g(r.data);if(r.type instanceof m)return new g([w(r)]);if(Array.isArray(r))return new g(r.flatMap(t=>cd(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:0,data:r};if(r instanceof Int8Array)return new g([w(Object.assign(Object.assign({},t),{type:new ye}))]);if(r instanceof Int16Array)return new g([w(Object.assign(Object.assign({},t),{type:new ge}))]);if(r instanceof Int32Array)return new g([w(Object.assign(Object.assign({},t),{type:new pt}))]);if(r instanceof BigInt64Array)return new g([w(Object.assign(Object.assign({},t),{type:new be}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new g([w(Object.assign(Object.assign({},t),{type:new we}))]);if(r instanceof Uint16Array)return new g([w(Object.assign(Object.assign({},t),{type:new _e}))]);if(r instanceof Uint32Array)return new g([w(Object.assign(Object.assign({},t),{type:new ve}))]);if(r instanceof BigUint64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Ze}))]);if(r instanceof Float32Array)return new g([w(Object.assign(Object.assign({},t),{type:new Xt}))]);if(r instanceof Float64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Qt}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function cd(r){return r instanceof R?[r]:r instanceof g?r.data:Or(r).data}function tu(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
9
|
case ${ld(n)}:`).join("")}
|
|
10
10
|
return false;
|
|
@@ -13,11 +13,11 @@ ${t}`),new Function("x",`${t}
|
|
|
13
13
|
return true;`)}function ld(r){return typeof r!="bigint"?Le(r):`${Le(r)}n`}function Aa(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function eu(r,t=0){return r.length>=t?r.subarray(0,t):qn(new r.constructor(t),r,0)}var Ee=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?Aa(n*1,this.BYTES_PER_ELEMENT):Aa(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Aa(t*this.stride,this.BYTES_PER_ELEMENT);let e=eu(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=eu(this.buffer,t)}},ur=class extends Ee{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}},Ln=class extends ur{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,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Nn=class extends ur{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 rt=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=he(t),this._nulls=new Ln,e&&e.length>0&&(this._isValid=tu(e))}toVector(){return new g([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((a,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:s,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:h}=this;(e=c?.flush(o))?i=l?.flush(o):(i=l?.flush(o))?t=u?.flush(l.last()):t=u?.flush(o),a>0&&(n=h?.flush(o));let d=this.children.map(b=>b.flush());return this.clear(),w({type:s,length:o,nullCount:a,children:d,child:d[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};rt.prototype.length=1;rt.prototype.stride=1;rt.prototype.children=null;rt.prototype.finished=!1;rt.prototype.nullValues=null;rt.prototype._isValid=()=>!0;var yt=class extends rt{constructor(t){super(t),this._values=new ur(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},ee=class extends rt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Nn(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 tr?e[xe].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 tn=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 Et=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 Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Et).__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):$.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ot).__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 tn).__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 tn).__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 Q).__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,$.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 E=class{constructor(t=[],e,n,i=$.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Ta(t)),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 E(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new E(e,this.metadata)}assign(...t){let e=t[0]instanceof E?t[0]:Array.isArray(t[0])?new E(t[0]):new E(t),n=[...this.fields],i=Hs(Hs(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Hs(Hs(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Ta(s,new Map);return new E([...n,...s],i,new Map([...this.dictionaries,...o]))}};E.prototype.fields=null;E.prototype.metadata=null;E.prototype.dictionaries=null;var D=class{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new D(`${e}`,n,i,s)}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,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],D.new(e,n,i,s)}};D.prototype.type=null;D.prototype.name=null;D.prototype.nullable=null;D.prototype.metadata=null;function Hs(r,t){return new Map([...r||new Map,...t||new Map])}function Ta(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(m.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Ta(s.children,t)}return t}var ud=ar,fd=Ct,fr=class{static decode(t){t=new fd(T(t));let e=Et.getRootAsFooter(t),n=E.decode(e.schema(),new Map,e.version());return new Da(n,e)}static encode(t){let e=new ud,n=E.encode(e,t.schema);Et.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Re.encode(e,o);let i=e.endVector();Et.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Re.encode(e,o);let s=e.endVector();return Et.startFooter(e),Et.addSchema(e,n),Et.addVersion(e,$.V5),Et.addRecordBatches(e,i),Et.addDictionaries(e,s),Et.finishFooterBuffer(e,Et.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=$.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 Da=class extends fr{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 Re.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Re.decode(e)}return null}},Re=class{static decode(t){return new Re(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return tn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=at(n),this.bodyLength=at(e)}};var q=Object.freeze({done:!0,value:void 0}),ui=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())}},Ys=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 y(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(q);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 y(this,void 0,void 0,function*(){return yield this.abort(t),q})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),q})}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(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(q)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var er=class extends Ys{write(t){if((t=T(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Xn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Xn)}toUint8Array(t=!1){return t?ce(this._values)[0]:(()=>y(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var c=!0,l=Te(this),u;u=yield l.next(),e=u.done,!e;c=!0){s=u.value,c=!1;let h=s;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return ce(o,a)[0]}))()}},rr=class{constructor(t){t&&(this.source=new Oa(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)}},re=class{constructor(t){t instanceof re?this.source=t.source:t instanceof er?this.source=new hr(Bt.fromAsyncIterable(t)):ps(t)?this.source=new hr(Bt.fromNodeStream(t)):Qn(t)?this.source=new hr(Bt.fromDOMStream(t)):hs(t)?this.source=new hr(Bt.fromDOMStream(t.body)):De(t)?this.source=new hr(Bt.fromIterable(t)):ae(t)?this.source=new hr(Bt.fromAsyncIterable(t)):de(t)&&(this.source=new hr(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)}},Oa=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)||q)}return(t){return Object.create(this.source.return&&this.source.return(t)||q)}},hr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return y(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return y(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||q;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return y(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||q;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var fi=class extends rr{constructor(t,e){super(),this.position=0,this.buffer=T(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}}},Fr=class extends re{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return y(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 y(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 y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0,c=Math.min(n,s+Math.min(n-s,t)),l=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,s));return l}return null})}readAt(t,e){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ma={};xr(Ma,{BaseInt64:()=>hi,Int128:()=>ne,Int64:()=>St,Uint64:()=>G});function Un(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var En=8,Fa=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],hi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Un(this.buffer[1])} ${Un(this.buffer[0])}`}},G=class extends hi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return G.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return G.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new G(e);for(let s=0;s<n;){let o=En<n-s?En:n-s,a=new G(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new G(new Uint32Array([Fa[o],0]));i.times(c),i.plus(a),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)G.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new G(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new G(new Uint32Array(t.buffer)).plus(e)}},St=class extends hi{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 St.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return St.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new St(e);for(let o=n?1:0;o<i;){let a=En<i-o?En:i-o,c=new St(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new St(new Uint32Array([Fa[a],0]));s.times(l),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)St.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new St(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new St(new Uint32Array(t.buffer)).plus(e)}},ne=class{constructor(t){this.buffer=t}high(){return new St(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new St(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 G(new Uint32Array([this.buffer[3],0])),n=new G(new Uint32Array([this.buffer[2],0])),i=new G(new Uint32Array([this.buffer[1],0])),s=new G(new Uint32Array([this.buffer[0],0])),o=new G(new Uint32Array([t.buffer[3],0])),a=new G(new Uint32Array([t.buffer[2],0])),c=new G(new Uint32Array([t.buffer[1],0])),l=new G(new Uint32Array([t.buffer[0],0])),u=G.multiply(s,l);this.buffer[0]=u.low();let h=new G(new Uint32Array([u.high(),0]));return u=G.multiply(i,l),h.plus(u),u=G.multiply(s,c),h.plus(u),this.buffer[1]=h.low(),this.buffer[3]=h.lessThan(u)?1:0,this.buffer[2]=h.high(),new G(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(G.multiply(n,l)).plus(G.multiply(i,c)).plus(G.multiply(s,a)),this.buffer[3]+=G.multiply(e,l).plus(G.multiply(n,c)).plus(G.multiply(i,a)).plus(G.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${Un(this.buffer[3])} ${Un(this.buffer[2])} ${Un(this.buffer[1])} ${Un(this.buffer[0])}`}static multiply(t,e){return new ne(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ne(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ne.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ne.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new ne(e);for(let o=n?1:0;o<i;){let a=En<i-o?En:i-o,c=new ne(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new ne(new Uint32Array([Fa[a],0,0,0]));s.times(l),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)ne.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var di=class extends v{constructor(t,e,n,i,s=$.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof D?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return w({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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 w({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 w({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 w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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<$.V5&&this.readNullBitmap(t,n),t.mode===K.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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)}},Ks=class extends di{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Xr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return m.isTimestamp(t)?C(Uint8Array,St.convertArray(n[e])):(m.isInt(t)||m.isTime(t))&&t.bitWidth===64||m.isDuration(t)?C(Uint8Array,St.convertArray(n[e])):m.isDate(t)&&t.unit===et.MILLISECOND?C(Uint8Array,St.convertArray(n[e])):m.isDecimal(t)?C(Uint8Array,ne.convertArray(n[e])):m.isBinary(t)||m.isLargeBinary(t)||m.isFixedSizeBinary(t)?hd(n[e]):m.isBool(t)?Xr(n[e]):m.isUtf8(t)||m.isLargeUtf8(t)?Pe(n[e].join("")):C(Uint8Array,C(t.ArrayType,n[e].map(i=>+i)))}};function hd(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 Rn=class extends ee{constructor(t){super(t),this._values=new Ee(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,T(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let c=a.length;i.set(a,s),n.set(o,c),s+=c}}};var Cn=class extends ee{constructor(t){super(t),this._values=new Ee(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,T(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;i.set(a,s),n.set(o,BigInt(c)),s+=c}}};var Zs=class extends rt{constructor(t){super(t),this._values=new Ln}setValue(t,e){this._values.set(t,+e)}};var rn=class extends yt{};rn.prototype._setValue=fa;var pi=class extends rn{};pi.prototype._setValue=Is;var mi=class extends rn{};mi.prototype._setValue=xs;var yi=class extends yt{};yi.prototype._setValue=pa;var Js=class extends rt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Ut(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=dr({type:this.type.indices,nullValues:e}),this.dictionary=dr({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var gi=class extends yt{};gi.prototype._setValue=ua;var Xs=class extends rt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Vt(this.type.listSize,new D(e,t.type,!0)),n}};var nn=class extends yt{setValue(t,e){this._values.set(t,e)}},Qs=class extends nn{setValue(t,e){super.setValue(t,si(e))}},qs=class extends nn{},to=class extends nn{};var sn=class extends yt{};sn.prototype._setValue=ma;var bi=class extends sn{};bi.prototype._setValue=Ls;var wi=class extends sn{};wi.prototype._setValue=Ns;var pr=class extends yt{};pr.prototype._setValue=ya;var _i=class extends pr{};_i.prototype._setValue=Us;var vi=class extends pr{};vi.prototype._setValue=Es;var Ii=class extends pr{};Ii.prototype._setValue=Rs;var xi=class extends pr{};xi.prototype._setValue=Cs;var Se=class extends yt{setValue(t,e){this._values.set(t,e)}},eo=class extends Se{},ro=class extends Se{},no=class extends Se{},io=class extends Se{},so=class extends Se{},oo=class extends Se{},ao=class extends Se{},co=class extends Se{};var lo=class extends ee{constructor(t){super(t),this._offsets=new Nn(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 Tt(new D(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(typeof s>"u")e.set(i,0);else{let o=s,a=o.length,c=e.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,o[l])}}};var uo=class extends ee{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new jt(new D(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:a}=e.set(i,s.size).buffer;for(let c of s.entries())if(n.set(o,c),++o>=a)break}}};var fo=class extends rt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var ho=class extends rt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new V([...this.type.children,new D(e,t.type,!0)]),n}};var mr=class extends yt{};mr.prototype._setValue=ha;var Si=class extends mr{};Si.prototype._setValue=Ss;var Bi=class extends mr{};Bi.prototype._setValue=Bs;var Ai=class extends mr{};Ai.prototype._setValue=As;var Ti=class extends mr{};Ti.prototype._setValue=Ts;var yr=class extends yt{};yr.prototype._setValue=da;var Di=class extends yr{};Di.prototype._setValue=Ds;var Oi=class extends yr{};Oi.prototype._setValue=Os;var Fi=class extends yr{};Fi.prototype._setValue=Fs;var Mi=class extends yr{};Mi.prototype._setValue=Ms;var Pn=class extends rt{constructor(t){super(t),this._typeIds=new ur(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],s=this.children[i];s?.set(t,e)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new D(e,t.type)];return this.type=new Ie(s,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},po=class extends Pn{},mo=class extends Pn{constructor(t){super(t),this._offsets=new ur(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s?.set(o,e)}};var Li=class extends ee{constructor(t){super(t),this._values=new Ee(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,Pe(e))}_flushPending(t,e){}};Li.prototype._flushPending=Rn.prototype._flushPending;var Ni=class extends ee{constructor(t){super(t),this._values=new Ee(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,Pe(e))}_flushPending(t,e){}};Ni.prototype._flushPending=Cn.prototype._flushPending;var La=class extends v{visitNull(){return fo}visitBool(){return Zs}visitInt(){return Se}visitInt8(){return eo}visitInt16(){return ro}visitInt32(){return no}visitInt64(){return io}visitUint8(){return so}visitUint16(){return oo}visitUint32(){return ao}visitUint64(){return co}visitFloat(){return nn}visitFloat16(){return Qs}visitFloat32(){return qs}visitFloat64(){return to}visitUtf8(){return Li}visitLargeUtf8(){return Ni}visitBinary(){return Rn}visitLargeBinary(){return Cn}visitFixedSizeBinary(){return gi}visitDate(){return rn}visitDateDay(){return pi}visitDateMillisecond(){return mi}visitTimestamp(){return mr}visitTimestampSecond(){return Si}visitTimestampMillisecond(){return Bi}visitTimestampMicrosecond(){return Ai}visitTimestampNanosecond(){return Ti}visitTime(){return yr}visitTimeSecond(){return Di}visitTimeMillisecond(){return Oi}visitTimeMicrosecond(){return Fi}visitTimeNanosecond(){return Mi}visitDecimal(){return yi}visitList(){return lo}visitStruct(){return ho}visitUnion(){return Pn}visitDenseUnion(){return mo}visitSparseUnion(){return po}visitDictionary(){return Js}visitInterval(){return sn}visitIntervalDayTime(){return bi}visitIntervalYearMonth(){return wi}visitDuration(){return pr}visitDurationSecond(){return _i}visitDurationMillisecond(){return vi}visitDurationMicrosecond(){return Ii}visitDurationNanosecond(){return xi}visitFixedSizeList(){return Xs}visitMap(){return uo}},ru=new La;var B=class extends v{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 zt(r,t){return t instanceof r.constructor}function on(r,t){return r===t||zt(r,t)}function gr(r,t){return r===t||zt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function yo(r,t){return r===t||zt(r,t)&&r.precision===t.precision}function dd(r,t){return r===t||zt(r,t)&&r.byteWidth===t.byteWidth}function Na(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ui(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ei(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function pd(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function md(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function Ua(r,t){return r===t||zt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&nr.compareManyFields(r.children,t.children)}function yd(r,t){return r===t||zt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&nr.visit(r.indices,t.indices)&&nr.visit(r.dictionary,t.dictionary)}function Ea(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ri(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function gd(r,t){return r===t||zt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function bd(r,t){return r===t||zt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}B.prototype.visitNull=on;B.prototype.visitBool=on;B.prototype.visitInt=gr;B.prototype.visitInt8=gr;B.prototype.visitInt16=gr;B.prototype.visitInt32=gr;B.prototype.visitInt64=gr;B.prototype.visitUint8=gr;B.prototype.visitUint16=gr;B.prototype.visitUint32=gr;B.prototype.visitUint64=gr;B.prototype.visitFloat=yo;B.prototype.visitFloat16=yo;B.prototype.visitFloat32=yo;B.prototype.visitFloat64=yo;B.prototype.visitUtf8=on;B.prototype.visitLargeUtf8=on;B.prototype.visitBinary=on;B.prototype.visitLargeBinary=on;B.prototype.visitFixedSizeBinary=dd;B.prototype.visitDate=Na;B.prototype.visitDateDay=Na;B.prototype.visitDateMillisecond=Na;B.prototype.visitTimestamp=Ui;B.prototype.visitTimestampSecond=Ui;B.prototype.visitTimestampMillisecond=Ui;B.prototype.visitTimestampMicrosecond=Ui;B.prototype.visitTimestampNanosecond=Ui;B.prototype.visitTime=Ei;B.prototype.visitTimeSecond=Ei;B.prototype.visitTimeMillisecond=Ei;B.prototype.visitTimeMicrosecond=Ei;B.prototype.visitTimeNanosecond=Ei;B.prototype.visitDecimal=on;B.prototype.visitList=pd;B.prototype.visitStruct=md;B.prototype.visitUnion=Ua;B.prototype.visitDenseUnion=Ua;B.prototype.visitSparseUnion=Ua;B.prototype.visitDictionary=yd;B.prototype.visitInterval=Ea;B.prototype.visitIntervalDayTime=Ea;B.prototype.visitIntervalYearMonth=Ea;B.prototype.visitDuration=Ri;B.prototype.visitDurationSecond=Ri;B.prototype.visitDurationMillisecond=Ri;B.prototype.visitDurationMicrosecond=Ri;B.prototype.visitDurationNanosecond=Ri;B.prototype.visitFixedSizeList=gd;B.prototype.visitMap=bd;var nr=new B;function an(r,t){return nr.compareSchemas(r,t)}function nu(r,t){return nr.compareFields(r,t)}function go(r,t){return nr.visit(r,t)}function dr(r){let t=r.type,e=new(ru.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,a)=>n[a]||i:({name:o})=>n[o]||i;for(let[o,a]of t.children.entries()){let{type:c}=a,l=s(a,o);e.children.push(dr(Object.assign(Object.assign({},l),{type:c})))}}return e}function Ci(r,t){if(r instanceof R||r instanceof g||r.type instanceof m||ArrayBuffer.isView(r))return Or(r);let e={type:t??bo(r),nullValues:[null]},n=[...Ra(e)(r)],i=n.length===1?n[0]:n.reduce((s,o)=>s.concat(o));return m.isDictionary(i.type)?i.memoize():i}function bo(r){if(r.length===0)return new ut;let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++s;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 Qt;if(s+t===r.length)return new Ut(new Pt,new pt);if(o+t===r.length)return new be;if(a+t===r.length)return new kt;if(c+t===r.length)return new cr;if(e+t===r.length){let l=r,u=bo(l[l.findIndex(h=>h!=null)]);if(l.every(h=>h==null||go(u,bo(h))))return new Tt(new D("",u,!0))}else if(n+t===r.length){let l=new Map;for(let u of r)for(let h of Object.keys(u))!l.has(h)&&u[h]!=null&&l.set(h,new D(h,bo([u[h]]),!0));return new V([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function Ra(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 s=0,o=dr(r);for(let a of i)o.append(a)[n]>=e&&++s&&(yield o.toVector());(o.finish().length>0||s===0)&&(yield o.toVector())}}function wo(r,t){return wd(r,t.map(e=>e.data.concat()))}function wd(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((h,d)=>Math.max(h,d.length),0)},s=0,o=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=_d(e,o,u,t,i),o>0&&(n[s++]=w({type:new V(e),length:o,nullCount:0,children:u.slice()})))}return[r=r.assign(e),n.map(h=>new Y(r,h))]}function _d(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],u=l?.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let h=r[a];r[a]=h.clone({nullable:!0}),e[a]=(s=l?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:w({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var iu,J=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new E([]),this._offsets=[0],this;let i,s;t[0]instanceof E&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof Y)return[c];if(c instanceof J)return c.batches;if(c instanceof R){if(c.type instanceof V)return[new Y(new E(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(b=>new g([c[b]])),h=i??new E(l.map((b,M)=>new D(String(b),u[M].type,u[M].nullable))),[,d]=wo(h,u);return d.length===0?[new Y(c)]:d}}}return[]},a=t.flatMap(c=>o(c));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new E([]),!(i instanceof E))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Y))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!an(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??zs(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=js(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Fn.visit(new g(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 J(e,n.map(i=>new Y(e,i)))}slice(t,e){let n=this.schema;[t,e]=oi({length:this.numRows},t,e);let i=Ws(this.data,this._offsets,t,e);return new J(n,i.map(s=>new Y(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=w({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new g(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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[n,i]=wo(n,a)}return new J(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new J(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,h]=a,d=e.findIndex(b=>b.name===c.name);return~d?h[d]=l:u.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...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 J(...wo(s,o))}};iu=Symbol.toStringTag;J[iu]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=On(li),r.get=On(mt.getVisitFn(f.Struct)),r.set=Gs(Dt.getVisitFn(f.Struct)),r.indexOf=$s(qr.getVisitFn(f.Struct)),"Table"))(J.prototype);var ou,Y=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof E))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=w({nullCount:0,type:new V(this.schema.fields),children:this.schema.fields.map(e=>w({type:e.type,nullCount:0}))})]=t,!(this.data instanceof R))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=su(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=D.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new E(n),a=w({type:new V(n),length:s,children:i,nullCount:0});[this.schema,this.data]=su(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=au(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 mt.visit(this.data,t)}set(t,e){return Dt.visit(this.data,t,e)}indexOf(t,e){return qr.visit(this.data,t,e)}[Symbol.iterator](){return Fn.visit(new g([this.data]))}toArray(){return[...this]}concat(...t){return new J(this.schema,[this,...t])}slice(t,e){let[n]=new g([this.data]).slice(t,e).data;return new Y(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 g([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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new E(s,new Map(this.schema.metadata)),i=w({type:new V(s),children:o})}return new Y(n,i)}select(t){let e=this.schema.select(t),n=new V(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new Y(e,w({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=w({type:new V(e.fields),length:this.numRows,children:n});return new Y(e,i)}};ou=Symbol.toStringTag;Y[ou]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Y.prototype);function su(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),s[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:w({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),w({type:new V(i),length:e,children:s})]}function au(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 s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])au(a.children,l?.children,e);if(m.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 cn=class extends Y{constructor(t){let e=t.fields.map(i=>w({type:i.type})),n=w({type:new V(t.fields),nullCount:0,children:e});super(t,n)}};var ft=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 ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new ft).__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):$.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):P.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 Q).__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,$.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,P.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,s,o){return ft.startMessage(t),ft.addVersion(t,e),ft.addHeaderType(t,n),ft.addHeader(t,i),ft.addBodyLength(t,s),ft.addCustomMetadata(t,o),ft.endMessage(t)}};var Ca=class extends v{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return He.startNull(e),He.endNull(e)}visitInt(t,e){return _t.startInt(e),_t.addBitWidth(e,t.bitWidth),_t.addIsSigned(e,t.isSigned),_t.endInt(e)}visitFloat(t,e){return Kt.startFloatingPoint(e),Kt.addPrecision(e,t.precision),Kt.endFloatingPoint(e)}visitBinary(t,e){return je.startBinary(e),je.endBinary(e)}visitLargeBinary(t,e){return We.startLargeBinary(e),We.endLargeBinary(e)}visitBool(t,e){return ze.startBool(e),ze.endBool(e)}visitUtf8(t,e){return Ke.startUtf8(e),Ke.endUtf8(e)}visitLargeUtf8(t,e){return Ge.startLargeUtf8(e),Ge.endLargeUtf8(e)}visitDecimal(t,e){return vt.startDecimal(e),vt.addScale(e,t.scale),vt.addPrecision(e,t.precision),vt.addBitWidth(e,t.bitWidth),vt.endDecimal(e)}visitDate(t,e){return Gt.startDate(e),Gt.addUnit(e,t.unit),Gt.endDate(e)}visitTime(t,e){return Mt.startTime(e),Mt.addUnit(e,t.unit),Mt.addBitWidth(e,t.bitWidth),Mt.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Lt.startTimestamp(e),Lt.addUnit(e,t.unit),n!==void 0&&Lt.addTimezone(e,n),Lt.endTimestamp(e)}visitInterval(t,e){return Zt.startInterval(e),Zt.addUnit(e,t.unit),Zt.endInterval(e)}visitDuration(t,e){return $t.startDuration(e),$t.addUnit(e,t.unit),$t.endDuration(e)}visitList(t,e){return $e.startList(e),$e.endList(e)}visitStruct(t,e){return Ye.startStruct_(e),Ye.endStruct_(e)}visitUnion(t,e){It.startTypeIdsVector(e,t.typeIds.length);let n=It.createTypeIdsVector(e,t.typeIds);return It.startUnion(e),It.addMode(e,t.mode),It.addTypeIds(e,n),It.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return le.startDictionaryEncoding(e),le.addId(e,BigInt(t.id)),le.addIsOrdered(e,t.isOrdered),n!==void 0&&le.addIndexType(e,n),le.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Ht.startFixedSizeBinary(e),Ht.addByteWidth(e,t.byteWidth),Ht.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Yt.startFixedSizeList(e),Yt.addListSize(e,t.listSize),Yt.endFixedSizeList(e)}visitMap(t,e){return Jt.startMap(e),Jt.addKeysSorted(e,t.keysSorted),Jt.endMap(e)}},_o=new Ca;function fu(r,t=new Map){return new E(vd(r,t),vo(r.metadata),t)}function Pa(r){return new Ot(r.count,du(r.columns),pu(r.columns))}function hu(r){return new se(Pa(r.data),r.id,r.isDelta)}function vd(r,t){return(r.fields||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function cu(r,t){return(r.children||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function du(r){return(r||[]).reduce((t,e)=>[...t,new Be(e.count,Id(e.VALIDITY)),...du(e.children)],[])}function pu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ie(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ie(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ie(t.length,i.OFFSET.length)),i.DATA&&t.push(new ie(t.length,i.DATA.length)),t=pu(i.children,t)}return t}function Id(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function mu(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=uu(r,cu(r,t)),i=new D(r.name,o,r.nullable,vo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?lu(n):new pt,a=new Ut(t.get(e),n,e,s.isOrdered),i=new D(r.name,a,r.nullable,vo(r.metadata))):(n=(n=s.indexType)?lu(n):new pt,t.set(e,o=uu(r,cu(r,t))),a=new Ut(o,n,e,s.isOrdered),i=new D(r.name,a,r.nullable,vo(r.metadata))),i||null}function vo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function lu(r){return new it(r.isSigned,r.bitWidth)}function uu(r,t){let e=r.type.name;switch(e){case"NONE":return new ut;case"null":return new ut;case"binary":return new ue;case"largebinary":return new Je;case"utf8":return new Pt;case"largeutf8":return new Xe;case"bool":return new kt;case"list":return new Tt((t||[])[0]);case"struct":return new V(t||[]);case"struct_":return new V(t||[])}switch(e){case"int":{let n=r.type;return new it(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new At(j[n.precision])}case"decimal":{let n=r.type;return new fe(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new qt(et[n.unit])}case"time":{let n=r.type;return new xt(p[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Nt(p[n.unit],n.timezone)}case"interval":{let n=r.type;return new te(nt[n.unit])}case"duration":{let n=r.type;return new Qe(p[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Ie(K[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new qe(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Vt(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new jt((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var xd=ar,Sd=Ct,gt=class{static fromJSON(t,e){let n=new gt(0,$.V5,e);return n._createHeader=Bd(t,e),n}static decode(t){t=new Sd(T(t));let e=ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new gt(n,i,s);return o._createHeader=Ad(e,s),o}static encode(t){let e=new xd,n=-1;return t.isSchema()?n=E.encode(e,t.header()):t.isRecordBatch()?n=Ot.encode(e,t.header()):t.isDictionaryBatch()&&(n=se.encode(e,t.header())),ft.startMessage(e),ft.addVersion(e,$.V5),ft.addHeader(e,n),ft.addHeaderType(e,t.headerType),ft.addBodyLength(e,BigInt(t.bodyLength)),ft.finishMessageBuffer(e,ft.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof E)return new gt(0,$.V5,P.Schema,t);if(t instanceof Ot)return new gt(e,$.V5,P.RecordBatch,t);if(t instanceof se)return new gt(e,$.V5,P.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===P.Schema}isRecordBatch(){return this.headerType===P.RecordBatch}isDictionaryBatch(){return this.headerType===P.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=at(t)}},Ot=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=at(t)}},se=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=at(e)}},ie=class{constructor(t,e){this.offset=at(t),this.length=at(e)}},Be=class{constructor(t,e){this.length=at(t),this.nullCount=at(e)}};function Bd(r,t){return()=>{switch(t){case P.Schema:return E.fromJSON(r);case P.RecordBatch:return Ot.fromJSON(r);case P.DictionaryBatch:return se.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}function Ad(r,t){return()=>{switch(t){case P.Schema:return E.decode(r.header(new ot),new Map,r.version());case P.RecordBatch:return Ot.decode(r.header(new Ft),r.version());case P.DictionaryBatch:return se.decode(r.header(new me),r.version())}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}D.encode=Cd;D.decode=Ed;D.fromJSON=mu;E.encode=Rd;E.decode=Td;E.fromJSON=fu;Ot.encode=Pd;Ot.decode=Dd;Ot.fromJSON=Pa;se.encode=kd;se.decode=Od;se.fromJSON=hu;Be.encode=Vd;Be.decode=Md;ie.encode=jd;ie.decode=Fd;function Td(r,t=new Map,e=$.V5){let n=Ud(r,t);return new E(n,Io(r),t,e)}function Dd(r,t=$.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Ot(r.length(),Ld(r),Nd(r,t))}function Od(r,t=$.V5){return new se(Ot.decode(r.data(),t),r.id(),r.isDelta())}function Fd(r){return new ie(r.offset(),r.length())}function Md(r){return new Be(r.length(),r.nullCount())}function Ld(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Be.decode(e));return t}function Nd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<$.V4&&(n.bb_pos+=8*(i+1)),e[++s]=ie.decode(n));return e}function Ud(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=D.decode(n,t));return e}function yu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=D.decode(n,t));return e}function Ed(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=bu(r,yu(r,t)),n=new D(r.name(),i,r.nullable(),Io(r))):t.has(e=at(a.id()))?(s=(s=a.indexType())?gu(s):new pt,o=new Ut(t.get(e),s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),Io(r))):(s=(s=a.indexType())?gu(s):new pt,t.set(e,i=bu(r,yu(r,t))),o=new Ut(i,s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),Io(r))),n||null}function Io(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function gu(r){return new it(r.isSigned(),r.bitWidth())}function bu(r,t){let e=r.typeType();switch(e){case Z.NONE:return new ut;case Z.Null:return new ut;case Z.Binary:return new ue;case Z.LargeBinary:return new Je;case Z.Utf8:return new Pt;case Z.LargeUtf8:return new Xe;case Z.Bool:return new kt;case Z.List:return new Tt((t||[])[0]);case Z.Struct_:return new V(t||[])}switch(e){case Z.Int:{let n=r.type(new _t);return new it(n.isSigned(),n.bitWidth())}case Z.FloatingPoint:{let n=r.type(new Kt);return new At(n.precision())}case Z.Decimal:{let n=r.type(new vt);return new fe(n.scale(),n.precision(),n.bitWidth())}case Z.Date:{let n=r.type(new Gt);return new qt(n.unit())}case Z.Time:{let n=r.type(new Mt);return new xt(n.unit(),n.bitWidth())}case Z.Timestamp:{let n=r.type(new Lt);return new Nt(n.unit(),n.timezone())}case Z.Interval:{let n=r.type(new Zt);return new te(n.unit())}case Z.Duration:{let n=r.type(new $t);return new Qe(n.unit())}case Z.Union:{let n=r.type(new It);return new Ie(n.mode(),n.typeIdsArray()||[],t||[])}case Z.FixedSizeBinary:{let n=r.type(new Ht);return new qe(n.byteWidth())}case Z.FixedSizeList:{let n=r.type(new Yt);return new Vt(n.listSize(),(t||[])[0])}case Z.Map:{let n=r.type(new Jt);return new jt((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Z[e]}" (${e})`)}function Rd(r,t){let e=t.fields.map(s=>D.encode(r,s));ot.startFieldsVector(r,e.length);let n=ot.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?ot.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return Q.startKeyValue(r),Q.addKey(r,a),Q.addValue(r,c),Q.endKeyValue(r)})):-1;return ot.startSchema(r),ot.addFields(r,n),ot.addEndianness(r,zd?Sr.Little:Sr.Big),i!==-1&&ot.addCustomMetadata(r,i),ot.endSchema(r)}function Cd(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;m.isDictionary(s)?(o=s.dictionary.typeId,i=_o.visit(s,r),n=_o.visit(s.dictionary,r)):n=_o.visit(s,r);let a=(s.children||[]).map(u=>D.encode(r,u)),c=dt.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?dt.createCustomMetadataVector(r,[...t.metadata].map(([u,h])=>{let d=r.createString(`${u}`),b=r.createString(`${h}`);return Q.startKeyValue(r),Q.addKey(r,d),Q.addValue(r,b),Q.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),dt.startField(r),dt.addType(r,n),dt.addTypeType(r,o),dt.addChildren(r,c),dt.addNullable(r,!!t.nullable),e!==-1&&dt.addName(r,e),i!==-1&&dt.addDictionary(r,i),l!==-1&&dt.addCustomMetadata(r,l),dt.endField(r)}function Pd(r,t){let e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(r,e.length);for(let o of e.slice().reverse())Be.encode(r,o);let i=r.endVector();Ft.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ie.encode(r,o);let s=r.endVector();return Ft.startRecordBatch(r),Ft.addLength(r,BigInt(t.length)),Ft.addNodes(r,i),Ft.addBuffers(r,s),Ft.endRecordBatch(r)}function kd(r,t){let e=Ot.encode(r,t.data);return me.startDictionaryBatch(r),me.addId(r,BigInt(t.id)),me.addIsDelta(r,t.isDelta),me.addData(r,e),me.endDictionaryBatch(r)}function Vd(r,t){return vn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function jd(r,t){return _n.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var zd=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Va=r=>`Expected ${P[r]} Message in stream, but was null or length 0.`,ja=r=>`Header pointer of flatbuffer-encoded ${P[r]} Message is null or length 0.`,wu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,_u=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,kn=class{constructor(t){this.source=t instanceof rr?t:new rr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?q:t.value===-1&&(t=this.readMetadataLength()).done?q:(t=this.readMetadata(t.value)).done?q: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(Va(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=T(this.source.read(t));if(e.byteLength<t)throw new Error(_u(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=P.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(ja(e));return i}readMetadataLength(){let t=this.source.read(xo),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(wu(t,e.byteLength));return{done:!1,value:gt.decode(e)}}},Pi=class{constructor(t,e){this.source=t instanceof re?t:fs(t)?new Fr(t,e):new re(t)}[Symbol.asyncIterator](){return this}next(){return y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?q:t.value===-1&&(t=yield this.readMetadataLength()).done?q:(t=yield this.readMetadata(t.value)).done?q:t})}throw(t){return y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return y(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(Va(t));return e.value})}readMessageBody(t){return y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=T(yield this.source.read(t));if(e.byteLength<t)throw new Error(_u(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return y(this,void 0,void 0,function*(){let e=P.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(ja(e));return i})}readMetadataLength(){return y(this,void 0,void 0,function*(){let t=yield this.source.read(xo),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return y(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(wu(t,e.byteLength));return{done:!1,value:gt.decode(e)}})}},ki=class extends kn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ui?t:new ui(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gt.fromJSON(t.schema,P.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:gt.fromJSON(e,P.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:gt.fromJSON(e,P.RecordBatch)}}return this._body=[],q}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Va(t));return e.value}readSchema(){let t=P.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(ja(t));return n}},xo=4,ka="ARROW1",Vn=new Uint8Array(ka.length);for(let r=0;r<ka.length;r+=1)Vn[r]=ka.codePointAt(r);function So(r,t=0){for(let e=-1,n=Vn.length;++e<n;)if(Vn[e]!==r[t+e])return!1;return!0}var jn=Vn.length,za=jn+xo,vu=jn*2+xo;var bt=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 ae(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 bt?t:ls(t)?Gd(t):fs(t)?Yd(t):ae(t)?(()=>y(this,void 0,void 0,function*(){return yield bt.from(yield t)}))():hs(t)||Qn(t)||ps(t)||de(t)?Hd(new re(t)):$d(new rr(t))}static readAll(t){return t instanceof bt?t.isSync()?Iu(t):xu(t):ls(t)||ArrayBuffer.isView(t)||De(t)||us(t)?Iu(t):xu(t)}},ir=class extends bt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oe(this,arguments,function*(){yield U(yield*bn(Te(this[Symbol.iterator]())))})}},Mr=class extends bt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return y(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=Te(this),c;c=yield a.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let l=i;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Lr=class extends ir{constructor(t){super(t),this._impl=t}},Vi=class extends Mr{constructor(t){super(t),this._impl=t}},Bo=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=w({type:new V(this.schema.fields),length:t.length,children:n});return new Y(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n);if(i||!a){let c=o.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new g(l)):new g(l)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new di(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},zn=class extends Bo{constructor(t,e){super(e),this._reader=ls(t)?new ki(this._handle=t):new kn(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=Su(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):q}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):q}next(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Wn=class extends Bo{constructor(t,e){super(e),this._reader=new Pi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return y(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 y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Su(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):q})}return(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):q})}next(){return y(this,void 0,void 0,function*(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Ao=class extends zn{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 fi?t:new fi(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(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-za,n=t.readInt32(e),i=t.readAt(e-n,n);return fr.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}},Wa=class extends Wn{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 Fr?t:new Fr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return y(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return y(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-za,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return fr.decode(i)})}_readNextMessageAndValidate(t){return y(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})}},Ga=class extends zn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Ks(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Su(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Iu(r){let t=bt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function xu(r){return oe(this,arguments,function*(){let e=yield U(bt.from(r));try{if(!(yield U(e.open({autoDestroy:!1}))).closed)do yield yield U(e);while(!(yield U(e.reset().open())).closed)}finally{yield U(e.cancel())}})}function Gd(r){return new ir(new Ga(r))}function $d(r){let t=r.peek(jn+7&-8);return t&&t.byteLength>=4?So(t)?new Lr(new Ao(r.read())):new ir(new zn(r)):new ir(new zn(function*(){}()))}function Hd(r){return y(this,void 0,void 0,function*(){let t=yield r.peek(jn+7&-8);return t&&t.byteLength>=4?So(t)?new Lr(new Ao(yield r.read())):new Mr(new Wn(r)):new Mr(new Wn(function(){return oe(this,arguments,function*(){})}()))})}function Yd(r){return y(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Fr(r,t);return t>=vu&&So(yield e.readAt(0,jn+7&-8))?new Vi(new Wa(e)):new Mr(new Wn(e))})}var tt=class extends v{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Y?s.data.children:s.data),n=new tt;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof g)return this.visitMany(t.data),this;let{type:e}=t;if(!m.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(m.isUnion(e))this.nodes.push(new Be(n,0));else{let{nullCount:i}=t;m.isNull(e)||Ce.call(this,i<=0?new Uint8Array(0):Jr(t.offset,n,t.nullBitmap)),this.nodes.push(new Be(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 Ce(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ie(this._byteLength,t)),this._byteLength+=t,this}function Kd(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Ce.call(this,i),e.mode===K.Sparse)return $a.call(this,r);if(e.mode===K.Dense){if(r.offset<=0)return Ce.call(this,s),$a.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,h=-1;++h<n;)(l=i[h])!==void 0&&((u=a[l])===void 0&&(u=a[l]=s[h]),o[h]=s[h]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Ce.call(this,o),this.visitMany(r.children.map((l,u)=>{let h=e.typeIds[u],d=a[h],b=c[h];return l.slice(d,Math.min(n,b))}))}}return this}function Zd(r){let t;return r.nullCount>=r.length?Ce.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ce.call(this,Jr(r.offset,r.length,t)):Ce.call(this,Xr(r.values))}function br(r){return Ce.call(this,r.values.subarray(0,r.length*r.stride))}function To(r){let{length:t,values:e,valueOffsets:n}=r,i=at(n[0]),s=at(n[t]),o=Math.min(s-i,e.byteLength-i);return Ce.call(this,ys(-i,t+1,n)),Ce.call(this,e.subarray(i,i+o)),this}function Ha(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Ce.call(this,ys(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function $a(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}tt.prototype.visitBool=Zd;tt.prototype.visitInt=br;tt.prototype.visitFloat=br;tt.prototype.visitUtf8=To;tt.prototype.visitLargeUtf8=To;tt.prototype.visitBinary=To;tt.prototype.visitLargeBinary=To;tt.prototype.visitFixedSizeBinary=br;tt.prototype.visitDate=br;tt.prototype.visitTimestamp=br;tt.prototype.visitTime=br;tt.prototype.visitDecimal=br;tt.prototype.visitList=Ha;tt.prototype.visitStruct=$a;tt.prototype.visitUnion=Kd;tt.prototype.visitInterval=br;tt.prototype.visitDuration=br;tt.prototype.visitFixedSizeList=Ha;tt.prototype.visitMap=Ha;var ln=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){super(),this._position=0,this._started=!1,this._sink=new er,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Rt(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 ae(t)?t.then(e=>this.writeAll(e)):de(t)?Ka(this,t):Ya(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 er?this._sink=t:(this._sink=new er,t&&Pc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&kc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!an(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof J&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Y&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!an(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Y?t instanceof cn||this._writeRecordBatch(t):t instanceof J?this.writeAll(t.batches):De(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=gt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===P.RecordBatch?this._recordBatchBlocks.push(new Re(a,t.bodyLength,this._position)):t.headerType===P.DictionaryBatch&&this._dictionaryBlocks.push(new Re(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=T(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(gt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Vn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=tt.assemble(t),o=new Ot(t.numRows,n,i),a=gt.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=tt.assemble(new g([t])),c=new Ot(t.length,s,o),l=new se(c,e,n),u=gt.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n?.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},wr=class extends ln{static writeAll(t,e){let n=new wr(e);return ae(t)?t.then(i=>n.writeAll(i)):de(t)?Ka(n,t):Ya(n,t)}},_r=class extends ln{static writeAll(t){let e=new _r;return ae(t)?t.then(n=>e.writeAll(n)):de(t)?Ka(e,t):Ya(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=fr.encode(new fr(t,$.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Ya(r,t){let e=t;t instanceof J&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Ka(r,t){var e,n,i,s,o,a,c;return y(this,void 0,void 0,function*(){try{for(e=!0,n=Te(t);i=yield n.next(),s=i.done,!s;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function Bu(r,t){if(de(r))return Xd(r,t);if(De(r))return Jd(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Jd(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(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function Xd(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(o){return y(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return y(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return y(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return y(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}function Du(r){return new Za(r)}var Za=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Rc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=dr(s),this._getSize=i!=="bytes"?Au:Tu;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:i!=="bytes"?Au:Tu}),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)}},Au=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Tu=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function Do(r,t){let e=new er,n=null,i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield e.close()})},start(a){return y(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return y(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return y(this,void 0,void 0,function*(){return yield(yield bt.from(e)).open(t)})}function o(a,c){return y(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Oo(r,t){let e=new this(r),n=new re(e),i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return y(this,void 0,void 0,function*(){yield s(o)})},start(o){return y(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return y(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}function ji(r){let t=bt.from(r);return ae(t)?t.then(e=>ji(e)):t.isAsync()?t.readAll().then(e=>new J(e)):new J(t.readAll())}function Fo(r,t="stream"){return(t==="stream"?wr:_r).writeAll(r).toUint8Array(!0)}var cp=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},oa),Ma),xa),aa),ea),Ia),ia),{compareSchemas:an,compareFields:nu,compareTypes:go});Bt.toDOMStream=Bu;rt.throughDOM=Du;bt.throughDOM=Do;Lr.throughDOM=Do;ir.throughDOM=Do;ln.throughDOM=Oo;_r.throughDOM=Oo;wr.throughDOM=Oo;var Mo=class extends Er{arrowSchema;constructor(t,e){super(t,e),this.arrowSchema=null}getBatch(){let t=super.getBatch();if(t){this.arrowSchema=this.arrowSchema||lp(t.schema);let e=up(this.arrowSchema,t.data),n=new Y(this.arrowSchema,w({type:new V(this.arrowSchema.fields),children:e.map(({data:i})=>i[0])}));return{shape:"arrow-table",batchType:"data",data:new J([n]),length:t.length}}return null}};function lp(r){let t=[];for(let e in r){let n=r[e];if(n.type===Float32Array){let i=new Map,s=new D(n.name,new Xt,n.nullable,i);t.push(s)}}if(t.length===0)throw new Error("No arrow convertible fields");return new E(t)}function up(r,t){let e=[];for(let n of r.fields){let i=t[n.name];if(i instanceof Float32Array){let s=Or(i);e.push(s)}}if(r.fields.length!==e.length)throw new Error("Some columns not arrow convertible");return e}function Ou(r){switch(r.constructor){case Int8Array:return new ye;case Uint8Array:return new we;case Int16Array:return new ge;case Uint16Array:return new _e;case Int32Array:return new pt;case Uint32Array:return new ve;case Float32Array:return new Xt;case Float64Array:return new Qt;default:throw new Error("array type not supported")}}var fn;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(fn||(fn={}));function Lo(r){let t=r.data,e={};for(let n of t.schema.fields){let s=t.getChild(n.name)?.toArray();e[n.name]=s}return{shape:"columnar-table",schema:r.schema,data:e}}function Gn(r){return{fields:r.fields.map(t=>hn(t)),metadata:No(r.metadata)}}function Fu(r){return new E(r.fields.map(t=>dn(t)),Uo(r.metadata))}function No(r){return Object.fromEntries(r)}function Uo(r){return r?new Map(Object.entries(r)):new Map}function hn(r){return{name:r.name,type:Ja(r.type),nullable:r.nullable,metadata:No(r.metadata)}}function dn(r){return new D(r.name,Xa(r.type),r.nullable,Uo(r.metadata))}function Ja(r){switch(r.constructor){case ut:return"null";case ue:return"binary";case kt:return"bool";case it:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case ye:return"int8";case ge:return"int16";case pt:return"int32";case be:return"int64";case we:return"uint8";case _e:return"uint16";case ve:return"uint32";case Ze:return"uint64";case At:switch(r.precision){case j.HALF:return"float16";case j.SINGLE:return"float32";case j.DOUBLE:return"float64";default:return"float16"}case Br:return"float16";case Xt:return"float32";case Qt:return"float64";case Pt:return"utf8";case fe:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case qt:return r.unit===et.DAY?"date-day":"date-millisecond";case Pr:return"date-day";case cr:return"date-millisecond";case xt:switch(r.unit){case p.SECOND:return"time-second";case p.MILLISECOND:return"time-millisecond";case p.MICROSECOND:return"time-microsecond";case p.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Vr:return"time-millisecond";case kr:return"time-second";case jr:return"time-microsecond";case zr:return"time-nanosecond";case Nt:switch(r.unit){case p.SECOND:return"timestamp-second";case p.MILLISECOND:return"timestamp-millisecond";case p.MICROSECOND:return"timestamp-microsecond";case p.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Wr:return"timestamp-second";case Gr:return"timestamp-millisecond";case $r:return"timestamp-microsecond";case Hr:return"timestamp-nanosecond";case te:switch(r.unit){case nt.DAY_TIME:return"interval-daytime";case nt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Yr:return"interval-daytime";case Kr:return"interval-yearmonth";case jt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(b=>hn(b))};case Tt:let u=r.valueField;return{type:"list",children:[hn(u)]};case Vt:let h=r;return{type:"fixed-size-list",listSize:h.listSize,children:[hn(h.children[0])]};case V:return{type:"struct",children:r.children.map(b=>hn(b))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Xa(r){if(typeof r=="object")switch(r.type){case"decimal":return new fe(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>dn(i));return new jt(t,r.keysSorted);case"list":let e=dn(r.children[0]);return new Tt(e);case"fixed-size-list":let n=dn(r.children[0]);return new Vt(r.listSize,n);case"struct":return t=r.children.map(i=>dn(i)),new V(t);default:throw new Error("array type not supported")}switch(r){case"null":return new ut;case"binary":return new ue;case"bool":return new kt;case"int8":return new ye;case"int16":return new ge;case"int32":return new pt;case"int64":return new be;case"uint8":return new we;case"uint16":return new _e;case"uint32":return new ve;case"uint64":return new Ze;case"float16":return new Br;case"float32":return new Xt;case"float64":return new Qt;case"utf8":return new Pt;case"date-day":return new Pr;case"date-millisecond":return new cr;case"time-second":return new kr;case"time-millisecond":return new Vr;case"time-microsecond":return new jr;case"time-nanosecond":return new zr;case"timestamp-second":return new Wr;case"timestamp-millisecond":return new Gr;case"timestamp-microsecond":return new $r;case"timestamp-nanosecond":return new Hr;case"interval-daytime":return new Yr;case"interval-yearmonth":return new Kr;default:throw new Error("array type not supported")}}function zi(r,t){let e=ji([new Uint8Array(r)]),n={shape:"arrow-table",schema:Gn(e.schema),data:e},i=t?.shape||"arrow-table";switch(i){case"arrow-table":return n;case"columnar-table":return Lo(n);case"object-row-table":let s=Lo(n);return cs(s,"object-row-table");case"array-row-table":return s=Lo(n),cs(s,"array-row-table");default:throw new Error(i)}}function Eo(r,t){async function*e(){let n=bt.readAll(r);for await(let i of n){for await(let s 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 J([s]),length:s.data.length};break}}return e()}var fp="4.3.0-alpha.2",Wi={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:fp,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"}}},Mu={...Wi,parse:async(r,t)=>zi(r,t?.arrow),parseSync:(r,t)=>zi(r,t?.arrow),parseInBatches:Eo};function Qa(r){let t={};for(let i of r){let s=hp(i.array,i.type);t[i.name]=s}let e=new J(t);return Fo(e)}function hp(r,t){switch(t){case fn.DATE:return Ci(r);case fn.FLOAT:default:return Ci(r)}}var dp="4.3.0-alpha.2",Lu={name:"Apache Arrow",id:"arrow",module:"arrow",version:dp,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 Qa(t)},encodeSync(r,t){return Qa(r)}};var pp=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],mp="ARROW:extension:name",yp="ARROW:extension:metadata";function qa(r){let t={};for(let e of r.fields){let n=gp(e);n&&(t[e.name]=n)}return t}function gp(r){let t=null,e=r.metadata?.[mp];e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),pp.includes(e)?(t=t||{},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=r.metadata?.[yp];if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function Nr(r){return Nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(r)}function tc(r,t){if(Nr(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(Nr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function ec(r){var t=tc(r,"string");return Nr(t)==="symbol"?t:String(t)}function Ae(r,t,e){return t=ec(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var Gi={x:0,y:1,z:2};function Ro(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Gi[i[0]],c=Gi[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function nc(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=Uu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,b,M,z;if(s&&(a=Sp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],b=h=r[1];for(let X=e;X<o;X+=e)M=r[X],z=r[X+1],M<d&&(d=M),z<b&&(b=z),M>u&&(u=M),z>h&&(h=z);l=Math.max(u-d,h-b),l=l!==0?32767/l:0}return $i(a,c,e,d,b,l,0),c}function Uu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Ro(r,{start:t,end:e,size:n,plane:o}));let l=Gi[o[0]],u=Gi[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=Nu(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=Nu(a,r[a+l],r[a+u],c);return c&&ko(c,c.next)&&(Yi(c),c=c.next),c}function pn(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(ko(e,e.next)||ct(e.prev,e,e.next)===0)){if(Yi(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function $i(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Op(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?vp(r,n,i,s):_p(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Yi(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=Ip(pn(r),t,e),$i(r,t,e,n,i,s,2)):o===2&&xp(r,t,e,n,i,s):$i(pn(r),t,e,n,i,s,1);break}}}function _p(r){let t=r.prev,e=r,n=r.next;if(ct(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,b=a>c?a>l?a:l:c>l?c:l,M=n.next;for(;M!==t;){if(M.x>=u&&M.x<=d&&M.y>=h&&M.y<=b&&$n(i,a,s,c,o,l,M.x,M.y)&&ct(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function vp(r,t,e,n){let i=r.prev,s=r,o=r.next;if(ct(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,b=a<c?a<l?a:l:c<l?c:l,M=u<h?u<d?u:d:h<d?h:d,z=a>c?a>l?a:l:c>l?c:l,X=u>h?u>d?u:d:h>d?h:d,st=rc(b,M,t,e,n),yn=rc(z,X,t,e,n),W=r.prevZ,k=r.nextZ;for(;W&&W.z>=st&&k&&k.z<=yn;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&$n(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0||(W=W.prevZ,k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&$n(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;W&&W.z>=st;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&$n(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;k&&k.z<=yn;){if(k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&$n(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function Ip(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!ko(i,s)&&Eu(i,n,n.next,s)&&Hi(i,s)&&Hi(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Yi(n),Yi(n.next),n=r=s),n=n.next}while(n!==r);return pn(n)}function xp(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Lp(o,a)){let c=Ru(o,a);o=pn(o,o.next),c=pn(c,c.next),$i(o,t,e,n,i,s,0),$i(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function Sp(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=Uu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Mp(h));for(o.sort(Bp),a=0;a<o.length;a++)e=Ap(o[a],e);return e}function Bp(r,t){return r.x-t.x}function Ap(r,t){let e=Tp(r,t);if(!e)return t;let n=Ru(e,r);return pn(n,n.next),pn(e,e.next)}function Tp(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&$n(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Hi(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&Dp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function Dp(r,t){return ct(r.prev,r,t.prev)<0&&ct(t.next,r,r.next)<0}function Op(r,t,e,n){let i=r;do i.z===0&&(i.z=rc(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Fp(i)}function Fp(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function rc(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Mp(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function $n(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function Lp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Np(r,t)&&(Hi(r,t)&&Hi(t,r)&&Up(r,t)&&(ct(r.prev,r,t.prev)||ct(r,t.prev,t))||ko(r,t)&&ct(r.prev,r,r.next)>0&&ct(t.prev,t,t.next)>0)}function ct(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ko(r,t){return r.x===t.x&&r.y===t.y}function Eu(r,t,e,n){let i=Po(ct(r,t,e)),s=Po(ct(r,t,n)),o=Po(ct(e,n,r)),a=Po(ct(e,n,t));return!!(i!==s&&o!==a||i===0&&Co(r,e,t)||s===0&&Co(r,n,t)||o===0&&Co(e,r,n)||a===0&&Co(e,t,n))}function Co(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Po(r){return r>0?1:r<0?-1:0}function Np(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Eu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Hi(r,t){return ct(r.prev,r,r.next)<0?ct(r,t,r.next)>=0&&ct(r,r.prev,t)>=0:ct(r,t,r.prev)<0||ct(r,r.next,t)<0}function Up(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Ru(r,t){let e=new Ki(r.i,r.x,r.y),n=new Ki(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Nu(r,t,e,n){let i=new Ki(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Yi(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Ki=class{constructor(t,e,n){Ae(this,"i",void 0),Ae(this,"x",void 0),Ae(this,"y",void 0),Ae(this,"prev",null),Ae(this,"next",null),Ae(this,"z",0),Ae(this,"prevZ",null),Ae(this,"nextZ",null),Ae(this,"steiner",!1),this.i=t,this.x=e,this.y=n}};function Hn(r,t,e){switch(r.type){case"Point":return Vp(r,t,e);case"LineString":return kp(r,t,e);case"Polygon":return ku(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function ku(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),s=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1],d=Vo(n,u,h);c.push(d)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],u=i[c+1],h=ku(r,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function kp(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:Vo(n,i[0],i[1])};let o=[];for(let a=0;a<i.length-1;a++){let c=Vo(n,i[a],i[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function Vp(r,t,e){let{positions:n}=r,i=Vo(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Vo(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let s=Array();for(let o=i*r.size;o<(i+1)*r.size;o++)s.push(Number(r.value[o]));n.push(s)}return n}function jo(r){let t=r.data,e=Gn(t.schema),n=qa(e),i=n.geometry.encoding,s=[],o=t.schema.fields.map(l=>l.name).filter(l=>!(l in n)),a=t.select(o),c=t.getChild("geometry");for(let l=0;l<t.numRows;l++){let u=c?.get(l),h=zo(u,i);if(h){let d=a.get(l)?.toJSON()||{};s.push({type:"Feature",geometry:h,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:r.schema,features:s}}function ic(r,t){let e=zi(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return jo(e);default:return e}}function Vu(r){return Eo(r)}var sc={...Wi,options:{arrow:{shape:"arrow-table"}}},ju={...sc,parse:async(r,t)=>ic(r,t?.arrow),parseSync:(r,t)=>ic(r,t?.arrow),parseInBatches:Vu};function Wo(r,t,e,n=100){let i=r.length/t,s=Math.max(Math.floor(i/n),1),o=[...e];for(let a=0;a<i;a+=s){let c=r[a*t],l=r[a*t+1];c<o[0]&&(o[0]=c),l<o[1]&&(o[1]=l),c>o[2]&&(o[2]=c),l>o[3]&&(o[3]=l)}return o}var Yn;(function(r){r.points="points",r.lines="lines",r.polygons="polygons"})(Yn||(Yn={}));function Zi(){return{globalFeatureIds:{value:new Uint32Array(0),size:1},positions:{value:new Float32Array(0),size:2},properties:[],numericProps:{},featureIds:{value:new Uint32Array(0),size:1}}}function zu(r,t,e){let n={polygon:t==="geoarrow.multipolygon"||t==="geoarrow.polygon",point:t==="geoarrow.multipoint"||t==="geoarrow.point",line:t==="geoarrow.multilinestring"||t==="geoarrow.linestring"},i=e?.chunkIndex!==void 0&&e?.chunkIndex>=0?[r.data[e?.chunkIndex]]:r.data,s=[1/0,1/0,-1/0,-1/0],o=e?.chunkOffset||0,a=[];return i.forEach(c=>{let{featureIds:l,flatCoordinateArray:u,nDim:h,geomOffset:d,triangles:b}=zp(c,t,e),M=new Uint32Array(l.length);for(let X=0;X<l.length;X++)M[X]=l[X]+o;let z={globalFeatureIds:{value:M,size:1},positions:{value:u,size:h},featureIds:{value:l,size:1},properties:[...Array(c.length).keys()].map(X=>({index:X+o}))};o+=c.length,a.push({shape:"binary-feature-collection",points:{type:"Point",...Zi(),...n.point?z:{}},lines:{type:"LineString",...Zi(),...n.line?z:{},pathIndices:{value:n.line?d:new Uint16Array(0),size:1}},polygons:{type:"Polygon",...Zi(),...n.polygon?z:{},polygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},primitivePolygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},...b?{triangles:{value:b,size:1}}:{}}}),s=Wo(u,h,s)}),{binaryGeometries:a,bounds:s,featureTypes:n,...e?.calculateMeanCenters?{meanCenters:oc(a)}:{}}}function oc(r){let t=[];return r.forEach(e=>{let n=null;e.points&&e.points.positions.value.length>0?n=Yn.points:e.lines&&e.lines.positions.value.length>0?n=Yn.lines:e.polygons&&e.polygons.positions.value.length>0&&(n=Yn.polygons);let i=n?e[n]:null;if(i&&n!==null){let s=i.featureIds.value,o=i.positions.value,a=i.positions.size,c=i.type==="Polygon"?i.primitivePolygonIndices?.value:void 0;jp(s,o,a,n,c).forEach(u=>{t.push(u)})}}),t}function jp(r,t,e,n,i){let s=[],o=t.length,a=0,c=0,l=0;for(;a<o;){let u=r[a/e],h=[0,0],d=0;for(;a<o&&r[c]===u;)n===Yn.polygons&&i?.[l]===c?(a+=e,l++):(h[0]+=t[a],h[1]+=t[a+1],a+=e,d++),c+=1;h[0]/=d,h[1]/=d,s.push(h)}return s}function zp(r,t,e){switch(t){case"geoarrow.point":case"geoarrow.multipoint":return $p(r,t);case"geoarrow.linestring":case"geoarrow.multilinestring":return Gp(r,t);case"geoarrow.polygon":case"geoarrow.multipolygon":return Wp(r,t,e);default:throw Error("invalid geoarrow encoding")}}function ac(r,t,e,n){try{let i=0,s=[];for(let a=0;a<r.length-1;a++){let c=r[a],l=r[a+1],u=e.subarray(c*n,l*n),h=[];for(;t[i]<l;)t[i]>c&&h.push(t[i]-c),i++;let d=nc(u,h.length>0?h:void 0,n);if(d.length===0)throw Error("earcut failed e.g. invalid polygon");for(let b=0;b<d.length;b++)s.push(d[b]+c)}let o=new Uint32Array(s.length);for(let a=0;a<s.length;a++)o[a]=s[a];return o}catch{return null}}function Wp(r,t,e){let n=t==="geoarrow.multipolygon",i=n?r.children[0]:r,s=i.valueOffsets,o=n?r.valueOffsets.map(st=>s.at(st)||st):r.valueOffsets,a=i.children[0],c=a.children[0],l=c.children[0],u=c.stride,h=a.valueOffsets,d=l.values,b=new Uint16Array(s.length);for(let st=0;st<s.length;st++)b[st]=h[s[st]];let M=d.length/u,z=new Uint32Array(M);for(let st=0;st<o.length-1;st++){let yn=h[o[st]],W=h[o[st+1]];for(let k=yn;k<W;k++)z[k]=st}let X=e?.triangulate?ac(b,h,d,u):null;return{featureIds:z,nDim:u,flatCoordinateArray:d,geomOffset:h,geometryIndicies:b,...e?.triangulate&&X?{triangles:X}:{}}}function Gp(r,t){let e=t==="geoarrow.multilinestring",n=e?r.children[0]:r,i=n.children[0],s=i.children[0],o=i.stride,a=n.valueOffsets,c=s.values,l=new Uint16Array(0),u=c.length/o,h=new Uint32Array(u);if(e){let d=r.valueOffsets;for(let b=0;b<d.length-1;b++){let M=a[d[b]],z=a[d[b+1]];for(let X=M;X<z;X++)h[X]=b}}else for(let d=0;d<r.length;d++){let b=a[d],M=a[d+1];for(let z=b;z<M;z++)h[z]=d}return{featureIds:h,flatCoordinateArray:c,nDim:o,geomOffset:a,geometryIndicies:l}}function $p(r,t){let e=t==="geoarrow.multipoint",n=e?r.children[0]:r,i=n.children[0],s=n.stride,o=i.values,a=new Uint16Array(0),c=new Int32Array(0),l=o.length/s,u=new Uint32Array(l);if(e){let h=r.valueOffsets;for(let d=0;d<h.length-1;d++){let b=h[d],M=h[d+1];for(let z=b;z<M;z++)u[z]=d}}else for(let h=0;h<r.length;h++)u[h]=h;return{featureIds:u,flatCoordinateArray:o,nDim:s,geomOffset:c,geometryIndicies:a}}var Go="4.3.0-alpha.2";var Wu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Gu=new RegExp("^"+Wu.source+"(\\s"+Wu.source+"){1,}"),cc=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("];function $u(r){return cc.some(t=>r.startsWith(t))}function lc(r,t){return Hp(r,t)}function Hp(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),o=Hu({parts:e,_:n,i:0});return t?.wkt?.crs?Yp(o,i):o}function Hu(r){return Kp(r)||Jp(r)||Qp(r)||Zp(r)||Xp(r)||qp(r)||tm(r)}function Yp(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 Kp(r){if(!ht(/^(POINT(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Yu(r);return!t||(Wt(r),!ht(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function Zp(r){if(!ht(/^(MULTIPOINT)/i,r))return null;Wt(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=$o(r);return e?(Wt(r),{type:"MultiPoint",coordinates:e}):null}function Jp(r){if(!ht(/^(LINESTRING(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Yu(r);return!t||!ht(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function Xp(r){if(!ht(/^(MULTILINESTRING)/i,r))return null;Wt(r);let t=$o(r);return t?(Wt(r),{type:"MultiLineString",coordinates:t}):null}function Qp(r){if(!ht(/^(POLYGON(\sz)?)/i,r))return null;Wt(r);let t=$o(r);return t?{type:"Polygon",coordinates:t}:null}function qp(r){if(!ht(/^(MULTIPOLYGON)/i,r))return null;Wt(r);let t=$o(r);return t?{type:"MultiPolygon",coordinates:t}:null}function tm(r){let t=[],e;if(!ht(/^(GEOMETRYCOLLECTION)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;for(;e=Hu(r);)t.push(e),Wt(r),ht(/^(,)/,r),Wt(r);return ht(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function $o(r){Wt(r);let t=0,e=[],n=[e],i=e,s;for(;s=ht(/^(\()/,r)||ht(/^(\))/,r)||ht(/^(,)/,r)||ht(Gu,r);){if(s==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(s===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(s===",")i=[],n[n.length-1].push(i);else if(!s.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,s.split(/\s/g).map(parseFloat));else return null;Wt(r)}return t!==0?null:e}function Yu(r){let t=[],e,n;for(;n=ht(Gu,r)||ht(/^(,)/,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))),Wt(r);if(e)t.push(e);else return null;return t.length?t:null}function ht(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Wt(r){ht(/^\s*/,r)}var Ku={dataType:null,batchType:null,name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:Go,worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,tests:cc,testText:$u,options:{wkt:{shape:"geojson-geometry",crs:!0}}},uc={...Ku,parse:async(r,t)=>lc(new TextDecoder().decode(r),t),parseTextSync:(r,t)=>lc(r,t)};var vr;(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"})(vr||(vr={}));function Zu(r){let t=new DataView(r),e=0,n=t.getUint8(e);if(e+=1,n>1)return!1;let i=n===1,s=t.getUint32(e,i);e+=4;let o=s&7;if(o===0||o>7)return!1;let a=s-o;if(a===0||a===1e3||a===2e3||a===3e3)return!0;if(a&536870911)return!1;if(a&536870912){let c=t.getUint32(e,i);if(e+=4,c>1e4)return!1}return!0}function Ju(r,t){let e=Object.assign(t||{},{type:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});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.type="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.type="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.type="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let s=n&2147483648,o=n&1073741824,a=n&536870912;return s&&o?(e.type="ewkb",e.dimensions=4,e.coordinates="xyzm"):s?(e.type="ewkb",e.dimensions=3,e.coordinates="xyz"):o&&(e.type="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.type="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function fc(r,t){let e=em(r,t),n=t?.wkb?.shape||"binary-geometry";switch(n){case"binary-geometry":return e;case"geojson-geometry":return Hn(e);case"geometry":return console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead'),Hn(e);default:throw new Error(n)}}function em(r,t){let e=new DataView(r),n=Ju(e),{geometryType:i,dimensions:s,littleEndian:o}=n,a=n.byteOffset;switch(i){case vr.Point:return Xu(e,a,s,o).geometry;case vr.LineString:return hc(e,a,s,o).geometry;case vr.Polygon:return Qu(e,a,s,o).geometry;case vr.MultiPoint:let h=rm(e,a,s,o);return h.type="Point",h;case vr.MultiLineString:let d=nm(e,a,s,o);return d.type="LineString",d;case vr.MultiPolygon:let b=im(e,a,s,o);return b.type="Polygon",b;default:throw new Error(`WKB: Unsupported geometry type: ${i}`)}}function Xu(r,t,e,n){let i=new Float64Array(e);for(let s=0;s<e;s++)i[s]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function hc(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=new Float64Array(i*e);for(let a=0;a<i*e;a++)s[a]=r.getFloat64(t,n),t+=8;let o=[0];return i>0&&o.push(i),{geometry:{type:"LineString",positions:{value:s,size:e},pathIndices:{value:new Uint32Array(o),size:1}},offset:t}}var dc=r=>t=>r+=t;function Qu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let l=0;l<i;l++){let u=hc(r,t,e,n),{positions:h}=u.geometry;t=u.offset,s.push(h.value)}let o=new Float64Array(Ho(s).buffer),a=[0];o.length>0&&a.push(o.length/e);let c=s.map(l=>l.length/e).map(dc(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:o,size:e},polygonIndices:{value:new Uint32Array(a),size:1},primitivePolygonIndices:{value:new Uint32Array(c),size:1}},offset:t}}function rm(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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,s.push(c.geometry)}return sm(s,e)}function nm(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=hc(r,t,e,a);t=c.offset,s.push(c.geometry)}return om(s,e)}function im(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=Qu(r,t,e,a);t=c.offset,s.push(c.geometry)}return am(s,e)}function sm(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(Ho(e).buffer),size:t}}}function om(r,t){let e=r.map(s=>s.positions.value),n=new Float64Array(Ho(e).buffer),i=e.map(s=>s.length/t).map(dc(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function am(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(Ho(e).buffer),s=e.map(a=>a.length/t).map(dc(0));s.unshift(0);let o=[0];for(let a of n)o.push(...a.filter(c=>c>0).map(c=>c+o[o.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(s),size:1},primitivePolygonIndices:{value:new Uint32Array(o),size:1}}}function Ho(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 s=new Uint8Array(r[i].buffer);t=s.length;for(let o=0;o<t;++o)e[n++]=s[o]}return e}var qu={dataType:null,batchType:null,name:"WKB",id:"wkb",module:"wkt",version:Go,worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],tests:[Zu],options:{wkb:{shape:"binary-geometry"}}},pc={...qu,parse:async r=>fc(r),parseSync:fc};function zo(r,t){if(t=t?.toLowerCase(),!t||!r)return null;let e;switch(t){case"geoarrow.multipolygon":e=um(r);break;case"geoarrow.polygon":e=fm(r);break;case"geoarrow.multipoint":e=hm(r);break;case"geoarrow.point":e=dm(r);break;case"geoarrow.multilinestring":e=pm(r);break;case"geoarrow.linestring":e=mm(r);break;case"geoarrow.wkb":e=cm(r);break;case"geoarrow.wkt":e=lm(r);break;default:throw Error(`GeoArrow encoding not supported ${t}`)}return e}function cm(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),e=pc.parseSync?.(t);return Hn(e)}function lm(r){let t=r;return uc.parseTextSync?.(t)}function um(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i?.length;o++){let a=i?.get(o),c=[];for(let l=0;a&&l<a.length;l++){let u=a.get(l),h=Array.from(u);c.push(h)}s.push(c)}t.push(s)}return{type:"MultiPolygon",coordinates:t}}function fm(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i.length;o++){let a=i.get(o),c=Array.from(a);s.push(c)}t.push(s)}return{type:"Polygon",coordinates:t}}function hm(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 dm(r){return{type:"Point",coordinates:Array.from(r)}}function pm(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let s=0;n&&s<n.length;s++){let o=n.get(s);if(o){let a=Array.from(o);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function mm(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 Ji(r,t=!1){if("data"in r)return new g(r.data.map(s=>Ji(s,t)));let e=[];for(let s of r.children)e.push(Ji(s,t));let n;r.dictionary!==void 0&&(n=Ji(r.dictionary,t));let i={[lt.OFFSET]:Yo(r.buffers[lt.OFFSET],t),[lt.DATA]:Yo(r.buffers[lt.DATA],t),[lt.VALIDITY]:Yo(r.buffers[lt.VALIDITY],t),[lt.TYPE]:Yo(r.buffers[lt.TYPE],t)};return new R(r.type,r.offset,r.length,r._nullCount,i,e,n)}function ym(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function Yo(r,t){return r===void 0||!t&&!ym(r)?r:r.slice()}var tf="latest";function gm(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.0-alpha.2"),globalThis._loadersgl_.version}var mc=gm();function sr(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var or={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},cA=or.self||or.window||or.global||{},lA=or.window||or.self||or.global||{},uA=or.global||or.self||or.window||{},fA=or.document||{};var Ir=typeof process!="object"||String(process)!=="[object process]"||process.browser;var rf=typeof window<"u"&&typeof window.orientation<"u",ef=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),hA=ef&&parseFloat(ef[1])||0;var Xi=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){sr(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){sr(this.isRunning),this.isRunning=!1,this._reject(t)}};var Kn=class{terminate(){}};var yc=new Map;function nf(r){sr(r.source&&!r.url||!r.source&&r.url);let t=yc.get(r.source||r.url);return t||(r.url&&(t=bm(r.url),yc.set(r.url,t)),r.source&&(t=sf(r.source),yc.set(r.source,t))),sr(t),t}function bm(r){if(!r.startsWith("http"))return r;let t=wm(r);return sf(t)}function sf(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function wm(r){return`try {
|
|
16
|
+
]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new J(e,n.map(i=>new Y(e,i)))}slice(t,e){let n=this.schema;[t,e]=oi({length:this.numRows},t,e);let i=Ws(this.data,this._offsets,t,e);return new J(n,i.map(s=>new Y(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=w({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new g(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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[n,i]=wo(n,a)}return new J(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new J(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,h]=a,d=e.findIndex(b=>b.name===c.name);return~d?h[d]=l:u.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...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 J(...wo(s,o))}};iu=Symbol.toStringTag;J[iu]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=On(li),r.get=On(mt.getVisitFn(f.Struct)),r.set=Gs(Dt.getVisitFn(f.Struct)),r.indexOf=$s(qr.getVisitFn(f.Struct)),"Table"))(J.prototype);var ou,Y=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof E))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=w({nullCount:0,type:new V(this.schema.fields),children:this.schema.fields.map(e=>w({type:e.type,nullCount:0}))})]=t,!(this.data instanceof R))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=su(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=D.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new E(n),a=w({type:new V(n),length:s,children:i,nullCount:0});[this.schema,this.data]=su(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=au(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 mt.visit(this.data,t)}set(t,e){return Dt.visit(this.data,t,e)}indexOf(t,e){return qr.visit(this.data,t,e)}[Symbol.iterator](){return Fn.visit(new g([this.data]))}toArray(){return[...this]}concat(...t){return new J(this.schema,[this,...t])}slice(t,e){let[n]=new g([this.data]).slice(t,e).data;return new Y(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 g([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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new E(s,new Map(this.schema.metadata)),i=w({type:new V(s),children:o})}return new Y(n,i)}select(t){let e=this.schema.select(t),n=new V(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new Y(e,w({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=w({type:new V(e.fields),length:this.numRows,children:n});return new Y(e,i)}};ou=Symbol.toStringTag;Y[ou]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Y.prototype);function su(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),s[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:w({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),w({type:new V(i),length:e,children:s})]}function au(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 s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])au(a.children,l?.children,e);if(m.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 cn=class extends Y{constructor(t){let e=t.fields.map(i=>w({type:i.type})),n=w({type:new V(t.fields),nullCount:0,children:e});super(t,n)}};var ft=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 ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new ft).__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):$.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):P.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 Q).__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,$.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,P.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,s,o){return ft.startMessage(t),ft.addVersion(t,e),ft.addHeaderType(t,n),ft.addHeader(t,i),ft.addBodyLength(t,s),ft.addCustomMetadata(t,o),ft.endMessage(t)}};var Ca=class extends v{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return He.startNull(e),He.endNull(e)}visitInt(t,e){return _t.startInt(e),_t.addBitWidth(e,t.bitWidth),_t.addIsSigned(e,t.isSigned),_t.endInt(e)}visitFloat(t,e){return Kt.startFloatingPoint(e),Kt.addPrecision(e,t.precision),Kt.endFloatingPoint(e)}visitBinary(t,e){return je.startBinary(e),je.endBinary(e)}visitLargeBinary(t,e){return We.startLargeBinary(e),We.endLargeBinary(e)}visitBool(t,e){return ze.startBool(e),ze.endBool(e)}visitUtf8(t,e){return Ke.startUtf8(e),Ke.endUtf8(e)}visitLargeUtf8(t,e){return Ge.startLargeUtf8(e),Ge.endLargeUtf8(e)}visitDecimal(t,e){return vt.startDecimal(e),vt.addScale(e,t.scale),vt.addPrecision(e,t.precision),vt.addBitWidth(e,t.bitWidth),vt.endDecimal(e)}visitDate(t,e){return Gt.startDate(e),Gt.addUnit(e,t.unit),Gt.endDate(e)}visitTime(t,e){return Mt.startTime(e),Mt.addUnit(e,t.unit),Mt.addBitWidth(e,t.bitWidth),Mt.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Lt.startTimestamp(e),Lt.addUnit(e,t.unit),n!==void 0&&Lt.addTimezone(e,n),Lt.endTimestamp(e)}visitInterval(t,e){return Zt.startInterval(e),Zt.addUnit(e,t.unit),Zt.endInterval(e)}visitDuration(t,e){return $t.startDuration(e),$t.addUnit(e,t.unit),$t.endDuration(e)}visitList(t,e){return $e.startList(e),$e.endList(e)}visitStruct(t,e){return Ye.startStruct_(e),Ye.endStruct_(e)}visitUnion(t,e){It.startTypeIdsVector(e,t.typeIds.length);let n=It.createTypeIdsVector(e,t.typeIds);return It.startUnion(e),It.addMode(e,t.mode),It.addTypeIds(e,n),It.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return le.startDictionaryEncoding(e),le.addId(e,BigInt(t.id)),le.addIsOrdered(e,t.isOrdered),n!==void 0&&le.addIndexType(e,n),le.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Ht.startFixedSizeBinary(e),Ht.addByteWidth(e,t.byteWidth),Ht.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Yt.startFixedSizeList(e),Yt.addListSize(e,t.listSize),Yt.endFixedSizeList(e)}visitMap(t,e){return Jt.startMap(e),Jt.addKeysSorted(e,t.keysSorted),Jt.endMap(e)}},_o=new Ca;function fu(r,t=new Map){return new E(vd(r,t),vo(r.metadata),t)}function Pa(r){return new Ot(r.count,du(r.columns),pu(r.columns))}function hu(r){return new se(Pa(r.data),r.id,r.isDelta)}function vd(r,t){return(r.fields||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function cu(r,t){return(r.children||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function du(r){return(r||[]).reduce((t,e)=>[...t,new Be(e.count,Id(e.VALIDITY)),...du(e.children)],[])}function pu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ie(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ie(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ie(t.length,i.OFFSET.length)),i.DATA&&t.push(new ie(t.length,i.DATA.length)),t=pu(i.children,t)}return t}function Id(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function mu(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=uu(r,cu(r,t)),i=new D(r.name,o,r.nullable,vo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?lu(n):new pt,a=new Ut(t.get(e),n,e,s.isOrdered),i=new D(r.name,a,r.nullable,vo(r.metadata))):(n=(n=s.indexType)?lu(n):new pt,t.set(e,o=uu(r,cu(r,t))),a=new Ut(o,n,e,s.isOrdered),i=new D(r.name,a,r.nullable,vo(r.metadata))),i||null}function vo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function lu(r){return new it(r.isSigned,r.bitWidth)}function uu(r,t){let e=r.type.name;switch(e){case"NONE":return new ut;case"null":return new ut;case"binary":return new ue;case"largebinary":return new Je;case"utf8":return new Pt;case"largeutf8":return new Xe;case"bool":return new kt;case"list":return new Tt((t||[])[0]);case"struct":return new V(t||[]);case"struct_":return new V(t||[])}switch(e){case"int":{let n=r.type;return new it(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new At(j[n.precision])}case"decimal":{let n=r.type;return new fe(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new qt(et[n.unit])}case"time":{let n=r.type;return new xt(p[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Nt(p[n.unit],n.timezone)}case"interval":{let n=r.type;return new te(nt[n.unit])}case"duration":{let n=r.type;return new Qe(p[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Ie(K[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new qe(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Vt(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new jt((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var xd=ar,Sd=Ct,gt=class{static fromJSON(t,e){let n=new gt(0,$.V5,e);return n._createHeader=Bd(t,e),n}static decode(t){t=new Sd(T(t));let e=ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new gt(n,i,s);return o._createHeader=Ad(e,s),o}static encode(t){let e=new xd,n=-1;return t.isSchema()?n=E.encode(e,t.header()):t.isRecordBatch()?n=Ot.encode(e,t.header()):t.isDictionaryBatch()&&(n=se.encode(e,t.header())),ft.startMessage(e),ft.addVersion(e,$.V5),ft.addHeader(e,n),ft.addHeaderType(e,t.headerType),ft.addBodyLength(e,BigInt(t.bodyLength)),ft.finishMessageBuffer(e,ft.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof E)return new gt(0,$.V5,P.Schema,t);if(t instanceof Ot)return new gt(e,$.V5,P.RecordBatch,t);if(t instanceof se)return new gt(e,$.V5,P.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===P.Schema}isRecordBatch(){return this.headerType===P.RecordBatch}isDictionaryBatch(){return this.headerType===P.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=at(t)}},Ot=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=at(t)}},se=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=at(e)}},ie=class{constructor(t,e){this.offset=at(t),this.length=at(e)}},Be=class{constructor(t,e){this.length=at(t),this.nullCount=at(e)}};function Bd(r,t){return()=>{switch(t){case P.Schema:return E.fromJSON(r);case P.RecordBatch:return Ot.fromJSON(r);case P.DictionaryBatch:return se.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}function Ad(r,t){return()=>{switch(t){case P.Schema:return E.decode(r.header(new ot),new Map,r.version());case P.RecordBatch:return Ot.decode(r.header(new Ft),r.version());case P.DictionaryBatch:return se.decode(r.header(new me),r.version())}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}D.encode=Cd;D.decode=Ed;D.fromJSON=mu;E.encode=Rd;E.decode=Td;E.fromJSON=fu;Ot.encode=Pd;Ot.decode=Dd;Ot.fromJSON=Pa;se.encode=kd;se.decode=Od;se.fromJSON=hu;Be.encode=Vd;Be.decode=Md;ie.encode=jd;ie.decode=Fd;function Td(r,t=new Map,e=$.V5){let n=Ud(r,t);return new E(n,Io(r),t,e)}function Dd(r,t=$.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Ot(r.length(),Ld(r),Nd(r,t))}function Od(r,t=$.V5){return new se(Ot.decode(r.data(),t),r.id(),r.isDelta())}function Fd(r){return new ie(r.offset(),r.length())}function Md(r){return new Be(r.length(),r.nullCount())}function Ld(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Be.decode(e));return t}function Nd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<$.V4&&(n.bb_pos+=8*(i+1)),e[++s]=ie.decode(n));return e}function Ud(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=D.decode(n,t));return e}function yu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=D.decode(n,t));return e}function Ed(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=bu(r,yu(r,t)),n=new D(r.name(),i,r.nullable(),Io(r))):t.has(e=at(a.id()))?(s=(s=a.indexType())?gu(s):new pt,o=new Ut(t.get(e),s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),Io(r))):(s=(s=a.indexType())?gu(s):new pt,t.set(e,i=bu(r,yu(r,t))),o=new Ut(i,s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),Io(r))),n||null}function Io(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function gu(r){return new it(r.isSigned(),r.bitWidth())}function bu(r,t){let e=r.typeType();switch(e){case Z.NONE:return new ut;case Z.Null:return new ut;case Z.Binary:return new ue;case Z.LargeBinary:return new Je;case Z.Utf8:return new Pt;case Z.LargeUtf8:return new Xe;case Z.Bool:return new kt;case Z.List:return new Tt((t||[])[0]);case Z.Struct_:return new V(t||[])}switch(e){case Z.Int:{let n=r.type(new _t);return new it(n.isSigned(),n.bitWidth())}case Z.FloatingPoint:{let n=r.type(new Kt);return new At(n.precision())}case Z.Decimal:{let n=r.type(new vt);return new fe(n.scale(),n.precision(),n.bitWidth())}case Z.Date:{let n=r.type(new Gt);return new qt(n.unit())}case Z.Time:{let n=r.type(new Mt);return new xt(n.unit(),n.bitWidth())}case Z.Timestamp:{let n=r.type(new Lt);return new Nt(n.unit(),n.timezone())}case Z.Interval:{let n=r.type(new Zt);return new te(n.unit())}case Z.Duration:{let n=r.type(new $t);return new Qe(n.unit())}case Z.Union:{let n=r.type(new It);return new Ie(n.mode(),n.typeIdsArray()||[],t||[])}case Z.FixedSizeBinary:{let n=r.type(new Ht);return new qe(n.byteWidth())}case Z.FixedSizeList:{let n=r.type(new Yt);return new Vt(n.listSize(),(t||[])[0])}case Z.Map:{let n=r.type(new Jt);return new jt((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Z[e]}" (${e})`)}function Rd(r,t){let e=t.fields.map(s=>D.encode(r,s));ot.startFieldsVector(r,e.length);let n=ot.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?ot.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return Q.startKeyValue(r),Q.addKey(r,a),Q.addValue(r,c),Q.endKeyValue(r)})):-1;return ot.startSchema(r),ot.addFields(r,n),ot.addEndianness(r,zd?Sr.Little:Sr.Big),i!==-1&&ot.addCustomMetadata(r,i),ot.endSchema(r)}function Cd(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;m.isDictionary(s)?(o=s.dictionary.typeId,i=_o.visit(s,r),n=_o.visit(s.dictionary,r)):n=_o.visit(s,r);let a=(s.children||[]).map(u=>D.encode(r,u)),c=dt.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?dt.createCustomMetadataVector(r,[...t.metadata].map(([u,h])=>{let d=r.createString(`${u}`),b=r.createString(`${h}`);return Q.startKeyValue(r),Q.addKey(r,d),Q.addValue(r,b),Q.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),dt.startField(r),dt.addType(r,n),dt.addTypeType(r,o),dt.addChildren(r,c),dt.addNullable(r,!!t.nullable),e!==-1&&dt.addName(r,e),i!==-1&&dt.addDictionary(r,i),l!==-1&&dt.addCustomMetadata(r,l),dt.endField(r)}function Pd(r,t){let e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(r,e.length);for(let o of e.slice().reverse())Be.encode(r,o);let i=r.endVector();Ft.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ie.encode(r,o);let s=r.endVector();return Ft.startRecordBatch(r),Ft.addLength(r,BigInt(t.length)),Ft.addNodes(r,i),Ft.addBuffers(r,s),Ft.endRecordBatch(r)}function kd(r,t){let e=Ot.encode(r,t.data);return me.startDictionaryBatch(r),me.addId(r,BigInt(t.id)),me.addIsDelta(r,t.isDelta),me.addData(r,e),me.endDictionaryBatch(r)}function Vd(r,t){return vn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function jd(r,t){return _n.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var zd=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Va=r=>`Expected ${P[r]} Message in stream, but was null or length 0.`,ja=r=>`Header pointer of flatbuffer-encoded ${P[r]} Message is null or length 0.`,wu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,_u=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,kn=class{constructor(t){this.source=t instanceof rr?t:new rr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?q:t.value===-1&&(t=this.readMetadataLength()).done?q:(t=this.readMetadata(t.value)).done?q: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(Va(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=T(this.source.read(t));if(e.byteLength<t)throw new Error(_u(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=P.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(ja(e));return i}readMetadataLength(){let t=this.source.read(xo),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(wu(t,e.byteLength));return{done:!1,value:gt.decode(e)}}},Pi=class{constructor(t,e){this.source=t instanceof re?t:fs(t)?new Fr(t,e):new re(t)}[Symbol.asyncIterator](){return this}next(){return y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?q:t.value===-1&&(t=yield this.readMetadataLength()).done?q:(t=yield this.readMetadata(t.value)).done?q:t})}throw(t){return y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return y(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(Va(t));return e.value})}readMessageBody(t){return y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=T(yield this.source.read(t));if(e.byteLength<t)throw new Error(_u(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return y(this,void 0,void 0,function*(){let e=P.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(ja(e));return i})}readMetadataLength(){return y(this,void 0,void 0,function*(){let t=yield this.source.read(xo),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return y(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(wu(t,e.byteLength));return{done:!1,value:gt.decode(e)}})}},ki=class extends kn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ui?t:new ui(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gt.fromJSON(t.schema,P.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:gt.fromJSON(e,P.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:gt.fromJSON(e,P.RecordBatch)}}return this._body=[],q}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Va(t));return e.value}readSchema(){let t=P.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(ja(t));return n}},xo=4,ka="ARROW1",Vn=new Uint8Array(ka.length);for(let r=0;r<ka.length;r+=1)Vn[r]=ka.codePointAt(r);function So(r,t=0){for(let e=-1,n=Vn.length;++e<n;)if(Vn[e]!==r[t+e])return!1;return!0}var jn=Vn.length,za=jn+xo,vu=jn*2+xo;var bt=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 ae(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 bt?t:ls(t)?Gd(t):fs(t)?Yd(t):ae(t)?(()=>y(this,void 0,void 0,function*(){return yield bt.from(yield t)}))():hs(t)||Qn(t)||ps(t)||de(t)?Hd(new re(t)):$d(new rr(t))}static readAll(t){return t instanceof bt?t.isSync()?Iu(t):xu(t):ls(t)||ArrayBuffer.isView(t)||De(t)||us(t)?Iu(t):xu(t)}},ir=class extends bt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oe(this,arguments,function*(){yield U(yield*bn(Te(this[Symbol.iterator]())))})}},Mr=class extends bt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return y(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=Te(this),c;c=yield a.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let l=i;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Lr=class extends ir{constructor(t){super(t),this._impl=t}},Vi=class extends Mr{constructor(t){super(t),this._impl=t}},Bo=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=w({type:new V(this.schema.fields),length:t.length,children:n});return new Y(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n);if(i||!a){let c=o.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new g(l)):new g(l)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new di(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},zn=class extends Bo{constructor(t,e){super(e),this._reader=ls(t)?new ki(this._handle=t):new kn(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=Su(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):q}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):q}next(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Wn=class extends Bo{constructor(t,e){super(e),this._reader=new Pi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return y(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 y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Su(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):q})}return(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):q})}next(){return y(this,void 0,void 0,function*(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Ao=class extends zn{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 fi?t:new fi(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(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-za,n=t.readInt32(e),i=t.readAt(e-n,n);return fr.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}},Wa=class extends Wn{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 Fr?t:new Fr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return y(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return y(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-za,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return fr.decode(i)})}_readNextMessageAndValidate(t){return y(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})}},Ga=class extends zn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Ks(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Su(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Iu(r){let t=bt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function xu(r){return oe(this,arguments,function*(){let e=yield U(bt.from(r));try{if(!(yield U(e.open({autoDestroy:!1}))).closed)do yield yield U(e);while(!(yield U(e.reset().open())).closed)}finally{yield U(e.cancel())}})}function Gd(r){return new ir(new Ga(r))}function $d(r){let t=r.peek(jn+7&-8);return t&&t.byteLength>=4?So(t)?new Lr(new Ao(r.read())):new ir(new zn(r)):new ir(new zn(function*(){}()))}function Hd(r){return y(this,void 0,void 0,function*(){let t=yield r.peek(jn+7&-8);return t&&t.byteLength>=4?So(t)?new Lr(new Ao(yield r.read())):new Mr(new Wn(r)):new Mr(new Wn(function(){return oe(this,arguments,function*(){})}()))})}function Yd(r){return y(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Fr(r,t);return t>=vu&&So(yield e.readAt(0,jn+7&-8))?new Vi(new Wa(e)):new Mr(new Wn(e))})}var tt=class extends v{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Y?s.data.children:s.data),n=new tt;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof g)return this.visitMany(t.data),this;let{type:e}=t;if(!m.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(m.isUnion(e))this.nodes.push(new Be(n,0));else{let{nullCount:i}=t;m.isNull(e)||Ce.call(this,i<=0?new Uint8Array(0):Jr(t.offset,n,t.nullBitmap)),this.nodes.push(new Be(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 Ce(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ie(this._byteLength,t)),this._byteLength+=t,this}function Kd(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Ce.call(this,i),e.mode===K.Sparse)return $a.call(this,r);if(e.mode===K.Dense){if(r.offset<=0)return Ce.call(this,s),$a.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,h=-1;++h<n;)(l=i[h])!==void 0&&((u=a[l])===void 0&&(u=a[l]=s[h]),o[h]=s[h]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Ce.call(this,o),this.visitMany(r.children.map((l,u)=>{let h=e.typeIds[u],d=a[h],b=c[h];return l.slice(d,Math.min(n,b))}))}}return this}function Zd(r){let t;return r.nullCount>=r.length?Ce.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ce.call(this,Jr(r.offset,r.length,t)):Ce.call(this,Xr(r.values))}function br(r){return Ce.call(this,r.values.subarray(0,r.length*r.stride))}function To(r){let{length:t,values:e,valueOffsets:n}=r,i=at(n[0]),s=at(n[t]),o=Math.min(s-i,e.byteLength-i);return Ce.call(this,ys(-i,t+1,n)),Ce.call(this,e.subarray(i,i+o)),this}function Ha(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Ce.call(this,ys(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function $a(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}tt.prototype.visitBool=Zd;tt.prototype.visitInt=br;tt.prototype.visitFloat=br;tt.prototype.visitUtf8=To;tt.prototype.visitLargeUtf8=To;tt.prototype.visitBinary=To;tt.prototype.visitLargeBinary=To;tt.prototype.visitFixedSizeBinary=br;tt.prototype.visitDate=br;tt.prototype.visitTimestamp=br;tt.prototype.visitTime=br;tt.prototype.visitDecimal=br;tt.prototype.visitList=Ha;tt.prototype.visitStruct=$a;tt.prototype.visitUnion=Kd;tt.prototype.visitInterval=br;tt.prototype.visitDuration=br;tt.prototype.visitFixedSizeList=Ha;tt.prototype.visitMap=Ha;var ln=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){super(),this._position=0,this._started=!1,this._sink=new er,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Rt(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 ae(t)?t.then(e=>this.writeAll(e)):de(t)?Ka(this,t):Ya(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 er?this._sink=t:(this._sink=new er,t&&Pc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&kc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!an(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof J&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Y&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!an(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Y?t instanceof cn||this._writeRecordBatch(t):t instanceof J?this.writeAll(t.batches):De(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=gt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===P.RecordBatch?this._recordBatchBlocks.push(new Re(a,t.bodyLength,this._position)):t.headerType===P.DictionaryBatch&&this._dictionaryBlocks.push(new Re(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=T(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(gt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Vn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=tt.assemble(t),o=new Ot(t.numRows,n,i),a=gt.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=tt.assemble(new g([t])),c=new Ot(t.length,s,o),l=new se(c,e,n),u=gt.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n?.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},wr=class extends ln{static writeAll(t,e){let n=new wr(e);return ae(t)?t.then(i=>n.writeAll(i)):de(t)?Ka(n,t):Ya(n,t)}},_r=class extends ln{static writeAll(t){let e=new _r;return ae(t)?t.then(n=>e.writeAll(n)):de(t)?Ka(e,t):Ya(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=fr.encode(new fr(t,$.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Ya(r,t){let e=t;t instanceof J&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Ka(r,t){var e,n,i,s,o,a,c;return y(this,void 0,void 0,function*(){try{for(e=!0,n=Te(t);i=yield n.next(),s=i.done,!s;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function Bu(r,t){if(de(r))return Xd(r,t);if(De(r))return Jd(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Jd(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(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function Xd(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(o){return y(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return y(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return y(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return y(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}function Du(r){return new Za(r)}var Za=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Rc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=dr(s),this._getSize=i!=="bytes"?Au:Tu;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:i!=="bytes"?Au:Tu}),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)}},Au=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Tu=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function Do(r,t){let e=new er,n=null,i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield e.close()})},start(a){return y(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return y(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return y(this,void 0,void 0,function*(){return yield(yield bt.from(e)).open(t)})}function o(a,c){return y(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Oo(r,t){let e=new this(r),n=new re(e),i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return y(this,void 0,void 0,function*(){yield s(o)})},start(o){return y(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return y(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}function ji(r){let t=bt.from(r);return ae(t)?t.then(e=>ji(e)):t.isAsync()?t.readAll().then(e=>new J(e)):new J(t.readAll())}function Fo(r,t="stream"){return(t==="stream"?wr:_r).writeAll(r).toUint8Array(!0)}var cp=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},oa),Ma),xa),aa),ea),Ia),ia),{compareSchemas:an,compareFields:nu,compareTypes:go});Bt.toDOMStream=Bu;rt.throughDOM=Du;bt.throughDOM=Do;Lr.throughDOM=Do;ir.throughDOM=Do;ln.throughDOM=Oo;_r.throughDOM=Oo;wr.throughDOM=Oo;var Mo=class extends Er{arrowSchema;constructor(t,e){super(t,e),this.arrowSchema=null}getBatch(){let t=super.getBatch();if(t){this.arrowSchema=this.arrowSchema||lp(t.schema);let e=up(this.arrowSchema,t.data),n=new Y(this.arrowSchema,w({type:new V(this.arrowSchema.fields),children:e.map(({data:i})=>i[0])}));return{shape:"arrow-table",batchType:"data",data:new J([n]),length:t.length}}return null}};function lp(r){let t=[];for(let e in r){let n=r[e];if(n.type===Float32Array){let i=new Map,s=new D(n.name,new Xt,n.nullable,i);t.push(s)}}if(t.length===0)throw new Error("No arrow convertible fields");return new E(t)}function up(r,t){let e=[];for(let n of r.fields){let i=t[n.name];if(i instanceof Float32Array){let s=Or(i);e.push(s)}}if(r.fields.length!==e.length)throw new Error("Some columns not arrow convertible");return e}function Ou(r){switch(r.constructor){case Int8Array:return new ye;case Uint8Array:return new we;case Int16Array:return new ge;case Uint16Array:return new _e;case Int32Array:return new pt;case Uint32Array:return new ve;case Float32Array:return new Xt;case Float64Array:return new Qt;default:throw new Error("array type not supported")}}var fn;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(fn||(fn={}));function Lo(r){let t=r.data,e={};for(let n of t.schema.fields){let s=t.getChild(n.name)?.toArray();e[n.name]=s}return{shape:"columnar-table",schema:r.schema,data:e}}function Gn(r){return{fields:r.fields.map(t=>hn(t)),metadata:No(r.metadata)}}function Fu(r){return new E(r.fields.map(t=>dn(t)),Uo(r.metadata))}function No(r){return Object.fromEntries(r)}function Uo(r){return r?new Map(Object.entries(r)):new Map}function hn(r){return{name:r.name,type:Ja(r.type),nullable:r.nullable,metadata:No(r.metadata)}}function dn(r){return new D(r.name,Xa(r.type),r.nullable,Uo(r.metadata))}function Ja(r){switch(r.constructor){case ut:return"null";case ue:return"binary";case kt:return"bool";case it:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case ye:return"int8";case ge:return"int16";case pt:return"int32";case be:return"int64";case we:return"uint8";case _e:return"uint16";case ve:return"uint32";case Ze:return"uint64";case At:switch(r.precision){case j.HALF:return"float16";case j.SINGLE:return"float32";case j.DOUBLE:return"float64";default:return"float16"}case Br:return"float16";case Xt:return"float32";case Qt:return"float64";case Pt:return"utf8";case fe:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case qt:return r.unit===et.DAY?"date-day":"date-millisecond";case Pr:return"date-day";case cr:return"date-millisecond";case xt:switch(r.unit){case p.SECOND:return"time-second";case p.MILLISECOND:return"time-millisecond";case p.MICROSECOND:return"time-microsecond";case p.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Vr:return"time-millisecond";case kr:return"time-second";case jr:return"time-microsecond";case zr:return"time-nanosecond";case Nt:switch(r.unit){case p.SECOND:return"timestamp-second";case p.MILLISECOND:return"timestamp-millisecond";case p.MICROSECOND:return"timestamp-microsecond";case p.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Wr:return"timestamp-second";case Gr:return"timestamp-millisecond";case $r:return"timestamp-microsecond";case Hr:return"timestamp-nanosecond";case te:switch(r.unit){case nt.DAY_TIME:return"interval-daytime";case nt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Yr:return"interval-daytime";case Kr:return"interval-yearmonth";case jt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(b=>hn(b))};case Tt:let u=r.valueField;return{type:"list",children:[hn(u)]};case Vt:let h=r;return{type:"fixed-size-list",listSize:h.listSize,children:[hn(h.children[0])]};case V:return{type:"struct",children:r.children.map(b=>hn(b))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Xa(r){if(typeof r=="object")switch(r.type){case"decimal":return new fe(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>dn(i));return new jt(t,r.keysSorted);case"list":let e=dn(r.children[0]);return new Tt(e);case"fixed-size-list":let n=dn(r.children[0]);return new Vt(r.listSize,n);case"struct":return t=r.children.map(i=>dn(i)),new V(t);default:throw new Error("array type not supported")}switch(r){case"null":return new ut;case"binary":return new ue;case"bool":return new kt;case"int8":return new ye;case"int16":return new ge;case"int32":return new pt;case"int64":return new be;case"uint8":return new we;case"uint16":return new _e;case"uint32":return new ve;case"uint64":return new Ze;case"float16":return new Br;case"float32":return new Xt;case"float64":return new Qt;case"utf8":return new Pt;case"date-day":return new Pr;case"date-millisecond":return new cr;case"time-second":return new kr;case"time-millisecond":return new Vr;case"time-microsecond":return new jr;case"time-nanosecond":return new zr;case"timestamp-second":return new Wr;case"timestamp-millisecond":return new Gr;case"timestamp-microsecond":return new $r;case"timestamp-nanosecond":return new Hr;case"interval-daytime":return new Yr;case"interval-yearmonth":return new Kr;default:throw new Error("array type not supported")}}function zi(r,t){let e=ji([new Uint8Array(r)]),n={shape:"arrow-table",schema:Gn(e.schema),data:e},i=t?.shape||"arrow-table";switch(i){case"arrow-table":return n;case"columnar-table":return Lo(n);case"object-row-table":let s=Lo(n);return cs(s,"object-row-table");case"array-row-table":return s=Lo(n),cs(s,"array-row-table");default:throw new Error(i)}}function Eo(r,t){async function*e(){let n=bt.readAll(r);for await(let i of n){for await(let s 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 J([s]),length:s.data.length};break}}return e()}var fp="4.3.0-alpha.4",Wi={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:fp,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"}}},Mu={...Wi,parse:async(r,t)=>zi(r,t?.arrow),parseSync:(r,t)=>zi(r,t?.arrow),parseInBatches:Eo};function Qa(r){let t={};for(let i of r){let s=hp(i.array,i.type);t[i.name]=s}let e=new J(t);return Fo(e)}function hp(r,t){switch(t){case fn.DATE:return Ci(r);case fn.FLOAT:default:return Ci(r)}}var dp="4.3.0-alpha.4",Lu={name:"Apache Arrow",id:"arrow",module:"arrow",version:dp,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 Qa(t)},encodeSync(r,t){return Qa(r)}};var pp=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],mp="ARROW:extension:name",yp="ARROW:extension:metadata";function qa(r){let t={};for(let e of r.fields){let n=gp(e);n&&(t[e.name]=n)}return t}function gp(r){let t=null,e=r.metadata?.[mp];e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),pp.includes(e)?(t=t||{},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=r.metadata?.[yp];if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function Nr(r){return Nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(r)}function tc(r,t){if(Nr(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(Nr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function ec(r){var t=tc(r,"string");return Nr(t)==="symbol"?t:String(t)}function Ae(r,t,e){return t=ec(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var Gi={x:0,y:1,z:2};function Ro(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Gi[i[0]],c=Gi[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function nc(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=Uu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,b,M,z;if(s&&(a=Sp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],b=h=r[1];for(let X=e;X<o;X+=e)M=r[X],z=r[X+1],M<d&&(d=M),z<b&&(b=z),M>u&&(u=M),z>h&&(h=z);l=Math.max(u-d,h-b),l=l!==0?32767/l:0}return $i(a,c,e,d,b,l,0),c}function Uu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Ro(r,{start:t,end:e,size:n,plane:o}));let l=Gi[o[0]],u=Gi[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=Nu(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=Nu(a,r[a+l],r[a+u],c);return c&&ko(c,c.next)&&(Yi(c),c=c.next),c}function pn(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(ko(e,e.next)||ct(e.prev,e,e.next)===0)){if(Yi(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function $i(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Op(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?vp(r,n,i,s):_p(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Yi(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=Ip(pn(r),t,e),$i(r,t,e,n,i,s,2)):o===2&&xp(r,t,e,n,i,s):$i(pn(r),t,e,n,i,s,1);break}}}function _p(r){let t=r.prev,e=r,n=r.next;if(ct(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,b=a>c?a>l?a:l:c>l?c:l,M=n.next;for(;M!==t;){if(M.x>=u&&M.x<=d&&M.y>=h&&M.y<=b&&$n(i,a,s,c,o,l,M.x,M.y)&&ct(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function vp(r,t,e,n){let i=r.prev,s=r,o=r.next;if(ct(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,b=a<c?a<l?a:l:c<l?c:l,M=u<h?u<d?u:d:h<d?h:d,z=a>c?a>l?a:l:c>l?c:l,X=u>h?u>d?u:d:h>d?h:d,st=rc(b,M,t,e,n),yn=rc(z,X,t,e,n),W=r.prevZ,k=r.nextZ;for(;W&&W.z>=st&&k&&k.z<=yn;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&$n(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0||(W=W.prevZ,k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&$n(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;W&&W.z>=st;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&$n(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;k&&k.z<=yn;){if(k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&$n(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function Ip(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!ko(i,s)&&Eu(i,n,n.next,s)&&Hi(i,s)&&Hi(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Yi(n),Yi(n.next),n=r=s),n=n.next}while(n!==r);return pn(n)}function xp(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Lp(o,a)){let c=Ru(o,a);o=pn(o,o.next),c=pn(c,c.next),$i(o,t,e,n,i,s,0),$i(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function Sp(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=Uu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Mp(h));for(o.sort(Bp),a=0;a<o.length;a++)e=Ap(o[a],e);return e}function Bp(r,t){return r.x-t.x}function Ap(r,t){let e=Tp(r,t);if(!e)return t;let n=Ru(e,r);return pn(n,n.next),pn(e,e.next)}function Tp(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&$n(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Hi(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&Dp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function Dp(r,t){return ct(r.prev,r,t.prev)<0&&ct(t.next,r,r.next)<0}function Op(r,t,e,n){let i=r;do i.z===0&&(i.z=rc(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Fp(i)}function Fp(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function rc(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Mp(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function $n(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function Lp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Np(r,t)&&(Hi(r,t)&&Hi(t,r)&&Up(r,t)&&(ct(r.prev,r,t.prev)||ct(r,t.prev,t))||ko(r,t)&&ct(r.prev,r,r.next)>0&&ct(t.prev,t,t.next)>0)}function ct(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ko(r,t){return r.x===t.x&&r.y===t.y}function Eu(r,t,e,n){let i=Po(ct(r,t,e)),s=Po(ct(r,t,n)),o=Po(ct(e,n,r)),a=Po(ct(e,n,t));return!!(i!==s&&o!==a||i===0&&Co(r,e,t)||s===0&&Co(r,n,t)||o===0&&Co(e,r,n)||a===0&&Co(e,t,n))}function Co(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Po(r){return r>0?1:r<0?-1:0}function Np(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Eu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Hi(r,t){return ct(r.prev,r,r.next)<0?ct(r,t,r.next)>=0&&ct(r,r.prev,t)>=0:ct(r,t,r.prev)<0||ct(r,r.next,t)<0}function Up(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Ru(r,t){let e=new Ki(r.i,r.x,r.y),n=new Ki(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Nu(r,t,e,n){let i=new Ki(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Yi(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Ki=class{constructor(t,e,n){Ae(this,"i",void 0),Ae(this,"x",void 0),Ae(this,"y",void 0),Ae(this,"prev",null),Ae(this,"next",null),Ae(this,"z",0),Ae(this,"prevZ",null),Ae(this,"nextZ",null),Ae(this,"steiner",!1),this.i=t,this.x=e,this.y=n}};function Hn(r,t,e){switch(r.type){case"Point":return Vp(r,t,e);case"LineString":return kp(r,t,e);case"Polygon":return ku(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function ku(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),s=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1],d=Vo(n,u,h);c.push(d)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],u=i[c+1],h=ku(r,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function kp(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:Vo(n,i[0],i[1])};let o=[];for(let a=0;a<i.length-1;a++){let c=Vo(n,i[a],i[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function Vp(r,t,e){let{positions:n}=r,i=Vo(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Vo(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let s=Array();for(let o=i*r.size;o<(i+1)*r.size;o++)s.push(Number(r.value[o]));n.push(s)}return n}function jo(r){let t=r.data,e=Gn(t.schema),n=qa(e),i=n.geometry.encoding,s=[],o=t.schema.fields.map(l=>l.name).filter(l=>!(l in n)),a=t.select(o),c=t.getChild("geometry");for(let l=0;l<t.numRows;l++){let u=c?.get(l),h=zo(u,i);if(h){let d=a.get(l)?.toJSON()||{};s.push({type:"Feature",geometry:h,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:r.schema,features:s}}function ic(r,t){let e=zi(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return jo(e);default:return e}}function Vu(r){return Eo(r)}var sc={...Wi,options:{arrow:{shape:"arrow-table"}}},ju={...sc,parse:async(r,t)=>ic(r,t?.arrow),parseSync:(r,t)=>ic(r,t?.arrow),parseInBatches:Vu};function Wo(r,t,e,n=100){let i=r.length/t,s=Math.max(Math.floor(i/n),1),o=[...e];for(let a=0;a<i;a+=s){let c=r[a*t],l=r[a*t+1];c<o[0]&&(o[0]=c),l<o[1]&&(o[1]=l),c>o[2]&&(o[2]=c),l>o[3]&&(o[3]=l)}return o}var Yn;(function(r){r.points="points",r.lines="lines",r.polygons="polygons"})(Yn||(Yn={}));function Zi(){return{globalFeatureIds:{value:new Uint32Array(0),size:1},positions:{value:new Float32Array(0),size:2},properties:[],numericProps:{},featureIds:{value:new Uint32Array(0),size:1}}}function zu(r,t,e){let n={polygon:t==="geoarrow.multipolygon"||t==="geoarrow.polygon",point:t==="geoarrow.multipoint"||t==="geoarrow.point",line:t==="geoarrow.multilinestring"||t==="geoarrow.linestring"},i=e?.chunkIndex!==void 0&&e?.chunkIndex>=0?[r.data[e?.chunkIndex]]:r.data,s=[1/0,1/0,-1/0,-1/0],o=e?.chunkOffset||0,a=[];return i.forEach(c=>{let{featureIds:l,flatCoordinateArray:u,nDim:h,geomOffset:d,triangles:b}=zp(c,t,e),M=new Uint32Array(l.length);for(let X=0;X<l.length;X++)M[X]=l[X]+o;let z={globalFeatureIds:{value:M,size:1},positions:{value:u,size:h},featureIds:{value:l,size:1},properties:[...Array(c.length).keys()].map(X=>({index:X+o}))};o+=c.length,a.push({shape:"binary-feature-collection",points:{type:"Point",...Zi(),...n.point?z:{}},lines:{type:"LineString",...Zi(),...n.line?z:{},pathIndices:{value:n.line?d:new Uint16Array(0),size:1}},polygons:{type:"Polygon",...Zi(),...n.polygon?z:{},polygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},primitivePolygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},...b?{triangles:{value:b,size:1}}:{}}}),s=Wo(u,h,s)}),{binaryGeometries:a,bounds:s,featureTypes:n,...e?.calculateMeanCenters?{meanCenters:oc(a)}:{}}}function oc(r){let t=[];return r.forEach(e=>{let n=null;e.points&&e.points.positions.value.length>0?n=Yn.points:e.lines&&e.lines.positions.value.length>0?n=Yn.lines:e.polygons&&e.polygons.positions.value.length>0&&(n=Yn.polygons);let i=n?e[n]:null;if(i&&n!==null){let s=i.featureIds.value,o=i.positions.value,a=i.positions.size,c=i.type==="Polygon"?i.primitivePolygonIndices?.value:void 0;jp(s,o,a,n,c).forEach(u=>{t.push(u)})}}),t}function jp(r,t,e,n,i){let s=[],o=t.length,a=0,c=0,l=0;for(;a<o;){let u=r[a/e],h=[0,0],d=0;for(;a<o&&r[c]===u;)n===Yn.polygons&&i?.[l]===c?(a+=e,l++):(h[0]+=t[a],h[1]+=t[a+1],a+=e,d++),c+=1;h[0]/=d,h[1]/=d,s.push(h)}return s}function zp(r,t,e){switch(t){case"geoarrow.point":case"geoarrow.multipoint":return $p(r,t);case"geoarrow.linestring":case"geoarrow.multilinestring":return Gp(r,t);case"geoarrow.polygon":case"geoarrow.multipolygon":return Wp(r,t,e);default:throw Error("invalid geoarrow encoding")}}function ac(r,t,e,n){try{let i=0,s=[];for(let a=0;a<r.length-1;a++){let c=r[a],l=r[a+1],u=e.subarray(c*n,l*n),h=[];for(;t[i]<l;)t[i]>c&&h.push(t[i]-c),i++;let d=nc(u,h.length>0?h:void 0,n);if(d.length===0)throw Error("earcut failed e.g. invalid polygon");for(let b=0;b<d.length;b++)s.push(d[b]+c)}let o=new Uint32Array(s.length);for(let a=0;a<s.length;a++)o[a]=s[a];return o}catch{return null}}function Wp(r,t,e){let n=t==="geoarrow.multipolygon",i=n?r.children[0]:r,s=i.valueOffsets,o=n?r.valueOffsets.map(st=>s.at(st)||st):r.valueOffsets,a=i.children[0],c=a.children[0],l=c.children[0],u=c.stride,h=a.valueOffsets,d=l.values,b=new Uint16Array(s.length);for(let st=0;st<s.length;st++)b[st]=h[s[st]];let M=d.length/u,z=new Uint32Array(M);for(let st=0;st<o.length-1;st++){let yn=h[o[st]],W=h[o[st+1]];for(let k=yn;k<W;k++)z[k]=st}let X=e?.triangulate?ac(b,h,d,u):null;return{featureIds:z,nDim:u,flatCoordinateArray:d,geomOffset:h,geometryIndicies:b,...e?.triangulate&&X?{triangles:X}:{}}}function Gp(r,t){let e=t==="geoarrow.multilinestring",n=e?r.children[0]:r,i=n.children[0],s=i.children[0],o=i.stride,a=n.valueOffsets,c=s.values,l=new Uint16Array(0),u=c.length/o,h=new Uint32Array(u);if(e){let d=r.valueOffsets;for(let b=0;b<d.length-1;b++){let M=a[d[b]],z=a[d[b+1]];for(let X=M;X<z;X++)h[X]=b}}else for(let d=0;d<r.length;d++){let b=a[d],M=a[d+1];for(let z=b;z<M;z++)h[z]=d}return{featureIds:h,flatCoordinateArray:c,nDim:o,geomOffset:a,geometryIndicies:l}}function $p(r,t){let e=t==="geoarrow.multipoint",n=e?r.children[0]:r,i=n.children[0],s=n.stride,o=i.values,a=new Uint16Array(0),c=new Int32Array(0),l=o.length/s,u=new Uint32Array(l);if(e){let h=r.valueOffsets;for(let d=0;d<h.length-1;d++){let b=h[d],M=h[d+1];for(let z=b;z<M;z++)u[z]=d}}else for(let h=0;h<r.length;h++)u[h]=h;return{featureIds:u,flatCoordinateArray:o,nDim:s,geomOffset:c,geometryIndicies:a}}var Go="4.3.0-alpha.4";var Wu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Gu=new RegExp("^"+Wu.source+"(\\s"+Wu.source+"){1,}"),cc=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("];function $u(r){return cc.some(t=>r.startsWith(t))}function lc(r,t){return Hp(r,t)}function Hp(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),o=Hu({parts:e,_:n,i:0});return t?.wkt?.crs?Yp(o,i):o}function Hu(r){return Kp(r)||Jp(r)||Qp(r)||Zp(r)||Xp(r)||qp(r)||tm(r)}function Yp(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 Kp(r){if(!ht(/^(POINT(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Yu(r);return!t||(Wt(r),!ht(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function Zp(r){if(!ht(/^(MULTIPOINT)/i,r))return null;Wt(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=$o(r);return e?(Wt(r),{type:"MultiPoint",coordinates:e}):null}function Jp(r){if(!ht(/^(LINESTRING(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Yu(r);return!t||!ht(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function Xp(r){if(!ht(/^(MULTILINESTRING)/i,r))return null;Wt(r);let t=$o(r);return t?(Wt(r),{type:"MultiLineString",coordinates:t}):null}function Qp(r){if(!ht(/^(POLYGON(\sz)?)/i,r))return null;Wt(r);let t=$o(r);return t?{type:"Polygon",coordinates:t}:null}function qp(r){if(!ht(/^(MULTIPOLYGON)/i,r))return null;Wt(r);let t=$o(r);return t?{type:"MultiPolygon",coordinates:t}:null}function tm(r){let t=[],e;if(!ht(/^(GEOMETRYCOLLECTION)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;for(;e=Hu(r);)t.push(e),Wt(r),ht(/^(,)/,r),Wt(r);return ht(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function $o(r){Wt(r);let t=0,e=[],n=[e],i=e,s;for(;s=ht(/^(\()/,r)||ht(/^(\))/,r)||ht(/^(,)/,r)||ht(Gu,r);){if(s==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(s===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(s===",")i=[],n[n.length-1].push(i);else if(!s.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,s.split(/\s/g).map(parseFloat));else return null;Wt(r)}return t!==0?null:e}function Yu(r){let t=[],e,n;for(;n=ht(Gu,r)||ht(/^(,)/,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))),Wt(r);if(e)t.push(e);else return null;return t.length?t:null}function ht(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Wt(r){ht(/^\s*/,r)}var Ku={dataType:null,batchType:null,name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:Go,worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,tests:cc,testText:$u,options:{wkt:{shape:"geojson-geometry",crs:!0}}},uc={...Ku,parse:async(r,t)=>lc(new TextDecoder().decode(r),t),parseTextSync:(r,t)=>lc(r,t)};var vr;(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"})(vr||(vr={}));function Zu(r){let t=new DataView(r),e=0,n=t.getUint8(e);if(e+=1,n>1)return!1;let i=n===1,s=t.getUint32(e,i);e+=4;let o=s&7;if(o===0||o>7)return!1;let a=s-o;if(a===0||a===1e3||a===2e3||a===3e3)return!0;if(a&536870911)return!1;if(a&536870912){let c=t.getUint32(e,i);if(e+=4,c>1e4)return!1}return!0}function Ju(r,t){let e=Object.assign(t||{},{type:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});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.type="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.type="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.type="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let s=n&2147483648,o=n&1073741824,a=n&536870912;return s&&o?(e.type="ewkb",e.dimensions=4,e.coordinates="xyzm"):s?(e.type="ewkb",e.dimensions=3,e.coordinates="xyz"):o&&(e.type="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.type="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function fc(r,t){let e=em(r,t),n=t?.wkb?.shape||"binary-geometry";switch(n){case"binary-geometry":return e;case"geojson-geometry":return Hn(e);case"geometry":return console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead'),Hn(e);default:throw new Error(n)}}function em(r,t){let e=new DataView(r),n=Ju(e),{geometryType:i,dimensions:s,littleEndian:o}=n,a=n.byteOffset;switch(i){case vr.Point:return Xu(e,a,s,o).geometry;case vr.LineString:return hc(e,a,s,o).geometry;case vr.Polygon:return Qu(e,a,s,o).geometry;case vr.MultiPoint:let h=rm(e,a,s,o);return h.type="Point",h;case vr.MultiLineString:let d=nm(e,a,s,o);return d.type="LineString",d;case vr.MultiPolygon:let b=im(e,a,s,o);return b.type="Polygon",b;default:throw new Error(`WKB: Unsupported geometry type: ${i}`)}}function Xu(r,t,e,n){let i=new Float64Array(e);for(let s=0;s<e;s++)i[s]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function hc(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=new Float64Array(i*e);for(let a=0;a<i*e;a++)s[a]=r.getFloat64(t,n),t+=8;let o=[0];return i>0&&o.push(i),{geometry:{type:"LineString",positions:{value:s,size:e},pathIndices:{value:new Uint32Array(o),size:1}},offset:t}}var dc=r=>t=>r+=t;function Qu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let l=0;l<i;l++){let u=hc(r,t,e,n),{positions:h}=u.geometry;t=u.offset,s.push(h.value)}let o=new Float64Array(Ho(s).buffer),a=[0];o.length>0&&a.push(o.length/e);let c=s.map(l=>l.length/e).map(dc(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:o,size:e},polygonIndices:{value:new Uint32Array(a),size:1},primitivePolygonIndices:{value:new Uint32Array(c),size:1}},offset:t}}function rm(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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,s.push(c.geometry)}return sm(s,e)}function nm(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=hc(r,t,e,a);t=c.offset,s.push(c.geometry)}return om(s,e)}function im(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=Qu(r,t,e,a);t=c.offset,s.push(c.geometry)}return am(s,e)}function sm(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(Ho(e).buffer),size:t}}}function om(r,t){let e=r.map(s=>s.positions.value),n=new Float64Array(Ho(e).buffer),i=e.map(s=>s.length/t).map(dc(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function am(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(Ho(e).buffer),s=e.map(a=>a.length/t).map(dc(0));s.unshift(0);let o=[0];for(let a of n)o.push(...a.filter(c=>c>0).map(c=>c+o[o.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(s),size:1},primitivePolygonIndices:{value:new Uint32Array(o),size:1}}}function Ho(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 s=new Uint8Array(r[i].buffer);t=s.length;for(let o=0;o<t;++o)e[n++]=s[o]}return e}var qu={dataType:null,batchType:null,name:"WKB",id:"wkb",module:"wkt",version:Go,worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],tests:[Zu],options:{wkb:{shape:"binary-geometry"}}},pc={...qu,parse:async r=>fc(r),parseSync:fc};function zo(r,t){if(t=t?.toLowerCase(),!t||!r)return null;let e;switch(t){case"geoarrow.multipolygon":e=um(r);break;case"geoarrow.polygon":e=fm(r);break;case"geoarrow.multipoint":e=hm(r);break;case"geoarrow.point":e=dm(r);break;case"geoarrow.multilinestring":e=pm(r);break;case"geoarrow.linestring":e=mm(r);break;case"geoarrow.wkb":e=cm(r);break;case"geoarrow.wkt":e=lm(r);break;default:throw Error(`GeoArrow encoding not supported ${t}`)}return e}function cm(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),e=pc.parseSync?.(t);return Hn(e)}function lm(r){let t=r;return uc.parseTextSync?.(t)}function um(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i?.length;o++){let a=i?.get(o),c=[];for(let l=0;a&&l<a.length;l++){let u=a.get(l),h=Array.from(u);c.push(h)}s.push(c)}t.push(s)}return{type:"MultiPolygon",coordinates:t}}function fm(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i.length;o++){let a=i.get(o),c=Array.from(a);s.push(c)}t.push(s)}return{type:"Polygon",coordinates:t}}function hm(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 dm(r){return{type:"Point",coordinates:Array.from(r)}}function pm(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let s=0;n&&s<n.length;s++){let o=n.get(s);if(o){let a=Array.from(o);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function mm(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 Ji(r,t=!1){if("data"in r)return new g(r.data.map(s=>Ji(s,t)));let e=[];for(let s of r.children)e.push(Ji(s,t));let n;r.dictionary!==void 0&&(n=Ji(r.dictionary,t));let i={[lt.OFFSET]:Yo(r.buffers[lt.OFFSET],t),[lt.DATA]:Yo(r.buffers[lt.DATA],t),[lt.VALIDITY]:Yo(r.buffers[lt.VALIDITY],t),[lt.TYPE]:Yo(r.buffers[lt.TYPE],t)};return new R(r.type,r.offset,r.length,r._nullCount,i,e,n)}function ym(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function Yo(r,t){return r===void 0||!t&&!ym(r)?r:r.slice()}var tf="latest";function gm(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.0-alpha.4"),globalThis._loadersgl_.version}var mc=gm();function sr(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var or={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},cA=or.self||or.window||or.global||{},lA=or.window||or.self||or.global||{},uA=or.global||or.self||or.window||{},fA=or.document||{};var Ir=typeof process!="object"||String(process)!=="[object process]"||process.browser;var rf=typeof window<"u"&&typeof window.orientation<"u",ef=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),hA=ef&&parseFloat(ef[1])||0;var Xi=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){sr(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){sr(this.isRunning),this.isRunning=!1,this._reject(t)}};var Kn=class{terminate(){}};var yc=new Map;function nf(r){sr(r.source&&!r.url||!r.source&&r.url);let t=yc.get(r.source||r.url);return t||(r.url&&(t=bm(r.url),yc.set(r.url,t)),r.source&&(t=sf(r.source),yc.set(r.source,t))),sr(t),t}function bm(r){if(!r.startsWith("http"))return r;let t=wm(r);return sf(t)}function sf(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function wm(r){return`try {
|
|
17
17
|
importScripts('${r}');
|
|
18
18
|
} catch (error) {
|
|
19
19
|
console.error(error);
|
|
20
20
|
throw error;
|
|
21
|
-
}`}function gc(r,t=!0,e){let n=e||new Set;if(r){if(of(r))n.add(r);else if(of(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)gc(r[i],t,n)}}return e===void 0?Array.from(n):[]}function of(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 bc(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]=bc(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var wc=()=>{},Ur=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Ir||typeof Kn<"u"&&!Ir}constructor(t){let{name:e,source:n,url:i}=t;sr(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=wc,this.onError=s=>console.log(s),this.worker=Ir?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=wc,this.onError=wc,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||gc(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=nf({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}`;t=new Kn(n,{eval:!1})}else if(this.source)t=new Kn(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 Qi=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Ur.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,s,o)=>i.done(o),n=(i,s)=>i.error(s)){let i=new Promise(s=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:s}),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 Xi(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){!Ir||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 Ur({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return rf?this.maxMobileConcurrency:this.maxConcurrency}};var _m={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},mn=class{props;workerPools=new Map;static isSupported(){return Ur.isSupported()}static getWorkerFarm(t={}){return mn._workerFarm=mn._workerFarm||new mn({}),mn._workerFarm.setProps(t),mn._workerFarm}constructor(t){this.props={..._m},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,s=this.workerPools.get(e);return s||(s=new Qi({name:e,source:n,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Zn=mn;rs(Zn,"_workerFarm");function af(r){let t=r.version!==mc?` (worker-utils@${mc})`:"";return`${r.name}@${r.version}${t}`}function cf(r,t={}){let e=t[r.id]||{},n=Ir?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(Ir?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=tf);let o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return sr(i),i}async function Ko(r,t,e={},n={}){let i=af(r),s=Zn.getWorkerFarm(e),{source:o}=e,a={name:i,source:o};o||(a.url=cf(r,e));let c=s.getWorkerPool(a),l=e.jobName||r.name,u=await c.startJob(l,vm.bind(null,n)),h=bc(e);return u.postMessage("process",{input:t,options:h}),(await u.result).result}async function vm(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:s,options:o}=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(s,o);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}`)}}var Im="4.3.0-alpha.
|
|
21
|
+
}`}function gc(r,t=!0,e){let n=e||new Set;if(r){if(of(r))n.add(r);else if(of(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)gc(r[i],t,n)}}return e===void 0?Array.from(n):[]}function of(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 bc(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]=bc(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var wc=()=>{},Ur=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Ir||typeof Kn<"u"&&!Ir}constructor(t){let{name:e,source:n,url:i}=t;sr(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=wc,this.onError=s=>console.log(s),this.worker=Ir?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=wc,this.onError=wc,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||gc(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=nf({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}`;t=new Kn(n,{eval:!1})}else if(this.source)t=new Kn(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 Qi=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Ur.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,s,o)=>i.done(o),n=(i,s)=>i.error(s)){let i=new Promise(s=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:s}),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 Xi(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){!Ir||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 Ur({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return rf?this.maxMobileConcurrency:this.maxConcurrency}};var _m={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},mn=class{props;workerPools=new Map;static isSupported(){return Ur.isSupported()}static getWorkerFarm(t={}){return mn._workerFarm=mn._workerFarm||new mn({}),mn._workerFarm.setProps(t),mn._workerFarm}constructor(t){this.props={..._m},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,s=this.workerPools.get(e);return s||(s=new Qi({name:e,source:n,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Zn=mn;rs(Zn,"_workerFarm");function af(r){let t=r.version!==mc?` (worker-utils@${mc})`:"";return`${r.name}@${r.version}${t}`}function cf(r,t={}){let e=t[r.id]||{},n=Ir?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(Ir?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=tf);let o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return sr(i),i}async function Ko(r,t,e={},n={}){let i=af(r),s=Zn.getWorkerFarm(e),{source:o}=e,a={name:i,source:o};o||(a.url=cf(r,e));let c=s.getWorkerPool(a),l=e.jobName||r.name,u=await c.startJob(l,vm.bind(null,n)),h=bc(e);return u.postMessage("process",{input:t,options:h}),(await u.result).result}async function vm(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:s,options:o}=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(s,o);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}`)}}var Im="4.3.0-alpha.4",Zo={id:"triangulation",name:"Triangulate",module:"arrow",version:Im,options:{}};function lf(r,t={}){return Ko(Zo,{...r,operation:"triangulate"},t)}function uf(r,t={}){return Ko(Zo,{...r,operation:"parse-geoarrow"},t)}gn.ArrowBatch=Mo;return wf(qi);})();
|
|
22
22
|
return __exports__;
|
|
23
23
|
});
|