@loaders.gl/arrow 4.3.2 → 4.4.0-alpha.2

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.
Files changed (77) hide show
  1. package/dist/arrow-loader.d.ts +1 -1
  2. package/dist/arrow-worker.js +638 -1292
  3. package/dist/arrow-writer.js +1 -1
  4. package/dist/dist.dev.js +2140 -3383
  5. package/dist/dist.min.js +5 -5
  6. package/dist/exports/arrow-format.d.ts +12 -0
  7. package/dist/exports/arrow-format.d.ts.map +1 -0
  8. package/dist/exports/arrow-format.js +18 -0
  9. package/dist/exports/arrow-loader.d.ts +1 -1
  10. package/dist/exports/arrow-loader.d.ts.map +1 -1
  11. package/dist/exports/arrow-loader.js +1 -1
  12. package/dist/exports/geoarrow-loader.d.ts +1 -1
  13. package/dist/exports/geoarrow-loader.d.ts.map +1 -1
  14. package/dist/geoarrow-loader.d.ts +1 -2
  15. package/dist/geoarrow-loader.d.ts.map +1 -1
  16. package/dist/geoarrow-writer.d.ts +3 -3
  17. package/dist/geoarrow-writer.d.ts.map +1 -1
  18. package/dist/geoarrow-writer.js +1 -1
  19. package/dist/index.cjs +39 -952
  20. package/dist/index.cjs.map +4 -4
  21. package/dist/index.d.ts +1 -9
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +7 -14
  24. package/dist/lib/parsers/parse-arrow.d.ts +1 -2
  25. package/dist/lib/parsers/parse-arrow.d.ts.map +1 -1
  26. package/dist/lib/parsers/parse-arrow.js +1 -1
  27. package/dist/lib/parsers/parse-geoarrow.d.ts +1 -2
  28. package/dist/lib/parsers/parse-geoarrow.d.ts.map +1 -1
  29. package/dist/lib/parsers/parse-geoarrow.js +2 -2
  30. package/dist/triangulate-on-worker.d.ts +2 -1
  31. package/dist/triangulate-on-worker.d.ts.map +1 -1
  32. package/dist/triangulate-on-worker.js +1 -1
  33. package/dist/triangulation-worker.js +212 -154
  34. package/dist/workers/triangulation-worker.js +2 -2
  35. package/package.json +10 -9
  36. package/src/exports/arrow-format.ts +21 -0
  37. package/src/exports/arrow-loader.ts +1 -1
  38. package/src/exports/geoarrow-loader.ts +1 -2
  39. package/src/geoarrow-loader.ts +6 -2
  40. package/src/geoarrow-writer.ts +1 -1
  41. package/src/index.ts +2 -42
  42. package/src/lib/parsers/parse-arrow.ts +2 -3
  43. package/src/lib/parsers/parse-geoarrow.ts +8 -4
  44. package/src/triangulate-on-worker.ts +2 -1
  45. package/src/workers/triangulation-worker.ts +3 -3
  46. package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.d.ts +0 -74
  47. package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.d.ts.map +0 -1
  48. package/dist/lib/geoarrow/convert-geoarrow-to-binary-geometry.js +0 -377
  49. package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts +0 -13
  50. package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.d.ts.map +0 -1
  51. package/dist/lib/geoarrow/convert-geoarrow-to-geojson-geometry.js +0 -176
  52. package/dist/lib/geoarrow/get-arrow-bounds.d.ts +0 -11
  53. package/dist/lib/geoarrow/get-arrow-bounds.d.ts.map +0 -1
  54. package/dist/lib/geoarrow/get-arrow-bounds.js +0 -34
  55. package/dist/lib/tables/convert-arrow-schema.d.ts +0 -23
  56. package/dist/lib/tables/convert-arrow-schema.d.ts.map +0 -1
  57. package/dist/lib/tables/convert-arrow-schema.js +0 -280
  58. package/dist/lib/tables/convert-arrow-to-table.d.ts +0 -15
  59. package/dist/lib/tables/convert-arrow-to-table.d.ts.map +0 -1
  60. package/dist/lib/tables/convert-arrow-to-table.js +0 -104
  61. package/dist/lib/tables/convert-table-to-arrow.d.ts +0 -16
  62. package/dist/lib/tables/convert-table-to-arrow.d.ts.map +0 -1
  63. package/dist/lib/tables/convert-table-to-arrow.js +0 -56
  64. package/dist/schema/arrow-table-batch.d.ts +0 -10
  65. package/dist/schema/arrow-table-batch.d.ts.map +0 -1
  66. package/dist/schema/arrow-table-batch.js +0 -67
  67. package/dist/schema/arrow-table-type.d.ts +0 -25
  68. package/dist/schema/arrow-table-type.d.ts.map +0 -1
  69. package/dist/schema/arrow-table-type.js +0 -4
  70. package/src/lib/geoarrow/convert-geoarrow-to-binary-geometry.ts +0 -494
  71. package/src/lib/geoarrow/convert-geoarrow-to-geojson-geometry.ts +0 -207
  72. package/src/lib/geoarrow/get-arrow-bounds.ts +0 -41
  73. package/src/lib/tables/convert-arrow-schema.ts +0 -301
  74. package/src/lib/tables/convert-arrow-to-table.ts +0 -144
  75. package/src/lib/tables/convert-table-to-arrow.ts +0 -72
  76. package/src/schema/arrow-table-batch.ts +0 -82
  77. package/src/schema/arrow-table-type.ts +0 -30
package/dist/dist.min.js CHANGED
@@ -4,20 +4,20 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var df=Object.create;var Xn=Object.defineProperty;var pf=Object.getOwnPropertyDescriptor;var mf=Object.getOwnPropertyNames;var yf=Object.getPrototypeOf,gf=Object.prototype.hasOwnProperty;var bf=(r,t,e)=>t in r?Xn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var wf=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Ir=(r,t)=>{for(var e in t)Xn(r,e,{get:t[e],enumerable:!0})},es=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mf(t))!gf.call(r,i)&&i!==e&&Xn(r,i,{get:()=>t[i],enumerable:!(n=pf(t,i))||n.enumerable});return r},rs=(r,t,e)=>(es(r,t,"default"),e&&es(e,t,"default")),_f=(r,t,e)=>(e=r!=null?df(yf(r)):{},es(t||!r||!r.__esModule?Xn(e,"default",{value:r,enumerable:!0}):e,r)),vf=r=>es(Xn({},"__esModule",{value:!0}),r);var ns=(r,t,e)=>(bf(r,typeof t!="symbol"?t+"":t,e),e);var Bc=wf((Fm,Sc)=>{Sc.exports=globalThis.loaders});var ts={};Ir(ts,{ArrowLoader:()=>Ju,ArrowWorkerLoader:()=>Wn,ArrowWriter:()=>Xu,GeoArrowLoader:()=>qu,GeoArrowWorkerLoader:()=>$o,TriangulationWorker:()=>Zo,VECTOR_TYPES:()=>Ur,convertArrowToSchema:()=>Hn,convertArrowToTable:()=>Yn,convertSchemaToArrow:()=>Pu,convertTableToArrow:()=>tf,deserializeArrowField:()=>hn,deserializeArrowMetadata:()=>ko,deserializeArrowSchema:()=>Ki,deserializeArrowType:()=>oc,getBinaryGeometriesFromArrow:()=>ef,getBinaryGeometryTemplate:()=>Ji,getMeanCentersFromBinaryGeometries:()=>gc,getTriangleIndices:()=>bc,hardClone:()=>Xi,parseGeoArrowOnWorker:()=>hf,parseGeometryFromArrow:()=>Wo,serializeArrowField:()=>fn,serializeArrowMetadata:()=>Po,serializeArrowSchema:()=>ic,serializeArrowType:()=>sc,triangulateOnWorker:()=>ff,updateBoundsFromGeoArrowSamples:()=>Ho});rs(ts,_f(Bc(),1));var Ur;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(Ur||(Ur={}));function is(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function Ac(r){let t=If(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=is(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function If(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 Tc(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 ss=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 Dc(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 Oc(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 Fc(r){let t=[];for(let e=0;e<r.length;e++){let n=`column-${e}`;t.push(n)}return t}function Mc(r){return Object.keys(r)}var Lc=100,os=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||=Fc(t),this.options.shape){case"object-row-table":let n=Dc(t,this._headers);this.addObjectRow(n,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Lc),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=Mc(t),this.options.shape){case"array-row-table":let n=Oc(t,this._headers);this.addArrayRow(n,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Lc),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 xf={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},Sf="TableBatchBuilder",as=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={...xf,...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 os;case"columnar-table":return Er;case"arrow-table":if(!as.ArrowBatch)throw new Error(Sf);return as.ArrowBatch;default:return ss}}},mn=as;ns(mn,"ArrowBatch");function xr(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 Jo(r){if(r.schema)return r.schema.fields.length;if(xr(r)===0)throw new Error("empty table");switch(r.shape){case"array-row-table":return r.data[0].length;case"object-row-table":return Object.keys(r.data[0]).length;case"geojson-table":return Object.keys(r.features[0]).length;case"columnar-table":return Object.keys(r.data).length;case"arrow-table":return r.data.numCols;default:throw new Error("table")}}function Xo(r,t,e){switch(r.shape){case"array-row-table":let n=Nc(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 Qo(r,t,e){switch(r.shape){case"array-row-table":return r.data[t][e];case"object-row-table":let n=cs(r,e);return r.data[t][n];case"geojson-table":let i=cs(r,e);return r.features[t][i];case"columnar-table":let s=cs(r,e);return r.data[s][t];case"arrow-table":return r.data.getChildAt(e)?.get(t);default:throw new Error("todo")}}function Nc(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function cs(r,t){let e=r.schema?.fields[t]?.name;if(!e)throw new Error(`${t}`);return e}function qo(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 ta(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 Uc(r){switch(r.shape){case"array-row-table":case"object-row-table":return Af(r.data);case"geojson-table":return Tf(r.features);case"columnar-table":return Bf(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Bf(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Df(n,e);t.push(i)}return{fields:t,metadata:{}}}function Af(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(Ec(i,n));return{fields:t,metadata:{}}}function Tf(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(Ec(i,n));return{fields:t,metadata:{}}}function Df(r,t){if(ArrayBuffer.isView(r)){let e=Ac(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=is(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Ec(r,t){let e=is(r);return{name:t,type:e,nullable:!0}}function Rc(r,t){let e=Tc(r.type,r.nullable);return new e(t)}function ls(r,t){switch(t){case"object-row-table":return Lf(r);case"array-row-table":return Mf(r);case"columnar-table":return Ff(r);case"arrow-table":return Of(r);default:throw new Error(t)}}function Of(r){let t=globalThis.__loaders?._makeArrowTable;if(!t)throw new Error("");return t(r)}function Ff(r){let t=r.schema||Uc(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=xr(r),i={};for(let s of e){let o=Rc(s,n);i[s.name]=o;for(let a=0;a<n;a++)o[a]=Xo(r,a,s.name)}return{shape:"columnar-table",schema:t,data:i}}function Mf(r){if(r.shape==="array-row-table")return r;let t=xr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=ta(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Lf(r){if(r.shape==="object-row-table")return r;let t=xr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=qo(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Pc(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 g(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 Cc(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 E(r){return this instanceof E?(this.v=r,this):new E(r)}function ie(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(p){return function(v){return Promise.resolve(v).then(p,h)}}function a(p,v){n[p]&&(i[p]=function(k){return new Promise(function(Z,et){s.push([p,k,Z,et])>1||c(p,k)})},v&&(i[p]=v(i[p])))}function c(p,v){try{l(n[p](v))}catch(k){d(s[0][3],k)}}function l(p){p.value instanceof E?Promise.resolve(p.value.v).then(u,h):d(s[0][2],p)}function u(p){c("next",p)}function h(p){c("throw",p)}function d(p,v){p(v),s.shift(),s.length&&c(s[0][0],s[0][1])}}function yn(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:E(r[i](o)),done:!1}:s?s(o):o}:s}}function ve(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 Cc=="function"?Cc(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 oa={};Ir(oa,{compareArrayLike:()=>sa,joinUint8Arrays:()=>oe,memcpy:()=>ti,rebaseValueOffsets:()=>gs,toArrayBufferView:()=>C,toArrayBufferViewAsyncIterator:()=>xe,toArrayBufferViewIterator:()=>Ue,toBigInt64Array:()=>ys,toBigUint64Array:()=>jf,toFloat32Array:()=>zf,toFloat32ArrayAsyncIterator:()=>ih,toFloat32ArrayIterator:()=>Jf,toFloat64Array:()=>Wf,toFloat64ArrayAsyncIterator:()=>sh,toFloat64ArrayIterator:()=>Xf,toInt16Array:()=>Pf,toInt16ArrayAsyncIterator:()=>th,toInt16ArrayIterator:()=>Hf,toInt32Array:()=>Rr,toInt32ArrayAsyncIterator:()=>eh,toInt32ArrayIterator:()=>Yf,toInt8Array:()=>Cf,toInt8ArrayAsyncIterator:()=>qf,toInt8ArrayIterator:()=>$f,toUint16Array:()=>kf,toUint16ArrayAsyncIterator:()=>rh,toUint16ArrayIterator:()=>Kf,toUint32Array:()=>Vf,toUint32ArrayAsyncIterator:()=>nh,toUint32ArrayIterator:()=>Zf,toUint8Array:()=>D,toUint8ArrayAsyncIterator:()=>ia,toUint8ArrayIterator:()=>na,toUint8ClampedArray:()=>Gf,toUint8ClampedArrayAsyncIterator:()=>oh,toUint8ClampedArrayIterator:()=>Qf});var Nf=new TextDecoder("utf-8"),Qn=r=>Nf.decode(r),Uf=new TextEncoder,Ne=r=>Uf.encode(r);var Ef=r=>typeof r=="number",kc=r=>typeof r=="boolean",bt=r=>typeof r=="function",Rt=r=>r!=null&&Object(r)===r,se=r=>Rt(r)&&bt(r.then);var Ie=r=>Rt(r)&&bt(r[Symbol.iterator]),fe=r=>Rt(r)&&bt(r[Symbol.asyncIterator]),us=r=>Rt(r)&&Rt(r.schema);var fs=r=>Rt(r)&&"done"in r&&"value"in r;var hs=r=>Rt(r)&&bt(r.stat)&&Ef(r.fd);var ds=r=>Rt(r)&&qn(r.body),ps=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Vc=r=>Rt(r)&&bt(r.abort)&&bt(r.getWriter)&&!ps(r),qn=r=>Rt(r)&&bt(r.cancel)&&bt(r.getReader)&&!ps(r),jc=r=>Rt(r)&&bt(r.end)&&bt(r.write)&&kc(r.writable)&&!ps(r),ms=r=>Rt(r)&&bt(r.read)&&bt(r.pipe)&&kc(r.readable)&&!ps(r),zc=r=>Rt(r)&&bt(r.clear)&&bt(r.bytes)&&bt(r.position)&&bt(r.setPosition)&&bt(r.capacity)&&bt(r.getBufferIdentifier)&&bt(r.createLong);var ra=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Rf(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 ti(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 oe(r,t){let e=Rf(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?ti(o,s,a):o=s;break}ti(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=fs(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Ne(e)),e instanceof ArrayBuffer?new r(e):e instanceof ra?new r(e):zc(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 Cf=r=>C(Int8Array,r),Pf=r=>C(Int16Array,r),Rr=r=>C(Int32Array,r),ys=r=>C(BigInt64Array,r),D=r=>C(Uint8Array,r),kf=r=>C(Uint16Array,r),Vf=r=>C(Uint32Array,r),jf=r=>C(BigUint64Array,r),zf=r=>C(Float32Array,r),Wf=r=>C(Float64Array,r),Gf=r=>C(Uint8ClampedArray,r),ea=r=>(r.next(),r);function*Ue(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ra?e(t):Ie(t)?t:e(t);return yield*ea(function*(i){let s=null;do s=i.next(yield C(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var $f=r=>Ue(Int8Array,r),Hf=r=>Ue(Int16Array,r),Yf=r=>Ue(Int32Array,r),na=r=>Ue(Uint8Array,r),Kf=r=>Ue(Uint16Array,r),Zf=r=>Ue(Uint32Array,r),Jf=r=>Ue(Float32Array,r),Xf=r=>Ue(Float64Array,r),Qf=r=>Ue(Uint8ClampedArray,r);function xe(r,t){return ie(this,arguments,function*(){if(se(t))return yield E(yield E(yield*yn(ve(xe(r,yield E(t))))));let n=function(o){return ie(this,arguments,function*(){yield yield E(yield E(o))})},i=function(o){return ie(this,arguments,function*(){yield E(yield*yn(ve(ea(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 ra?n(t):Ie(t)?i(t):fe(t)?t:n(t);return yield E(yield*yn(ve(ea(function(o){return ie(this,arguments,function*(){let a=null;do a=yield E(o.next(yield yield E(C(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield E(new r)})}var qf=r=>xe(Int8Array,r),th=r=>xe(Int16Array,r),eh=r=>xe(Int32Array,r),ia=r=>xe(Uint8Array,r),rh=r=>xe(Uint16Array,r),nh=r=>xe(Uint32Array,r),ih=r=>xe(Float32Array,r),sh=r=>xe(Float64Array,r),oh=r=>xe(Uint8ClampedArray,r);function gs(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 sa(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 bs(ah(r))},fromAsyncIterable(r){return bs(ch(r))},fromDOMStream(r){return bs(lh(r))},fromNodeStream(r){return bs(uh(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')}},bs=r=>(r.next(),r);function*ah(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?oe(n,o)[0]:([i,n,a]=oe(n,o),i)}({cmd:s,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=na(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 ch(r){return ie(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?oe(i,a)[0]:([s,i,c]=oe(i,a),s)}({cmd:o,size:a}=(yield yield E((()=>null)()))||{cmd:"read",size:0});let u=ia(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield E(u.next()):yield E(u.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield E(l()));while(a<c);while(!e)}catch(h){(n=!0)&&typeof u.throw=="function"&&(yield E(u.throw(h)))}finally{n===!1&&typeof u.return=="function"&&(yield E(u.return(new Uint8Array(0))))}return yield E(null)})}function lh(r){return ie(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?oe(i,a)[0]:([s,i,c]=oe(i,a),s)}({cmd:o,size:a}=(yield yield E((()=>null)()))||{cmd:"read",size:0});let u=new ca(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield E(u.read()):yield E(u.read(a-c)),!e&&s.byteLength>0&&(i.push(D(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield E(l()));while(a<c);while(!e)}catch(h){(n=!0)&&(yield E(u.cancel(h)))}finally{n===!1?yield E(u.cancel()):r.locked&&u.releaseLock()}return yield E(null)})}var ca=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 g(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 g(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=D(e)),e})}},aa=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function uh(r){return ie(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,l=[],u;function h(){return o==="peek"?oe(l,a)[0]:([u,l,c]=oe(l,a),u)}if({cmd:o,size:a}=(yield yield E((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield E(new Uint8Array(0)),yield E(null);try{e[0]=aa(r,"end"),e[1]=aa(r,"error");do{if(e[2]=aa(r,"readable"),[n,s]=yield E(Promise.race(e.map(p=>p[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=D(r.read(a-c)),u.byteLength<a-c&&(u=D(r.read()))):u=D(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield E(h()));while(a<c)}while(!i)}finally{yield E(d(e,n==="error"?s:null))}return yield E(null);function d(p,v){return u=l=null,new Promise((k,Z)=>{for(let[et,pn]of p)r.off(et,pn);try{let et=r.destroy;et&&et.call(r,v),v=void 0}catch(et){v=et||v}finally{v!=null?Z(v):k()}})}})}var H;(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"})(H||(H={}));var J;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(J||(J={}));var z;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(z||(z={}));var rt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(rt||(rt={}));var m;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(m||(m={}));var it;(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"})(it||(it={}));var Ee=new Int32Array(2),ws=new Float32Array(Ee.buffer),_s=new Float64Array(Ee.buffer),gn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ei;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(ei||(ei={}));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 Ee[0]=this.readInt32(t),ws[0]}readFloat64(t){return Ee[gn?0:1]=this.readInt32(t),Ee[gn?1:0]=this.readInt32(t+4),_s[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){ws[0]=e,this.writeInt32(t,Ee[0])}writeFloat64(t,e){_s[0]=e,this.writeInt32(t,Ee[gn?0:1]),this.writeInt32(t+4,Ee[gn?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===ei.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 ri;(function(r){r[r.BUFFER=0]="BUFFER"})(ri||(ri={}));var ni;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ni||(ni={}));var Be=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 Be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new Be).__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):ni.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ri.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ni.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ri.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Be.startBodyCompression(t),Be.addCodec(t,e),Be.addMethod(t,n),Be.endBodyCompression(t)}};var bn=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 wn=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 wn).__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 bn).__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 Be).__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 de=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 de).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new de).__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 ii;(function(r){r[r.DenseArray=0]="DenseArray"})(ii||(ii={}));var wt=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 wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new wt).__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 wt.startInt(t),wt.addBitWidth(t,e),wt.addIsSigned(t,n),wt.endInt(t)}};var ae=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 ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new wt).__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):ii.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,ii.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 Re=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 Re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new Re).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Re.startBinary(t),Re.endBinary(t)}};var Ce=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new Ce).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Ce.startBool(t),Ce.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):rt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,rt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Gt.startDate(t),Gt.addUnit(t,e),Gt.endDate(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 getRootAsDecimal(t,e){return(e||new _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new _t).__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 _t.startDecimal(t),_t.addPrecision(t,e),_t.addScale(t,n),_t.addBitWidth(t,i),_t.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):m.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,m.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):z.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,z.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):it.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,it.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Zt.startInterval(t),Zt.addUnit(t,e),Zt.endInterval(t)}};var Pe=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 Pe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Pe).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Pe.startLargeBinary(t),Pe.endLargeBinary(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 getRootAsLargeUtf8(t,e){return(e||new ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new ke).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return ke.startLargeUtf8(t),ke.endLargeUtf8(t)}};var Ve=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 Ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new Ve).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Ve.startList(t),Ve.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 je=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 je).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new je).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return je.startNull(t),je.endNull(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 getRootAsStruct_(t,e){return(e||new ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new ze).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return ze.startStruct_(t),ze.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):m.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,m.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):m.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,m.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 vt=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 vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new vt).__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):J.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,J.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 vt.startUnion(t),vt.addMode(t,e),vt.addTypeIds(t,n),vt.endUnion(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 getRootAsUtf8(t,e){return(e||new We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new We).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return We.startUtf8(t),We.endUtf8(t)}};var X;(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"})(X||(X={}));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):X.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 ae).__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,X.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 Ta={};Ir(Ta,{clampIndex:()=>Xh,clampRange:()=>ai,createElementComparator:()=>Dr});var la={};Ir(la,{valueToString:()=>Ae});function Ae(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=>Ae(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var fa={};Ir(fa,{BN:()=>Cr,bigNumToBigInt:()=>$c,bigNumToString:()=>In,isArrowBigNumSymbol:()=>Wc});var Wc=Symbol.for("isArrowBigNum");function Te(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)}Te.prototype[Wc]=!0;Te.prototype.toJSON=function(){return`"${In(this)}"`};Te.prototype.valueOf=function(){return Gc(this)};Te.prototype.toString=function(){return In(this)};Te.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Gc(this);case"string":return In(this);case"default":return $c(this)}return In(this)};function _n(...r){return Te.apply(this,r)}function vn(...r){return Te.apply(this,r)}function si(...r){return Te.apply(this,r)}Object.setPrototypeOf(_n.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(vn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(si.prototype,Object.create(Uint32Array.prototype));Object.assign(_n.prototype,Te.prototype,{constructor:_n,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(vn.prototype,Te.prototype,{constructor:vn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(si.prototype,Te.prototype,{constructor:si,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Gc(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 In=r=>{if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return ua(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ua(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`-${ua(t)}`},$c=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:In(r);function ua(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 _n(t);case!1:return new vn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new _n(t)}return t.byteLength===16?new si(t):new vn(t)}static signed(t){return new _n(t)}static unsigned(t){return new vn(t)}static decimal(t){return new si(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 Hc,Yc,Kc,Zc,Jc,Xc,Qc,qc,tl,el,rl,nl,il,sl,ol,al,cl,ll,ul,fl,hl,dl,y=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 y.isUnion(t)&&t.mode===J.Dense}static isSparseUnion(t){return y.isUnion(t)&&t.mode===J.Sparse}constructor(t){this.typeId=t}};Hc=Symbol.toStringTag;y[Hc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(y.prototype);var ut=class extends y{constructor(){super(f.Null)}toString(){return"Null"}};Yc=Symbol.toStringTag;ut[Yc]=(r=>r[Symbol.toStringTag]="Null")(ut.prototype);var st=class extends y{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}`}};Kc=Symbol.toStringTag;st[Kc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(st.prototype);var Ge=class extends st{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},$e=class extends st{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},It=class extends st{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},pe=class extends st{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},He=class extends st{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Ye=class extends st{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ke=class extends st{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ze=class extends st{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ge.prototype,"ArrayType",{value:Int8Array});Object.defineProperty($e.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(It.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(pe.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(He.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ye.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ke.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ze.prototype,"ArrayType",{value:BigUint64Array});var At=class extends y{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case z.HALF:return Uint16Array;case z.SINGLE:return Float32Array;case z.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Zc=Symbol.toStringTag;At[Zc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(At.prototype);var Br=class extends At{constructor(){super(z.HALF)}},me=class extends At{constructor(){super(z.SINGLE)}},ye=class extends At{constructor(){super(z.DOUBLE)}};Object.defineProperty(Br.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(me.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(ye.prototype,"ArrayType",{value:Float64Array});var ce=class extends y{constructor(){super(f.Binary)}toString(){return"Binary"}};Jc=Symbol.toStringTag;ce[Jc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ce.prototype);var Je=class extends y{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Xc=Symbol.toStringTag;Je[Xc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Je.prototype);var Pt=class extends y{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Qc=Symbol.toStringTag;Pt[Qc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Pt.prototype);var Xe=class extends y{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};qc=Symbol.toStringTag;Xe[qc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Xe.prototype);var kt=class extends y{constructor(){super(f.Bool)}toString(){return"Bool"}};tl=Symbol.toStringTag;kt[tl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(kt.prototype);var le=class extends y{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}]`}};el=Symbol.toStringTag;le[el]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(le.prototype);var Xt=class extends y{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${rt[this.unit]}>`}};rl=Symbol.toStringTag;Xt[rl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(Xt.prototype);var Pr=class extends Xt{constructor(){super(rt.DAY)}},cr=class extends Xt{constructor(){super(rt.MILLISECOND)}},xt=class extends y{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${m[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};nl=Symbol.toStringTag;xt[nl]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(xt.prototype);var kr=class extends xt{constructor(){super(m.SECOND,32)}},Vr=class extends xt{constructor(){super(m.MILLISECOND,32)}},jr=class extends xt{constructor(){super(m.MICROSECOND,64)}},zr=class extends xt{constructor(){super(m.NANOSECOND,64)}},Nt=class extends y{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${m[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};il=Symbol.toStringTag;Nt[il]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Nt.prototype);var Wr=class extends Nt{constructor(t){super(m.SECOND,t)}},Gr=class extends Nt{constructor(t){super(m.MILLISECOND,t)}},$r=class extends Nt{constructor(t){super(m.MICROSECOND,t)}},Hr=class extends Nt{constructor(t){super(m.NANOSECOND,t)}},Qt=class extends y{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${it[this.unit]}>`}};sl=Symbol.toStringTag;Qt[sl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Qt.prototype);var Yr=class extends Qt{constructor(){super(it.DAY_TIME)}},Kr=class extends Qt{constructor(){super(it.YEAR_MONTH)}},Qe=class extends y{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${m[this.unit]}>`}};ol=Symbol.toStringTag;Qe[ol]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Qe.prototype);var Tt=class extends y{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}};al=Symbol.toStringTag;Tt[al]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Tt.prototype);var V=class extends y{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};cl=Symbol.toStringTag;V[cl]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(V.prototype);var ge=class extends y{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(" | ")}>`}};ll=Symbol.toStringTag;ge[ll]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ge.prototype);var qe=class extends y{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};ul=Symbol.toStringTag;qe[ul]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(qe.prototype);var Vt=class extends y{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}>`}};fl=Symbol.toStringTag;Vt[fl]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Vt.prototype);var jt=class extends y{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(", ")}}>`}};hl=Symbol.toStringTag;jt[hl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(jt.prototype);var fh=(r=>()=>++r)(-1),Ut=class extends y{constructor(t,e,n,i){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?fh():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}>`}};dl=Symbol.toStringTag;Ut[dl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ut.prototype);function ue(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 I=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 hh(this,t,e)}getVisitFnByTypeId(t,e=!0){return xn(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 hh(r,t,e=!0){return typeof t=="number"?xn(r,t,e):typeof t=="string"&&t in f?xn(r,f[t],e):t&&t instanceof y?xn(r,ml(t),e):t?.type&&t.type instanceof y?xn(r,ml(t.type),e):xn(r,f.NONE,e)}function xn(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 ml(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 z.HALF:return f.Float16;case z.SINGLE:return f.Float32;case z.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 m.SECOND:return f.TimeSecond;case m.MILLISECOND:return f.TimeMillisecond;case m.MICROSECOND:return f.TimeMicrosecond;case m.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case m.SECOND:return f.TimestampSecond;case m.MILLISECOND:return f.TimestampMillisecond;case m.MICROSECOND:return f.TimestampMicrosecond;case m.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case rt.DAY:return f.DateDay;case rt.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case it.DAY_TIME:return f.IntervalDayTime;case it.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case m.SECOND:return f.DurationSecond;case m.MILLISECOND:return f.DurationMillisecond;case m.MICROSECOND:return f.DurationMicrosecond;case m.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 J.Dense:return f.DenseUnion;case J.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]}'`)}I.prototype.visitInt8=null;I.prototype.visitInt16=null;I.prototype.visitInt32=null;I.prototype.visitInt64=null;I.prototype.visitUint8=null;I.prototype.visitUint16=null;I.prototype.visitUint32=null;I.prototype.visitUint64=null;I.prototype.visitFloat16=null;I.prototype.visitFloat32=null;I.prototype.visitFloat64=null;I.prototype.visitDateDay=null;I.prototype.visitDateMillisecond=null;I.prototype.visitTimestampSecond=null;I.prototype.visitTimestampMillisecond=null;I.prototype.visitTimestampMicrosecond=null;I.prototype.visitTimestampNanosecond=null;I.prototype.visitTimeSecond=null;I.prototype.visitTimeMillisecond=null;I.prototype.visitTimeMicrosecond=null;I.prototype.visitTimeNanosecond=null;I.prototype.visitDenseUnion=null;I.prototype.visitSparseUnion=null;I.prototype.visitIntervalDayTime=null;I.prototype.visitIntervalYearMonth=null;I.prototype.visitDuration=null;I.prototype.visitDurationSecond=null;I.prototype.visitDurationMillisecond=null;I.prototype.visitDurationMicrosecond=null;I.prototype.visitDurationNanosecond=null;var ha={};Ir(ha,{float64ToUint16:()=>oi,uint16ToFloat64:()=>Is});var yl=new Float64Array(1),Sn=new Uint32Array(yl.buffer);function Is(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 oi(r){if(r!==r)return 32256;yl[0]=r;let t=(Sn[1]&2147483648)>>16&65535,e=Sn[1]&2146435072,n=0;return e>=1089470464?Sn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Sn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Sn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Sn[1]&1048575)+512>>10),t|e|n&65535}var T=class extends I{};function L(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var dh=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},da=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},ph=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},mh=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},gl=(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)}},yh=({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},pa=({values:r},t,e)=>{r[t]=e},bl=({values:r},t,e)=>{r[t]=oi(e)},gh=(r,t,e)=>{switch(r.type.precision){case z.HALF:return bl(r,t,e);case z.SINGLE:case z.DOUBLE:return pa(r,t,e)}},xs=({values:r},t,e)=>{dh(r,t,e.valueOf())},Ss=({values:r},t,e)=>{da(r,t*2,e.valueOf())},ma=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},wl=({values:r,valueOffsets:t},e,n)=>gl(r,t,e,n),_l=({values:r,valueOffsets:t},e,n)=>gl(r,t,e,Ne(n)),ya=(r,t,e)=>{r.type.unit===rt.DAY?xs(r,t,e):Ss(r,t,e)},Bs=({values:r},t,e)=>da(r,t*2,e/1e3),As=({values:r},t,e)=>da(r,t*2,e),Ts=({values:r},t,e)=>ph(r,t*2,e),Ds=({values:r},t,e)=>mh(r,t*2,e),ga=(r,t,e)=>{switch(r.type.unit){case m.SECOND:return Bs(r,t,e);case m.MILLISECOND:return As(r,t,e);case m.MICROSECOND:return Ts(r,t,e);case m.NANOSECOND:return Ds(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},Ls=({values:r},t,e)=>{r[t]=e},ba=(r,t,e)=>{switch(r.type.unit){case m.SECOND:return Os(r,t,e);case m.MILLISECOND:return Fs(r,t,e);case m.MICROSECOND:return Ms(r,t,e);case m.NANOSECOND:return Ls(r,t,e)}},wa=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},bh=(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))},wh=(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},_h=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),vh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),Ih=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),xh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),Sh=(r,t,e)=>{let n=r.type.children.map(s=>Dt.getVisitFn(s.type)),i=e instanceof Map?Ih(t,e):e instanceof b?vh(t,e):Array.isArray(e)?_h(t,e):xh(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Bh=(r,t,e)=>{r.type.mode===J.Dense?vl(r,t,e):Il(r,t,e)},vl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,r.valueOffsets[t],e)},Il=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,t,e)},Ah=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},_a=(r,t,e)=>{r.type.unit===it.DAY_TIME?Ns(r,t,e):Us(r,t,e)},Ns=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Us=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Es=({values:r},t,e)=>{r[t]=e},Rs=({values:r},t,e)=>{r[t]=e},Cs=({values:r},t,e)=>{r[t]=e},Ps=({values:r},t,e)=>{r[t]=e},va=(r,t,e)=>{switch(r.type.unit){case m.SECOND:return Es(r,t,e);case m.MILLISECOND:return Rs(r,t,e);case m.MICROSECOND:return Cs(r,t,e);case m.NANOSECOND:return Ps(r,t,e)}},Th=(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))};T.prototype.visitBool=L(yh);T.prototype.visitInt=L(lr);T.prototype.visitInt8=L(lr);T.prototype.visitInt16=L(lr);T.prototype.visitInt32=L(lr);T.prototype.visitInt64=L(lr);T.prototype.visitUint8=L(lr);T.prototype.visitUint16=L(lr);T.prototype.visitUint32=L(lr);T.prototype.visitUint64=L(lr);T.prototype.visitFloat=L(gh);T.prototype.visitFloat16=L(bl);T.prototype.visitFloat32=L(pa);T.prototype.visitFloat64=L(pa);T.prototype.visitUtf8=L(_l);T.prototype.visitLargeUtf8=L(_l);T.prototype.visitBinary=L(wl);T.prototype.visitLargeBinary=L(wl);T.prototype.visitFixedSizeBinary=L(ma);T.prototype.visitDate=L(ya);T.prototype.visitDateDay=L(xs);T.prototype.visitDateMillisecond=L(Ss);T.prototype.visitTimestamp=L(ga);T.prototype.visitTimestampSecond=L(Bs);T.prototype.visitTimestampMillisecond=L(As);T.prototype.visitTimestampMicrosecond=L(Ts);T.prototype.visitTimestampNanosecond=L(Ds);T.prototype.visitTime=L(ba);T.prototype.visitTimeSecond=L(Os);T.prototype.visitTimeMillisecond=L(Fs);T.prototype.visitTimeMicrosecond=L(Ms);T.prototype.visitTimeNanosecond=L(Ls);T.prototype.visitDecimal=L(wa);T.prototype.visitList=L(bh);T.prototype.visitStruct=L(Sh);T.prototype.visitUnion=L(Bh);T.prototype.visitDenseUnion=L(vl);T.prototype.visitSparseUnion=L(Il);T.prototype.visitDictionary=L(Ah);T.prototype.visitInterval=L(_a);T.prototype.visitIntervalDayTime=L(Ns);T.prototype.visitIntervalYearMonth=L(Us);T.prototype.visitDuration=L(va);T.prototype.visitDurationSecond=L(Es);T.prototype.visitDurationMillisecond=L(Rs);T.prototype.visitDurationMicrosecond=L(Cs);T.prototype.visitDurationNanosecond=L(Ps);T.prototype.visitFixedSizeList=L(Th);T.prototype.visitMap=L(wh);var Dt=new T;var De=Symbol.for("parent"),Bn=Symbol.for("rowIndex"),Ar=class{constructor(t,e){return this[De]=t,this[Bn]=e,new Proxy(this,new xa)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Bn],e=this[De],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=pt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${Ae(t)}: ${Ae(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ia(this[De],this[Bn])}},Ia=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,pt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[De]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Bn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var xa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[De].type.children.map(e=>e.name)}has(t,e){return t[De].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[De].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[De].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=pt.visit(t[De].children[n],t[Bn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[De].type.children.findIndex(s=>s.name===e);return i!==-1?(Dt.visit(t[De].children[i],t[Bn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var x=class extends I{};function F(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Dh=(r,t)=>864e5*r[t],Sa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Oh=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Fh=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,xl=r=>new Date(r),Mh=(r,t)=>xl(Dh(r,t)),Lh=(r,t)=>xl(Sa(r,t)),Nh=(r,t)=>null,Sl=(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)},Uh=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Bl=({values:r},t)=>Mh(r,t),Al=({values:r},t)=>Lh(r,t*2),Tr=({stride:r,values:t},e)=>t[r*e],Eh=({stride:r,values:t},e)=>Is(t[r*e]),Tl=({values:r},t)=>r[t],Rh=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Dl=({values:r,valueOffsets:t},e)=>Sl(r,t,e),Ol=({values:r,valueOffsets:t},e)=>{let n=Sl(r,t,e);return n!==null?Qn(n):null},Ch=({values:r},t)=>r[t],Ph=({type:r,values:t},e)=>r.precision!==z.HALF?t[e]:Is(t[e]),kh=(r,t)=>r.type.unit===rt.DAY?Bl(r,t):Al(r,t),Fl=({values:r},t)=>1e3*Sa(r,t*2),Ml=({values:r},t)=>Sa(r,t*2),Ll=({values:r},t)=>Oh(r,t*2),Nl=({values:r},t)=>Fh(r,t*2),Vh=(r,t)=>{switch(r.type.unit){case m.SECOND:return Fl(r,t);case m.MILLISECOND:return Ml(r,t);case m.MICROSECOND:return Ll(r,t);case m.NANOSECOND:return Nl(r,t)}},Ul=({values:r},t)=>r[t],El=({values:r},t)=>r[t],Rl=({values:r},t)=>r[t],Cl=({values:r},t)=>r[t],jh=(r,t)=>{switch(r.type.unit){case m.SECOND:return Ul(r,t);case m.MILLISECOND:return El(r,t);case m.MICROSECOND:return Rl(r,t);case m.NANOSECOND:return Cl(r,t)}},zh=({values:r,stride:t},e)=>Cr.decimal(r.subarray(t*e,t*(e+1))),Wh=(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 b([c])},Gh=(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))},$h=(r,t)=>new Ar(r,t),Hh=(r,t)=>r.type.mode===J.Dense?Pl(r,t):kl(r,t),Pl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return pt.visit(n,r.valueOffsets[t])},kl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return pt.visit(n,t)},Yh=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Kh=(r,t)=>r.type.unit===it.DAY_TIME?Vl(r,t):jl(r,t),Vl=({values:r},t)=>r.subarray(2*t,2*(t+1)),jl=({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},zl=({values:r},t)=>r[t],Wl=({values:r},t)=>r[t],Gl=({values:r},t)=>r[t],$l=({values:r},t)=>r[t],Zh=(r,t)=>{switch(r.type.unit){case m.SECOND:return zl(r,t);case m.MILLISECOND:return Wl(r,t);case m.MICROSECOND:return Gl(r,t);case m.NANOSECOND:return $l(r,t)}},Jh=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new b([s])};x.prototype.visitNull=F(Nh);x.prototype.visitBool=F(Uh);x.prototype.visitInt=F(Ch);x.prototype.visitInt8=F(Tr);x.prototype.visitInt16=F(Tr);x.prototype.visitInt32=F(Tr);x.prototype.visitInt64=F(Tl);x.prototype.visitUint8=F(Tr);x.prototype.visitUint16=F(Tr);x.prototype.visitUint32=F(Tr);x.prototype.visitUint64=F(Tl);x.prototype.visitFloat=F(Ph);x.prototype.visitFloat16=F(Eh);x.prototype.visitFloat32=F(Tr);x.prototype.visitFloat64=F(Tr);x.prototype.visitUtf8=F(Ol);x.prototype.visitLargeUtf8=F(Ol);x.prototype.visitBinary=F(Dl);x.prototype.visitLargeBinary=F(Dl);x.prototype.visitFixedSizeBinary=F(Rh);x.prototype.visitDate=F(kh);x.prototype.visitDateDay=F(Bl);x.prototype.visitDateMillisecond=F(Al);x.prototype.visitTimestamp=F(Vh);x.prototype.visitTimestampSecond=F(Fl);x.prototype.visitTimestampMillisecond=F(Ml);x.prototype.visitTimestampMicrosecond=F(Ll);x.prototype.visitTimestampNanosecond=F(Nl);x.prototype.visitTime=F(jh);x.prototype.visitTimeSecond=F(Ul);x.prototype.visitTimeMillisecond=F(El);x.prototype.visitTimeMicrosecond=F(Rl);x.prototype.visitTimeNanosecond=F(Cl);x.prototype.visitDecimal=F(zh);x.prototype.visitList=F(Wh);x.prototype.visitStruct=F($h);x.prototype.visitUnion=F(Hh);x.prototype.visitDenseUnion=F(Pl);x.prototype.visitSparseUnion=F(kl);x.prototype.visitDictionary=F(Yh);x.prototype.visitInterval=F(Kh);x.prototype.visitIntervalDayTime=F(Vl);x.prototype.visitIntervalYearMonth=F(jl);x.prototype.visitDuration=F(Zh);x.prototype.visitDurationSecond=F(zl);x.prototype.visitDurationMillisecond=F(Wl);x.prototype.visitDurationMicrosecond=F(Gl);x.prototype.visitDurationNanosecond=F($l);x.prototype.visitFixedSizeList=F(Jh);x.prototype.visitMap=F(Gh);var pt=new x;var be=Symbol.for("keys"),An=Symbol.for("vals"),tr=class{constructor(t){return this[be]=new b([t.children[0]]).memoize(),this[An]=t.children[1],new Proxy(this,new Aa)}[Symbol.iterator](){return new Ba(this[be],this[An])}get size(){return this[be].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[be],e=this[An],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=pt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${Ae(t)}: ${Ae(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Ba=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),pt.visit(this.vals,t)]})}},Aa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[be].toArray().map(String)}has(t,e){return t[be].includes(e)}getOwnPropertyDescriptor(t,e){if(t[be].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[be].indexOf(e);if(n!==-1){let i=pt.visit(Reflect.get(t,An),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[be].indexOf(e);return i!==-1?(Dt.visit(Reflect.get(t,An),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"},[be]:{writable:!0,enumerable:!1,configurable:!1,value:null},[An]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Xh(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var Hl;function ai(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&&(Hl=s,s=o,o=Hl),o>i&&(o=i),n?n(r,s,o):[s,o]}var Yl=r=>r!==r;function Dr(r){if(typeof r!=="object"||r===null)return Yl(r)?Yl:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?sa(r,e):!1:r instanceof Map?qh(r):Array.isArray(r)?Qh(r):r instanceof b?td(r):ed(r,!0)}function Qh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r[e]);return ks(t)}function qh(r){let t=-1,e=[];for(let n of r.values())e[++t]=Dr(n);return ks(e)}function td(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r.get(e));return ks(t)}function ed(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 ks(n,e)}function ks(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return rd(r,e);case Map:return Kl(r,e,e.keys());case tr:case Ar:case Object:case void 0:return Kl(r,e,t||Object.keys(e))}return e instanceof b?nd(r,e):!1}}function rd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function nd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function Kl(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 Da={};Ir(Da,{BitIterator:()=>Zr,getBit:()=>Zl,getBool:()=>js,packBools:()=>Xr,popcnt_array:()=>Jl,popcnt_bit_range:()=>ci,popcnt_uint32:()=>Vs,setBool:()=>id,truncateBitmap:()=>Jr});function js(r,t,e,n){return(e&1<<n)!==0}function Zl(r,t,e,n){return(e&1<<n)>>n}function id(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,js)).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 ci(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,Zl))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ci(r,t,i)+ci(r,n,e)+Jl(r,i>>3,n-i>>3)}function Jl(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+=Vs(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Vs(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Vs(s.getUint8(i)),i+=1;return n}function Vs(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 sd=-1,U=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 y.isSparseUnion(t)?this.children.some(e=>e.nullable):y.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(y.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=sd&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-ci(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 U?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=ue(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(y.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===J.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(y.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===J.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 U(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))}};U.prototype.children=Object.freeze([]);var Qr=class extends I{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new U(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.data),s=D(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.data),s=D(t.nullBitmap),o=ys(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.data),s=D(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.data),s=D(t.nullBitmap),o=ys(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=D(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=D(t.nullBitmap),{length:o=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new U(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(y.isSparseUnion(e))return new U(e,n,o,a,[void 0,void 0,void 0,s],i);let c=Rr(t.valueOffsets);return new U(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.indices.ArrayType,t.data),{["dictionary"]:o=new b([new Qr().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=D(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(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=D(t.nullBitmap),{["length"]:o=i.length/ue(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new U(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=D(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new U(e,n,a,c,[o,void 0,s],[i])}},od=new Qr;function w(r){return od.visit(r)}var li=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 Xl(r){return r.some(t=>t.nullable)}function zs(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Ws(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Gs(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 Oa(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 ui(r,t){return r.getValid(t)}function Tn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Oa(n,this._offsets,e,t)}}function $s(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=Oa(s,this._offsets,n,e);return t=void 0,o}}function Hs(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):Oa(s,this._offsets,i,e);return t=void 0,o}}var S=class extends I{};function ad(r,t){return t===null&&r.length>0?0:-1}function cd(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new Zr(e,r.offset+(t||0),r.length,e,js)){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 cd(r,e)}let n=pt.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 Ql(r,t,e){let n=pt.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}S.prototype.visitNull=ad;S.prototype.visitBool=N;S.prototype.visitInt=N;S.prototype.visitInt8=N;S.prototype.visitInt16=N;S.prototype.visitInt32=N;S.prototype.visitInt64=N;S.prototype.visitUint8=N;S.prototype.visitUint16=N;S.prototype.visitUint32=N;S.prototype.visitUint64=N;S.prototype.visitFloat=N;S.prototype.visitFloat16=N;S.prototype.visitFloat32=N;S.prototype.visitFloat64=N;S.prototype.visitUtf8=N;S.prototype.visitLargeUtf8=N;S.prototype.visitBinary=N;S.prototype.visitLargeBinary=N;S.prototype.visitFixedSizeBinary=N;S.prototype.visitDate=N;S.prototype.visitDateDay=N;S.prototype.visitDateMillisecond=N;S.prototype.visitTimestamp=N;S.prototype.visitTimestampSecond=N;S.prototype.visitTimestampMillisecond=N;S.prototype.visitTimestampMicrosecond=N;S.prototype.visitTimestampNanosecond=N;S.prototype.visitTime=N;S.prototype.visitTimeSecond=N;S.prototype.visitTimeMillisecond=N;S.prototype.visitTimeMicrosecond=N;S.prototype.visitTimeNanosecond=N;S.prototype.visitDecimal=N;S.prototype.visitList=N;S.prototype.visitStruct=N;S.prototype.visitUnion=N;S.prototype.visitDenseUnion=Ql;S.prototype.visitSparseUnion=Ql;S.prototype.visitDictionary=N;S.prototype.visitInterval=N;S.prototype.visitIntervalDayTime=N;S.prototype.visitIntervalYearMonth=N;S.prototype.visitDuration=N;S.prototype.visitDurationSecond=N;S.prototype.visitDurationMillisecond=N;S.prototype.visitDurationMicrosecond=N;S.prototype.visitDurationNanosecond=N;S.prototype.visitFixedSizeList=N;S.prototype.visitMap=N;var qr=new S;var B=class extends I{};function M(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof st&&t.bitWidth!==64||t instanceof xt&&t.bitWidth!==64||t instanceof At&&t.precision!==z.HALF))return new li(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new li(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Fa(o)})}var Fa=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}};B.prototype.visitNull=M;B.prototype.visitBool=M;B.prototype.visitInt=M;B.prototype.visitInt8=M;B.prototype.visitInt16=M;B.prototype.visitInt32=M;B.prototype.visitInt64=M;B.prototype.visitUint8=M;B.prototype.visitUint16=M;B.prototype.visitUint32=M;B.prototype.visitUint64=M;B.prototype.visitFloat=M;B.prototype.visitFloat16=M;B.prototype.visitFloat32=M;B.prototype.visitFloat64=M;B.prototype.visitUtf8=M;B.prototype.visitLargeUtf8=M;B.prototype.visitBinary=M;B.prototype.visitLargeBinary=M;B.prototype.visitFixedSizeBinary=M;B.prototype.visitDate=M;B.prototype.visitDateDay=M;B.prototype.visitDateMillisecond=M;B.prototype.visitTimestamp=M;B.prototype.visitTimestampSecond=M;B.prototype.visitTimestampMillisecond=M;B.prototype.visitTimestampMicrosecond=M;B.prototype.visitTimestampNanosecond=M;B.prototype.visitTime=M;B.prototype.visitTimeSecond=M;B.prototype.visitTimeMillisecond=M;B.prototype.visitTimeMicrosecond=M;B.prototype.visitTimeNanosecond=M;B.prototype.visitDecimal=M;B.prototype.visitList=M;B.prototype.visitStruct=M;B.prototype.visitUnion=M;B.prototype.visitDenseUnion=M;B.prototype.visitSparseUnion=M;B.prototype.visitDictionary=M;B.prototype.visitInterval=M;B.prototype.visitIntervalDayTime=M;B.prototype.visitIntervalYearMonth=M;B.prototype.visitDuration=M;B.prototype.visitDurationSecond=M;B.prototype.visitDurationMillisecond=M;B.prototype.visitDurationMicrosecond=M;B.prototype.visitDurationNanosecond=M;B.prototype.visitFixedSizeList=M;B.prototype.visitMap=M;var Dn=new B;var ql,tu={},eu={},b=class{constructor(t){var e,n,i;let s=t[0]instanceof b?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof U)))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}=tu[o.typeId],u=s[0];this.isValid=h=>ui(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,eu[o.typeId]),this._offsets=Ws(s);break}this.data=s,this.type=o,this.stride=ue(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 Xl(this.data)}get nullCount(){return zs(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 Dn.visit(this)}concat(...t){return new b(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new b(ai(this,t,e,({data:n,_offsets:i},s,o)=>Gs(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 b(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return y.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(y.isDictionary(this.type)){let t=new On(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new b(e)}return new On(this)}unmemoize(){if(y.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 b(e)}return this}};ql=Symbol.toStringTag;b[ql]=(r=>{r.type=y.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=pt.getVisitFnByTypeId(e),i=Dt.getVisitFnByTypeId(e),s=qr.getVisitFnByTypeId(e);tu[e]={get:n,set:i,indexOf:s},eu[e]=Object.create(r,{isValid:{value:Tn(ui)},get:{value:Tn(pt.getVisitFnByTypeId(e))},set:{value:$s(Dt.getVisitFnByTypeId(e))},indexOf:{value:Hs(qr.getVisitFnByTypeId(e))}})}return"Vector"})(b.prototype);var On=class extends b{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 On(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new b(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Or(r){if(r){if(r instanceof U)return new b([r]);if(r instanceof b)return new b(r.data);if(r.type instanceof y)return new b([w(r)]);if(Array.isArray(r))return new b(r.flatMap(t=>ld(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 b([w(Object.assign(Object.assign({},t),{type:new Ge}))]);if(r instanceof Int16Array)return new b([w(Object.assign(Object.assign({},t),{type:new $e}))]);if(r instanceof Int32Array)return new b([w(Object.assign(Object.assign({},t),{type:new It}))]);if(r instanceof BigInt64Array)return new b([w(Object.assign(Object.assign({},t),{type:new pe}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new b([w(Object.assign(Object.assign({},t),{type:new He}))]);if(r instanceof Uint16Array)return new b([w(Object.assign(Object.assign({},t),{type:new Ye}))]);if(r instanceof Uint32Array)return new b([w(Object.assign(Object.assign({},t),{type:new Ke}))]);if(r instanceof BigUint64Array)return new b([w(Object.assign(Object.assign({},t),{type:new Ze}))]);if(r instanceof Float32Array)return new b([w(Object.assign(Object.assign({},t),{type:new me}))]);if(r instanceof Float64Array)return new b([w(Object.assign(Object.assign({},t),{type:new ye}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function ld(r){return r instanceof U?[r]:r instanceof b?r.data:Or(r).data}function ru(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 Nu=Object.create;var Wn=Object.defineProperty;var Uu=Object.getOwnPropertyDescriptor;var Eu=Object.getOwnPropertyNames;var Ru=Object.getPrototypeOf,Cu=Object.prototype.hasOwnProperty;var ku=(r,t,e)=>t in r?Wn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Pu=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),br=(r,t)=>{for(var e in t)Wn(r,e,{get:t[e],enumerable:!0})},Vi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Eu(t))!Cu.call(r,i)&&i!==e&&Wn(r,i,{get:()=>t[i],enumerable:!(n=Uu(t,i))||n.enumerable});return r},ji=(r,t,e)=>(Vi(r,t,"default"),e&&Vi(e,t,"default")),Vu=(r,t,e)=>(e=r!=null?Nu(Ru(r)):{},Vi(t||!r||!r.__esModule?Wn(e,"default",{value:r,enumerable:!0}):e,r)),ju=r=>Vi(Wn({},"__esModule",{value:!0}),r);var za=(r,t,e)=>(ku(r,typeof t!="symbol"?t+"":t,e),e);var Ga=Pu((wp,Wa)=>{Wa.exports=globalThis.loaders});var Pi={};br(Pi,{ArrowFormat:()=>$a,ArrowLoader:()=>Xl,ArrowWorkerLoader:()=>cn,ArrowWriter:()=>ql,GeoArrowLoader:()=>vu,GeoArrowWorkerLoader:()=>ho,TriangulationWorker:()=>bo,VECTOR_TYPES:()=>Fr,hardClone:()=>Ri,parseGeoArrowOnWorker:()=>Mu,triangulateOnWorker:()=>Fu});ji(Pi,Vu(Ga(),1));var Fr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(Fr||(Fr={}));var $a={name:"Apache Arrow",id:"arrow",module:"arrow",category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"]};var zu="4.4.0-alpha.1",cn={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:zu,category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"],options:{arrow:{shape:"columnar-table"}}};function Ha(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function m(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(d){try{l(n.next(d))}catch(f){o(f)}}function c(d){try{l(n.throw(d))}catch(f){o(f)}}function l(d){d.done?s(d.value):i(d.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Ya(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(r){return this instanceof L?(this.v=r,this):new L(r)}function qt(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(N){return function(ot){return Promise.resolve(ot).then(N,f)}}function a(N,ot){n[N]&&(i[N]=function(yr){return new Promise(function(wo,gr){s.push([N,yr,wo,gr])>1||c(N,yr)})},ot&&(i[N]=ot(i[N])))}function c(N,ot){try{l(n[N](ot))}catch(yr){V(s[0][3],yr)}}function l(N){N.value instanceof L?Promise.resolve(N.value.v).then(d,f):V(s[0][2],N)}function d(N){c("next",N)}function f(N){c("throw",N)}function V(N,ot){N(ot),s.shift(),s.length&&c(s[0][0],s[0][1])}}function ln(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:L(r[i](o)),done:!1}:s?s(o):o}:s}}function he(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Ya=="function"?Ya(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 Bo={};br(Bo,{compareArrayLike:()=>xo,joinUint8Arrays:()=>te,memcpy:()=>Yn,rebaseValueOffsets:()=>Ki,toArrayBufferView:()=>E,toArrayBufferViewAsyncIterator:()=>me,toArrayBufferViewIterator:()=>Ae,toBigInt64Array:()=>Ji,toBigUint64Array:()=>Xu,toFloat32Array:()=>qu,toFloat32ArrayAsyncIterator:()=>pd,toFloat32ArrayIterator:()=>od,toFloat64Array:()=>Qu,toFloat64ArrayAsyncIterator:()=>md,toFloat64ArrayIterator:()=>ad,toInt16Array:()=>Ju,toInt16ArrayAsyncIterator:()=>ud,toInt16ArrayIterator:()=>rd,toInt32Array:()=>Mr,toInt32ArrayAsyncIterator:()=>dd,toInt32ArrayIterator:()=>nd,toInt8Array:()=>Hu,toInt8ArrayAsyncIterator:()=>ld,toInt8ArrayIterator:()=>ed,toUint16Array:()=>Ku,toUint16ArrayAsyncIterator:()=>fd,toUint16ArrayIterator:()=>id,toUint32Array:()=>Zu,toUint32ArrayAsyncIterator:()=>hd,toUint32ArrayIterator:()=>sd,toUint8Array:()=>B,toUint8ArrayAsyncIterator:()=>So,toUint8ArrayIterator:()=>Io,toUint8ClampedArray:()=>td,toUint8ClampedArrayAsyncIterator:()=>yd,toUint8ClampedArrayIterator:()=>cd});var Wu=new TextDecoder("utf-8"),Gn=r=>Wu.decode(r),Gu=new TextEncoder,Be=r=>Gu.encode(r);var $u=r=>typeof r=="number",Ja=r=>typeof r=="boolean",ft=r=>typeof r=="function",Ot=r=>r!=null&&Object(r)===r,Qt=r=>Ot(r)&&ft(r.then);var pe=r=>Ot(r)&&ft(r[Symbol.iterator]),se=r=>Ot(r)&&ft(r[Symbol.asyncIterator]),zi=r=>Ot(r)&&Ot(r.schema);var Wi=r=>Ot(r)&&"done"in r&&"value"in r;var Gi=r=>Ot(r)&&ft(r.stat)&&$u(r.fd);var $i=r=>Ot(r)&&$n(r.body),Yi=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Ka=r=>Ot(r)&&ft(r.abort)&&ft(r.getWriter)&&!Yi(r),$n=r=>Ot(r)&&ft(r.cancel)&&ft(r.getReader)&&!Yi(r),Za=r=>Ot(r)&&ft(r.end)&&ft(r.write)&&Ja(r.writable)&&!Yi(r),Hi=r=>Ot(r)&&ft(r.read)&&ft(r.pipe)&&Ja(r.readable)&&!Yi(r),Xa=r=>Ot(r)&&ft(r.clear)&&ft(r.bytes)&&ft(r.position)&&ft(r.setPosition)&&ft(r.capacity)&&ft(r.getBufferIdentifier)&&ft(r.createLong);var vo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Yu(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,c=0,l=0,d=r.length;++c<d;){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 Yn(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 te(r,t){let e=Yu(r),n=e.reduce((d,f)=>d+f.byteLength,0),i,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let d=e.length;++c<d;){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?Yn(o,s,a):o=s;break}Yn(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function E(r,t){let e=Wi(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Be(e)),e instanceof ArrayBuffer?new r(e):e instanceof vo?new r(e):Xa(e)?E(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var Hu=r=>E(Int8Array,r),Ju=r=>E(Int16Array,r),Mr=r=>E(Int32Array,r),Ji=r=>E(BigInt64Array,r),B=r=>E(Uint8Array,r),Ku=r=>E(Uint16Array,r),Zu=r=>E(Uint32Array,r),Xu=r=>E(BigUint64Array,r),qu=r=>E(Float32Array,r),Qu=r=>E(Float64Array,r),td=r=>E(Uint8ClampedArray,r),_o=r=>(r.next(),r);function*Ae(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vo?e(t):pe(t)?t:e(t);return yield*_o(function*(i){let s=null;do s=i.next(yield E(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var ed=r=>Ae(Int8Array,r),rd=r=>Ae(Int16Array,r),nd=r=>Ae(Int32Array,r),Io=r=>Ae(Uint8Array,r),id=r=>Ae(Uint16Array,r),sd=r=>Ae(Uint32Array,r),od=r=>Ae(Float32Array,r),ad=r=>Ae(Float64Array,r),cd=r=>Ae(Uint8ClampedArray,r);function me(r,t){return qt(this,arguments,function*(){if(Qt(t))return yield L(yield L(yield*ln(he(me(r,yield L(t))))));let n=function(o){return qt(this,arguments,function*(){yield yield L(yield L(o))})},i=function(o){return qt(this,arguments,function*(){yield L(yield*ln(he(_o(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 vo?n(t):pe(t)?i(t):se(t)?t:n(t);return yield L(yield*ln(he(_o(function(o){return qt(this,arguments,function*(){let a=null;do a=yield L(o.next(yield yield L(E(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield L(new r)})}var ld=r=>me(Int8Array,r),ud=r=>me(Int16Array,r),dd=r=>me(Int32Array,r),So=r=>me(Uint8Array,r),fd=r=>me(Uint16Array,r),hd=r=>me(Uint32Array,r),pd=r=>me(Float32Array,r),md=r=>me(Float64Array,r),yd=r=>me(Uint8ClampedArray,r);function Ki(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function xo(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var bt={fromIterable(r){return Zi(gd(r))},fromAsyncIterable(r){return Zi(bd(r))},fromDOMStream(r){return Zi(wd(r))},fromNodeStream(r){return Zi(_d(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Zi=r=>(r.next(),r);function*gd(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?te(n,o)[0]:([i,n,a]=te(n,o),i)}({cmd:s,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Io(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(d){(e=!0)&&typeof l.throw=="function"&&l.throw(d)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function bd(r){return qt(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?te(i,a)[0]:([s,i,c]=te(i,a),s)}({cmd:o,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let d=So(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield L(d.next()):yield L(d.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(f){(n=!0)&&typeof d.throw=="function"&&(yield L(d.throw(f)))}finally{n===!1&&typeof d.return=="function"&&(yield L(d.return(new Uint8Array(0))))}return yield L(null)})}function wd(r){return qt(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?te(i,a)[0]:([s,i,c]=te(i,a),s)}({cmd:o,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let d=new To(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield L(d.read()):yield L(d.read(a-c)),!e&&s.byteLength>0&&(i.push(B(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(f){(n=!0)&&(yield L(d.cancel(f)))}finally{n===!1?yield L(d.cancel()):r.locked&&d.releaseLock()}return yield L(null)})}var To=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return m(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return m(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=B(e)),e})}},Ao=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function _d(r){return qt(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,l=[],d;function f(){return o==="peek"?te(l,a)[0]:([d,l,c]=te(l,a),d)}if({cmd:o,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield L(new Uint8Array(0)),yield L(null);try{e[0]=Ao(r,"end"),e[1]=Ao(r,"error");do{if(e[2]=Ao(r,"readable"),[n,s]=yield L(Promise.race(e.map(N=>N[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(d=B(r.read(a-c)),d.byteLength<a-c&&(d=B(r.read()))):d=B(r.read()),d.byteLength>0&&(l.push(d),c+=d.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield L(f()));while(a<c)}while(!i)}finally{yield L(V(e,n==="error"?s:null))}return yield L(null);function V(N,ot){return d=l=null,new Promise((yr,wo)=>{for(let[gr,Lu]of N)r.off(gr,Lu);try{let gr=r.destroy;gr&&gr.call(r,ot),ot=void 0}catch(gr){ot=gr||ot}finally{ot!=null?wo(ot):yr()}})}})}var z;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(z||(z={}));var Y;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Y||(Y={}));var P;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(P||(P={}));var J;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(J||(J={}));var h;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(h||(h={}));var Q;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Q||(Q={}));var Te=new Int32Array(2),Xi=new Float32Array(Te.buffer),qi=new Float64Array(Te.buffer),un=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hn;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Hn||(Hn={}));var Ft=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ft(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Te[0]=this.readInt32(t),Xi[0]}readFloat64(t){return Te[un?0:1]=this.readInt32(t),Te[un?1:0]=this.readInt32(t+4),qi[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){Xi[0]=e,this.writeInt32(t,Te[0])}writeFloat64(t,e){qi[0]=e,this.writeInt32(t,Te[un?0:1]),this.writeInt32(t+4,Te[un?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===Hn.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let 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 tr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Ft.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=tr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=Ft.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let 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;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Jn;(function(r){r[r.BUFFER=0]="BUFFER"})(Jn||(Jn={}));var Kn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Kn||(Kn={}));var ge=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Kn.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Jn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Kn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Jn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return ge.startBodyCompression(t),ge.addCodec(t,e),ge.addMethod(t,n),ge.endBodyCompression(t)}};var dn=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 fn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var It=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new It).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new fn).__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 dn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new ge).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var ae=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new It).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var wr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(wr||(wr={}));var Zn;(function(r){r[r.DenseArray=0]="DenseArray"})(Zn||(Zn={}));var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return ht.startInt(t),ht.addBitWidth(t,e),ht.addIsSigned(t,n),ht.endInt(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ht).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Zn.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Zn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var K=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new K).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new K).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return K.startKeyValue(t),K.addKey(t,e),K.addValue(t,n),K.endKeyValue(t)}};var De=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return De.startBinary(t),De.endBinary(t)}};var Oe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Oe.startBool(t),Oe.endBool(t)}};var kt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):J.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,J.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return kt.startDate(t),kt.addUnit(t,e),kt.endDate(t)}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return pt.startDecimal(t),pt.addPrecision(t,e),pt.addScale(t,n),pt.addBitWidth(t,i),pt.endDecimal(t)}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return Pt.startDuration(t),Pt.addUnit(t,e),Pt.endDuration(t)}};var Vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(t),Vt.addByteWidth(t,e),Vt.endFixedSizeBinary(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return jt.startFixedSizeList(t),jt.addListSize(t,e),jt.endFixedSizeList(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):P.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,P.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return zt.startFloatingPoint(t),zt.addPrecision(t,e),zt.endFloatingPoint(t)}};var Wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Q.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Q.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Wt.startInterval(t),Wt.addUnit(t,e),Wt.endInterval(t)}};var Fe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Fe.startLargeBinary(t),Fe.endLargeBinary(t)}};var Me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Me.startLargeUtf8(t),Me.endLargeUtf8(t)}};var Le=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Le.startList(t),Le.endList(t)}};var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Gt.startMap(t),Gt.addKeysSorted(t,e),Gt.endMap(t)}};var Ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ne.startNull(t),Ne.endNull(t)}};var Ue=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ue.startStruct_(t),Ue.endStruct_(t)}};var St=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return St.startTime(t),St.addUnit(t,e),St.addBitWidth(t,n),St.endTime(t)}};var xt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return xt.startTimestamp(t),xt.addUnit(t,e),xt.addTimezone(t,n),xt.endTimestamp(t)}};var mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Y.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return mt.startUnion(t),mt.addMode(t,e),mt.addTypeIds(t,n),mt.endUnion(t)}};var Ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ee.startUtf8(t),Ee.endUtf8(t)}};var H;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(H||(H={}));var at=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ee).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,H.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,wr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return tt.startSchema(t),tt.addEndianness(t,e),tt.addFields(t,n),tt.addCustomMetadata(t,i),tt.addFeatures(t,s),tt.endSchema(t)}};var R;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(R||(R={}));var u;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(u||(u={}));var rt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(rt||(rt={}));var Ho={};br(Ho,{clampRange:()=>Qn,createElementComparator:()=>xr,wrapIndex:()=>Gr});var Do={};br(Do,{valueToString:()=>be});function be(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>be(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Lo={};br(Lo,{BN:()=>Lr,bigNumToBigInt:()=>Qa,bigNumToNumber:()=>Mo,bigNumToString:()=>mn,isArrowBigNumSymbol:()=>qa});function C(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Oo(r,t){return C(r/t)+C(r%t)/C(t)}var qa=Symbol.for("isArrowBigNum");function we(r,...t){return t.length===0?Object.setPrototypeOf(E(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}we.prototype[qa]=!0;we.prototype.toJSON=function(){return`"${mn(this)}"`};we.prototype.valueOf=function(r){return Mo(this,r)};we.prototype.toString=function(){return mn(this)};we.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Mo(this);case"string":return mn(this);case"default":return Qa(this)}return mn(this)};function hn(...r){return we.apply(this,r)}function pn(...r){return we.apply(this,r)}function Xn(...r){return we.apply(this,r)}Object.setPrototypeOf(hn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(pn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Xn.prototype,Object.create(Uint32Array.prototype));Object.assign(hn.prototype,we.prototype,{constructor:hn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(pn.prototype,we.prototype,{constructor:pn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Xn.prototype,we.prototype,{constructor:Xn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var vd=BigInt(4294967296)*BigInt(4294967296),Id=vd-BigInt(1);function Mo(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,o=new BigUint64Array(e,n,i/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let d of o)c|=(d^Id)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let d of o)c|=d*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let d=BigInt(Math.pow(10,t)),f=c/d,V=c%d;return C(f)+C(V)/C(d)}return C(c)}function mn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Fo(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Fo(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`-${Fo(t)}`}function Qa(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:mn(r)}function Fo(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 Lr=class{static new(t,e){switch(e){case!0:return new hn(t);case!1:return new pn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new hn(t)}return t.byteLength===16?new Xn(t):new pn(t)}static signed(t){return new hn(t)}static unsigned(t){return new pn(t)}static decimal(t){return new Xn(t)}constructor(t,e){return Lr.new(t,e)}};var tc,ec,rc,nc,ic,sc,oc,ac,cc,lc,uc,dc,fc,hc,pc,mc,yc,gc,bc,wc,_c,vc,p=class{static isNull(t){return t?.typeId===u.Null}static isInt(t){return t?.typeId===u.Int}static isFloat(t){return t?.typeId===u.Float}static isBinary(t){return t?.typeId===u.Binary}static isLargeBinary(t){return t?.typeId===u.LargeBinary}static isUtf8(t){return t?.typeId===u.Utf8}static isLargeUtf8(t){return t?.typeId===u.LargeUtf8}static isBool(t){return t?.typeId===u.Bool}static isDecimal(t){return t?.typeId===u.Decimal}static isDate(t){return t?.typeId===u.Date}static isTime(t){return t?.typeId===u.Time}static isTimestamp(t){return t?.typeId===u.Timestamp}static isInterval(t){return t?.typeId===u.Interval}static isDuration(t){return t?.typeId===u.Duration}static isList(t){return t?.typeId===u.List}static isStruct(t){return t?.typeId===u.Struct}static isUnion(t){return t?.typeId===u.Union}static isFixedSizeBinary(t){return t?.typeId===u.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===u.FixedSizeList}static isMap(t){return t?.typeId===u.Map}static isDictionary(t){return t?.typeId===u.Dictionary}static isDenseUnion(t){return p.isUnion(t)&&t.mode===Y.Dense}static isSparseUnion(t){return p.isUnion(t)&&t.mode===Y.Sparse}constructor(t){this.typeId=t}};tc=Symbol.toStringTag;p[tc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(p.prototype);var nt=class extends p{constructor(){super(u.Null)}toString(){return"Null"}};ec=Symbol.toStringTag;nt[ec]=(r=>r[Symbol.toStringTag]="Null")(nt.prototype);var et=class extends p{constructor(t,e){super(u.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};rc=Symbol.toStringTag;et[rc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(et.prototype);var Re=class extends et{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ce=class extends et{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},yt=class extends et{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ce=class extends et{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ke=class extends et{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Pe=class extends et{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ve=class extends et{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},je=class extends et{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Re.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ce.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(yt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ce.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(ke.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Pe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(je.prototype,"ArrayType",{value:BigUint64Array});var Mt=class extends p{constructor(t){super(u.Float),this.precision=t}get ArrayType(){switch(this.precision){case P.HALF:return Uint16Array;case P.SINGLE:return Float32Array;case P.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};nc=Symbol.toStringTag;Mt[nc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Mt.prototype);var _r=class extends Mt{constructor(){super(P.HALF)}},ze=class extends Mt{constructor(){super(P.SINGLE)}},le=class extends Mt{constructor(){super(P.DOUBLE)}};Object.defineProperty(_r.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(le.prototype,"ArrayType",{value:Float64Array});var re=class extends p{constructor(){super(u.Binary)}toString(){return"Binary"}};ic=Symbol.toStringTag;re[ic]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(re.prototype);var We=class extends p{constructor(){super(u.LargeBinary)}toString(){return"LargeBinary"}};sc=Symbol.toStringTag;We[sc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(We.prototype);var Lt=class extends p{constructor(){super(u.Utf8)}toString(){return"Utf8"}};oc=Symbol.toStringTag;Lt[oc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Lt.prototype);var Ge=class extends p{constructor(){super(u.LargeUtf8)}toString(){return"LargeUtf8"}};ac=Symbol.toStringTag;Ge[ac]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Ge.prototype);var Nt=class extends p{constructor(){super(u.Bool)}toString(){return"Bool"}};cc=Symbol.toStringTag;Nt[cc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Nt.prototype);var ne=class extends p{constructor(t,e,n=128){super(u.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};lc=Symbol.toStringTag;ne[lc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ne.prototype);var $t=class extends p{constructor(t){super(u.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${J[this.unit]}>`}get ArrayType(){return this.unit===J.DAY?Int32Array:BigInt64Array}};uc=Symbol.toStringTag;$t[uc]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))($t.prototype);var Nr=class extends $t{constructor(){super(J.DAY)}},Ur=class extends $t{constructor(){super(J.MILLISECOND)}},Bt=class extends p{constructor(t,e){super(u.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${h[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};dc=Symbol.toStringTag;Bt[dc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Bt.prototype);var Er=class extends Bt{constructor(){super(h.SECOND,32)}},Rr=class extends Bt{constructor(){super(h.MILLISECOND,32)}},Cr=class extends Bt{constructor(){super(h.MICROSECOND,64)}},kr=class extends Bt{constructor(){super(h.NANOSECOND,64)}},At=class extends p{constructor(t,e){super(u.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${h[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};fc=Symbol.toStringTag;At[fc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(At.prototype);var Pr=class extends At{constructor(t){super(h.SECOND,t)}},er=class extends At{constructor(t){super(h.MILLISECOND,t)}},Vr=class extends At{constructor(t){super(h.MICROSECOND,t)}},jr=class extends At{constructor(t){super(h.NANOSECOND,t)}},Yt=class extends p{constructor(t){super(u.Interval),this.unit=t}toString(){return`Interval<${Q[this.unit]}>`}};hc=Symbol.toStringTag;Yt[hc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Yt.prototype);var zr=class extends Yt{constructor(){super(Q.DAY_TIME)}},Wr=class extends Yt{constructor(){super(Q.YEAR_MONTH)}},$e=class extends p{constructor(t){super(u.Duration),this.unit=t}toString(){return`Duration<${h[this.unit]}>`}};pc=Symbol.toStringTag;$e[pc]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))($e.prototype);var wt=class extends p{constructor(t){super(u.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};mc=Symbol.toStringTag;wt[mc]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(wt.prototype);var k=class extends p{constructor(t){super(u.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};yc=Symbol.toStringTag;k[yc]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(k.prototype);var ue=class extends p{constructor(t,e,n){super(u.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};gc=Symbol.toStringTag;ue[gc]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ue.prototype);var Ye=class extends p{constructor(t){super(u.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};bc=Symbol.toStringTag;Ye[bc]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ye.prototype);var Ut=class extends p{constructor(t,e){super(u.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};wc=Symbol.toStringTag;Ut[wc]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ut.prototype);var Et=class extends p{constructor(t,e=!1){var n,i,s;if(super(u.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(", ")}}>`}};_c=Symbol.toStringTag;Et[_c]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Et.prototype);var Sd=(r=>()=>++r)(-1),Tt=class extends p{constructor(t,e,n,i){super(u.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?Sd():C(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};vc=Symbol.toStringTag;Tt[vc]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Tt.prototype);function ie(r){let t=r;switch(r.typeId){case u.Decimal:return r.bitWidth/32;case u.Interval:return 1+t.unit;case u.FixedSizeList:return t.listSize;case u.FixedSizeBinary:return t.byteWidth;default:return 1}}var w=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return xd(this,t,e)}getVisitFnByTypeId(t,e=!0){return yn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function xd(r,t,e=!0){return typeof t=="number"?yn(r,t,e):typeof t=="string"&&t in u?yn(r,u[t],e):t&&t instanceof p?yn(r,Sc(t),e):t?.type&&t.type instanceof p?yn(r,Sc(t.type),e):yn(r,u.NONE,e)}function yn(r,t,e=!0){let n=null;switch(t){case u.Null:n=r.visitNull;break;case u.Bool:n=r.visitBool;break;case u.Int:n=r.visitInt;break;case u.Int8:n=r.visitInt8||r.visitInt;break;case u.Int16:n=r.visitInt16||r.visitInt;break;case u.Int32:n=r.visitInt32||r.visitInt;break;case u.Int64:n=r.visitInt64||r.visitInt;break;case u.Uint8:n=r.visitUint8||r.visitInt;break;case u.Uint16:n=r.visitUint16||r.visitInt;break;case u.Uint32:n=r.visitUint32||r.visitInt;break;case u.Uint64:n=r.visitUint64||r.visitInt;break;case u.Float:n=r.visitFloat;break;case u.Float16:n=r.visitFloat16||r.visitFloat;break;case u.Float32:n=r.visitFloat32||r.visitFloat;break;case u.Float64:n=r.visitFloat64||r.visitFloat;break;case u.Utf8:n=r.visitUtf8;break;case u.LargeUtf8:n=r.visitLargeUtf8;break;case u.Binary:n=r.visitBinary;break;case u.LargeBinary:n=r.visitLargeBinary;break;case u.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case u.Date:n=r.visitDate;break;case u.DateDay:n=r.visitDateDay||r.visitDate;break;case u.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case u.Timestamp:n=r.visitTimestamp;break;case u.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case u.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case u.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case u.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case u.Time:n=r.visitTime;break;case u.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case u.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case u.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case u.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case u.Decimal:n=r.visitDecimal;break;case u.List:n=r.visitList;break;case u.Struct:n=r.visitStruct;break;case u.Union:n=r.visitUnion;break;case u.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case u.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case u.Dictionary:n=r.visitDictionary;break;case u.Interval:n=r.visitInterval;break;case u.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case u.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case u.Duration:n=r.visitDuration;break;case u.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case u.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case u.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case u.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case u.FixedSizeList:n=r.visitFixedSizeList;break;case u.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${u[t]}'`)}function Sc(r){switch(r.typeId){case u.Null:return u.Null;case u.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?u.Int8:u.Uint8;case 16:return e?u.Int16:u.Uint16;case 32:return e?u.Int32:u.Uint32;case 64:return e?u.Int64:u.Uint64}return u.Int}case u.Float:switch(r.precision){case P.HALF:return u.Float16;case P.SINGLE:return u.Float32;case P.DOUBLE:return u.Float64}return u.Float;case u.Binary:return u.Binary;case u.LargeBinary:return u.LargeBinary;case u.Utf8:return u.Utf8;case u.LargeUtf8:return u.LargeUtf8;case u.Bool:return u.Bool;case u.Decimal:return u.Decimal;case u.Time:switch(r.unit){case h.SECOND:return u.TimeSecond;case h.MILLISECOND:return u.TimeMillisecond;case h.MICROSECOND:return u.TimeMicrosecond;case h.NANOSECOND:return u.TimeNanosecond}return u.Time;case u.Timestamp:switch(r.unit){case h.SECOND:return u.TimestampSecond;case h.MILLISECOND:return u.TimestampMillisecond;case h.MICROSECOND:return u.TimestampMicrosecond;case h.NANOSECOND:return u.TimestampNanosecond}return u.Timestamp;case u.Date:switch(r.unit){case J.DAY:return u.DateDay;case J.MILLISECOND:return u.DateMillisecond}return u.Date;case u.Interval:switch(r.unit){case Q.DAY_TIME:return u.IntervalDayTime;case Q.YEAR_MONTH:return u.IntervalYearMonth}return u.Interval;case u.Duration:switch(r.unit){case h.SECOND:return u.DurationSecond;case h.MILLISECOND:return u.DurationMillisecond;case h.MICROSECOND:return u.DurationMicrosecond;case h.NANOSECOND:return u.DurationNanosecond}return u.Duration;case u.Map:return u.Map;case u.List:return u.List;case u.Struct:return u.Struct;case u.Union:switch(r.mode){case Y.Dense:return u.DenseUnion;case Y.Sparse:return u.SparseUnion}return u.Union;case u.FixedSizeBinary:return u.FixedSizeBinary;case u.FixedSizeList:return u.FixedSizeList;case u.Dictionary:return u.Dictionary}throw new Error(`Unrecognized type '${u[r.typeId]}'`)}w.prototype.visitInt8=null;w.prototype.visitInt16=null;w.prototype.visitInt32=null;w.prototype.visitInt64=null;w.prototype.visitUint8=null;w.prototype.visitUint16=null;w.prototype.visitUint32=null;w.prototype.visitUint64=null;w.prototype.visitFloat16=null;w.prototype.visitFloat32=null;w.prototype.visitFloat64=null;w.prototype.visitDateDay=null;w.prototype.visitDateMillisecond=null;w.prototype.visitTimestampSecond=null;w.prototype.visitTimestampMillisecond=null;w.prototype.visitTimestampMicrosecond=null;w.prototype.visitTimestampNanosecond=null;w.prototype.visitTimeSecond=null;w.prototype.visitTimeMillisecond=null;w.prototype.visitTimeMicrosecond=null;w.prototype.visitTimeNanosecond=null;w.prototype.visitDenseUnion=null;w.prototype.visitSparseUnion=null;w.prototype.visitIntervalDayTime=null;w.prototype.visitIntervalYearMonth=null;w.prototype.visitDuration=null;w.prototype.visitDurationSecond=null;w.prototype.visitDurationMillisecond=null;w.prototype.visitDurationMicrosecond=null;w.prototype.visitDurationNanosecond=null;var No={};br(No,{float64ToUint16:()=>qn,uint16ToFloat64:()=>ts});var xc=new Float64Array(1),gn=new Uint32Array(xc.buffer);function ts(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function qn(r){if(r!==r)return 32256;xc[0]=r;let t=(gn[1]&2147483648)>>16&65535,e=gn[1]&2146435072,n=0;return e>=1089470464?gn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(gn[1]&1048575)>>10):e<=1056964608?(n=1048576+(gn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(gn[1]&1048575)+512>>10),t|e|n&65535}var x=class extends w{};function D(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var Bd=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Bc=(r,t,e,n)=>{if(e+1<t.length){let i=C(t[e]),s=C(t[e+1]);r.set(n.subarray(0,s-i),i)}},Ad=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},rr=({values:r},t,e)=>{r[t]=e},Uo=({values:r},t,e)=>{r[t]=e},Ac=({values:r},t,e)=>{r[t]=qn(e)},Td=(r,t,e)=>{switch(r.type.precision){case P.HALF:return Ac(r,t,e);case P.SINGLE:case P.DOUBLE:return Uo(r,t,e)}},es=({values:r},t,e)=>{Bd(r,t,e.valueOf())},rs=({values:r},t,e)=>{r[t]=BigInt(e)},Eo=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Tc=({values:r,valueOffsets:t},e,n)=>Bc(r,t,e,n),Dc=({values:r,valueOffsets:t},e,n)=>Bc(r,t,e,Be(n)),Ro=(r,t,e)=>{r.type.unit===J.DAY?es(r,t,e):rs(r,t,e)},ns=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},is=({values:r},t,e)=>{r[t]=BigInt(e)},ss=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},os=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Co=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return ns(r,t,e);case h.MILLISECOND:return is(r,t,e);case h.MICROSECOND:return ss(r,t,e);case h.NANOSECOND:return os(r,t,e)}},as=({values:r},t,e)=>{r[t]=e},cs=({values:r},t,e)=>{r[t]=e},ls=({values:r},t,e)=>{r[t]=e},us=({values:r},t,e)=>{r[t]=e},ko=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return as(r,t,e);case h.MILLISECOND:return cs(r,t,e);case h.MICROSECOND:return ls(r,t,e);case h.NANOSECOND:return us(r,t,e)}},Po=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Dd=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=_t.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))},Od=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=_t.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},Fd=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),Md=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),Ld=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Nd=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),Ud=(r,t,e)=>{let n=r.type.children.map(s=>_t.getVisitFn(s.type)),i=e instanceof Map?Ld(t,e):e instanceof y?Md(t,e):Array.isArray(e)?Fd(t,e):Nd(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Ed=(r,t,e)=>{r.type.mode===Y.Dense?Oc(r,t,e):Fc(r,t,e)},Oc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,r.valueOffsets[t],e)},Fc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,t,e)},Rd=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Vo=(r,t,e)=>{r.type.unit===Q.DAY_TIME?ds(r,t,e):fs(r,t,e)},ds=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},fs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},hs=({values:r},t,e)=>{r[t]=e},ps=({values:r},t,e)=>{r[t]=e},ms=({values:r},t,e)=>{r[t]=e},ys=({values:r},t,e)=>{r[t]=e},jo=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return hs(r,t,e);case h.MILLISECOND:return ps(r,t,e);case h.MICROSECOND:return ms(r,t,e);case h.NANOSECOND:return ys(r,t,e)}},Cd=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=_t.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))};x.prototype.visitBool=D(Ad);x.prototype.visitInt=D(rr);x.prototype.visitInt8=D(rr);x.prototype.visitInt16=D(rr);x.prototype.visitInt32=D(rr);x.prototype.visitInt64=D(rr);x.prototype.visitUint8=D(rr);x.prototype.visitUint16=D(rr);x.prototype.visitUint32=D(rr);x.prototype.visitUint64=D(rr);x.prototype.visitFloat=D(Td);x.prototype.visitFloat16=D(Ac);x.prototype.visitFloat32=D(Uo);x.prototype.visitFloat64=D(Uo);x.prototype.visitUtf8=D(Dc);x.prototype.visitLargeUtf8=D(Dc);x.prototype.visitBinary=D(Tc);x.prototype.visitLargeBinary=D(Tc);x.prototype.visitFixedSizeBinary=D(Eo);x.prototype.visitDate=D(Ro);x.prototype.visitDateDay=D(es);x.prototype.visitDateMillisecond=D(rs);x.prototype.visitTimestamp=D(Co);x.prototype.visitTimestampSecond=D(ns);x.prototype.visitTimestampMillisecond=D(is);x.prototype.visitTimestampMicrosecond=D(ss);x.prototype.visitTimestampNanosecond=D(os);x.prototype.visitTime=D(ko);x.prototype.visitTimeSecond=D(as);x.prototype.visitTimeMillisecond=D(cs);x.prototype.visitTimeMicrosecond=D(ls);x.prototype.visitTimeNanosecond=D(us);x.prototype.visitDecimal=D(Po);x.prototype.visitList=D(Dd);x.prototype.visitStruct=D(Ud);x.prototype.visitUnion=D(Ed);x.prototype.visitDenseUnion=D(Oc);x.prototype.visitSparseUnion=D(Fc);x.prototype.visitDictionary=D(Rd);x.prototype.visitInterval=D(Vo);x.prototype.visitIntervalDayTime=D(ds);x.prototype.visitIntervalYearMonth=D(fs);x.prototype.visitDuration=D(jo);x.prototype.visitDurationSecond=D(hs);x.prototype.visitDurationMillisecond=D(ps);x.prototype.visitDurationMicrosecond=D(ms);x.prototype.visitDurationNanosecond=D(ys);x.prototype.visitFixedSizeList=D(Cd);x.prototype.visitMap=D(Od);var _t=new x;var _e=Symbol.for("parent"),bn=Symbol.for("rowIndex"),vr=class{constructor(t,e){return this[_e]=t,this[bn]=e,new Proxy(this,new Wo)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[bn],e=this[_e],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=ct.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new zo(this[_e],this[bn])}},zo=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ct.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(vr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_e]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Wo=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_e].type.children.map(e=>e.name)}has(t,e){return t[_e].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[_e].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[_e].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=ct.visit(t[_e].children[n],t[bn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[_e].type.children.findIndex(s=>s.name===e);return i!==-1?(_t.visit(t[_e].children[i],t[bn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var _=class extends w{};function A(r){return(t,e)=>t.getValid(e)?r(t,e):null}var kd=(r,t)=>864e5*r[t],Pd=(r,t)=>null,Mc=(r,t,e)=>{if(e+1>=t.length)return null;let n=C(t[e]),i=C(t[e+1]);return r.subarray(n,i)},Vd=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Lc=({values:r},t)=>kd(r,t),Nc=({values:r},t)=>C(r[t]),Ir=({stride:r,values:t},e)=>t[r*e],jd=({stride:r,values:t},e)=>ts(t[r*e]),Uc=({values:r},t)=>r[t],zd=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Ec=({values:r,valueOffsets:t},e)=>Mc(r,t,e),Rc=({values:r,valueOffsets:t},e)=>{let n=Mc(r,t,e);return n!==null?Gn(n):null},Wd=({values:r},t)=>r[t],Gd=({type:r,values:t},e)=>r.precision!==P.HALF?t[e]:ts(t[e]),$d=(r,t)=>r.type.unit===J.DAY?Lc(r,t):Nc(r,t),Cc=({values:r},t)=>1e3*C(r[t]),kc=({values:r},t)=>C(r[t]),Pc=({values:r},t)=>Oo(r[t],BigInt(1e3)),Vc=({values:r},t)=>Oo(r[t],BigInt(1e6)),Yd=(r,t)=>{switch(r.type.unit){case h.SECOND:return Cc(r,t);case h.MILLISECOND:return kc(r,t);case h.MICROSECOND:return Pc(r,t);case h.NANOSECOND:return Vc(r,t)}},jc=({values:r},t)=>r[t],zc=({values:r},t)=>r[t],Wc=({values:r},t)=>r[t],Gc=({values:r},t)=>r[t],Hd=(r,t)=>{switch(r.type.unit){case h.SECOND:return jc(r,t);case h.MILLISECOND:return zc(r,t);case h.MICROSECOND:return Wc(r,t);case h.NANOSECOND:return Gc(r,t)}},Jd=({values:r,stride:t},e)=>Lr.decimal(r.subarray(t*e,t*(e+1))),Kd=(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 y([c])},Zd=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new He(o.slice(i,s-i))},Xd=(r,t)=>new vr(r,t),qd=(r,t)=>r.type.mode===Y.Dense?$c(r,t):Yc(r,t),$c=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,r.valueOffsets[t])},Yc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,t)},Qd=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},tf=(r,t)=>r.type.unit===Q.DAY_TIME?Hc(r,t):Jc(r,t),Hc=({values:r},t)=>r.subarray(2*t,2*(t+1)),Jc=({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},Kc=({values:r},t)=>r[t],Zc=({values:r},t)=>r[t],Xc=({values:r},t)=>r[t],qc=({values:r},t)=>r[t],ef=(r,t)=>{switch(r.type.unit){case h.SECOND:return Kc(r,t);case h.MILLISECOND:return Zc(r,t);case h.MICROSECOND:return Xc(r,t);case h.NANOSECOND:return qc(r,t)}},rf=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new y([s])};_.prototype.visitNull=A(Pd);_.prototype.visitBool=A(Vd);_.prototype.visitInt=A(Wd);_.prototype.visitInt8=A(Ir);_.prototype.visitInt16=A(Ir);_.prototype.visitInt32=A(Ir);_.prototype.visitInt64=A(Uc);_.prototype.visitUint8=A(Ir);_.prototype.visitUint16=A(Ir);_.prototype.visitUint32=A(Ir);_.prototype.visitUint64=A(Uc);_.prototype.visitFloat=A(Gd);_.prototype.visitFloat16=A(jd);_.prototype.visitFloat32=A(Ir);_.prototype.visitFloat64=A(Ir);_.prototype.visitUtf8=A(Rc);_.prototype.visitLargeUtf8=A(Rc);_.prototype.visitBinary=A(Ec);_.prototype.visitLargeBinary=A(Ec);_.prototype.visitFixedSizeBinary=A(zd);_.prototype.visitDate=A($d);_.prototype.visitDateDay=A(Lc);_.prototype.visitDateMillisecond=A(Nc);_.prototype.visitTimestamp=A(Yd);_.prototype.visitTimestampSecond=A(Cc);_.prototype.visitTimestampMillisecond=A(kc);_.prototype.visitTimestampMicrosecond=A(Pc);_.prototype.visitTimestampNanosecond=A(Vc);_.prototype.visitTime=A(Hd);_.prototype.visitTimeSecond=A(jc);_.prototype.visitTimeMillisecond=A(zc);_.prototype.visitTimeMicrosecond=A(Wc);_.prototype.visitTimeNanosecond=A(Gc);_.prototype.visitDecimal=A(Jd);_.prototype.visitList=A(Kd);_.prototype.visitStruct=A(Xd);_.prototype.visitUnion=A(qd);_.prototype.visitDenseUnion=A($c);_.prototype.visitSparseUnion=A(Yc);_.prototype.visitDictionary=A(Qd);_.prototype.visitInterval=A(tf);_.prototype.visitIntervalDayTime=A(Hc);_.prototype.visitIntervalYearMonth=A(Jc);_.prototype.visitDuration=A(ef);_.prototype.visitDurationSecond=A(Kc);_.prototype.visitDurationMillisecond=A(Zc);_.prototype.visitDurationMicrosecond=A(Xc);_.prototype.visitDurationNanosecond=A(qc);_.prototype.visitFixedSizeList=A(rf);_.prototype.visitMap=A(Zd);var ct=new _;var Sr=Symbol.for("keys"),_n=Symbol.for("vals"),wn=Symbol.for("kKeysAsStrings"),Go=Symbol.for("_kKeysAsStrings"),He=class{constructor(t){return this[Sr]=new y([t.children[0]]).memoize(),this[_n]=t.children[1],new Proxy(this,new Yo)}get[wn](){return this[Go]||(this[Go]=Array.from(this[Sr].toArray(),String))}[Symbol.iterator](){return new $o(this[Sr],this[_n])}get size(){return this[Sr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Sr],e=this[_n],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=ct.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},$o=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ct.visit(this.vals,t)]})}},Yo=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wn]}has(t,e){return t[wn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[wn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[wn].indexOf(e);if(n!==-1){let i=ct.visit(Reflect.get(t,_n),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[wn].indexOf(e);return i!==-1?(_t.visit(Reflect.get(t,_n),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(He.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Sr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_n]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Go]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Qc;function Qn(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&&(Qc=s,s=o,o=Qc),o>i&&(o=i),n?n(r,s,o):[s,o]}var Gr=(r,t)=>r<0?t+r:r,tl=r=>r!==r;function xr(r){if(typeof r!=="object"||r===null)return tl(r)?tl: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?xo(r,e):!1:r instanceof Map?sf(r):Array.isArray(r)?nf(r):r instanceof y?of(r):af(r,!0)}function nf(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r[e]);return gs(t)}function sf(r){let t=-1,e=[];for(let n of r.values())e[++t]=xr(n);return gs(e)}function of(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r.get(e));return gs(t)}function af(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]=xr(r[e[i]]);return gs(n,e)}function gs(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return cf(r,e);case Map:return el(r,e,e.keys());case He:case vr:case Object:case void 0:return el(r,e,t||Object.keys(e))}return e instanceof y?lf(r,e):!1}}function cf(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 lf(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 el(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(),d=i.next();for(;o<a&&!l.done&&!d.done&&!c.done&&!(l.value!==d.value||!r[o](c.value));++o,l=n.next(),d=i.next(),c=s.next());return o===a&&l.done&&d.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var Jo={};br(Jo,{BitIterator:()=>$r,getBit:()=>rl,getBool:()=>ws,packBools:()=>Hr,popcnt_array:()=>nl,popcnt_bit_range:()=>ti,popcnt_uint32:()=>bs,setBool:()=>uf,truncateBitmap:()=>Yr});function ws(r,t,e,n){return(e&1<<n)!==0}function rl(r,t,e,n){return(e&1<<n)>>n}function uf(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Yr(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Hr(new $r(e,r,t,null,ws)).subarray(0,n)),i}return e}function Hr(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 $r=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 ti(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new $r(r,t,e-t,r,rl))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ti(r,t,i)+ti(r,n,e)+nl(r,i>>3,n-i>>3)}function nl(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+=bs(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=bs(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=bs(s.getUint8(i)),i+=1;return n}function bs(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 df=-1,M=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return p.isSparseUnion(t)?this.children.some(e=>e.nullable):p.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds: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(p.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=df&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ti(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,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 M?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=ie(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(p.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===Y.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(p.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===Y.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,d=c>>3;(!s||s.byteLength<=d)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Yr(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let f=s[d];n=(f&l)!==0,s[d]=e?f|l:f&~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 M(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===u.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Yr(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[rt.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[rt.TYPE])&&(o[rt.TYPE]=s.subarray(t,t+e)),(s=o[rt.OFFSET])&&(o[rt.OFFSET]=s.subarray(t,t+e+1))||(s=o[rt.DATA])&&(o[rt.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};M.prototype.children=Object.freeze([]);var Jr=class extends w{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new M(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),s=B(t.nullBitmap),o=Mr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),s=B(t.nullBitmap),o=Ji(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),s=B(t.nullBitmap),o=Mr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),s=B(t.nullBitmap),o=Ji(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=B(t.nullBitmap),o=Mr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=B(t.nullBitmap),{length:o=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=E(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(p.isSparseUnion(e))return new M(e,n,o,a,[void 0,void 0,void 0,s],i);let c=Mr(t.valueOffsets);return new M(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.indices.ArrayType,t.data),{["dictionary"]:o=new y([new Jr().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),s=E(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.valueType})}=t,s=B(t.nullBitmap),{["length"]:o=i.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.childType})}=t,s=B(t.nullBitmap),o=Mr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[o,void 0,s],[i])}},ff=new Jr;function b(r){return ff.visit(r)}var ei=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function il(r){return r.some(t=>t.nullable)}function _s(r){return r.reduce((t,e)=>t+e.nullCount,0)}function vs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Is(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 d=Math.max(0,e-c),f=Math.min(n-c,l);i.push(a.slice(d,f-d))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ko(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 ri(r,t){return r.getValid(t)}function vn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ko(n,this._offsets,e,t)}}function Ss(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=Ko(s,this._offsets,n,e);return t=void 0,o}}function xs(r){let t;function e(n,i,s){let o=s,a=0,c=0;for(let l=i-1,d=n.length;++l<d;){let f=n[l];if(~(a=r(f,t,o)))return c+a;o=0,c+=f.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ko(s,this._offsets,i,e);return t=void 0,o}}var v=class extends w{};function hf(r,t){return t===null&&r.length>0?0:-1}function pf(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new $r(e,r.offset+(t||0),r.length,e,ws)){if(!i)return n;++n}return-1}function F(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case u.Union:break;case u.Dictionary:break;default:return pf(r,e)}let n=ct.getVisitFn(r),i=xr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function sl(r,t,e){let n=ct.getVisitFn(r),i=xr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}v.prototype.visitNull=hf;v.prototype.visitBool=F;v.prototype.visitInt=F;v.prototype.visitInt8=F;v.prototype.visitInt16=F;v.prototype.visitInt32=F;v.prototype.visitInt64=F;v.prototype.visitUint8=F;v.prototype.visitUint16=F;v.prototype.visitUint32=F;v.prototype.visitUint64=F;v.prototype.visitFloat=F;v.prototype.visitFloat16=F;v.prototype.visitFloat32=F;v.prototype.visitFloat64=F;v.prototype.visitUtf8=F;v.prototype.visitLargeUtf8=F;v.prototype.visitBinary=F;v.prototype.visitLargeBinary=F;v.prototype.visitFixedSizeBinary=F;v.prototype.visitDate=F;v.prototype.visitDateDay=F;v.prototype.visitDateMillisecond=F;v.prototype.visitTimestamp=F;v.prototype.visitTimestampSecond=F;v.prototype.visitTimestampMillisecond=F;v.prototype.visitTimestampMicrosecond=F;v.prototype.visitTimestampNanosecond=F;v.prototype.visitTime=F;v.prototype.visitTimeSecond=F;v.prototype.visitTimeMillisecond=F;v.prototype.visitTimeMicrosecond=F;v.prototype.visitTimeNanosecond=F;v.prototype.visitDecimal=F;v.prototype.visitList=F;v.prototype.visitStruct=F;v.prototype.visitUnion=F;v.prototype.visitDenseUnion=sl;v.prototype.visitSparseUnion=sl;v.prototype.visitDictionary=F;v.prototype.visitInterval=F;v.prototype.visitIntervalDayTime=F;v.prototype.visitIntervalYearMonth=F;v.prototype.visitDuration=F;v.prototype.visitDurationSecond=F;v.prototype.visitDurationMillisecond=F;v.prototype.visitDurationMicrosecond=F;v.prototype.visitDurationNanosecond=F;v.prototype.visitFixedSizeList=F;v.prototype.visitMap=F;var Kr=new v;var I=class extends w{};function T(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(p.isInt(t)&&t.bitWidth!==64||p.isTime(t)&&t.bitWidth!==64||p.isFloat(t)&&t.precision!==P.HALF))return new ei(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ei(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Zo(o)})}var Zo=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};I.prototype.visitNull=T;I.prototype.visitBool=T;I.prototype.visitInt=T;I.prototype.visitInt8=T;I.prototype.visitInt16=T;I.prototype.visitInt32=T;I.prototype.visitInt64=T;I.prototype.visitUint8=T;I.prototype.visitUint16=T;I.prototype.visitUint32=T;I.prototype.visitUint64=T;I.prototype.visitFloat=T;I.prototype.visitFloat16=T;I.prototype.visitFloat32=T;I.prototype.visitFloat64=T;I.prototype.visitUtf8=T;I.prototype.visitLargeUtf8=T;I.prototype.visitBinary=T;I.prototype.visitLargeBinary=T;I.prototype.visitFixedSizeBinary=T;I.prototype.visitDate=T;I.prototype.visitDateDay=T;I.prototype.visitDateMillisecond=T;I.prototype.visitTimestamp=T;I.prototype.visitTimestampSecond=T;I.prototype.visitTimestampMillisecond=T;I.prototype.visitTimestampMicrosecond=T;I.prototype.visitTimestampNanosecond=T;I.prototype.visitTime=T;I.prototype.visitTimeSecond=T;I.prototype.visitTimeMillisecond=T;I.prototype.visitTimeMicrosecond=T;I.prototype.visitTimeNanosecond=T;I.prototype.visitDecimal=T;I.prototype.visitList=T;I.prototype.visitStruct=T;I.prototype.visitUnion=T;I.prototype.visitDenseUnion=T;I.prototype.visitSparseUnion=T;I.prototype.visitDictionary=T;I.prototype.visitInterval=T;I.prototype.visitIntervalDayTime=T;I.prototype.visitIntervalYearMonth=T;I.prototype.visitDuration=T;I.prototype.visitDurationSecond=T;I.prototype.visitDurationMillisecond=T;I.prototype.visitDurationMicrosecond=T;I.prototype.visitDurationNanosecond=T;I.prototype.visitFixedSizeList=T;I.prototype.visitMap=T;var In=new I;var ol,al={},cl={},y=class{constructor(t){var e,n,i;let s=t[0]instanceof y?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof M)))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}=al[o.typeId],d=s[0];this.isValid=f=>ri(d,f),this.get=f=>a(d,f),this.set=(f,V)=>c(d,f,V),this.indexOf=f=>l(d,f),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,cl[o.typeId]),this._offsets=vs(s);break}this.data=s,this.type=o,this.stride=ie(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 il(this.data)}get nullCount(){return _s(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${u[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return In.visit(this)}concat(...t){return new y(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new y(Qn(this,t,e,({data:n,_offsets:i},s,o)=>Is(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case u.Int:case u.Float:case u.Decimal:case u.Time:case u.Timestamp:switch(e.length){case 0:return new 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 y(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return p.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(p.isDictionary(this.type)){let t=new Sn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return new Sn(this)}unmemoize(){if(p.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return this}};ol=Symbol.toStringTag;y[ol]=(r=>{r.type=p.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(u).map(e=>u[e]).filter(e=>typeof e=="number"&&e!==u.NONE);for(let e of t){let n=ct.getVisitFnByTypeId(e),i=_t.getVisitFnByTypeId(e),s=Kr.getVisitFnByTypeId(e);al[e]={get:n,set:i,indexOf:s},cl[e]=Object.create(r,{isValid:{value:vn(ri)},get:{value:vn(ct.getVisitFnByTypeId(e))},set:{value:Ss(_t.getVisitFnByTypeId(e))},indexOf:{value:xs(Kr.getVisitFnByTypeId(e))}})}return"Vector"})(y.prototype);var Sn=class extends y{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,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 Sn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new y(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function xn(r){if(r){if(r instanceof M)return new y([r]);if(r instanceof y)return new y(r.data);if(r.type instanceof p)return new y([b(r)]);if(Array.isArray(r))return new y(r.flatMap(t=>mf(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new y([b(Object.assign(Object.assign({},t),{type:new Re}))]);if(r instanceof Int16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ce}))]);if(r instanceof Int32Array)return new y([b(Object.assign(Object.assign({},t),{type:new yt}))]);if(r instanceof BigInt64Array)return new y([b(Object.assign(Object.assign({},t),{type:new ce}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new y([b(Object.assign(Object.assign({},t),{type:new ke}))]);if(r instanceof Uint16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Pe}))]);if(r instanceof Uint32Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ve}))]);if(r instanceof BigUint64Array)return new y([b(Object.assign(Object.assign({},t),{type:new je}))]);if(r instanceof Float32Array)return new y([b(Object.assign(Object.assign({},t),{type:new ze}))]);if(r instanceof Float64Array)return new y([b(Object.assign(Object.assign({},t),{type:new le}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function mf(r){return r instanceof M?[r]:r instanceof y?r.data:xn(r).data}function ll(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
8
8
  switch (x) {${e.map(n=>`
9
- case ${ud(n)}:`).join("")}
9
+ case ${yf(n)}:`).join("")}
10
10
  return false;
11
11
  }`),r.length!==e.length&&(t=`if (x !== x) return false;
12
12
  ${t}`),new Function("x",`${t}
13
- return true;`)}function ud(r){return typeof r!="bigint"?Ae(r):`${Ae(r)}n`}function Ma(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function nu(r,t=0){return r.length>=t?r.subarray(0,t):ti(new r.constructor(t),r,0)}var Oe=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?Ma(n*1,this.BYTES_PER_ELEMENT):Ma(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ma(t*this.stride,this.BYTES_PER_ELEMENT);let e=nu(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=nu(this.buffer,t)}},ur=class extends Oe{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}},Fn=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()}},Mn=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 nt=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=ue(t),this._nulls=new Fn,e&&e.length>0&&(this._isValid=ru(e))}toVector(){return new b([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(p=>p.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}};nt.prototype.length=1;nt.prototype.stride=1;nt.prototype.children=null;nt.prototype.finished=!1;nt.prototype.nullValues=null;nt.prototype._isValid=()=>!0;var mt=class extends nt{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)}},qt=class extends nt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Mn(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[be].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):H.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,H.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 R=class{constructor(t=[],e,n,i=H.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=La(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 R(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new R(e,this.metadata)}assign(...t){let e=t[0]instanceof R?t[0]:Array.isArray(t[0])?new R(t[0]):new R(t),n=[...this.fields],i=Ys(Ys(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:Ys(Ys(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=La(s,new Map);return new R([...n,...s],i,new Map([...this.dictionaries,...o]))}};R.prototype.fields=null;R.prototype.metadata=null;R.prototype.dictionaries=null;var O=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 O(`${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],O.new(e,n,i,s)}};O.prototype.type=null;O.prototype.name=null;O.prototype.nullable=null;O.prototype.metadata=null;function Ys(r,t){return new Map([...r||new Map,...t||new Map])}function La(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(y.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&&La(s.children,t)}return t}var fd=ar,hd=Ct,fr=class{static decode(t){t=new hd(D(t));let e=Et.getRootAsFooter(t),n=R.decode(e.schema(),new Map,e.version());return new Na(n,e)}static encode(t){let e=new fd,n=R.encode(e,t.schema);Et.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Fe.encode(e,o);let i=e.endVector();Et.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Fe.encode(e,o);let s=e.endVector();return Et.startFooter(e),Et.addSchema(e,n),Et.addVersion(e,H.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=H.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 Na=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 Fe.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Fe.decode(e)}return null}},Fe=class{static decode(t){return new Fe(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}),fi=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())}},Ks=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 g(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 g(this,void 0,void 0,function*(){return yield this.abort(t),q})}return(t){return g(this,void 0,void 0,function*(){return yield this.close(),q})}read(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return g(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 Ks{write(t){if((t=D(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Qn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Qn)}toUint8Array(t=!1){return t?oe(this._values)[0]:(()=>g(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var c=!0,l=ve(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 oe(o,a)[0]}))()}},rr=class{constructor(t){t&&(this.source=new Ua(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)}},te=class{constructor(t){t instanceof te?this.source=t.source:t instanceof er?this.source=new hr(Bt.fromAsyncIterable(t)):ms(t)?this.source=new hr(Bt.fromNodeStream(t)):qn(t)?this.source=new hr(Bt.fromDOMStream(t)):ds(t)?this.source=new hr(Bt.fromDOMStream(t.body)):Ie(t)?this.source=new hr(Bt.fromIterable(t)):se(t)?this.source=new hr(Bt.fromAsyncIterable(t)):fe(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)}},Ua=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 g(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return g(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return g(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return g(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 g(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 hi=class extends rr{constructor(t,e){super(),this.position=0,this.buffer=D(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 te{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>g(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return g(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 g(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 g(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 g(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 g(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return g(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return g(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ra={};Ir(Ra,{BaseInt64:()=>di,Int128:()=>ee,Int64:()=>St,Uint64:()=>$});function Ln(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Nn=8,Ea=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],di=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`${Ln(this.buffer[1])} ${Ln(this.buffer[0])}`}},$=class extends di{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return $.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return $.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new $(e);for(let s=0;s<n;){let o=Nn<n-s?Nn:n-s,a=new $(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new $(new Uint32Array([Ea[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;)$.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new $(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new $(new Uint32Array(t.buffer)).plus(e)}},St=class extends di{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=Nn<i-o?Nn:i-o,c=new St(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new St(new Uint32Array([Ea[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)}},ee=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 $(new Uint32Array([this.buffer[3],0])),n=new $(new Uint32Array([this.buffer[2],0])),i=new $(new Uint32Array([this.buffer[1],0])),s=new $(new Uint32Array([this.buffer[0],0])),o=new $(new Uint32Array([t.buffer[3],0])),a=new $(new Uint32Array([t.buffer[2],0])),c=new $(new Uint32Array([t.buffer[1],0])),l=new $(new Uint32Array([t.buffer[0],0])),u=$.multiply(s,l);this.buffer[0]=u.low();let h=new $(new Uint32Array([u.high(),0]));return u=$.multiply(i,l),h.plus(u),u=$.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 $(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus($.multiply(n,l)).plus($.multiply(i,c)).plus($.multiply(s,a)),this.buffer[3]+=$.multiply(e,l).plus($.multiply(n,c)).plus($.multiply(i,a)).plus($.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`${Ln(this.buffer[3])} ${Ln(this.buffer[2])} ${Ln(this.buffer[1])} ${Ln(this.buffer[0])}`}static multiply(t,e){return new ee(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ee(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ee.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ee.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new ee(e);for(let o=n?1:0;o<i;){let a=Nn<i-o?Nn:i-o,c=new ee(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new ee(new Uint32Array([Ea[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;)ee.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var pi=class extends I{constructor(t,e,n,i,s=H.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 O?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<H.V5&&this.readNullBitmap(t,n),t.mode===J.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)}},Zs=class extends pi{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 y.isTimestamp(t)?C(Uint8Array,St.convertArray(n[e])):(y.isInt(t)||y.isTime(t))&&t.bitWidth===64||y.isDuration(t)?C(Uint8Array,St.convertArray(n[e])):y.isDate(t)&&t.unit===rt.MILLISECOND?C(Uint8Array,St.convertArray(n[e])):y.isDecimal(t)?C(Uint8Array,ee.convertArray(n[e])):y.isBinary(t)||y.isLargeBinary(t)||y.isFixedSizeBinary(t)?dd(n[e]):y.isBool(t)?Xr(n[e]):y.isUtf8(t)||y.isLargeUtf8(t)?Ne(n[e].join("")):C(Uint8Array,C(t.ArrayType,n[e].map(i=>+i)))}};function dd(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 Un=class extends qt{constructor(t){super(t),this._values=new Oe(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,D(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 En=class extends qt{constructor(t){super(t),this._values=new Oe(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,D(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 Js=class extends nt{constructor(t){super(t),this._values=new Fn}setValue(t,e){this._values.set(t,+e)}};var rn=class extends mt{};rn.prototype._setValue=ya;var mi=class extends rn{};mi.prototype._setValue=xs;var yi=class extends rn{};yi.prototype._setValue=Ss;var gi=class extends mt{};gi.prototype._setValue=wa;var Xs=class extends nt{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=Me({type:this.type.indices,nullValues:e}),this.dictionary=Me({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 bi=class extends mt{};bi.prototype._setValue=ma;var Qs=class extends nt{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 O(e,t.type,!0)),n}};var nn=class extends mt{setValue(t,e){this._values.set(t,e)}},qs=class extends nn{setValue(t,e){super.setValue(t,oi(e))}},to=class extends nn{},eo=class extends nn{};var sn=class extends mt{};sn.prototype._setValue=_a;var wi=class extends sn{};wi.prototype._setValue=Ns;var _i=class extends sn{};_i.prototype._setValue=Us;var dr=class extends mt{};dr.prototype._setValue=va;var vi=class extends dr{};vi.prototype._setValue=Es;var Ii=class extends dr{};Ii.prototype._setValue=Rs;var xi=class extends dr{};xi.prototype._setValue=Cs;var Si=class extends dr{};Si.prototype._setValue=Ps;var we=class extends mt{setValue(t,e){this._values.set(t,e)}},ro=class extends we{},no=class extends we{},io=class extends we{},so=class extends we{},oo=class extends we{},ao=class extends we{},co=class extends we{},lo=class extends we{};var uo=class extends qt{constructor(t){super(t),this._offsets=new Mn(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 O(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 fo=class extends qt{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 O(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 ho=class extends nt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var po=class extends nt{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 O(e,t.type,!0)]),n}};var pr=class extends mt{};pr.prototype._setValue=ga;var Bi=class extends pr{};Bi.prototype._setValue=Bs;var Ai=class extends pr{};Ai.prototype._setValue=As;var Ti=class extends pr{};Ti.prototype._setValue=Ts;var Di=class extends pr{};Di.prototype._setValue=Ds;var mr=class extends mt{};mr.prototype._setValue=ba;var Oi=class extends mr{};Oi.prototype._setValue=Os;var Fi=class extends mr{};Fi.prototype._setValue=Fs;var Mi=class extends mr{};Mi.prototype._setValue=Ms;var Li=class extends mr{};Li.prototype._setValue=Ls;var Rn=class extends nt{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 O(e,t.type)];return this.type=new ge(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.")}},mo=class extends Rn{},yo=class extends Rn{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 Ni=class extends qt{constructor(t){super(t),this._values=new Oe(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,Ne(e))}_flushPending(t,e){}};Ni.prototype._flushPending=Un.prototype._flushPending;var Ui=class extends qt{constructor(t){super(t),this._values=new Oe(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,Ne(e))}_flushPending(t,e){}};Ui.prototype._flushPending=En.prototype._flushPending;var Ca=class extends I{visitNull(){return ho}visitBool(){return Js}visitInt(){return we}visitInt8(){return ro}visitInt16(){return no}visitInt32(){return io}visitInt64(){return so}visitUint8(){return oo}visitUint16(){return ao}visitUint32(){return co}visitUint64(){return lo}visitFloat(){return nn}visitFloat16(){return qs}visitFloat32(){return to}visitFloat64(){return eo}visitUtf8(){return Ni}visitLargeUtf8(){return Ui}visitBinary(){return Un}visitLargeBinary(){return En}visitFixedSizeBinary(){return bi}visitDate(){return rn}visitDateDay(){return mi}visitDateMillisecond(){return yi}visitTimestamp(){return pr}visitTimestampSecond(){return Bi}visitTimestampMillisecond(){return Ai}visitTimestampMicrosecond(){return Ti}visitTimestampNanosecond(){return Di}visitTime(){return mr}visitTimeSecond(){return Oi}visitTimeMillisecond(){return Fi}visitTimeMicrosecond(){return Mi}visitTimeNanosecond(){return Li}visitDecimal(){return gi}visitList(){return uo}visitStruct(){return po}visitUnion(){return Rn}visitDenseUnion(){return yo}visitSparseUnion(){return mo}visitDictionary(){return Xs}visitInterval(){return sn}visitIntervalDayTime(){return wi}visitIntervalYearMonth(){return _i}visitDuration(){return dr}visitDurationSecond(){return vi}visitDurationMillisecond(){return Ii}visitDurationMicrosecond(){return xi}visitDurationNanosecond(){return Si}visitFixedSizeList(){return Qs}visitMap(){return fo}},iu=new Ca;var A=class extends I{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 yr(r,t){return r===t||zt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function go(r,t){return r===t||zt(r,t)&&r.precision===t.precision}function pd(r,t){return r===t||zt(r,t)&&r.byteWidth===t.byteWidth}function Pa(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ei(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ri(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function md(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function yd(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function ka(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 gd(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 Va(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ci(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function bd(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 wd(r,t){return r===t||zt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}A.prototype.visitNull=on;A.prototype.visitBool=on;A.prototype.visitInt=yr;A.prototype.visitInt8=yr;A.prototype.visitInt16=yr;A.prototype.visitInt32=yr;A.prototype.visitInt64=yr;A.prototype.visitUint8=yr;A.prototype.visitUint16=yr;A.prototype.visitUint32=yr;A.prototype.visitUint64=yr;A.prototype.visitFloat=go;A.prototype.visitFloat16=go;A.prototype.visitFloat32=go;A.prototype.visitFloat64=go;A.prototype.visitUtf8=on;A.prototype.visitLargeUtf8=on;A.prototype.visitBinary=on;A.prototype.visitLargeBinary=on;A.prototype.visitFixedSizeBinary=pd;A.prototype.visitDate=Pa;A.prototype.visitDateDay=Pa;A.prototype.visitDateMillisecond=Pa;A.prototype.visitTimestamp=Ei;A.prototype.visitTimestampSecond=Ei;A.prototype.visitTimestampMillisecond=Ei;A.prototype.visitTimestampMicrosecond=Ei;A.prototype.visitTimestampNanosecond=Ei;A.prototype.visitTime=Ri;A.prototype.visitTimeSecond=Ri;A.prototype.visitTimeMillisecond=Ri;A.prototype.visitTimeMicrosecond=Ri;A.prototype.visitTimeNanosecond=Ri;A.prototype.visitDecimal=on;A.prototype.visitList=md;A.prototype.visitStruct=yd;A.prototype.visitUnion=ka;A.prototype.visitDenseUnion=ka;A.prototype.visitSparseUnion=ka;A.prototype.visitDictionary=gd;A.prototype.visitInterval=Va;A.prototype.visitIntervalDayTime=Va;A.prototype.visitIntervalYearMonth=Va;A.prototype.visitDuration=Ci;A.prototype.visitDurationSecond=Ci;A.prototype.visitDurationMillisecond=Ci;A.prototype.visitDurationMicrosecond=Ci;A.prototype.visitDurationNanosecond=Ci;A.prototype.visitFixedSizeList=bd;A.prototype.visitMap=wd;var nr=new A;function an(r,t){return nr.compareSchemas(r,t)}function su(r,t){return nr.compareFields(r,t)}function bo(r,t){return nr.visit(r,t)}function Me(r){let t=r.type,e=new(iu.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(Me(Object.assign(Object.assign({},l),{type:c})))}}return e}function Pi(r,t){if(r instanceof U||r instanceof b||r.type instanceof y||ArrayBuffer.isView(r))return Or(r);let e={type:t??wo(r),nullValues:[null]},n=[...ja(e)(r)],i=n.length===1?n[0]:n.reduce((s,o)=>s.concat(o));return y.isDictionary(i.type)?i.memoize():i}function wo(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 ye;if(s+t===r.length)return new Ut(new Pt,new It);if(o+t===r.length)return new pe;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=wo(l[l.findIndex(h=>h!=null)]);if(l.every(h=>h==null||bo(u,wo(h))))return new Tt(new O("",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 O(h,wo([u[h]]),!0));return new V([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function ja(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=Me(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 _o(r,t){return _d(r,t.map(e=>e.data.concat()))}function _d(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=vd(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 W(r,h))]}function vd(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 ou,K=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new R([]),this._offsets=[0],this;let i,s;t[0]instanceof R&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof W)return[c];if(c instanceof K)return c.batches;if(c instanceof U){if(c.type instanceof V)return[new W(new R(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(p=>new b([c[p]])),h=i??new R(l.map((p,v)=>new O(String(p),u[v].type,u[v].nullable))),[,d]=_o(h,u);return d.length===0?[new W(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 R([]),!(i instanceof R))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof W))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??Ws(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=zs(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?Dn.visit(new b(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
13
+ return true;`)}function yf(r){return typeof r!="bigint"?be(r):`${be(r)}n`}function Xo(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function ul(r,t=0){return r.length>=t?r.subarray(0,t):Yn(new r.constructor(t),r,0)}var ve=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?Xo(n*1,this.BYTES_PER_ELEMENT):Xo(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Xo(t*this.stride,this.BYTES_PER_ELEMENT);let e=ul(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=ul(this.buffer,t)}},nr=class extends ve{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},Bn=class extends nr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,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()}},An=class extends nr{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var q=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=ie(t),this._nulls=new Bn,e&&e.length>0&&(this._isValid=ll(e))}toVector(){return new y([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds: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:d,_nulls:f}=this;(e=c?.flush(o))?i=l?.flush(o):(i=l?.flush(o))?t=d?.flush(l.last()):t=d?.flush(o),a>0&&(n=f?.flush(o));let V=this.children.map(N=>N.flush());return this.clear(),b({type:s,length:o,nullCount:a,children:V,child:V[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};q.prototype.length=1;q.prototype.stride=1;q.prototype.children=null;q.prototype.finished=!1;q.prototype.nullValues=null;q.prototype._isValid=()=>!0;var lt=class extends q{constructor(t){super(t),this._values=new nr(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Ht=class extends q{constructor(t){super(t),this._pendingLength=0,this._offsets=new An(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof He?e[Sr].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var Zr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}};var Dt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new tt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Zr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new Zr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var U=class{constructor(t=[],e,n,i=z.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=qo(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new U(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new U(e,this.metadata)}assign(...t){let e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),n=[...this.fields],i=Bs(Bs(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:Bs(Bs(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=qo(s,new Map);return new U([...n,...s],i,new Map([...this.dictionaries,...o]))}};U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;var O=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 O(`${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],O.new(e,n,i,s)}};O.prototype.type=null;O.prototype.name=null;O.prototype.nullable=null;O.prototype.metadata=null;function Bs(r,t){return new Map([...r||new Map,...t||new Map])}function qo(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(p.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&&qo(s.children,t)}return t}var gf=tr,bf=Ft,ir=class{static decode(t){t=new bf(B(t));let e=Dt.getRootAsFooter(t),n=U.decode(e.schema(),new Map,e.version());return new Qo(n,e)}static encode(t){let e=new gf,n=U.encode(e,t.schema);Dt.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ie.encode(e,o);let i=e.endVector();Dt.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ie.encode(e,o);let s=e.endVector();return Dt.startFooter(e),Dt.addSchema(e,n),Dt.addVersion(e,z.V5),Dt.addRecordBatches(e,i),Dt.addDictionaries(e,s),Dt.finishFooterBuffer(e,Dt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=z.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Qo=class extends ir{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ie.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ie.decode(e)}return null}},Ie=class{static decode(t){return new Ie(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return Zr.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=C(n),this.bodyLength=C(e)}};var Z=Object.freeze({done:!0,value:void 0}),ni=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Xr=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},As=class extends Xr{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Z);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return bt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return m(this,void 0,void 0,function*(){return yield this.abort(t),Z})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),Z})}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(Z)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Je=class extends As{write(t){if((t=B(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Gn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Gn)}toUint8Array(t=!1){return t?te(this._values)[0]:(()=>m(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var c=!0,l=he(this),d;d=yield l.next(),e=d.done,!e;c=!0){s=d.value,c=!1;let f=s;o.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return te(o,a)[0]}))()}},Ke=class{constructor(t){t&&(this.source=new ta(bt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Jt=class{constructor(t){t instanceof Jt?this.source=t.source:t instanceof Je?this.source=new sr(bt.fromAsyncIterable(t)):Hi(t)?this.source=new sr(bt.fromNodeStream(t)):$n(t)?this.source=new sr(bt.fromDOMStream(t)):$i(t)?this.source=new sr(bt.fromDOMStream(t.body)):pe(t)?this.source=new sr(bt.fromIterable(t)):Qt(t)?this.source=new sr(bt.fromAsyncIterable(t)):se(t)&&(this.source=new sr(bt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},ta=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Z)}return(t){return Object.create(this.source.return&&this.source.return(t)||Z)}},sr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return m(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return m(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return m(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var ii=class extends Ke{constructor(t,e){super(),this.position=0,this.buffer=B(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Br=class extends Jt{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>m(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return m(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return m(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let 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 m(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 m(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ra={};br(ra,{BaseInt64:()=>si,Int128:()=>Kt,Int64:()=>gt,Uint64:()=>j});function Tn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Dn=8,ea=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],si=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`${Tn(this.buffer[1])} ${Tn(this.buffer[0])}`}},j=class extends si{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return j.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return j.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new j(e);for(let s=0;s<n;){let o=Dn<n-s?Dn:n-s,a=new j(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new j(new Uint32Array([ea[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;)j.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new j(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new j(new Uint32Array(t.buffer)).plus(e)}},gt=class extends si{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return gt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return gt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new gt(e);for(let o=n?1:0;o<i;){let a=Dn<i-o?Dn:i-o,c=new gt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new gt(new Uint32Array([ea[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;)gt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new gt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new gt(new Uint32Array(t.buffer)).plus(e)}},Kt=class{constructor(t){this.buffer=t}high(){return new gt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new gt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new j(new Uint32Array([this.buffer[3],0])),n=new j(new Uint32Array([this.buffer[2],0])),i=new j(new Uint32Array([this.buffer[1],0])),s=new j(new Uint32Array([this.buffer[0],0])),o=new j(new Uint32Array([t.buffer[3],0])),a=new j(new Uint32Array([t.buffer[2],0])),c=new j(new Uint32Array([t.buffer[1],0])),l=new j(new Uint32Array([t.buffer[0],0])),d=j.multiply(s,l);this.buffer[0]=d.low();let f=new j(new Uint32Array([d.high(),0]));return d=j.multiply(i,l),f.plus(d),d=j.multiply(s,c),f.plus(d),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(d)?1:0,this.buffer[2]=f.high(),new j(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(j.multiply(n,l)).plus(j.multiply(i,c)).plus(j.multiply(s,a)),this.buffer[3]+=j.multiply(e,l).plus(j.multiply(n,c)).plus(j.multiply(i,a)).plus(j.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`${Tn(this.buffer[3])} ${Tn(this.buffer[2])} ${Tn(this.buffer[1])} ${Tn(this.buffer[0])}`}static multiply(t,e){return new Kt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Kt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Kt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Kt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new Kt(e);for(let o=n?1:0;o<i;){let a=Dn<i-o?Dn:i-o,c=new Kt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new Kt(new Uint32Array([ea[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;)Kt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var oi=class extends w{constructor(t,e,n,i,s=z.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 O?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return b({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<z.V5&&this.readNullBitmap(t,n),t.mode===Y.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},Ts=class extends oi{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):Hr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return p.isTimestamp(t)?E(Uint8Array,gt.convertArray(n[e])):(p.isInt(t)||p.isTime(t))&&t.bitWidth===64||p.isDuration(t)?E(Uint8Array,gt.convertArray(n[e])):p.isDate(t)&&t.unit===J.MILLISECOND?E(Uint8Array,gt.convertArray(n[e])):p.isDecimal(t)?E(Uint8Array,Kt.convertArray(n[e])):p.isBinary(t)||p.isLargeBinary(t)||p.isFixedSizeBinary(t)?wf(n[e]):p.isBool(t)?Hr(n[e]):p.isUtf8(t)||p.isLargeUtf8(t)?Be(n[e].join("")):E(Uint8Array,E(t.ArrayType,n[e].map(i=>+i)))}};function wf(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var On=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,B(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,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 Fn=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,B(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,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 Ds=class extends q{constructor(t){super(t),this._values=new Bn}setValue(t,e){this._values.set(t,+e)}};var qr=class extends lt{};qr.prototype._setValue=Ro;var ai=class extends qr{};ai.prototype._setValue=es;var ci=class extends qr{};ci.prototype._setValue=rs;var li=class extends lt{};li.prototype._setValue=Po;var Os=class extends q{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Tt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Se({type:this.type.indices,nullValues:e}),this.dictionary=Se({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),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 ui=class extends lt{};ui.prototype._setValue=Eo;var Fs=class extends q{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 Ut(this.type.listSize,new O(e,t.type,!0)),n}};var Qr=class extends lt{setValue(t,e){this._values.set(t,e)}},Ms=class extends Qr{setValue(t,e){super.setValue(t,qn(e))}},Ls=class extends Qr{},Ns=class extends Qr{};var tn=class extends lt{};tn.prototype._setValue=Vo;var di=class extends tn{};di.prototype._setValue=ds;var fi=class extends tn{};fi.prototype._setValue=fs;var or=class extends lt{};or.prototype._setValue=jo;var hi=class extends or{};hi.prototype._setValue=hs;var pi=class extends or{};pi.prototype._setValue=ps;var mi=class extends or{};mi.prototype._setValue=ms;var yi=class extends or{};yi.prototype._setValue=ys;var de=class extends lt{setValue(t,e){this._values.set(t,e)}},Us=class extends de{},Es=class extends de{},Rs=class extends de{},Cs=class extends de{},ks=class extends de{},Ps=class extends de{},Vs=class extends de{},js=class extends de{};var zs=class extends Ht{constructor(t){super(t),this._offsets=new An(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new wt(new O(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,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 Ws=class extends Ht{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),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 Et(new O(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,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 Gs=class extends q{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var $s=class extends q{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 k([...this.type.children,new O(e,t.type,!0)]),n}};var ar=class extends lt{};ar.prototype._setValue=Co;var gi=class extends ar{};gi.prototype._setValue=ns;var bi=class extends ar{};bi.prototype._setValue=is;var wi=class extends ar{};wi.prototype._setValue=ss;var _i=class extends ar{};_i.prototype._setValue=os;var cr=class extends lt{};cr.prototype._setValue=ko;var vi=class extends cr{};vi.prototype._setValue=as;var Ii=class extends cr{};Ii.prototype._setValue=cs;var Si=class extends cr{};Si.prototype._setValue=ls;var xi=class extends cr{};xi.prototype._setValue=us;var Mn=class extends q{constructor(t){super(t),this._typeIds=new nr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],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 O(e,t.type)];return this.type=new ue(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.")}},Ys=class extends Mn{},Hs=class extends Mn{constructor(t){super(t),this._offsets=new nr(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s?.set(o,e)}};var Bi=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Be(e))}_flushPending(t,e){}};Bi.prototype._flushPending=On.prototype._flushPending;var Ai=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Be(e))}_flushPending(t,e){}};Ai.prototype._flushPending=Fn.prototype._flushPending;var na=class extends w{visitNull(){return Gs}visitBool(){return Ds}visitInt(){return de}visitInt8(){return Us}visitInt16(){return Es}visitInt32(){return Rs}visitInt64(){return Cs}visitUint8(){return ks}visitUint16(){return Ps}visitUint32(){return Vs}visitUint64(){return js}visitFloat(){return Qr}visitFloat16(){return Ms}visitFloat32(){return Ls}visitFloat64(){return Ns}visitUtf8(){return Bi}visitLargeUtf8(){return Ai}visitBinary(){return On}visitLargeBinary(){return Fn}visitFixedSizeBinary(){return ui}visitDate(){return qr}visitDateDay(){return ai}visitDateMillisecond(){return ci}visitTimestamp(){return ar}visitTimestampSecond(){return gi}visitTimestampMillisecond(){return bi}visitTimestampMicrosecond(){return wi}visitTimestampNanosecond(){return _i}visitTime(){return cr}visitTimeSecond(){return vi}visitTimeMillisecond(){return Ii}visitTimeMicrosecond(){return Si}visitTimeNanosecond(){return xi}visitDecimal(){return li}visitList(){return zs}visitStruct(){return $s}visitUnion(){return Mn}visitDenseUnion(){return Hs}visitSparseUnion(){return Ys}visitDictionary(){return Os}visitInterval(){return tn}visitIntervalDayTime(){return di}visitIntervalYearMonth(){return fi}visitDuration(){return or}visitDurationSecond(){return hi}visitDurationMillisecond(){return pi}visitDurationMicrosecond(){return mi}visitDurationNanosecond(){return yi}visitFixedSizeList(){return Fs}visitMap(){return Ws}},dl=new na;var S=class extends w{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function Rt(r,t){return t instanceof r.constructor}function en(r,t){return r===t||Rt(r,t)}function lr(r,t){return r===t||Rt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Js(r,t){return r===t||Rt(r,t)&&r.precision===t.precision}function _f(r,t){return r===t||Rt(r,t)&&r.byteWidth===t.byteWidth}function ia(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Ti(r,t){return r===t||Rt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Di(r,t){return r===t||Rt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function vf(r,t){return r===t||Rt(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function If(r,t){return r===t||Rt(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function sa(r,t){return r===t||Rt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Ze.compareManyFields(r.children,t.children)}function Sf(r,t){return r===t||Rt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Ze.visit(r.indices,t.indices)&&Ze.visit(r.dictionary,t.dictionary)}function oa(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Oi(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function xf(r,t){return r===t||Rt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function Bf(r,t){return r===t||Rt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}S.prototype.visitNull=en;S.prototype.visitBool=en;S.prototype.visitInt=lr;S.prototype.visitInt8=lr;S.prototype.visitInt16=lr;S.prototype.visitInt32=lr;S.prototype.visitInt64=lr;S.prototype.visitUint8=lr;S.prototype.visitUint16=lr;S.prototype.visitUint32=lr;S.prototype.visitUint64=lr;S.prototype.visitFloat=Js;S.prototype.visitFloat16=Js;S.prototype.visitFloat32=Js;S.prototype.visitFloat64=Js;S.prototype.visitUtf8=en;S.prototype.visitLargeUtf8=en;S.prototype.visitBinary=en;S.prototype.visitLargeBinary=en;S.prototype.visitFixedSizeBinary=_f;S.prototype.visitDate=ia;S.prototype.visitDateDay=ia;S.prototype.visitDateMillisecond=ia;S.prototype.visitTimestamp=Ti;S.prototype.visitTimestampSecond=Ti;S.prototype.visitTimestampMillisecond=Ti;S.prototype.visitTimestampMicrosecond=Ti;S.prototype.visitTimestampNanosecond=Ti;S.prototype.visitTime=Di;S.prototype.visitTimeSecond=Di;S.prototype.visitTimeMillisecond=Di;S.prototype.visitTimeMicrosecond=Di;S.prototype.visitTimeNanosecond=Di;S.prototype.visitDecimal=en;S.prototype.visitList=vf;S.prototype.visitStruct=If;S.prototype.visitUnion=sa;S.prototype.visitDenseUnion=sa;S.prototype.visitSparseUnion=sa;S.prototype.visitDictionary=Sf;S.prototype.visitInterval=oa;S.prototype.visitIntervalDayTime=oa;S.prototype.visitIntervalYearMonth=oa;S.prototype.visitDuration=Oi;S.prototype.visitDurationSecond=Oi;S.prototype.visitDurationMillisecond=Oi;S.prototype.visitDurationMicrosecond=Oi;S.prototype.visitDurationNanosecond=Oi;S.prototype.visitFixedSizeList=xf;S.prototype.visitMap=Bf;var Ze=new S;function rn(r,t){return Ze.compareSchemas(r,t)}function fl(r,t){return Ze.compareFields(r,t)}function Ks(r,t){return Ze.visit(r,t)}function Se(r){let t=r.type,e=new(dl.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(Se(Object.assign(Object.assign({},l),{type:c})))}}return e}function Fi(r,t){if(r instanceof M||r instanceof y||r.type instanceof p||ArrayBuffer.isView(r))return xn(r);let e={type:t??Zs(r),nullValues:[null]},n=[...aa(e)(r)],i=n.length===1?n[0]:n.reduce((s,o)=>s.concat(o));return p.isDictionary(i.type)?i.memoize():i}function Zs(r){if(r.length===0)return new nt;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 le;if(s+t===r.length)return new Tt(new Lt,new yt);if(o+t===r.length)return new ce;if(a+t===r.length)return new Nt;if(c+t===r.length)return new er;if(e+t===r.length){let l=r,d=Zs(l[l.findIndex(f=>f!=null)]);if(l.every(f=>f==null||Ks(d,Zs(f))))return new wt(new O("",d,!0))}else if(n+t===r.length){let l=new Map;for(let d of r)for(let f of Object.keys(d))!l.has(f)&&d[f]!=null&&l.set(f,new O(f,Zs([d[f]]),!0));return new k([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function aa(r){let{["queueingStrategy"]:t="count"}=r,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=t!=="bytes"?"length":"byteLength";return function*(i){let s=0,o=Se(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 Xs(r,t){return Af(r,t.map(e=>e.data.concat()))}function Af(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((f,V)=>Math.max(f,V.length),0)},s=0,o=0,a=-1,c=t.length,l,d=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)d[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(d=Tf(e,o,d,t,i),o>0&&(n[s++]=b({type:new k(e),length:o,nullCount:0,children:d.slice()})))}return[r=r.assign(e),n.map(f=>new G(r,f))]}function Tf(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],d=l?.length;if(d>=t)d===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,d-t))));else{let f=r[a];r[a]=f.clone({nullable:!0}),e[a]=(s=l?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:b({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var hl,$=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let i,s;t[0]instanceof U&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof G)return[c];if(c instanceof $)return c.batches;if(c instanceof M){if(c.type instanceof k)return[new G(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),d=l.map(N=>new y([c[N]])),f=i??new U(l.map((N,ot)=>new O(String(N),d[ot].type,d[ot].nullable))),[,V]=Xs(f,d);return V.length===0?[new G(c)]:V}}}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 U([]),!(i instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof G))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!rn(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??vs(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=_s(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?In.visit(new y(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
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 K(e,n.map(i=>new W(e,i)))}slice(t,e){let n=this.schema;[t,e]=ai({length:this.numRows},t,e);let i=Gs(this.data,this._offsets,t,e);return new K(n,i.map(s=>new W(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 b(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 b([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]=_o(n,a)}return new K(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 K(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(p=>p.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 K(..._o(s,o))}};ou=Symbol.toStringTag;K[ou]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Tn(ui),r.get=Tn(pt.getVisitFn(f.Struct)),r.set=$s(Dt.getVisitFn(f.Struct)),r.indexOf=Hs(qr.getVisitFn(f.Struct)),"Table"))(K.prototype);var cu,W=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof R))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 U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=au(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]=O.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new R(n),a=w({type:new V(n),length:s,children:i,nullCount:0});[this.schema,this.data]=au(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=lu(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 pt.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 Dn.visit(new b([this.data]))}toArray(){return[...this]}concat(...t){return new K(this.schema,[this,...t])}slice(t,e){let[n]=new b([this.data]).slice(t,e).data;return new W(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 b([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 b([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 R(s,new Map(this.schema.metadata)),i=w({type:new V(s),children:o})}return new W(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 W(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 W(e,i)}};cu=Symbol.toStringTag;W[cu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(W.prototype);function au(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 lu(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)||[]])lu(a.children,l?.children,e);if(y.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 W{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):H.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,H.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 za=class extends I{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return je.startNull(e),je.endNull(e)}visitInt(t,e){return wt.startInt(e),wt.addBitWidth(e,t.bitWidth),wt.addIsSigned(e,t.isSigned),wt.endInt(e)}visitFloat(t,e){return Kt.startFloatingPoint(e),Kt.addPrecision(e,t.precision),Kt.endFloatingPoint(e)}visitBinary(t,e){return Re.startBinary(e),Re.endBinary(e)}visitLargeBinary(t,e){return Pe.startLargeBinary(e),Pe.endLargeBinary(e)}visitBool(t,e){return Ce.startBool(e),Ce.endBool(e)}visitUtf8(t,e){return We.startUtf8(e),We.endUtf8(e)}visitLargeUtf8(t,e){return ke.startLargeUtf8(e),ke.endLargeUtf8(e)}visitDecimal(t,e){return _t.startDecimal(e),_t.addScale(e,t.scale),_t.addPrecision(e,t.precision),_t.addBitWidth(e,t.bitWidth),_t.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 Ve.startList(e),Ve.endList(e)}visitStruct(t,e){return ze.startStruct_(e),ze.endStruct_(e)}visitUnion(t,e){vt.startTypeIdsVector(e,t.typeIds.length);let n=vt.createTypeIdsVector(e,t.typeIds);return vt.startUnion(e),vt.addMode(e,t.mode),vt.addTypeIds(e,n),vt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ae.startDictionaryEncoding(e),ae.addId(e,BigInt(t.id)),ae.addIsOrdered(e,t.isOrdered),n!==void 0&&ae.addIndexType(e,n),ae.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)}},vo=new za;function du(r,t=new Map){return new R(Id(r,t),Io(r.metadata),t)}function Wa(r){return new Ot(r.count,mu(r.columns),yu(r.columns))}function pu(r){return new ne(Wa(r.data),r.id,r.isDelta)}function Id(r,t){return(r.fields||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function uu(r,t){return(r.children||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function mu(r){return(r||[]).reduce((t,e)=>[...t,new _e(e.count,xd(e.VALIDITY)),...mu(e.children)],[])}function yu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new re(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new re(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new re(t.length,i.OFFSET.length)),i.DATA&&t.push(new re(t.length,i.DATA.length)),t=yu(i.children,t)}return t}function xd(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function gu(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=hu(r,uu(r,t)),i=new O(r.name,o,r.nullable,Io(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?fu(n):new It,a=new Ut(t.get(e),n,e,s.isOrdered),i=new O(r.name,a,r.nullable,Io(r.metadata))):(n=(n=s.indexType)?fu(n):new It,t.set(e,o=hu(r,uu(r,t))),a=new Ut(o,n,e,s.isOrdered),i=new O(r.name,a,r.nullable,Io(r.metadata))),i||null}function Io(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function fu(r){return new st(r.isSigned,r.bitWidth)}function hu(r,t){let e=r.type.name;switch(e){case"NONE":return new ut;case"null":return new ut;case"binary":return new ce;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 st(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new At(z[n.precision])}case"decimal":{let n=r.type;return new le(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Xt(rt[n.unit])}case"time":{let n=r.type;return new xt(m[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Nt(m[n.unit],n.timezone)}case"interval":{let n=r.type;return new Qt(it[n.unit])}case"duration":{let n=r.type;return new Qe(m[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new ge(J[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 Sd=ar,Bd=Ct,yt=class{static fromJSON(t,e){let n=new yt(0,H.V5,e);return n._createHeader=Ad(t,e),n}static decode(t){t=new Bd(D(t));let e=ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new yt(n,i,s);return o._createHeader=Td(e,s),o}static encode(t){let e=new Sd,n=-1;return t.isSchema()?n=R.encode(e,t.header()):t.isRecordBatch()?n=Ot.encode(e,t.header()):t.isDictionaryBatch()&&(n=ne.encode(e,t.header())),ft.startMessage(e),ft.addVersion(e,H.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 R)return new yt(0,H.V5,P.Schema,t);if(t instanceof Ot)return new yt(e,H.V5,P.RecordBatch,t);if(t instanceof ne)return new yt(e,H.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)}},ne=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)}},re=class{constructor(t,e){this.offset=at(t),this.length=at(e)}},_e=class{constructor(t,e){this.length=at(t),this.nullCount=at(e)}};function Ad(r,t){return()=>{switch(t){case P.Schema:return R.fromJSON(r);case P.RecordBatch:return Ot.fromJSON(r);case P.DictionaryBatch:return ne.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}function Td(r,t){return()=>{switch(t){case P.Schema:return R.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 ne.decode(r.header(new de),r.version())}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}O.encode=Pd;O.decode=Rd;O.fromJSON=gu;R.encode=Cd;R.decode=Dd;R.fromJSON=du;Ot.encode=kd;Ot.decode=Od;Ot.fromJSON=Wa;ne.encode=Vd;ne.decode=Fd;ne.fromJSON=pu;_e.encode=jd;_e.decode=Ld;re.encode=zd;re.decode=Md;function Dd(r,t=new Map,e=H.V5){let n=Ed(r,t);return new R(n,xo(r),t,e)}function Od(r,t=H.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Ot(r.length(),Nd(r),Ud(r,t))}function Fd(r,t=H.V5){return new ne(Ot.decode(r.data(),t),r.id(),r.isDelta())}function Md(r){return new re(r.offset(),r.length())}function Ld(r){return new _e(r.length(),r.nullCount())}function Nd(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=_e.decode(e));return t}function Ud(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<H.V4&&(n.bb_pos+=8*(i+1)),e[++s]=re.decode(n));return e}function Ed(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=O.decode(n,t));return e}function bu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=O.decode(n,t));return e}function Rd(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=_u(r,bu(r,t)),n=new O(r.name(),i,r.nullable(),xo(r))):t.has(e=at(a.id()))?(s=(s=a.indexType())?wu(s):new It,o=new Ut(t.get(e),s,e,a.isOrdered()),n=new O(r.name(),o,r.nullable(),xo(r))):(s=(s=a.indexType())?wu(s):new It,t.set(e,i=_u(r,bu(r,t))),o=new Ut(i,s,e,a.isOrdered()),n=new O(r.name(),o,r.nullable(),xo(r))),n||null}function xo(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 wu(r){return new st(r.isSigned(),r.bitWidth())}function _u(r,t){let e=r.typeType();switch(e){case X.NONE:return new ut;case X.Null:return new ut;case X.Binary:return new ce;case X.LargeBinary:return new Je;case X.Utf8:return new Pt;case X.LargeUtf8:return new Xe;case X.Bool:return new kt;case X.List:return new Tt((t||[])[0]);case X.Struct_:return new V(t||[])}switch(e){case X.Int:{let n=r.type(new wt);return new st(n.isSigned(),n.bitWidth())}case X.FloatingPoint:{let n=r.type(new Kt);return new At(n.precision())}case X.Decimal:{let n=r.type(new _t);return new le(n.scale(),n.precision(),n.bitWidth())}case X.Date:{let n=r.type(new Gt);return new Xt(n.unit())}case X.Time:{let n=r.type(new Mt);return new xt(n.unit(),n.bitWidth())}case X.Timestamp:{let n=r.type(new Lt);return new Nt(n.unit(),n.timezone())}case X.Interval:{let n=r.type(new Zt);return new Qt(n.unit())}case X.Duration:{let n=r.type(new $t);return new Qe(n.unit())}case X.Union:{let n=r.type(new vt);return new ge(n.mode(),n.typeIdsArray()||[],t||[])}case X.FixedSizeBinary:{let n=r.type(new Ht);return new qe(n.byteWidth())}case X.FixedSizeList:{let n=r.type(new Yt);return new Vt(n.listSize(),(t||[])[0])}case X.Map:{let n=r.type(new Jt);return new jt((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${X[e]}" (${e})`)}function Cd(r,t){let e=t.fields.map(s=>O.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,Wd?Sr.Little:Sr.Big),i!==-1&&ot.addCustomMetadata(r,i),ot.endSchema(r)}function Pd(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;y.isDictionary(s)?(o=s.dictionary.typeId,i=vo.visit(s,r),n=vo.visit(s.dictionary,r)):n=vo.visit(s,r);let a=(s.children||[]).map(u=>O.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}`),p=r.createString(`${h}`);return Q.startKeyValue(r),Q.addKey(r,d),Q.addValue(r,p),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 kd(r,t){let e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(r,e.length);for(let o of e.slice().reverse())_e.encode(r,o);let i=r.endVector();Ft.startBuffersVector(r,n.length);for(let o of n.slice().reverse())re.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 Vd(r,t){let e=Ot.encode(r,t.data);return de.startDictionaryBatch(r),de.addId(r,BigInt(t.id)),de.addIsDelta(r,t.isDelta),de.addData(r,e),de.endDictionaryBatch(r)}function jd(r,t){return wn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function zd(r,t){return bn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var Wd=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var $a=r=>`Expected ${P[r]} Message in stream, but was null or length 0.`,Ha=r=>`Header pointer of flatbuffer-encoded ${P[r]} Message is null or length 0.`,vu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Iu=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Cn=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($a(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=D(this.source.read(t));if(e.byteLength<t)throw new Error(Iu(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(Ha(e));return i}readMetadataLength(){let t=this.source.read(So),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(vu(t,e.byteLength));return{done:!1,value:yt.decode(e)}}},ki=class{constructor(t,e){this.source=t instanceof te?t:hs(t)?new Fr(t,e):new te(t)}[Symbol.asyncIterator](){return this}next(){return g(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 g(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return g(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return g(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($a(t));return e.value})}readMessageBody(t){return g(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=D(yield this.source.read(t));if(e.byteLength<t)throw new Error(Iu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return g(this,void 0,void 0,function*(){let e=P.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(Ha(e));return i})}readMetadataLength(){return g(this,void 0,void 0,function*(){let t=yield this.source.read(So),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return g(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(vu(t,e.byteLength));return{done:!1,value:yt.decode(e)}})}},Vi=class extends Cn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof fi?t:new fi(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:yt.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:yt.fromJSON(e,P.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:yt.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($a(t));return e.value}readSchema(){let t=P.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(Ha(t));return n}},So=4,Ga="ARROW1",Pn=new Uint8Array(Ga.length);for(let r=0;r<Ga.length;r+=1)Pn[r]=Ga.codePointAt(r);function Bo(r,t=0){for(let e=-1,n=Pn.length;++e<n;)if(Pn[e]!==r[t+e])return!1;return!0}var kn=Pn.length,Ya=kn+So,xu=kn*2+So;var gt=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 se(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 gt?t:us(t)?$d(t):hs(t)?Kd(t):se(t)?(()=>g(this,void 0,void 0,function*(){return yield gt.from(yield t)}))():ds(t)||qn(t)||ms(t)||fe(t)?Yd(new te(t)):Hd(new rr(t))}static readAll(t){return t instanceof gt?t.isSync()?Su(t):Bu(t):us(t)||ArrayBuffer.isView(t)||Ie(t)||fs(t)?Su(t):Bu(t)}},ir=class extends gt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ie(this,arguments,function*(){yield E(yield*yn(ve(this[Symbol.iterator]())))})}},Mr=class extends gt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return g(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=ve(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}},ji=class extends Mr{constructor(t){super(t),this._impl=t}},Ao=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 W(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 b(l)):new b(l)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new pi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Vn=class extends Ao{constructor(t,e){super(e),this._reader=us(t)?new Vi(this._handle=t):new Cn(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=Au(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)}},jn=class extends Ao{constructor(t,e){super(e),this._reader=new ki(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return g(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 g(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Au(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return g(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):q})}return(t){return g(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):q})}next(){return g(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 g(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},To=class extends Vn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof hi?t:new hi(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-Ya,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}},Ka=class extends jn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof 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 g(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 g(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 g(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 g(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Ya,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return fr.decode(i)})}_readNextMessageAndValidate(t){return g(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})}},Za=class extends Vn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Zs(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Au(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Su(r){let t=gt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Bu(r){return ie(this,arguments,function*(){let e=yield E(gt.from(r));try{if(!(yield E(e.open({autoDestroy:!1}))).closed)do yield yield E(e);while(!(yield E(e.reset().open())).closed)}finally{yield E(e.cancel())}})}function $d(r){return new ir(new Za(r))}function Hd(r){let t=r.peek(kn+7&-8);return t&&t.byteLength>=4?Bo(t)?new Lr(new To(r.read())):new ir(new Vn(r)):new ir(new Vn(function*(){}()))}function Yd(r){return g(this,void 0,void 0,function*(){let t=yield r.peek(kn+7&-8);return t&&t.byteLength>=4?Bo(t)?new Lr(new To(yield r.read())):new Mr(new jn(r)):new Mr(new jn(function(){return ie(this,arguments,function*(){})}()))})}function Kd(r){return g(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Fr(r,t);return t>=xu&&Bo(yield e.readAt(0,kn+7&-8))?new ji(new Ka(e)):new Mr(new jn(e))})}var tt=class extends I{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof W?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 b)return this.visitMany(t.data),this;let{type:e}=t;if(!y.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(y.isUnion(e))this.nodes.push(new _e(n,0));else{let{nullCount:i}=t;y.isNull(e)||Le.call(this,i<=0?new Uint8Array(0):Jr(t.offset,n,t.nullBitmap)),this.nodes.push(new _e(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 Le(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new re(this._byteLength,t)),this._byteLength+=t,this}function Zd(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Le.call(this,i),e.mode===J.Sparse)return Ja.call(this,r);if(e.mode===J.Dense){if(r.offset<=0)return Le.call(this,s),Ja.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);Le.call(this,o),this.visitMany(r.children.map((l,u)=>{let h=e.typeIds[u],d=a[h],p=c[h];return l.slice(d,Math.min(n,p))}))}}return this}function Jd(r){let t;return r.nullCount>=r.length?Le.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Le.call(this,Jr(r.offset,r.length,t)):Le.call(this,Xr(r.values))}function gr(r){return Le.call(this,r.values.subarray(0,r.length*r.stride))}function Do(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 Le.call(this,gs(-i,t+1,n)),Le.call(this,e.subarray(i,i+o)),this}function Xa(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Le.call(this,gs(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function Ja(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}tt.prototype.visitBool=Jd;tt.prototype.visitInt=gr;tt.prototype.visitFloat=gr;tt.prototype.visitUtf8=Do;tt.prototype.visitLargeUtf8=Do;tt.prototype.visitBinary=Do;tt.prototype.visitLargeBinary=Do;tt.prototype.visitFixedSizeBinary=gr;tt.prototype.visitDate=gr;tt.prototype.visitTimestamp=gr;tt.prototype.visitTime=gr;tt.prototype.visitDecimal=gr;tt.prototype.visitList=Xa;tt.prototype.visitStruct=Ja;tt.prototype.visitUnion=Zd;tt.prototype.visitInterval=gr;tt.prototype.visitDuration=gr;tt.prototype.visitFixedSizeList=Xa;tt.prototype.visitMap=Xa;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 se(t)?t.then(e=>this.writeAll(e)):fe(t)?qa(this,t):Qa(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&&Vc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&jc(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 K&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof W&&!(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 W?t instanceof cn||this._writeRecordBatch(t):t instanceof K?this.writeAll(t.batches):Ie(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=yt.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 Fe(a,t.bodyLength,this._position)):t.headerType===P.DictionaryBatch&&this._dictionaryBlocks.push(new Fe(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=D(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(yt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Pn)}_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=yt.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 b([t])),c=new Ot(t.length,s,o),l=new ne(c,e,n),u=yt.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}},br=class extends ln{static writeAll(t,e){let n=new br(e);return se(t)?t.then(i=>n.writeAll(i)):fe(t)?qa(n,t):Qa(n,t)}},wr=class extends ln{static writeAll(t){let e=new wr;return se(t)?t.then(n=>e.writeAll(n)):fe(t)?qa(e,t):Qa(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=fr.encode(new fr(t,H.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Qa(r,t){let e=t;t instanceof K&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function qa(r,t){var e,n,i,s,o,a,c;return g(this,void 0,void 0,function*(){try{for(e=!0,n=ve(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 Tu(r,t){if(fe(r))return Qd(r,t);if(Ie(r))return Xd(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}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){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=D(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 Qd(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 g(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return g(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return g(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 g(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=D(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 Fu(r){return new tc(r)}var tc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Pc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Me(s),this._getSize=i!=="bytes"?Du:Ou;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"?Du:Ou}),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)}},Du=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Ou=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function Oo(r,t){let e=new er,n=null,i=new ReadableStream({cancel(){return g(this,void 0,void 0,function*(){yield e.close()})},start(a){return g(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return g(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 g(this,void 0,void 0,function*(){return yield(yield gt.from(e)).open(t)})}function o(a,c){return g(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 Fo(r,t){let e=new this(r),n=new te(e),i=new ReadableStream({cancel(){return g(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return g(this,void 0,void 0,function*(){yield s(o)})},start(o){return g(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 g(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 zi(r){let t=gt.from(r);return se(t)?t.then(e=>zi(e)):t.isAsync()?t.readAll().then(e=>new K(e)):new K(t.readAll())}function Mo(r,t="stream"){return(t==="stream"?br:wr).writeAll(r).toUint8Array(!0)}var lp=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},fa),Ra),Da),ha),oa),Ta),la),{compareSchemas:an,compareFields:su,compareTypes:bo});Bt.toDOMStream=Tu;nt.throughDOM=Fu;gt.throughDOM=Oo;Lr.throughDOM=Oo;ir.throughDOM=Oo;ln.throughDOM=Fo;wr.throughDOM=Fo;br.throughDOM=Fo;var Lo=class extends Er{arrowSchema;constructor(t,e){super(t,e),this.arrowSchema=null}getBatch(){let t=super.getBatch();if(t){this.arrowSchema=this.arrowSchema||up(t.schema);let e=fp(this.arrowSchema,t.data),n=new W(this.arrowSchema,w({type:new V(this.arrowSchema.fields),children:e.map(({data:i})=>i[0])}));return{shape:"arrow-table",batchType:"data",data:new K([n]),length:t.length}}return null}};function up(r){let t=[];for(let e in r){let n=r[e];if(n.type===Float32Array){let i=new Map,s=new O(n.name,new me,n.nullable,i);t.push(s)}}if(t.length===0)throw new Error("No arrow convertible fields");return new R(t)}function fp(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}var hp="4.3.1",Wn={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:hp,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"}}};var dp=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],pp="ARROW:extension:name",mp="ARROW:extension:metadata";function ec(r){let t={};for(let e of r.fields){let n=yp(e);n&&(t[e.name]=n)}return t}function yp(r){let t=null,e=r.metadata?.[pp];e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),dp.includes(e)?(t=t||{},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=r.metadata?.[mp];if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}var Wi={x:0,y:1,z:2};function No(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Wi[i[0]],c=Wi[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=Lu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,p,v,k;if(s&&(a=xp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],p=h=r[1];for(let Z=e;Z<o;Z+=e)v=r[Z],k=r[Z+1],v<d&&(d=v),k<p&&(p=k),v>u&&(u=v),k>h&&(h=k);l=Math.max(u-d,h-p),l=l!==0?32767/l:0}return Gi(a,c,e,d,p,l,0),c}function Lu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=No(r,{start:t,end:e,size:n,plane:o}));let l=Wi[o[0]],u=Wi[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=Mu(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=Mu(a,r[a+l],r[a+u],c);return c&&Ro(c,c.next)&&(Hi(c),c=c.next),c}function un(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(Ro(e,e.next)||ct(e.prev,e,e.next)===0)){if(Hi(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Gi(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Dp(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?_p(r,n,i,s):wp(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Hi(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=vp(un(r),t,e),Gi(r,t,e,n,i,s,2)):o===2&&Ip(r,t,e,n,i,s):Gi(un(r),t,e,n,i,s,1);break}}}function wp(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,p=a>c?a>l?a:l:c>l?c:l,v=n.next;for(;v!==t;){if(v.x>=u&&v.x<=d&&v.y>=h&&v.y<=p&&Gn(i,a,s,c,o,l,v.x,v.y)&&ct(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function _p(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,p=a<c?a<l?a:l:c<l?c:l,v=u<h?u<d?u:d:h<d?h:d,k=a>c?a>l?a:l:c>l?c:l,Z=u>h?u>d?u:d:h>d?h:d,et=rc(p,v,t,e,n),pn=rc(k,Z,t,e,n),G=r.prevZ,j=r.nextZ;for(;G&&G.z>=et&&j&&j.z<=pn;){if(G.x>=p&&G.x<=k&&G.y>=v&&G.y<=Z&&G!==i&&G!==o&&Gn(a,u,c,h,l,d,G.x,G.y)&&ct(G.prev,G,G.next)>=0||(G=G.prevZ,j.x>=p&&j.x<=k&&j.y>=v&&j.y<=Z&&j!==i&&j!==o&&Gn(a,u,c,h,l,d,j.x,j.y)&&ct(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;G&&G.z>=et;){if(G.x>=p&&G.x<=k&&G.y>=v&&G.y<=Z&&G!==i&&G!==o&&Gn(a,u,c,h,l,d,G.x,G.y)&&ct(G.prev,G,G.next)>=0)return!1;G=G.prevZ}for(;j&&j.z<=pn;){if(j.x>=p&&j.x<=k&&j.y>=v&&j.y<=Z&&j!==i&&j!==o&&Gn(a,u,c,h,l,d,j.x,j.y)&&ct(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function vp(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!Ro(i,s)&&Nu(i,n,n.next,s)&&$i(i,s)&&$i(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Hi(n),Hi(n.next),n=r=s),n=n.next}while(n!==r);return un(n)}function Ip(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Mp(o,a)){let c=Uu(o,a);o=un(o,o.next),c=un(c,c.next),Gi(o,t,e,n,i,s,0),Gi(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function xp(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=Lu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Fp(h));for(o.sort(Sp),a=0;a<o.length;a++)e=Bp(o[a],e);return e}function Sp(r,t){return r.x-t.x}function Bp(r,t){let e=Ap(r,t);if(!e)return t;let n=Uu(e,r);return un(n,n.next),un(e,e.next)}function Ap(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&&Gn(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),$i(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&Tp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function Tp(r,t){return ct(r.prev,r,t.prev)<0&&ct(t.next,r,r.next)<0}function Dp(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,Op(i)}function Op(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 Fp(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 Gn(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 Mp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Lp(r,t)&&($i(r,t)&&$i(t,r)&&Np(r,t)&&(ct(r.prev,r,t.prev)||ct(r,t.prev,t))||Ro(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 Ro(r,t){return r.x===t.x&&r.y===t.y}function Nu(r,t,e,n){let i=Eo(ct(r,t,e)),s=Eo(ct(r,t,n)),o=Eo(ct(e,n,r)),a=Eo(ct(e,n,t));return!!(i!==s&&o!==a||i===0&&Uo(r,e,t)||s===0&&Uo(r,n,t)||o===0&&Uo(e,r,n)||a===0&&Uo(e,t,n))}function Uo(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 Eo(r){return r>0?1:r<0?-1:0}function Lp(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&&Nu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function $i(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 Np(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 Uu(r,t){let e=new Yi(r.i,r.x,r.y),n=new Yi(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 Mu(r,t,e,n){let i=new Yi(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 Hi(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 Yi=class{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}};function $n(r,t,e){switch(r.type){case"Point":return kp(r,t,e);case"LineString":return Pp(r,t,e);case"Polygon":return Cu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function Cu(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=Co(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=Cu(r,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function Pp(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.pathIndices.value.filter(a=>a>=t&&a<=e);if(!(i.length>2))return{type:"LineString",coordinates:Co(n,i[0],i[1])};let o=[];for(let a=0;a<i.length-1;a++){let c=Co(n,i[a],i[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function kp(r,t,e){let{positions:n}=r,i=Co(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Co(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 Hn(r){return ic(r)}function Pu(r){return Ki(r)}function ic(r){return{fields:r.fields.map(t=>fn(t)),metadata:Po(r.metadata)}}function Ki(r){return new R(r.fields.map(t=>hn(t)),ko(r.metadata))}function Po(r){return Object.fromEntries(r)}function ko(r){return r?new Map(Object.entries(r)):new Map}function fn(r){return{name:r.name,type:sc(r.type),nullable:r.nullable,metadata:Po(r.metadata)}}function hn(r){return new O(r.name,oc(r.type),r.nullable,ko(r.metadata))}function sc(r){switch(r.constructor){case ut:return"null";case ce:return"binary";case kt:return"bool";case st:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case Ge:return"int8";case $e:return"int16";case It:return"int32";case pe:return"int64";case He:return"uint8";case Ye:return"uint16";case Ke:return"uint32";case Ze:return"uint64";case At:switch(r.precision){case z.HALF:return"float16";case z.SINGLE:return"float32";case z.DOUBLE:return"float64";default:return"float16"}case Br:return"float16";case me:return"float32";case ye:return"float64";case Pt:return"utf8";case le:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case Xt:return r.unit===rt.DAY?"date-day":"date-millisecond";case Pr:return"date-day";case cr:return"date-millisecond";case xt:switch(r.unit){case m.SECOND:return"time-second";case m.MILLISECOND:return"time-millisecond";case m.MICROSECOND:return"time-microsecond";case m.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 m.SECOND:return"timestamp-second";case m.MILLISECOND:return"timestamp-millisecond";case m.MICROSECOND:return"timestamp-microsecond";case m.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 Qt:switch(r.unit){case it.DAY_TIME:return"interval-daytime";case it.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(p=>fn(p))};case Tt:let u=r.valueField;return{type:"list",children:[fn(u)]};case Vt:let h=r;return{type:"fixed-size-list",listSize:h.listSize,children:[fn(h.children[0])]};case V:return{type:"struct",children:r.children.map(p=>fn(p))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function oc(r){if(typeof r=="object")switch(r.type){case"decimal":return new le(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>hn(i));return new jt(t,r.keysSorted);case"list":let e=hn(r.children[0]);return new Tt(e);case"fixed-size-list":let n=hn(r.children[0]);return new Vt(r.listSize,n);case"struct":return t=r.children.map(i=>hn(i)),new V(t);default:throw new Error("array type not supported")}switch(r){case"null":return new ut;case"binary":return new ce;case"bool":return new kt;case"int8":return new Ge;case"int16":return new $e;case"int32":return new It;case"int64":return new pe;case"uint8":return new He;case"uint16":return new Ye;case"uint32":return new Ke;case"uint64":return new Ze;case"float16":return new Br;case"float32":return new me;case"float64":return new ye;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")}}var Vo="4.3.1";var ku=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Vu=new RegExp("^"+ku.source+"(\\s"+ku.source+"){1,}"),ac=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("];function ju(r){return ac.some(t=>r.startsWith(t))}function cc(r,t){return Vp(r,t)}function Vp(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),o=zu({parts:e,_:n,i:0});return t?.wkt?.crs?jp(o,i):o}function zu(r){return zp(r)||Gp(r)||Hp(r)||Wp(r)||$p(r)||Yp(r)||Kp(r)}function jp(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 zp(r){if(!ht(/^(POINT(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Wu(r);return!t||(Wt(r),!ht(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function Wp(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=jo(r);return e?(Wt(r),{type:"MultiPoint",coordinates:e}):null}function Gp(r){if(!ht(/^(LINESTRING(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Wu(r);return!t||!ht(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function $p(r){if(!ht(/^(MULTILINESTRING)/i,r))return null;Wt(r);let t=jo(r);return t?(Wt(r),{type:"MultiLineString",coordinates:t}):null}function Hp(r){if(!ht(/^(POLYGON(\sz)?)/i,r))return null;Wt(r);let t=jo(r);return t?{type:"Polygon",coordinates:t}:null}function Yp(r){if(!ht(/^(MULTIPOLYGON)/i,r))return null;Wt(r);let t=jo(r);return t?{type:"MultiPolygon",coordinates:t}:null}function Kp(r){let t=[],e;if(!ht(/^(GEOMETRYCOLLECTION)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;for(;e=zu(r);)t.push(e),Wt(r),ht(/^(,)/,r),Wt(r);return ht(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function jo(r){Wt(r);let t=0,e=[],n=[e],i=e,s;for(;s=ht(/^(\()/,r)||ht(/^(\))/,r)||ht(/^(,)/,r)||ht(Vu,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 Wu(r){let t=[],e,n;for(;n=ht(Vu,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 Gu={dataType:null,batchType:null,name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:Vo,worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,tests:ac,testText:ju,options:{wkt:{shape:"geojson-geometry",crs:!0}}},lc={...Gu,parse:async(r,t)=>cc(new TextDecoder().decode(r),t),parseTextSync:(r,t)=>cc(r,t)};var _r;(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"})(_r||(_r={}));function $u(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 Hu(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 uc(r,t){let e=Zp(r,t),n=t?.wkb?.shape||"binary-geometry";switch(n){case"binary-geometry":return e;case"geojson-geometry":return $n(e);case"geometry":return console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead'),$n(e);default:throw new Error(n)}}function Zp(r,t){let e=new DataView(r),n=Hu(e),{geometryType:i,dimensions:s,littleEndian:o}=n,a=n.byteOffset;switch(i){case _r.Point:return Yu(e,a,s,o).geometry;case _r.LineString:return fc(e,a,s,o).geometry;case _r.Polygon:return Ku(e,a,s,o).geometry;case _r.MultiPoint:let h=Jp(e,a,s,o);return h.type="Point",h;case _r.MultiLineString:let d=Xp(e,a,s,o);return d.type="LineString",d;case _r.MultiPolygon:let p=Qp(e,a,s,o);return p.type="Polygon",p;default:throw new Error(`WKB: Unsupported geometry type: ${i}`)}}function Yu(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 fc(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 hc=r=>t=>r+=t;function Ku(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let l=0;l<i;l++){let u=fc(r,t,e,n),{positions:h}=u.geometry;t=u.offset,s.push(h.value)}let o=new Float64Array(zo(s).buffer),a=[0];o.length>0&&a.push(o.length/e);let c=s.map(l=>l.length/e).map(hc(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 Jp(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=Yu(r,t,e,a);t=c.offset,s.push(c.geometry)}return qp(s,e)}function Xp(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=fc(r,t,e,a);t=c.offset,s.push(c.geometry)}return tm(s,e)}function Qp(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=Ku(r,t,e,a);t=c.offset,s.push(c.geometry)}return em(s,e)}function qp(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(zo(e).buffer),size:t}}}function tm(r,t){let e=r.map(s=>s.positions.value),n=new Float64Array(zo(e).buffer),i=e.map(s=>s.length/t).map(hc(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function em(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(zo(e).buffer),s=e.map(a=>a.length/t).map(hc(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 zo(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 Zu={dataType:null,batchType:null,name:"WKB",id:"wkb",module:"wkt",version:Vo,worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],tests:[$u],options:{wkb:{shape:"binary-geometry"}}},dc={...Zu,parse:async r=>uc(r),parseSync:uc};function Wo(r,t){if(t=t?.toLowerCase(),!t||!r)return null;let e;switch(t){case"geoarrow.multipolygon":e=im(r);break;case"geoarrow.polygon":e=sm(r);break;case"geoarrow.multipoint":e=om(r);break;case"geoarrow.point":e=am(r);break;case"geoarrow.multilinestring":e=cm(r);break;case"geoarrow.linestring":e=lm(r);break;case"geoarrow.wkb":e=rm(r);break;case"geoarrow.wkt":e=nm(r);break;default:throw Error(`GeoArrow encoding not supported ${t}`)}return e}function rm(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),e=dc.parseSync?.(t);return $n(e)}function nm(r){let t=r;return lc.parseTextSync?.(t)}function im(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 sm(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 om(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 am(r){return{type:"Point",coordinates:Array.from(r)}}function cm(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 lm(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 Yn(r,t){switch(t){case"arrow-table":return um(r);case"array-row-table":return fm(r);case"object-row-table":return hm(r);case"columnar-table":return pc(r);case"geojson-table":return dm(r);default:throw new Error(t)}}function um(r){return{shape:"arrow-table",schema:Hn(r.schema),data:r}}function fm(r){let t=pc(r);return ls(t,"array-row-table")}function hm(r){let t=pc(r);return ls(t,"object-row-table")}function pc(r){let t={};for(let n of r.schema.fields){let s=r.getChild(n.name)?.toArray();t[n.name]=s}return{shape:"columnar-table",schema:Hn(r.schema),data:t}}function dm(r){let t=Hn(r.schema),e=ec(t),n=e.geometry.encoding,i=[],s=r.schema.fields.map(c=>c.name).filter(c=>!(c in e)),o=r.select(s),a=r.getChild("geometry");for(let c=0;c<r.numRows;c++){let l=a?.get(c),u=Wo(l,n);if(u){let h=o.get(c)?.toJSON()||{};i.push({type:"Feature",geometry:u,properties:h})}}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:i}}function Zi(r,t){let e=t?.shape||"arrow-table",n=zi([new Uint8Array(r)]);return Yn(n,e)}function Go(r,t){async function*e(){let n=gt.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 K([s]),length:s.data.length};break}}return e()}var Ju={...Wn,parse:async(r,t)=>Zi(r,t?.arrow),parseSync:(r,t)=>Zi(r,t?.arrow),parseInBatches:Go};function mc(r){let t={};for(let i of r){let s=pm(i.array,i.type);t[i.name]=s}let e=new K(t);return Mo(e)}function pm(r,t){switch(t){case Ur.DATE:return Pi(r);case Ur.FLOAT:default:return Pi(r)}}var mm="4.3.1",Xu={name:"Apache Arrow",id:"arrow",module:"arrow",version:mm,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 mc(t)},encodeSync(r,t){return mc(r)}};var $o={...Wn,options:{arrow:{shape:"arrow-table"}}};function yc(r,t){let e=Zi(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return Yn(e.data,"geojson-table");default:return e}}function Qu(r){return Go(r)}var qu={...$o,parse:async(r,t)=>yc(r,t?.arrow),parseSync:(r,t)=>yc(r,t?.arrow),parseInBatches:Qu};function tf(r,t){switch(r.shape){case"arrow-table":return r.data;case"columnar-table":default:let e=ym(r,t);return new K(e)}}function*ym(r,t){let e=Ki(r.schema),n=xr(r),i=Jo(r),s=t?.batchSize||n,o=e?.fields.map(l=>Me(l)),a=new V(e.fields),c=0;for(let l=0;l<n;l++)for(let u=0;u<i;++u){let h=Qo(r,l,u);if(o[u].append(h),c++,c>=s){let p=o.map(k=>k.flush()),v=new U(a,0,c,0,void 0,p);yield new W(e,v),c=0}}if(c>0){let l=o.map(h=>h.flush()),u=new U(a,0,c,0,void 0,l);yield new W(e,u),c=0}o.map(l=>l.finish())}function Ho(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 Kn;(function(r){r.points="points",r.lines="lines",r.polygons="polygons"})(Kn||(Kn={}));function Ji(){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 ef(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:p}=bm(c,t,e),v=new Uint32Array(l.length);for(let Z=0;Z<l.length;Z++)v[Z]=l[Z]+o;let k={globalFeatureIds:{value:v,size:1},positions:{value:u,size:h},featureIds:{value:l,size:1},properties:[...Array(c.length).keys()].map(Z=>({index:Z+o}))};o+=c.length,a.push({shape:"binary-feature-collection",points:{type:"Point",...Ji(),...n.point?k:{}},lines:{type:"LineString",...Ji(),...n.line?k:{},pathIndices:{value:n.line?d:new Uint16Array(0),size:1}},polygons:{type:"Polygon",...Ji(),...n.polygon?k:{},polygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},primitivePolygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},...p?{triangles:{value:p,size:1}}:{}}}),s=Ho(u,h,s)}),{binaryGeometries:a,bounds:s,featureTypes:n,...e?.calculateMeanCenters?{meanCenters:gc(a)}:{}}}function gc(r){let t=[];return r.forEach(e=>{let n=null;e.points&&e.points.positions.value.length>0?n=Kn.points:e.lines&&e.lines.positions.value.length>0?n=Kn.lines:e.polygons&&e.polygons.positions.value.length>0&&(n=Kn.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;gm(s,o,a,n,c).forEach(u=>{t.push(u)})}}),t}function gm(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===Kn.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 bm(r,t,e){switch(t){case"geoarrow.point":case"geoarrow.multipoint":return vm(r,t);case"geoarrow.linestring":case"geoarrow.multilinestring":return _m(r,t);case"geoarrow.polygon":case"geoarrow.multipolygon":return wm(r,t,e);default:throw Error("invalid geoarrow encoding")}}function bc(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 p=0;p<d.length;p++)s.push(d[p]+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 wm(r,t,e){let n=t==="geoarrow.multipolygon",i=n?r.children[0]:r,s=i.valueOffsets,o=n?r.valueOffsets.map(et=>s.at(et)||et):r.valueOffsets,a=i.children[0],c=a.children[0],l=c.children[0],u=c.stride,h=a.valueOffsets,d=l.values,p=new Uint16Array(s.length);for(let et=0;et<s.length;et++)p[et]=h[s[et]];let v=d.length/u,k=new Uint32Array(v);for(let et=0;et<o.length-1;et++){let pn=h[o[et]],G=h[o[et+1]];for(let j=pn;j<G;j++)k[j]=et}let Z=e?.triangulate?bc(p,h,d,u):null;return{featureIds:k,nDim:u,flatCoordinateArray:d,geomOffset:h,geometryIndicies:p,...e?.triangulate&&Z?{triangles:Z}:{}}}function _m(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 p=0;p<d.length-1;p++){let v=a[d[p]],k=a[d[p+1]];for(let Z=v;Z<k;Z++)h[Z]=p}}else for(let d=0;d<r.length;d++){let p=a[d],v=a[d+1];for(let k=p;k<v;k++)h[k]=d}return{featureIds:h,flatCoordinateArray:c,nDim:o,geomOffset:a,geometryIndicies:l}}function vm(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 p=h[d],v=h[d+1];for(let k=p;k<v;k++)u[k]=d}}else for(let h=0;h<r.length;h++)u[h]=h;return{featureIds:u,flatCoordinateArray:o,nDim:s,geomOffset:c,geometryIndicies:a}}function Xi(r,t=!1){if("data"in r)return new b(r.data.map(s=>Xi(s,t)));let e=[];for(let s of r.children)e.push(Xi(s,t));let n;r.dictionary!==void 0&&(n=Xi(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 U(r.type,r.offset,r.length,r._nullCount,i,e,n)}function Im(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function Yo(r,t){return r===void 0||!t&&!Im(r)?r:r.slice()}var rf="latest";function xm(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.1"),globalThis._loadersgl_.version}var wc=xm();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},lA=or.self||or.window||or.global||{},uA=or.window||or.self||or.global||{},fA=or.global||or.self||or.window||{},hA=or.document||{};var vr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var sf=typeof window<"u"&&typeof window.orientation<"u",nf=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),dA=nf&&parseFloat(nf[1])||0;var Qi=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 Zn=class{terminate(){}};var _c=new Map;function of(r){sr(r.source&&!r.url||!r.source&&r.url);let t=_c.get(r.source||r.url);return t||(r.url&&(t=Sm(r.url),_c.set(r.url,t)),r.source&&(t=af(r.source),_c.set(r.source,t))),sr(t),t}function Sm(r){if(!r.startsWith("http"))return r;let t=Bm(r);return af(t)}function af(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function Bm(r){return`try {
16
+ ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new $(e,n.map(i=>new G(e,i)))}slice(t,e){let n=this.schema;[t,e]=Qn({length:this.numRows},t,e);let i=Is(this.data,this._offsets,t,e);return new $(n,i.map(s=>new G(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=b({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new y(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let 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]=Xs(n,a)}return new $(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 $(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[d,f]=a,V=e.findIndex(N=>N.name===c.name);return~V?f[V]=l:d.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 $(...Xs(s,o))}};hl=Symbol.toStringTag;$[hl]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=vn(ri),r.get=vn(ct.getVisitFn(u.Struct)),r.set=Ss(_t.getVisitFn(u.Struct)),r.indexOf=xs(Kr.getVisitFn(u.Struct)),"Table"))($.prototype);var ml,G=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=b({nullCount:0,type:new k(this.schema.fields),children:this.schema.fields.map(e=>b({type:e.type,nullCount:0}))})]=t,!(this.data instanceof M))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=pl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((c,l,d)=>(c.children[d]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[d]=O.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new U(n),a=b({type:new k(n),length:s,children:i,nullCount:0});[this.schema,this.data]=pl(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=yl(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return ct.visit(this.data,t)}at(t){return this.get(Gr(t,this.numRows))}set(t,e){return _t.visit(this.data,t,e)}indexOf(t,e){return Kr.visit(this.data,t,e)}[Symbol.iterator](){return In.visit(new y([this.data]))}toArray(){return[...this]}concat(...t){return new $(this.schema,[this,...t])}slice(t,e){let[n]=new y([this.data]).slice(t,e).data;return new G(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new y([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let 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 U(s,new Map(this.schema.metadata)),i=b({type:new k(s),children:o})}return new G(n,i)}select(t){let e=this.schema.select(t),n=new k(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 G(e,b({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=b({type:new k(e.fields),length:this.numRows,children:n});return new G(e,i)}};ml=Symbol.toStringTag;G[ml]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(G.prototype);function pl(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:b({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),b({type:new k(i),length:e,children:s})]}function yl(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)||[]])yl(a.children,l?.children,e);if(p.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var nn=class extends G{constructor(t){let e=t.fields.map(i=>b({type:i.type})),n=b({type:new k(t.fields),nullCount:0,children:e});super(t,n)}};var it=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new it).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):R.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,R.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return it.startMessage(t),it.addVersion(t,e),it.addHeaderType(t,n),it.addHeader(t,i),it.addBodyLength(t,s),it.addCustomMetadata(t,o),it.endMessage(t)}};var ca=class extends w{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ne.startNull(e),Ne.endNull(e)}visitInt(t,e){return ht.startInt(e),ht.addBitWidth(e,t.bitWidth),ht.addIsSigned(e,t.isSigned),ht.endInt(e)}visitFloat(t,e){return zt.startFloatingPoint(e),zt.addPrecision(e,t.precision),zt.endFloatingPoint(e)}visitBinary(t,e){return De.startBinary(e),De.endBinary(e)}visitLargeBinary(t,e){return Fe.startLargeBinary(e),Fe.endLargeBinary(e)}visitBool(t,e){return Oe.startBool(e),Oe.endBool(e)}visitUtf8(t,e){return Ee.startUtf8(e),Ee.endUtf8(e)}visitLargeUtf8(t,e){return Me.startLargeUtf8(e),Me.endLargeUtf8(e)}visitDecimal(t,e){return pt.startDecimal(e),pt.addScale(e,t.scale),pt.addPrecision(e,t.precision),pt.addBitWidth(e,t.bitWidth),pt.endDecimal(e)}visitDate(t,e){return kt.startDate(e),kt.addUnit(e,t.unit),kt.endDate(e)}visitTime(t,e){return St.startTime(e),St.addUnit(e,t.unit),St.addBitWidth(e,t.bitWidth),St.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return xt.startTimestamp(e),xt.addUnit(e,t.unit),n!==void 0&&xt.addTimezone(e,n),xt.endTimestamp(e)}visitInterval(t,e){return Wt.startInterval(e),Wt.addUnit(e,t.unit),Wt.endInterval(e)}visitDuration(t,e){return Pt.startDuration(e),Pt.addUnit(e,t.unit),Pt.endDuration(e)}visitList(t,e){return Le.startList(e),Le.endList(e)}visitStruct(t,e){return Ue.startStruct_(e),Ue.endStruct_(e)}visitUnion(t,e){mt.startTypeIdsVector(e,t.typeIds.length);let n=mt.createTypeIdsVector(e,t.typeIds);return mt.startUnion(e),mt.addMode(e,t.mode),mt.addTypeIds(e,n),mt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ee.startDictionaryEncoding(e),ee.addId(e,BigInt(t.id)),ee.addIsOrdered(e,t.isOrdered),n!==void 0&&ee.addIndexType(e,n),ee.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(e),Vt.addByteWidth(e,t.byteWidth),Vt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return jt.startFixedSizeList(e),jt.addListSize(e,t.listSize),jt.endFixedSizeList(e)}visitMap(t,e){return Gt.startMap(e),Gt.addKeysSorted(e,t.keysSorted),Gt.endMap(e)}},qs=new ca;function _l(r,t=new Map){return new U(Df(r,t),Qs(r.metadata),t)}function la(r){return new vt(r.count,Il(r.columns),Sl(r.columns))}function vl(r){return new Xt(la(r.data),r.id,r.isDelta)}function Df(r,t){return(r.fields||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function gl(r,t){return(r.children||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function Il(r){return(r||[]).reduce((t,e)=>[...t,new fe(e.count,Of(e.VALIDITY)),...Il(e.children)],[])}function Sl(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Zt(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Zt(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Zt(t.length,i.OFFSET.length)),i.DATA&&t.push(new Zt(t.length,i.DATA.length)),t=Sl(i.children,t)}return t}function Of(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function xl(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=wl(r,gl(r,t)),i=new O(r.name,o,r.nullable,Qs(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?bl(n):new yt,a=new Tt(t.get(e),n,e,s.isOrdered),i=new O(r.name,a,r.nullable,Qs(r.metadata))):(n=(n=s.indexType)?bl(n):new yt,t.set(e,o=wl(r,gl(r,t))),a=new Tt(o,n,e,s.isOrdered),i=new O(r.name,a,r.nullable,Qs(r.metadata))),i||null}function Qs(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function bl(r){return new et(r.isSigned,r.bitWidth)}function wl(r,t){let e=r.type.name;switch(e){case"NONE":return new nt;case"null":return new nt;case"binary":return new re;case"largebinary":return new We;case"utf8":return new Lt;case"largeutf8":return new Ge;case"bool":return new Nt;case"list":return new wt((t||[])[0]);case"struct":return new k(t||[]);case"struct_":return new k(t||[])}switch(e){case"int":{let n=r.type;return new et(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Mt(P[n.precision])}case"decimal":{let n=r.type;return new ne(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new $t(J[n.unit])}case"time":{let n=r.type;return new Bt(h[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new At(h[n.unit],n.timezone)}case"interval":{let n=r.type;return new Yt(Q[n.unit])}case"duration":{let n=r.type;return new $e(h[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new ue(Y[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Ye(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ut(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Et((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ff=tr,Mf=Ft,ut=class{static fromJSON(t,e){let n=new ut(0,z.V5,e);return n._createHeader=Lf(t,e),n}static decode(t){t=new Mf(B(t));let e=it.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new ut(n,i,s);return o._createHeader=Nf(e,s),o}static encode(t){let e=new Ff,n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=vt.encode(e,t.header()):t.isDictionaryBatch()&&(n=Xt.encode(e,t.header())),it.startMessage(e),it.addVersion(e,z.V5),it.addHeader(e,n),it.addHeaderType(e,t.headerType),it.addBodyLength(e,BigInt(t.bodyLength)),it.finishMessageBuffer(e,it.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new ut(0,z.V5,R.Schema,t);if(t instanceof vt)return new ut(e,z.V5,R.RecordBatch,t);if(t instanceof Xt)return new ut(e,z.V5,R.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=C(t)}},vt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=C(t)}},Xt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=C(e)}},Zt=class{constructor(t,e){this.offset=C(t),this.length=C(e)}},fe=class{constructor(t,e){this.length=C(t),this.nullCount=C(e)}};function Lf(r,t){return()=>{switch(t){case R.Schema:return U.fromJSON(r);case R.RecordBatch:return vt.fromJSON(r);case R.DictionaryBatch:return Xt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function Nf(r,t){return()=>{switch(t){case R.Schema:return U.decode(r.header(new tt),new Map,r.version());case R.RecordBatch:return vt.decode(r.header(new It),r.version());case R.DictionaryBatch:return Xt.decode(r.header(new ae),r.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}O.encode=Gf;O.decode=zf;O.fromJSON=xl;U.encode=Wf;U.decode=Uf;U.fromJSON=_l;vt.encode=$f;vt.decode=Ef;vt.fromJSON=la;Xt.encode=Yf;Xt.decode=Rf;Xt.fromJSON=vl;fe.encode=Hf;fe.decode=kf;Zt.encode=Jf;Zt.decode=Cf;function Uf(r,t=new Map,e=z.V5){let n=jf(r,t);return new U(n,to(r),t,e)}function Ef(r,t=z.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new vt(r.length(),Pf(r),Vf(r,t))}function Rf(r,t=z.V5){return new Xt(vt.decode(r.data(),t),r.id(),r.isDelta())}function Cf(r){return new Zt(r.offset(),r.length())}function kf(r){return new fe(r.length(),r.nullCount())}function Pf(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=fe.decode(e));return t}function Vf(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<z.V4&&(n.bb_pos+=8*(i+1)),e[++s]=Zt.decode(n));return e}function jf(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=O.decode(n,t));return e}function Bl(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=O.decode(n,t));return e}function zf(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=Tl(r,Bl(r,t)),n=new O(r.name(),i,r.nullable(),to(r))):t.has(e=C(a.id()))?(s=(s=a.indexType())?Al(s):new yt,o=new Tt(t.get(e),s,e,a.isOrdered()),n=new O(r.name(),o,r.nullable(),to(r))):(s=(s=a.indexType())?Al(s):new yt,t.set(e,i=Tl(r,Bl(r,t))),o=new Tt(i,s,e,a.isOrdered()),n=new O(r.name(),o,r.nullable(),to(r))),n||null}function to(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 Al(r){return new et(r.isSigned(),r.bitWidth())}function Tl(r,t){let e=r.typeType();switch(e){case H.NONE:return new nt;case H.Null:return new nt;case H.Binary:return new re;case H.LargeBinary:return new We;case H.Utf8:return new Lt;case H.LargeUtf8:return new Ge;case H.Bool:return new Nt;case H.List:return new wt((t||[])[0]);case H.Struct_:return new k(t||[])}switch(e){case H.Int:{let n=r.type(new ht);return new et(n.isSigned(),n.bitWidth())}case H.FloatingPoint:{let n=r.type(new zt);return new Mt(n.precision())}case H.Decimal:{let n=r.type(new pt);return new ne(n.scale(),n.precision(),n.bitWidth())}case H.Date:{let n=r.type(new kt);return new $t(n.unit())}case H.Time:{let n=r.type(new St);return new Bt(n.unit(),n.bitWidth())}case H.Timestamp:{let n=r.type(new xt);return new At(n.unit(),n.timezone())}case H.Interval:{let n=r.type(new Wt);return new Yt(n.unit())}case H.Duration:{let n=r.type(new Pt);return new $e(n.unit())}case H.Union:{let n=r.type(new mt);return new ue(n.mode(),n.typeIdsArray()||[],t||[])}case H.FixedSizeBinary:{let n=r.type(new Vt);return new Ye(n.byteWidth())}case H.FixedSizeList:{let n=r.type(new jt);return new Ut(n.listSize(),(t||[])[0])}case H.Map:{let n=r.type(new Gt);return new Et((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${H[e]}" (${e})`)}function Wf(r,t){let e=t.fields.map(s=>O.encode(r,s));tt.startFieldsVector(r,e.length);let n=tt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?tt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return K.startKeyValue(r),K.addKey(r,a),K.addValue(r,c),K.endKeyValue(r)})):-1;return tt.startSchema(r),tt.addFields(r,n),tt.addEndianness(r,Kf?wr.Little:wr.Big),i!==-1&&tt.addCustomMetadata(r,i),tt.endSchema(r)}function Gf(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;p.isDictionary(s)?(o=s.dictionary.typeId,i=qs.visit(s,r),n=qs.visit(s.dictionary,r)):n=qs.visit(s,r);let a=(s.children||[]).map(d=>O.encode(r,d)),c=at.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?at.createCustomMetadataVector(r,[...t.metadata].map(([d,f])=>{let V=r.createString(`${d}`),N=r.createString(`${f}`);return K.startKeyValue(r),K.addKey(r,V),K.addValue(r,N),K.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,o),at.addChildren(r,c),at.addNullable(r,!!t.nullable),e!==-1&&at.addName(r,e),i!==-1&&at.addDictionary(r,i),l!==-1&&at.addCustomMetadata(r,l),at.endField(r)}function $f(r,t){let e=t.nodes||[],n=t.buffers||[];It.startNodesVector(r,e.length);for(let o of e.slice().reverse())fe.encode(r,o);let i=r.endVector();It.startBuffersVector(r,n.length);for(let o of n.slice().reverse())Zt.encode(r,o);let s=r.endVector();return It.startRecordBatch(r),It.addLength(r,BigInt(t.length)),It.addNodes(r,i),It.addBuffers(r,s),It.endRecordBatch(r)}function Yf(r,t){let e=vt.encode(r,t.data);return ae.startDictionaryBatch(r),ae.addId(r,BigInt(t.id)),ae.addIsDelta(r,t.isDelta),ae.addData(r,e),ae.endDictionaryBatch(r)}function Hf(r,t){return fn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Jf(r,t){return dn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var Kf=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var da=r=>`Expected ${R[r]} Message in stream, but was null or length 0.`,fa=r=>`Header pointer of flatbuffer-encoded ${R[r]} Message is null or length 0.`,Dl=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Ol=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Ln=class{constructor(t){this.source=t instanceof Ke?t:new Ke(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Z:t.value===-1&&(t=this.readMetadataLength()).done?Z:(t=this.readMetadata(t.value)).done?Z:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(da(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=B(this.source.read(t));if(e.byteLength<t)throw new Error(Ol(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=R.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(fa(e));return i}readMetadataLength(){let t=this.source.read(eo),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Dl(t,e.byteLength));return{done:!1,value:ut.decode(e)}}},Mi=class{constructor(t,e){this.source=t instanceof Jt?t:Gi(t)?new Br(t,e):new Jt(t)}[Symbol.asyncIterator](){return this}next(){return m(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Z:t.value===-1&&(t=yield this.readMetadataLength()).done?Z:(t=yield this.readMetadata(t.value)).done?Z:t})}throw(t){return m(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return m(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return m(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(da(t));return e.value})}readMessageBody(t){return m(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=B(yield this.source.read(t));if(e.byteLength<t)throw new Error(Ol(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return m(this,arguments,void 0,function*(t=!1){let e=R.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(fa(e));return i})}readMetadataLength(){return m(this,void 0,void 0,function*(){let t=yield this.source.read(eo),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return m(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Dl(t,e.byteLength));return{done:!1,value:ut.decode(e)}})}},Li=class extends Ln{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ni?t:new ni(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ut.fromJSON(t.schema,R.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ut.fromJSON(e,R.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ut.fromJSON(e,R.RecordBatch)}}return this._body=[],Z}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,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(da(t));return e.value}readSchema(){let t=R.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(fa(t));return n}},eo=4,ua="ARROW1",Nn=new Uint8Array(ua.length);for(let r=0;r<ua.length;r+=1)Nn[r]=ua.codePointAt(r);function ro(r,t=0){for(let e=-1,n=Nn.length;++e<n;)if(Nn[e]!==r[t+e])return!1;return!0}var Un=Nn.length,ha=Un+eo,Fl=Un*2+eo;var dt=class extends Xr{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Qt(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return bt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof dt?t:zi(t)?Xf(t):Gi(t)?th(t):Qt(t)?(()=>m(this,void 0,void 0,function*(){return yield dt.from(yield t)}))():$i(t)||$n(t)||Hi(t)||se(t)?Qf(new Jt(t)):qf(new Ke(t))}static readAll(t){return t instanceof dt?t.isSync()?Ml(t):Ll(t):zi(t)||ArrayBuffer.isView(t)||pe(t)||Wi(t)?Ml(t):Ll(t)}},Xe=class extends dt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return qt(this,arguments,function*(){yield L(yield*ln(he(this[Symbol.iterator]())))})}},Ar=class extends dt{constructor(t){super(t),this._impl=t}readAll(){return m(this,void 0,void 0,function*(){var t,e,n,i;let s=new Array;try{for(var o=!0,a=he(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]()}},Tr=class extends Xe{constructor(t){super(t),this._impl=t}},Ni=class extends Ar{constructor(t){super(t),this._impl=t}},no=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=b({type:new k(this.schema.fields),length:t.length,children:n});return new G(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n),c=o.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new y(l)):new y(l)).memoize()}_loadVectors(t,e,n){return new oi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},En=class extends no{constructor(t,e){super(e),this._reader=zi(t)?new Li(this._handle=t):new Ln(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Nl(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Z}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Z}next(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Rn=class extends no{constructor(t,e){super(e),this._reader=new Mi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return m(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return m(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Nl(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Z})}return(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Z})}next(){return m(this,void 0,void 0,function*(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},io=class extends En{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof ii?t:new ii(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let 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(R.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-ha,n=t.readInt32(e),i=t.readAt(e-n,n);return ir.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},pa=class extends Rn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Br?t:new Br(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return m(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return m(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return m(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return m(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ha,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return ir.decode(i)})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},ma=class extends En{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Ts(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Nl(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Ml(r){let t=dt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Ll(r){return qt(this,arguments,function*(){let e=yield L(dt.from(r));try{if(!(yield L(e.open({autoDestroy:!1}))).closed)do yield yield L(e);while(!(yield L(e.reset().open())).closed)}finally{yield L(e.cancel())}})}function Xf(r){return new Xe(new ma(r))}function qf(r){let t=r.peek(Un+7&-8);return t&&t.byteLength>=4?ro(t)?new Tr(new io(r.read())):new Xe(new En(r)):new Xe(new En(function*(){}()))}function Qf(r){return m(this,void 0,void 0,function*(){let t=yield r.peek(Un+7&-8);return t&&t.byteLength>=4?ro(t)?new Tr(new io(yield r.read())):new Ar(new Rn(r)):new Ar(new Rn(function(){return qt(this,arguments,function*(){})}()))})}function th(r){return m(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Br(r,t);return t>=Fl&&ro(yield e.readAt(0,Un+7&-8))?new Ni(new pa(e)):new Ar(new Rn(e))})}var X=class extends w{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof G?s.data.children:s.data),n=new X;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof y)return this.visitMany(t.data),this;let{type:e}=t;if(!p.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(p.isUnion(e))this.nodes.push(new fe(n,0));else{let{nullCount:i}=t;p.isNull(e)||xe.call(this,i<=0?new Uint8Array(0):Yr(t.offset,n,t.nullBitmap)),this.nodes.push(new fe(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function xe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Zt(this._byteLength,t)),this._byteLength+=t,this}function eh(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(xe.call(this,i),e.mode===Y.Sparse)return ya.call(this,r);if(e.mode===Y.Dense){if(r.offset<=0)return xe.call(this,s),ya.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,d,f=-1;++f<n;)(l=i[f])!==void 0&&((d=a[l])===void 0&&(d=a[l]=s[f]),o[f]=s[f]-d,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);xe.call(this,o),this.visitMany(r.children.map((l,d)=>{let f=e.typeIds[d],V=a[f],N=c[f];return l.slice(V,Math.min(n,N))}))}}return this}function rh(r){let t;return r.nullCount>=r.length?xe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?xe.call(this,Yr(r.offset,r.length,t)):xe.call(this,Hr(r.values))}function ur(r){return xe.call(this,r.values.subarray(0,r.length*r.stride))}function so(r){let{length:t,values:e,valueOffsets:n}=r,i=C(n[0]),s=C(n[t]),o=Math.min(s-i,e.byteLength-i);return xe.call(this,Ki(-i,t+1,n)),xe.call(this,e.subarray(i,i+o)),this}function ga(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return xe.call(this,Ki(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function ya(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}X.prototype.visitBool=rh;X.prototype.visitInt=ur;X.prototype.visitFloat=ur;X.prototype.visitUtf8=so;X.prototype.visitLargeUtf8=so;X.prototype.visitBinary=so;X.prototype.visitLargeBinary=so;X.prototype.visitFixedSizeBinary=ur;X.prototype.visitDate=ur;X.prototype.visitTimestamp=ur;X.prototype.visitTime=ur;X.prototype.visitDecimal=ur;X.prototype.visitList=ga;X.prototype.visitStruct=ya;X.prototype.visitUnion=eh;X.prototype.visitInterval=ur;X.prototype.visitDuration=ur;X.prototype.visitFixedSizeList=ga;X.prototype.visitMap=ga;var sn=class extends Xr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Je,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Ot(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Qt(t)?t.then(e=>this.writeAll(e)):se(t)?wa(this,t):ba(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Je?this._sink=t:(this._sink=new Je,t&&Ka(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Za(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!rn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof $&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof G&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!rn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof G?t instanceof nn||this._writeRecordBatch(t):t instanceof $?this.writeAll(t.batches):pe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ut.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new Ie(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new Ie(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=B(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ut.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Nn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=X.assemble(t),o=new vt(t.numRows,n,i),a=ut.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=X.assemble(new y([t])),c=new vt(t.length,s,o),l=new Xt(c,e,n),d=ut.from(l,i);return this._writeMessage(d)._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){var e,n;for(let[i,s]of t.dictionaries){let o=(e=s?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(let[l,d]of o.entries())this._writeDictionaryBatch(d,i,l>0);else if(c<o.length)for(let l of o.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,o.length)}return this}},dr=class extends sn{static writeAll(t,e){let n=new dr(e);return Qt(t)?t.then(i=>n.writeAll(i)):se(t)?wa(n,t):ba(n,t)}},fr=class extends sn{static writeAll(t){let e=new fr;return Qt(t)?t.then(n=>e.writeAll(n)):se(t)?wa(e,t):ba(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=ir.encode(new ir(t,z.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function ba(r,t){let e=t;t instanceof $&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function wa(r,t){return m(this,void 0,void 0,function*(){var e,n,i,s,o,a,c;try{for(e=!0,n=he(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 Ul(r,t){if(se(r))return ih(r,t);if(pe(r))return nh(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function nh(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,d=o.desiredSize||null;for(;!(l=a.next(n?d:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(d!=null&&n&&(d=d-c.byteLength+1),l.value=c),o.enqueue(l.value),d!=null&&--d<=0)return;o.close()}}function ih(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 m(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return m(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return m(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return m(this,void 0,void 0,function*(){let c,l=null,d=o.desiredSize||null;for(;!(l=yield a.next(n?d:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(d!=null&&n&&(d=d-c.byteLength+1),l.value=c),o.enqueue(l.value),d!=null&&--d<=0)return;o.close()})}}function Cl(r){return new _a(r)}var _a=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Ha(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Se(s),this._getSize=i!=="bytes"?El:Rl;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"?El:Rl}),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)}},El=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Rl=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function oo(r,t){let e=new Je,n=null,i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield e.close()})},start(a){return m(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return m(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 m(this,void 0,void 0,function*(){return yield(yield dt.from(e)).open(t)})}function o(a,c){return m(this,void 0,void 0,function*(){let l=a.desiredSize,d=null;for(;!(d=yield c.next()).done;)if(a.enqueue(d.value),l!=null&&--l<=0)return;a.close()})}}function ao(r,t){let e=new this(r),n=new Jt(e),i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return m(this,void 0,void 0,function*(){yield s(o)})},start(o){return m(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 m(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 Ui(r){let t=dt.from(r);return Qt(t)?t.then(e=>Ui(e)):t.isAsync()?t.readAll().then(e=>new $(e)):new $(t.readAll())}function co(r,t="stream"){return(t==="stream"?dr:fr).writeAll(r).toUint8Array(!0)}var mh=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Lo),ra),Jo),No),Bo),Ho),Do),{compareSchemas:rn,compareFields:fl,compareTypes:Ks});bt.toDOMStream=Ul;q.throughDOM=Cl;dt.throughDOM=oo;Tr.throughDOM=oo;Xe.throughDOM=oo;sn.throughDOM=ao;fr.throughDOM=ao;dr.throughDOM=ao;function lo(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function kl(r){let t=yh(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=lo(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function yh(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 Pl(r,t){if(!t)switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:break}return Array}function hr(r){return Vl(r)}function uo(r){return jl(r)}function Vl(r){return{fields:r.fields.map(t=>kn(t)),metadata:va(r.metadata)}}function jl(r){return new U(r.fields.map(t=>Pn(t)),Ia(r.metadata))}function va(r){return Object.fromEntries(r)}function Ia(r){return r?new Map(Object.entries(r)):new Map}function kn(r){return{name:r.name,type:zl(r.type),nullable:r.nullable,metadata:va(r.metadata)}}function Pn(r){return new O(r.name,Wl(r.type),r.nullable,Ia(r.metadata))}function zl(r){switch(r.constructor){case nt:return"null";case re:return"binary";case Nt:return"bool";case et:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case Re:return"int8";case Ce:return"int16";case yt:return"int32";case ce:return"int64";case ke:return"uint8";case Pe:return"uint16";case Ve:return"uint32";case je:return"uint64";case Mt:switch(r.precision){case P.HALF:return"float16";case P.SINGLE:return"float32";case P.DOUBLE:return"float64";default:return"float16"}case _r:return"float16";case ze:return"float32";case le:return"float64";case Lt:return"utf8";case ne:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case $t:return r.unit===J.DAY?"date-day":"date-millisecond";case Nr:return"date-day";case Ur:return"date-millisecond";case Bt:switch(r.unit){case h.SECOND:return"time-second";case h.MILLISECOND:return"time-millisecond";case h.MICROSECOND:return"time-microsecond";case h.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Rr:return"time-millisecond";case Er:return"time-second";case Cr:return"time-microsecond";case kr:return"time-nanosecond";case At:switch(r.unit){case h.SECOND:return"timestamp-second";case h.MILLISECOND:return"timestamp-millisecond";case h.MICROSECOND:return"timestamp-microsecond";case h.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Pr:return"timestamp-second";case er:return"timestamp-millisecond";case Vr:return"timestamp-microsecond";case jr:return"timestamp-nanosecond";case Yt:switch(r.unit){case Q.DAY_TIME:return"interval-daytime";case Q.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case zr:return"interval-daytime";case Wr:return"interval-yearmonth";case Et:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(N=>kn(N))};case wt:let d=r.valueField;return{type:"list",children:[kn(d)]};case Ut:let f=r;return{type:"fixed-size-list",listSize:f.listSize,children:[kn(f.children[0])]};case k:return{type:"struct",children:r.children.map(N=>kn(N))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Wl(r){if(typeof r=="object")switch(r.type){case"decimal":return new ne(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>Pn(i));return new Et(t,r.keysSorted);case"list":let e=Pn(r.children[0]);return new wt(e);case"fixed-size-list":let n=Pn(r.children[0]);return new Ut(r.listSize,n);case"struct":return t=r.children.map(i=>Pn(i)),new k(t);default:throw new Error("array type not supported")}switch(r){case"null":return new nt;case"binary":return new re;case"bool":return new Nt;case"int8":return new Re;case"int16":return new Ce;case"int32":return new yt;case"int64":return new ce;case"uint8":return new ke;case"uint16":return new Pe;case"uint32":return new Ve;case"uint64":return new je;case"float16":return new _r;case"float32":return new ze;case"float64":return new le;case"utf8":return new Lt;case"date-day":return new Nr;case"date-millisecond":return new Ur;case"time-second":return new Er;case"time-millisecond":return new Rr;case"time-microsecond":return new Cr;case"time-nanosecond":return new kr;case"timestamp-second":return new Pr;case"timestamp-millisecond":return new er;case"timestamp-microsecond":return new Vr;case"timestamp-nanosecond":return new jr;case"interval-daytime":return new zr;case"interval-yearmonth":return new Wr;default:throw new Error("array type not supported")}}function Gl(r){switch(r.shape){case"array-row-table":case"object-row-table":return bh(r.data);case"geojson-table":return wh(r.features);case"columnar-table":return gh(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function gh(r){let t=[];for(let[e,n]of Object.entries(r)){let i=_h(n,e);t.push(i)}return{fields:t,metadata:{}}}function bh(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($l(i,n));return{fields:t,metadata:{}}}function wh(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($l(i,n));return{fields:t,metadata:{}}}function _h(r,t){if(ArrayBuffer.isView(r)){let e=kl(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=lo(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function $l(r,t){let e=lo(r);return{name:t,type:e,nullable:!0}}function Dr(r){switch(r.shape){case"array-row-table":case"object-row-table":return r.data.length;case"geojson-table":return r.features.length;case"arrow-table":return r.data.numRows;case"columnar-table":for(let e of Object.values(r.data))return e.length||0;return 0;default:throw new Error("table")}}function xa(r){if(r.schema)return r.schema.fields.length;if(Dr(r)===0)throw new Error("empty table");switch(r.shape){case"array-row-table":return r.data[0].length;case"object-row-table":return Object.keys(r.data[0]).length;case"geojson-table":return Object.keys(r.features[0]).length;case"columnar-table":return Object.keys(r.data).length;case"arrow-table":return r.data.numCols;default:throw new Error("table")}}function Yl(r,t,e){switch(r.shape){case"array-row-table":let n=vh(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 Ba(r,t,e){switch(r.shape){case"array-row-table":return r.data[t][e];case"object-row-table":let n=Sa(r,e);return r.data[t][n];case"geojson-table":let i=Sa(r,e);return r.features[t][i];case"columnar-table":let s=Sa(r,e);return r.data[s][t];case"arrow-table":return r.data.getChildAt(e)?.get(t);default:throw new Error("todo")}}function vh(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Sa(r,t){let e=r.schema?.fields[t]?.name;if(!e)throw new Error(`${t}`);return e}function Hl(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,d]of Object.entries(r.data))c[l]=d[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 Jl(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 d of Object.values(r.data))c[l]=d[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 Kl(r,t){let e=Pl(r.type,r.nullable);return new e(t)}function*Zl(r,t){let e=uo(r.schema),n=Dr(r),i=xa(r),s=t?.batchSize||n,o=e?.fields.map(l=>Se(l)),a=new k(e.fields),c=0;for(let l=0;l<n;l++)for(let d=0;d<i;++d){let f=Ba(r,l,d);if(o[d].append(f),c++,c>=s){let N=o.map(yr=>yr.flush()),ot=new M(a,0,c,0,void 0,N);yield new G(e,ot),c=0}}if(c>0){let l=o.map(f=>f.flush()),d=new M(a,0,c,0,void 0,l);yield new G(e,d),c=0}o.map(l=>l.finish())}function Aa(r,t){switch(r.shape){case"arrow-table":return r.data;case"columnar-table":default:let e=Zl(r,t);return new $(e)}}function Ta(r,t){switch(t){case"arrow-table":return Ih(r);case"array-row-table":return Sh(r);case"object-row-table":return xh(r);case"columnar-table":return Da(r);case"geojson-table":return Bh(r);default:throw new Error(t)}}function Ih(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function Sh(r){let t=Da(r);return on(t,"array-row-table")}function xh(r){let t=Da(r);return on(t,"object-row-table")}function Da(r){let t={};for(let n of r.schema.fields){let s=r.getChild(n.name)?.toArray();t[n.name]=s}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function Bh(r){let t=hr(r.schema),e=[];for(let n=0;n<r.numRows;n++){let i=r.get(n)?.toJSON()||{};e.push({type:"Feature",geometry:null,properties:i})}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:e}}function on(r,t){switch(t){case"object-row-table":return Dh(r);case"array-row-table":return Th(r);case"columnar-table":return Ah(r);case"arrow-table":return Oh(r);default:throw new Error(t)}}function Ah(r){let t=r.schema||Gl(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=Dr(r),i={};for(let s of e){let o=Kl(s,n);i[s.name]=o;for(let a=0;a<n;a++)o[a]=Yl(r,a,s.name)}return{shape:"columnar-table",schema:t,data:i}}function Th(r){if(r.shape==="array-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Jl(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Dh(r){if(r.shape==="object-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Hl(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Oh(r){let t=Aa(r);return{shape:"arrow-table",schema:r.schema,data:t}}function Ei(r,t){let e=t?.shape||"arrow-table",n=Ui([new Uint8Array(r)]);return Ta(n,e)}function fo(r,t){async function*e(){let n=dt.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 $([s]),length:s.data.length};break}}return e()}var Xl={...cn,parse:async(r,t)=>Ei(r,t?.arrow),parseSync:(r,t)=>Ei(r,t?.arrow),parseInBatches:fo};function Oa(r){let t={};for(let i of r){let s=Fh(i.array,i.type);t[i.name]=s}let e=new $(t);return co(e)}function Fh(r,t){switch(t){case Fr.DATE:return Fi(r);case Fr.FLOAT:default:return Fi(r)}}var Mh="4.4.0-alpha.1",ql={name:"Apache Arrow",id:"arrow",module:"arrow",version:Mh,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 Oa(t)},encodeSync(r,t){return Oa(r)}};var ho={...cn,options:{arrow:{shape:"arrow-table"}}};function Fa(r,t){return r instanceof Map?r.get(t)||null:r[t]||null}var Lh=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],Nh="ARROW:extension:name",Uh="ARROW:extension:metadata";function Ma(r){let t={};for(let e of r.fields||[]){let n=Eh(e?.metadata||{});n&&(t[e.name]=n)}return t}function Eh(r){let t=null,e=Fa(r,Nh);e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),Lh.includes(e)?(t||={},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=Fa(r,Uh);if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function Ql(r,t,e){switch(r.type){case"Point":return Ch(r,t,e);case"LineString":return Rh(r,t,e);case"Polygon":return tu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function tu(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 d=s[l],f=s[l+1],V=po(n,d,f);c.push(V)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],d=i[c+1],f=tu(r,l,d).coordinates;a.push(f)}return{type:"MultiPolygon",coordinates:a}}function Rh(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:po(n,i[0],i[1])};let o=[];for(let a=0;a<i.length-1;a++){let c=po(n,i[a],i[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function Ch(r,t,e){let{positions:n}=r,i=po(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function po(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 Vn(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}function eu(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(Vn(e).buffer),size:t}}}function ru(r,t){let e=r.map(s=>s.positions.value),n=new Float64Array(Vn(e).buffer),i=e.map(s=>s.length/t).map(iu(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function nu(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(Vn(e).buffer),s=e.map(a=>a.length/t).map(iu(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}}}var iu=r=>t=>r+=t;var pr;(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"})(pr||(pr={}));var su=2147483648,ou=1073741824,au=536870912;var La=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("],kh=new TextEncoder,cu=La.map(r=>kh.encode(r));function Ph(r){return Vh(r)!==null}function Vh(r){if(typeof r=="string"){let n=La.findIndex(i=>r.startsWith(i));return n>=0?n+1:null}let t=new Uint8Array(r),e=cu.findIndex(n=>n.every((i,s)=>i===t[s]));return e>=0?e+1:null}function lu(r,t){let e=Object.assign(t||{},{type:"wkb",variant:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});if(Ph(r.buffer))throw new Error("WKB: Cannot parse WKT data");e.littleEndian=r.getUint8(e.byteOffset)===1,e.byteOffset++;let n=r.getUint32(e.byteOffset,e.littleEndian);e.byteOffset+=4,e.geometryType=n&7;let i=(n-e.geometryType)/1e3;switch(i){case 0:break;case 1:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.variant="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let s=n&su,o=n&ou,a=n&au;return s&&o?(e.variant="ewkb",e.dimensions=4,e.coordinates="xyzm"):s?(e.variant="ewkb",e.dimensions=3,e.coordinates="xyz"):o&&(e.variant="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.variant="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function uu(r){let t=new DataView(r),e=lu(t),{geometryType:n,dimensions:i,littleEndian:s}=e,o=e.byteOffset;switch(n){case pr.Point:return du(t,o,i,s).geometry;case pr.LineString:return Na(t,o,i,s).geometry;case pr.Polygon:return fu(t,o,i,s).geometry;case pr.MultiPoint:let d=zh(t,o,i,s);return d.type="Point",d;case pr.MultiLineString:let f=Wh(t,o,i,s);return f.type="LineString",f;case pr.MultiPolygon:let V=Gh(t,o,i,s);return V.type="Polygon",V;default:throw new Error(`WKB: Unsupported geometry type: ${n}`)}}function du(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 Na(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 jh=r=>t=>r+=t;function fu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let l=0;l<i;l++){let d=Na(r,t,e,n),{positions:f}=d.geometry;t=d.offset,s.push(f.value)}let o=new Float64Array(Vn(s).buffer),a=[0];o.length>0&&a.push(o.length/e);let c=s.map(l=>l.length/e).map(jh(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 zh(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=du(r,t,e,a);t=c.offset,s.push(c.geometry)}return eu(s,e)}function Wh(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=Na(r,t,e,a);t=c.offset,s.push(c.geometry)}return ru(s,e)}function Gh(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=fu(r,t,e,a);t=c.offset,s.push(c.geometry)}return nu(s,e)}function hu(r){let t=uu(r);return Ql(t)}var pu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,mu=new RegExp("^"+pu.source+"(\\s"+pu.source+"){1,}");function yu(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),o=gu({parts:e,_:n,i:0});return t?.wkt?.crs?$h(o,i):o}function gu(r){return Yh(r)||Jh(r)||Zh(r)||Hh(r)||Kh(r)||Xh(r)||qh(r)}function $h(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 Yh(r){if(!st(/^(POINT(\sz)?)/i,r)||(Ct(r),!st(/^(\()/,r)))return null;let t=bu(r);return!t||(Ct(r),!st(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function Hh(r){if(!st(/^(MULTIPOINT)/i,r))return null;Ct(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=mo(r);return e?(Ct(r),{type:"MultiPoint",coordinates:e}):null}function Jh(r){if(!st(/^(LINESTRING(\sz)?)/i,r)||(Ct(r),!st(/^(\()/,r)))return null;let t=bu(r);return!t||!st(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function Kh(r){if(!st(/^(MULTILINESTRING)/i,r))return null;Ct(r);let t=mo(r);return t?(Ct(r),{type:"MultiLineString",coordinates:t}):null}function Zh(r){if(!st(/^(POLYGON(\sz)?)/i,r))return null;Ct(r);let t=mo(r);return t?{type:"Polygon",coordinates:t}:null}function Xh(r){if(!st(/^(MULTIPOLYGON)/i,r))return null;Ct(r);let t=mo(r);return t?{type:"MultiPolygon",coordinates:t}:null}function qh(r){let t=[],e;if(!st(/^(GEOMETRYCOLLECTION)/i,r)||(Ct(r),!st(/^(\()/,r)))return null;for(;e=gu(r);)t.push(e),Ct(r),st(/^(,)/,r),Ct(r);return st(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function mo(r){Ct(r);let t=0,e=[],n=[e],i=e,s;for(;s=st(/^(\()/,r)||st(/^(\))/,r)||st(/^(,)/,r)||st(mu,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;Ct(r)}return t!==0?null:e}function bu(r){let t=[],e,n;for(;n=st(mu,r)||st(/^(,)/,r);)n===","?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),Ct(r);if(e)t.push(e);else return null;return t.length?t:null}function st(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Ct(r){st(/^\s*/,r)}function wu(r,t){if(t=t?.toLowerCase(),!t||!r)return null;switch(t){case"geoarrow.multipolygon":return ep(r);case"geoarrow.polygon":return rp(r);case"geoarrow.multipoint":return np(r);case"geoarrow.point":return ip(r);case"geoarrow.multilinestring":return sp(r);case"geoarrow.linestring":return op(r);case"geoarrow.wkb":return Qh(r);case"geoarrow.wkt":return tp(r);default:throw Error(`GeoArrow encoding not supported ${t}`)}}function Qh(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);return hu(t)}function tp(r){return yu(r)}function ep(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 d=a.get(l),f=Array.from(d);c.push(f)}s.push(c)}t.push(s)}return{type:"MultiPolygon",coordinates:t}}function rp(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 np(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 ip(r){return{type:"Point",coordinates:Array.from(r)}}function sp(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 op(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 Ua(r,t){switch(t){case"arrow-table":return ap(r);case"array-row-table":return cp(r);case"object-row-table":return lp(r);case"columnar-table":return Ea(r);case"geojson-table":return up(r);default:throw new Error(t)}}function ap(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function cp(r){let t=Ea(r);return on(t,"array-row-table")}function lp(r){let t=Ea(r);return on(t,"object-row-table")}function Ea(r){let t={};for(let n of r.schema.fields){let s=r.getChild(n.name)?.toArray();t[n.name]=s}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function up(r){let t=hr(r.schema),e=Ma(t),n=e.geometry.encoding,i=[],s=r.schema.fields.map(c=>c.name).filter(c=>!(c in e)),o=r.select(s),a=r.getChild("geometry");for(let c=0;c<r.numRows;c++){let l=a?.get(c),d=wu(l,n);if(d){let f=o.get(c)?.toJSON()||{};i.push({type:"Feature",geometry:d,properties:f})}}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:i}}function Ra(r,t){let e=Ei(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return Ua(e.data,"geojson-table");default:return e}}function _u(r){return fo(r)}var vu={...ho,parse:async(r,t)=>Ra(r,t?.arrow),parseSync:(r,t)=>Ra(r,t?.arrow),parseInBatches:_u};function Ri(r,t=!1){if("data"in r)return new y(r.data.map(s=>Ri(s,t)));let e=[];for(let s of r.children)e.push(Ri(s,t));let n;r.dictionary!==void 0&&(n=Ri(r.dictionary,t));let i={[rt.OFFSET]:yo(r.buffers[rt.OFFSET],t),[rt.DATA]:yo(r.buffers[rt.DATA],t),[rt.VALIDITY]:yo(r.buffers[rt.VALIDITY],t),[rt.TYPE]:yo(r.buffers[rt.TYPE],t)};return new M(r.type,r.offset,r.length,r._nullCount,i,e,n)}function dp(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function yo(r,t){return r===void 0||!t&&!dp(r)?r:r.slice()}var Iu="beta";function fp(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0-alpha.1"),globalThis._loadersgl_.version}var Ca=fp();function qe(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var Qe={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ax=Qe.self||Qe.window||Qe.global||{},cx=Qe.window||Qe.self||Qe.global||{},lx=Qe.global||Qe.self||Qe.window||{},ux=Qe.document||{};var mr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var xu=typeof window<"u"&&typeof window.orientation<"u",Su=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),dx=Su&&parseFloat(Su[1])||0;var Ci=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,e){this.name=t,this.workerThread=e,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){qe(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){qe(this.isRunning),this.isRunning=!1,this._reject(t)}};var jn=class{terminate(){}};var ka=new Map;function Bu(r){qe(r.source&&!r.url||!r.source&&r.url);let t=ka.get(r.source||r.url);return t||(r.url&&(t=hp(r.url),ka.set(r.url,t)),r.source&&(t=Au(r.source),ka.set(r.source,t))),qe(t),t}function hp(r){if(!r.startsWith("http"))return r;let t=pp(r);return Au(t)}function Au(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function pp(r){return`try {
17
17
  importScripts('${r}');
18
18
  } catch (error) {
19
19
  console.error(error);
20
20
  throw error;
21
- }`}function vc(r,t=!0,e){let n=e||new Set;if(r){if(cf(r))n.add(r);else if(cf(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)vc(r[i],t,n)}}return e===void 0?Array.from(n):[]}function cf(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 Ic(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]=Ic(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var xc=()=>{},Nr=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&vr||typeof Zn<"u"&&!vr}constructor(t){let{name:e,source:n,url:i}=t;sr(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=xc,this.onError=s=>console.log(s),this.worker=vr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=xc,this.onError=xc,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||vc(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=of({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 Zn(n,{eval:!1})}else if(this.source)t=new Zn(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 Nr.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 Qi(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){!vr||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 Nr({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return sf?this.maxMobileConcurrency:this.maxConcurrency}};var Am={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},dn=class{props;workerPools=new Map;static isSupported(){return Nr.isSupported()}static getWorkerFarm(t={}){return dn._workerFarm=dn._workerFarm||new dn({}),dn._workerFarm.setProps(t),dn._workerFarm}constructor(t){this.props={...Am},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}}},Jn=dn;ns(Jn,"_workerFarm");function lf(r){let t=r.version!==wc?` (worker-utils@${wc})`:"";return`${r.name}@${r.version}${t}`}function uf(r,t={}){let e=t[r.id]||{},n=vr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(vr?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=rf);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=lf(r),s=Jn.getWorkerFarm(e),{source:o}=e,a={name:i,source:o};o||(a.url=uf(r,e));let c=s.getWorkerPool(a),l=e.jobName||r.name,u=await c.startJob(l,Tm.bind(null,n)),h=Ic(e);return u.postMessage("process",{input:t,options:h}),(await u.result).result}async function Tm(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 Dm="4.3.1",Zo={id:"triangulation",name:"Triangulate",module:"arrow",version:Dm,options:{}};function ff(r,t={}){return Ko(Zo,{...r,operation:"triangulate"},t)}function hf(r,t={}){return Ko(Zo,{...r,operation:"parse-geoarrow"},t)}mn.ArrowBatch=Lo;return vf(ts);})();
21
+ }`}function Pa(r,t=!0,e){let n=e||new Set;if(r){if(Tu(r))n.add(r);else if(Tu(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)Pa(r[i],t,n)}}return e===void 0?Array.from(n):[]}function Tu(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 Va(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]=Va(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var ja=()=>{},Or=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&mr||typeof jn<"u"&&!mr}constructor(t){let{name:e,source:n,url:i}=t;qe(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=ja,this.onError=s=>console.log(s),this.worker=mr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=ja,this.onError=ja,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||Pa(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=Bu({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 jn(n,{eval:!1})}else if(this.source)t=new jn(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",e=>{this.onMessage(e)}),t.on("error",e=>{this.onError(e)}),t.on("exit",e=>{}),t}};var ki=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Or.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,e=(i,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 Ci(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){!mr||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Or({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return xu?this.maxMobileConcurrency:this.maxConcurrency}};var mp={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},an=class{props;workerPools=new Map;static isSupported(){return Or.isSupported()}static getWorkerFarm(t={}){return an._workerFarm=an._workerFarm||new an({}),an._workerFarm.setProps(t),an._workerFarm}constructor(t){this.props={...mp},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 ki({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=an;za(zn,"_workerFarm");function Du(r){let t=r.version!==Ca?` (worker-utils@${Ca})`:"";return`${r.name}@${r.version}${t}`}function Ou(r,t={}){let e=t[r.id]||{},n=mr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(mr?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=Iu);let o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return qe(i),i}async function go(r,t,e={},n={}){let i=Du(r),s=zn.getWorkerFarm(e),{source:o}=e,a={name:i,source:o};o||(a.url=Ou(r,e));let c=s.getWorkerPool(a),l=e.jobName||r.name,d=await c.startJob(l,yp.bind(null,n)),f=Va(e);return d.postMessage("process",{input:t,options:f}),(await d.result).result}async function yp(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 gp="4.4.0-alpha.1",bo={id:"triangulation",name:"Triangulate",module:"arrow",version:gp,options:{}};function Fu(r,t={}){return go(bo,{...r,operation:"triangulate"},t)}function Mu(r,t={}){return go(bo,{...r,operation:"parse-geoarrow"},t)}return ju(Pi);})();
22
22
  return __exports__;
23
23
  });