@ioai/lerobot-studio 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist-lib/{DockviewLayout-DeRL52Yo.js → DockviewLayout-CUu7GYs2.js} +3245 -3221
- package/dist-lib/{LeRobotDataLoader-B8wZijIi.js → LeRobotDataLoader-DXZRK9t2.js} +1885 -1809
- package/dist-lib/assets/parquetImage.worker-DJN4vgFr.js +7 -0
- package/dist-lib/lerobot-studio.css +88 -1
- package/dist-lib/lerobot.es.js +3810 -2563
- package/dist-lib/{react-window-BIZRp3dx.js → react-window-Bqez0RiF.js} +976 -770
- package/dist-lib/workerManager-CQ6DPJcz.js +509 -0
- package/package.json +13 -10
- package/dist-lib/assets/parquetImage.worker-CsyqAWyH.js +0 -7
- package/dist-lib/workerManager-D6ovn2ln.js +0 -270
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
const e=Symbol(`Comlink.proxy`),t=Symbol(`Comlink.endpoint`),n=Symbol(`Comlink.releaseProxy`),r=Symbol(`Comlink.finalizer`),i=Symbol(`Comlink.thrown`),a=e=>typeof e==`object`&&!!e||typeof e==`function`,o=new Map([[`proxy`,{canHandle:t=>a(t)&&t[e],serialize(e){let{port1:t,port2:n}=new MessageChannel;return c(e,t),[n,[n]]},deserialize(e){return e.start(),ee(e)}}],[`throw`,{canHandle:e=>a(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function s(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function c(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function a(o){if(!o||!o.data)return;if(!s(n,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}let{id:l,type:ee,path:te}=Object.assign({path:[]},o.data),ne=(o.data.argumentList||[]).map(me),re;try{let t=te.slice(0,-1).reduce((e,t)=>e[t],e),n=te.reduce((e,t)=>e[t],e);switch(ee){case`GET`:re=n;break;case`SET`:t[te.slice(-1)[0]]=me(o.data.value),re=!0;break;case`APPLY`:re=n.apply(t,ne);break;case`CONSTRUCT`:re=fe(new n(...ne));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;c(e,n),re=de(t,[t])}break;case`RELEASE`:re=void 0;break;default:return}}catch(e){re={value:e,[i]:0}}Promise.resolve(re).catch(e=>({value:e,[i]:0})).then(n=>{let[i,o]=pe(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),o),ee===`RELEASE`&&(t.removeEventListener(`message`,a),u(t),r in e&&typeof e[r]==`function`&&e[r]())}).catch(e=>{let[n,r]=pe({value:TypeError(`Unserializable return value`),[i]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)})}),t.start&&t.start()}function l(e){return e.constructor.name===`MessagePort`}function u(e){l(e)&&e.close()}function ee(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),se(e,n,[],t)}function te(e){if(e)throw Error(`Proxy has been released and is not useable`)}function ne(e){return he(e,new Map,{type:`RELEASE`}).then(()=>{u(e)})}const re=new WeakMap,ie=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(re.get(e)||0)-1;re.set(e,t),t===0&&ne(e)});function ae(e,t){let n=(re.get(t)||0)+1;re.set(t,n),ie&&ie.register(e,t,e)}function oe(e){ie&&ie.unregister(e)}function se(e,r,i=[],a=function(){}){let o=!1,s=new Proxy(a,{get(t,a){if(te(o),a===n)return()=>{oe(s),ne(e),r.clear(),o=!0};if(a===`then`){if(i.length===0)return{then:()=>s};let t=he(e,r,{type:`GET`,path:i.map(e=>e.toString())}).then(me);return t.then.bind(t)}return se(e,r,[...i,a])},set(t,n,a){te(o);let[s,c]=pe(a);return he(e,r,{type:`SET`,path:[...i,n].map(e=>e.toString()),value:s},c).then(me)},apply(n,a,s){te(o);let c=i[i.length-1];if(c===t)return he(e,r,{type:`ENDPOINT`}).then(me);if(c===`bind`)return se(e,r,i.slice(0,-1));let[l,u]=le(s);return he(e,r,{type:`APPLY`,path:i.map(e=>e.toString()),argumentList:l},u).then(me)},construct(t,n){te(o);let[a,s]=le(n);return he(e,r,{type:`CONSTRUCT`,path:i.map(e=>e.toString()),argumentList:a},s).then(me)}});return ae(s,e),s}function ce(e){return Array.prototype.concat.apply([],e)}function le(e){let t=e.map(pe);return[t.map(e=>e[0]),ce(t.map(e=>e[1]))]}const ue=new WeakMap;function de(e,t){return ue.set(e,t),e}function fe(t){return Object.assign(t,{[e]:!0})}function pe(e){for(let[t,n]of o)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},ue.get(e)||[]]}function me(e){switch(e.type){case`HANDLER`:return o.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function he(e,t,n,r){return new Promise(i=>{let a=ge();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function ge(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}let d,_e=null;function ve(){return(_e===null||_e.byteLength===0)&&(_e=new Uint8Array(d.memory.buffer)),_e}let ye=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});ye.decode();let be=0;function xe(e,t){return be+=t,be>=2146435072&&(ye=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),ye.decode(),be=t),ye.decode(ve().subarray(e,e+t))}function Se(e,t){return e>>>=0,xe(e,t)}let f=0;const Ce=new TextEncoder;`encodeInto`in Ce||(Ce.encodeInto=function(e,t){let n=Ce.encode(e);return t.set(n),{read:e.length,written:n.length}});function we(e,t,n){if(n===void 0){let n=Ce.encode(e),r=t(n.length,1)>>>0;return ve().subarray(r,r+n.length).set(n),f=n.length,r}let r=e.length,i=t(r,1)>>>0,a=ve(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=ve().subarray(i+o,i+r),a=Ce.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return f=o,i}let Te=null;function Ee(){return(Te===null||Te.buffer.detached===!0||Te.buffer.detached===void 0&&Te.buffer!==d.memory.buffer)&&(Te=new DataView(d.memory.buffer)),Te}function De(e){let t=d.__externref_table_alloc();return d.__wbindgen_export_4.set(t,e),t}function p(e,t){try{return e.apply(this,t)}catch(e){let t=De(e);d.__wbindgen_exn_store(t)}}function m(e){return e==null}function Oe(e,t){return e>>>=0,ve().subarray(e/1,e/1+t)}function ke(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ke(e[0]));for(let r=1;r<t;r++)n+=`, `+ke(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}const Ae=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{d.__wbindgen_export_5.get(e.dtor)(e.a,e.b)});function je(e,t,n,r){let i={a:e,b:t,cnt:1,dtor:n},a=(...e)=>{i.cnt++;let t=i.a;i.a=0;try{return r(t,i.b,...e)}finally{--i.cnt===0?(d.__wbindgen_export_5.get(i.dtor)(t,i.b),Ae.unregister(i)):i.a=t}};return a.original=i,Ae.register(a,i,i),a}function h(e){let t=d.__wbindgen_export_4.get(e);return d.__externref_table_dealloc(e),t}function Me(e,t){e>>>=0;let n=Ee(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(d.__wbindgen_export_4.get(n.getUint32(i,!0)));return d.__externref_drop_slice(e,t),r}function Ne(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function Pe(e,t){let n=t(e.length*1,1)>>>0;return ve().set(e,n/1),f=e.length,n}function Fe(e,t){let n=Pe(e,d.__wbindgen_malloc),r=f,i=d.readParquet(n,r,m(t)?0:De(t));if(i[2])throw h(i[1]);return yt.__wrap(i[0])}let Ie=null;function Le(){return(Ie===null||Ie.byteLength===0)&&(Ie=new Uint32Array(d.memory.buffer)),Ie}function Re(e,t){return e>>>=0,Le().subarray(e/4,e/4+t)}function ze(e,t,n){d.closure3806_externref_shim(e,t,n)}function Be(e,t){d.wasm_bindgen__convert__closures_____invoke__h7767827484ad8911(e,t)}function Ve(e,t,n,r){d.closure3830_externref_shim(e,t,n,r)}Object.freeze({UNCOMPRESSED:0,0:`UNCOMPRESSED`,SNAPPY:1,1:`SNAPPY`,GZIP:2,2:`GZIP`,BROTLI:3,3:`BROTLI`,LZ4:4,4:`LZ4`,ZSTD:5,5:`ZSTD`,LZ4_RAW:6,6:`LZ4_RAW`,LZO:7,7:`LZO`}),Object.freeze({None:0,0:`None`,Chunk:1,1:`Chunk`,Page:2,2:`Page`}),Object.freeze({PLAIN:0,0:`PLAIN`,PLAIN_DICTIONARY:1,1:`PLAIN_DICTIONARY`,RLE:2,2:`RLE`,BIT_PACKED:3,3:`BIT_PACKED`,DELTA_BINARY_PACKED:4,4:`DELTA_BINARY_PACKED`,DELTA_LENGTH_BYTE_ARRAY:5,5:`DELTA_LENGTH_BYTE_ARRAY`,DELTA_BYTE_ARRAY:6,6:`DELTA_BYTE_ARRAY`,RLE_DICTIONARY:7,7:`RLE_DICTIONARY`,BYTE_STREAM_SPLIT:8,8:`BYTE_STREAM_SPLIT`}),Object.freeze({V1:0,0:`V1`,V2:1,1:`V2`});const He=[`bytes`],Ue=[`default`,`no-store`,`reload`,`no-cache`,`force-cache`,`only-if-cached`],We=[`omit`,`same-origin`,`include`],Ge=[`same-origin`,`no-cors`,`cors`,`navigate`],Ke=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_columnchunkmetadata_free(e>>>0,1));var qe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ke.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ke.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_columnchunkmetadata_free(e,0)}numValues(){return d.columnchunkmetadata_numValues(this.__wbg_ptr)}columnPath(){let e=d.columnchunkmetadata_columnPath(this.__wbg_ptr);var t=Me(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*4,4),t}compression(){return d.columnchunkmetadata_compression(this.__wbg_ptr)}fileOffset(){return d.columnchunkmetadata_fileOffset(this.__wbg_ptr)}compressedSize(){return d.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return d.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}encodings(){let e=d.columnchunkmetadata_encodings(this.__wbg_ptr);var t=Me(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*4,4),t}filePath(){let e=d.columnchunkmetadata_filePath(this.__wbg_ptr),t;return e[0]!==0&&(t=Se(e[0],e[1]).slice(),d.__wbindgen_free(e[0],e[1]*1,1)),t}};Symbol.dispose&&(qe.prototype[Symbol.dispose]=qe.prototype.free);const Je=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_ffidata_free(e>>>0,1));var Ye=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Je.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Je.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_ffidata_free(e,0)}arrayAddr(){return d.ffidata_arrayAddr(this.__wbg_ptr)>>>0}schemaAddr(){return d.ffidata_schemaAddr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Ye.prototype[Symbol.dispose]=Ye.prototype.free);const Xe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_ffischema_free(e>>>0,1));var Ze=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Xe.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Xe.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_ffischema_free(e,0)}addr(){return d.ffischema_addr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Ze.prototype[Symbol.dispose]=Ze.prototype.free);const Qe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_ffistream_free(e>>>0,1));var $e=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Qe.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Qe.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_ffistream_free(e,0)}arrayAddr(e){return d.ffistream_arrayAddr(this.__wbg_ptr,e)>>>0}numArrays(){return d.ffistream_numArrays(this.__wbg_ptr)>>>0}arrayAddrs(){let e=d.ffistream_arrayAddrs(this.__wbg_ptr);var t=Re(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*4,4),t}schemaAddr(){return d.ffistream_schemaAddr(this.__wbg_ptr)>>>0}drop(){let e=this.__destroy_into_raw();d.ffistream_drop(e)}};Symbol.dispose&&($e.prototype[Symbol.dispose]=$e.prototype.free);const et=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_filemetadata_free(e>>>0,1));var tt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,et.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_filemetadata_free(e,0)}createdBy(){let e=d.filemetadata_createdBy(this.__wbg_ptr),t;return e[0]!==0&&(t=Se(e[0],e[1]).slice(),d.__wbindgen_free(e[0],e[1]*1,1)),t}keyValueMetadata(){let e=d.filemetadata_keyValueMetadata(this.__wbg_ptr);if(e[2])throw h(e[1]);return h(e[0])}version(){return d.filemetadata_version(this.__wbg_ptr)}numRows(){return d.filemetadata_numRows(this.__wbg_ptr)}};Symbol.dispose&&(tt.prototype[Symbol.dispose]=tt.prototype.free);const nt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_intounderlyingbytesource_free(e>>>0,1));var rt=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,nt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_intounderlyingbytesource_free(e,0)}get autoAllocateChunkSize(){return d.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}pull(e){return d.intounderlyingbytesource_pull(this.__wbg_ptr,e)}start(e){d.intounderlyingbytesource_start(this.__wbg_ptr,e)}get type(){let e=d.intounderlyingbytesource_type(this.__wbg_ptr);return He[e]}cancel(){let e=this.__destroy_into_raw();d.intounderlyingbytesource_cancel(e)}};Symbol.dispose&&(rt.prototype[Symbol.dispose]=rt.prototype.free);const it=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_intounderlyingsink_free(e>>>0,1));var at=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,it.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_intounderlyingsink_free(e,0)}abort(e){let t=this.__destroy_into_raw();return d.intounderlyingsink_abort(t,e)}close(){let e=this.__destroy_into_raw();return d.intounderlyingsink_close(e)}write(e){return d.intounderlyingsink_write(this.__wbg_ptr,e)}};Symbol.dispose&&(at.prototype[Symbol.dispose]=at.prototype.free);const ot=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_intounderlyingsource_free(e>>>0,1));var st=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ot.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ot.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_intounderlyingsource_free(e,0)}pull(e){return d.intounderlyingsource_pull(this.__wbg_ptr,e)}cancel(){let e=this.__destroy_into_raw();d.intounderlyingsource_cancel(e)}};Symbol.dispose&&(st.prototype[Symbol.dispose]=st.prototype.free);const ct=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_parquetfile_free(e>>>0,1));var lt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ct.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ct.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_parquetfile_free(e,0)}read(e){return d.parquetfile_read(this.__wbg_ptr,m(e)?0:De(e))}schema(){let e=d.parquetfile_schema(this.__wbg_ptr);if(e[2])throw h(e[1]);return _t.__wrap(e[0])}stream(e){return d.parquetfile_stream(this.__wbg_ptr,m(e)?0:De(e))}static fromUrl(e){let t=we(e,d.__wbindgen_malloc,d.__wbindgen_realloc),n=f;return d.parquetfile_fromUrl(t,n)}metadata(){let e=d.parquetfile_metadata(this.__wbg_ptr);if(e[2])throw h(e[1]);return dt.__wrap(e[0])}static fromFile(e){return d.parquetfile_fromFile(e)}};Symbol.dispose&&(lt.prototype[Symbol.dispose]=lt.prototype.free);const ut=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_parquetmetadata_free(e>>>0,1));var dt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ut.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ut.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_parquetmetadata_free(e,0)}rowGroups(){let e=d.parquetmetadata_rowGroups(this.__wbg_ptr);var t=Me(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*4,4),t}fileMetadata(){let e=d.parquetmetadata_fileMetadata(this.__wbg_ptr);return tt.__wrap(e)}numRowGroups(){return d.parquetmetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(e){let t=d.parquetmetadata_rowGroup(this.__wbg_ptr,e);return ht.__wrap(t)}};Symbol.dispose&&(dt.prototype[Symbol.dispose]=dt.prototype.free);const ft=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_recordbatch_free(e>>>0,1));var pt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ft.register(n,n.__wbg_ptr,n),n}static __unwrap(t){return t instanceof e?t.__destroy_into_raw():0}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ft.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_recordbatch_free(e,0)}get numColumns(){return d.recordbatch_numColumns(this.__wbg_ptr)>>>0}withSchema(t){Ne(t,_t);var n=t.__destroy_into_raw();let r=d.recordbatch_withSchema(this.__wbg_ptr,n);if(r[2])throw h(r[1]);return e.__wrap(r[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=d.recordbatch_intoIPCStream(e);if(t[3])throw h(t[2]);var n=Oe(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),n}getArrayMemorySize(){return d.recordbatch_getArrayMemorySize(this.__wbg_ptr)>>>0}slice(t,n){let r=d.recordbatch_slice(this.__wbg_ptr,t,n);return e.__wrap(r)}get schema(){let e=d.recordbatch_schema(this.__wbg_ptr);return _t.__wrap(e)}toFFI(){let e=d.recordbatch_toFFI(this.__wbg_ptr);if(e[2])throw h(e[1]);return Ye.__wrap(e[0])}intoFFI(){let e=this.__destroy_into_raw(),t=d.recordbatch_intoFFI(e);if(t[2])throw h(t[1]);return Ye.__wrap(t[0])}get numRows(){return d.recordbatch_numRows(this.__wbg_ptr)>>>0}};Symbol.dispose&&(pt.prototype[Symbol.dispose]=pt.prototype.free);const mt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_rowgroupmetadata_free(e>>>0,1));var ht=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,mt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,mt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_rowgroupmetadata_free(e,0)}numColumns(){return d.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}compressedSize(){return d.rowgroupmetadata_compressedSize(this.__wbg_ptr)}totalByteSize(){return d.rowgroupmetadata_totalByteSize(this.__wbg_ptr)}column(e){let t=d.rowgroupmetadata_column(this.__wbg_ptr,e);return qe.__wrap(t)}columns(){let e=d.rowgroupmetadata_columns(this.__wbg_ptr);var t=Me(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*4,4),t}numRows(){return d.rowgroupmetadata_numRows(this.__wbg_ptr)}};Symbol.dispose&&(ht.prototype[Symbol.dispose]=ht.prototype.free);const gt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_schema_free(e>>>0,1));var _t=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,gt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,gt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_schema_free(e,0)}withMetadata(t){let n=d.schema_withMetadata(this.__wbg_ptr,t);if(n[2])throw h(n[1]);return e.__wrap(n[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=d.schema_intoIPCStream(e);if(t[3])throw h(t[2]);var n=Oe(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),n}toFFI(){let e=d.schema_toFFI(this.__wbg_ptr);if(e[2])throw h(e[1]);return Ze.__wrap(e[0])}indexOf(e){let t=we(e,d.__wbindgen_malloc,d.__wbindgen_realloc),n=f,r=d.schema_indexOf(this.__wbg_ptr,t,n);if(r[2])throw h(r[1]);return r[0]>>>0}intoFFI(){let e=this.__destroy_into_raw(),t=d.schema_intoFFI(e);if(t[2])throw h(t[1]);return Ze.__wrap(t[0])}metadata(){let e=d.schema_metadata(this.__wbg_ptr);if(e[2])throw h(e[1]);return h(e[0])}};Symbol.dispose&&(_t.prototype[Symbol.dispose]=_t.prototype.free);const vt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_table_free(e>>>0,1));var yt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,vt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,vt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_table_free(e,0)}get numBatches(){return d.table_numBatches(this.__wbg_ptr)>>>0}recordBatch(e){let t=d.table_recordBatch(this.__wbg_ptr,e);return t===0?void 0:pt.__wrap(t)}recordBatches(){let e=d.table_recordBatches(this.__wbg_ptr);var t=Me(e[0],e[1]).slice();return d.__wbindgen_free(e[0],e[1]*4,4),t}static fromIPCStream(t){let n=Pe(t,d.__wbindgen_malloc),r=f,i=d.table_fromIPCStream(n,r);if(i[2])throw h(i[1]);return e.__wrap(i[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=d.table_intoIPCStream(e);if(t[3])throw h(t[2]);var n=Oe(t[0],t[1]).slice();return d.__wbindgen_free(t[0],t[1]*1,1),n}getArrayMemorySize(){return d.table_getArrayMemorySize(this.__wbg_ptr)>>>0}get schema(){let e=d.table_schema(this.__wbg_ptr);return _t.__wrap(e)}toFFI(){let e=d.table_toFFI(this.__wbg_ptr);if(e[2])throw h(e[1]);return $e.__wrap(e[0])}intoFFI(){let e=this.__destroy_into_raw(),t=d.table_intoFFI(e);if(t[2])throw h(t[1]);return $e.__wrap(t[0])}};Symbol.dispose&&(yt.prototype[Symbol.dispose]=yt.prototype.free);const bt=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_writerproperties_free(e>>>0,1));var xt=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,bt.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,bt.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_writerproperties_free(e,0)}};Symbol.dispose&&(xt.prototype[Symbol.dispose]=xt.prototype.free);const St=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>d.__wbg_writerpropertiesbuilder_free(e>>>0,1));var Ct=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,St.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,St.unregister(this),e}free(){let e=this.__destroy_into_raw();d.__wbg_writerpropertiesbuilder_free(e,0)}setEncoding(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setEncoding(n,t);return e.__wrap(r)}setCreatedBy(t){let n=this.__destroy_into_raw(),r=we(t,d.__wbindgen_malloc,d.__wbindgen_realloc),i=f,a=d.writerpropertiesbuilder_setCreatedBy(n,r,i);return e.__wrap(a)}setCompression(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setCompression(n,t);return e.__wrap(r)}setWriterVersion(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setWriterVersion(n,t);return e.__wrap(r)}setColumnEncoding(t,n){let r=this.__destroy_into_raw(),i=we(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=f,o=d.writerpropertiesbuilder_setColumnEncoding(r,i,a,n);return e.__wrap(o)}setWriteBatchSize(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setWriteBatchSize(n,t);return e.__wrap(r)}setColumnCompression(t,n){let r=this.__destroy_into_raw(),i=we(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=f,o=d.writerpropertiesbuilder_setColumnCompression(r,i,a,n);return e.__wrap(o)}setDictionaryEnabled(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setDictionaryEnabled(n,t);return e.__wrap(r)}setKeyValueMetadata(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setKeyValueMetadata(n,t);if(r[2])throw h(r[1]);return e.__wrap(r[0])}setMaxRowGroupSize(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setMaxRowGroupSize(n,t);return e.__wrap(r)}setStatisticsEnabled(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setStatisticsEnabled(n,t);return e.__wrap(r)}setDataPageSizeLimit(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setDataPageSizeLimit(n,t);return e.__wrap(r)}setColumnDictionaryEnabled(t,n){let r=this.__destroy_into_raw(),i=we(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=f,o=d.writerpropertiesbuilder_setColumnDictionaryEnabled(r,i,a,n);return e.__wrap(o)}setColumnStatisticsEnabled(t,n){let r=this.__destroy_into_raw(),i=we(t,d.__wbindgen_malloc,d.__wbindgen_realloc),a=f,o=d.writerpropertiesbuilder_setColumnStatisticsEnabled(r,i,a,n);return e.__wrap(o)}setDictionaryPageSizeLimit(t){let n=this.__destroy_into_raw(),r=d.writerpropertiesbuilder_setDictionaryPageSizeLimit(n,t);return e.__wrap(r)}constructor(){let e=d.writerpropertiesbuilder_new();return this.__wbg_ptr=e>>>0,St.register(this,this.__wbg_ptr,this),this}build(){let e=this.__destroy_into_raw(),t=d.writerpropertiesbuilder_build(e);return xt.__wrap(t)}};Symbol.dispose&&(Ct.prototype[Symbol.dispose]=Ct.prototype.free);const wt=new Set([`basic`,`cors`,`default`]);async function Tt(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&wt.has(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function Et(){let e={};return e.wbg={},e.wbg.__wbg_Error_e17e777aac105295=function(e,t){return Error(Se(e,t))},e.wbg.__wbg_Number_998bea33bd87c3e0=function(e){return Number(e)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,t){let n=we(String(t),d.__wbindgen_malloc,d.__wbindgen_realloc),r=f;Ee().setInt32(e+4,r,!0),Ee().setInt32(e+0,n,!0)},e.wbg.__wbg_abort_67e1b49bf6614565=function(e){e.abort()},e.wbg.__wbg_abort_d830bf2e9aa6ec5b=function(e,t){e.abort(t)},e.wbg.__wbg_append_72a3c0addd2bce38=function(){return p(function(e,t,n,r,i){e.append(Se(t,n),Se(r,i))},arguments)},e.wbg.__wbg_arrayBuffer_2c907ed8e8ef4e35=function(e){return e.arrayBuffer()},e.wbg.__wbg_arrayBuffer_9c99b8e2809e8cbb=function(){return p(function(e){return e.arrayBuffer()},arguments)},e.wbg.__wbg_buffer_8d40b1d762fb3c66=function(e){return e.buffer},e.wbg.__wbg_byobRequest_2c036bceca1e6037=function(e){let t=e.byobRequest;return m(t)?0:De(t)},e.wbg.__wbg_byteLength_331a6b5545834024=function(e){return e.byteLength},e.wbg.__wbg_byteOffset_49a5b5608000358b=function(e){return e.byteOffset},e.wbg.__wbg_call_13410aac570ffff7=function(){return p(function(e,t){return e.call(t)},arguments)},e.wbg.__wbg_call_a5400b25a865cfd8=function(){return p(function(e,t,n){return e.call(t,n)},arguments)},e.wbg.__wbg_cancel_8bb5b8f4906b658a=function(e){return e.cancel()},e.wbg.__wbg_catch_c80ecae90cb8ed4e=function(e,t){return e.catch(t)},e.wbg.__wbg_clearTimeout_6222fede17abcb1a=function(e){return clearTimeout(e)},e.wbg.__wbg_close_a1918cff3cac355b=function(e){return e.close()},e.wbg.__wbg_close_cccada6053ee3a65=function(){return p(function(e){e.close()},arguments)},e.wbg.__wbg_close_d71a78219dc23e91=function(){return p(function(e){e.close()},arguments)},e.wbg.__wbg_columnchunkmetadata_new=function(e){return qe.__wrap(e)},e.wbg.__wbg_done_75ed0ee6dd243d9d=function(e){return e.done},e.wbg.__wbg_enqueue_452bc2343d1c2ff9=function(){return p(function(e,t){e.enqueue(t)},arguments)},e.wbg.__wbg_entries_2be2f15bd5554996=function(e){return Object.entries(e)},e.wbg.__wbg_fetch_87aed7f306ec6d63=function(e,t){return e.fetch(t)},e.wbg.__wbg_fetch_f156d10be9a5c88a=function(e){return fetch(e)},e.wbg.__wbg_getReader_48e00749fe3f6089=function(){return p(function(e){return e.getReader()},arguments)},e.wbg.__wbg_getWriter_03d7689e275ac6a4=function(){return p(function(e){return e.getWriter()},arguments)},e.wbg.__wbg_get_0da715ceaecea5c8=function(e,t){return e[t>>>0]},e.wbg.__wbg_get_458e874b43b18b25=function(){return p(function(e,t){return Reflect.get(e,t)},arguments)},e.wbg.__wbg_getdone_f026246f6bbe58d3=function(e){let t=e.done;return m(t)?16777215:+!!t},e.wbg.__wbg_getvalue_31e5a08f61e5aa42=function(e){return e.value},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,t){return e[t]},e.wbg.__wbg_has_b89e451f638123e3=function(){return p(function(e,t){return Reflect.has(e,t)},arguments)},e.wbg.__wbg_headers_29fec3c72865cd75=function(e){return e.headers},e.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd=function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_Response_50fde2cd696850bf=function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7=function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_isArray_030cce220591fb41=function(e){return Array.isArray(e)},e.wbg.__wbg_isSafeInteger_1c0d1af5542e102a=function(e){return Number.isSafeInteger(e)},e.wbg.__wbg_iterator_f370b34483c71a1c=function(){return Symbol.iterator},e.wbg.__wbg_length_186546c51cd61acd=function(e){return e.length},e.wbg.__wbg_length_6bb7e81f9d7713e4=function(e){return e.length},e.wbg.__wbg_new_19c25a3f2fa63a02=function(){return{}},e.wbg.__wbg_new_2e3c58a15f39f5f9=function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return Ve(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=n.b=0}},e.wbg.__wbg_new_2ff1f68f3676ea53=function(){return new Map},e.wbg.__wbg_new_638ebfaedbf32a5e=function(e){return new Uint8Array(e)},e.wbg.__wbg_new_66b9434b4e59b63e=function(){return p(function(){return new AbortController},arguments)},e.wbg.__wbg_new_99a6a948d5b3f607=function(){return p(function(){return new TransformStream},arguments)},e.wbg.__wbg_new_da9dc54c5db29dfa=function(e,t){return Error(Se(e,t))},e.wbg.__wbg_new_f6e53210afea8e45=function(){return p(function(){return new Headers},arguments)},e.wbg.__wbg_newfromslice_074c56947bd43469=function(e,t){return new Uint8Array(Oe(e,t))},e.wbg.__wbg_newnoargs_254190557c45b4ec=function(e,t){return Function(Se(e,t))},e.wbg.__wbg_newwithbyteoffset_6bd4b2a4ca518883=function(e,t){return new Uint8Array(e,t>>>0)},e.wbg.__wbg_newwithbyteoffsetandlength_e8f53910b4d42b45=function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},e.wbg.__wbg_newwithintounderlyingsource_b47f6a6a596a7f24=function(e,t){return new ReadableStream(st.__wrap(e),t)},e.wbg.__wbg_newwithstrandinit_b5d168a29a3fd85f=function(){return p(function(e,t,n){return new Request(Se(e,t),n)},arguments)},e.wbg.__wbg_next_5b3530e612fde77d=function(e){return e.next},e.wbg.__wbg_next_692e82279131b03c=function(){return p(function(e){return e.next()},arguments)},e.wbg.__wbg_parquetfile_new=function(e){return lt.__wrap(e)},e.wbg.__wbg_prototypesetcall_3d4a26c1ed734349=function(e,t,n){Uint8Array.prototype.set.call(Oe(e,t),n)},e.wbg.__wbg_queueMicrotask_25d0739ac89e8c88=function(e){queueMicrotask(e)},e.wbg.__wbg_queueMicrotask_4488407636f5bf24=function(e){return e.queueMicrotask},e.wbg.__wbg_read_bc925c758aa4d897=function(e){return e.read()},e.wbg.__wbg_readable_e82cff27b968ed1c=function(e){return e.readable},e.wbg.__wbg_ready_4186da3cb500ae7d=function(e){return e.ready},e.wbg.__wbg_recordbatch_new=function(e){return pt.__wrap(e)},e.wbg.__wbg_recordbatch_unwrap=function(e){return pt.__unwrap(e)},e.wbg.__wbg_releaseLock_62151472ae632176=function(e){e.releaseLock()},e.wbg.__wbg_releaseLock_ff29b586502a8221=function(e){e.releaseLock()},e.wbg.__wbg_resolve_4055c623acdd6a1b=function(e){return Promise.resolve(e)},e.wbg.__wbg_respond_6c2c4e20ef85138e=function(){return p(function(e,t){e.respond(t>>>0)},arguments)},e.wbg.__wbg_rowgroupmetadata_new=function(e){return ht.__wrap(e)},e.wbg.__wbg_setTimeout_2b339866a2aa3789=function(e,t){return setTimeout(e,t)},e.wbg.__wbg_set_1353b2a5e96bc48c=function(e,t,n){e.set(Oe(t,n))},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,n){e[t]=n},e.wbg.__wbg_set_b7f1cf4fae26fe2a=function(e,t,n){return e.set(t,n)},e.wbg.__wbg_setbody_c8460bdf44147df8=function(e,t){e.body=t},e.wbg.__wbg_setcache_90ca4ad8a8ad40d3=function(e,t){e.cache=Ue[t]},e.wbg.__wbg_setcredentials_9cd60d632c9d5dfc=function(e,t){e.credentials=We[t]},e.wbg.__wbg_setheaders_0052283e2f3503d1=function(e,t){e.headers=t},e.wbg.__wbg_sethighwatermark_3d5961f834647d41=function(e,t){e.highWaterMark=t},e.wbg.__wbg_setmethod_9b504d5b855b329c=function(e,t,n){e.method=Se(t,n)},e.wbg.__wbg_setmode_a23e1a2ad8b512f8=function(e,t){e.mode=Ge[t]},e.wbg.__wbg_setsignal_8c45ad1247a74809=function(e,t){e.signal=t},e.wbg.__wbg_signal_da4d466ce86118b5=function(e){return e.signal},e.wbg.__wbg_size_8f84e7768fba0589=function(e){return e.size},e.wbg.__wbg_slice_36c55c8c1a260c46=function(){return p(function(e,t,n){return e.slice(t,n)},arguments)},e.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12=function(){let e=typeof global>`u`?null:global;return m(e)?0:De(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184=function(){let e=typeof globalThis>`u`?null:globalThis;return m(e)?0:De(e)},e.wbg.__wbg_static_accessor_SELF_995b214ae681ff99=function(){let e=typeof self>`u`?null:self;return m(e)?0:De(e)},e.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea=function(){let e=typeof window>`u`?null:window;return m(e)?0:De(e)},e.wbg.__wbg_status_3fea3036088621d6=function(e){return e.status},e.wbg.__wbg_stringify_b98c93d0a190446a=function(){return p(function(e){return JSON.stringify(e)},arguments)},e.wbg.__wbg_table_new=function(e){return yt.__wrap(e)},e.wbg.__wbg_then_b33a773d723afa3e=function(e,t,n){return e.then(t,n)},e.wbg.__wbg_then_e22500defe16819f=function(e,t){return e.then(t)},e.wbg.__wbg_toString_78df35411a4fd40c=function(e){return e.toString()},e.wbg.__wbg_url_e5720dfacf77b05e=function(e,t){let n=t.url,r=we(n,d.__wbindgen_malloc,d.__wbindgen_realloc),i=f;Ee().setInt32(e+4,i,!0),Ee().setInt32(e+0,r,!0)},e.wbg.__wbg_value_dd9372230531eade=function(e){return e.value},e.wbg.__wbg_view_91cc97d57ab30530=function(e){let t=e.view;return m(t)?0:De(t)},e.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1=function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;Ee().setBigInt64(e+8,m(r)?BigInt(0):r,!0),Ee().setInt32(e+0,!m(r),!0)},e.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746=function(e){let t=e,n=typeof t==`boolean`?t:void 0;return m(n)?16777215:+!!n},e.wbg.__wbg_wbindgencbdrop_eb10308566512b88=function(e){let t=e.original;return t.cnt--==1&&(t.a=0,!0)},e.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d=function(e,t){let n=we(ke(t),d.__wbindgen_malloc,d.__wbindgen_realloc),r=f;Ee().setInt32(e+4,r,!0),Ee().setInt32(e+0,n,!0)},e.wbg.__wbg_wbindgenfunctiontable_aa1084b2969a9cbe=function(){return d.__wbindgen_export_5},e.wbg.__wbg_wbindgenin_d7a1ee10933d2d55=function(e,t){return e in t},e.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154=function(e){return typeof e==`bigint`},e.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74=function(e){return typeof e==`function`},e.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8=function(e){let t=e;return typeof t==`object`&&!!t},e.wbg.__wbg_wbindgenisstring_d4fa939789f003b0=function(e){return typeof e==`string`},e.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5=function(e){return e===void 0},e.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58=function(e,t){return e===t},e.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1=function(e,t){return e==t},e.wbg.__wbg_wbindgenmemory_d84da70f7c42d172=function(){return d.memory},e.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb=function(e,t){let n=t,r=typeof n==`number`?n:void 0;Ee().setFloat64(e+8,m(r)?0:r,!0),Ee().setInt32(e+0,!m(r),!0)},e.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f=function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=m(r)?0:we(r,d.__wbindgen_malloc,d.__wbindgen_realloc),a=f;Ee().setInt32(e+4,a,!0),Ee().setInt32(e+0,i,!0)},e.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6=function(e,t){throw Error(Se(e,t))},e.wbg.__wbg_writable_e5202c9fd57615db=function(e){return e.writable},e.wbg.__wbg_write_2e39e04a4c8c9e9d=function(e,t){return e.write(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,t){return Se(e,t)},e.wbg.__wbindgen_cast_3fa4d3e7d32dad96=function(e,t){return je(e,t,339,Be)},e.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},e.wbg.__wbindgen_cast_5c484bf9528b29d7=function(e,t){return je(e,t,3805,ze)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},e.wbg.__wbindgen_init_externref_table=function(){let e=d.__wbindgen_export_4,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e}function Dt(e,t){return d=e.exports,Ot.__wbindgen_wasm_module=t,Te=null,Ie=null,_e=null,d.__wbindgen_start(),d}async function Ot(e){if(d!==void 0)return d;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0)throw Error(`This build requires an explicit parquet-wasm module_or_path.`);let t=Et();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Tt(await e,t);return Dt(n,r)}function g(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function kt(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function _(e){return this instanceof _?(this.v=e,this):new _(e)}function At(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,ee)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){te(a[0][3],e)}}function l(e){e.value instanceof _?Promise.resolve(e.value.v).then(u,ee):te(a[0][2],e)}function u(e){c(`next`,e)}function ee(e){c(`throw`,e)}function te(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function jt(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:_(e[r](t)),done:!1}:i?i(t):t}:i}}function Mt(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof kt==`function`?kt(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}const Nt=new TextDecoder(`utf-8`),Pt=Nt.decode.bind(Nt),Ft=new TextEncoder,It=e=>Ft.encode(e),Lt=e=>typeof e==`number`,Rt=e=>typeof e==`boolean`,v=e=>typeof e==`function`,zt=e=>e!=null&&Object(e)===e,Bt=e=>zt(e)&&v(e.then),Vt=e=>zt(e)&&v(e[Symbol.iterator]),Ht=e=>zt(e)&&v(e[Symbol.asyncIterator]),Ut=e=>zt(e)&&zt(e.schema),Wt=e=>zt(e)&&`done`in e&&`value`in e,Gt=e=>zt(e)&&v(e.stat)&&Lt(e.fd),Kt=e=>zt(e)&&Jt(e.body),qt=e=>`_getDOMStream`in e&&`_getNodeStream`in e,Jt=e=>zt(e)&&v(e.cancel)&&v(e.getReader)&&!qt(e),Yt=e=>zt(e)&&v(e.read)&&v(e.pipe)&&Rt(e.readable)&&!qt(e),Xt=e=>zt(e)&&v(e.clear)&&v(e.bytes)&&v(e.position)&&v(e.setPosition)&&v(e.capacity)&&v(e.getBufferIdentifier)&&v(e.createLong),Zt=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function Qt(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++c<u;){if(o=t[l],s=e[c],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(t[++l]=s);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:a}=s,n+i<r||r+a<n){s&&(t[++l]=s);continue}t[l]=new Uint8Array(o.buffer,n,r-n+a)}return t}function $t(e,t,n=0,r=t.byteLength){let i=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return a.set(o,n),e}function en(e,t){let n=Qt(e),r=n.reduce((e,t)=>e+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++c<e;){if(i=n[c],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?n[c]=i.subarray(a.length):a.length===i.length&&c++,o?$t(o,a,s):o=a;break}$t(o||=new Uint8Array(l),a,s),s+=a.length}return[o||new Uint8Array,n.slice(c),r-(o?o.byteLength:0)]}function y(e,t){let n=Wt(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n==`string`&&(n=It(n)),n instanceof ArrayBuffer||n instanceof Zt?new e(n):Xt(n)?y(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const tn=e=>y(Int32Array,e),nn=e=>y(BigInt64Array,e),b=e=>y(Uint8Array,e),rn=e=>(e.next(),e);function*an(e,t){let n=function*(e){yield e},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Zt?n(t):Vt(t)?t:n(t);return yield*rn((function*(t){let n=null;do n=t.next(yield y(e,n));while(!n.done)})(r[Symbol.iterator]())),new e}const on=e=>an(Uint8Array,e);function sn(e,t){return At(this,arguments,function*(){if(Bt(t))return yield _(yield _(yield*jt(Mt(sn(e,yield _(t))))));let n=function(e){return At(this,arguments,function*(){yield yield _(yield _(e))})},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Zt?n(t):Vt(t)?function(e){return At(this,arguments,function*(){yield _(yield*jt(Mt(rn((function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)})(e[Symbol.iterator]())))))})}(t):Ht(t)?t:n(t);return yield _(yield*jt(Mt(rn((function(t){return At(this,arguments,function*(){let n=null;do n=yield _(t.next(yield yield _(y(e,n))));while(!n.done)})})(r[Symbol.asyncIterator]()))))),yield _(new e)})}const cn=e=>sn(Uint8Array,e);function ln(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var un={fromIterable(e){return dn(fn(e))},fromAsyncIterable(e){return dn(pn(e))},fromDOMStream(e){return dn(mn(e))},fromNodeStream(e){return dn(_n(e))},toDOMStream(e,t){throw Error(`"toDOMStream" not available in this environment`)},toNodeStream(e,t){throw Error(`"toNodeStream" not available in this environment`)}};const dn=e=>(e.next(),e);function*fn(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?en(r,o)[0]:([i,r,s]=en(r,o),i)}({cmd:a,size:o}=(yield null)||{cmd:`read`,size:0});let l=on(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&l.throw(e)}finally{n===!1&&typeof l.return==`function`&&l.return(null)}return null}function pn(e){return At(this,arguments,function*(){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?en(r,o)[0]:([i,r,s]=en(r,o),i)}({cmd:a,size:o}=(yield yield _(null))||{cmd:`read`,size:0});let l=cn(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?yield _(l.next()):yield _(l.next(o-s)),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield _(c()));while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&(yield _(l.throw(e)))}finally{n===!1&&typeof l.return==`function`&&(yield _(l.return(new Uint8Array)))}return yield _(null)})}function mn(e){return At(this,arguments,function*(){let t=!1,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?en(r,o)[0]:([i,r,s]=en(r,o),i)}({cmd:a,size:o}=(yield yield _(null))||{cmd:`read`,size:0});let l=new hn(e);try{do if({done:t,value:i}=Number.isNaN(o-s)?yield _(l.read()):yield _(l.read(o-s)),!t&&i.byteLength>0&&(r.push(b(i)),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield _(c()));while(o<s);while(!t)}catch(e){n=!0,yield _(l.cancel(e))}finally{n===!1?yield _(l.cancel()):e.locked&&l.releaseLock()}return yield _(null)})}var hn=class{constructor(e){this.source=e,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(e){return g(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return g(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=b(t)),t})}};const gn=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function _n(e){return At(this,arguments,function*(){let t=[],n=`error`,r=!1,i=null,a,o,s=0,c=[],l;function u(){return a===`peek`?en(c,o)[0]:([l,c,s]=en(c,o),l)}if({cmd:a,size:o}=(yield yield _(null))||{cmd:`read`,size:0},e.isTTY)return yield yield _(new Uint8Array),yield _(null);try{t[0]=gn(e,`end`),t[1]=gn(e,`error`);do{if(t[2]=gn(e,`readable`),[n,i]=yield _(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((r=n===`end`)||(Number.isFinite(o-s)?(l=b(e.read(o-s)),l.byteLength<o-s&&(l=b(e.read()))):l=b(e.read()),l.byteLength>0&&(c.push(l),s+=l.byteLength)),r||o<=s)do({cmd:a,size:o}=yield yield _(u()));while(o<s)}while(!r)}finally{yield _(ee(t,n===`error`?i:null))}return yield _(null);function ee(t,n){return l=c=null,new Promise((r,i)=>{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var x;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(x||={});var vn;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(vn||={});var S;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(S||={});var yn;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(yn||={});var C;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(C||={});var w;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(w||={});const bn=new Int32Array(2),xn=new Float32Array(bn.buffer),Sn=new Float64Array(bn.buffer),Cn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var wn;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(wn||={});var Tn=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return bn[0]=this.readInt32(e),xn[0]}readFloat64(e){return bn[+!Cn]=this.readInt32(e),bn[+!!Cn]=this.readInt32(e+4),Sn[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){xn[0]=t,this.writeInt32(e,bn[0])}writeFloat64(e,t){Sn[0]=t,this.writeInt32(e,bn[+!Cn]),this.writeInt32(e+4,bn[+!!Cn])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error(`FlatBuffers: ByteBuffer is too short to contain an identifier.`);let e=``;for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+n);return t===wn.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,t){return typeof e==`string`?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw Error(`FlatBuffers: file identifier must be length 4`);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t)}return n}createObjList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t.unpack())}return n}},En=class e{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;t=e||1024,this.bb=Tn.allocate(t),this.space=t}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(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let t=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(r)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(--this.space,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw TypeError(`FlatBuffers: struct must be serialized inline.`)}notNested(){if(this.isNested)throw TypeError(`FlatBuffers: object serialization must not be nested.`)}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw Error(`FlatBuffers: cannot grow buffer beyond 2 gigabytes.`);let n=t<<1,r=Tn.allocate(n);return r.setPosition(n-t),r.bytes().set(e.bytes(),n-t),r}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable??=[],this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw Error(`FlatBuffers: endObject called without startObject`);this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);this.addInt16(e-this.object_start);let r=(n+2)*2;this.addInt16(r);let i=0,a=this.space;outer_loop:for(t=0;t<this.vtables.length;t++){let e=this.bb.capacity()-this.vtables[t];if(r==this.bb.readInt16(e)){for(let t=2;t<r;t+=2)if(this.bb.readInt16(a+t)!=this.bb.readInt16(e+t))continue outer_loop;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let r=n?4:0;if(t){let e=t;if(this.prep(this.minalign,8+r),e.length!=4)throw TypeError(`FlatBuffers: file identifier must be length 4`);for(let t=3;t>=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,4+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(r)&&this.bb.readInt16(r+t)!=0))throw TypeError(`FlatBuffers: field `+t+` must be set`)}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||=new Map,this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return t=e instanceof Uint8Array?e:this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e==`string`?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let r=e[n];if(r!==null)t.push(this.createObjectOffset(r));else throw TypeError(`FlatBuffers: Argument for createObjectOffsetList cannot contain null.`)}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}},Dn;(function(e){e[e.BUFFER=0]=`BUFFER`})(Dn||={});var On;(function(e){e[e.LZ4_FRAME=0]=`LZ4_FRAME`,e[e.ZSTD=1]=`ZSTD`})(On||={});var kn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):On.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):Dn.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,On.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,Dn.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}},An=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},jn=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Mn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new jn).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new An).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}buffersLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){let t=this.bb.__offset(this.bb_pos,10);return t?(e||new kn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}variadicBufferCounts(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}variadicBufferCountsLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startRecordBatch(e){e.startObject(5)}static addLength(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static addVariadicBufferCounts(e,t){e.addFieldOffset(4,t,0)}static createVariadicBufferCountsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startVariadicBufferCountsVector(e,t){e.startVector(8,t,8)}static endRecordBatch(e){return e.endObject()}},Nn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Mn).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}},Pn;(function(e){e[e.Little=0]=`Little`,e[e.Big=1]=`Big`})(Pn||={});var Fn;(function(e){e[e.DenseArray=0]=`DenseArray`})(Fn||={});var In=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}},Ln=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new In).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):Fn.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,Fn.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}},T=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}},Rn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}},zn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinaryView(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(e){e.startObject(0)}static endBinaryView(e){return e.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}},Bn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}},Vn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):yn.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,yn.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}},Hn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}},Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):C.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,C.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}},Wn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}},Gn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}},Kn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):S.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,S.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}},qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):w.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,w.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}},Jn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}},Yn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}},Xn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}},Zn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(t){return e.startList(t),e.endList(t)}},Qn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}},$n=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}},er=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}},tr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):C.MILLISECOND}bitWidth(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,C.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}},nr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):C.SECOND}timezone(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,C.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}},rr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):vn.Sparse}typeIds(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,vn.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},ir=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},ar=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8View(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(e){e.startObject(0)}static endUtf8View(e){return e.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}},E;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.ListView=25]=`ListView`,e[e.LargeListView=26]=`LargeListView`})(E||={});var or=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):E.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new Ln).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,E.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}},sr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Pn.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new or).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,Pn.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static createSchema(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},D;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(D||={});var O;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`,e[e.IntervalMonthDayNano=-31]=`IntervalMonthDayNano`})(O||={});var cr;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(cr||={});function lr(e){if(e===null)return`null`;if(e===void 0)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>lr(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function k(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function ur(e,t){return k(e/t)+k(e%t)/k(t)}const dr=Symbol.for(`isArrowBigNum`);function fr(e,...t){return t.length===0?Object.setPrototypeOf(y(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}fr.prototype[dr]=!0,fr.prototype.toJSON=function(){return`"${vr(this)}"`},fr.prototype.valueOf=function(e){return _r(this,e)},fr.prototype.toString=function(){return vr(this)},fr.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return _r(this);case`string`:return vr(this);case`default`:return yr(this)}return vr(this)};function pr(...e){return fr.apply(this,e)}function mr(...e){return fr.apply(this,e)}function hr(...e){return fr.apply(this,e)}Object.setPrototypeOf(pr.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(mr.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(hr.prototype,Object.create(Uint32Array.prototype)),Object.assign(pr.prototype,fr.prototype,{constructor:pr,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(mr.prototype,fr.prototype,{constructor:mr,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(hr.prototype,fr.prototype,{constructor:hr,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const gr=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function _r(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(s){for(let e of o)c|=(e^gr)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let e of o)c|=e*(BigInt(1)<<BigInt(64*l++));if(typeof t==`number`&&t>0){let e=BigInt(`1`.padEnd(t+1,`0`)),n=c/e,r=s?-(c%e):c%e,i=k(n),a=`${r}`.padStart(t,`0`);return+`${s&&i===0?`-`:``}${i}.${a}`}return k(c)}function vr(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return br(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return br(e);t=t.slice();let n=1;for(let e=0;e<t.length;e++){let r=t[e],i=~r+n;t[e]=i,n&=+(r===0)}return`-${br(t)}`}function yr(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:vr(e)}function br(e){let t=``,n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),a=-1,o=r.length-1;do{for(n[0]=r[a=0];a<o;)r[a++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[a];r[a]=n[1]=n[0]/10,n[0]-=n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??`0`}var xr=class e{static new(e,t){switch(t){case!0:return new pr(e);case!1:return new mr(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new pr(e)}return e.byteLength===16?new hr(e):new mr(e)}static signed(e){return new pr(e)}static unsigned(e){return new mr(e)}static decimal(e){return new hr(e)}constructor(t,n){return e.new(t,n)}},Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr;const qr=Symbol.for(`apache-arrow/DataType`);var A=class e{static isDataType(e){return e?.[qr]===!0}static isNull(e){return e?.typeId===O.Null}static isInt(e){return e?.typeId===O.Int}static isFloat(e){return e?.typeId===O.Float}static isBinary(e){return e?.typeId===O.Binary}static isBinaryView(e){return e?.typeId===O.BinaryView}static isLargeBinary(e){return e?.typeId===O.LargeBinary}static isUtf8(e){return e?.typeId===O.Utf8}static isUtf8View(e){return e?.typeId===O.Utf8View}static isLargeUtf8(e){return e?.typeId===O.LargeUtf8}static isBool(e){return e?.typeId===O.Bool}static isDecimal(e){return e?.typeId===O.Decimal}static isDate(e){return e?.typeId===O.Date}static isTime(e){return e?.typeId===O.Time}static isTimestamp(e){return e?.typeId===O.Timestamp}static isInterval(e){return e?.typeId===O.Interval}static isDuration(e){return e?.typeId===O.Duration}static isList(e){return e?.typeId===O.List}static isLargeList(e){return e?.typeId===O.LargeList}static isStruct(e){return e?.typeId===O.Struct}static isUnion(e){return e?.typeId===O.Union}static isFixedSizeBinary(e){return e?.typeId===O.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===O.FixedSizeList}static isMap(e){return e?.typeId===O.Map}static isDictionary(e){return e?.typeId===O.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===vn.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===vn.Sparse}constructor(e){this.typeId=e}};Sr=Symbol.toStringTag,A[Sr]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[qr]=!0,e[Symbol.toStringTag]=`DataType`))(A.prototype);var Jr=class extends A{constructor(){super(O.Null)}toString(){return`Null`}};Cr=Symbol.toStringTag,Jr[Cr]=(e=>e[Symbol.toStringTag]=`Null`)(Jr.prototype);var Yr=class extends A{constructor(e,t){super(O.Int),this.isSigned=e,this.bitWidth=t}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};wr=Symbol.toStringTag,Yr[wr]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(Yr.prototype);var Xr=class extends Yr{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Zr=class extends Yr{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Qr=class extends Yr{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},$r=class extends Yr{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ei=class extends Yr{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ti=class extends Yr{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ni=class extends Yr{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ri=class extends Yr{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Xr.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(Zr.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Qr.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty($r.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(ei.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(ti.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(ni.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(ri.prototype,"ArrayType",{value:BigUint64Array});var ii=class extends A{constructor(e){super(O.Float),this.precision=e}get ArrayType(){switch(this.precision){case S.HALF:return Uint16Array;case S.SINGLE:return Float32Array;case S.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Tr=Symbol.toStringTag,ii[Tr]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(ii.prototype);var ai=class extends ii{constructor(){super(S.HALF)}},oi=class extends ii{constructor(){super(S.SINGLE)}},si=class extends ii{constructor(){super(S.DOUBLE)}};Object.defineProperty(ai.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(oi.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(si.prototype,"ArrayType",{value:Float64Array});var ci=class extends A{constructor(){super(O.Binary)}toString(){return`Binary`}};Er=Symbol.toStringTag,ci[Er]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(ci.prototype);var j=class extends A{constructor(){super(O.BinaryView)}toString(){return`BinaryView`}};Dr=Symbol.toStringTag,j.ELEMENT_WIDTH=16,j.INLINE_CAPACITY=12,j.LENGTH_OFFSET=0,j.INLINE_OFFSET=4,j.BUFFER_INDEX_OFFSET=8,j.BUFFER_OFFSET_OFFSET=12,j[Dr]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`BinaryView`))(j.prototype);var li=class extends A{constructor(){super(O.LargeBinary)}toString(){return`LargeBinary`}};Or=Symbol.toStringTag,li[Or]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(li.prototype);var ui=class extends A{constructor(){super(O.Utf8)}toString(){return`Utf8`}};kr=Symbol.toStringTag,ui[kr]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(ui.prototype);var di=class extends A{constructor(){super(O.Utf8View)}toString(){return`Utf8View`}};Ar=Symbol.toStringTag,di.ELEMENT_WIDTH=j.ELEMENT_WIDTH,di.INLINE_CAPACITY=j.INLINE_CAPACITY,di[Ar]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8View`))(di.prototype);var fi=class extends A{constructor(){super(O.LargeUtf8)}toString(){return`LargeUtf8`}};jr=Symbol.toStringTag,fi[jr]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(fi.prototype);var pi=class extends A{constructor(){super(O.Bool)}toString(){return`Bool`}};Mr=Symbol.toStringTag,pi[Mr]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(pi.prototype);var mi=class extends A{constructor(e,t,n=128){super(O.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};Nr=Symbol.toStringTag,mi[Nr]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(mi.prototype);var hi=class extends A{constructor(e){super(O.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${yn[this.unit]}>`}get ArrayType(){return this.unit===yn.DAY?Int32Array:BigInt64Array}};Pr=Symbol.toStringTag,hi[Pr]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(hi.prototype);var gi=class extends A{constructor(e,t){super(O.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${C[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Fr=Symbol.toStringTag,gi[Fr]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(gi.prototype);var _i=class extends A{constructor(e,t){super(O.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${C[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};Ir=Symbol.toStringTag,_i[Ir]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(_i.prototype);var vi=class extends A{constructor(e){super(O.Interval),this.unit=e}toString(){return`Interval<${w[this.unit]}>`}};Lr=Symbol.toStringTag,vi[Lr]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(vi.prototype);var yi=class extends A{constructor(e){super(O.Duration),this.unit=e}toString(){return`Duration<${C[this.unit]}>`}};Rr=Symbol.toStringTag,yi[Rr]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(yi.prototype);var bi=class extends A{constructor(e){super(O.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};zr=Symbol.toStringTag,bi[zr]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(bi.prototype);var xi=class extends A{constructor(e){super(O.LargeList),this.children=[e]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Br=Symbol.toStringTag,xi[Br]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeList`))(xi.prototype);var M=class extends A{constructor(e){super(O.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};Vr=Symbol.toStringTag,M[Vr]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(M.prototype);var Si=class extends A{constructor(e,t,n){super(O.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};Hr=Symbol.toStringTag,Si[Hr]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(Si.prototype);var Ci=class extends A{constructor(e){super(O.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Ur=Symbol.toStringTag,Ci[Ur]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(Ci.prototype);var wi=class extends A{constructor(e,t){super(O.FixedSizeList),this.listSize=e,this.children=[t]}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}>`}};Wr=Symbol.toStringTag,wi[Wr]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(wi.prototype);var Ti=class extends A{constructor(e,t=!1){if(super(O.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,e?.type?.children)){let t=(e?.type)?.children[0];t&&(t.name=`key`);let n=(e?.type)?.children[1];n&&(n.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(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};Gr=Symbol.toStringTag,Ti[Gr]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(Ti.prototype);const Ei=(e=>()=>++e)(-1);var Di=class extends A{constructor(e,t,n,r){super(O.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?Ei():k(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}>`}};Kr=Symbol.toStringTag,Di[Kr]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(Di.prototype);function Oi(e){let t=e;switch(e.typeId){case O.Decimal:return e.bitWidth/32;case O.Interval:return t.unit===w.MONTH_DAY_NANO?4:1+t.unit;case O.BinaryView:case O.Utf8View:return 16;case O.FixedSizeList:return t.listSize;case O.FixedSizeBinary:return t.byteWidth;default:return 1}}var N=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return ki(this,e,t)}getVisitFnByTypeId(e,t=!0){return Ai(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitUtf8View(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitBinaryView(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitLargeList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function ki(e,t,n=!0){return typeof t==`number`?Ai(e,t,n):typeof t==`string`&&t in O?Ai(e,O[t],n):t&&t instanceof A?Ai(e,ji(t),n):t?.type&&t.type instanceof A?Ai(e,ji(t.type),n):Ai(e,O.NONE,n)}function Ai(e,t,n=!0){let r=null;switch(t){case O.Null:r=e.visitNull;break;case O.Bool:r=e.visitBool;break;case O.Int:r=e.visitInt;break;case O.Int8:r=e.visitInt8||e.visitInt;break;case O.Int16:r=e.visitInt16||e.visitInt;break;case O.Int32:r=e.visitInt32||e.visitInt;break;case O.Int64:r=e.visitInt64||e.visitInt;break;case O.Uint8:r=e.visitUint8||e.visitInt;break;case O.Uint16:r=e.visitUint16||e.visitInt;break;case O.Uint32:r=e.visitUint32||e.visitInt;break;case O.Uint64:r=e.visitUint64||e.visitInt;break;case O.Float:r=e.visitFloat;break;case O.Float16:r=e.visitFloat16||e.visitFloat;break;case O.Float32:r=e.visitFloat32||e.visitFloat;break;case O.Float64:r=e.visitFloat64||e.visitFloat;break;case O.Utf8:r=e.visitUtf8;break;case O.LargeUtf8:r=e.visitLargeUtf8;break;case O.Utf8View:r=e.visitUtf8View||e.visitUtf8;break;case O.Binary:r=e.visitBinary;break;case O.LargeBinary:r=e.visitLargeBinary;break;case O.BinaryView:r=e.visitBinaryView||e.visitBinary;break;case O.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case O.Date:r=e.visitDate;break;case O.DateDay:r=e.visitDateDay||e.visitDate;break;case O.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case O.Timestamp:r=e.visitTimestamp;break;case O.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case O.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case O.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case O.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case O.Time:r=e.visitTime;break;case O.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case O.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case O.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case O.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case O.Decimal:r=e.visitDecimal;break;case O.List:r=e.visitList;break;case O.LargeList:r=e.visitLargeList;break;case O.Struct:r=e.visitStruct;break;case O.Union:r=e.visitUnion;break;case O.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case O.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case O.Dictionary:r=e.visitDictionary;break;case O.Interval:r=e.visitInterval;break;case O.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case O.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case O.IntervalMonthDayNano:r=e.visitIntervalMonthDayNano||e.visitInterval;break;case O.Duration:r=e.visitDuration;break;case O.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case O.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case O.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case O.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case O.FixedSizeList:r=e.visitFixedSizeList;break;case O.Map:r=e.visitMap}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${O[t]}'`)}function ji(e){switch(e.typeId){case O.Null:return O.Null;case O.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?O.Int8:O.Uint8;case 16:return n?O.Int16:O.Uint16;case 32:return n?O.Int32:O.Uint32;case 64:return n?O.Int64:O.Uint64}return O.Int}case O.Float:switch(e.precision){case S.HALF:return O.Float16;case S.SINGLE:return O.Float32;case S.DOUBLE:return O.Float64}return O.Float;case O.Binary:return O.Binary;case O.LargeBinary:return O.LargeBinary;case O.BinaryView:return O.BinaryView;case O.Utf8:return O.Utf8;case O.LargeUtf8:return O.LargeUtf8;case O.Utf8View:return O.Utf8View;case O.Bool:return O.Bool;case O.Decimal:return O.Decimal;case O.Time:switch(e.unit){case C.SECOND:return O.TimeSecond;case C.MILLISECOND:return O.TimeMillisecond;case C.MICROSECOND:return O.TimeMicrosecond;case C.NANOSECOND:return O.TimeNanosecond}return O.Time;case O.Timestamp:switch(e.unit){case C.SECOND:return O.TimestampSecond;case C.MILLISECOND:return O.TimestampMillisecond;case C.MICROSECOND:return O.TimestampMicrosecond;case C.NANOSECOND:return O.TimestampNanosecond}return O.Timestamp;case O.Date:switch(e.unit){case yn.DAY:return O.DateDay;case yn.MILLISECOND:return O.DateMillisecond}return O.Date;case O.Interval:switch(e.unit){case w.DAY_TIME:return O.IntervalDayTime;case w.YEAR_MONTH:return O.IntervalYearMonth;case w.MONTH_DAY_NANO:return O.IntervalMonthDayNano}return O.Interval;case O.Duration:switch(e.unit){case C.SECOND:return O.DurationSecond;case C.MILLISECOND:return O.DurationMillisecond;case C.MICROSECOND:return O.DurationMicrosecond;case C.NANOSECOND:return O.DurationNanosecond}return O.Duration;case O.Map:return O.Map;case O.List:return O.List;case O.LargeList:return O.LargeList;case O.Struct:return O.Struct;case O.Union:switch(e.mode){case vn.Dense:return O.DenseUnion;case vn.Sparse:return O.SparseUnion}return O.Union;case O.FixedSizeBinary:return O.FixedSizeBinary;case O.FixedSizeList:return O.FixedSizeList;case O.Dictionary:return O.Dictionary}throw Error(`Unrecognized type '${O[e.typeId]}'`)}N.prototype.visitInt8=null,N.prototype.visitInt16=null,N.prototype.visitInt32=null,N.prototype.visitInt64=null,N.prototype.visitUint8=null,N.prototype.visitUint16=null,N.prototype.visitUint32=null,N.prototype.visitUint64=null,N.prototype.visitFloat16=null,N.prototype.visitFloat32=null,N.prototype.visitFloat64=null,N.prototype.visitDateDay=null,N.prototype.visitDateMillisecond=null,N.prototype.visitTimestampSecond=null,N.prototype.visitTimestampMillisecond=null,N.prototype.visitTimestampMicrosecond=null,N.prototype.visitTimestampNanosecond=null,N.prototype.visitTimeSecond=null,N.prototype.visitTimeMillisecond=null,N.prototype.visitTimeMicrosecond=null,N.prototype.visitTimeNanosecond=null,N.prototype.visitDenseUnion=null,N.prototype.visitSparseUnion=null,N.prototype.visitIntervalDayTime=null,N.prototype.visitIntervalYearMonth=null,N.prototype.visitIntervalMonthDayNano=null,N.prototype.visitDuration=null,N.prototype.visitDurationSecond=null,N.prototype.visitDurationMillisecond=null,N.prototype.visitDurationMicrosecond=null,N.prototype.visitDurationNanosecond=null;const Mi=new Float64Array(1),Ni=new Uint32Array(Mi.buffer);function Pi(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function Fi(e){if(e!==e)return 32256;Mi[0]=e;let t=(Ni[1]&2147483648)>>16&65535,n=Ni[1]&2146435072,r=0;return n>=1089470464?Ni[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Ni[1]&1048575)>>10):n<=1056964608?(r=1048576+(Ni[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Ni[1]&1048575)+512>>10),t|n|r&65535}var P=class extends N{};function F(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Ii=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Li=(e,t,n,r)=>{if(n+1<t.length){let i=k(t[n]),a=k(t[n+1]);e.set(r.subarray(0,a-i),i)}},Ri=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},zi=({values:e},t,n)=>{e[t]=n},Bi=({values:e},t,n)=>{e[t]=n},Vi=({values:e},t,n)=>{e[t]=Fi(n)},Hi=(e,t,n)=>{switch(e.type.precision){case S.HALF:return Vi(e,t,n);case S.SINGLE:case S.DOUBLE:return Bi(e,t,n)}},Ui=({values:e},t,n)=>{Ii(e,t,n.valueOf())},Wi=({values:e},t,n)=>{e[t]=BigInt(n)},Gi=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Ki=({values:e,valueOffsets:t},n,r)=>Li(e,t,n,r),qi=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},Ji=(e,t,n)=>{let r=e.values;if(!r)throw Error(`BinaryView data is missing view buffer`);let i=j.ELEMENT_WIDTH,a=t*i,o=a+i;if(a<0||o>r.length)throw RangeError(`BinaryView index ${t} out of bounds`);r.fill(0,a,o);let s=new DataView(r.buffer,r.byteOffset+a,i),c=n.length;if(s.setInt32(j.LENGTH_OFFSET,c,!0),c<=j.INLINE_CAPACITY){r.set(n,a+j.INLINE_OFFSET);return}let l=(n[0]??0)|(n[1]??0)<<8|(n[2]??0)<<16|(n[3]??0)<<24;s.setUint32(j.INLINE_OFFSET,l>>>0,!0);let u=qi(e),ee=n.slice(),te=u.push(ee)-1;s.setInt32(j.BUFFER_INDEX_OFFSET,te,!0),s.setInt32(j.BUFFER_OFFSET_OFFSET,0,!0)},Yi=(e,t,n)=>{let r=n instanceof Uint8Array?n:new Uint8Array(n);Ji(e,t,r)},Xi=({values:e,valueOffsets:t},n,r)=>Li(e,t,n,It(r)),Zi=(e,t,n)=>{let r=It(n);Ji(e,t,r)},Qi=(e,t,n)=>{e.type.unit===yn.DAY?Ui(e,t,n):Wi(e,t,n)},$i=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},ea=({values:e},t,n)=>{e[t]=BigInt(n)},ta=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},na=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},ra=(e,t,n)=>{switch(e.type.unit){case C.SECOND:return $i(e,t,n);case C.MILLISECOND:return ea(e,t,n);case C.MICROSECOND:return ta(e,t,n);case C.NANOSECOND:return na(e,t,n)}},ia=({values:e},t,n)=>{e[t]=n},aa=({values:e},t,n)=>{e[t]=n},oa=({values:e},t,n)=>{e[t]=n},sa=({values:e},t,n)=>{e[t]=n},ca=(e,t,n)=>{switch(e.type.unit){case C.SECOND:return ia(e,t,n);case C.MILLISECOND:return aa(e,t,n);case C.MICROSECOND:return oa(e,t,n);case C.NANOSECOND:return sa(e,t,n)}},la=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},ua=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=ja.getVisitFn(r),o=k(i[t]),s=k(i[t+1]);if(Array.isArray(n))for(let e=-1,t=o;t<s;)a(r,t++,n[++e]);else for(let e=-1,t=o;t<s;)a(r,t++,n.get(++e))},da=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,a=ja.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},fa=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),pa=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),ma=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),ha=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),ga=(e,t,n)=>{let r=e.type.children.map(e=>ja.getVisitFn(e.type)),i=n instanceof Map?ma(t,n):n instanceof G?pa(t,n):Array.isArray(n)?fa(t,n):ha(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},_a=(e,t,n)=>{e.type.mode===vn.Dense?va(e,t,n):ya(e,t,n)},va=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ja.visit(i,e.valueOffsets[t],n)},ya=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ja.visit(i,t,n)},ba=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},xa=(e,t,n)=>{switch(e.type.unit){case w.YEAR_MONTH:return Ca(e,t,n);case w.DAY_TIME:return Sa(e,t,n);case w.MONTH_DAY_NANO:return wa(e,t,n)}},Sa=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Ca=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},wa=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Ta=({values:e},t,n)=>{e[t]=n},Ea=({values:e},t,n)=>{e[t]=n},Da=({values:e},t,n)=>{e[t]=n},Oa=({values:e},t,n)=>{e[t]=n},ka=(e,t,n)=>{switch(e.type.unit){case C.SECOND:return Ta(e,t,n);case C.MILLISECOND:return Ea(e,t,n);case C.MICROSECOND:return Da(e,t,n);case C.NANOSECOND:return Oa(e,t,n)}},Aa=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=ja.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e<r;)a(i,o+e,n[e]);else for(let e=-1,o=t*r;++e<r;)a(i,o+e,n.get(e))};P.prototype.visitBool=F(Ri),P.prototype.visitInt=F(zi),P.prototype.visitInt8=F(zi),P.prototype.visitInt16=F(zi),P.prototype.visitInt32=F(zi),P.prototype.visitInt64=F(zi),P.prototype.visitUint8=F(zi),P.prototype.visitUint16=F(zi),P.prototype.visitUint32=F(zi),P.prototype.visitUint64=F(zi),P.prototype.visitFloat=F(Hi),P.prototype.visitFloat16=F(Vi),P.prototype.visitFloat32=F(Bi),P.prototype.visitFloat64=F(Bi),P.prototype.visitUtf8=F(Xi),P.prototype.visitLargeUtf8=F(Xi),P.prototype.visitUtf8View=F(Zi),P.prototype.visitBinary=F(Ki),P.prototype.visitLargeBinary=F(Ki),P.prototype.visitBinaryView=F(Yi),P.prototype.visitFixedSizeBinary=F(Gi),P.prototype.visitDate=F(Qi),P.prototype.visitDateDay=F(Ui),P.prototype.visitDateMillisecond=F(Wi),P.prototype.visitTimestamp=F(ra),P.prototype.visitTimestampSecond=F($i),P.prototype.visitTimestampMillisecond=F(ea),P.prototype.visitTimestampMicrosecond=F(ta),P.prototype.visitTimestampNanosecond=F(na),P.prototype.visitTime=F(ca),P.prototype.visitTimeSecond=F(ia),P.prototype.visitTimeMillisecond=F(aa),P.prototype.visitTimeMicrosecond=F(oa),P.prototype.visitTimeNanosecond=F(sa),P.prototype.visitDecimal=F(la),P.prototype.visitList=F(ua),P.prototype.visitLargeList=F(ua),P.prototype.visitStruct=F(ga),P.prototype.visitUnion=F(_a),P.prototype.visitDenseUnion=F(va),P.prototype.visitSparseUnion=F(ya),P.prototype.visitDictionary=F(ba),P.prototype.visitInterval=F(xa),P.prototype.visitIntervalDayTime=F(Sa),P.prototype.visitIntervalYearMonth=F(Ca),P.prototype.visitIntervalMonthDayNano=F(wa),P.prototype.visitDuration=F(ka),P.prototype.visitDurationSecond=F(Ta),P.prototype.visitDurationMillisecond=F(Ea),P.prototype.visitDurationMicrosecond=F(Da),P.prototype.visitDurationNanosecond=F(Oa),P.prototype.visitFixedSizeList=F(Aa),P.prototype.visitMap=F(da);const ja=new P,Ma=Symbol.for(`parent`),Na=Symbol.for(`rowIndex`);var Pa=class{constructor(e,t){return this[Ma]=e,this[Na]=t,new Proxy(this,Ia)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Na],t=this[Ma],n=t.type.children,r={};for(let i=-1,a=n.length;++i<a;)r[n[i].name]=R.visit(t.children[i],e);return r}toString(){return`{${[...this].map(([e,t])=>`${lr(e)}: ${lr(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new Fa(this[Ma],this[Na])}},Fa=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,R.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Pa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Ma]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Na]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});const Ia=new class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Ma].type.children.map(e=>e.name)}has(e,t){return e[Ma].type.children.some(e=>e.name===t)}getOwnPropertyDescriptor(e,t){if(e[Ma].type.children.some(e=>e.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Ma].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=R.visit(e[Ma].children[n],e[Na]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Ma].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(ja.visit(e[Ma].children[r],e[Na],n),Reflect.set(e,t,n))}};var I=class extends N{};function L(e){return(t,n)=>t.getValid(n)?e(t,n):null}const La=(e,t)=>864e5*e[t],Ra=(e,t)=>null,za=(e,t,n)=>{if(n+1>=t.length)return null;let r=k(t[n]),i=k(t[n+1]);return e.subarray(r,i)},Ba=({offset:e,values:t},n)=>{let r=e+n;return!!(t[r>>3]&1<<r%8)},Va=({values:e},t)=>La(e,t),Ha=({values:e},t)=>k(e[t]),Ua=({stride:e,values:t},n)=>t[e*n],Wa=({stride:e,values:t},n)=>Pi(t[e*n]),Ga=({values:e},t)=>e[t],Ka=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),qa=({values:e,valueOffsets:t},n)=>za(e,t,n),Ja=(e,t)=>{let n=e.values;if(!n)throw Error(`BinaryView data is missing view buffer`);let r=t*16,i=r+16;if(r<0||i>n.length)throw Error(`BinaryView data buffer is too short: expected 16 bytes, got ${Math.max(0,n.length-r)}`);let a=n.subarray(r,i);if(a.length<16)throw Error(`BinaryView data buffer is too short: expected 16 bytes, got ${a.length}`);let o=new DataView(n.buffer,a.byteOffset,16),s=o.getInt32(0,!0);if(s<=0)return new Uint8Array;if(s<=12)return a.subarray(4,4+s);let c=o.getInt32(8,!0),l=o.getInt32(12,!0),u=e.variadicBuffers?.[c];if(!u)throw Error(`BinaryView variadic buffer ${c} is missing`);return u.subarray(l,l+s)},Ya=(e,t)=>Ja(e,t),Xa=({values:e,valueOffsets:t},n)=>{let r=za(e,t,n);return r===null?null:Pt(r)},Za=(e,t)=>{let n=Ja(e,t);return Pt(n)},Qa=({values:e},t)=>e[t],$a=({type:e,values:t},n)=>e.precision===S.HALF?Pi(t[n]):t[n],eo=(e,t)=>e.type.unit===yn.DAY?Va(e,t):Ha(e,t),to=({values:e},t)=>1e3*k(e[t]),no=({values:e},t)=>k(e[t]),ro=({values:e},t)=>ur(e[t],BigInt(1e3)),io=({values:e},t)=>ur(e[t],BigInt(1e6)),ao=(e,t)=>{switch(e.type.unit){case C.SECOND:return to(e,t);case C.MILLISECOND:return no(e,t);case C.MICROSECOND:return ro(e,t);case C.NANOSECOND:return io(e,t)}},oo=({values:e},t)=>e[t],so=({values:e},t)=>e[t],co=({values:e},t)=>e[t],lo=({values:e},t)=>e[t],uo=(e,t)=>{switch(e.type.unit){case C.SECOND:return oo(e,t);case C.MILLISECOND:return so(e,t);case C.MICROSECOND:return co(e,t);case C.NANOSECOND:return lo(e,t)}},fo=({values:e,stride:t},n)=>xr.decimal(e.subarray(t*n,t*(n+1))),po=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,a=k(n[t*r]),o=k(n[t*r+1]);return new G([i[0].slice(a,o-a)])},mo=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new Po(o.slice(i,a-i))},ho=(e,t)=>new Pa(e,t),go=(e,t)=>e.type.mode===vn.Dense?_o(e,t):vo(e,t),_o=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return R.visit(r,e.valueOffsets[t])},vo=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return R.visit(r,t)},yo=(e,t)=>e.dictionary?.get(e.values[t]),bo=(e,t)=>e.type.unit===w.MONTH_DAY_NANO?Co(e,t):e.type.unit===w.DAY_TIME?xo(e,t):So(e,t),xo=({values:e},t)=>e.subarray(2*t,2*(t+1)),So=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},Co=({values:e},t)=>e.subarray(4*t,4*(t+1)),wo=({values:e},t)=>e[t],To=({values:e},t)=>e[t],Eo=({values:e},t)=>e[t],Do=({values:e},t)=>e[t],Oo=(e,t)=>{switch(e.type.unit){case C.SECOND:return wo(e,t);case C.MILLISECOND:return To(e,t);case C.MICROSECOND:return Eo(e,t);case C.NANOSECOND:return Do(e,t)}},ko=(e,t)=>{let{stride:n,children:r}=e;return new G([r[0].slice(t*n,n)])};I.prototype.visitNull=L(Ra),I.prototype.visitBool=L(Ba),I.prototype.visitInt=L(Qa),I.prototype.visitInt8=L(Ua),I.prototype.visitInt16=L(Ua),I.prototype.visitInt32=L(Ua),I.prototype.visitInt64=L(Ga),I.prototype.visitUint8=L(Ua),I.prototype.visitUint16=L(Ua),I.prototype.visitUint32=L(Ua),I.prototype.visitUint64=L(Ga),I.prototype.visitFloat=L($a),I.prototype.visitFloat16=L(Wa),I.prototype.visitFloat32=L(Ua),I.prototype.visitFloat64=L(Ua),I.prototype.visitUtf8=L(Xa),I.prototype.visitLargeUtf8=L(Xa),I.prototype.visitUtf8View=L(Za),I.prototype.visitBinary=L(qa),I.prototype.visitLargeBinary=L(qa),I.prototype.visitBinaryView=L(Ya),I.prototype.visitFixedSizeBinary=L(Ka),I.prototype.visitDate=L(eo),I.prototype.visitDateDay=L(Va),I.prototype.visitDateMillisecond=L(Ha),I.prototype.visitTimestamp=L(ao),I.prototype.visitTimestampSecond=L(to),I.prototype.visitTimestampMillisecond=L(no),I.prototype.visitTimestampMicrosecond=L(ro),I.prototype.visitTimestampNanosecond=L(io),I.prototype.visitTime=L(uo),I.prototype.visitTimeSecond=L(oo),I.prototype.visitTimeMillisecond=L(so),I.prototype.visitTimeMicrosecond=L(co),I.prototype.visitTimeNanosecond=L(lo),I.prototype.visitDecimal=L(fo),I.prototype.visitList=L(po),I.prototype.visitLargeList=L(po),I.prototype.visitStruct=L(ho),I.prototype.visitUnion=L(go),I.prototype.visitDenseUnion=L(_o),I.prototype.visitSparseUnion=L(vo),I.prototype.visitDictionary=L(yo),I.prototype.visitInterval=L(bo),I.prototype.visitIntervalDayTime=L(xo),I.prototype.visitIntervalYearMonth=L(So),I.prototype.visitIntervalMonthDayNano=L(Co),I.prototype.visitDuration=L(Oo),I.prototype.visitDurationSecond=L(wo),I.prototype.visitDurationMillisecond=L(To),I.prototype.visitDurationMicrosecond=L(Eo),I.prototype.visitDurationNanosecond=L(Do),I.prototype.visitFixedSizeList=L(ko),I.prototype.visitMap=L(mo);const R=new I,Ao=Symbol.for(`keys`),jo=Symbol.for(`vals`),Mo=Symbol.for(`kKeysAsStrings`),No=Symbol.for(`_kKeysAsStrings`);var Po=class{constructor(e){return this[Ao]=new G([e.children[0]]).memoize(),this[jo]=e.children[1],new Proxy(this,new Io)}get[Mo](){return this[No]||(this[No]=Array.from(this[Ao].toArray(),String))}[Symbol.iterator](){return new Fo(this[Ao],this[jo])}get size(){return this[Ao].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[Ao],t=this[jo],n={};for(let r=-1,i=e.length;++r<i;)n[e.get(r)]=R.visit(t,r);return n}toString(){return`{${[...this].map(([e,t])=>`${lr(e)}: ${lr(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},Fo=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),R.visit(this.vals,e)]})}},Io=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Mo]}has(e,t){return e[Mo].includes(t)}getOwnPropertyDescriptor(e,t){if(e[Mo].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[Mo].indexOf(t);if(n!==-1){let r=R.visit(Reflect.get(e,jo),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[Mo].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(ja.visit(Reflect.get(e,jo),r,n),Reflect.set(e,t,n))}};Object.defineProperties(Po.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[Ao]:{writable:!0,enumerable:!1,configurable:!1,value:null},[jo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[No]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Lo;function Ro(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(Lo=a,a=o,o=Lo),o>i&&(o=i),r?r(e,a,o):[a,o]}const zo=(e,t)=>e<0?t+e:e,Bo=e=>e!==e;function Vo(e){if(typeof e!=`object`||!e)return Bo(e)?Bo:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>t?ln(e,t):!1:e instanceof Map?Uo(e):Array.isArray(e)?Ho(e):e instanceof G?Wo(e):Go(e,!0)}function Ho(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Vo(e[n]);return Ko(t)}function Uo(e){let t=-1,n=[];for(let r of e.values())n[++t]=Vo(r);return Ko(n)}function Wo(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Vo(e.get(n));return Ko(t)}function Go(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let t=-1,i=n.length;++t<i;)r[t]=Vo(e[n[t]]);return Ko(r,n)}function Ko(e,t){return n=>{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return qo(e,n);case Map:return Yo(e,n,n.keys());case Po:case Pa:case Object:case void 0:return Yo(e,n,t||Object.keys(n))}return n instanceof G&&Jo(e,n)}}function qo(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Jo(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Yo(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,s=e.length,c=a.next(),l=r.next(),u=i.next();for(;o<s&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[o](c.value));++o,l=r.next(),u=i.next(),c=a.next());return o===s&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),a.return&&a.return(),!1)}function Xo(e,t,n,r){return!!(n&1<<r)}function Zo(e,t,n,r){return(n&1<<r)>>r}function Qo(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8==0?n.subarray(e>>3):$o(new es(n,e,t,null,Xo)).subarray(0,r)),i}return n}function $o(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var es=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[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 ts(e,t,n){if(n-t<=0)return 0;if(n-t<8){let r=0;for(let i of new es(e,t,n-t,e,Zo))r+=i;return r}let r=n>>3<<3,i=t+(t%8==0?0:8-t%8);return ts(e,t,i)+ts(e,r,n)+ns(e,i>>3,r-i>>3)}function ns(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=rs(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=rs(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=rs(a.getUint8(i)),i+=1;return r}function rs(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const is=Symbol.for(`apache-arrow/Data`);var z=class e{static isData(e){return e?.[is]===!0}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:e}=this;return A.isSparseUnion(e)||A.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),e+=this.variadicBuffers.reduce((e,t)=>e+(t?.byteLength??0),0),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(A.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-ts(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s,c=[]){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets,this.variadicBuffers=a.variadicBuffers):(this.stride=Oi(t),a&&((l=a[0])&&(this.valueOffsets=l),(l=a[1])&&(this.values=l),(l=a[2])&&(this.nullBitmap=l),(l=a[3])&&(this.typeIds=l)),this.variadicBuffers=c),this.variadicBuffers??=[]}getValid(e){let{type:t}=this;if(A.isUnion(t)){let n=t,r=this.typeIds[e],i=n.typeIdToChildIndex[r],a=this.children[i],o=this.valueOffsets,s=n.mode===vn.Dense&&o?Number(o[e]):e;return a.getValid(s)}if(this.nullable&&this.nullCount>0){let t=this.offset+e;return!!(this.nullBitmap[t>>3]&1<<t%8)}return!0}setValid(e,t){let n,{type:r}=this;if(A.isUnion(r)){let i=r,a=this.typeIds[e],o=i.typeIdToChildIndex[a],s=this.children[o],c=this.valueOffsets,l=i.mode===vn.Dense&&c?Number(c[e]):e;n=s.getValid(l),s.setValid(l,t)}else{let{nullBitmap:r}=this,{offset:i,length:a}=this,o=i+e,s=1<<o%8,c=o>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Qo(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children,s=this.variadicBuffers){return new e(t,n,r,i,a,o,this.dictionary,s)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===O.Null)return this.clone(this.type,0,e,0,this.buffers,this.children,this.variadicBuffers);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<<t-(t&-8))-1,n>0&&r.set(Qo(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[cr.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i,this.children,this.variadicBuffers)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;if((i=a[cr.TYPE])&&(a[cr.TYPE]=i.subarray(e,e+t)),A.isBinaryView(this.type)||A.isUtf8View(this.type)){let n=j.ELEMENT_WIDTH;(i=a[cr.DATA])&&(a[cr.DATA]=i.subarray(e*n,(e+t)*n))}else(i=a[cr.OFFSET])&&(a[cr.OFFSET]=i.subarray(e,e+t+1))||(i=a[cr.DATA])&&(a[cr.DATA]=r===6?i:i.subarray(n*e,n*(e+t)));return a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};z.prototype.children=Object.freeze([]),z.prototype[is]=!0,Object.defineProperty(z,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===z&&z.isData(e)}});const as=new class e extends N{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new z(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=b(e.data),i=b(e.nullBitmap),a=tn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitUtf8View(e){let{type:t,offset:n=0}=e,r=y(t.ArrayType,e.views),i=b(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>b(e));return new z(t,n,e.length??Math.trunc(r.length/di.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=b(e.data),i=b(e.nullBitmap),a=nn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=b(e.data),i=b(e.nullBitmap),a=tn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitBinaryView(e){let{type:t,offset:n=0}=e,r=y(t.ArrayType,e.views),i=b(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>b(e));return new z(t,n,e.length??Math.trunc(r.length/j.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=b(e.data),i=b(e.nullBitmap),a=nn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length/Oi(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length/Oi(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length/Oi(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length/Oi(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length/Oi(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=b(e.nullBitmap),a=tn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,void 0,i],[r])}visitLargeList(e){let{type:t,offset:n=0,child:r}=e,i=b(e.nullBitmap),a=nn(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new z(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=b(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=y(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;return A.isSparseUnion(t)?new z(t,n,a,o,[void 0,void 0,void 0,i],r):new z(t,n,a,o,[tn(e.valueOffsets),void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=b(t.nullBitmap),a=y(n.indices.ArrayType,t.data),{dictionary:o=new G([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new z(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length/Oi(t),nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=b(e.nullBitmap),i=y(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new z(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=b(t.nullBitmap),{length:o=i.length/Oi(n),nullCount:s=t.nullBitmap?-1:0}=t;return new z(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=b(t.nullBitmap),o=tn(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new z(n,r,s,c,[o,void 0,a],[i])}};function B(e){return as.visit(e)}var os=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function ss(e){return e.some(e=>e.nullable)}function cs(e){return e.reduce((e,t)=>e+t.nullCount,0)}function ls(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function us(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a<o;){let o=e[a],s=t[a],{length:c}=o;if(s>=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function ds(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;a=i+Math.trunc((o-i)*.5),n<t[a]?o=a:i=a}while(i<o)}function fs(e,t){return e.getValid(t)}function ps(e){function t(t,n,r){return e(t[n],r)}return function(e){let n=this.data;return ds(n,this._offsets,e,t)}}function ms(e){let t;function n(n,r,i){return e(n[r],i,t)}return function(e,r){let i=this.data;t=r;let a=ds(i,this._offsets,e,n);return t=void 0,a}}function hs(e){let t;function n(n,r,i){let a=i,o=0,s=0;for(let i=r-1,c=n.length;++i<c;){let r=n[i];if(~(o=e(r,t,a)))return s+o;a=0,s+=r.length}return-1}return function(e,r){t=e;let i=this.data,a=typeof r==`number`?ds(i,this._offsets,r,n):n(i,0,0);return t=void 0,a}}var V=class extends N{};function gs(e,t){return t===null&&e.length>0?0:-1}function _s(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new es(n,e.offset+(t||0),e.length,n,Xo)){if(!i)return r;++r}return-1}function H(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case O.Union:break;case O.Dictionary:break;default:return _s(e,n)}let r=R.getVisitFn(e),i=Vo(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}function vs(e,t,n){let r=R.getVisitFn(e),i=Vo(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}V.prototype.visitNull=gs,V.prototype.visitBool=H,V.prototype.visitInt=H,V.prototype.visitInt8=H,V.prototype.visitInt16=H,V.prototype.visitInt32=H,V.prototype.visitInt64=H,V.prototype.visitUint8=H,V.prototype.visitUint16=H,V.prototype.visitUint32=H,V.prototype.visitUint64=H,V.prototype.visitFloat=H,V.prototype.visitFloat16=H,V.prototype.visitFloat32=H,V.prototype.visitFloat64=H,V.prototype.visitUtf8=H,V.prototype.visitLargeUtf8=H,V.prototype.visitUtf8View=H,V.prototype.visitBinary=H,V.prototype.visitLargeBinary=H,V.prototype.visitBinaryView=H,V.prototype.visitFixedSizeBinary=H,V.prototype.visitDate=H,V.prototype.visitDateDay=H,V.prototype.visitDateMillisecond=H,V.prototype.visitTimestamp=H,V.prototype.visitTimestampSecond=H,V.prototype.visitTimestampMillisecond=H,V.prototype.visitTimestampMicrosecond=H,V.prototype.visitTimestampNanosecond=H,V.prototype.visitTime=H,V.prototype.visitTimeSecond=H,V.prototype.visitTimeMillisecond=H,V.prototype.visitTimeMicrosecond=H,V.prototype.visitTimeNanosecond=H,V.prototype.visitDecimal=H,V.prototype.visitList=H,V.prototype.visitLargeList=H,V.prototype.visitStruct=H,V.prototype.visitUnion=H,V.prototype.visitDenseUnion=vs,V.prototype.visitSparseUnion=vs,V.prototype.visitDictionary=H,V.prototype.visitInterval=H,V.prototype.visitIntervalDayTime=H,V.prototype.visitIntervalYearMonth=H,V.prototype.visitIntervalMonthDayNano=H,V.prototype.visitDuration=H,V.prototype.visitDurationSecond=H,V.prototype.visitDurationMillisecond=H,V.prototype.visitDurationMicrosecond=H,V.prototype.visitDurationNanosecond=H,V.prototype.visitFixedSizeList=H,V.prototype.visitMap=H;const ys=new V;var U=class extends N{};function W(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(A.isInt(t)&&t.bitWidth!==64||A.isTime(t)&&t.bitWidth!==64||A.isFloat(t)&&t.precision!==S.HALF))return new os(e.data.length,t=>{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new os(e.data.length,t=>{let r=e.data[t].length,i=e.slice(n,n+r);return n+=r,new bs(i)})}var bs=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};U.prototype.visitNull=W,U.prototype.visitBool=W,U.prototype.visitInt=W,U.prototype.visitInt8=W,U.prototype.visitInt16=W,U.prototype.visitInt32=W,U.prototype.visitInt64=W,U.prototype.visitUint8=W,U.prototype.visitUint16=W,U.prototype.visitUint32=W,U.prototype.visitUint64=W,U.prototype.visitFloat=W,U.prototype.visitFloat16=W,U.prototype.visitFloat32=W,U.prototype.visitFloat64=W,U.prototype.visitUtf8=W,U.prototype.visitLargeUtf8=W,U.prototype.visitUtf8View=W,U.prototype.visitBinary=W,U.prototype.visitLargeBinary=W,U.prototype.visitBinaryView=W,U.prototype.visitFixedSizeBinary=W,U.prototype.visitDate=W,U.prototype.visitDateDay=W,U.prototype.visitDateMillisecond=W,U.prototype.visitTimestamp=W,U.prototype.visitTimestampSecond=W,U.prototype.visitTimestampMillisecond=W,U.prototype.visitTimestampMicrosecond=W,U.prototype.visitTimestampNanosecond=W,U.prototype.visitTime=W,U.prototype.visitTimeSecond=W,U.prototype.visitTimeMillisecond=W,U.prototype.visitTimeMicrosecond=W,U.prototype.visitTimeNanosecond=W,U.prototype.visitDecimal=W,U.prototype.visitList=W,U.prototype.visitLargeList=W,U.prototype.visitStruct=W,U.prototype.visitUnion=W,U.prototype.visitDenseUnion=W,U.prototype.visitSparseUnion=W,U.prototype.visitDictionary=W,U.prototype.visitInterval=W,U.prototype.visitIntervalDayTime=W,U.prototype.visitIntervalYearMonth=W,U.prototype.visitIntervalMonthDayNano=W,U.prototype.visitDuration=W,U.prototype.visitDurationSecond=W,U.prototype.visitDurationMillisecond=W,U.prototype.visitDurationMicrosecond=W,U.prototype.visitDurationNanosecond=W,U.prototype.visitFixedSizeList=W,U.prototype.visitMap=W;const xs=new U;var Ss;const Cs=Symbol.for(`apache-arrow/Vector`),ws={},Ts={};var G=class e{static isVector(e){return e?.[Cs]===!0}constructor(t){let n=t[0]instanceof e?t.flatMap(e=>e.data):t;if(n.length===0||n.some(e=>!(e instanceof z)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let r=n[0]?.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:i}=ws[r.typeId],a=n[0];this.isValid=e=>fs(a,e),this.get=t=>e(a,t),this.set=(e,n)=>t(a,e,n),this.indexOf=e=>i(a,e),this._offsets=[0,a.length];break}default:Object.setPrototypeOf(this,Ts[r.typeId]),this._offsets=ls(n)}this.data=n,this.type=r,this.stride=Oi(r),this.numChildren=r.children?.length??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return ss(this.data)}get nullCount(){return cs(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${O[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(zo(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return xs.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(Ro(this,t,n,({data:e,_offsets:t},n,r)=>us(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case O.Int:case O.Float:case O.Decimal:case O.Time:case O.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){return this.getChildAt(this.type.children?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return A.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(A.isDictionary(this.type)){let t=new Es(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new Es(this)}unmemoize(){if(A.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};Ss=Symbol.toStringTag,G[Ss]=(e=>{e.type=A.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[Cs]=!0;let t=Object.keys(O).map(e=>O[e]).filter(e=>typeof e==`number`&&e!==O.NONE);for(let n of t){let t=R.getVisitFnByTypeId(n),r=ja.getVisitFnByTypeId(n),i=ys.getVisitFnByTypeId(n);ws[n]={get:t,set:r,indexOf:i},Ts[n]=Object.create(e,{isValid:{value:ps(fs)},get:{value:ps(R.getVisitFnByTypeId(n))},set:{value:ms(ja.getVisitFnByTypeId(n))},indexOf:{value:hs(ys.getVisitFnByTypeId(n))}})}return`Vector`})(G.prototype),Object.defineProperty(G,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===G&&G.isVector(e)}});var Es=class e extends G{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,"get",{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,"set",{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,"slice",{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new G(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}},Ds=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,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(e,t,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},Os=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):x.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new sr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new Ds).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new Ds).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,x.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}};const ks=Symbol.for(`apache-arrow/Schema`),As=Symbol.for(`apache-arrow/Field`);var K=class e{static isSchema(e){return e?.[ks]===!0}constructor(e=[],t,n,r=x.V5){this.fields=e||[],this.metadata=t||new Map,n||=Ms(this.fields),this.dictionaries=n,this.metadataVersion=r}get[Symbol.toStringTag](){return`Schema`}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(`, `)} }>`}select(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=js(js(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return!~t||(r[t]=e.clone({metadata:js(js(new Map,r[t].metadata),e.metadata)}))&&!1}),o=Ms(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};K.prototype.fields=null,K.prototype.metadata=null,K.prototype.dictionaries=null,K.prototype[ks]=!0,Object.defineProperty(K,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===K&&K.isSchema(e)}});var q=class e{static isField(e){return e?.[As]===!0}static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};q.prototype.type=null,q.prototype.name=null,q.prototype.nullable=null,q.prototype.metadata=null,q.prototype[As]=!0,Object.defineProperty(q,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===q&&q.isField(e)}});function js(e,t){return new Map([...e||new Map,...t||new Map])}function Ms(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let r=e[n].type;if(A.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}r.children&&r.children.length>0&&Ms(r.children,t)}return t}var Ns=En,Ps=Tn,Fs=class{static decode(e){e=new Ps(b(e));let t=Os.getRootAsFooter(e);return new Is(K.decode(t.schema(),new Map,t.version()),t)}static encode(e){let t=new Ns,n=K.encode(t,e.schema);Os.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())Ls.encode(t,n);let r=t.endVector();Os.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())Ls.encode(t,n);let i=t.endVector();return Os.startFooter(t),Os.addSchema(t,n),Os.addVersion(t,x.V5),Os.addRecordBatches(t,r),Os.addDictionaries(t,i),Os.finishFooterBuffer(t,Os.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=x.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},Is=class extends Fs{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return Ls.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return Ls.decode(t)}return null}},Ls=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(e,t){let{metaDataLength:n}=t,r=BigInt(t.offset),i=BigInt(t.bodyLength);return Ds.createBlock(e,r,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=k(n),this.bodyLength=k(t)}},Rs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):x.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):D.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new T).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,x.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,D.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt(`0`))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}};const zs=new class extends N{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return $n.startNull(t),$n.endNull(t)}visitInt(e,t){return In.startInt(t),In.addBitWidth(t,e.bitWidth),In.addIsSigned(t,e.isSigned),In.endInt(t)}visitFloat(e,t){return Kn.startFloatingPoint(t),Kn.addPrecision(t,e.precision),Kn.endFloatingPoint(t)}visitBinary(e,t){return Rn.startBinary(t),Rn.endBinary(t)}visitBinaryView(e,t){return zn.startBinaryView(t),zn.endBinaryView(t)}visitLargeBinary(e,t){return Jn.startLargeBinary(t),Jn.endLargeBinary(t)}visitBool(e,t){return Bn.startBool(t),Bn.endBool(t)}visitUtf8(e,t){return ir.startUtf8(t),ir.endUtf8(t)}visitUtf8View(e,t){return ar.startUtf8View(t),ar.endUtf8View(t)}visitLargeUtf8(e,t){return Xn.startLargeUtf8(t),Xn.endLargeUtf8(t)}visitDecimal(e,t){return Hn.startDecimal(t),Hn.addScale(t,e.scale),Hn.addPrecision(t,e.precision),Hn.addBitWidth(t,e.bitWidth),Hn.endDecimal(t)}visitDate(e,t){return Vn.startDate(t),Vn.addUnit(t,e.unit),Vn.endDate(t)}visitTime(e,t){return tr.startTime(t),tr.addUnit(t,e.unit),tr.addBitWidth(t,e.bitWidth),tr.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return nr.startTimestamp(t),nr.addUnit(t,e.unit),n!==void 0&&nr.addTimezone(t,n),nr.endTimestamp(t)}visitInterval(e,t){return qn.startInterval(t),qn.addUnit(t,e.unit),qn.endInterval(t)}visitDuration(e,t){return Un.startDuration(t),Un.addUnit(t,e.unit),Un.endDuration(t)}visitList(e,t){return Zn.startList(t),Zn.endList(t)}visitLargeList(e,t){return Yn.startLargeList(t),Yn.endLargeList(t)}visitStruct(e,t){return er.startStruct_(t),er.endStruct_(t)}visitUnion(e,t){rr.startTypeIdsVector(t,e.typeIds.length);let n=rr.createTypeIdsVector(t,e.typeIds);return rr.startUnion(t),rr.addMode(t,e.mode),rr.addTypeIds(t,n),rr.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return Ln.startDictionaryEncoding(t),Ln.addId(t,BigInt(e.id)),Ln.addIsOrdered(t,e.isOrdered),n!==void 0&&Ln.addIndexType(t,n),Ln.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return Wn.startFixedSizeBinary(t),Wn.addByteWidth(t,e.byteWidth),Wn.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return Gn.startFixedSizeList(t),Gn.addListSize(t,e.listSize),Gn.endFixedSizeList(t)}visitMap(e,t){return Qn.startMap(t),Qn.addKeysSorted(t,e.keysSorted),Qn.endMap(t)}};function Bs(e,t=new Map){return new K(Us(e,t),Xs(e.metadata),t)}function Vs(e){return new nc(e.count,Gs(e.columns),Ks(e.columns),null,Js(e.columns))}function Hs(e){return new rc(Vs(e.data),e.id,e.isDelta)}function Us(e,t){return(e.fields||[]).filter(Boolean).map(e=>q.fromJSON(e,t))}function Ws(e,t){return(e.children||[]).filter(Boolean).map(e=>q.fromJSON(e,t))}function Gs(e){return(e||[]).reduce((e,t)=>[...e,new ac(t.count,qs(t.VALIDITY)),...Gs(t.children)],[])}function Ks(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let r=e[n];if(r.VALIDITY&&t.push(new ic(t.length,r.VALIDITY.length)),r.TYPE_ID&&t.push(new ic(t.length,r.TYPE_ID.length)),r.OFFSET&&t.push(new ic(t.length,r.OFFSET.length)),r.DATA&&t.push(new ic(t.length,r.DATA.length)),r.VIEWS&&t.push(new ic(t.length,r.VIEWS.length)),r.VARIADIC_DATA_BUFFERS)for(let e of r.VARIADIC_DATA_BUFFERS)t.push(new ic(t.length,e.length));t=Ks(r.children,t)}return t}function qs(e){return(e||[]).reduce((e,t)=>e+ +(t===0),0)}function Js(e){return(e||[]).reduce((e,t)=>[...e,...t.VARIADIC_DATA_BUFFERS?[t.VARIADIC_DATA_BUFFERS.length]:[],...Js(t.children)],[])}function Ys(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=Qs(e,Ws(e,t)),i=new q(e.name,o,e.nullable,Xs(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?Zs(r):new Qr,s=new Di(t.get(n),r,n,a.isOrdered),i=new q(e.name,s,e.nullable,Xs(e.metadata))):(r=(r=a.indexType)?Zs(r):new Qr,t.set(n,o=Qs(e,Ws(e,t))),s=new Di(o,r,n,a.isOrdered),i=new q(e.name,s,e.nullable,Xs(e.metadata))),i||null}function Xs(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function Zs(e){return new Yr(e.isSigned,e.bitWidth)}function Qs(e,t){let n=e.type.name;switch(n){case`NONE`:return new Jr;case`null`:return new Jr;case`binary`:return new ci;case`largebinary`:return new li;case`binaryview`:return new j;case`utf8`:return new ui;case`largeutf8`:return new fi;case`utf8view`:return new di;case`bool`:return new pi;case`list`:return new bi((t||[])[0]);case`largelist`:return new xi((t||[])[0]);case`struct`:return new M(t||[]);case`struct_`:return new M(t||[])}switch(n){case`int`:{let t=e.type;return new Yr(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new ii(S[t.precision])}case`decimal`:{let t=e.type;return new mi(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new hi(yn[t.unit])}case`time`:{let t=e.type;return new gi(C[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new _i(C[t.unit],t.timezone)}case`interval`:{let t=e.type;return new vi(w[t.unit])}case`duration`:{let t=e.type;return new yi(C[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new Si(vn[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new Ci(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new wi(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new Ti((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var $s=En,ec=Tn,tc=class e{static fromJSON(t,n){let r=new e(0,x.V5,n);return r._createHeader=sc(t,n),r}static decode(t){t=new ec(b(t));let n=Rs.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=xc(n),s=new e(r,i,a,void 0,o);return s._createHeader=cc(n,a),s}static encode(e){let t=new $s,n=-1;e.isSchema()?n=K.encode(t,e.header()):e.isRecordBatch()?n=nc.encode(t,e.header()):e.isDictionaryBatch()&&(n=rc.encode(t,e.header()));let r=e.metadata&&e.metadata.size>0?Rs.createCustomMetadataVector(t,[...e.metadata].map(([e,n])=>{let r=t.createString(`${e}`),i=t.createString(`${n}`);return T.startKeyValue(t),T.addKey(t,r),T.addValue(t,i),T.endKeyValue(t)})):-1;return Rs.startMessage(t),Rs.addVersion(t,x.V5),Rs.addHeader(t,n),Rs.addHeaderType(t,e.headerType),Rs.addBodyLength(t,BigInt(e.bodyLength)),r!==-1&&Rs.addCustomMetadata(t,r),Rs.finishMessageBuffer(t,Rs.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof K)return new e(0,x.V5,D.Schema,t);if(t instanceof nc)return new e(n,x.V5,D.RecordBatch,t,t.metadata);if(t instanceof rc)return new e(n,x.V5,D.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===D.Schema}isRecordBatch(){return this.headerType===D.RecordBatch}isDictionaryBatch(){return this.headerType===D.DictionaryBatch}constructor(e,t,n,r,i){this._version=t,this._headerType=n,this.body=new Uint8Array,this._compression=r?.compression,r&&(this._createHeader=()=>r),this._bodyLength=k(e),this._metadata=i||new Map}},nc=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(e,t,n,r,i=[],a){this._nodes=t,this._buffers=n,this._length=k(e),this._compression=r,this._variadicBufferCounts=i,this._metadata=a||new Map}},rc=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(e,t,n=!1){this._data=e,this._isDelta=n,this._id=k(t)}},ic=class{constructor(e,t){this.offset=k(e),this.length=k(t)}},ac=class{constructor(e,t){this.length=k(e),this.nullCount=k(t)}},oc=class{constructor(e,t=Dn.BUFFER){this.type=e,this.method=t}};function sc(e,t){return(()=>{switch(t){case D.Schema:return K.fromJSON(e);case D.RecordBatch:return nc.fromJSON(e);case D.DictionaryBatch:return rc.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${D[t]}, type: ${t} }`)})}function cc(e,t){return(()=>{switch(t){case D.Schema:return K.decode(e.header(new sr),new Map,e.version());case D.RecordBatch:return nc.decode(e.header(new Mn),e.version());case D.DictionaryBatch:return rc.decode(e.header(new Nn),e.version())}throw Error(`Unrecognized Message type: { name: ${D[t]}, type: ${t} }`)})}q.encode=Ec,q.decode=yc,q.fromJSON=Ys,K.encode=Tc,K.decode=lc,K.fromJSON=Bs,nc.encode=Dc,nc.decode=uc,nc.fromJSON=Vs,rc.encode=kc,rc.decode=dc,rc.fromJSON=Hs,ac.encode=Ac,ac.decode=pc,ic.encode=jc,ic.decode=fc,oc.encode=Oc,oc.decode=wc;function lc(e,t=new Map,n=x.V5){return new K(_c(e,t),bc(e),t,n)}function uc(e,t=x.V5){return new nc(e.length(),mc(e),hc(e,t),wc(e.compression()),gc(e))}function dc(e,t=x.V5){return new rc(nc.decode(e.data(),t),e.id(),e.isDelta())}function fc(e){return new ic(e.offset(),e.length())}function pc(e){return new ac(e.length(),e.nullCount())}function mc(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++r<a;)(n=e.nodes(r))&&(t[++i]=ac.decode(n));return t}function hc(e,t){let n=[];for(let r,i=-1,a=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<x.V4&&(r.bb_pos+=8*(i+1)),n[++a]=ic.decode(r));return n}function gc(e){let t=[],n=Math.trunc(e.variadicBufferCountsLength());for(let r=0;r<n;++r)t.push(k(e.variadicBufferCounts(r)));return t}function _c(e,t){let n=[];for(let r,i=-1,a=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++a]=q.decode(r,t));return n}function vc(e,t){let n=[];for(let r,i=-1,a=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++a]=q.decode(r,t));return n}function yc(e,t){let n,r,i,a,o,s;return!t||!(s=e.dictionary())?(i=Cc(e,vc(e,t)),r=new q(e.name(),i,e.nullable(),bc(e))):t.has(n=k(s.id()))?(a=(a=s.indexType())?Sc(a):new Qr,o=new Di(t.get(n),a,n,s.isOrdered()),r=new q(e.name(),o,e.nullable(),bc(e))):(a=(a=s.indexType())?Sc(a):new Qr,t.set(n,i=Cc(e,vc(e,t))),o=new Di(i,a,n,s.isOrdered()),r=new q(e.name(),o,e.nullable(),bc(e))),r||null}function bc(e){let t=new Map;if(e)for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function xc(e){let t=new Map;for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Sc(e){return new Yr(e.isSigned(),e.bitWidth())}function Cc(e,t){let n=e.typeType();switch(n){case E.NONE:return new Jr;case E.Null:return new Jr;case E.Binary:return new ci;case E.LargeBinary:return new li;case E.BinaryView:return new j;case E.Utf8:return new ui;case E.LargeUtf8:return new fi;case E.Utf8View:return new di;case E.Bool:return new pi;case E.List:return new bi((t||[])[0]);case E.LargeList:return new xi((t||[])[0]);case E.Struct_:return new M(t||[])}switch(n){case E.Int:{let t=e.type(new In);return new Yr(t.isSigned(),t.bitWidth())}case E.FloatingPoint:return new ii(e.type(new Kn).precision());case E.Decimal:{let t=e.type(new Hn);return new mi(t.scale(),t.precision(),t.bitWidth())}case E.Date:return new hi(e.type(new Vn).unit());case E.Time:{let t=e.type(new tr);return new gi(t.unit(),t.bitWidth())}case E.Timestamp:{let t=e.type(new nr);return new _i(t.unit(),t.timezone())}case E.Interval:return new vi(e.type(new qn).unit());case E.Duration:return new yi(e.type(new Un).unit());case E.Union:{let n=e.type(new rr);return new Si(n.mode(),n.typeIdsArray()||[],t||[])}case E.FixedSizeBinary:return new Ci(e.type(new Wn).byteWidth());case E.FixedSizeList:return new wi(e.type(new Gn).listSize(),(t||[])[0]);case E.Map:{let n=e.type(new Qn);return new Ti((t||[])[0],n.keysSorted())}}throw Error(`Unrecognized type: "${E[n]}" (${n})`)}function wc(e){return e?new oc(e.codec(),e.method()):null}function Tc(e,t){let n=t.fields.map(t=>q.encode(e,t));sr.startFieldsVector(e,n.length);let r=sr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?sr.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return T.startKeyValue(e),T.addKey(e,r),T.addValue(e,i),T.endKeyValue(e)})):-1;return sr.startSchema(e),sr.addFields(e,r),sr.addEndianness(e,Mc?Pn.Little:Pn.Big),i!==-1&&sr.addCustomMetadata(e,i),sr.endSchema(e)}function Ec(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;A.isDictionary(a)?(o=a.dictionary.typeId,i=zs.visit(a,e),r=zs.visit(a.dictionary,e)):r=zs.visit(a,e);let s=(a.children||[]).map(t=>q.encode(e,t)),c=or.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?or.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return T.startKeyValue(e),T.addKey(e,r),T.addValue(e,i),T.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),or.startField(e),or.addType(e,r),or.addTypeType(e,o),or.addChildren(e,c),or.addNullable(e,!!t.nullable),n!==-1&&or.addName(e,n),i!==-1&&or.addDictionary(e,i),l!==-1&&or.addCustomMetadata(e,l),or.endField(e)}function Dc(e,t){let n=t.nodes||[],r=t.buffers||[],i=t.variadicBufferCounts||[];Mn.startNodesVector(e,n.length);for(let t of n.slice().reverse())ac.encode(e,t);let a=e.endVector();Mn.startBuffersVector(e,r.length);for(let t of r.slice().reverse())ic.encode(e,t);let o=e.endVector(),s=null;t.compression!==null&&(s=Oc(e,t.compression));let c=-1;return i.length>0&&(c=Mn.createVariadicBufferCountsVector(e,i.map(BigInt))),Mn.startRecordBatch(e),Mn.addLength(e,BigInt(t.length)),Mn.addNodes(e,a),Mn.addBuffers(e,o),t.compression!==null&&s&&Mn.addCompression(e,s),c!==-1&&Mn.addVariadicBufferCounts(e,c),Mn.endRecordBatch(e)}function Oc(e,t){return kn.startBodyCompression(e),kn.addCodec(e,t.type),kn.addMethod(e,t.method),kn.endBodyCompression(e)}function kc(e,t){let n=nc.encode(e,t.data);return Nn.startDictionaryBatch(e),Nn.addId(e,BigInt(t.id)),Nn.addIsDelta(e,t.isDelta),Nn.addData(e,n),Nn.endDictionaryBatch(e)}function Ac(e,t){return jn.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function jc(e,t){return An.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const Mc=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),J=Object.freeze({done:!0,value:void 0});var Nc=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Pc=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||=this.toDOMStream()}_getNodeStream(){return this._nodeStream||=this.toNodeStream()}},Fc=class extends Pc{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return g(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(J);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return un.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return un.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return g(this,void 0,void 0,function*(){return yield this.abort(e),J})}return(e){return g(this,void 0,void 0,function*(){return yield this.close(),J})}read(e){return g(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return g(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(...e){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,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(J)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},Ic=class extends Fc{write(e){if((e=b(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Pt(this.toUint8Array(!0)):this.toUint8Array(!1).then(Pt)}toUint8Array(e=!1){return e?en(this._values)[0]:g(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var o=!0,s=Mt(this),c;c=yield s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return en(i,a)[0]})}},Lc=class{constructor(e){e&&(this.source=new zc(un.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Rc=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Ic?this.source=new Bc(un.fromAsyncIterable(t)):Yt(t)?this.source=new Bc(un.fromNodeStream(t)):Jt(t)?this.source=new Bc(un.fromDOMStream(t)):Kt(t)?this.source=new Bc(un.fromDOMStream(t.body)):Vt(t)?this.source=new Bc(un.fromIterable(t)):(Bt(t)||Ht(t))&&(this.source=new Bc(un.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},zc=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,`peek`).value}read(e){return this.next(e,`read`).value}next(e,t=`read`){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||J)}return(e){return Object.create(this.source.return&&this.source.return(e)||J)}},Bc=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return g(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return g(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return g(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return g(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return g(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||J;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return g(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||J;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},Vc=class extends Lc{constructor(e,t){super(),this.position=0,this.buffer=b(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:r}=this;return t&&r<n?(typeof e!=`number`&&(e=1/0),this.position=Math.min(n,r+Math.min(n-r,e)),t.subarray(r,this.position)):null}readAt(e,t){let n=this.buffer,r=Math.min(this.size,e+t);return n?n.subarray(e,r):new Uint8Array(t)}close(){this.buffer&&=null}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},Hc=class extends Rc{constructor(e,t){super(),this.position=0,this._handle=e,typeof t==`number`?this.size=t:this._pending=g(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return g(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return g(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return g(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:r}=this;if(t&&r<n){typeof e!=`number`&&(e=1/0);let i=r,a=0,o=0,s=Math.min(n,i+Math.min(n-i,e)),c=new Uint8Array(Math.max(0,(this.position=s)-i));for(;(i+=o)<s&&(a+=o)<c.byteLength;)({bytesRead:o}=yield t.read(c,a,c.byteLength-a,i));return c}return null})}readAt(e,t){return g(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r}=this;if(n&&e+t<r){let i=Math.min(r,e+t),a=new Uint8Array(i-e);return(yield n.read(a,0,t,e)).buffer}return new Uint8Array(t)})}close(){return g(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return g(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return g(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}};function Uc(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const Wc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];var Gc=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${Uc(this.buffer[1])} ${Uc(this.buffer[0])}`}},Y=class e extends Gc{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let n=0;n<r;){let a=8<r-n?8:r-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+a),10),0])),s=new e(new Uint32Array([Wc[a],0]));i.times(s),i.plus(o),n+=a}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Kc=class e extends Gc{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=8<i-n?8:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0])),s=new e(new Uint32Array([Wc[r],0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},qc=class e{constructor(e){this.buffer=e}high(){return new Kc(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Kc(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(e){let t=new Y(new Uint32Array([this.buffer[3],0])),n=new Y(new Uint32Array([this.buffer[2],0])),r=new Y(new Uint32Array([this.buffer[1],0])),i=new Y(new Uint32Array([this.buffer[0],0])),a=new Y(new Uint32Array([e.buffer[3],0])),o=new Y(new Uint32Array([e.buffer[2],0])),s=new Y(new Uint32Array([e.buffer[1],0])),c=new Y(new Uint32Array([e.buffer[0],0])),l=Y.multiply(i,c);this.buffer[0]=l.low();let u=new Y(new Uint32Array([l.high(),0]));return l=Y.multiply(r,c),u.plus(l),l=Y.multiply(i,s),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=+!!u.lessThan(l),this.buffer[2]=u.high(),new Y(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Y.multiply(n,c)).plus(Y.multiply(r,s)).plus(Y.multiply(i,o)),this.buffer[3]+=Y.multiply(t,c).plus(Y.multiply(n,s)).plus(Y.multiply(r,o)).plus(Y.multiply(i,a)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${Uc(this.buffer[3])} ${Uc(this.buffer[2])} ${Uc(this.buffer[1])} ${Uc(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=8<i-n?8:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0,0,0])),s=new e(new Uint32Array([Wc[r],0,0,0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}};function Jc(e){let t=e.length,n=new Int32Array(t*2);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.days??0,n[i++]=t.milliseconds??0}return n}function Yc(e){let t=e.length,n=new Int32Array(t*4);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.months??0,n[i++]=t.days??0;let a=t.nanoseconds;if(a){let e=BigInt(a);n[i++]=Number(e&BigInt(4294967295))>>>0,n[i++]=Number(e>>BigInt(32))>>>0}else i+=2}return n}var Xc=class extends N{constructor(e,t,n,r,i=x.V5,a=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=r,this.metadataVersion=i,this.variadicBufferCounts=a}visit(e){return super.visit(e instanceof q?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return B({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitUtf8View(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinaryView(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitLargeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<x.V5&&this.readNullBitmap(e,n),e.mode===vn.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return B({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readVariadicBuffers(e){return Array.from({length:e},()=>this.readData(null))}nextVariadicBufferCount(){return this.variadicBufferCounts[++this.variadicBufferIndex]??0}readDictionary(e){return this.dictionaries.get(e.id)}},Zc=class extends Xc{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:$o(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return y(Uint8Array,y(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return y(Uint8Array,y(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;if(A.isTimestamp(e)||(A.isInt(e)||A.isTime(e))&&e.bitWidth===64||A.isDuration(e)||A.isDate(e)&&e.unit===yn.MILLISECOND)return y(Uint8Array,Kc.convertArray(n[t]));if(A.isDecimal(e))return y(Uint8Array,qc.convertArray(n[t]));if(A.isBinary(e)||A.isLargeBinary(e)||A.isFixedSizeBinary(e))return $c(n[t]);if(A.isBinaryView(e))return tl(n[t]);if(A.isUtf8View(e))return nl(n[t]);if(A.isBool(e))return $o(n[t]);if(A.isUtf8(e)||A.isLargeUtf8(e))return It(n[t].join(``));if(A.isInterval(e))switch(e.unit){case w.DAY_TIME:return Jc(n[t]);case w.MONTH_DAY_NANO:return Yc(n[t])}return y(Uint8Array,y(e.ArrayType,n[t].map(e=>+e)))}readVariadicBuffers(e){let t=[];for(let n=0;n<e;n++){let{offset:e}=this.nextBufferRange(),n=this.sources[e];t.push(Qc(n))}return t}};function Qc(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t}function $c(e){return Qc(e.join(``))}function el(e,t){let n=new Uint8Array(e.length*16),r=new DataView(n.buffer);for(let[i,a]of e.entries()){let e=i*16,o=a.SIZE;if(r.setInt32(e,o,!0),a.INLINED!==void 0){let r=t(a.INLINED);for(let t=0;t<r.length&&t<12;t++)n[e+4+t]=r[t]}else{let t=a.PREFIX_HEX;for(let r=0;r<8&&r<t.length;r+=2)n[e+4+(r>>1)]=Number.parseInt(t.slice(r,r+2),16);r.setInt32(e+8,a.BUFFER_INDEX,!0),r.setInt32(e+12,a.OFFSET,!0)}}return n}function tl(e){return el(e,e=>{let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t})}function nl(e){return el(e,e=>new TextEncoder().encode(e))}var rl=class extends Xc{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.bodyChunks=e}readData(e,t=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}},X=class extends N{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>this.compareFields(e,t[n]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};function Z(e,t){return t instanceof e.constructor}function il(e,t){return e===t||Z(e,t)}function al(e,t){return e===t||Z(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function ol(e,t){return e===t||Z(e,t)&&e.precision===t.precision}function sl(e,t){return e===t||Z(e,t)&&e.byteWidth===t.byteWidth}function cl(e,t){return e===t||Z(e,t)&&e.unit===t.unit}function ll(e,t){return e===t||Z(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ul(e,t){return e===t||Z(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function dl(e,t){return e===t||Z(e,t)&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}function fl(e,t){return e===t||Z(e,t)&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}function pl(e,t){return e===t||Z(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&yl.compareManyFields(e.children,t.children)}function ml(e,t){return e===t||Z(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&yl.visit(e.indices,t.indices)&&yl.visit(e.dictionary,t.dictionary)}function hl(e,t){return e===t||Z(e,t)&&e.unit===t.unit}function gl(e,t){return e===t||Z(e,t)&&e.unit===t.unit}function _l(e,t){return e===t||Z(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}function vl(e,t){return e===t||Z(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&yl.compareManyFields(e.children,t.children)}X.prototype.visitNull=il,X.prototype.visitBool=il,X.prototype.visitInt=al,X.prototype.visitInt8=al,X.prototype.visitInt16=al,X.prototype.visitInt32=al,X.prototype.visitInt64=al,X.prototype.visitUint8=al,X.prototype.visitUint16=al,X.prototype.visitUint32=al,X.prototype.visitUint64=al,X.prototype.visitFloat=ol,X.prototype.visitFloat16=ol,X.prototype.visitFloat32=ol,X.prototype.visitFloat64=ol,X.prototype.visitUtf8=il,X.prototype.visitLargeUtf8=il,X.prototype.visitUtf8View=il,X.prototype.visitBinary=il,X.prototype.visitLargeBinary=il,X.prototype.visitBinaryView=il,X.prototype.visitFixedSizeBinary=sl,X.prototype.visitDate=cl,X.prototype.visitDateDay=cl,X.prototype.visitDateMillisecond=cl,X.prototype.visitTimestamp=ll,X.prototype.visitTimestampSecond=ll,X.prototype.visitTimestampMillisecond=ll,X.prototype.visitTimestampMicrosecond=ll,X.prototype.visitTimestampNanosecond=ll,X.prototype.visitTime=ul,X.prototype.visitTimeSecond=ul,X.prototype.visitTimeMillisecond=ul,X.prototype.visitTimeMicrosecond=ul,X.prototype.visitTimeNanosecond=ul,X.prototype.visitDecimal=il,X.prototype.visitList=dl,X.prototype.visitLargeList=dl,X.prototype.visitStruct=fl,X.prototype.visitUnion=pl,X.prototype.visitDenseUnion=pl,X.prototype.visitSparseUnion=pl,X.prototype.visitDictionary=ml,X.prototype.visitInterval=hl,X.prototype.visitIntervalDayTime=hl,X.prototype.visitIntervalYearMonth=hl,X.prototype.visitIntervalMonthDayNano=hl,X.prototype.visitDuration=gl,X.prototype.visitDurationSecond=gl,X.prototype.visitDurationMillisecond=gl,X.prototype.visitDurationMicrosecond=gl,X.prototype.visitDurationNanosecond=gl,X.prototype.visitFixedSizeList=_l,X.prototype.visitMap=vl;const yl=new X;function bl(e,t){return yl.compareSchemas(e,t)}function xl(e,t){return Sl(e,t.map(e=>e.data.concat()))}function Sl(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-->0;){for(o=1/0,s=-1;++s<c;)u[s]=l=t[s].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=Cl(n,o,u,t,i),o>0&&(r[a++]=B({type:new M(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new kl(e,t))]}function Cl(e,t,n,r,i){let a=(t+63&-64)>>3;for(let o=-1,s=r.length;++o<s;){let s=n[o],c=s?.length;if(c>=t)c===t?n[o]=s:(n[o]=s.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(s.slice(t,c-t))));else{let r=e[o];e[o]=r.clone({nullable:!0}),n[o]=s?._changeLengthAndBackfillNullBitmap(t)??B({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var wl;const Tl=Symbol.for(`apache-arrow/Table`);var El=class e{static isTable(e){return e?.[Tl]===!0}constructor(...t){if(t.length===0)return this.batches=[],this.schema=new K([]),this._offsets=[0],this;let n,r;t[0]instanceof K&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());let i=t=>{if(t){if(t instanceof kl)return[t];if(t instanceof e)return t.batches;if(t instanceof z){if(t.type instanceof M)return[new kl(new K(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>i(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>i(e));else if(typeof t==`object`){let e=Object.keys(t),r=e.map(e=>new G([t[e]])),[,i]=xl(n??new K(e.map((e,t)=>new q(String(e),r[t].type,r[t].nullable))),r);return i.length===0?[new kl(t)]:i}}return[]},a=t.flatMap(e=>i(e));if(n=n??a[0]?.schema??new K([]),!(n instanceof K))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of a){if(!(e instanceof kl))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!bl(n,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=n,this.batches=a,this._offsets=r??ls(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=cs(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(zo(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?xs.visit(new G(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
|
|
7
|
-
`)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new kl(n,e)))}slice(t,n){let r=this.schema;[t,n]=Ro({length:this.numRows},t,n);let i=us(this.data,this._offsets,t,n);return new e(r,i.map(e=>new kl(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(t=>t.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=B({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new G(t)}return null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||=new G([B({type:new Jr,length:this.numRows})]);let e=r.fields.slice(),a=e[t].clone({type:n.type}),o=this.schema.fields.map((e,t)=>this.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=xl(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(...xl(a,o))}};wl=Symbol.toStringTag,El[wl]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[Tl]=!0,e.isValid=ps(fs),e.get=ps(R.getVisitFn(O.Struct)),e.set=ms(ja.getVisitFn(O.Struct)),e.indexOf=hs(ys.getVisitFn(O.Struct)),`Table`))(El.prototype),Object.defineProperty(El,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===El&&El.isTable(e)}});var Dl;const Ol=Symbol.for(`apache-arrow/RecordBatch`);var kl=class e{static isRecordBatch(e){return e?.[Ol]===!0}constructor(...e){switch(e.length){case 3:case 2:if([this.schema]=e,!(this.schema instanceof K)||([,this.data=B({nullCount:0,type:new M(this.schema.fields),children:this.schema.fields.map(e=>B({type:e.type,nullCount:0}))}),this._metadata=new Map]=e,!(this.data instanceof z)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=Al(this.schema,this.data.children,this.data.length);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=q.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new K(n),o=B({type:new M(n),length:i,children:r,nullCount:0});[this.schema,this.data]=Al(a,o.children,i),this._metadata=new Map;break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||=jl(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(e){return this.data.getValid(e)}get(e){return R.visit(this.data,e)}at(e){return this.get(zo(e,this.numRows))}set(e,t){return ja.visit(this.data,e,t)}indexOf(e,t){return ys.visit(this.data,e,t)}[Symbol.iterator](){return xs.visit(new G([this.data]))}toArray(){return[...this]}concat(...e){return new El(this.schema,[this,...e])}slice(t,n){let[r]=new G([this.data]).slice(t,n).data;return new e(this.schema,r,this._metadata)}getChild(e){return this.getChildAt(this.schema.fields?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new G([this.data.children[e]]):null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||=new G([B({type:new Jr,length:this.numRows})]);let e=r.fields.slice(),a=i.children.slice(),o=e[t].clone({type:n.type});[e[t],a[t]]=[o,n.data[0]],r=new K(e,new Map(this.schema.metadata)),i=B({type:new M(e),length:i.length,children:a})}return new e(r,i,this._metadata)}select(t){let n=this.schema.select(t),r=new M(n.fields),i=[];for(let e of t){let t=this.schema.fields.findIndex(t=>t.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,B({type:r,length:this.numRows,children:i}),this._metadata)}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=B({type:new M(n.fields),length:this.numRows,children:r});return new e(n,i,this._metadata)}};Dl=Symbol.toStringTag,kl[Dl]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[Ol]=!0,`RecordBatch`))(kl.prototype),Object.defineProperty(kl,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===kl&&kl.isRecordBatch(e)}});function Al(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){let r=[...e.fields],i=[...t],a=(n+63&-64)>>3;for(let[o,s]of e.fields.entries()){let e=t[o];(!e||e.length!==n)&&(r[o]=s.clone({nullable:!0}),i[o]=e?._changeLengthAndBackfillNullBitmap(n)??B({type:s.type,length:n,nullCount:n,nullBitmap:new Uint8Array(a)}))}return[e.assign(r),B({type:new M(r),length:n,children:i})]}function jl(e,t,n=new Map){if((e?.length??0)>0&&e?.length===t?.length)for(let r=-1,i=e.length;++r<i;){let{type:i}=e[r],a=t[r];for(let e of[a,...a?.dictionary?.data||[]])jl(i.children,e?.children,n);if(A.isDictionary(i)){let{id:e}=i;if(!n.has(e))a?.dictionary&&n.set(e,a.dictionary);else if(n.get(e)!==a.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}}return n}var Ml=class extends kl{constructor(e,t){let n=e.fields.map(e=>B({type:e.type})),r=B({type:new M(e.fields),length:0,nullCount:0,children:n});super(e,r,t||new Map)}};const Nl=e=>`Expected ${D[e]} Message in stream, but was null or length 0.`,Pl=e=>`Header pointer of flatbuffer-encoded ${D[e]} Message is null or length 0.`,Fl=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Il=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;var Ll=class{constructor(e){this.source=e instanceof Lc?e:new Lc(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?J:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Nl(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=b(this.source.read(e));if(t.byteLength<e)throw Error(Il(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=D.Schema,n=this.readMessage(t)?.header();if(e&&!n)throw Error(Pl(t));return n}readMetadataLength(){let e=this.source.read(4),t=(e&&new Tn(e))?.readInt32(0)||0;return{done:t===0,value:t}}readMetadata(e){let t=this.source.read(e);if(!t)return J;if(t.byteLength<e)throw Error(Fl(e,t.byteLength));return{done:!1,value:tc.decode(t)}}},Rl=class{constructor(e,t){this.source=e instanceof Rc?e:Gt(e)?new Hc(e,t):new Rc(e)}[Symbol.asyncIterator](){return this}next(){return g(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?J:e})}throw(e){return g(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return g(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return g(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Nl(e));return t.value})}readMessageBody(e){return g(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array;let t=b(yield this.source.read(e));if(t.byteLength<e)throw Error(Il(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return g(this,arguments,void 0,function*(e=!1){let t=D.Schema,n=(yield this.readMessage(t))?.header();if(e&&!n)throw Error(Pl(t));return n})}readMetadataLength(){return g(this,void 0,void 0,function*(){let e=yield this.source.read(4),t=(e&&new Tn(e))?.readInt32(0)||0;return{done:t===0,value:t}})}readMetadata(e){return g(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return J;if(t.byteLength<e)throw Error(Fl(e,t.byteLength));return{done:!1,value:tc.decode(t)}})}},zl=class extends Ll{constructor(e){super(new Uint8Array),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof Nc?e:new Nc(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:tc.fromJSON(e.schema,D.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:tc.fromJSON(t,D.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:tc.fromJSON(t,D.RecordBatch)}}return this._body=[],J}readMessageBody(e){return t(this._body);function t(e){return(e||[]).reduce((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...n.VIEWS&&[n.VIEWS]||[],...n.VARIADIC_DATA_BUFFERS||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Nl(e));return t.value}readSchema(){let e=D.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(Pl(e));return n}};const Bl=new Uint8Array(6);for(let e=0;e<6;e+=1)Bl[e]=`ARROW1`.codePointAt(e);function Vl(e,t=0){for(let n=-1,r=Bl.length;++n<r;)if(Bl[n]!==e[t+n])return!1;return!0}const Hl=Bl.length,Ul=Hl+4,Wl=Hl*2+4;var Gl=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)&&this._hasValidVersion(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.LZ4_FRAME_MAGIC.every((t,n)=>e[n]===t)}_hasValidVersion(e){return(e[4]&192)>>6==1}},Kl=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.ZSTD_MAGIC.every((t,n)=>e[n]===t)}};const ql={[On.LZ4_FRAME]:new Gl,[On.ZSTD]:new Kl},Jl=new class{constructor(){this.registry={}}set(e,t){if(t?.encode&&typeof t.encode==`function`&&!ql[e].isValidCodecEncode(t))throw Error(`Encoder for ${On[e]} is not valid.`);this.registry[e]=t}get(e){return this.registry?.[e]||null}};var Yl=class e extends Pc{constructor(e){super(),this._impl=e}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(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){let t=this._impl.open(e);return Bt(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return un.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return un.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(t){return t instanceof e?t:Ut(t)?lu(t):Gt(t)?fu(t):Bt(t)?g(this,void 0,void 0,function*(){return yield e.from(yield t)}):Kt(t)||Jt(t)||Yt(t)||Ht(t)?du(new Rc(t)):uu(new Lc(t))}static readAll(t){return t instanceof e?t.isSync()?su(t):cu(t):Ut(t)||ArrayBuffer.isView(t)||Vt(t)||Wt(t)?su(t):cu(t)}},Xl=class extends Yl{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return At(this,arguments,function*(){yield _(yield*jt(Mt(this[Symbol.iterator]())))})}},Zl=class extends Yl{constructor(e){super(e),this._impl=e}readAll(){return g(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=Mt(this),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Ql=class extends Xl{constructor(e){super(e),this._impl=e}},$l=class extends Zl{constructor(e){super(e),this._impl=e}},eu=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t,n){let r;if(e.compression!=null){let n=Jl.get(e.compression.type);if(n?.decode&&typeof n.decode==`function`){let{decommpressedBody:i,buffers:a}=this._decompressBuffers(e,t,n);r=this._loadCompressedVectors(e,i,this.schema.fields),e=new nc(e.length,e.nodes,a,null)}else throw Error(`Record batch is compressed but codec not found`)}else r=this._loadVectors(e,t,this.schema.fields);let i=B({type:new M(this.schema.fields),length:e.length,children:r});return new kl(this.schema,i,n)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c;if(e.data.compression!=null){let i=Jl.get(e.data.compression.type);if(i?.decode&&typeof i.decode==`function`){let{decommpressedBody:a,buffers:o}=this._decompressBuffers(e.data,t,i);c=this._loadCompressedVectors(e.data,a,[s]),e=new rc(new nc(e.data.length,e.data.nodes,o,null,e.data.variadicBufferCounts),n,r)}else throw Error(`Dictionary batch is compressed but codec not found`)}else c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new G(c)):new G(c)).memoize()}_loadVectors(e,t,n){return new Xc(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(e,t,n){return new rl(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_decompressBuffers(e,t,n){let r=[],i=[],a=0;for(let{offset:o,length:s}of e.buffers){if(s===0){r.push(new Uint8Array),i.push(new ic(a,0));continue}let e=new Tn(t.subarray(o,o+s)),c=k(e.readInt64(0)),l=e.bytes().subarray(8),u=c===-1?l:n.decode(l);r.push(u);let ee=(a+7&-8)-a;a+=ee,i.push(new ic(a,u.length)),a+=u.length}return{decommpressedBody:r,buffers:i}}},tu=class extends eu{constructor(e,t){super(t),this._reader=Ut(e)?new zl(this._handle=e):new Ll(this._handle=e)}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(e){return this.closed||(this.autoDestroy=ou(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):J}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):J}next(){if(this.closed)return J;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ml(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},nu=class extends eu{constructor(e,t){super(t),this._reader=new Rl(this._handle=e)}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(e){return g(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=ou(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return g(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):J})}return(e){return g(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):J})}next(){return g(this,void 0,void 0,function*(){if(this.closed)return J;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ml(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return g(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},ru=class extends tu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof Vc?e:new Vc(e),t)}isSync(){return!0}isFile(){return!0}open(e){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(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();let t=this._footer?.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(D.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null}_readDictionaryBatch(e){let t=this._footer?.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(D.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-Ul,n=e.readInt32(t),r=e.readAt(t-n,n);return Fs.decode(r)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer?.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}},iu=class extends nu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]==`number`?void 0:t.shift(),r=t[0]instanceof Map?t.shift():void 0;super(e instanceof Hc?e:new Hc(e,n),r)}isFile(){return!0}isAsync(){return!0}open(e){let t=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 e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return g(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let t=this._footer?.getRecordBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(D.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null})}_readDictionaryBatch(e){return g(this,void 0,void 0,function*(){let t=this._footer?.getDictionaryBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(D.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return g(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Ul,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return Fs.decode(r)})}_readNextMessageAndValidate(e){return g(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}},au=class extends tu{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new Zc(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}};function ou(e,t){return t&&typeof t.autoDestroy==`boolean`?t.autoDestroy:e.autoDestroy}function*su(e){let t=Yl.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function cu(e){return At(this,arguments,function*(){let t=yield _(Yl.from(e));try{if(!(yield _(t.open({autoDestroy:!1}))).closed)do yield yield _(t);while(!(yield _(t.reset().open())).closed)}finally{yield _(t.cancel())}})}function lu(e){return new Xl(new au(e))}function uu(e){let t=e.peek(Hl+7&-8);return t&&t.byteLength>=4?Vl(t)?new Ql(new ru(e.read())):new Xl(new tu(e)):new Xl(new tu(function*(){}()))}function du(e){return g(this,void 0,void 0,function*(){let t=yield e.peek(Hl+7&-8);return t&&t.byteLength>=4?Vl(t)?new Ql(new ru(yield e.read())):new Zl(new nu(e)):new Zl(new nu(function(){return At(this,arguments,function*(){})}()))})}function fu(e){return g(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Hc(e,t);return t>=Wl&&Vl(yield n.readAt(0,Hl+7&-8))?new $l(new iu(n)):new Zl(new nu(n))})}function pu(e){let t=Yl.from(e);return Bt(t)?t.then(e=>pu(e)):t.isAsync()?t.readAll().then(e=>new El(e)):new El(t.readAll())}function mu(e){return e===`observation.image`||e.startsWith(`observation.images`)}function hu(e){return e.filter(mu)}let gu=!1,_u=null,vu=null,yu=null;const bu=new Promise((e,t)=>{vu=e,yu=t});let Q=null;const $=new Map;function xu(e){let t=$.get(e);if(t)return $.delete(e),$.set(e,t),t}function Su(e,t){if($.has(e)){let t=$.get(e);$.delete(e);try{t?.close()}catch{}}for($.set(e,t);$.size>24;){let e=$.keys().next().value;if(e===void 0)break;let t=$.get(e);$.delete(e);try{t?.close()}catch{}}}function Cu(){for(let e of $.values())try{e.close()}catch{}$.clear()}let wu=0,Tu=null;self.onmessage=async e=>{let{type:t}=e.data;if(t===`init-wasm`){vu?.(e.data.wasmBuffer);return}if(t===`init-wasm-error`){yu?.(Error(`Main thread failed to load WASM: ${String(e.data.message)}`));return}if(t===`preload-episode`){let{episodeKey:t,column:n,startRow:r,endRow:i,reqId:a}=e.data;try{if(await Du(),Tu=t,!Q){self.postMessage({type:`preload-error`,reqId:a,error:`No file loaded`});return}let e=Q.columns.get(n);if(!e){self.postMessage({type:`preload-error`,reqId:a,error:`Column ${n} not found`});return}let o=Math.max(0,i-r),s=Math.min(o,8),c=0,l=0;for(let i=0;i<s;i++){if(Tu!==t){self.postMessage({type:`preload-aborted`,reqId:a});return}let o=r+i,u=Ou(e.get(o));if(!u){l++;continue}if(c+=u.byteLength,c>67108864)break;try{let e=`${n}:${i}`;$.has(e)||Su(e,await createImageBitmap(new Blob([ku(u)],{type:`image/jpeg`})))}catch{}l++,(l%4==0||l===s)&&self.postMessage({type:`preload-progress`,reqId:a,completed:l,total:s})}self.postMessage({type:`preload-done`,reqId:a,total:l})}catch(e){self.postMessage({type:`preload-error`,reqId:a,error:e instanceof Error?e.message:String(e)})}return}if(t===`get-frame-bitmap`){let{column:t,relRow:n,startRow:r,reqId:i}=e.data;try{if(await Du(),!Q){self.postMessage({type:`frame-bitmap-miss`,reqId:i,reason:`no-file`});return}let e=Q.columns.get(t);if(!e){self.postMessage({type:`frame-bitmap-miss`,reqId:i,reason:`no-column`});return}let a=`${t}:${n}`,o=xu(a);if(o)$.delete(a);else{let t=Ou(e.get(r+n));if(!t){self.postMessage({type:`frame-bitmap-miss`,reqId:i,reason:`no-bytes`});return}o=await createImageBitmap(new Blob([ku(t)],{type:`image/jpeg`}))}self.postMessage({type:`frame-bitmap`,reqId:i,bitmap:o},[o]),Eu(t,n,r,e)}catch(e){self.postMessage({type:`frame-bitmap-error`,reqId:i,error:e instanceof Error?e.message:String(e)})}return}if(t===`clear-preload`){Cu(),Tu=null,wu++,self.postMessage({type:`clear-preload-done`});return}};function Eu(e,t,n,r){let i=++wu;(async()=>{for(let a=1;a<=4;a++){if(i!==wu)return;let o=t+a,s=`${e}:${o}`;if(!$.has(s)){try{let e=Ou(r.get(n+o));if(!e)continue;let t=await createImageBitmap(new Blob([ku(e)],{type:`image/jpeg`}));if(i!==wu){try{t.close()}catch{}return}Su(s,t)}catch{}await new Promise(e=>setTimeout(e,0))}}})()}async function Du(){if(!gu)return _u||(_u=(async()=>{try{await Ot(await bu),gu=!0}catch(e){throw console.error(`Worker: Failed to initialize WASM`,e),_u=null,e}})(),_u)}function Ou(e){if(!e)return null;if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(typeof e==`object`&&e){let t=e;if(`bytes`in t){let e=t.bytes;if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer||Array.isArray(e))return new Uint8Array(e)}if(`data`in t&&t.data instanceof Uint8Array)return t.data}return null}function ku(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}c({async init(){await Du()},async loadFile(e,t,n){await Du();let r=new Uint8Array(t),i=n?.filter(Boolean)??[];if(i.length===0&&(i=hu(pu(Fe(r).intoIPCStream()).schema.fields.map(e=>e.name))),i.length===0)throw Error(`No image columns requested or detected. Expected 'observation.image' or 'observation.images.*'`);let a=pu(Fe(r,{columns:i}).intoIPCStream()),o=new Map;for(let e of i){let t=a.getChild(e);t&&o.set(e,t)}(!Q||Q.filePath!==e)&&Cu();let s=Array.from(o.keys());return Q={filePath:e,columns:o,requestedColumns:i,numRows:a.numRows},{columns:s,numRows:a.numRows}},async getImageCached(e,t){if(!Q)throw Error(`No file loaded`);let n=Q.columns.get(e);if(!n)throw Error(`Column ${e} not found in file ${Q.filePath}. Requested: ${Q.requestedColumns.join(`, `)||`(none)`}. Available: ${Array.from(Q.columns.keys()).join(`, `)||`(none)`}`);if(t<0||t>=Q.numRows)throw Error(`Row ${t} out of range [0, ${Q.numRows-1}]`);let r=Ou(n.get(t));if(!r)throw Error(`No image data at row ${t} for column ${e}`);let i=new Uint8Array(r.length);return i.set(r),de(i.buffer,[i.buffer])},async clearCache(){Q=null,Cu(),Tu=null,wu++}});
|