diff --git a/isamples_export_client/__main__.py b/isamples_export_client/__main__.py index 3a25557..1954255 100644 --- a/isamples_export_client/__main__.py +++ b/isamples_export_client/__main__.py @@ -1,5 +1,3 @@ -from typing import Optional - import click import logging import multiprocessing @@ -121,9 +119,8 @@ def refresh(jwt: str, refresh_dir: str): help=("The port to start the server on."), default=8000 ) -def server(download_dir: str, ui_dir: str, browser_dir: Optional[str], port: int): - """Run a local web server to view exported data. - """ +def server(download_dir: str, ui_dir: str, browser_dir: typing.Optional[str], port: int): + """Run a local web server to view exported data.""" def openBrowser(): url = f"http://localhost:{port}/" logging.info(f"Opening browser at {url}...") diff --git a/isamples_export_client/ui/_import/sample.2f6689b3.js b/isamples_export_client/ui/_import/sample.2f6689b3.js deleted file mode 100644 index 31924ea..0000000 --- a/isamples_export_client/ui/_import/sample.2f6689b3.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Implements a module for displaying sample locations on a leaflet map using the GL extension. - * - * The WebGL approach is preferred when a large number of features are to be rendered. - */ - -export class Samples { - - constructor(db) { - this._db = db; - } - - async init(data_source_url){ - await this._db.query("DROP TABLE IF EXISTS samples;") - let q = `CREATE TABLE samples AS SELECT * FROM '${data_source_url}'`; - if (data_source_url.endsWith(".jsonl")) { - q = `CREATE TABLE samples AS SELECT * FROM read_json_auto('${data_source_url}', format='newline_delimited')`; - } - if (data_source_url.endsWith(".parquet")) { - q = `CREATE TABLE samples AS SELECT * FROM read_parquet('${data_source_url}')`; - } - try { - return this._db.query(q); - } catch (e) { - console.log(e); - } - } - - get totalRecords() { - const q = 'SELECT COUNT(*) as n FROM samples;'; - return this._db.queryRow(q).then((res) => { - return res.n - }).catch((e) => { - console.log(e); - return 0; - }); - } - - async allRows(){ - const q = 'SELECT sample_identifier as pid, label, source_collection FROM samples;'; - return this._db.query(q); - } - - async getRecordsByBB(bb) { - /* - Returns x,y,pid of samples within bounding box of - [min_x, min_y, max_x, max_y] - */ - const q = `select - produced_by.sampling_site.sample_location.longitude as x, - produced_by.sampling_site.sample_location.latitude as y, - source_collection as source, - sample_identifier as pid from samples - where x>=${bb[0]} and x<=${bb[2]} and y>=${bb[1]} and y<=${bb[2]};`; - return this._db.query(q); - } - - async getRecord(pid) { - const q = "SELECT * FROM samples WHERE sample_identifier=?"; - return this._db.query(q, pid); - } - - async getRecordsById(pid) { - /* - Returns records that have the same location as the record with the specified identifier. - */ - // TODO: fuzziness should be a function of zoom level. - const dx = 0.001; - const dy = 0.001; - const q = `select sample_identifier, source_collection, label from samples s - inner join (select produced_by.sampling_site.sample_location.longitude as x, - produced_by.sampling_site.sample_location.latitude as y from samples - where sample_identifier='${pid}') sm - on s.produced_by.sampling_site.sample_location.longitude>=sm.x-${dx} - and s.produced_by.sampling_site.sample_location.longitude<=sm.x+${dx} - and produced_by.sampling_site.sample_location.latitude>=sm.y-${dy} - and produced_by.sampling_site.sample_location.latitude<=sm.y+${dy};`; - return this._db.query(q); - } -} - diff --git a/isamples_export_client/ui/_import/sample.7389c5f6.js b/isamples_export_client/ui/_import/sample.da41fe32.js similarity index 98% rename from isamples_export_client/ui/_import/sample.7389c5f6.js rename to isamples_export_client/ui/_import/sample.da41fe32.js index 4c00a81..ddb3bb8 100644 --- a/isamples_export_client/ui/_import/sample.7389c5f6.js +++ b/isamples_export_client/ui/_import/sample.da41fe32.js @@ -16,7 +16,7 @@ export class Samples { if (data_source_url.endsWith(".jsonl")) { q = `CREATE TABLE samples AS SELECT * FROM read_json_auto('${data_source_url}', format='newline_delimited')`; } - if (data_source_url.endsWith(".parquet")) { + if (data_source_url.includes(".parquet")) { q = `CREATE TABLE samples AS SELECT * FROM read_parquet('${data_source_url}')`; } try { diff --git a/isamples_export_client/ui/_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/_esm.js b/isamples_export_client/ui/_npm/@duckdb/duckdb-wasm@1.28.0/_esm.js similarity index 51% rename from isamples_export_client/ui/_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/_esm.js rename to isamples_export_client/ui/_npm/@duckdb/duckdb-wasm@1.28.0/_esm.js index 0519cbf..003fe02 100644 --- a/isamples_export_client/ui/_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/_esm.js +++ b/isamples_export_client/ui/_npm/@duckdb/duckdb-wasm@1.28.0/_esm.js @@ -1,7 +1,7 @@ /** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. - * Original file: /npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/dist/duckdb-browser.mjs + * Original file: /npm/@duckdb/duckdb-wasm@1.28.0/dist/duckdb-browser.mjs * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -import*as e from"../../apache-arrow@16.1.0/_esm.js";var s=Object.create;var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty;var o=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports);var d=(e,s,n,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of r(s))!i.call(e,d)&&d!==n&&t(e,d,{get:()=>s[d],enumerable:!(o=a(s,d))||o.enumerable});return e};var c=(e,a,r)=>(r=e!=null?s(n(e)):{},d(a||!e||!e.__esModule?t(r,"default",{value:e,enumerable:!0}):r,e));var E=o(((e,s)=>{s.exports=Worker}));var l=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(l||{});var _=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(_||{});var u=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(u||{}),T=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(T||{}),R=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(R||{}),p=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(p||{}),h=class{log(e){}},I=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};function m(e){switch(e){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function b(e){switch(e){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function S(e){switch(e){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function g(e){switch(e){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var N=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(N||{});var y=class{constructor(e,s){this._bindings=e,this._conn=s}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(s){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:s});let t=await this._bindings.runQuery(this._conn,s),a=e.RecordBatchReader.from(t);return console.assert(a.isSync(),"Reader is not sync"),console.assert(a.isFile(),"Reader is not file"),new e.Table(a)}async send(s){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:s});let t=await this._bindings.startPendingQuery(this._conn,s);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let a=new k(this._bindings,this._conn,t),r=await e.RecordBatchReader.from(a);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let s=await this._bindings.createPrepared(this._conn,e);return new O(this._bindings,this._conn,s)}async insertArrowTable(s,t){let a=e.tableToIPC(s,"stream");await this.insertArrowFromIPCStream(a,t)}async insertArrowFromIPCStream(e,s){await this._bindings.insertArrowFromIPCStream(this._conn,e,s)}async insertCSVFromPath(e,s){await this._bindings.insertCSVFromPath(this._conn,e,s)}async insertJSONFromPath(e,s){await this._bindings.insertJSONFromPath(this._conn,e,s)}},k=class{constructor(e,s,t){this.db=e;this.conn=s;this.header=t;this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},O=class{constructor(e,s,t){this.bindings=e,this.connectionId=s,this.statementId=t}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...s){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,s),a=e.RecordBatchReader.from(t);return console.assert(a.isSync()),console.assert(a.isFile()),new e.Table(a)}async send(...s){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,s),a=new k(this.bindings,this.connectionId,t),r=await e.RecordBatchReader.from(a);return console.assert(r.isAsync()),console.assert(r.isStream()),r}};var w=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(w||{}),A=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(A||{}),F=class{constructor(e,s){this.promiseResolver=()=>{};this.promiseRejecter=()=>{};this.type=e,this.data=s,this.promise=new Promise(((e,s)=>{this.promiseResolver=e,this.promiseRejecter=s}))}};function P(s){switch(s.typeId){case e.Type.Binary:return{sqlType:"binary"};case e.Type.Bool:return{sqlType:"bool"};case e.Type.Date:return{sqlType:"date"};case e.Type.DateDay:return{sqlType:"date32[d]"};case e.Type.DateMillisecond:return{sqlType:"date64[ms]"};case e.Type.Decimal:{let e=s;return{sqlType:"decimal",precision:e.precision,scale:e.scale}}case e.Type.Float:return{sqlType:"float"};case e.Type.Float16:return{sqlType:"float16"};case e.Type.Float32:return{sqlType:"float32"};case e.Type.Float64:return{sqlType:"float64"};case e.Type.Int:return{sqlType:"int32"};case e.Type.Int16:return{sqlType:"int16"};case e.Type.Int32:return{sqlType:"int32"};case e.Type.Int64:return{sqlType:"int64"};case e.Type.Uint16:return{sqlType:"uint16"};case e.Type.Uint32:return{sqlType:"uint32"};case e.Type.Uint64:return{sqlType:"uint64"};case e.Type.Uint8:return{sqlType:"uint8"};case e.Type.IntervalDayTime:return{sqlType:"interval[dt]"};case e.Type.IntervalYearMonth:return{sqlType:"interval[m]"};case e.Type.List:return{sqlType:"list",valueType:P(s.valueType)};case e.Type.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:s.byteWidth};case e.Type.Null:return{sqlType:"null"};case e.Type.Utf8:return{sqlType:"utf8"};case e.Type.Struct:return{sqlType:"struct",fields:s.children.map((e=>L(e.name,e.type)))};case e.Type.Map:{let e=s;return{sqlType:"map",keyType:P(e.keyType),valueType:P(e.valueType)}}case e.Type.Time:return{sqlType:"time[s]"};case e.Type.TimeMicrosecond:return{sqlType:"time[us]"};case e.Type.TimeMillisecond:return{sqlType:"time[ms]"};case e.Type.TimeNanosecond:return{sqlType:"time[ns]"};case e.Type.TimeSecond:return{sqlType:"time[s]"};case e.Type.Timestamp:return{sqlType:"timestamp",timezone:s.timezone||void 0};case e.Type.TimestampSecond:return{sqlType:"timestamp[s]",timezone:s.timezone||void 0};case e.Type.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:s.timezone||void 0};case e.Type.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:s.timezone||void 0};case e.Type.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:s.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(s.toString()))}function L(e,s){let t=P(s);return t.name=e,t}var C=new TextEncoder,U=class{constructor(e,s=null){this._onInstantiationProgress=[];this._worker=null;this._workerShutdownPromise=null;this._workerShutdownResolver=()=>{};this._nextMessageId=0;this._pendingRequests=new Map;this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),s!=null&&this.attach(s)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise(((e,s)=>{this._workerShutdownResolver=e}))}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,s=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let t=this._nextMessageId++;return this._pendingRequests.set(t,e),this._worker.postMessage({messageId:t,type:e.type,data:e.data},s),await e.promise}onMessage(e){var s;let t=e.data;switch(t.type){case"LOG":{this._logger.log(t.data);return}case"INSTANTIATE_PROGRESS":{for(let e of this._onInstantiationProgress)e(t.data);return}}let a=this._pendingRequests.get(t.requestId);if(!a){console.warn("unassociated response: [".concat(t.requestId,", ").concat(t.type.toString(),"]"));return}if(this._pendingRequests.delete(t.requestId),t.type=="ERROR"){let e=new Error(t.data.message);e.name=t.data.name,(s=Object.getOwnPropertyDescriptor(e,"stack"))!=null&&s.writable&&(e.stack=t.data.stack),a.promiseRejecter(e);return}switch(a.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(t.type=="OK"){a.promiseResolver(t.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],t.type=="OK"){a.promiseResolver(t.data);return}break;case"GLOB_FILE_INFOS":if(t.type=="FILE_INFOS"){a.promiseResolver(t.data);return}break;case"GET_VERSION":if(t.type=="VERSION_STRING"){a.promiseResolver(t.data);return}break;case"GET_FEATURE_FLAGS":if(t.type=="FEATURE_FLAGS"){a.promiseResolver(t.data);return}break;case"GET_TABLE_NAMES":if(t.type=="TABLE_NAMES"){a.promiseResolver(t.data);return}break;case"TOKENIZE":if(t.type=="SCRIPT_TOKENS"){a.promiseResolver(t.data);return}break;case"COPY_FILE_TO_BUFFER":if(t.type=="FILE_BUFFER"){a.promiseResolver(t.data);return}break;case"EXPORT_FILE_STATISTICS":if(t.type=="FILE_STATISTICS"){a.promiseResolver(t.data);return}break;case"CONNECT":if(t.type=="CONNECTION_INFO"){a.promiseResolver(t.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(t.type=="QUERY_RESULT"){a.promiseResolver(t.data);return}break;case"SEND_PREPARED":if(t.type=="QUERY_RESULT_HEADER"){a.promiseResolver(t.data);return}break;case"START_PENDING_QUERY":if(t.type=="QUERY_RESULT_HEADER_OR_NULL"){a.promiseResolver(t.data);return}break;case"POLL_PENDING_QUERY":if(t.type=="QUERY_RESULT_HEADER_OR_NULL"){a.promiseResolver(t.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],t.type=="SUCCESS"){a.promiseResolver(t.data);return}break;case"FETCH_QUERY_RESULTS":if(t.type=="QUERY_RESULT_CHUNK"){a.promiseResolver(t.data);return}break;case"CREATE_PREPARED":if(t.type=="PREPARED_STATEMENT_ID"){a.promiseResolver(t.data);return}break}a.promiseRejecter(new Error("unexpected response type: ".concat(t.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new F("RESET",null);return await this.postTask(e)}async ping(){let e=new F("PING",null);await this.postTask(e)}async dropFile(e){let s=new F("DROP_FILE",e);return await this.postTask(s)}async dropFiles(){let e=new F("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new F("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,s=null,t=(e=>{})){this._onInstantiationProgress.push(t);let a=new F("INSTANTIATE",[e,s]);return await this.postTask(a)}async getVersion(){let e=new F("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new F("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let s=new F("OPEN",e);await this.postTask(s)}async tokenize(e){let s=new F("TOKENIZE",e);return await this.postTask(s)}async connectInternal(){let e=new F("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new y(this,e)}async disconnect(e){let s=new F("DISCONNECT",e);await this.postTask(s)}async runQuery(e,s){let t=new F("RUN_QUERY",[e,s]);return await this.postTask(t)}async startPendingQuery(e,s){let t=new F("START_PENDING_QUERY",[e,s]);return await this.postTask(t)}async pollPendingQuery(e){let s=new F("POLL_PENDING_QUERY",e);return await this.postTask(s)}async cancelPendingQuery(e){let s=new F("CANCEL_PENDING_QUERY",e);return await this.postTask(s)}async fetchQueryResults(e){let s=new F("FETCH_QUERY_RESULTS",e);return await this.postTask(s)}async getTableNames(e,s){let t=new F("GET_TABLE_NAMES",[e,s]);return await this.postTask(t)}async createPrepared(e,s){let t=new F("CREATE_PREPARED",[e,s]);return await this.postTask(t)}async closePrepared(e,s){let t=new F("CLOSE_PREPARED",[e,s]);await this.postTask(t)}async runPrepared(e,s,t){let a=new F("RUN_PREPARED",[e,s,t]);return await this.postTask(a)}async sendPrepared(e,s,t){let a=new F("SEND_PREPARED",[e,s,t]);return await this.postTask(a)}async globFiles(e){let s=new F("GLOB_FILE_INFOS",e);return await this.postTask(s)}async registerFileText(e,s){let t=C.encode(s);await this.registerFileBuffer(e,t)}async registerFileURL(e,s,t,a){s===void 0&&(s=e);let r=new F("REGISTER_FILE_URL",[e,s,t,a]);await this.postTask(r)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,s){let t=new F("REGISTER_FILE_BUFFER",[e,s]);await this.postTask(t,[s.buffer])}async registerFileHandle(e,s,t,a){let r=new F("REGISTER_FILE_HANDLE",[e,s,t,a]);await this.postTask(r,[])}async collectFileStatistics(e,s){let t=new F("COLLECT_FILE_STATISTICS",[e,s]);await this.postTask(t,[])}async exportFileStatistics(e){let s=new F("EXPORT_FILE_STATISTICS",e);return await this.postTask(s,[])}async copyFileToBuffer(e){let s=new F("COPY_FILE_TO_BUFFER",e);return await this.postTask(s)}async copyFileToPath(e,s){let t=new F("COPY_FILE_TO_PATH",[e,s]);await this.postTask(t)}async insertArrowFromIPCStream(e,s,t){if(s.length==0)return;let a=new F("INSERT_ARROW_FROM_IPC_STREAM",[e,s,t]);await this.postTask(a,[s.buffer])}async insertCSVFromPath(e,s,t){if(t.columns!==void 0){let e=[];for(let s in t.columns){let a=t.columns[s];e.push(L(s,a))}t.columnsFlat=e,delete t.columns}let a=new F("IMPORT_CSV_FROM_PATH",[e,s,t]);await this.postTask(a)}async insertJSONFromPath(e,s,t){if(t.columns!==void 0){let e=[];for(let s in t.columns){let a=t.columns[s];e.push(L(s,a))}t.columnsFlat=e,delete t.columns}let a=new F("IMPORT_JSON_FROM_PATH",[e,s,t]);await this.postTask(a)}};var f=class{constructor(){this._bindings=null;this._nextMessageId=0}log(e){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:e},[])}sendOK(e){this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"OK",data:null},[])}failWith(e,s){let t={name:s.name,message:s.message,stack:s.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"ERROR",data:t},[])}async onMessage(e){switch(e.type){case"PING":this.sendOK(e);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(e,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(e.data[0],e.data[1],(s=>{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"INSTANTIATE_PROGRESS",data:s},[])})),this.sendOK(e)}catch(s){console.log(s),this._bindings=null,this.failWith(e,s)}return}if(!this._bindings)return this.failWith(e,new Error("duckdb is not initialized"));try{switch(e.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(e);break;case"OPEN":this._bindings.open(e.data),this.sendOK(e);break;case"DROP_FILE":this._bindings.dropFile(e.data),this.sendOK(e);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(e);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(e);break;case"CONNECT":{let s=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"CONNECTION_INFO",data:s.useUnsafe(((e,s)=>s))},[]);break}case"DISCONNECT":this._bindings.disconnect(e.data),this.sendOK(e);break;case"CREATE_PREPARED":{let s=this._bindings.createPrepared(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"PREPARED_STATEMENT_ID",data:s},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(e.data[0],e.data[1]),this.sendOK(e);break}case"RUN_PREPARED":{let s=this._bindings.runPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:s},[s.buffer]);break}case"RUN_QUERY":{let s=this._bindings.runQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:s},[s.buffer]);break}case"SEND_PREPARED":{let s=this._bindings.sendPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER",data:s},[s.buffer]);break}case"START_PENDING_QUERY":{let s=this._bindings.startPendingQuery(e.data[0],e.data[1]),t=[];s&&t.push(s.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:s},t);break}case"POLL_PENDING_QUERY":{let s=this._bindings.pollPendingQuery(e.data),t=[];s&&t.push(s.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:s},t);break}case"CANCEL_PENDING_QUERY":{let s=this._bindings.cancelPendingQuery(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SUCCESS",data:s},[]);break}case"FETCH_QUERY_RESULTS":{let s=this._bindings.fetchQueryResults(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_CHUNK",data:s},[s.buffer]);break}case"GET_TABLE_NAMES":{let s=this._bindings.getTableNames(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"TABLE_NAMES",data:s},[]);break}case"GLOB_FILE_INFOS":{let s=this._bindings.globFiles(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_INFOS",data:s},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_BUFFER":{let s=this._bindings.copyFileToBuffer(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_BUFFER",data:s},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(e.data[0],e.data[1]),this.sendOK(e);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(e.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"TOKENIZE":{let s=this._bindings.tokenize(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SCRIPT_TOKENS",data:s},[]);break}}}catch(s){return console.log(s),this.failWith(e,s)}}};var D=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),v=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var M=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var G=()=>(async e=>{try{return typeof MessageChannel<"u"&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var j={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev195.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^15.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}};var q=j.name,B=j.version,Y=j.version.split("."),Q=Y[0],H=Y[1],K=Y[2];var W=()=>typeof navigator>"u",x=()=>W()?"node":navigator.userAgent,V=()=>x().includes("Firefox"),z=()=>/^((?!chrome|android).)*safari/i.test(x());function J(){let e="https://cdn.jsdelivr.net/npm/".concat(q,"@").concat(B,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var Z=null,X=null,$=null,ee=null,se=null;async function te(){return Z==null&&(Z=typeof BigInt64Array<"u"),X==null&&(X=await v()),$==null&&($=await G()),ee==null&&(ee=await M()),se==null&&(se=await D()),{bigInt64Array:Z,crossOriginIsolated:W()||globalThis.crossOriginIsolated||!1,wasmExceptions:X,wasmSIMD:ee,wasmThreads:$,wasmBulkMemory:se}}async function ae(e){let s=await te();if(s.wasmExceptions){if(s.wasmSIMD&&s.wasmThreads&&s.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var re=c(E());async function ne(e){let s=new Request(e),t=await fetch(s),a=URL.createObjectURL(await t.blob());return new re.default(a)}function ie(){let e=new TextDecoder;return s=>(typeof SharedArrayBuffer<"u"&&s.buffer instanceof SharedArrayBuffer&&(s=new Uint8Array(s)),e.decode(s))}ie();var oe=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(oe||{});export{U as AsyncDuckDB,y as AsyncDuckDBConnection,f as AsyncDuckDBDispatcher,O as AsyncPreparedStatement,k as AsyncResultStreamIterator,I as ConsoleLogger,l as DuckDBAccessMode,oe as DuckDBDataProtocol,R as LogEvent,u as LogLevel,p as LogOrigin,T as LogTopic,q as PACKAGE_NAME,B as PACKAGE_VERSION,Q as PACKAGE_VERSION_MAJOR,H as PACKAGE_VERSION_MINOR,K as PACKAGE_VERSION_PATCH,N as StatusCode,_ as TokenType,h as VoidLogger,w as WorkerRequestType,A as WorkerResponseType,F as WorkerTask,ne as createWorker,J as getJsDelivrBundles,b as getLogEventLabel,m as getLogLevelLabel,g as getLogOriginLabel,S as getLogTopicLabel,te as getPlatformFeatures,V as isFirefox,W as isNode,z as isSafari,ae as selectBundle};export default null; +import*as e from"../../apache-arrow@16.1.0/_esm.js";var s=Object.create;var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var r=Object.getOwnPropertyNames;var n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty;var o=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports);var d=(e,s,n,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let d of r(s))!i.call(e,d)&&d!==n&&t(e,d,{get:()=>s[d],enumerable:!(o=a(s,d))||o.enumerable});return e};var c=(e,a,r)=>(r=e!=null?s(n(e)):{},d(a||!e||!e.__esModule?t(r,"default",{value:e,enumerable:!0}):r,e));var E=o(((e,s)=>{s.exports=Worker}));var l=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(l||{});var _=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(_||{});var u=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(u||{}),T=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(T||{}),R=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(R||{}),p=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(p||{}),h=class{log(e){}},I=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};function m(e){switch(e){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function b(e){switch(e){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function S(e){switch(e){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function g(e){switch(e){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var y=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(y||{});var N=class{constructor(e,s){this._bindings=e,this._conn=s}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(s){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:s});let t=await this._bindings.runQuery(this._conn,s),a=e.RecordBatchReader.from(t);return console.assert(a.isSync(),"Reader is not sync"),console.assert(a.isFile(),"Reader is not file"),new e.Table(a)}async send(s){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:s});let t=await this._bindings.startPendingQuery(this._conn,s);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let a=new k(this._bindings,this._conn,t),r=await e.RecordBatchReader.from(a);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let s=await this._bindings.createPrepared(this._conn,e);return new O(this._bindings,this._conn,s)}async insertArrowTable(s,t){let a=e.tableToIPC(s,"stream");await this.insertArrowFromIPCStream(a,t)}async insertArrowFromIPCStream(e,s){await this._bindings.insertArrowFromIPCStream(this._conn,e,s)}async insertCSVFromPath(e,s){await this._bindings.insertCSVFromPath(this._conn,e,s)}async insertJSONFromPath(e,s){await this._bindings.insertJSONFromPath(this._conn,e,s)}},k=class{constructor(e,s,t){this.db=e;this.conn=s;this.header=t;this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},O=class{constructor(e,s,t){this.bindings=e,this.connectionId=s,this.statementId=t}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...s){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,s),a=e.RecordBatchReader.from(t);return console.assert(a.isSync()),console.assert(a.isFile()),new e.Table(a)}async send(...s){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,s),a=new k(this.bindings,this.connectionId,t),r=await e.RecordBatchReader.from(a);return console.assert(r.isAsync()),console.assert(r.isStream()),r}};var w=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(w||{}),F=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(F||{}),A=class{constructor(e,s){this.promiseResolver=()=>{};this.promiseRejecter=()=>{};this.type=e,this.data=s,this.promise=new Promise(((e,s)=>{this.promiseResolver=e,this.promiseRejecter=s}))}};function P(s){switch(s.typeId){case e.Type.Binary:return{sqlType:"binary"};case e.Type.Bool:return{sqlType:"bool"};case e.Type.Date:return{sqlType:"date"};case e.Type.DateDay:return{sqlType:"date32[d]"};case e.Type.DateMillisecond:return{sqlType:"date64[ms]"};case e.Type.Decimal:{let e=s;return{sqlType:"decimal",precision:e.precision,scale:e.scale}}case e.Type.Float:return{sqlType:"float"};case e.Type.Float16:return{sqlType:"float16"};case e.Type.Float32:return{sqlType:"float32"};case e.Type.Float64:return{sqlType:"float64"};case e.Type.Int:return{sqlType:"int32"};case e.Type.Int16:return{sqlType:"int16"};case e.Type.Int32:return{sqlType:"int32"};case e.Type.Int64:return{sqlType:"int64"};case e.Type.Uint16:return{sqlType:"uint16"};case e.Type.Uint32:return{sqlType:"uint32"};case e.Type.Uint64:return{sqlType:"uint64"};case e.Type.Uint8:return{sqlType:"uint8"};case e.Type.IntervalDayTime:return{sqlType:"interval[dt]"};case e.Type.IntervalYearMonth:return{sqlType:"interval[m]"};case e.Type.List:return{sqlType:"list",valueType:P(s.valueType)};case e.Type.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:s.byteWidth};case e.Type.Null:return{sqlType:"null"};case e.Type.Utf8:return{sqlType:"utf8"};case e.Type.Struct:return{sqlType:"struct",fields:s.children.map((e=>L(e.name,e.type)))};case e.Type.Map:{let e=s;return{sqlType:"map",keyType:P(e.keyType),valueType:P(e.valueType)}}case e.Type.Time:return{sqlType:"time[s]"};case e.Type.TimeMicrosecond:return{sqlType:"time[us]"};case e.Type.TimeMillisecond:return{sqlType:"time[ms]"};case e.Type.TimeNanosecond:return{sqlType:"time[ns]"};case e.Type.TimeSecond:return{sqlType:"time[s]"};case e.Type.Timestamp:return{sqlType:"timestamp",timezone:s.timezone||void 0};case e.Type.TimestampSecond:return{sqlType:"timestamp[s]",timezone:s.timezone||void 0};case e.Type.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:s.timezone||void 0};case e.Type.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:s.timezone||void 0};case e.Type.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:s.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(s.toString()))}function L(e,s){let t=P(s);return t.name=e,t}var C=new TextEncoder,U=class{constructor(e,s=null){this._onInstantiationProgress=[];this._worker=null;this._workerShutdownPromise=null;this._workerShutdownResolver=()=>{};this._nextMessageId=0;this._pendingRequests=new Map;this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),s!=null&&this.attach(s)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise(((e,s)=>{this._workerShutdownResolver=e}))}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,s=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let t=this._nextMessageId++;return this._pendingRequests.set(t,e),this._worker.postMessage({messageId:t,type:e.type,data:e.data},s),await e.promise}onMessage(e){var s;let t=e.data;switch(t.type){case"LOG":{this._logger.log(t.data);return}case"INSTANTIATE_PROGRESS":{for(let e of this._onInstantiationProgress)e(t.data);return}}let a=this._pendingRequests.get(t.requestId);if(!a){console.warn("unassociated response: [".concat(t.requestId,", ").concat(t.type.toString(),"]"));return}if(this._pendingRequests.delete(t.requestId),t.type=="ERROR"){let e=new Error(t.data.message);e.name=t.data.name,(s=Object.getOwnPropertyDescriptor(e,"stack"))!=null&&s.writable&&(e.stack=t.data.stack),a.promiseRejecter(e);return}switch(a.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(t.type=="OK"){a.promiseResolver(t.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],t.type=="OK"){a.promiseResolver(t.data);return}break;case"GLOB_FILE_INFOS":if(t.type=="FILE_INFOS"){a.promiseResolver(t.data);return}break;case"GET_VERSION":if(t.type=="VERSION_STRING"){a.promiseResolver(t.data);return}break;case"GET_FEATURE_FLAGS":if(t.type=="FEATURE_FLAGS"){a.promiseResolver(t.data);return}break;case"GET_TABLE_NAMES":if(t.type=="TABLE_NAMES"){a.promiseResolver(t.data);return}break;case"TOKENIZE":if(t.type=="SCRIPT_TOKENS"){a.promiseResolver(t.data);return}break;case"COPY_FILE_TO_BUFFER":if(t.type=="FILE_BUFFER"){a.promiseResolver(t.data);return}break;case"EXPORT_FILE_STATISTICS":if(t.type=="FILE_STATISTICS"){a.promiseResolver(t.data);return}break;case"CONNECT":if(t.type=="CONNECTION_INFO"){a.promiseResolver(t.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(t.type=="QUERY_RESULT"){a.promiseResolver(t.data);return}break;case"SEND_PREPARED":if(t.type=="QUERY_RESULT_HEADER"){a.promiseResolver(t.data);return}break;case"START_PENDING_QUERY":if(t.type=="QUERY_RESULT_HEADER_OR_NULL"){a.promiseResolver(t.data);return}break;case"POLL_PENDING_QUERY":if(t.type=="QUERY_RESULT_HEADER_OR_NULL"){a.promiseResolver(t.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],t.type=="SUCCESS"){a.promiseResolver(t.data);return}break;case"FETCH_QUERY_RESULTS":if(t.type=="QUERY_RESULT_CHUNK"){a.promiseResolver(t.data);return}break;case"CREATE_PREPARED":if(t.type=="PREPARED_STATEMENT_ID"){a.promiseResolver(t.data);return}break}a.promiseRejecter(new Error("unexpected response type: ".concat(t.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new A("RESET",null);return await this.postTask(e)}async ping(){let e=new A("PING",null);await this.postTask(e)}async dropFile(e){let s=new A("DROP_FILE",e);return await this.postTask(s)}async dropFiles(){let e=new A("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new A("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,s=null,t=(e=>{})){this._onInstantiationProgress.push(t);let a=new A("INSTANTIATE",[e,s]);return await this.postTask(a)}async getVersion(){let e=new A("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new A("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let s=new A("OPEN",e);await this.postTask(s)}async tokenize(e){let s=new A("TOKENIZE",e);return await this.postTask(s)}async connectInternal(){let e=new A("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new N(this,e)}async disconnect(e){let s=new A("DISCONNECT",e);await this.postTask(s)}async runQuery(e,s){let t=new A("RUN_QUERY",[e,s]);return await this.postTask(t)}async startPendingQuery(e,s){let t=new A("START_PENDING_QUERY",[e,s]);return await this.postTask(t)}async pollPendingQuery(e){let s=new A("POLL_PENDING_QUERY",e);return await this.postTask(s)}async cancelPendingQuery(e){let s=new A("CANCEL_PENDING_QUERY",e);return await this.postTask(s)}async fetchQueryResults(e){let s=new A("FETCH_QUERY_RESULTS",e);return await this.postTask(s)}async getTableNames(e,s){let t=new A("GET_TABLE_NAMES",[e,s]);return await this.postTask(t)}async createPrepared(e,s){let t=new A("CREATE_PREPARED",[e,s]);return await this.postTask(t)}async closePrepared(e,s){let t=new A("CLOSE_PREPARED",[e,s]);await this.postTask(t)}async runPrepared(e,s,t){let a=new A("RUN_PREPARED",[e,s,t]);return await this.postTask(a)}async sendPrepared(e,s,t){let a=new A("SEND_PREPARED",[e,s,t]);return await this.postTask(a)}async globFiles(e){let s=new A("GLOB_FILE_INFOS",e);return await this.postTask(s)}async registerFileText(e,s){let t=C.encode(s);await this.registerFileBuffer(e,t)}async registerFileURL(e,s,t,a){s===void 0&&(s=e);let r=new A("REGISTER_FILE_URL",[e,s,t,a]);await this.postTask(r)}async registerEmptyFileBuffer(e){let s=new A("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(s)}async registerFileBuffer(e,s){let t=new A("REGISTER_FILE_BUFFER",[e,s]);await this.postTask(t,[s.buffer])}async registerFileHandle(e,s,t,a){let r=new A("REGISTER_FILE_HANDLE",[e,s,t,a]);await this.postTask(r,[])}async collectFileStatistics(e,s){let t=new A("COLLECT_FILE_STATISTICS",[e,s]);await this.postTask(t,[])}async exportFileStatistics(e){let s=new A("EXPORT_FILE_STATISTICS",e);return await this.postTask(s,[])}async copyFileToBuffer(e){let s=new A("COPY_FILE_TO_BUFFER",e);return await this.postTask(s)}async copyFileToPath(e,s){let t=new A("COPY_FILE_TO_PATH",[e,s]);await this.postTask(t)}async insertArrowFromIPCStream(e,s,t){if(s.length==0)return;let a=new A("INSERT_ARROW_FROM_IPC_STREAM",[e,s,t]);await this.postTask(a,[s.buffer])}async insertCSVFromPath(e,s,t){if(t.columns!==void 0){let e=[];for(let s in t.columns){let a=t.columns[s];e.push(L(s,a))}t.columnsFlat=e,delete t.columns}let a=new A("IMPORT_CSV_FROM_PATH",[e,s,t]);await this.postTask(a)}async insertJSONFromPath(e,s,t){if(t.columns!==void 0){let e=[];for(let s in t.columns){let a=t.columns[s];e.push(L(s,a))}t.columnsFlat=e,delete t.columns}let a=new A("IMPORT_JSON_FROM_PATH",[e,s,t]);await this.postTask(a)}};var f=class{constructor(){this._bindings=null;this._nextMessageId=0}log(e){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:e},[])}sendOK(e){this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"OK",data:null},[])}failWith(e,s){let t={name:s.name,message:s.message,stack:s.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"ERROR",data:t},[])}async onMessage(e){switch(e.type){case"PING":this.sendOK(e);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(e,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(e.data[0],e.data[1],(s=>{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"INSTANTIATE_PROGRESS",data:s},[])})),this.sendOK(e)}catch(s){console.log(s),this._bindings=null,this.failWith(e,s)}return}if(!this._bindings)return this.failWith(e,new Error("duckdb is not initialized"));try{switch(e.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(e);break;case"OPEN":this._bindings.open(e.data),this.sendOK(e);break;case"DROP_FILE":this._bindings.dropFile(e.data),this.sendOK(e);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(e);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(e);break;case"CONNECT":{let s=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"CONNECTION_INFO",data:s.useUnsafe(((e,s)=>s))},[]);break}case"DISCONNECT":this._bindings.disconnect(e.data),this.sendOK(e);break;case"CREATE_PREPARED":{let s=this._bindings.createPrepared(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"PREPARED_STATEMENT_ID",data:s},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(e.data[0],e.data[1]),this.sendOK(e);break}case"RUN_PREPARED":{let s=this._bindings.runPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:s},[s.buffer]);break}case"RUN_QUERY":{let s=this._bindings.runQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:s},[s.buffer]);break}case"SEND_PREPARED":{let s=this._bindings.sendPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER",data:s},[s.buffer]);break}case"START_PENDING_QUERY":{let s=this._bindings.startPendingQuery(e.data[0],e.data[1]),t=[];s&&t.push(s.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:s},t);break}case"POLL_PENDING_QUERY":{let s=this._bindings.pollPendingQuery(e.data),t=[];s&&t.push(s.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:s},t);break}case"CANCEL_PENDING_QUERY":{let s=this._bindings.cancelPendingQuery(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SUCCESS",data:s},[]);break}case"FETCH_QUERY_RESULTS":{let s=this._bindings.fetchQueryResults(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_CHUNK",data:s},[s.buffer]);break}case"GET_TABLE_NAMES":{let s=this._bindings.getTableNames(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"TABLE_NAMES",data:s},[]);break}case"GLOB_FILE_INFOS":{let s=this._bindings.globFiles(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_INFOS",data:s},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_BUFFER":{let s=this._bindings.copyFileToBuffer(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_BUFFER",data:s},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(e.data[0],e.data[1]),this.sendOK(e);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(e.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"TOKENIZE":{let s=this._bindings.tokenize(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SCRIPT_TOKENS",data:s},[]);break}}}catch(s){return console.log(s),this.failWith(e,s)}}};var D=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),v=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var M=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var G=()=>(async e=>{try{return typeof MessageChannel<"u"&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var j={name:"@duckdb/duckdb-wasm",version:"1.28.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^13.0.0"},devDependencies:{"@types/emscripten":"^1.39.8","@types/jasmine":"^4.3.1","@typescript-eslint/eslint-plugin":"^6.5.0","@typescript-eslint/parser":"^6.7.3",esbuild:"^0.19.5",eslint:"^8.50.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.1",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.9.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.0.2",puppeteer:"^21.1.1",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.2",typescript:"^5.2.2","wasm-feature-detect":"^1.5.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}};var q=j.name,B=j.version,Y=j.version.split("."),Q=Y[0],H=Y[1],K=Y[2];var W=()=>typeof navigator>"u",x=()=>W()?"node":navigator.userAgent,V=()=>x().includes("Firefox"),z=()=>/^((?!chrome|android).)*safari/i.test(x());function J(){let e="https://cdn.jsdelivr.net/npm/".concat(q,"@").concat(B,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var Z=null,X=null,$=null,ee=null,se=null;async function te(){return Z==null&&(Z=typeof BigInt64Array<"u"),X==null&&(X=await v()),$==null&&($=await G()),ee==null&&(ee=await M()),se==null&&(se=await D()),{bigInt64Array:Z,crossOriginIsolated:W()||globalThis.crossOriginIsolated||!1,wasmExceptions:X,wasmSIMD:ee,wasmThreads:$,wasmBulkMemory:se}}async function ae(e){let s=await te();if(s.wasmExceptions){if(s.wasmSIMD&&s.wasmThreads&&s.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var re=c(E());async function ne(e){let s=new Request(e),t=await fetch(s),a=URL.createObjectURL(await t.blob());return new re.default(a)}function ie(){let e=new TextDecoder;return s=>(typeof SharedArrayBuffer<"u"&&s.buffer instanceof SharedArrayBuffer&&(s=new Uint8Array(s)),e.decode(s))}ie();var oe=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(oe||{});export{U as AsyncDuckDB,N as AsyncDuckDBConnection,f as AsyncDuckDBDispatcher,O as AsyncPreparedStatement,k as AsyncResultStreamIterator,I as ConsoleLogger,l as DuckDBAccessMode,oe as DuckDBDataProtocol,R as LogEvent,u as LogLevel,p as LogOrigin,T as LogTopic,q as PACKAGE_NAME,B as PACKAGE_VERSION,Q as PACKAGE_VERSION_MAJOR,H as PACKAGE_VERSION_MINOR,K as PACKAGE_VERSION_PATCH,y as StatusCode,_ as TokenType,h as VoidLogger,w as WorkerRequestType,F as WorkerResponseType,A as WorkerTask,ne as createWorker,J as getJsDelivrBundles,b as getLogEventLabel,m as getLogLevelLabel,g as getLogOriginLabel,S as getLogTopicLabel,te as getPlatformFeatures,V as isFirefox,W as isNode,z as isSafari,ae as selectBundle};export default null; diff --git a/isamples_export_client/ui/_npm/apache-arrow@16.1.0/_esm.js b/isamples_export_client/ui/_npm/apache-arrow@16.1.0/_esm.js index 2b83053..000d842 100644 --- a/isamples_export_client/ui/_npm/apache-arrow@16.1.0/_esm.js +++ b/isamples_export_client/ui/_npm/apache-arrow@16.1.0/_esm.js @@ -4,4 +4,4 @@ * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -import{__asyncGenerator as t,__await as e,__asyncDelegator as i,__asyncValues as n,__awaiter as r,__rest as s}from"../tslib@2.6.2/_esm.js";import*as o from"../flatbuffers@24.3.25/_esm.js";import{ByteBuffer as a}from"../flatbuffers@24.3.25/_esm.js";const l=new TextDecoder("utf-8"),u=t=>l.decode(t),c=new TextEncoder,h=t=>c.encode(t),d=t=>"boolean"==typeof t,p=t=>"function"==typeof t,y=t=>null!=t&&Object(t)===t,f=t=>y(t)&&p(t.then),b=t=>y(t)&&p(t[Symbol.iterator]),g=t=>y(t)&&p(t[Symbol.asyncIterator]),v=t=>y(t)&&y(t.schema),_=t=>y(t)&&"done"in t&&"value"in t,m=t=>y(t)&&p(t.stat)&&(t=>"number"==typeof t)(t.fd),w=t=>y(t)&&S(t.body),I=t=>"_getDOMStream"in t&&"_getNodeStream"in t,S=t=>y(t)&&p(t.cancel)&&p(t.getReader)&&!I(t),A=t=>y(t)&&p(t.read)&&p(t.pipe)&&d(t.readable)&&!I(t),B=t=>y(t)&&p(t.clear)&&p(t.bytes)&&p(t.position)&&p(t.setPosition)&&p(t.capacity)&&p(t.getBufferIdentifier)&&p(t.createLong),D="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function T(t,e,i=0,n=e.byteLength){const r=t.byteLength,s=new Uint8Array(t.buffer,t.byteOffset,r),o=new Uint8Array(e.buffer,e.byteOffset,Math.min(n,r));return s.set(o,i),t}function O(t,e){const i=function(t){const e=t[0]?[t[0]]:[];let i,n,r,s;for(let o,a,l=0,u=0,c=t.length;++lt+e.byteLength),0);let r,s,o,a=0,l=-1;const u=Math.min(e||Number.POSITIVE_INFINITY,n);for(const t=i.length;++lL(Int32Array,t),M=t=>L(BigInt64Array,t),F=t=>L(Uint8Array,t),N=t=>(t.next(),t);function*U(t,e){const i=function*(t){yield t},n="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof D?i(e):b(e)?e:i(e);return yield*N(function*(e){let i=null;do{i=e.next(yield L(t,i))}while(!i.done)}(n[Symbol.iterator]())),new t}const C=t=>U(Uint8Array,t);function E(r,s){return t(this,arguments,(function*(){if(f(s))return yield e(yield e(yield*i(n(E(r,yield e(s))))));const o=function(i){return t(this,arguments,(function*(){yield yield e(yield e(i))}))},a="string"==typeof s||ArrayBuffer.isView(s)||s instanceof ArrayBuffer||s instanceof D?o(s):b(s)?function(r){return t(this,arguments,(function*(){yield e(yield*i(n(N(function*(t){let e=null;do{e=t.next(yield null==e?void 0:e.value)}while(!e.done)}(r[Symbol.iterator]())))))}))}(s):g(s)?s:o(s);return yield e(yield*i(n(N(function(i){return t(this,arguments,(function*(){let t=null;do{t=yield e(i.next(yield yield e(L(r,t))))}while(!t.done)}))}(a[Symbol.asyncIterator]()))))),yield e(new r)}))}const V=t=>E(Uint8Array,t);function R(t,e,i){if(0!==t)for(let n=-1,r=(i=i.slice(0,e)).length;++n0)do{if(t[i]!==e[i])return!1}while(++iL(Int8Array,t),toInt16Array:t=>L(Int16Array,t),toInt32Array:x,toBigInt64Array:M,toUint8Array:F,toUint16Array:t=>L(Uint16Array,t),toUint32Array:t=>L(Uint32Array,t),toBigUint64Array:t=>L(BigUint64Array,t),toFloat32Array:t=>L(Float32Array,t),toFloat64Array:t=>L(Float64Array,t),toUint8ClampedArray:t=>L(Uint8ClampedArray,t),toArrayBufferViewIterator:U,toInt8ArrayIterator:t=>U(Int8Array,t),toInt16ArrayIterator:t=>U(Int16Array,t),toInt32ArrayIterator:t=>U(Int32Array,t),toUint8ArrayIterator:C,toUint16ArrayIterator:t=>U(Uint16Array,t),toUint32ArrayIterator:t=>U(Uint32Array,t),toFloat32ArrayIterator:t=>U(Float32Array,t),toFloat64ArrayIterator:t=>U(Float64Array,t),toUint8ClampedArrayIterator:t=>U(Uint8ClampedArray,t),toArrayBufferViewAsyncIterator:E,toInt8ArrayAsyncIterator:t=>E(Int8Array,t),toInt16ArrayAsyncIterator:t=>E(Int16Array,t),toInt32ArrayAsyncIterator:t=>E(Int32Array,t),toUint8ArrayAsyncIterator:V,toUint16ArrayAsyncIterator:t=>E(Uint16Array,t),toUint32ArrayAsyncIterator:t=>E(Uint32Array,t),toFloat32ArrayAsyncIterator:t=>E(Float32Array,t),toFloat64ArrayAsyncIterator:t=>E(Float64Array,t),toUint8ClampedArrayAsyncIterator:t=>E(Uint8ClampedArray,t),rebaseValueOffsets:R,compareArrayLike:z}),j={fromIterable:t=>k(function*(t){let e,i,n,r,s=!1,o=[],a=0;function l(){return"peek"===n?O(o,r)[0]:([i,o,a]=O(o,r),i)}({cmd:n,size:r}=(yield null)||{cmd:"read",size:0});const u=C(t)[Symbol.iterator]();try{do{if(({done:e,value:i}=Number.isNaN(r-a)?u.next():u.next(r-a)),!e&&i.byteLength>0&&(o.push(i),a+=i.byteLength),e||r<=a)do{({cmd:n,size:r}=yield l())}while(rk(function(i){return t(this,arguments,(function*(){let t,n,r,s,o=!1,a=[],l=0;function u(){return"peek"===r?O(a,s)[0]:([n,a,l]=O(a,s),n)}({cmd:r,size:s}=(yield yield e(null))||{cmd:"read",size:0});const c=V(i)[Symbol.asyncIterator]();try{do{if(({done:t,value:n}=Number.isNaN(s-l)?yield e(c.next()):yield e(c.next(s-l))),!t&&n.byteLength>0&&(a.push(n),l+=n.byteLength),t||s<=l)do{({cmd:r,size:s}=yield yield e(u()))}while(sk(function(i){return t(this,arguments,(function*(){let t,n,r,s=!1,o=!1,a=[],l=0;function u(){return"peek"===n?O(a,r)[0]:([t,a,l]=O(a,r),t)}({cmd:n,size:r}=(yield yield e(null))||{cmd:"read",size:0});const c=new $(i);try{do{if(({done:s,value:t}=Number.isNaN(r-l)?yield e(c.read()):yield e(c.read(r-l))),!s&&t.byteLength>0&&(a.push(F(t)),l+=t.byteLength),s||r<=l)do{({cmd:n,size:r}=yield yield e(u()))}while(rk(function(i){return t(this,arguments,(function*(){const t=[];let n,r,s,o="error",a=!1,l=null,u=0,c=[];function h(){return"peek"===n?O(c,r)[0]:([s,c,u]=O(c,r),s)}if(({cmd:n,size:r}=(yield yield e(null))||{cmd:"read",size:0}),i.isTTY)return yield yield e(new Uint8Array(0)),yield e(null);try{t[0]=W(i,"end"),t[1]=W(i,"error");do{if(t[2]=W(i,"readable"),[o,l]=yield e(Promise.race(t.map((t=>t[2])))),"error"===o)break;if((a="end"===o)||(Number.isFinite(r-u)?(s=F(i.read(r-u)),s.byteLength0&&(c.push(s),u+=s.byteLength)),a||r<=u)do{({cmd:n,size:r}=yield yield e(h()))}while(r{for(const[e,n]of t)i.off(e,n);try{const t=i.destroy;t&&t.call(i,e),e=void 0}catch(t){e=t||e}finally{null!=e?r(e):n()}}))}}))}(i)),toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}};const k=t=>(t.next(),t);class ${constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch((()=>{}))}get closed(){return this.reader?this.reader.closed.catch((()=>{})):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return r(this,void 0,void 0,(function*(){const{reader:e,source:i}=this;e&&(yield e.cancel(t).catch((()=>{}))),i&&i.locked&&this.releaseLock()}))}read(t){return r(this,void 0,void 0,(function*(){if(0===t)return{done:null==this.reader,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=F(e)),e}))}}const W=(t,e)=>{const i=t=>n([e,t]);let n;return[e,i,new Promise((r=>(n=r)&&t.once(e,i)))]};var Y,H,G,Z,X,K,J,q,Q,tt,et,it,nt,rt,st,ot;!function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"}(Y||(Y={})),function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"}(H||(H={})),function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}(G||(G={})),function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"}(Z||(Z={})),function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"}(X||(X={})),function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"}(K||(K={})),function(t){t[t.BUFFER=0]="BUFFER"}(J||(J={})),function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"}(q||(q={}));class at{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):q.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):J.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,q.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,J.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return at.startBodyCompression(t),at.addCodec(t,e),at.addMethod(t,i),at.endBodyCompression(t)}}class lt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(null!=i?i:0)),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(null!=i?i:0)),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ct).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new ut).__init(this.bb.__vector(this.bb_pos+i)+16*t,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new lt).__init(this.bb.__vector(this.bb_pos+i)+16*t,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new at).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}}class ht{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new ct).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}}!function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(Q||(Q={})),function(t){t[t.DenseArray=0]="DenseArray"}(tt||(tt={}));class dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new dt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,i){return dt.startInt(t),dt.addBitWidth(t,e),dt.addIsSigned(t,i),dt.endInt(t)}}class pt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new dt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):tt.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,tt.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class yt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new yt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return yt.startKeyValue(t),yt.addKey(t,e),yt.addValue(t,i),yt.endKeyValue(t)}}class ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ft.startBinary(t),ft.endBinary(t)}}class bt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new bt).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return bt.startBool(t),bt.endBool(t)}}class gt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Z.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Z.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return gt.startDate(t),gt.addUnit(t,e),gt.endDate(t)}}class vt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,n){return vt.startDecimal(t),vt.addPrecision(t,e),vt.addScale(t,i),vt.addBitWidth(t,n),vt.endDecimal(t)}}class _t{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new _t).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):X.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,X.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return _t.startDuration(t),_t.addUnit(t,e),_t.endDuration(t)}}class mt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return mt.startFixedSizeBinary(t),mt.addByteWidth(t,e),mt.endFixedSizeBinary(t)}}class wt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new wt).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return wt.startFixedSizeList(t),wt.addListSize(t,e),wt.endFixedSizeList(t)}}class It{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new It).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):G.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,G.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return It.startFloatingPoint(t),It.addPrecision(t,e),It.endFloatingPoint(t)}}class St{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):K.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,K.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return St.startInterval(t),St.addUnit(t,e),St.endInterval(t)}}class At{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new At).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new At).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return At.startLargeBinary(t),At.endLargeBinary(t)}}class Bt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Bt).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Bt.startLargeUtf8(t),Bt.endLargeUtf8(t)}}class Dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Dt.startList(t),Dt.endList(t)}}class Tt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Tt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Tt.startMap(t),Tt.addKeysSorted(t,e),Tt.endMap(t)}}class Ot{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ot.startNull(t),Ot.endNull(t)}}class Lt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Lt.startStruct_(t),Lt.endStruct_(t)}}class xt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):X.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,X.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return xt.startTime(t),xt.addUnit(t,e),xt.addBitWidth(t,i),xt.endTime(t)}}class Mt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):X.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,X.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return Mt.startTimestamp(t),Mt.addUnit(t,e),Mt.addTimezone(t,i),Mt.endTimestamp(t)}}class Ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):H.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,H.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,i){return Ft.startUnion(t),Ft.addMode(t,e),Ft.addTypeIds(t,i),Ft.endUnion(t)}}class Nt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Nt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Nt).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Nt.startUtf8(t),Nt.endUtf8(t)}}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"}(et||(et={}));class Ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):et.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new pt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const i=this.bb.__offset(this.bb_pos,14);return i?(e||new Ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,16);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,et.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}}class Ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ct).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Q.Little}fields(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new Ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Q.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,i,n,r){return Ct.startSchema(t),Ct.addEndianness(t,e),Ct.addFields(t,i),Ct.addCustomMetadata(t,n),Ct.addFeatures(t,r),Ct.endSchema(t)}}!function(t){t[t.Row=0]="Row",t[t.Column=1]="Column"}(it||(it={})),function(t){t[t.NONE=0]="NONE",t[t.SparseTensorIndexCOO=1]="SparseTensorIndexCOO",t[t.SparseMatrixIndexCSX=2]="SparseMatrixIndexCSX",t[t.SparseTensorIndexCSF=3]="SparseTensorIndexCSF"}(nt||(nt={})),function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(rt||(rt={})),function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"}(st||(st={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(ot||(ot={}));const Et=void 0;function Vt(t){if(null===t)return"null";if(t===Et)return"undefined";switch(typeof t){case"number":case"bigint":return`${t}`;case"string":return`"${t}"`}return"function"==typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map((t=>Vt(t)))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,((t,e)=>"bigint"==typeof e?`${e}`:e))}var Rt=Object.freeze({__proto__:null,valueToString:Vt});function zt(t){if("bigint"==typeof t&&(tNumber.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function Pt(t,e){return zt(t/e)+zt(t%e)/zt(e)}const jt=Symbol.for("isArrowBigNum");function kt(t,...e){return 0===e.length?Object.setPrototypeOf(L(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}function $t(...t){return kt.apply(this,t)}function Wt(...t){return kt.apply(this,t)}function Yt(...t){return kt.apply(this,t)}kt.prototype[jt]=!0,kt.prototype.toJSON=function(){return`"${Zt(this)}"`},kt.prototype.valueOf=function(t){return Gt(this,t)},kt.prototype.toString=function(){return Zt(this)},kt.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return Gt(this);case"string":return Zt(this);case"default":return Xt(this)}return Zt(this)},Object.setPrototypeOf($t.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Wt.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Yt.prototype,Object.create(Uint32Array.prototype)),Object.assign($t.prototype,kt.prototype,{constructor:$t,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(Wt.prototype,kt.prototype,{constructor:Wt,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(Yt.prototype,kt.prototype,{constructor:Yt,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Ht=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function Gt(t,e){const{buffer:i,byteOffset:n,byteLength:r,signed:s}=t,o=new BigUint64Array(i,n,r/8),a=s&&o.at(-1)&BigInt(1)<=0)return Kt(t);e=e.slice();let i=1;for(let t=0;t(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(Ae.prototype);class Be extends Ae{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class De extends Ae{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Te extends Ae{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class Oe extends Ae{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class Le extends Ae{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class xe extends Ae{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class Me extends Ae{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class Fe extends Ae{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(Be.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(De.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Te.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Oe.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(Le.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(xe.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Me.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(Fe.prototype,"ArrayType",{value:BigUint64Array});class Ne extends Ie{constructor(t){super(st.Float),this.precision=t}get ArrayType(){switch(this.precision){case G.HALF:return Uint16Array;case G.SINGLE:return Float32Array;case G.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}ee=Symbol.toStringTag,Ne[ee]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(Ne.prototype);class Ue extends Ne{constructor(){super(G.HALF)}}class Ce extends Ne{constructor(){super(G.SINGLE)}}class Ee extends Ne{constructor(){super(G.DOUBLE)}}Object.defineProperty(Ue.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Ce.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(Ee.prototype,"ArrayType",{value:Float64Array});class Ve extends Ie{constructor(){super(st.Binary)}toString(){return"Binary"}}ie=Symbol.toStringTag,Ve[ie]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(Ve.prototype);class Re extends Ie{constructor(){super(st.LargeBinary)}toString(){return"LargeBinary"}}ne=Symbol.toStringTag,Re[ne]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(Re.prototype);class ze extends Ie{constructor(){super(st.Utf8)}toString(){return"Utf8"}}re=Symbol.toStringTag,ze[re]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(ze.prototype);class Pe extends Ie{constructor(){super(st.LargeUtf8)}toString(){return"LargeUtf8"}}se=Symbol.toStringTag,Pe[se]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(Pe.prototype);class je extends Ie{constructor(){super(st.Bool)}toString(){return"Bool"}}oe=Symbol.toStringTag,je[oe]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(je.prototype);class ke extends Ie{constructor(t,e,i=128){super(st.Decimal),this.scale=t,this.precision=e,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}ae=Symbol.toStringTag,ke[ae]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(ke.prototype);class $e extends Ie{constructor(t){super(st.Date),this.unit=t}toString(){return`Date${32*(this.unit+1)}<${Z[this.unit]}>`}get ArrayType(){return this.unit===Z.DAY?Int32Array:BigInt64Array}}le=Symbol.toStringTag,$e[le]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))($e.prototype);class We extends $e{constructor(){super(Z.DAY)}}class Ye extends $e{constructor(){super(Z.MILLISECOND)}}class He extends Ie{constructor(t,e){super(st.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${X[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}ue=Symbol.toStringTag,He[ue]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(He.prototype);class Ge extends He{constructor(){super(X.SECOND,32)}}class Ze extends He{constructor(){super(X.MILLISECOND,32)}}class Xe extends He{constructor(){super(X.MICROSECOND,64)}}class Ke extends He{constructor(){super(X.NANOSECOND,64)}}class Je extends Ie{constructor(t,e){super(st.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${X[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ce=Symbol.toStringTag,Je[ce]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(Je.prototype);class qe extends Je{constructor(t){super(X.SECOND,t)}}class Qe extends Je{constructor(t){super(X.MILLISECOND,t)}}class ti extends Je{constructor(t){super(X.MICROSECOND,t)}}class ei extends Je{constructor(t){super(X.NANOSECOND,t)}}class ii extends Ie{constructor(t){super(st.Interval),this.unit=t}toString(){return`Interval<${K[this.unit]}>`}}he=Symbol.toStringTag,ii[he]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(ii.prototype);class ni extends ii{constructor(){super(K.DAY_TIME)}}class ri extends ii{constructor(){super(K.YEAR_MONTH)}}class si extends Ie{constructor(t){super(st.Duration),this.unit=t}toString(){return`Duration<${X[this.unit]}>`}}de=Symbol.toStringTag,si[de]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(si.prototype);class oi extends si{constructor(){super(X.SECOND)}}class ai extends si{constructor(){super(X.MILLISECOND)}}class li extends si{constructor(){super(X.MICROSECOND)}}class ui extends si{constructor(){super(X.NANOSECOND)}}class ci extends Ie{constructor(t){super(st.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}pe=Symbol.toStringTag,ci[pe]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(ci.prototype);class hi extends Ie{constructor(t){super(st.Struct),this.children=t}toString(){return`Struct<{${this.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}ye=Symbol.toStringTag,hi[ye]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(hi.prototype);class di extends Ie{constructor(t,e,i){super(st.Union),this.mode=t,this.children=i,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce(((t,e,i)=>(t[e]=i)&&t||t),Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map((t=>`${t.type}`)).join(" | ")}>`}}fe=Symbol.toStringTag,di[fe]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(di.prototype);class pi extends di{constructor(t,e){super(H.Dense,t,e)}}class yi extends di{constructor(t,e){super(H.Sparse,t,e)}}class fi extends Ie{constructor(t){super(st.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}be=Symbol.toStringTag,fi[be]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(fi.prototype);class bi extends Ie{constructor(t,e){super(st.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}ge=Symbol.toStringTag,bi[ge]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(bi.prototype);class gi extends Ie{constructor(t,e=!1){var i,n,r;if(super(st.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",null===(i=null==t?void 0:t.type)||void 0===i?void 0:i.children)){const e=null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.children[0];e&&(e.name="key");const i=null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.children[1];i&&(i.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}ve=Symbol.toStringTag,gi[ve]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(gi.prototype);const vi=(_i=-1,()=>++_i);var _i;class mi extends Ie{constructor(t,e,i,n){super(st.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=n||!1,this.id=null==i?vi():zt(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}function wi(t){const e=t;switch(t.typeId){case st.Decimal:return t.bitWidth/32;case st.Interval:return 1+e.unit;case st.FixedSizeList:return e.listSize;case st.FixedSizeBinary:return e.byteWidth;default:return 1}}_e=Symbol.toStringTag,mi[_e]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(mi.prototype);class Ii{visitMany(t,...e){return t.map(((t,i)=>this.visit(t,...e.map((t=>t[i])))))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return function(t,e,i=!0){if("number"==typeof e)return Si(t,e,i);if("string"==typeof e&&e in st)return Si(t,st[e],i);if(e&&e instanceof Ie)return Si(t,Ai(e),i);if((null==e?void 0:e.type)&&e.type instanceof Ie)return Si(t,Ai(e.type),i);return Si(t,st.NONE,i)}(this,t,e)}getVisitFnByTypeId(t,e=!0){return Si(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Si(t,e,i=!0){let n=null;switch(e){case st.Null:n=t.visitNull;break;case st.Bool:n=t.visitBool;break;case st.Int:n=t.visitInt;break;case st.Int8:n=t.visitInt8||t.visitInt;break;case st.Int16:n=t.visitInt16||t.visitInt;break;case st.Int32:n=t.visitInt32||t.visitInt;break;case st.Int64:n=t.visitInt64||t.visitInt;break;case st.Uint8:n=t.visitUint8||t.visitInt;break;case st.Uint16:n=t.visitUint16||t.visitInt;break;case st.Uint32:n=t.visitUint32||t.visitInt;break;case st.Uint64:n=t.visitUint64||t.visitInt;break;case st.Float:n=t.visitFloat;break;case st.Float16:n=t.visitFloat16||t.visitFloat;break;case st.Float32:n=t.visitFloat32||t.visitFloat;break;case st.Float64:n=t.visitFloat64||t.visitFloat;break;case st.Utf8:n=t.visitUtf8;break;case st.LargeUtf8:n=t.visitLargeUtf8;break;case st.Binary:n=t.visitBinary;break;case st.LargeBinary:n=t.visitLargeBinary;break;case st.FixedSizeBinary:n=t.visitFixedSizeBinary;break;case st.Date:n=t.visitDate;break;case st.DateDay:n=t.visitDateDay||t.visitDate;break;case st.DateMillisecond:n=t.visitDateMillisecond||t.visitDate;break;case st.Timestamp:n=t.visitTimestamp;break;case st.TimestampSecond:n=t.visitTimestampSecond||t.visitTimestamp;break;case st.TimestampMillisecond:n=t.visitTimestampMillisecond||t.visitTimestamp;break;case st.TimestampMicrosecond:n=t.visitTimestampMicrosecond||t.visitTimestamp;break;case st.TimestampNanosecond:n=t.visitTimestampNanosecond||t.visitTimestamp;break;case st.Time:n=t.visitTime;break;case st.TimeSecond:n=t.visitTimeSecond||t.visitTime;break;case st.TimeMillisecond:n=t.visitTimeMillisecond||t.visitTime;break;case st.TimeMicrosecond:n=t.visitTimeMicrosecond||t.visitTime;break;case st.TimeNanosecond:n=t.visitTimeNanosecond||t.visitTime;break;case st.Decimal:n=t.visitDecimal;break;case st.List:n=t.visitList;break;case st.Struct:n=t.visitStruct;break;case st.Union:n=t.visitUnion;break;case st.DenseUnion:n=t.visitDenseUnion||t.visitUnion;break;case st.SparseUnion:n=t.visitSparseUnion||t.visitUnion;break;case st.Dictionary:n=t.visitDictionary;break;case st.Interval:n=t.visitInterval;break;case st.IntervalDayTime:n=t.visitIntervalDayTime||t.visitInterval;break;case st.IntervalYearMonth:n=t.visitIntervalYearMonth||t.visitInterval;break;case st.Duration:n=t.visitDuration;break;case st.DurationSecond:n=t.visitDurationSecond||t.visitDuration;break;case st.DurationMillisecond:n=t.visitDurationMillisecond||t.visitDuration;break;case st.DurationMicrosecond:n=t.visitDurationMicrosecond||t.visitDuration;break;case st.DurationNanosecond:n=t.visitDurationNanosecond||t.visitDuration;break;case st.FixedSizeList:n=t.visitFixedSizeList;break;case st.Map:n=t.visitMap}if("function"==typeof n)return n;if(!i)return()=>null;throw new Error(`Unrecognized type '${st[e]}'`)}function Ai(t){switch(t.typeId){case st.Null:return st.Null;case st.Int:{const{bitWidth:e,isSigned:i}=t;switch(e){case 8:return i?st.Int8:st.Uint8;case 16:return i?st.Int16:st.Uint16;case 32:return i?st.Int32:st.Uint32;case 64:return i?st.Int64:st.Uint64}return st.Int}case st.Float:switch(t.precision){case G.HALF:return st.Float16;case G.SINGLE:return st.Float32;case G.DOUBLE:return st.Float64}return st.Float;case st.Binary:return st.Binary;case st.LargeBinary:return st.LargeBinary;case st.Utf8:return st.Utf8;case st.LargeUtf8:return st.LargeUtf8;case st.Bool:return st.Bool;case st.Decimal:return st.Decimal;case st.Time:switch(t.unit){case X.SECOND:return st.TimeSecond;case X.MILLISECOND:return st.TimeMillisecond;case X.MICROSECOND:return st.TimeMicrosecond;case X.NANOSECOND:return st.TimeNanosecond}return st.Time;case st.Timestamp:switch(t.unit){case X.SECOND:return st.TimestampSecond;case X.MILLISECOND:return st.TimestampMillisecond;case X.MICROSECOND:return st.TimestampMicrosecond;case X.NANOSECOND:return st.TimestampNanosecond}return st.Timestamp;case st.Date:switch(t.unit){case Z.DAY:return st.DateDay;case Z.MILLISECOND:return st.DateMillisecond}return st.Date;case st.Interval:switch(t.unit){case K.DAY_TIME:return st.IntervalDayTime;case K.YEAR_MONTH:return st.IntervalYearMonth}return st.Interval;case st.Duration:switch(t.unit){case X.SECOND:return st.DurationSecond;case X.MILLISECOND:return st.DurationMillisecond;case X.MICROSECOND:return st.DurationMicrosecond;case X.NANOSECOND:return st.DurationNanosecond}return st.Duration;case st.Map:return st.Map;case st.List:return st.List;case st.Struct:return st.Struct;case st.Union:switch(t.mode){case H.Dense:return st.DenseUnion;case H.Sparse:return st.SparseUnion}return st.Union;case st.FixedSizeBinary:return st.FixedSizeBinary;case st.FixedSizeList:return st.FixedSizeList;case st.Dictionary:return st.Dictionary}throw new Error(`Unrecognized type '${st[t.typeId]}'`)}Ii.prototype.visitInt8=null,Ii.prototype.visitInt16=null,Ii.prototype.visitInt32=null,Ii.prototype.visitInt64=null,Ii.prototype.visitUint8=null,Ii.prototype.visitUint16=null,Ii.prototype.visitUint32=null,Ii.prototype.visitUint64=null,Ii.prototype.visitFloat16=null,Ii.prototype.visitFloat32=null,Ii.prototype.visitFloat64=null,Ii.prototype.visitDateDay=null,Ii.prototype.visitDateMillisecond=null,Ii.prototype.visitTimestampSecond=null,Ii.prototype.visitTimestampMillisecond=null,Ii.prototype.visitTimestampMicrosecond=null,Ii.prototype.visitTimestampNanosecond=null,Ii.prototype.visitTimeSecond=null,Ii.prototype.visitTimeMillisecond=null,Ii.prototype.visitTimeMicrosecond=null,Ii.prototype.visitTimeNanosecond=null,Ii.prototype.visitDenseUnion=null,Ii.prototype.visitSparseUnion=null,Ii.prototype.visitIntervalDayTime=null,Ii.prototype.visitIntervalYearMonth=null,Ii.prototype.visitDuration=null,Ii.prototype.visitDurationSecond=null,Ii.prototype.visitDurationMillisecond=null,Ii.prototype.visitDurationMicrosecond=null,Ii.prototype.visitDurationNanosecond=null;const Bi=new Float64Array(1),Di=new Uint32Array(Bi.buffer);function Ti(t){const e=(31744&t)>>10,i=(1023&t)/1024,n=Math.pow(-1,(32768&t)>>15);switch(e){case 31:return n*(i?Number.NaN:1/0);case 0:return n*(i?6103515625e-14*i:0)}return n*Math.pow(2,e-15)*(1+i)}function Oi(t){if(t!=t)return 32256;Bi[0]=t;const e=(2147483648&Di[1])>>16&65535;let i=2146435072&Di[1],n=0;return i>=1089470464?Di[0]>0?i=31744:(i=(2080374784&i)>>16,n=(1048575&Di[1])>>10):i<=1056964608?(n=1048576+(1048575&Di[1]),n=1048576+(n<<(i>>20)-998)>>21,i=0):(i=i-1056964608>>10,n=512+(1048575&Di[1])>>10),e|i|65535&n}var Li=Object.freeze({__proto__:null,uint16ToFloat64:Ti,float64ToUint16:Oi});class xi extends Ii{}function Mi(t){return(e,i,n)=>{if(e.setValid(i,null!=n))return t(e,i,n)}}const Fi=(t,e,i,n)=>{if(i+1{t[e]=i},Ui=({values:t},e,i)=>{t[e]=i},Ci=({values:t},e,i)=>{t[e]=Oi(i)},Ei=({values:t},e,i)=>{((t,e,i)=>{t[e]=Math.floor(i/864e5)})(t,e,i.valueOf())},Vi=({values:t},e,i)=>{t[e]=BigInt(i)},Ri=({stride:t,values:e},i,n)=>{e.set(n.subarray(0,t),t*i)},zi=({values:t,valueOffsets:e},i,n)=>Fi(t,e,i,n),Pi=({values:t,valueOffsets:e},i,n)=>Fi(t,e,i,h(n)),ji=(t,e,i)=>{t.type.unit===Z.DAY?Ei(t,e,i):Vi(t,e,i)},ki=({values:t},e,i)=>{t[e]=BigInt(i/1e3)},$i=({values:t},e,i)=>{t[e]=BigInt(i)},Wi=({values:t},e,i)=>{t[e]=BigInt(1e3*i)},Yi=({values:t},e,i)=>{t[e]=BigInt(1e6*i)},Hi=(t,e,i)=>{switch(t.type.unit){case X.SECOND:return ki(t,e,i);case X.MILLISECOND:return $i(t,e,i);case X.MICROSECOND:return Wi(t,e,i);case X.NANOSECOND:return Yi(t,e,i)}},Gi=({values:t},e,i)=>{t[e]=i},Zi=({values:t},e,i)=>{t[e]=i},Xi=({values:t},e,i)=>{t[e]=i},Ki=({values:t},e,i)=>{t[e]=i},Ji=(t,e,i)=>{switch(t.type.unit){case X.SECOND:return Gi(t,e,i);case X.MILLISECOND:return Zi(t,e,i);case X.MICROSECOND:return Xi(t,e,i);case X.NANOSECOND:return Ki(t,e,i)}},qi=({values:t,stride:e},i,n)=>{t.set(n.subarray(0,e),e*i)},Qi=(t,e,i)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];cn.visit(r,t.valueOffsets[e],i)},tn=(t,e,i)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];cn.visit(r,e,i)},en=(t,e,i)=>{t.type.unit===K.DAY_TIME?nn(t,e,i):rn(t,e,i)},nn=({values:t},e,i)=>{t.set(i.subarray(0,2),2*e)},rn=({values:t},e,i)=>{t[e]=12*i[0]+i[1]%12},sn=({values:t},e,i)=>{t[e]=i},on=({values:t},e,i)=>{t[e]=i},an=({values:t},e,i)=>{t[e]=i},ln=({values:t},e,i)=>{t[e]=i},un=(t,e,i)=>{switch(t.type.unit){case X.SECOND:return sn(t,e,i);case X.MILLISECOND:return on(t,e,i);case X.MICROSECOND:return an(t,e,i);case X.NANOSECOND:return ln(t,e,i)}};xi.prototype.visitBool=Mi((({offset:t,values:e},i,n)=>{const r=t+i;n?e[r>>3]|=1<>3]&=~(1<{switch(t.type.precision){case G.HALF:return Ci(t,e,i);case G.SINGLE:case G.DOUBLE:return Ui(t,e,i)}})),xi.prototype.visitFloat16=Mi(Ci),xi.prototype.visitFloat32=Mi(Ui),xi.prototype.visitFloat64=Mi(Ui),xi.prototype.visitUtf8=Mi(Pi),xi.prototype.visitLargeUtf8=Mi(Pi),xi.prototype.visitBinary=Mi(zi),xi.prototype.visitLargeBinary=Mi(zi),xi.prototype.visitFixedSizeBinary=Mi(Ri),xi.prototype.visitDate=Mi(ji),xi.prototype.visitDateDay=Mi(Ei),xi.prototype.visitDateMillisecond=Mi(Vi),xi.prototype.visitTimestamp=Mi(Hi),xi.prototype.visitTimestampSecond=Mi(ki),xi.prototype.visitTimestampMillisecond=Mi($i),xi.prototype.visitTimestampMicrosecond=Mi(Wi),xi.prototype.visitTimestampNanosecond=Mi(Yi),xi.prototype.visitTime=Mi(Ji),xi.prototype.visitTimeSecond=Mi(Gi),xi.prototype.visitTimeMillisecond=Mi(Zi),xi.prototype.visitTimeMicrosecond=Mi(Xi),xi.prototype.visitTimeNanosecond=Mi(Ki),xi.prototype.visitDecimal=Mi(qi),xi.prototype.visitList=Mi(((t,e,i)=>{const n=t.children[0],r=t.valueOffsets,s=cn.getVisitFn(n);if(Array.isArray(i))for(let t=-1,o=r[e],a=r[e+1];o{const n=t.type.children.map((t=>cn.getVisitFn(t.type))),r=i instanceof Map?(s=e,o=i,(t,e,i,n)=>e&&t(e,s,o.get(i.name))):i instanceof Er?((t,e)=>(i,n,r,s)=>n&&i(n,t,e.get(s)))(e,i):Array.isArray(i)?((t,e)=>(i,n,r,s)=>n&&i(n,t,e[s]))(e,i):((t,e)=>(i,n,r,s)=>n&&i(n,t,e[r.name]))(e,i);var s,o;t.type.children.forEach(((e,i)=>r(n[i],t.children[i],e,i)))})),xi.prototype.visitUnion=Mi(((t,e,i)=>{t.type.mode===H.Dense?Qi(t,e,i):tn(t,e,i)})),xi.prototype.visitDenseUnion=Mi(Qi),xi.prototype.visitSparseUnion=Mi(tn),xi.prototype.visitDictionary=Mi(((t,e,i)=>{var n;null===(n=t.dictionary)||void 0===n||n.set(t.values[e],i)})),xi.prototype.visitInterval=Mi(en),xi.prototype.visitIntervalDayTime=Mi(nn),xi.prototype.visitIntervalYearMonth=Mi(rn),xi.prototype.visitDuration=Mi(un),xi.prototype.visitDurationSecond=Mi(sn),xi.prototype.visitDurationMillisecond=Mi(on),xi.prototype.visitDurationMicrosecond=Mi(an),xi.prototype.visitDurationNanosecond=Mi(ln),xi.prototype.visitFixedSizeList=Mi(((t,e,i)=>{const{stride:n}=t,r=t.children[0],s=cn.getVisitFn(r);if(Array.isArray(i))for(let t=-1,o=e*n;++t{const n=t.children[0],{valueOffsets:r}=t,s=cn.getVisitFn(n);let{[e]:o,[e+1]:a}=r;const l=i instanceof Map?i.entries():Object.entries(i);for(const t of l)if(s(n,o,t),++o>=a)break}));const cn=new xi,hn=Symbol.for("parent"),dn=Symbol.for("rowIndex");class pn{constructor(t,e){return this[hn]=t,this[dn]=e,new Proxy(this,new fn)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[dn],e=this[hn],i=e.type.children,n={};for(let r=-1,s=i.length;++r`${Vt(t)}: ${Vt(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new yn(this[hn],this[dn])}}class yn{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return tt.name))}has(t,e){return-1!==t[hn].type.children.findIndex((t=>t.name===e))}getOwnPropertyDescriptor(t,e){if(-1!==t[hn].type.children.findIndex((t=>t.name===e)))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[hn].type.children.findIndex((t=>t.name===e));if(-1!==i){const n=jn.visit(t[hn].children[i],t[dn]);return Reflect.set(t,e,n),n}}set(t,e,i){const n=t[hn].type.children.findIndex((t=>t.name===e));return-1!==n?(cn.visit(t[hn].children[n],t[dn],i),Reflect.set(t,e,i)):!(!Reflect.has(t,e)&&"symbol"!=typeof e)&&Reflect.set(t,e,i)}}class bn extends Ii{}function gn(t){return(e,i)=>e.getValid(i)?t(e,i):null}const vn=(t,e,i)=>{if(i+1>=e.length)return null;const n=zt(e[i]),r=zt(e[i+1]);return t.subarray(n,r)},_n=({values:t},e)=>((t,e)=>864e5*t[e])(t,e),mn=({values:t},e)=>zt(t[e]),wn=({stride:t,values:e},i)=>e[t*i],In=({values:t},e)=>t[e],Sn=({values:t,valueOffsets:e},i)=>vn(t,e,i),An=({values:t,valueOffsets:e},i)=>{const n=vn(t,e,i);return null!==n?u(n):null},Bn=({values:t},e)=>1e3*zt(t[e]),Dn=({values:t},e)=>zt(t[e]),Tn=({values:t},e)=>Pt(t[e],BigInt(1e3)),On=({values:t},e)=>Pt(t[e],BigInt(1e6)),Ln=({values:t},e)=>t[e],xn=({values:t},e)=>t[e],Mn=({values:t},e)=>t[e],Fn=({values:t},e)=>t[e],Nn=(t,e)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];return jn.visit(n,t.valueOffsets[e])},Un=(t,e)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];return jn.visit(n,e)},Cn=({values:t},e)=>t.subarray(2*e,2*(e+1)),En=({values:t},e)=>{const i=t[e],n=new Int32Array(2);return n[0]=Math.trunc(i/12),n[1]=Math.trunc(i%12),n},Vn=({values:t},e)=>t[e],Rn=({values:t},e)=>t[e],zn=({values:t},e)=>t[e],Pn=({values:t},e)=>t[e];bn.prototype.visitNull=gn(((t,e)=>null)),bn.prototype.visitBool=gn((({offset:t,values:e},i)=>{const n=t+i;return 0!=(e[n>>3]&1<t[e])),bn.prototype.visitInt8=gn(wn),bn.prototype.visitInt16=gn(wn),bn.prototype.visitInt32=gn(wn),bn.prototype.visitInt64=gn(In),bn.prototype.visitUint8=gn(wn),bn.prototype.visitUint16=gn(wn),bn.prototype.visitUint32=gn(wn),bn.prototype.visitUint64=gn(In),bn.prototype.visitFloat=gn((({type:t,values:e},i)=>t.precision!==G.HALF?e[i]:Ti(e[i]))),bn.prototype.visitFloat16=gn((({stride:t,values:e},i)=>Ti(e[t*i]))),bn.prototype.visitFloat32=gn(wn),bn.prototype.visitFloat64=gn(wn),bn.prototype.visitUtf8=gn(An),bn.prototype.visitLargeUtf8=gn(An),bn.prototype.visitBinary=gn(Sn),bn.prototype.visitLargeBinary=gn(Sn),bn.prototype.visitFixedSizeBinary=gn((({stride:t,values:e},i)=>e.subarray(t*i,t*(i+1)))),bn.prototype.visitDate=gn(((t,e)=>t.type.unit===Z.DAY?_n(t,e):mn(t,e))),bn.prototype.visitDateDay=gn(_n),bn.prototype.visitDateMillisecond=gn(mn),bn.prototype.visitTimestamp=gn(((t,e)=>{switch(t.type.unit){case X.SECOND:return Bn(t,e);case X.MILLISECOND:return Dn(t,e);case X.MICROSECOND:return Tn(t,e);case X.NANOSECOND:return On(t,e)}})),bn.prototype.visitTimestampSecond=gn(Bn),bn.prototype.visitTimestampMillisecond=gn(Dn),bn.prototype.visitTimestampMicrosecond=gn(Tn),bn.prototype.visitTimestampNanosecond=gn(On),bn.prototype.visitTime=gn(((t,e)=>{switch(t.type.unit){case X.SECOND:return Ln(t,e);case X.MILLISECOND:return xn(t,e);case X.MICROSECOND:return Mn(t,e);case X.NANOSECOND:return Fn(t,e)}})),bn.prototype.visitTimeSecond=gn(Ln),bn.prototype.visitTimeMillisecond=gn(xn),bn.prototype.visitTimeMicrosecond=gn(Mn),bn.prototype.visitTimeNanosecond=gn(Fn),bn.prototype.visitDecimal=gn((({values:t,stride:e},i)=>Jt.decimal(t.subarray(e*i,e*(i+1))))),bn.prototype.visitList=gn(((t,e)=>{const{valueOffsets:i,stride:n,children:r}=t,{[e*n]:s,[e*n+1]:o}=i,a=r[0].slice(s,o-s);return new Er([a])})),bn.prototype.visitStruct=gn(((t,e)=>new pn(t,e))),bn.prototype.visitUnion=gn(((t,e)=>t.type.mode===H.Dense?Nn(t,e):Un(t,e))),bn.prototype.visitDenseUnion=gn(Nn),bn.prototype.visitSparseUnion=gn(Un),bn.prototype.visitDictionary=gn(((t,e)=>{var i;return null===(i=t.dictionary)||void 0===i?void 0:i.get(t.values[e])})),bn.prototype.visitInterval=gn(((t,e)=>t.type.unit===K.DAY_TIME?Cn(t,e):En(t,e))),bn.prototype.visitIntervalDayTime=gn(Cn),bn.prototype.visitIntervalYearMonth=gn(En),bn.prototype.visitDuration=gn(((t,e)=>{switch(t.type.unit){case X.SECOND:return Vn(t,e);case X.MILLISECOND:return Rn(t,e);case X.MICROSECOND:return zn(t,e);case X.NANOSECOND:return Pn(t,e)}})),bn.prototype.visitDurationSecond=gn(Vn),bn.prototype.visitDurationMillisecond=gn(Rn),bn.prototype.visitDurationMicrosecond=gn(zn),bn.prototype.visitDurationNanosecond=gn(Pn),bn.prototype.visitFixedSizeList=gn(((t,e)=>{const{stride:i,children:n}=t,r=n[0].slice(e*i,i);return new Er([r])})),bn.prototype.visitMap=gn(((t,e)=>{const{valueOffsets:i,children:n}=t,{[e]:r,[e+1]:s}=i,o=n[0];return new Hn(o.slice(r,s-r))}));const jn=new bn,kn=Symbol.for("keys"),$n=Symbol.for("vals"),Wn=Symbol.for("kKeysAsStrings"),Yn=Symbol.for("_kKeysAsStrings");class Hn{constructor(t){return this[kn]=new Er([t.children[0]]).memoize(),this[$n]=t.children[1],new Proxy(this,new Zn)}get[Wn](){return this[Yn]||(this[Yn]=Array.from(this[kn].toArray(),String))}[Symbol.iterator](){return new Gn(this[kn],this[$n])}get size(){return this[kn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[kn],e=this[$n],i={};for(let n=-1,r=t.length;++n`${Vt(t)}: ${Vt(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Gn{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),jn.visit(this.vals,t)]})}}class Zn{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Wn]}has(t,e){return t[Wn].includes(e)}getOwnPropertyDescriptor(t,e){if(-1!==t[Wn].indexOf(e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[Wn].indexOf(e);if(-1!==i){const n=jn.visit(Reflect.get(t,$n),i);return Reflect.set(t,e,n),n}}set(t,e,i){const n=t[Wn].indexOf(e);return-1!==n?(cn.visit(Reflect.get(t,$n),n,i),Reflect.set(t,e,i)):!!Reflect.has(t,e)&&Reflect.set(t,e,i)}}let Xn;function Kn(t,e,i,n){const{length:r=0}=t;let s="number"!=typeof e?0:e,o="number"!=typeof i?r:i;return s<0&&(s=(s%r+r)%r),o<0&&(o=(o%r+r)%r),or&&(o=r),n?n(t,s,o):[s,o]}Object.defineProperties(Hn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[kn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[$n]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Yn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});const Jn=(t,e)=>t<0?e+t:t,qn=t=>t!=t;function Qn(t){if("object"!==typeof t||null===t)return qn(t)?qn:e=>e===t;if(t instanceof Date){const e=t.valueOf();return t=>t instanceof Date&&t.valueOf()===e}return ArrayBuffer.isView(t)?e=>!!e&&z(t,e):t instanceof Map?function(t){let e=-1;const i=[];for(const n of t.values())i[++e]=Qn(n);return tr(i)}(t):Array.isArray(t)?function(t){const e=[];for(let i=-1,n=t.length;++i!1;const n=[];for(let e=-1,r=i.length;++e{if(!i||"object"!=typeof i)return!1;switch(i.constructor){case Array:return function(t,e){const i=t.length;if(e.length!==i)return!1;for(let n=-1;++n>n}function sr(t,e,i){const n=i.byteLength+7&-8;if(t>0||i.byteLength>3):or(new ar(i,t,e,null,nr)).subarray(0,n)),r}return i}function or(t){const e=[];let i=0,n=0,r=0;for(const s of t)s&&(r|=1<0)&&(e[i++]=r);const s=new Uint8Array(e.length+7&-8);return s.set(e),s}class ar{constructor(t,e,i,n,r){this.bytes=t,this.length=i,this.context=n,this.get=r,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,r=e+(e%8==0?0:8-e%8);return lr(t,e,r)+lr(t,n,i)+ur(t,r>>3,n-r>>3)}function ur(t,e,i){let n=0,r=Math.trunc(e);const s=new DataView(t.buffer,t.byteOffset,t.byteLength),o=void 0===i?t.byteLength:r+i;for(;o-r>=4;)n+=cr(s.getUint32(r)),r+=4;for(;o-r>=2;)n+=cr(s.getUint16(r)),r+=2;for(;o-r>=1;)n+=cr(s.getUint8(r)),r+=1;return n}function cr(t){let e=Math.trunc(t);return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),16843009*(e+(e>>>4)&252645135)>>>24}var hr=Object.freeze({__proto__:null,getBool:nr,getBit:rr,setBool:function(t,e,i){return i?!!(t[e>>3]|=1<>3]&=~(1<t.nullable)):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:i,nullBitmap:n,typeIds:r}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),this.children.reduce(((t,e)=>t+e.byteLength),t)}get nullCount(){if(Ie.isUnion(this.type))return this.children.reduce(((t,e)=>t+e.nullCount),0);let t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=0===t.length?0:this.length-lr(t,this.offset,this.offset+this.length)),e}constructor(t,e,i,n,r,s=[],o){let a;this.type=t,this.children=s,this.dictionary=o,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1)),r instanceof dr?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=wi(t),r&&((a=r[0])&&(this.valueOffsets=a),(a=r[1])&&(this.values=a),(a=r[2])&&(this.nullBitmap=a),(a=r[3])&&(this.typeIds=a)))}getValid(t){const{type:e}=this;if(Ie.isUnion(e)){const i=e,n=this.children[i.typeIdToChildIndex[this.typeIds[t]]],r=i.mode===H.Dense?this.valueOffsets[t]:t;return n.getValid(r)}if(this.nullable&&this.nullCount>0){const e=this.offset+t;return 0!=(this.nullBitmap[e>>3]&1<>3;(!n||n.byteLength<=l)&&(n=new Uint8Array((r+s+63&-64)>>3).fill(255),this.nullCount>0?(n.set(sr(r,s,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));const u=n[l];i=0!=(u&a),n[l]=e?u|a:u&~a}return i!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,i=this.length,n=this._nullCount,r=this,s=this.children){return new dr(t,e,i,n,r,s,this.dictionary)}slice(t,e){const{stride:i,typeId:n,children:r}=this,s=+(0===this._nullCount)-1,o=16===n?i:1,a=this._sliceBuffers(t,e,i,n);return this.clone(this.type,this.offset+t,e,s,a,0===r.length||this.valueOffsets?r:this._sliceChildren(r,o*t,o*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===st.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:i}=this,n=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);n[e>>3]=(1<0&&n.set(sr(this.offset,e,this.nullBitmap),0);const r=this.buffers;return r[ot.VALIDITY]=n,this.clone(this.type,0,t,i+(t-e),r)}_sliceBuffers(t,e,i,n){let r;const{buffers:s}=this;return(r=s[ot.TYPE])&&(s[ot.TYPE]=r.subarray(t,t+e)),(r=s[ot.OFFSET])&&(s[ot.OFFSET]=r.subarray(t,t+e+1))||(r=s[ot.DATA])&&(s[ot.DATA]=6===n?r:r.subarray(i*t,i*(t+e))),s}_sliceChildren(t,e,i){return t.map((t=>t.slice(e,i)))}}dr.prototype.children=Object.freeze([]);class pr extends Ii{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{type:e,offset:i=0,length:n=0}=t;return new dr(e,i,n,n)}visitBool(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length>>3,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitInt(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitFloat(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitUtf8(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitLargeUtf8(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=M(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitBinary(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitLargeBinary(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=M(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitFixedSizeBinary(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitDate(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitTimestamp(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitTime(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitDecimal(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitList(t){const{type:e,offset:i=0,child:n}=t,r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,void 0,r],[n])}visitStruct(t){const{type:e,offset:i=0,children:n=[]}=t,r=F(t.nullBitmap),{length:s=n.reduce(((t,{length:e})=>Math.max(t,e)),0),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,void 0,r],n)}visitUnion(t){const{type:e,offset:i=0,children:n=[]}=t,r=L(e.ArrayType,t.typeIds),{length:s=r.length,nullCount:o=-1}=t;if(Ie.isSparseUnion(e))return new dr(e,i,s,o,[void 0,void 0,void 0,r],n);const a=x(t.valueOffsets);return new dr(e,i,s,o,[a,void 0,void 0,r],n)}visitDictionary(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.indices.ArrayType,t.data),{dictionary:s=new Er([(new pr).visit({type:e.dictionary})])}=t,{length:o=r.length,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[void 0,r,n],[],s)}visitInterval(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitDuration(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitFixedSizeList(t){const{type:e,offset:i=0,child:n=(new pr).visit({type:e.valueType})}=t,r=F(t.nullBitmap),{length:s=n.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,void 0,r],[n])}visitMap(t){const{type:e,offset:i=0,child:n=(new pr).visit({type:e.childType})}=t,r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,void 0,r],[n])}}const yr=new pr;function fr(t){return yr.visit(t)}class br{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext+e.nullCount),0)}function vr(t){return t.reduce(((t,e,i)=>(t[i+1]=t[i]+e.length,t)),new Uint32Array(t.length+1))}function _r(t,e,i,n){const r=[];for(let s=-1,o=t.length;++s=n)break;if(i>=a+l)continue;if(a>=i&&a+l<=n){r.push(o);continue}const u=Math.max(0,i-a),c=Math.min(n-a,l);r.push(o.slice(u,c-u))}return 0===r.length&&r.push(t[0].slice(0,0)),r}function mr(t,e,i,n){let r=0,s=0,o=e.length-1;do{if(r>=o-1)return i0?0:-1},Br.prototype.visitBool=Dr,Br.prototype.visitInt=Dr,Br.prototype.visitInt8=Dr,Br.prototype.visitInt16=Dr,Br.prototype.visitInt32=Dr,Br.prototype.visitInt64=Dr,Br.prototype.visitUint8=Dr,Br.prototype.visitUint16=Dr,Br.prototype.visitUint32=Dr,Br.prototype.visitUint64=Dr,Br.prototype.visitFloat=Dr,Br.prototype.visitFloat16=Dr,Br.prototype.visitFloat32=Dr,Br.prototype.visitFloat64=Dr,Br.prototype.visitUtf8=Dr,Br.prototype.visitLargeUtf8=Dr,Br.prototype.visitBinary=Dr,Br.prototype.visitLargeBinary=Dr,Br.prototype.visitFixedSizeBinary=Dr,Br.prototype.visitDate=Dr,Br.prototype.visitDateDay=Dr,Br.prototype.visitDateMillisecond=Dr,Br.prototype.visitTimestamp=Dr,Br.prototype.visitTimestampSecond=Dr,Br.prototype.visitTimestampMillisecond=Dr,Br.prototype.visitTimestampMicrosecond=Dr,Br.prototype.visitTimestampNanosecond=Dr,Br.prototype.visitTime=Dr,Br.prototype.visitTimeSecond=Dr,Br.prototype.visitTimeMillisecond=Dr,Br.prototype.visitTimeMicrosecond=Dr,Br.prototype.visitTimeNanosecond=Dr,Br.prototype.visitDecimal=Dr,Br.prototype.visitList=Dr,Br.prototype.visitStruct=Dr,Br.prototype.visitUnion=Dr,Br.prototype.visitDenseUnion=Tr,Br.prototype.visitSparseUnion=Tr,Br.prototype.visitDictionary=Dr,Br.prototype.visitInterval=Dr,Br.prototype.visitIntervalDayTime=Dr,Br.prototype.visitIntervalYearMonth=Dr,Br.prototype.visitDuration=Dr,Br.prototype.visitDurationSecond=Dr,Br.prototype.visitDurationMillisecond=Dr,Br.prototype.visitDurationMicrosecond=Dr,Br.prototype.visitDurationNanosecond=Dr,Br.prototype.visitFixedSizeList=Dr,Br.prototype.visitMap=Dr;const Or=new Br;class Lr extends Ii{}function xr(t){const{type:e}=t;if(0===t.nullCount&&1===t.stride&&(Ie.isInt(e)&&64!==e.bitWidth||Ie.isTime(e)&&64!==e.bitWidth||Ie.isFloat(e)&&e.precision!==G.HALF))return new br(t.data.length,(e=>{const i=t.data[e];return i.values.subarray(0,i.length)[Symbol.iterator]()}));let i=0;return new br(t.data.length,(e=>{const n=t.data[e].length,r=t.slice(i,i+n);return i+=n,new Mr(r)}))}class Mr{constructor(t){this.vector=t,this.index=0}next(){return this.indext.data)):t;if(0===r.length||r.some((t=>!(t instanceof dr))))throw new TypeError("Vector constructor expects an Array of Data instances.");const s=null===(e=r[0])||void 0===e?void 0:e.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:t,set:e,indexOf:i}=Ur[s.typeId],n=r[0];this.isValid=t=>wr(n,t),this.get=e=>t(n,e),this.set=(t,i)=>e(n,t,i),this.indexOf=t=>i(n,t),this._offsets=[0,n.length];break}default:Object.setPrototypeOf(this,Cr[s.typeId]),this._offsets=vr(r)}this.data=r,this.type=s,this.stride=wi(s),this.numChildren=null!==(n=null===(i=s.children)||void 0===i?void 0:i.length)&&void 0!==n?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce(((t,e)=>t+e.byteLength),0)}get nullable(){return this.data.some((t=>t.nullable))}get nullCount(){return gr(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${st[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Jn(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Fr.visit(this)}concat(...t){return new Er(this.data.concat(t.flatMap((t=>t.data)).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new Er(Kn(this,t,e,(({data:t,_offsets:e},i,n)=>_r(t,e,i,n))))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:i,stride:n,ArrayType:r}=this;switch(t.typeId){case st.Int:case st.Float:case st.Decimal:case st.Time:case st.Timestamp:switch(e.length){case 0:return new r;case 1:return e[0].values.subarray(0,i*n);default:return e.reduce(((t,{values:e,length:i})=>(t.array.set(e.subarray(0,i*n),t.offset),t.offset+=i*n,t)),{array:new r(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt(null===(e=this.type.children)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&te[t]))):null}get isMemoized(){return!!Ie.isDictionary(this.type)&&this.data[0].dictionary.isMemoized}memoize(){if(Ie.isDictionary(this.type)){const t=new Vr(this.data[0].dictionary),e=this.data.map((e=>{const i=e.clone();return i.dictionary=t,i}));return new Er(e)}return new Vr(this)}unmemoize(){if(Ie.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map((e=>{const i=e.clone();return i.dictionary=t,i}));return new Er(e)}return this}}Nr=Symbol.toStringTag,Er[Nr]=(t=>{t.type=Ie.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(st).map((t=>st[t])).filter((t=>"number"==typeof t&&t!==st.NONE));for(const i of e){const e=jn.getVisitFnByTypeId(i),n=cn.getVisitFnByTypeId(i),r=Or.getVisitFnByTypeId(i);Ur[i]={get:e,set:n,indexOf:r},Cr[i]=Object.create(t,{isValid:{value:Ir(wr)},get:{value:Ir(jn.getVisitFnByTypeId(i))},set:{value:Sr(cn.getVisitFnByTypeId(i))},indexOf:{value:Ar(Or.getVisitFnByTypeId(i))}})}return"Vector"})(Er.prototype);class Vr extends Er{constructor(t){super(t.data);const e=this.get,i=this.set,n=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(t){const i=r[t];if(void 0!==i)return i;const n=e.call(this,t);return r[t]=n,n}}),Object.defineProperty(this,"set",{value(t,e){i.call(this,t,e),r[t]=e}}),Object.defineProperty(this,"slice",{value:(t,e)=>new Vr(n.call(this,t,e))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Er(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function Rr(t){if(t){if(t instanceof dr)return new Er([t]);if(t instanceof Er)return new Er(t.data);if(t.type instanceof Ie)return new Er([fr(t)]);if(Array.isArray(t))return new Er(t.flatMap((t=>{return(e=t)instanceof dr?[e]:e instanceof Er?e.data:Rr(e).data;var e})));if(ArrayBuffer.isView(t)){t instanceof DataView&&(t=new Uint8Array(t.buffer));const e={offset:0,length:t.length,nullCount:-1,data:t};if(t instanceof Int8Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Be}))]);if(t instanceof Int16Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new De}))]);if(t instanceof Int32Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Te}))]);if(t instanceof BigInt64Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Oe}))]);if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)return new Er([fr(Object.assign(Object.assign({},e),{type:new Le}))]);if(t instanceof Uint16Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new xe}))]);if(t instanceof Uint32Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Me}))]);if(t instanceof BigUint64Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Fe}))]);if(t instanceof Float32Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Ce}))]);if(t instanceof Float64Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Ee}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function zr(t){if(!t||t.length<=0)return function(t){return!0};let e="";const i=t.filter((t=>t==t));return i.length>0&&(e=`\n switch (x) {${i.map((t=>`\n case ${function(t){if("bigint"!=typeof t)return Vt(t);return`${Vt(t)}n`}(t)}:`)).join("")}\n return false;\n }`),t.length!==i.length&&(e=`if (x !== x) return false;\n${e}`),new Function("x",`${e}\nreturn true;`)}function Pr(t,e){const i=Math.ceil(t)*e-1;return(i-i%64+64||64)/e}function jr(t,e=0){return t.length>=e?t.subarray(0,e):T(new t.constructor(e),t,0)}class kr{constructor(t,e=0,i=1){this.length=Math.ceil(e/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;const e=this.stride,i=this.length*e,n=this.buffer.length;i>=n&&this._resize(Pr(0===n?1*i:2*i,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Pr(t*this.stride,this.BYTES_PER_ELEMENT);const e=jr(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=jr(this.buffer,t)}}class $r extends kr{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}}class Wr extends $r{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){const{buffer:i}=this.reserve(t-this.length+1),n=t>>3,r=t%8,s=i[n]>>r&1;return e?0===s&&(i[n]|=1<=0&&n.fill(n[i],i,t),n[t]=n[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}class Hr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=wi(t),this._nulls=new Wr,e&&e.length>0&&(this._isValid=zr(e))}toVector(){return new Er([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0;const{_offsets:e,_values:i,_nulls:n,_typeIds:r,children:s}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),s.reduce(((t,e)=>t+e.byteLength),t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce(((t,e)=>t+e.reservedByteLength),t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,i,n;const{type:r,length:s,nullCount:o,_typeIds:a,_offsets:l,_values:u,_nulls:c}=this;(e=null==a?void 0:a.flush(s))?n=null==l?void 0:l.flush(s):t=(n=null==l?void 0:l.flush(s))?null==u?void 0:u.flush(l.last()):null==u?void 0:u.flush(s),o>0&&(i=null==c?void 0:c.flush(s));const h=this.children.map((t=>t.flush()));return this.clear(),fr({type:r,length:s,nullCount:o,children:h,child:h[0],data:t,typeIds:e,nullBitmap:i,valueOffsets:n})}finish(){this.finished=!0;for(const t of this.children)t.finish();return this}clear(){var t,e,i,n;this.length=0,null===(t=this._nulls)||void 0===t||t.clear(),null===(e=this._values)||void 0===e||e.clear(),null===(i=this._offsets)||void 0===i||i.clear(),null===(n=this._typeIds)||void 0===n||n.clear();for(const t of this.children)t.clear();return this}}Hr.prototype.length=1,Hr.prototype.stride=1,Hr.prototype.children=null,Hr.prototype.finished=!1,Hr.prototype.nullValues=null,Hr.prototype._isValid=()=>!0;class Gr extends Hr{constructor(t){super(t),this._values=new $r(this.ArrayType,0,this.stride)}setValue(t,e){const i=this._values;return i.reserve(t-i.length+1),super.setValue(t,e)}}class Zr extends Hr{constructor(t){super(t),this._pendingLength=0,this._offsets=new Yr(t.type)}setValue(t,e){const i=this._pending||(this._pending=new Map),n=i.get(t);n&&(this._pendingLength-=n.length),this._pendingLength+=e instanceof Hn?e[kn].length:e.length,i.set(t,e)}setValid(t,e){return!!super.setValid(t,e)||((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}class Xr{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,i,n){return t.prep(8,24),t.writeInt64(BigInt(null!=n?n:0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class Kr{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Kr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Kr).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ct).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new Xr).__init(this.bb.__vector(this.bb_pos+i)+24*t,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const i=this.bb.__offset(this.bb_pos,10);return i?(e||new Xr).__init(this.bb.__vector(this.bb_pos+i)+24*t,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Y.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class Jr{constructor(t=[],e,i,n=Y.V5){this.fields=t||[],this.metadata=e||new Map,i||(i=ts(t)),this.dictionaries=i,this.metadataVersion=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map((t=>t.name))}toString(){return`Schema<{ ${this.fields.map(((t,e)=>`${e}: ${t}`)).join(", ")} }>`}select(t){const e=new Set(t),i=this.fields.filter((t=>e.has(t.name)));return new Jr(i,this.metadata)}selectAt(t){const e=t.map((t=>this.fields[t])).filter(Boolean);return new Jr(e,this.metadata)}assign(...t){const e=t[0]instanceof Jr?t[0]:Array.isArray(t[0])?new Jr(t[0]):new Jr(t),i=[...this.fields],n=Qr(Qr(new Map,this.metadata),e.metadata),r=e.fields.filter((t=>{const e=i.findIndex((e=>e.name===t.name));return!~e||(i[e]=t.clone({metadata:Qr(Qr(new Map,i[e].metadata),t.metadata)}))&&!1})),s=ts(r,new Map);return new Jr([...i,...r],n,new Map([...this.dictionaries,...s]))}}Jr.prototype.fields=null,Jr.prototype.metadata=null,Jr.prototype.dictionaries=null;class qr{static new(...t){let[e,i,n,r]=t;return t[0]&&"object"==typeof t[0]&&(({name:e}=t[0]),void 0===i&&(i=t[0].type),void 0===n&&(n=t[0].nullable),void 0===r&&(r=t[0].metadata)),new qr(`${e}`,i,n,r)}constructor(t,e,i=!1,n){this.name=t,this.type=e,this.nullable=i,this.metadata=n||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,i,n,r]=t;return t[0]&&"object"==typeof t[0]?({name:e=this.name,type:i=this.type,nullable:n=this.nullable,metadata:r=this.metadata}=t[0]):[e=this.name,i=this.type,n=this.nullable,r=this.metadata]=t,qr.new(e,i,n,r)}}function Qr(t,e){return new Map([...t||new Map,...e||new Map])}function ts(t,e=new Map){for(let i=-1,n=t.length;++i0&&ts(n.children,e)}return e}qr.prototype.type=null,qr.prototype.name=null,qr.prototype.nullable=null,qr.prototype.metadata=null;var es=o.Builder,is=o.ByteBuffer;class ns{static decode(t){t=new is(F(t));const e=Kr.getRootAsFooter(t),i=Jr.decode(e.schema(),new Map,e.version());return new rs(i,e)}static encode(t){const e=new es,i=Jr.encode(e,t.schema);Kr.startRecordBatchesVector(e,t.numRecordBatches);for(const i of[...t.recordBatches()].slice().reverse())ss.encode(e,i);const n=e.endVector();Kr.startDictionariesVector(e,t.numDictionaries);for(const i of[...t.dictionaryBatches()].slice().reverse())ss.encode(e,i);const r=e.endVector();return Kr.startFooter(e),Kr.addSchema(e,i),Kr.addVersion(e,Y.V5),Kr.addRecordBatches(e,n),Kr.addDictionaries(e,r),Kr.finishFooterBuffer(e,Kr.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=Y.V5,i,n){this.schema=t,this.version=e,i&&(this._recordBatches=i),n&&(this._dictionaryBatches=n)}*recordBatches(){for(let t,e=-1,i=this.numRecordBatches;++e=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t))}get closed(){return this._closedPromise}cancel(t){return r(this,void 0,void 0,(function*(){yield this.return(t)}))}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(os);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return j.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return j.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return r(this,void 0,void 0,(function*(){return yield this.abort(t),os}))}return(t){return r(this,void 0,void 0,(function*(){return yield this.close(),os}))}read(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise(((t,e)=>{this.resolvers.push({resolve:t,reject:e})})):Promise.resolve(os)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class cs extends us{write(t){if((t=F(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?u(this.toUint8Array(!0)):this.toUint8Array(!1).then(u)}toUint8Array(t=!1){return t?O(this._values)[0]:(()=>r(this,void 0,void 0,(function*(){var t,e,i,r;const s=[];let o=0;try{for(var a,l=!0,u=n(this);!(t=(a=yield u.next()).done);l=!0){r=a.value,l=!1;const t=r;s.push(t),o+=t.byteLength}}catch(t){e={error:t}}finally{try{l||t||!(i=u.return)||(yield i.call(u))}finally{if(e)throw e.error}}return O(s,o)[0]})))()}}class hs{constructor(t){t&&(this.source=new ps(j.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class ds{constructor(t){t instanceof ds?this.source=t.source:t instanceof cs?this.source=new ys(j.fromAsyncIterable(t)):A(t)?this.source=new ys(j.fromNodeStream(t)):S(t)?this.source=new ys(j.fromDOMStream(t)):w(t)?this.source=new ys(j.fromDOMStream(t.body)):b(t)?this.source=new ys(j.fromIterable(t)):(f(t)||g(t))&&(this.source=new ys(j.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class ps{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||os)}return(t){return Object.create(this.source.return&&this.source.return(t)||os)}}class ys{constructor(t){this.source=t,this._closedPromise=new Promise((t=>this._closedPromiseResolve=t))}cancel(t){return r(this,void 0,void 0,(function*(){yield this.return(t)}))}get closed(){return this._closedPromise}read(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(t){return r(this,arguments,void 0,(function*(t,e="read"){return yield this.source.next({cmd:e,size:t})}))}throw(t){return r(this,void 0,void 0,(function*(){const e=this.source.throw&&(yield this.source.throw(t))||os;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}return(t){return r(this,void 0,void 0,(function*(){const e=this.source.return&&(yield this.source.return(t))||os;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}}class fs extends hs{constructor(t,e){super(),this.position=0,this.buffer=F(t),this.size=void 0===e?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),tr(this,void 0,void 0,(function*(){this.size=(yield t.stat()).size,delete this._pending})))()}readInt32(t){return r(this,void 0,void 0,(function*(){const{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}))}seek(t){return r(this,void 0,void 0,(function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),i=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]);let n=e[3]*i[3];this.buffer[0]=65535&n;let r=n>>>16;return n=e[2]*i[3],r+=n,n=e[3]*i[2]>>>0,r+=n,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0>>16,this.buffer[1]+=e[1]*i[3]+e[2]*i[2]+e[3]*i[1],this.buffer[1]+=e[0]*i[3]+e[1]*i[2]+e[2]*i[1]+e[3]*i[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${gs(this.buffer[3])} ${gs(this.buffer[2])} ${gs(this.buffer[1])} ${gs(this.buffer[0])}`}static multiply(t,e){return new Is(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Is(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Is.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Is.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const i=t.startsWith("-"),n=t.length,r=new Is(e);for(let e=i?1:0;e0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class Bs extends As{constructor(t,e,i,n,r){super(new Uint8Array(0),e,i,n,r),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):or(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return L(Uint8Array,L(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return L(Uint8Array,L(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:i}=this;return Ie.isTimestamp(t)||(Ie.isInt(t)||Ie.isTime(t))&&64===t.bitWidth||Ie.isDuration(t)||Ie.isDate(t)&&t.unit===Z.MILLISECOND?L(Uint8Array,ws.convertArray(i[e])):Ie.isDecimal(t)?L(Uint8Array,Is.convertArray(i[e])):Ie.isBinary(t)||Ie.isLargeBinary(t)||Ie.isFixedSizeBinary(t)?function(t){const e=t.join(""),i=new Uint8Array(e.length/2);for(let t=0;t>1]=Number.parseInt(e.slice(t,t+2),16);return i}(i[e]):Ie.isBool(t)?or(i[e]):Ie.isUtf8(t)||Ie.isLargeUtf8(t)?h(i[e].join("")):L(Uint8Array,L(t.ArrayType,i[e].map((t=>+t))))}}class Ds extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,F(e))}_flushPending(t,e){const i=this._offsets,n=this._values.reserve(e).buffer;let r=0;for(const[e,s]of t)if(void 0===s)i.set(e,0);else{const t=s.length;n.set(s,r),i.set(e,t),r+=t}}}class Ts extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,F(e))}_flushPending(t,e){const i=this._offsets,n=this._values.reserve(e).buffer;let r=0;for(const[e,s]of t)if(void 0===s)i.set(e,BigInt(0));else{const t=s.length;n.set(s,r),i.set(e,BigInt(t)),r+=t}}}class Os extends Hr{constructor(t){super(t),this._values=new Wr}setValue(t,e){this._values.set(t,+e)}}class Ls extends Gr{}Ls.prototype._setValue=ji;class xs extends Ls{}xs.prototype._setValue=Ei;class Ms extends Ls{}Ms.prototype._setValue=Vi;class Fs extends Gr{}Fs.prototype._setValue=qi;class Ns extends Hr{constructor({type:t,nullValues:e,dictionaryHashFunction:i}){super({type:new mi(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ro({type:this.type.indices,nullValues:e}),this.dictionary=Ro({type:this.type.dictionary,nullValues:null}),"function"==typeof i&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){const i=this.indices;return e=i.setValid(t,e),this.length=i.length,e}setValue(t,e){const i=this._keysToIndices,n=this.valueToKey(e);let r=i[n];return void 0===r&&(i[n]=r=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,r)}flush(){const t=this.type,e=this._dictionary,i=this.dictionary.toVector(),n=this.indices.flush().clone(t);return n.dictionary=e?e.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=n.dictionary,this.clear(),n}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return"string"==typeof t?t:`${t}`}}class Us extends Gr{}Us.prototype._setValue=Ri;class Cs extends Hr{setValue(t,e){const[i]=this.children,n=t*this.stride;for(let t=-1,r=e.length;++t0)throw new Error("FixedSizeListBuilder can only have one child.");const i=this.children.push(t);return this.type=new bi(this.type.listSize,new qr(e,t.type,!0)),i}}class Es extends Gr{setValue(t,e){this._values.set(t,e)}}class Vs extends Es{setValue(t,e){super.setValue(t,Oi(e))}}class Rs extends Es{}class zs extends Es{}class Ps extends Gr{}Ps.prototype._setValue=en;class js extends Ps{}js.prototype._setValue=nn;class ks extends Ps{}ks.prototype._setValue=rn;class $s extends Gr{}$s.prototype._setValue=un;class Ws extends $s{}Ws.prototype._setValue=sn;class Ys extends $s{}Ys.prototype._setValue=on;class Hs extends $s{}Hs.prototype._setValue=an;class Gs extends $s{}Gs.prototype._setValue=ln;class Zs extends Gr{setValue(t,e){this._values.set(t,e)}}class Xs extends Zs{}class Ks extends Zs{}class Js extends Zs{}class qs extends Zs{}class Qs extends Zs{}class to extends Zs{}class eo extends Zs{}class io extends Zs{}class no extends Zr{constructor(t){super(t),this._offsets=new Yr(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ci(new qr(e,t.type,!0)),this.numChildren-1}_flushPending(t){const e=this._offsets,[i]=this.children;for(const[n,r]of t)if(void 0===r)e.set(n,0);else{const t=r,s=t.length,o=e.set(n,s).buffer[n];for(let e=-1;++e0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new gi(new qr(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){const e=this._offsets,[i]=this.children;for(const[n,r]of t)if(void 0===r)e.set(n,0);else{let{[n]:t,[n+1]:s}=e.set(n,r.size).buffer;for(const e of r.entries())if(i.set(t,e),++t>=s)break}}}class so extends Hr{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}}class oo extends Hr{setValue(t,e){const{children:i,type:n}=this;switch(Array.isArray(e)||e.constructor){case!0:return n.children.forEach(((n,r)=>i[r].set(t,e[r])));case Map:return n.children.forEach(((n,r)=>i[r].set(t,e.get(n.name))));default:return n.children.forEach(((n,r)=>i[r].set(t,e[n.name])))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach((i=>i.setValid(t,e))),e}addChild(t,e=`${this.numChildren}`){const i=this.children.push(t);return this.type=new hi([...this.type.children,new qr(e,t.type,!0)]),i}}class ao extends Gr{}ao.prototype._setValue=Hi;class lo extends ao{}lo.prototype._setValue=ki;class uo extends ao{}uo.prototype._setValue=$i;class co extends ao{}co.prototype._setValue=Wi;class ho extends ao{}ho.prototype._setValue=Yi;class po extends Gr{}po.prototype._setValue=Ji;class yo extends po{}yo.prototype._setValue=Gi;class fo extends po{}fo.prototype._setValue=Zi;class bo extends po{}bo.prototype._setValue=Xi;class go extends po{}go.prototype._setValue=Ki;class vo extends Hr{constructor(t){super(t),this._typeIds=new $r(Int8Array,0,1),"function"==typeof t.valueToChildTypeId&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,i){return void 0===i&&(i=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,i),this}setValue(t,e,i){this._typeIds.set(t,i);const n=this.type.typeIdToChildIndex[i],r=this.children[n];null==r||r.set(t,e)}addChild(t,e=`${this.children.length}`){const i=this.children.push(t),{type:{children:n,mode:r,typeIds:s}}=this,o=[...n,new qr(e,t.type)];return this.type=new di(r,[...s,i],o),i}_valueToChildTypeId(t,e,i){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class _o extends vo{}class mo extends vo{constructor(t){super(t),this._offsets=new $r(Int32Array)}setValue(t,e,i){const n=this._typeIds.set(t,i).buffer[t],r=this.getChildAt(this.type.typeIdToChildIndex[n]),s=this._offsets.set(t,r.length).buffer[t];null==r||r.set(s,e)}}class wo extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,h(e))}_flushPending(t,e){}}wo.prototype._flushPending=Ds.prototype._flushPending;class Io extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,h(e))}_flushPending(t,e){}}Io.prototype._flushPending=Ts.prototype._flushPending;const So=new class extends Ii{visitNull(){return so}visitBool(){return Os}visitInt(){return Zs}visitInt8(){return Xs}visitInt16(){return Ks}visitInt32(){return Js}visitInt64(){return qs}visitUint8(){return Qs}visitUint16(){return to}visitUint32(){return eo}visitUint64(){return io}visitFloat(){return Es}visitFloat16(){return Vs}visitFloat32(){return Rs}visitFloat64(){return zs}visitUtf8(){return wo}visitLargeUtf8(){return Io}visitBinary(){return Ds}visitLargeBinary(){return Ts}visitFixedSizeBinary(){return Us}visitDate(){return Ls}visitDateDay(){return xs}visitDateMillisecond(){return Ms}visitTimestamp(){return ao}visitTimestampSecond(){return lo}visitTimestampMillisecond(){return uo}visitTimestampMicrosecond(){return co}visitTimestampNanosecond(){return ho}visitTime(){return po}visitTimeSecond(){return yo}visitTimeMillisecond(){return fo}visitTimeMicrosecond(){return bo}visitTimeNanosecond(){return go}visitDecimal(){return Fs}visitList(){return no}visitStruct(){return oo}visitUnion(){return vo}visitDenseUnion(){return mo}visitSparseUnion(){return _o}visitDictionary(){return Ns}visitInterval(){return Ps}visitIntervalDayTime(){return js}visitIntervalYearMonth(){return ks}visitDuration(){return $s}visitDurationSecond(){return Ws}visitDurationMillisecond(){return Ys}visitDurationMicrosecond(){return Hs}visitDurationNanosecond(){return Gs}visitFixedSizeList(){return Cs}visitMap(){return ro}};class Ao extends Ii{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every(((t,i)=>this.compareFields(t,e[i])))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function Bo(t,e){return e instanceof t.constructor}function Do(t,e){return t===e||Bo(t,e)}function To(t,e){return t===e||Bo(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function Oo(t,e){return t===e||Bo(t,e)&&t.precision===e.precision}function Lo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit}function xo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function Mo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Fo(t,e){return t===e||Bo(t,e)&&t.mode===e.mode&&t.typeIds.every(((t,i)=>t===e.typeIds[i]))&&Co.compareManyFields(t.children,e.children)}function No(t,e){return t===e||Bo(t,e)&&t.unit===e.unit}function Uo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit}Ao.prototype.visitNull=Do,Ao.prototype.visitBool=Do,Ao.prototype.visitInt=To,Ao.prototype.visitInt8=To,Ao.prototype.visitInt16=To,Ao.prototype.visitInt32=To,Ao.prototype.visitInt64=To,Ao.prototype.visitUint8=To,Ao.prototype.visitUint16=To,Ao.prototype.visitUint32=To,Ao.prototype.visitUint64=To,Ao.prototype.visitFloat=Oo,Ao.prototype.visitFloat16=Oo,Ao.prototype.visitFloat32=Oo,Ao.prototype.visitFloat64=Oo,Ao.prototype.visitUtf8=Do,Ao.prototype.visitLargeUtf8=Do,Ao.prototype.visitBinary=Do,Ao.prototype.visitLargeBinary=Do,Ao.prototype.visitFixedSizeBinary=function(t,e){return t===e||Bo(t,e)&&t.byteWidth===e.byteWidth},Ao.prototype.visitDate=Lo,Ao.prototype.visitDateDay=Lo,Ao.prototype.visitDateMillisecond=Lo,Ao.prototype.visitTimestamp=xo,Ao.prototype.visitTimestampSecond=xo,Ao.prototype.visitTimestampMillisecond=xo,Ao.prototype.visitTimestampMicrosecond=xo,Ao.prototype.visitTimestampNanosecond=xo,Ao.prototype.visitTime=Mo,Ao.prototype.visitTimeSecond=Mo,Ao.prototype.visitTimeMillisecond=Mo,Ao.prototype.visitTimeMicrosecond=Mo,Ao.prototype.visitTimeNanosecond=Mo,Ao.prototype.visitDecimal=Do,Ao.prototype.visitList=function(t,e){return t===e||Bo(t,e)&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)},Ao.prototype.visitStruct=function(t,e){return t===e||Bo(t,e)&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)},Ao.prototype.visitUnion=Fo,Ao.prototype.visitDenseUnion=Fo,Ao.prototype.visitSparseUnion=Fo,Ao.prototype.visitDictionary=function(t,e){return t===e||Bo(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&Co.visit(t.indices,e.indices)&&Co.visit(t.dictionary,e.dictionary)},Ao.prototype.visitInterval=No,Ao.prototype.visitIntervalDayTime=No,Ao.prototype.visitIntervalYearMonth=No,Ao.prototype.visitDuration=Uo,Ao.prototype.visitDurationSecond=Uo,Ao.prototype.visitDurationMillisecond=Uo,Ao.prototype.visitDurationMicrosecond=Uo,Ao.prototype.visitDurationNanosecond=Uo,Ao.prototype.visitFixedSizeList=function(t,e){return t===e||Bo(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)},Ao.prototype.visitMap=function(t,e){return t===e||Bo(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)};const Co=new Ao;function Eo(t,e){return Co.compareSchemas(t,e)}function Vo(t,e){return Co.visit(t,e)}function Ro(t){const e=t.type,i=new(So.getVisitFn(e)())(t);if(e.children&&e.children.length>0){const n=t.children||[],r={nullValues:t.nullValues},s=Array.isArray(n)?(t,e)=>n[e]||r:({name:t})=>n[t]||r;for(const[t,n]of e.children.entries()){const{type:e}=n,r=s(n,t);i.children.push(Ro(Object.assign(Object.assign({},r),{type:e})))}}return i}function zo(t,e){if(t instanceof dr||t instanceof Er||t.type instanceof Ie||ArrayBuffer.isView(t))return Rr(t);const i=[...ko({type:null!=e?e:jo(t),nullValues:[null]})(t)],n=1===i.length?i[0]:i.reduce(((t,e)=>t.concat(e)));return Ie.isDictionary(n.type)?n.memoize():n}function Po(t){const e=zo(t),i=new Jo(new Jr(e.type.children),e.data[0]);return new Zo(i)}function jo(t){if(0===t.length)return new Se;let e=0,i=0,n=0,r=0,s=0,o=0,a=0,l=0;for(const u of t){if(null!=u){switch(typeof u){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++r;continue;case"string":++s;continue;case"object":Array.isArray(u)?++i:"[object Date]"===Object.prototype.toString.call(u)?++l:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}++e}if(r+e===t.length)return new Ee;if(s+e===t.length)return new mi(new ze,new Te);if(o+e===t.length)return new Oe;if(a+e===t.length)return new je;if(l+e===t.length)return new Qe;if(i+e===t.length){const e=t,i=jo(e[e.findIndex((t=>null!=t))]);if(e.every((t=>null==t||Vo(i,jo(t)))))return new ci(new qr("",i,!0))}else if(n+e===t.length){const e=new Map;for(const i of t)for(const t of Object.keys(i))e.has(t)||null==i[t]||e.set(t,new qr(t,jo([i[t]]),!0));return new hi([...e.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function ko(t){const{queueingStrategy:e="count"}=t,{highWaterMark:i=("bytes"!==e?Number.POSITIVE_INFINITY:Math.pow(2,14))}=t,n="bytes"!==e?"length":"byteLength";return function*(e){let r=0;const s=Ro(t);for(const t of e)s.append(t)[n]>=i&&++r&&(yield s.toVector());(s.finish().length>0||0===r)&&(yield s.toVector())}}function $o(i){const{queueingStrategy:r="count"}=i,{highWaterMark:s=("bytes"!==r?Number.POSITIVE_INFINITY:Math.pow(2,14))}=i,o="bytes"!==r?"length":"byteLength";return function(r){return t(this,arguments,(function*(){var t,a,l,u;let c=0;const h=Ro(i);try{for(var d,p=!0,y=n(r);!(t=(d=yield e(y.next())).done);p=!0){u=d.value,p=!1;const t=u;h.append(t)[o]>=s&&++c&&(yield yield e(h.toVector()))}}catch(t){a={error:t}}finally{try{p||t||!(l=y.return)||(yield e(l.call(y)))}finally{if(a)throw a.error}}(h.finish().length>0||0===c)&&(yield yield e(h.toVector()))}))}}function Wo(t,e){return function(t,e){const i=[...t.fields],n=[],r={numBatches:e.reduce(((t,e)=>Math.max(t,e.length)),0)};let s=0,o=0,a=-1;const l=e.length;let u,c=[];for(;r.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(n[s++]=fr({type:new hi(i),length:o,nullCount:0,children:c.slice()})))}return[t=t.assign(i),n.map((e=>new Jo(t,e)))]}(t,e.map((t=>t.data.concat())))}function Yo(t,e,i,n,r){var s;const o=(e+63&-64)>>3;for(let a=-1,l=n.length;++a=e)u===e?i[a]=l:(i[a]=l.slice(0,e),r.numBatches=Math.max(r.numBatches,n[a].unshift(l.slice(e,u-e))));else{const n=t[a];t[a]=n.clone({nullable:!0}),i[a]=null!==(s=null==l?void 0:l._changeLengthAndBackfillNullBitmap(e))&&void 0!==s?s:fr({type:n.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)})}}return i}var Ho,Go;class Zo{constructor(...t){var e,i;if(0===t.length)return this.batches=[],this.schema=new Jr([]),this._offsets=[0],this;let n,r;t[0]instanceof Jr&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());const s=t=>{if(t){if(t instanceof Jo)return[t];if(t instanceof Zo)return t.batches;if(t instanceof dr){if(t.type instanceof hi)return[new Jo(new Jr(t.type.children),t)]}else{if(Array.isArray(t))return t.flatMap((t=>s(t)));if("function"==typeof t[Symbol.iterator])return[...t].flatMap((t=>s(t)));if("object"==typeof t){const e=Object.keys(t),i=e.map((e=>new Er([t[e]]))),r=null!=n?n:new Jr(e.map(((t,e)=>new qr(String(t),i[e].type,i[e].nullable)))),[,s]=Wo(r,i);return 0===s.length?[new Jo(t)]:s}}}return[]},o=t.flatMap((t=>s(t)));if(n=null!==(i=null!=n?n:null===(e=o[0])||void 0===e?void 0:e.schema)&&void 0!==i?i:new Jr([]),!(n instanceof Jr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const t of o){if(!(t instanceof Jo))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Eo(n,t.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=o,this._offsets=null!=r?r:vr(this.data)}get data(){return this.batches.map((({data:t})=>t))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce(((t,e)=>t+e.length),0)}get nullCount(){return-1===this._nullCount&&(this._nullCount=gr(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Jn(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Fr.visit(new Er(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(",\n ")}\n]`}concat(...t){const e=this.schema,i=this.data.concat(t.flatMap((({data:t})=>t)));return new Zo(e,i.map((t=>new Jo(e,t))))}slice(t,e){const i=this.schema;[t,e]=Kn({length:this.numRows},t,e);const n=_r(this.data,this._offsets,t,e);return new Zo(i,n.map((t=>new Jo(i,t))))}getChild(t){return this.getChildAt(this.schema.fields.findIndex((e=>e.name===t)))}getChildAt(t){if(t>-1&&te.children[t]));if(0===e.length){const{type:i}=this.schema.fields[t],n=fr({type:i,length:0,nullCount:0});e.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new Er(e)}return null}setChild(t,e){var i;return this.setChildAt(null===(i=this.schema.fields)||void 0===i?void 0:i.findIndex((e=>e.name===t)),e)}setChildAt(t,e){let i=this.schema,n=[...this.batches];if(t>-1&&tthis.getChildAt(e)));[r[t],o[t]]=[s,e],[i,n]=Wo(i,o)}return new Zo(i,n)}select(t){const e=this.schema.fields.reduce(((t,e,i)=>t.set(e.name,i)),new Map);return this.selectAt(t.map((t=>e.get(t))).filter((t=>t>-1)))}selectAt(t){const e=this.schema.selectAt(t),i=this.batches.map((e=>e.selectAt(t)));return new Zo(e,i)}assign(t){const e=this.schema.fields,[i,n]=t.schema.fields.reduce(((t,i,n)=>{const[r,s]=t,o=e.findIndex((t=>t.name===i.name));return~o?s[o]=n:r.push(n),t}),[[],[]]),r=this.schema.assign(t.schema),s=[...e.map(((t,e)=>[e,n[e]])).map((([e,i])=>void 0===i?this.getChildAt(e):t.getChildAt(i))),...i.map((e=>t.getChildAt(e)))].filter(Boolean);return new Zo(...Wo(r,s))}}function Xo(t){const e={},i=Object.entries(t);for(const[t,n]of i)e[t]=Rr(n);return new Zo(e)}function Ko(t){const e={},i=Object.entries(t);for(const[t,n]of i)e[t]=zo(n);return new Zo(e)}Ho=Symbol.toStringTag,Zo[Ho]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=Ir(wr),t.get=Ir(jn.getVisitFn(st.Struct)),t.set=Sr(cn.getVisitFn(st.Struct)),t.indexOf=Ar(Or.getVisitFn(st.Struct)),"Table"))(Zo.prototype);class Jo{constructor(...t){switch(t.length){case 2:if([this.schema]=t,!(this.schema instanceof Jr))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=fr({nullCount:0,type:new hi(this.schema.fields),children:this.schema.fields.map((t=>fr({type:t.type,nullCount:0})))})]=t,!(this.data instanceof dr))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=qo(this.schema,this.data.children);break;case 1:{const[e]=t,{fields:i,children:n,length:r}=Object.keys(e).reduce(((t,i,n)=>(t.children[n]=e[i],t.length=Math.max(t.length,e[i].length),t.fields[n]=qr.new({name:i,type:e[i].type,nullable:!0}),t)),{length:0,fields:new Array,children:new Array}),s=new Jr(i),o=fr({type:new hi(i),length:r,children:n,nullCount:0});[this.schema,this.data]=qo(s,o.children,r);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Qo(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return jn.visit(this.data,t)}at(t){return this.get(Jn(t,this.numRows))}set(t,e){return cn.visit(this.data,t,e)}indexOf(t,e){return Or.visit(this.data,t,e)}[Symbol.iterator](){return Fr.visit(new Er([this.data]))}toArray(){return[...this]}concat(...t){return new Zo(this.schema,[this,...t])}slice(t,e){const[i]=new Er([this.data]).slice(t,e).data;return new Jo(this.schema,i)}getChild(t){var e;return this.getChildAt(null===(e=this.schema.fields)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&te.name===t)),e)}setChildAt(t,e){let i=this.schema,n=this.data;if(t>-1&&tt.name===e));~t&&(n[t]=this.data.children[t])}return new Jo(e,fr({type:i,length:this.numRows,children:n}))}selectAt(t){const e=this.schema.selectAt(t),i=t.map((t=>this.data.children[t])).filter(Boolean),n=fr({type:new hi(e.fields),length:this.numRows,children:i});return new Jo(e,n)}}function qo(t,e,i=e.reduce(((t,e)=>Math.max(t,e.length)),0)){var n;const r=[...t.fields],s=[...e],o=(i+63&-64)>>3;for(const[a,l]of t.fields.entries()){const t=e[a];t&&t.length===i||(r[a]=l.clone({nullable:!0}),s[a]=null!==(n=null==t?void 0:t._changeLengthAndBackfillNullBitmap(i))&&void 0!==n?n:fr({type:l.type,length:i,nullCount:i,nullBitmap:new Uint8Array(o)}))}return[t.assign(r),fr({type:new hi(r),length:i,children:s})]}function Qo(t,e,i=new Map){var n,r;if((null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0)>0&&(null==t?void 0:t.length)===(null==e?void 0:e.length))for(let n=-1,s=t.length;++n(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Jo.prototype);class ta extends Jo{constructor(t){const e=t.fields.map((t=>fr({type:t.type})));super(t,fr({type:new hi(t.fields),nullCount:0,children:e}))}}class ea{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new ea).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ea).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):rt.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Y.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,rt.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,i,n,r,s){return ea.startMessage(t),ea.addVersion(t,e),ea.addHeaderType(t,i),ea.addHeader(t,n),ea.addBodyLength(t,r),ea.addCustomMetadata(t,s),ea.endMessage(t)}}const ia=new class extends Ii{visit(t,e){return null==t||null==e?void 0:super.visit(t,e)}visitNull(t,e){return Ot.startNull(e),Ot.endNull(e)}visitInt(t,e){return dt.startInt(e),dt.addBitWidth(e,t.bitWidth),dt.addIsSigned(e,t.isSigned),dt.endInt(e)}visitFloat(t,e){return It.startFloatingPoint(e),It.addPrecision(e,t.precision),It.endFloatingPoint(e)}visitBinary(t,e){return ft.startBinary(e),ft.endBinary(e)}visitLargeBinary(t,e){return At.startLargeBinary(e),At.endLargeBinary(e)}visitBool(t,e){return bt.startBool(e),bt.endBool(e)}visitUtf8(t,e){return Nt.startUtf8(e),Nt.endUtf8(e)}visitLargeUtf8(t,e){return Bt.startLargeUtf8(e),Bt.endLargeUtf8(e)}visitDecimal(t,e){return vt.startDecimal(e),vt.addScale(e,t.scale),vt.addPrecision(e,t.precision),vt.addBitWidth(e,t.bitWidth),vt.endDecimal(e)}visitDate(t,e){return gt.startDate(e),gt.addUnit(e,t.unit),gt.endDate(e)}visitTime(t,e){return xt.startTime(e),xt.addUnit(e,t.unit),xt.addBitWidth(e,t.bitWidth),xt.endTime(e)}visitTimestamp(t,e){const i=t.timezone&&e.createString(t.timezone)||void 0;return Mt.startTimestamp(e),Mt.addUnit(e,t.unit),void 0!==i&&Mt.addTimezone(e,i),Mt.endTimestamp(e)}visitInterval(t,e){return St.startInterval(e),St.addUnit(e,t.unit),St.endInterval(e)}visitDuration(t,e){return _t.startDuration(e),_t.addUnit(e,t.unit),_t.endDuration(e)}visitList(t,e){return Dt.startList(e),Dt.endList(e)}visitStruct(t,e){return Lt.startStruct_(e),Lt.endStruct_(e)}visitUnion(t,e){Ft.startTypeIdsVector(e,t.typeIds.length);const i=Ft.createTypeIdsVector(e,t.typeIds);return Ft.startUnion(e),Ft.addMode(e,t.mode),Ft.addTypeIds(e,i),Ft.endUnion(e)}visitDictionary(t,e){const i=this.visit(t.indices,e);return pt.startDictionaryEncoding(e),pt.addId(e,BigInt(t.id)),pt.addIsOrdered(e,t.isOrdered),void 0!==i&&pt.addIndexType(e,i),pt.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return mt.startFixedSizeBinary(e),mt.addByteWidth(e,t.byteWidth),mt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return wt.startFixedSizeList(e),wt.addListSize(e,t.listSize),wt.endFixedSizeList(e)}visitMap(t,e){return Tt.startMap(e),Tt.addKeysSorted(e,t.keysSorted),Tt.endMap(e)}};function na(t){return new pa(t.count,sa(t.columns),oa(t.columns))}function ra(t,e){return(t.children||[]).filter(Boolean).map((t=>qr.fromJSON(t,e)))}function sa(t){return(t||[]).reduce(((t,e)=>{return[...t,new ba(e.count,(i=e.VALIDITY,(i||[]).reduce(((t,e)=>t+ +(0===e)),0))),...sa(e.children)];var i}),[])}function oa(t,e=[]){for(let i=-1,n=(t||[]).length;++i[t,e])))}function la(t){return new Ae(t.isSigned,t.bitWidth)}function ua(t,e){const i=t.type.name;switch(i){case"NONE":case"null":return new Se;case"binary":return new Ve;case"largebinary":return new Re;case"utf8":return new ze;case"largeutf8":return new Pe;case"bool":return new je;case"list":return new ci((e||[])[0]);case"struct":case"struct_":return new hi(e||[])}switch(i){case"int":{const e=t.type;return new Ae(e.isSigned,e.bitWidth)}case"floatingpoint":{const e=t.type;return new Ne(G[e.precision])}case"decimal":{const e=t.type;return new ke(e.scale,e.precision,e.bitWidth)}case"date":{const e=t.type;return new $e(Z[e.unit])}case"time":{const e=t.type;return new He(X[e.unit],e.bitWidth)}case"timestamp":{const e=t.type;return new Je(X[e.unit],e.timezone)}case"interval":{const e=t.type;return new ii(K[e.unit])}case"duration":{const e=t.type;return new si(X[e.unit])}case"union":{const i=t.type,[n,...r]=(i.mode+"").toLowerCase(),s=n.toUpperCase()+r.join("");return new di(H[s],i.typeIds||[],e||[])}case"fixedsizebinary":{const e=t.type;return new fi(e.byteWidth)}case"fixedsizelist":{const i=t.type;return new bi(i.listSize,(e||[])[0])}case"map":{const i=t.type;return new gi((e||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${i}"`)}var ca=o.Builder,ha=o.ByteBuffer;class da{static fromJSON(t,e){const i=new da(0,Y.V5,e);return i._createHeader=function(t,e){return()=>{switch(e){case rt.Schema:return Jr.fromJSON(t);case rt.RecordBatch:return pa.fromJSON(t);case rt.DictionaryBatch:return ya.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${rt[e]}, type: ${e} }`)}}(t,e),i}static decode(t){t=new ha(F(t));const e=ea.getRootAsMessage(t),i=e.bodyLength(),n=e.version(),r=e.headerType(),s=new da(i,n,r);return s._createHeader=function(t,e){return()=>{switch(e){case rt.Schema:return Jr.decode(t.header(new Ct),new Map,t.version());case rt.RecordBatch:return pa.decode(t.header(new ct),t.version());case rt.DictionaryBatch:return ya.decode(t.header(new ht),t.version())}throw new Error(`Unrecognized Message type: { name: ${rt[e]}, type: ${e} }`)}}(e,r),s}static encode(t){const e=new ca;let i=-1;return t.isSchema()?i=Jr.encode(e,t.header()):t.isRecordBatch()?i=pa.encode(e,t.header()):t.isDictionaryBatch()&&(i=ya.encode(e,t.header())),ea.startMessage(e),ea.addVersion(e,Y.V5),ea.addHeader(e,i),ea.addHeaderType(e,t.headerType),ea.addBodyLength(e,BigInt(t.bodyLength)),ea.finishMessageBuffer(e,ea.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof Jr)return new da(0,Y.V5,rt.Schema,t);if(t instanceof pa)return new da(e,Y.V5,rt.RecordBatch,t);if(t instanceof ya)return new da(e,Y.V5,rt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===rt.Schema}isRecordBatch(){return this.headerType===rt.RecordBatch}isDictionaryBatch(){return this.headerType===rt.DictionaryBatch}constructor(t,e,i,n){this._version=e,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=zt(t)}}class pa{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,i){this._nodes=e,this._buffers=i,this._length=zt(t)}}class ya{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=zt(e)}}class fa{constructor(t,e){this.offset=zt(t),this.length=zt(e)}}class ba{constructor(t,e){this.length=zt(t),this.nullCount=zt(e)}}function ga(t,e){const i=[];for(let n,r=-1,s=-1,o=t.childrenLength();++rqr.encode(t,e))),l=Ut.createChildrenVector(t,a),u=e.metadata&&e.metadata.size>0?Ut.createCustomMetadataVector(t,[...e.metadata].map((([e,i])=>{const n=t.createString(`${e}`),r=t.createString(`${i}`);return yt.startKeyValue(t),yt.addKey(t,n),yt.addValue(t,r),yt.endKeyValue(t)}))):-1;e.name&&(i=t.createString(e.name));Ut.startField(t),Ut.addType(t,n),Ut.addTypeType(t,o),Ut.addChildren(t,l),Ut.addNullable(t,!!e.nullable),-1!==i&&Ut.addName(t,i);-1!==r&&Ut.addDictionary(t,r);-1!==u&&Ut.addCustomMetadata(t,u);return Ut.endField(t)},qr.decode=function(t,e){let i,n,r,s,o,a;e&&(a=t.dictionary())?e.has(i=zt(a.id()))?(s=(s=a.indexType())?_a(s):new Te,o=new mi(e.get(i),s,i,a.isOrdered()),n=new qr(t.name(),o,t.nullable(),va(t))):(s=(s=a.indexType())?_a(s):new Te,e.set(i,r=ma(t,ga(t,e))),o=new mi(r,s,i,a.isOrdered()),n=new qr(t.name(),o,t.nullable(),va(t))):(r=ma(t,ga(t,e)),n=new qr(t.name(),r,t.nullable(),va(t)));return n||null},qr.fromJSON=function(t,e){let i,n,r,s,o,a;return e&&(s=t.dictionary)?e.has(i=s.id)?(n=(n=s.indexType)?la(n):new Te,a=new mi(e.get(i),n,i,s.isOrdered),r=new qr(t.name,a,t.nullable,aa(t.metadata))):(n=(n=s.indexType)?la(n):new Te,e.set(i,o=ua(t,ra(t,e))),a=new mi(o,n,i,s.isOrdered),r=new qr(t.name,a,t.nullable,aa(t.metadata))):(o=ua(t,ra(t,e)),r=new qr(t.name,o,t.nullable,aa(t.metadata))),r||null},Jr.encode=function(t,e){const i=e.fields.map((e=>qr.encode(t,e)));Ct.startFieldsVector(t,i.length);const n=Ct.createFieldsVector(t,i),r=e.metadata&&e.metadata.size>0?Ct.createCustomMetadataVector(t,[...e.metadata].map((([e,i])=>{const n=t.createString(`${e}`),r=t.createString(`${i}`);return yt.startKeyValue(t),yt.addKey(t,n),yt.addValue(t,r),yt.endKeyValue(t)}))):-1;Ct.startSchema(t),Ct.addFields(t,n),Ct.addEndianness(t,wa?Q.Little:Q.Big),-1!==r&&Ct.addCustomMetadata(t,r);return Ct.endSchema(t)},Jr.decode=function(t,e=new Map,i=Y.V5){const n=function(t,e){const i=[];for(let n,r=-1,s=-1,o=t.fieldsLength();++rqr.fromJSON(t,e)))}(t,e),aa(t.metadata),e)},pa.encode=function(t,e){const i=e.nodes||[],n=e.buffers||[];ct.startNodesVector(t,i.length);for(const e of i.slice().reverse())ba.encode(t,e);const r=t.endVector();ct.startBuffersVector(t,n.length);for(const e of n.slice().reverse())fa.encode(t,e);const s=t.endVector();return ct.startRecordBatch(t),ct.addLength(t,BigInt(e.length)),ct.addNodes(t,r),ct.addBuffers(t,s),ct.endRecordBatch(t)},pa.decode=function(t,e=Y.V5){if(null!==t.compression())throw new Error("Record batch compression not implemented");return new pa(t.length(),function(t){const e=[];for(let i,n=-1,r=-1,s=t.nodesLength();++n{const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]})(),Ia=t=>`Expected ${rt[t]} Message in stream, but was null or length 0.`,Sa=t=>`Header pointer of flatbuffer-encoded ${rt[t]} Message is null or length 0.`,Aa=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,Ba=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class Da{constructor(t){this.source=t instanceof hs?t:new hs(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?os:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Ia(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=F(this.source.read(t));if(e.byteLength[...e,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...t(i.children)]),[])}(this._body)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Ia(t));return e.value}readSchema(){const t=rt.Schema,e=this.readMessage(t),i=null==e?void 0:e.header();if(!e||!i)throw new Error(Sa(t));return i}}const La=4,xa="ARROW1",Ma=new Uint8Array(6);for(let t=0;t<6;t+=1)Ma[t]=xa.codePointAt(t);function Fa(t,e=0){for(let i=-1,n=Ma.length;++ithis)):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return j.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return j.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Ea?e:v(e)?function(t){return new Va(new Ha(t))}(e):m(e)?function(t){return r(this,void 0,void 0,(function*(){const{size:e}=yield t.stat(),i=new bs(t,e);return e>=Ca&&Fa(yield i.readAt(0,Na+7&-8))?new Pa(new Ya(i)):new Ra(new $a(i))}))}(e):f(e)?(()=>r(this,void 0,void 0,(function*(){return yield Ea.from(yield e)})))():w(e)||S(e)||A(e)||g(e)?function(e){return r(this,void 0,void 0,(function*(){const i=yield e.peek(Na+7&-8);return i&&i.byteLength>=4?Fa(i)?new za(new Wa(yield e.read())):new Ra(new $a(e)):new Ra(new $a(function(){return t(this,arguments,(function*(){}))}()))}))}(new ds(e)):function(t){const e=t.peek(Na+7&-8);return e&&e.byteLength>=4?Fa(e)?new za(new Wa(t.read())):new Va(new ka(t)):new Va(new ka(function*(){}()))}(new hs(e))}static readAll(t){return t instanceof Ea?t.isSync()?Za(t):Xa(t):v(t)||ArrayBuffer.isView(t)||b(t)||_(t)?Za(t):Xa(t)}}class Va extends Ea{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return t(this,arguments,(function*(){yield e(yield*i(n(this[Symbol.iterator]())))}))}}class Ra extends Ea{constructor(t){super(t),this._impl=t}readAll(){return r(this,void 0,void 0,(function*(){var t,e,i,r;const s=new Array;try{for(var o,a=!0,l=n(this);!(t=(o=yield l.next()).done);a=!0){r=o.value,a=!1;const t=r;s.push(t)}}catch(t){e={error:t}}finally{try{a||t||!(i=l.return)||(yield i.call(l))}finally{if(e)throw e.error}}return s}))}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class za extends Va{constructor(t){super(t),this._impl=t}}class Pa extends Ra{constructor(t){super(t),this._impl=t}}class ja{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const i=this._loadVectors(t,e,this.schema.fields),n=fr({type:new hi(this.schema.fields),length:t.length,children:i});return new Jo(this.schema,n)}_loadDictionaryBatch(t,e){const{id:i,isDelta:n}=t,{dictionaries:r,schema:s}=this,o=r.get(i);if(n||!o){const r=s.dictionaries.get(i),a=this._loadVectors(t.data,e,[r]);return(o&&n?o.concat(new Er(a)):new Er(a)).memoize()}return o.memoize()}_loadVectors(t,e,i){return new As(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}}class ka extends ja{constructor(t,e){super(e),this._reader=v(t)?new Oa(this._handle=t):new Da(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Ga(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):os}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):os}next(){if(this.closed)return os;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),n=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),n=e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,r)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new ta(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class $a extends ja{constructor(t,e){super(e),this._reader=new Ta(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return r(this,void 0,void 0,(function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}))}open(t){return r(this,void 0,void 0,(function*(){return this.closed||(this.autoDestroy=Ga(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this}))}throw(t){return r(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):os}))}return(t){return r(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):os}))}next(){return r(this,void 0,void 0,(function*(){if(this.closed)return os;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),n=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),n=yield e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,r)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new ta(this.schema)}):yield this.return()}))}_readNextMessageAndValidate(t){return r(this,void 0,void 0,(function*(){return yield this._reader.readMessage(t)}))}}class Wa extends ka{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof fs?t:new fs(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const i=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){const t=this._reader.readMessage(rt.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),i=this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,i)}}return null}_readDictionaryBatch(t){var e;const i=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){const t=this._reader.readMessage(rt.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),i=this._reader.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(e,i);this.dictionaries.set(e.id,n)}}}_readFooter(){const{_handle:t}=this,e=t.size-Ua,i=t.readInt32(e),n=t.readAt(e-i,i);return ns.decode(n)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return r(this,void 0,void 0,(function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)}))}readRecordBatch(t){return r(this,void 0,void 0,(function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const i=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){const t=yield this._reader.readMessage(rt.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),i=yield this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,i)}}return null}))}_readDictionaryBatch(t){return r(this,void 0,void 0,(function*(){var e;const i=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){const t=yield this._reader.readMessage(rt.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),i=yield this._reader.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(e,i);this.dictionaries.set(e.id,n)}}}))}_readFooter(){return r(this,void 0,void 0,(function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Ua,i=yield t.readInt32(e),n=yield t.readAt(e-i,i);return ns.decode(n)}))}_readNextMessageAndValidate(t){return r(this,void 0,void 0,(function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndext.flatMap((t=>Array.isArray(t)?e(t):t instanceof Jo?t.data.children:t.data)),i=new Ka;return i.visitMany(e(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Er)return this.visitMany(t.data),this;const{type:e}=t;if(!Ie.isDictionary(e)){const{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Ie.isUnion(e))this.nodes.push(new ba(i,0));else{const{nullCount:n}=t;Ie.isNull(e)||Ja.call(this,n<=0?new Uint8Array(0):sr(t.offset,i,t.nullBitmap)),this.nodes.push(new ba(i,n))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function Ja(t){const e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new fa(this._byteLength,e)),this._byteLength+=e,this}function qa(t){return Ja.call(this,t.values.subarray(0,t.length*t.stride))}function Qa(t){const{length:e,values:i,valueOffsets:n}=t,r=zt(n[0]),s=zt(n[e]),o=Math.min(s-r,i.byteLength-r);return Ja.call(this,R(-r,e+1,n)),Ja.call(this,i.subarray(r,r+o)),this}function tl(t){const{length:e,valueOffsets:i}=t;if(i){const{0:n,[e]:r}=i;return Ja.call(this,R(-n,e+1,i)),this.visit(t.children[0].slice(n,r-n))}return this.visit(t.children[0])}function el(t){return this.visitMany(t.type.children.map(((e,i)=>t.children[i])).filter(Boolean))[0]}Ka.prototype.visitBool=function(t){let e;return t.nullCount>=t.length?Ja.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?Ja.call(this,sr(t.offset,t.length,e)):Ja.call(this,or(t.values))},Ka.prototype.visitInt=qa,Ka.prototype.visitFloat=qa,Ka.prototype.visitUtf8=Qa,Ka.prototype.visitLargeUtf8=Qa,Ka.prototype.visitBinary=Qa,Ka.prototype.visitLargeBinary=Qa,Ka.prototype.visitFixedSizeBinary=qa,Ka.prototype.visitDate=qa,Ka.prototype.visitTimestamp=qa,Ka.prototype.visitTime=qa,Ka.prototype.visitDecimal=qa,Ka.prototype.visitList=tl,Ka.prototype.visitStruct=el,Ka.prototype.visitUnion=function(t){var e;const{type:i,length:n,typeIds:r,valueOffsets:s}=t;if(Ja.call(this,r),i.mode===H.Sparse)return el.call(this,t);if(i.mode===H.Dense){if(t.offset<=0)return Ja.call(this,s),el.call(this,t);{const o=new Int32Array(n),a=Object.create(null),l=Object.create(null);for(let t,i,u=-1;++u{const r=i.typeIds[e],s=a[r],o=l[r];return t.slice(s,Math.min(n,o))})))}}return this},Ka.prototype.visitInterval=qa,Ka.prototype.visitDuration=qa,Ka.prototype.visitFixedSizeList=tl,Ka.prototype.visitMap=tl;class il extends Ii{visit(t){return null==t?void 0:super.visit(t)}visitNull({typeId:t}){return{name:et[t].toLowerCase()}}visitInt({typeId:t,bitWidth:e,isSigned:i}){return{name:et[t].toLowerCase(),bitWidth:e,isSigned:i}}visitFloat({typeId:t,precision:e}){return{name:et[t].toLowerCase(),precision:G[e]}}visitBinary({typeId:t}){return{name:et[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:et[t].toLowerCase()}}visitBool({typeId:t}){return{name:et[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:et[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:et[t].toLowerCase()}}visitDecimal({typeId:t,scale:e,precision:i,bitWidth:n}){return{name:et[t].toLowerCase(),scale:e,precision:i,bitWidth:n}}visitDate({typeId:t,unit:e}){return{name:et[t].toLowerCase(),unit:Z[e]}}visitTime({typeId:t,unit:e,bitWidth:i}){return{name:et[t].toLowerCase(),unit:X[e],bitWidth:i}}visitTimestamp({typeId:t,timezone:e,unit:i}){return{name:et[t].toLowerCase(),unit:X[i],timezone:e}}visitInterval({typeId:t,unit:e}){return{name:et[t].toLowerCase(),unit:K[e]}}visitDuration({typeId:t,unit:e}){return{name:et[t].toLocaleLowerCase(),unit:X[e]}}visitList({typeId:t}){return{name:et[t].toLowerCase()}}visitStruct({typeId:t}){return{name:et[t].toLowerCase()}}visitUnion({typeId:t,mode:e,typeIds:i}){return{name:et[t].toLowerCase(),mode:H[e].toUpperCase(),typeIds:[...i]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:e}){return{name:et[t].toLowerCase(),byteWidth:e}}visitFixedSizeList({typeId:t,listSize:e}){return{name:et[t].toLowerCase(),listSize:e}}visitMap({typeId:t,keysSorted:e}){return{name:et[t].toLowerCase(),keysSorted:e}}}class nl extends Ii{static assemble(...t){const e=new nl;return t.map((({schema:t,data:i})=>e.visitMany(t.fields,i.children)))}visit({name:t},e){const{length:i}=e,{offset:n,nullCount:r,nullBitmap:s}=e,o=Ie.isDictionary(e.type)?e.type.indices:e.type,a=Object.assign([],e.buffers,{[ot.VALIDITY]:void 0});return Object.assign({name:t,count:i,VALIDITY:Ie.isNull(o)||Ie.isUnion(o)?void 0:r<=0?Array.from({length:i},(()=>1)):[...new ar(s,n,i,null,rr)]},super.visit(e.clone(o,n,i,0,a)))}visitNull(){return{}}visitBool({values:t,offset:e,length:i}){return{DATA:[...new ar(t,e,i,null,nr)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...sl(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new Er([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new Er([t])],OFFSET:[...sl(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...rl(new Er([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...rl(new Er([t]))],OFFSET:[...sl(t.valueOffsets,2)]}}visitFixedSizeBinary(t){return{DATA:[...rl(new Er([t]))]}}visitDate(t){return{DATA:t.type.unit===Z.DAY?[...t.values]:[...sl(t.values,2)]}}visitTimestamp(t){return{DATA:[...sl(t.values,2)]}}visitTime(t){return{DATA:t.type.unit`${t}${("0"+(255&e).toString(16)).slice(-2)}`),"").toUpperCase()}function*sl(t,e){const i=new Uint32Array(t.buffer);for(let t=-1,n=i.length/e;++tthis.writeAll(t))):g(t)?hl(this,t):cl(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){var i;return t===this._sink||t instanceof cs?this._sink=t:(this._sink=new cs,t&&(y(i=t)&&p(i.abort)&&p(i.getWriter)&&!I(i))?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&(t=>y(t)&&p(t.end)&&p(t.write)&&d(t.writable)&&!I(t))(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,e&&Eo(e,this._schema)||(null==e?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(!this._sink)throw new Error("RecordBatchWriter is closed");if(null==t)return this.finish()&&void 0;if(t instanceof Zo&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Jo&&!(e=t.schema))return this.finish()&&void 0;if(e&&!Eo(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Jo?t instanceof ta||this._writeRecordBatch(t):t instanceof Zo?this.writeAll(t.batches):b(t)&&this.writeAll(t)}_writeMessage(t,e=8){const i=e-1,n=da.encode(t),r=n.byteLength,s=this._writeLegacyIpcFormat?4:8,o=r+s+i&~i,a=o-r-s;return t.headerType===rt.RecordBatch?this._recordBatchBlocks.push(new ss(o,t.bodyLength,this._position)):t.headerType===rt.DictionaryBatch&&this._dictionaryBlocks.push(new ss(o,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-s)),r>0&&this._write(n),this._writePadding(a)}_write(t){if(this._started){const e=F(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(da.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Ma)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:i,bufferRegions:n,buffers:r}=Ka.assemble(t),s=new pa(t.numRows,i,n),o=da.from(s,e);return this._writeDictionaries(t)._writeMessage(o)._writeBodyBuffers(r)}_writeDictionaryBatch(t,e,i=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));const{byteLength:n,nodes:r,bufferRegions:s,buffers:o}=Ka.assemble(new Er([t])),a=new pa(t.length,r,s),l=new ya(a,e,i),u=da.from(l,n);return this._writeMessage(u)._writeBodyBuffers(o)}_writeBodyBuffers(t){let e,i,n;for(let r=-1,s=t.length;++r0&&(this._write(e),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(t){for(let[e,i]of t.dictionaries){let t=this._dictionaryDeltaOffsets.get(e)||0;if(0===t||(i=null==i?void 0:i.slice(t)).length>0)for(const n of i.data)this._writeDictionaryBatch(n,e,t>0),t+=n.length}return this}}class al extends ol{static writeAll(t,e){const i=new al(e);return f(t)?t.then((t=>i.writeAll(t))):g(t)?hl(i,t):cl(i,t)}}class ll extends ol{static writeAll(t){const e=new ll;return f(t)?t.then((t=>e.writeAll(t))):g(t)?hl(e,t):cl(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=ns.encode(new ns(t,Y.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}class ul extends ol{static writeAll(t){return(new ul).writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._dictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{\n "schema": ${JSON.stringify({fields:t.fields.map((t=>dl(t)))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._dictionaries.push(t),this}_writeDictionaryBatch(t,e,i=!1){return this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0)),this._write(0===this._dictionaryBlocks.length?" ":",\n "),this._write(function(t,e,i=!1){const[n]=nl.assemble(new Jo({[e]:t}));return JSON.stringify({id:e,isDelta:i,data:{count:t.length,columns:n}},null,2)}(t,e,i)),this._dictionaryBlocks.push(new ss(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._dictionaries.length>0){this._write(',\n "dictionaries": [\n');for(const t of this._dictionaries)super._writeDictionaries(t);this._write("\n ]")}if(this._recordBatches.length>0){for(let t=-1,e=this._recordBatches.length;++tdl(t))),dictionary:Ie.isDictionary(e)?{id:e.id,isOrdered:e.isOrdered,indexType:n.visit(e.indices)}:void 0}}function pl(t){const[e]=nl.assemble(t);return JSON.stringify({count:t.numRows,columns:e},null,2)}class yl{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const{readableStrategy:e,writableStrategy:i,queueingStrategy:n="count"}=t,r=s(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ro(r),this._getSize="bytes"!==n?fl:bl;const{highWaterMark:o=("bytes"===n?Math.pow(2,14):1e3)}=Object.assign({},e),{highWaterMark:a=("bytes"===n?Math.pow(2,14):1e3)}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:t=>{this._maybeFlush(this._builder,this._controller=t)},start:t=>{this._maybeFlush(this._builder,this._controller=t)}},{highWaterMark:o,size:"bytes"!==n?fl:bl}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:t=>this._writeValueAndReturnChunkSize(t)})}_writeValueAndReturnChunkSize(t){const e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){null!=e&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||0===this._numChunks)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,null==e?t.close():t.enqueue(e)}}const fl=t=>{var e;return null!==(e=null==t?void 0:t.length)&&void 0!==e?e:0},bl=t=>{var e;return null!==(e=null==t?void 0:t.byteLength)&&void 0!==e?e:0};function gl(t,e){const i=new cs;let n=null;const s=new ReadableStream({cancel(){return r(this,void 0,void 0,(function*(){yield i.close()}))},start(t){return r(this,void 0,void 0,(function*(){yield o(t,n||(n=yield function(){return r(this,void 0,void 0,(function*(){return yield(yield Ea.from(i)).open(e)}))}()))}))},pull(t){return r(this,void 0,void 0,(function*(){n?yield o(t,n):t.close()}))}});return{writable:new WritableStream(i,Object.assign({highWaterMark:Math.pow(2,14)},t)),readable:s};function o(t,e){return r(this,void 0,void 0,(function*(){let i=t.desiredSize,n=null;for(;!(n=yield e.next()).done;)if(t.enqueue(n.value),null!=i&&--i<=0)return;t.close()}))}}function vl(t,e){const i=new this(t),n=new ds(i),s=new ReadableStream({cancel(){return r(this,void 0,void 0,(function*(){yield n.cancel()}))},pull(t){return r(this,void 0,void 0,(function*(){yield o(t)}))},start(t){return r(this,void 0,void 0,(function*(){yield o(t)}))}},Object.assign({highWaterMark:Math.pow(2,14)},e));return{writable:new WritableStream(i,t),readable:s};function o(t){return r(this,void 0,void 0,(function*(){let e=null,i=t.desiredSize;for(;e=yield n.read(i||null);)if(t.enqueue(e),null!=i&&(i-=e.byteLength)<=0)return;t.close()}))}}function _l(t){const e=Ea.from(t);return f(e)?e.then((t=>_l(t))):e.isAsync()?e.readAll().then((t=>new Zo(t))):new Zo(e.readAll())}function ml(t,e="stream"){return("stream"===e?al:ll).writeAll(t).toUint8Array(!0)}const wl=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},we),Ss),hr),Li),P),ir),Rt),{compareSchemas:Eo,compareFields:function(t,e){return Co.compareFields(t,e)},compareTypes:Vo});j.toDOMStream=function(t,e){if(g(t))return function(t,e){let i=null;const n="bytes"===(null==e?void 0:e.type)||!1,s=(null==e?void 0:e.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(e){return r(this,void 0,void 0,(function*(){yield o(e,i||(i=t[Symbol.asyncIterator]()))}))},pull(t){return r(this,void 0,void 0,(function*(){i?yield o(t,i):t.close()}))},cancel(){return r(this,void 0,void 0,(function*(){(null==i?void 0:i.return)&&(yield i.return()),i=null}))}}),Object.assign({highWaterMark:n?s:void 0},e));function o(t,e){return r(this,void 0,void 0,(function*(){let i,r=null,s=t.desiredSize||null;for(;!(r=yield e.next(n?s:null)).done;)if(ArrayBuffer.isView(r.value)&&(i=F(r.value))&&(null!=s&&n&&(s=s-i.byteLength+1),r.value=i),t.enqueue(r.value),null!=s&&--s<=0)return;t.close()}))}}(t,e);if(b(t))return function(t,e){let i=null;const n="bytes"===(null==e?void 0:e.type)||!1,r=(null==e?void 0:e.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(e){s(e,i||(i=t[Symbol.iterator]()))},pull(t){i?s(t,i):t.close()},cancel(){(null==i?void 0:i.return)&&i.return(),i=null}}),Object.assign({highWaterMark:n?r:void 0},e));function s(t,e){let i,r=null,s=t.desiredSize||null;for(;!(r=e.next(n?s:null)).done;)if(ArrayBuffer.isView(r.value)&&(i=F(r.value))&&(null!=s&&n&&(s=s-i.byteLength+1),r.value=i),t.enqueue(r.value),null!=s&&--s<=0)return;t.close()}}(t,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")},Hr.throughDOM=function(t){return new yl(t)},Ea.throughDOM=gl,za.throughDOM=gl,Va.throughDOM=gl,ol.throughDOM=vl,ll.throughDOM=vl,al.throughDOM=vl;export{cs as AsyncByteQueue,ds as AsyncByteStream,Ta as AsyncMessageReader,Pa as AsyncRecordBatchFileReader,Ra as AsyncRecordBatchStreamReader,Ve as Binary,Ds as BinaryBuilder,je as Bool,Os as BoolBuilder,ot as BufferType,Hr as Builder,hs as ByteStream,dr as Data,Ie as DataType,Ls as DateBuilder,We as DateDay,xs as DateDayBuilder,Ye as DateMillisecond,Ms as DateMillisecondBuilder,Z as DateUnit,$e as Date_,ke as Decimal,Fs as DecimalBuilder,pi as DenseUnion,mo as DenseUnionBuilder,mi as Dictionary,Ns as DictionaryBuilder,si as Duration,$s as DurationBuilder,li as DurationMicrosecond,Hs as DurationMicrosecondBuilder,ai as DurationMillisecond,Ys as DurationMillisecondBuilder,ui as DurationNanosecond,Gs as DurationNanosecondBuilder,oi as DurationSecond,Ws as DurationSecondBuilder,qr as Field,fi as FixedSizeBinary,Us as FixedSizeBinaryBuilder,bi as FixedSizeList,Cs as FixedSizeListBuilder,Ne as Float,Ue as Float16,Vs as Float16Builder,Ce as Float32,Rs as Float32Builder,Ee as Float64,zs as Float64Builder,Es as FloatBuilder,Ae as Int,De as Int16,Ks as Int16Builder,Te as Int32,Js as Int32Builder,Oe as Int64,qs as Int64Builder,Be as Int8,Xs as Int8Builder,Zs as IntBuilder,ii as Interval,Ps as IntervalBuilder,ni as IntervalDayTime,js as IntervalDayTimeBuilder,K as IntervalUnit,ri as IntervalYearMonth,ks as IntervalYearMonthBuilder,Oa as JSONMessageReader,Re as LargeBinary,Ts as LargeBinaryBuilder,Pe as LargeUtf8,Io as LargeUtf8Builder,ci as List,no as ListBuilder,ro as MapBuilder,Hn as MapRow,gi as Map_,da as Message,rt as MessageHeader,Da as MessageReader,Y as MetadataVersion,Se as Null,so as NullBuilder,G as Precision,Jo as RecordBatch,za as RecordBatchFileReader,ll as RecordBatchFileWriter,ul as RecordBatchJSONWriter,Ea as RecordBatchReader,Va as RecordBatchStreamReader,al as RecordBatchStreamWriter,ol as RecordBatchWriter,Jr as Schema,yi as SparseUnion,_o as SparseUnionBuilder,hi as Struct,oo as StructBuilder,pn as StructRow,Zo as Table,He as Time,po as TimeBuilder,Xe as TimeMicrosecond,bo as TimeMicrosecondBuilder,Ze as TimeMillisecond,fo as TimeMillisecondBuilder,Ke as TimeNanosecond,go as TimeNanosecondBuilder,Ge as TimeSecond,yo as TimeSecondBuilder,X as TimeUnit,Je as Timestamp,ao as TimestampBuilder,ti as TimestampMicrosecond,co as TimestampMicrosecondBuilder,Qe as TimestampMillisecond,uo as TimestampMillisecondBuilder,ei as TimestampNanosecond,ho as TimestampNanosecondBuilder,qe as TimestampSecond,lo as TimestampSecondBuilder,st as Type,xe as Uint16,to as Uint16Builder,Me as Uint32,eo as Uint32Builder,Fe as Uint64,io as Uint64Builder,Le as Uint8,Qs as Uint8Builder,di as Union,vo as UnionBuilder,H as UnionMode,ze as Utf8,wo as Utf8Builder,Er as Vector,Ii as Visitor,$o as builderThroughAsyncIterable,ko as builderThroughIterable,Ro as makeBuilder,fr as makeData,Xo as makeTable,Rr as makeVector,Ko as tableFromArrays,_l as tableFromIPC,Po as tableFromJSON,ml as tableToIPC,wl as util,zo as vectorFromArray};export default null; +import{__asyncGenerator as t,__await as e,__asyncDelegator as i,__asyncValues as n,__awaiter as r,__rest as s}from"../tslib@2.6.3/_esm.js";import*as o from"../flatbuffers@24.3.25/_esm.js";import{ByteBuffer as a}from"../flatbuffers@24.3.25/_esm.js";const l=new TextDecoder("utf-8"),u=t=>l.decode(t),c=new TextEncoder,h=t=>c.encode(t),d=t=>"boolean"==typeof t,p=t=>"function"==typeof t,y=t=>null!=t&&Object(t)===t,f=t=>y(t)&&p(t.then),b=t=>y(t)&&p(t[Symbol.iterator]),g=t=>y(t)&&p(t[Symbol.asyncIterator]),v=t=>y(t)&&y(t.schema),_=t=>y(t)&&"done"in t&&"value"in t,m=t=>y(t)&&p(t.stat)&&(t=>"number"==typeof t)(t.fd),w=t=>y(t)&&S(t.body),I=t=>"_getDOMStream"in t&&"_getNodeStream"in t,S=t=>y(t)&&p(t.cancel)&&p(t.getReader)&&!I(t),A=t=>y(t)&&p(t.read)&&p(t.pipe)&&d(t.readable)&&!I(t),B=t=>y(t)&&p(t.clear)&&p(t.bytes)&&p(t.position)&&p(t.setPosition)&&p(t.capacity)&&p(t.getBufferIdentifier)&&p(t.createLong),D="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function T(t,e,i=0,n=e.byteLength){const r=t.byteLength,s=new Uint8Array(t.buffer,t.byteOffset,r),o=new Uint8Array(e.buffer,e.byteOffset,Math.min(n,r));return s.set(o,i),t}function O(t,e){const i=function(t){const e=t[0]?[t[0]]:[];let i,n,r,s;for(let o,a,l=0,u=0,c=t.length;++lt+e.byteLength),0);let r,s,o,a=0,l=-1;const u=Math.min(e||Number.POSITIVE_INFINITY,n);for(const t=i.length;++lL(Int32Array,t),M=t=>L(BigInt64Array,t),F=t=>L(Uint8Array,t),N=t=>(t.next(),t);function*U(t,e){const i=function*(t){yield t},n="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof D?i(e):b(e)?e:i(e);return yield*N(function*(e){let i=null;do{i=e.next(yield L(t,i))}while(!i.done)}(n[Symbol.iterator]())),new t}const C=t=>U(Uint8Array,t);function E(r,s){return t(this,arguments,(function*(){if(f(s))return yield e(yield e(yield*i(n(E(r,yield e(s))))));const o=function(i){return t(this,arguments,(function*(){yield yield e(yield e(i))}))},a="string"==typeof s||ArrayBuffer.isView(s)||s instanceof ArrayBuffer||s instanceof D?o(s):b(s)?function(r){return t(this,arguments,(function*(){yield e(yield*i(n(N(function*(t){let e=null;do{e=t.next(yield null==e?void 0:e.value)}while(!e.done)}(r[Symbol.iterator]())))))}))}(s):g(s)?s:o(s);return yield e(yield*i(n(N(function(i){return t(this,arguments,(function*(){let t=null;do{t=yield e(i.next(yield yield e(L(r,t))))}while(!t.done)}))}(a[Symbol.asyncIterator]()))))),yield e(new r)}))}const V=t=>E(Uint8Array,t);function R(t,e,i){if(0!==t)for(let n=-1,r=(i=i.slice(0,e)).length;++n0)do{if(t[i]!==e[i])return!1}while(++iL(Int8Array,t),toInt16Array:t=>L(Int16Array,t),toInt32Array:x,toBigInt64Array:M,toUint8Array:F,toUint16Array:t=>L(Uint16Array,t),toUint32Array:t=>L(Uint32Array,t),toBigUint64Array:t=>L(BigUint64Array,t),toFloat32Array:t=>L(Float32Array,t),toFloat64Array:t=>L(Float64Array,t),toUint8ClampedArray:t=>L(Uint8ClampedArray,t),toArrayBufferViewIterator:U,toInt8ArrayIterator:t=>U(Int8Array,t),toInt16ArrayIterator:t=>U(Int16Array,t),toInt32ArrayIterator:t=>U(Int32Array,t),toUint8ArrayIterator:C,toUint16ArrayIterator:t=>U(Uint16Array,t),toUint32ArrayIterator:t=>U(Uint32Array,t),toFloat32ArrayIterator:t=>U(Float32Array,t),toFloat64ArrayIterator:t=>U(Float64Array,t),toUint8ClampedArrayIterator:t=>U(Uint8ClampedArray,t),toArrayBufferViewAsyncIterator:E,toInt8ArrayAsyncIterator:t=>E(Int8Array,t),toInt16ArrayAsyncIterator:t=>E(Int16Array,t),toInt32ArrayAsyncIterator:t=>E(Int32Array,t),toUint8ArrayAsyncIterator:V,toUint16ArrayAsyncIterator:t=>E(Uint16Array,t),toUint32ArrayAsyncIterator:t=>E(Uint32Array,t),toFloat32ArrayAsyncIterator:t=>E(Float32Array,t),toFloat64ArrayAsyncIterator:t=>E(Float64Array,t),toUint8ClampedArrayAsyncIterator:t=>E(Uint8ClampedArray,t),rebaseValueOffsets:R,compareArrayLike:z}),j={fromIterable:t=>k(function*(t){let e,i,n,r,s=!1,o=[],a=0;function l(){return"peek"===n?O(o,r)[0]:([i,o,a]=O(o,r),i)}({cmd:n,size:r}=(yield null)||{cmd:"read",size:0});const u=C(t)[Symbol.iterator]();try{do{if(({done:e,value:i}=Number.isNaN(r-a)?u.next():u.next(r-a)),!e&&i.byteLength>0&&(o.push(i),a+=i.byteLength),e||r<=a)do{({cmd:n,size:r}=yield l())}while(rk(function(i){return t(this,arguments,(function*(){let t,n,r,s,o=!1,a=[],l=0;function u(){return"peek"===r?O(a,s)[0]:([n,a,l]=O(a,s),n)}({cmd:r,size:s}=(yield yield e(null))||{cmd:"read",size:0});const c=V(i)[Symbol.asyncIterator]();try{do{if(({done:t,value:n}=Number.isNaN(s-l)?yield e(c.next()):yield e(c.next(s-l))),!t&&n.byteLength>0&&(a.push(n),l+=n.byteLength),t||s<=l)do{({cmd:r,size:s}=yield yield e(u()))}while(sk(function(i){return t(this,arguments,(function*(){let t,n,r,s=!1,o=!1,a=[],l=0;function u(){return"peek"===n?O(a,r)[0]:([t,a,l]=O(a,r),t)}({cmd:n,size:r}=(yield yield e(null))||{cmd:"read",size:0});const c=new $(i);try{do{if(({done:s,value:t}=Number.isNaN(r-l)?yield e(c.read()):yield e(c.read(r-l))),!s&&t.byteLength>0&&(a.push(F(t)),l+=t.byteLength),s||r<=l)do{({cmd:n,size:r}=yield yield e(u()))}while(rk(function(i){return t(this,arguments,(function*(){const t=[];let n,r,s,o="error",a=!1,l=null,u=0,c=[];function h(){return"peek"===n?O(c,r)[0]:([s,c,u]=O(c,r),s)}if(({cmd:n,size:r}=(yield yield e(null))||{cmd:"read",size:0}),i.isTTY)return yield yield e(new Uint8Array(0)),yield e(null);try{t[0]=W(i,"end"),t[1]=W(i,"error");do{if(t[2]=W(i,"readable"),[o,l]=yield e(Promise.race(t.map((t=>t[2])))),"error"===o)break;if((a="end"===o)||(Number.isFinite(r-u)?(s=F(i.read(r-u)),s.byteLength0&&(c.push(s),u+=s.byteLength)),a||r<=u)do{({cmd:n,size:r}=yield yield e(h()))}while(r{for(const[e,n]of t)i.off(e,n);try{const t=i.destroy;t&&t.call(i,e),e=void 0}catch(t){e=t||e}finally{null!=e?r(e):n()}}))}}))}(i)),toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}};const k=t=>(t.next(),t);class ${constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch((()=>{}))}get closed(){return this.reader?this.reader.closed.catch((()=>{})):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return r(this,void 0,void 0,(function*(){const{reader:e,source:i}=this;e&&(yield e.cancel(t).catch((()=>{}))),i&&i.locked&&this.releaseLock()}))}read(t){return r(this,void 0,void 0,(function*(){if(0===t)return{done:null==this.reader,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=F(e)),e}))}}const W=(t,e)=>{const i=t=>n([e,t]);let n;return[e,i,new Promise((r=>(n=r)&&t.once(e,i)))]};var Y,H,G,Z,X,K,J,q,Q,tt,et,it,nt,rt,st,ot;!function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"}(Y||(Y={})),function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"}(H||(H={})),function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}(G||(G={})),function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"}(Z||(Z={})),function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"}(X||(X={})),function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"}(K||(K={})),function(t){t[t.BUFFER=0]="BUFFER"}(J||(J={})),function(t){t[t.LZ4_FRAME=0]="LZ4_FRAME",t[t.ZSTD=1]="ZSTD"}(q||(q={}));class at{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):q.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):J.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,q.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,J.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return at.startBodyCompression(t),at.addCodec(t,e),at.addMethod(t,i),at.endBodyCompression(t)}}class lt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(null!=i?i:0)),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(null!=i?i:0)),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ct).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new ut).__init(this.bb.__vector(this.bb_pos+i)+16*t,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new lt).__init(this.bb.__vector(this.bb_pos+i)+16*t,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new at).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}}class ht{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new ct).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}}!function(t){t[t.Little=0]="Little",t[t.Big=1]="Big"}(Q||(Q={})),function(t){t[t.DenseArray=0]="DenseArray"}(tt||(tt={}));class dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new dt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,i){return dt.startInt(t),dt.addBitWidth(t,e),dt.addIsSigned(t,i),dt.endInt(t)}}class pt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new dt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):tt.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,tt.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class yt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new yt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return yt.startKeyValue(t),yt.addKey(t,e),yt.addValue(t,i),yt.endKeyValue(t)}}class ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ft.startBinary(t),ft.endBinary(t)}}class bt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new bt).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return bt.startBool(t),bt.endBool(t)}}class gt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Z.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Z.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return gt.startDate(t),gt.addUnit(t,e),gt.endDate(t)}}class vt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,n){return vt.startDecimal(t),vt.addPrecision(t,e),vt.addScale(t,i),vt.addBitWidth(t,n),vt.endDecimal(t)}}class _t{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new _t).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):X.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,X.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return _t.startDuration(t),_t.addUnit(t,e),_t.endDuration(t)}}class mt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return mt.startFixedSizeBinary(t),mt.addByteWidth(t,e),mt.endFixedSizeBinary(t)}}class wt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new wt).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return wt.startFixedSizeList(t),wt.addListSize(t,e),wt.endFixedSizeList(t)}}class It{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new It).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):G.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,G.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return It.startFloatingPoint(t),It.addPrecision(t,e),It.endFloatingPoint(t)}}class St{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):K.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,K.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return St.startInterval(t),St.addUnit(t,e),St.endInterval(t)}}class At{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new At).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new At).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return At.startLargeBinary(t),At.endLargeBinary(t)}}class Bt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Bt).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Bt.startLargeUtf8(t),Bt.endLargeUtf8(t)}}class Dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Dt.startList(t),Dt.endList(t)}}class Tt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Tt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Tt.startMap(t),Tt.addKeysSorted(t,e),Tt.endMap(t)}}class Ot{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ot.startNull(t),Ot.endNull(t)}}class Lt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Lt.startStruct_(t),Lt.endStruct_(t)}}class xt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):X.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,X.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return xt.startTime(t),xt.addUnit(t,e),xt.addBitWidth(t,i),xt.endTime(t)}}class Mt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):X.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,X.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return Mt.startTimestamp(t),Mt.addUnit(t,e),Mt.addTimezone(t,i),Mt.endTimestamp(t)}}class Ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):H.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,H.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addInt32(e[i]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,i){return Ft.startUnion(t),Ft.addMode(t,e),Ft.addTypeIds(t,i),Ft.endUnion(t)}}class Nt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Nt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Nt).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Nt.startUtf8(t),Nt.endUtf8(t)}}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"}(et||(et={}));class Ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ut).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):et.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new pt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const i=this.bb.__offset(this.bb_pos,14);return i?(e||new Ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,16);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,et.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}}class Ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Ct).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Q.Little}fields(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new Ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+8*t):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Q.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let i=e.length-1;i>=0;i--)t.addInt64(e[i]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,i,n,r){return Ct.startSchema(t),Ct.addEndianness(t,e),Ct.addFields(t,i),Ct.addCustomMetadata(t,n),Ct.addFeatures(t,r),Ct.endSchema(t)}}!function(t){t[t.Row=0]="Row",t[t.Column=1]="Column"}(it||(it={})),function(t){t[t.NONE=0]="NONE",t[t.SparseTensorIndexCOO=1]="SparseTensorIndexCOO",t[t.SparseMatrixIndexCSX=2]="SparseMatrixIndexCSX",t[t.SparseTensorIndexCSF=3]="SparseTensorIndexCSF"}(nt||(nt={})),function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}(rt||(rt={})),function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"}(st||(st={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(ot||(ot={}));const Et=void 0;function Vt(t){if(null===t)return"null";if(t===Et)return"undefined";switch(typeof t){case"number":case"bigint":return`${t}`;case"string":return`"${t}"`}return"function"==typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map((t=>Vt(t)))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,((t,e)=>"bigint"==typeof e?`${e}`:e))}var Rt=Object.freeze({__proto__:null,valueToString:Vt});function zt(t){if("bigint"==typeof t&&(tNumber.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function Pt(t,e){return zt(t/e)+zt(t%e)/zt(e)}const jt=Symbol.for("isArrowBigNum");function kt(t,...e){return 0===e.length?Object.setPrototypeOf(L(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}function $t(...t){return kt.apply(this,t)}function Wt(...t){return kt.apply(this,t)}function Yt(...t){return kt.apply(this,t)}kt.prototype[jt]=!0,kt.prototype.toJSON=function(){return`"${Zt(this)}"`},kt.prototype.valueOf=function(t){return Gt(this,t)},kt.prototype.toString=function(){return Zt(this)},kt.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return Gt(this);case"string":return Zt(this);case"default":return Xt(this)}return Zt(this)},Object.setPrototypeOf($t.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Wt.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Yt.prototype,Object.create(Uint32Array.prototype)),Object.assign($t.prototype,kt.prototype,{constructor:$t,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(Wt.prototype,kt.prototype,{constructor:Wt,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(Yt.prototype,kt.prototype,{constructor:Yt,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Ht=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function Gt(t,e){const{buffer:i,byteOffset:n,byteLength:r,signed:s}=t,o=new BigUint64Array(i,n,r/8),a=s&&o.at(-1)&BigInt(1)<=0)return Kt(t);e=e.slice();let i=1;for(let t=0;t(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(Ae.prototype);class Be extends Ae{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class De extends Ae{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Te extends Ae{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class Oe extends Ae{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class Le extends Ae{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}class xe extends Ae{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class Me extends Ae{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class Fe extends Ae{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(Be.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(De.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Te.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Oe.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(Le.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(xe.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Me.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(Fe.prototype,"ArrayType",{value:BigUint64Array});class Ne extends Ie{constructor(t){super(st.Float),this.precision=t}get ArrayType(){switch(this.precision){case G.HALF:return Uint16Array;case G.SINGLE:return Float32Array;case G.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}ee=Symbol.toStringTag,Ne[ee]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(Ne.prototype);class Ue extends Ne{constructor(){super(G.HALF)}}class Ce extends Ne{constructor(){super(G.SINGLE)}}class Ee extends Ne{constructor(){super(G.DOUBLE)}}Object.defineProperty(Ue.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Ce.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(Ee.prototype,"ArrayType",{value:Float64Array});class Ve extends Ie{constructor(){super(st.Binary)}toString(){return"Binary"}}ie=Symbol.toStringTag,Ve[ie]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(Ve.prototype);class Re extends Ie{constructor(){super(st.LargeBinary)}toString(){return"LargeBinary"}}ne=Symbol.toStringTag,Re[ne]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))(Re.prototype);class ze extends Ie{constructor(){super(st.Utf8)}toString(){return"Utf8"}}re=Symbol.toStringTag,ze[re]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(ze.prototype);class Pe extends Ie{constructor(){super(st.LargeUtf8)}toString(){return"LargeUtf8"}}se=Symbol.toStringTag,Pe[se]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(Pe.prototype);class je extends Ie{constructor(){super(st.Bool)}toString(){return"Bool"}}oe=Symbol.toStringTag,je[oe]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(je.prototype);class ke extends Ie{constructor(t,e,i=128){super(st.Decimal),this.scale=t,this.precision=e,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}ae=Symbol.toStringTag,ke[ae]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(ke.prototype);class $e extends Ie{constructor(t){super(st.Date),this.unit=t}toString(){return`Date${32*(this.unit+1)}<${Z[this.unit]}>`}get ArrayType(){return this.unit===Z.DAY?Int32Array:BigInt64Array}}le=Symbol.toStringTag,$e[le]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))($e.prototype);class We extends $e{constructor(){super(Z.DAY)}}class Ye extends $e{constructor(){super(Z.MILLISECOND)}}class He extends Ie{constructor(t,e){super(st.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${X[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}ue=Symbol.toStringTag,He[ue]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(He.prototype);class Ge extends He{constructor(){super(X.SECOND,32)}}class Ze extends He{constructor(){super(X.MILLISECOND,32)}}class Xe extends He{constructor(){super(X.MICROSECOND,64)}}class Ke extends He{constructor(){super(X.NANOSECOND,64)}}class Je extends Ie{constructor(t,e){super(st.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${X[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ce=Symbol.toStringTag,Je[ce]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(Je.prototype);class qe extends Je{constructor(t){super(X.SECOND,t)}}class Qe extends Je{constructor(t){super(X.MILLISECOND,t)}}class ti extends Je{constructor(t){super(X.MICROSECOND,t)}}class ei extends Je{constructor(t){super(X.NANOSECOND,t)}}class ii extends Ie{constructor(t){super(st.Interval),this.unit=t}toString(){return`Interval<${K[this.unit]}>`}}he=Symbol.toStringTag,ii[he]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(ii.prototype);class ni extends ii{constructor(){super(K.DAY_TIME)}}class ri extends ii{constructor(){super(K.YEAR_MONTH)}}class si extends Ie{constructor(t){super(st.Duration),this.unit=t}toString(){return`Duration<${X[this.unit]}>`}}de=Symbol.toStringTag,si[de]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(si.prototype);class oi extends si{constructor(){super(X.SECOND)}}class ai extends si{constructor(){super(X.MILLISECOND)}}class li extends si{constructor(){super(X.MICROSECOND)}}class ui extends si{constructor(){super(X.NANOSECOND)}}class ci extends Ie{constructor(t){super(st.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}pe=Symbol.toStringTag,ci[pe]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(ci.prototype);class hi extends Ie{constructor(t){super(st.Struct),this.children=t}toString(){return`Struct<{${this.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}ye=Symbol.toStringTag,hi[ye]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(hi.prototype);class di extends Ie{constructor(t,e,i){super(st.Union),this.mode=t,this.children=i,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce(((t,e,i)=>(t[e]=i)&&t||t),Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map((t=>`${t.type}`)).join(" | ")}>`}}fe=Symbol.toStringTag,di[fe]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(di.prototype);class pi extends di{constructor(t,e){super(H.Dense,t,e)}}class yi extends di{constructor(t,e){super(H.Sparse,t,e)}}class fi extends Ie{constructor(t){super(st.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}be=Symbol.toStringTag,fi[be]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(fi.prototype);class bi extends Ie{constructor(t,e){super(st.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}ge=Symbol.toStringTag,bi[ge]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(bi.prototype);class gi extends Ie{constructor(t,e=!1){var i,n,r;if(super(st.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",null===(i=null==t?void 0:t.type)||void 0===i?void 0:i.children)){const e=null===(n=null==t?void 0:t.type)||void 0===n?void 0:n.children[0];e&&(e.name="key");const i=null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.children[1];i&&(i.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map((t=>`${t.name}:${t.type}`)).join(", ")}}>`}}ve=Symbol.toStringTag,gi[ve]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(gi.prototype);const vi=(_i=-1,()=>++_i);var _i;class mi extends Ie{constructor(t,e,i,n){super(st.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=n||!1,this.id=null==i?vi():zt(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}function wi(t){const e=t;switch(t.typeId){case st.Decimal:return t.bitWidth/32;case st.Interval:return 1+e.unit;case st.FixedSizeList:return e.listSize;case st.FixedSizeBinary:return e.byteWidth;default:return 1}}_e=Symbol.toStringTag,mi[_e]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(mi.prototype);class Ii{visitMany(t,...e){return t.map(((t,i)=>this.visit(t,...e.map((t=>t[i])))))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return function(t,e,i=!0){if("number"==typeof e)return Si(t,e,i);if("string"==typeof e&&e in st)return Si(t,st[e],i);if(e&&e instanceof Ie)return Si(t,Ai(e),i);if((null==e?void 0:e.type)&&e.type instanceof Ie)return Si(t,Ai(e.type),i);return Si(t,st.NONE,i)}(this,t,e)}getVisitFnByTypeId(t,e=!0){return Si(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Si(t,e,i=!0){let n=null;switch(e){case st.Null:n=t.visitNull;break;case st.Bool:n=t.visitBool;break;case st.Int:n=t.visitInt;break;case st.Int8:n=t.visitInt8||t.visitInt;break;case st.Int16:n=t.visitInt16||t.visitInt;break;case st.Int32:n=t.visitInt32||t.visitInt;break;case st.Int64:n=t.visitInt64||t.visitInt;break;case st.Uint8:n=t.visitUint8||t.visitInt;break;case st.Uint16:n=t.visitUint16||t.visitInt;break;case st.Uint32:n=t.visitUint32||t.visitInt;break;case st.Uint64:n=t.visitUint64||t.visitInt;break;case st.Float:n=t.visitFloat;break;case st.Float16:n=t.visitFloat16||t.visitFloat;break;case st.Float32:n=t.visitFloat32||t.visitFloat;break;case st.Float64:n=t.visitFloat64||t.visitFloat;break;case st.Utf8:n=t.visitUtf8;break;case st.LargeUtf8:n=t.visitLargeUtf8;break;case st.Binary:n=t.visitBinary;break;case st.LargeBinary:n=t.visitLargeBinary;break;case st.FixedSizeBinary:n=t.visitFixedSizeBinary;break;case st.Date:n=t.visitDate;break;case st.DateDay:n=t.visitDateDay||t.visitDate;break;case st.DateMillisecond:n=t.visitDateMillisecond||t.visitDate;break;case st.Timestamp:n=t.visitTimestamp;break;case st.TimestampSecond:n=t.visitTimestampSecond||t.visitTimestamp;break;case st.TimestampMillisecond:n=t.visitTimestampMillisecond||t.visitTimestamp;break;case st.TimestampMicrosecond:n=t.visitTimestampMicrosecond||t.visitTimestamp;break;case st.TimestampNanosecond:n=t.visitTimestampNanosecond||t.visitTimestamp;break;case st.Time:n=t.visitTime;break;case st.TimeSecond:n=t.visitTimeSecond||t.visitTime;break;case st.TimeMillisecond:n=t.visitTimeMillisecond||t.visitTime;break;case st.TimeMicrosecond:n=t.visitTimeMicrosecond||t.visitTime;break;case st.TimeNanosecond:n=t.visitTimeNanosecond||t.visitTime;break;case st.Decimal:n=t.visitDecimal;break;case st.List:n=t.visitList;break;case st.Struct:n=t.visitStruct;break;case st.Union:n=t.visitUnion;break;case st.DenseUnion:n=t.visitDenseUnion||t.visitUnion;break;case st.SparseUnion:n=t.visitSparseUnion||t.visitUnion;break;case st.Dictionary:n=t.visitDictionary;break;case st.Interval:n=t.visitInterval;break;case st.IntervalDayTime:n=t.visitIntervalDayTime||t.visitInterval;break;case st.IntervalYearMonth:n=t.visitIntervalYearMonth||t.visitInterval;break;case st.Duration:n=t.visitDuration;break;case st.DurationSecond:n=t.visitDurationSecond||t.visitDuration;break;case st.DurationMillisecond:n=t.visitDurationMillisecond||t.visitDuration;break;case st.DurationMicrosecond:n=t.visitDurationMicrosecond||t.visitDuration;break;case st.DurationNanosecond:n=t.visitDurationNanosecond||t.visitDuration;break;case st.FixedSizeList:n=t.visitFixedSizeList;break;case st.Map:n=t.visitMap}if("function"==typeof n)return n;if(!i)return()=>null;throw new Error(`Unrecognized type '${st[e]}'`)}function Ai(t){switch(t.typeId){case st.Null:return st.Null;case st.Int:{const{bitWidth:e,isSigned:i}=t;switch(e){case 8:return i?st.Int8:st.Uint8;case 16:return i?st.Int16:st.Uint16;case 32:return i?st.Int32:st.Uint32;case 64:return i?st.Int64:st.Uint64}return st.Int}case st.Float:switch(t.precision){case G.HALF:return st.Float16;case G.SINGLE:return st.Float32;case G.DOUBLE:return st.Float64}return st.Float;case st.Binary:return st.Binary;case st.LargeBinary:return st.LargeBinary;case st.Utf8:return st.Utf8;case st.LargeUtf8:return st.LargeUtf8;case st.Bool:return st.Bool;case st.Decimal:return st.Decimal;case st.Time:switch(t.unit){case X.SECOND:return st.TimeSecond;case X.MILLISECOND:return st.TimeMillisecond;case X.MICROSECOND:return st.TimeMicrosecond;case X.NANOSECOND:return st.TimeNanosecond}return st.Time;case st.Timestamp:switch(t.unit){case X.SECOND:return st.TimestampSecond;case X.MILLISECOND:return st.TimestampMillisecond;case X.MICROSECOND:return st.TimestampMicrosecond;case X.NANOSECOND:return st.TimestampNanosecond}return st.Timestamp;case st.Date:switch(t.unit){case Z.DAY:return st.DateDay;case Z.MILLISECOND:return st.DateMillisecond}return st.Date;case st.Interval:switch(t.unit){case K.DAY_TIME:return st.IntervalDayTime;case K.YEAR_MONTH:return st.IntervalYearMonth}return st.Interval;case st.Duration:switch(t.unit){case X.SECOND:return st.DurationSecond;case X.MILLISECOND:return st.DurationMillisecond;case X.MICROSECOND:return st.DurationMicrosecond;case X.NANOSECOND:return st.DurationNanosecond}return st.Duration;case st.Map:return st.Map;case st.List:return st.List;case st.Struct:return st.Struct;case st.Union:switch(t.mode){case H.Dense:return st.DenseUnion;case H.Sparse:return st.SparseUnion}return st.Union;case st.FixedSizeBinary:return st.FixedSizeBinary;case st.FixedSizeList:return st.FixedSizeList;case st.Dictionary:return st.Dictionary}throw new Error(`Unrecognized type '${st[t.typeId]}'`)}Ii.prototype.visitInt8=null,Ii.prototype.visitInt16=null,Ii.prototype.visitInt32=null,Ii.prototype.visitInt64=null,Ii.prototype.visitUint8=null,Ii.prototype.visitUint16=null,Ii.prototype.visitUint32=null,Ii.prototype.visitUint64=null,Ii.prototype.visitFloat16=null,Ii.prototype.visitFloat32=null,Ii.prototype.visitFloat64=null,Ii.prototype.visitDateDay=null,Ii.prototype.visitDateMillisecond=null,Ii.prototype.visitTimestampSecond=null,Ii.prototype.visitTimestampMillisecond=null,Ii.prototype.visitTimestampMicrosecond=null,Ii.prototype.visitTimestampNanosecond=null,Ii.prototype.visitTimeSecond=null,Ii.prototype.visitTimeMillisecond=null,Ii.prototype.visitTimeMicrosecond=null,Ii.prototype.visitTimeNanosecond=null,Ii.prototype.visitDenseUnion=null,Ii.prototype.visitSparseUnion=null,Ii.prototype.visitIntervalDayTime=null,Ii.prototype.visitIntervalYearMonth=null,Ii.prototype.visitDuration=null,Ii.prototype.visitDurationSecond=null,Ii.prototype.visitDurationMillisecond=null,Ii.prototype.visitDurationMicrosecond=null,Ii.prototype.visitDurationNanosecond=null;const Bi=new Float64Array(1),Di=new Uint32Array(Bi.buffer);function Ti(t){const e=(31744&t)>>10,i=(1023&t)/1024,n=Math.pow(-1,(32768&t)>>15);switch(e){case 31:return n*(i?Number.NaN:1/0);case 0:return n*(i?6103515625e-14*i:0)}return n*Math.pow(2,e-15)*(1+i)}function Oi(t){if(t!=t)return 32256;Bi[0]=t;const e=(2147483648&Di[1])>>16&65535;let i=2146435072&Di[1],n=0;return i>=1089470464?Di[0]>0?i=31744:(i=(2080374784&i)>>16,n=(1048575&Di[1])>>10):i<=1056964608?(n=1048576+(1048575&Di[1]),n=1048576+(n<<(i>>20)-998)>>21,i=0):(i=i-1056964608>>10,n=512+(1048575&Di[1])>>10),e|i|65535&n}var Li=Object.freeze({__proto__:null,uint16ToFloat64:Ti,float64ToUint16:Oi});class xi extends Ii{}function Mi(t){return(e,i,n)=>{if(e.setValid(i,null!=n))return t(e,i,n)}}const Fi=(t,e,i,n)=>{if(i+1{t[e]=i},Ui=({values:t},e,i)=>{t[e]=i},Ci=({values:t},e,i)=>{t[e]=Oi(i)},Ei=({values:t},e,i)=>{((t,e,i)=>{t[e]=Math.floor(i/864e5)})(t,e,i.valueOf())},Vi=({values:t},e,i)=>{t[e]=BigInt(i)},Ri=({stride:t,values:e},i,n)=>{e.set(n.subarray(0,t),t*i)},zi=({values:t,valueOffsets:e},i,n)=>Fi(t,e,i,n),Pi=({values:t,valueOffsets:e},i,n)=>Fi(t,e,i,h(n)),ji=(t,e,i)=>{t.type.unit===Z.DAY?Ei(t,e,i):Vi(t,e,i)},ki=({values:t},e,i)=>{t[e]=BigInt(i/1e3)},$i=({values:t},e,i)=>{t[e]=BigInt(i)},Wi=({values:t},e,i)=>{t[e]=BigInt(1e3*i)},Yi=({values:t},e,i)=>{t[e]=BigInt(1e6*i)},Hi=(t,e,i)=>{switch(t.type.unit){case X.SECOND:return ki(t,e,i);case X.MILLISECOND:return $i(t,e,i);case X.MICROSECOND:return Wi(t,e,i);case X.NANOSECOND:return Yi(t,e,i)}},Gi=({values:t},e,i)=>{t[e]=i},Zi=({values:t},e,i)=>{t[e]=i},Xi=({values:t},e,i)=>{t[e]=i},Ki=({values:t},e,i)=>{t[e]=i},Ji=(t,e,i)=>{switch(t.type.unit){case X.SECOND:return Gi(t,e,i);case X.MILLISECOND:return Zi(t,e,i);case X.MICROSECOND:return Xi(t,e,i);case X.NANOSECOND:return Ki(t,e,i)}},qi=({values:t,stride:e},i,n)=>{t.set(n.subarray(0,e),e*i)},Qi=(t,e,i)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];cn.visit(r,t.valueOffsets[e],i)},tn=(t,e,i)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];cn.visit(r,e,i)},en=(t,e,i)=>{t.type.unit===K.DAY_TIME?nn(t,e,i):rn(t,e,i)},nn=({values:t},e,i)=>{t.set(i.subarray(0,2),2*e)},rn=({values:t},e,i)=>{t[e]=12*i[0]+i[1]%12},sn=({values:t},e,i)=>{t[e]=i},on=({values:t},e,i)=>{t[e]=i},an=({values:t},e,i)=>{t[e]=i},ln=({values:t},e,i)=>{t[e]=i},un=(t,e,i)=>{switch(t.type.unit){case X.SECOND:return sn(t,e,i);case X.MILLISECOND:return on(t,e,i);case X.MICROSECOND:return an(t,e,i);case X.NANOSECOND:return ln(t,e,i)}};xi.prototype.visitBool=Mi((({offset:t,values:e},i,n)=>{const r=t+i;n?e[r>>3]|=1<>3]&=~(1<{switch(t.type.precision){case G.HALF:return Ci(t,e,i);case G.SINGLE:case G.DOUBLE:return Ui(t,e,i)}})),xi.prototype.visitFloat16=Mi(Ci),xi.prototype.visitFloat32=Mi(Ui),xi.prototype.visitFloat64=Mi(Ui),xi.prototype.visitUtf8=Mi(Pi),xi.prototype.visitLargeUtf8=Mi(Pi),xi.prototype.visitBinary=Mi(zi),xi.prototype.visitLargeBinary=Mi(zi),xi.prototype.visitFixedSizeBinary=Mi(Ri),xi.prototype.visitDate=Mi(ji),xi.prototype.visitDateDay=Mi(Ei),xi.prototype.visitDateMillisecond=Mi(Vi),xi.prototype.visitTimestamp=Mi(Hi),xi.prototype.visitTimestampSecond=Mi(ki),xi.prototype.visitTimestampMillisecond=Mi($i),xi.prototype.visitTimestampMicrosecond=Mi(Wi),xi.prototype.visitTimestampNanosecond=Mi(Yi),xi.prototype.visitTime=Mi(Ji),xi.prototype.visitTimeSecond=Mi(Gi),xi.prototype.visitTimeMillisecond=Mi(Zi),xi.prototype.visitTimeMicrosecond=Mi(Xi),xi.prototype.visitTimeNanosecond=Mi(Ki),xi.prototype.visitDecimal=Mi(qi),xi.prototype.visitList=Mi(((t,e,i)=>{const n=t.children[0],r=t.valueOffsets,s=cn.getVisitFn(n);if(Array.isArray(i))for(let t=-1,o=r[e],a=r[e+1];o{const n=t.type.children.map((t=>cn.getVisitFn(t.type))),r=i instanceof Map?(s=e,o=i,(t,e,i,n)=>e&&t(e,s,o.get(i.name))):i instanceof Er?((t,e)=>(i,n,r,s)=>n&&i(n,t,e.get(s)))(e,i):Array.isArray(i)?((t,e)=>(i,n,r,s)=>n&&i(n,t,e[s]))(e,i):((t,e)=>(i,n,r,s)=>n&&i(n,t,e[r.name]))(e,i);var s,o;t.type.children.forEach(((e,i)=>r(n[i],t.children[i],e,i)))})),xi.prototype.visitUnion=Mi(((t,e,i)=>{t.type.mode===H.Dense?Qi(t,e,i):tn(t,e,i)})),xi.prototype.visitDenseUnion=Mi(Qi),xi.prototype.visitSparseUnion=Mi(tn),xi.prototype.visitDictionary=Mi(((t,e,i)=>{var n;null===(n=t.dictionary)||void 0===n||n.set(t.values[e],i)})),xi.prototype.visitInterval=Mi(en),xi.prototype.visitIntervalDayTime=Mi(nn),xi.prototype.visitIntervalYearMonth=Mi(rn),xi.prototype.visitDuration=Mi(un),xi.prototype.visitDurationSecond=Mi(sn),xi.prototype.visitDurationMillisecond=Mi(on),xi.prototype.visitDurationMicrosecond=Mi(an),xi.prototype.visitDurationNanosecond=Mi(ln),xi.prototype.visitFixedSizeList=Mi(((t,e,i)=>{const{stride:n}=t,r=t.children[0],s=cn.getVisitFn(r);if(Array.isArray(i))for(let t=-1,o=e*n;++t{const n=t.children[0],{valueOffsets:r}=t,s=cn.getVisitFn(n);let{[e]:o,[e+1]:a}=r;const l=i instanceof Map?i.entries():Object.entries(i);for(const t of l)if(s(n,o,t),++o>=a)break}));const cn=new xi,hn=Symbol.for("parent"),dn=Symbol.for("rowIndex");class pn{constructor(t,e){return this[hn]=t,this[dn]=e,new Proxy(this,new fn)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[dn],e=this[hn],i=e.type.children,n={};for(let r=-1,s=i.length;++r`${Vt(t)}: ${Vt(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new yn(this[hn],this[dn])}}class yn{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return tt.name))}has(t,e){return-1!==t[hn].type.children.findIndex((t=>t.name===e))}getOwnPropertyDescriptor(t,e){if(-1!==t[hn].type.children.findIndex((t=>t.name===e)))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[hn].type.children.findIndex((t=>t.name===e));if(-1!==i){const n=jn.visit(t[hn].children[i],t[dn]);return Reflect.set(t,e,n),n}}set(t,e,i){const n=t[hn].type.children.findIndex((t=>t.name===e));return-1!==n?(cn.visit(t[hn].children[n],t[dn],i),Reflect.set(t,e,i)):!(!Reflect.has(t,e)&&"symbol"!=typeof e)&&Reflect.set(t,e,i)}}class bn extends Ii{}function gn(t){return(e,i)=>e.getValid(i)?t(e,i):null}const vn=(t,e,i)=>{if(i+1>=e.length)return null;const n=zt(e[i]),r=zt(e[i+1]);return t.subarray(n,r)},_n=({values:t},e)=>((t,e)=>864e5*t[e])(t,e),mn=({values:t},e)=>zt(t[e]),wn=({stride:t,values:e},i)=>e[t*i],In=({values:t},e)=>t[e],Sn=({values:t,valueOffsets:e},i)=>vn(t,e,i),An=({values:t,valueOffsets:e},i)=>{const n=vn(t,e,i);return null!==n?u(n):null},Bn=({values:t},e)=>1e3*zt(t[e]),Dn=({values:t},e)=>zt(t[e]),Tn=({values:t},e)=>Pt(t[e],BigInt(1e3)),On=({values:t},e)=>Pt(t[e],BigInt(1e6)),Ln=({values:t},e)=>t[e],xn=({values:t},e)=>t[e],Mn=({values:t},e)=>t[e],Fn=({values:t},e)=>t[e],Nn=(t,e)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];return jn.visit(n,t.valueOffsets[e])},Un=(t,e)=>{const i=t.type.typeIdToChildIndex[t.typeIds[e]],n=t.children[i];return jn.visit(n,e)},Cn=({values:t},e)=>t.subarray(2*e,2*(e+1)),En=({values:t},e)=>{const i=t[e],n=new Int32Array(2);return n[0]=Math.trunc(i/12),n[1]=Math.trunc(i%12),n},Vn=({values:t},e)=>t[e],Rn=({values:t},e)=>t[e],zn=({values:t},e)=>t[e],Pn=({values:t},e)=>t[e];bn.prototype.visitNull=gn(((t,e)=>null)),bn.prototype.visitBool=gn((({offset:t,values:e},i)=>{const n=t+i;return 0!=(e[n>>3]&1<t[e])),bn.prototype.visitInt8=gn(wn),bn.prototype.visitInt16=gn(wn),bn.prototype.visitInt32=gn(wn),bn.prototype.visitInt64=gn(In),bn.prototype.visitUint8=gn(wn),bn.prototype.visitUint16=gn(wn),bn.prototype.visitUint32=gn(wn),bn.prototype.visitUint64=gn(In),bn.prototype.visitFloat=gn((({type:t,values:e},i)=>t.precision!==G.HALF?e[i]:Ti(e[i]))),bn.prototype.visitFloat16=gn((({stride:t,values:e},i)=>Ti(e[t*i]))),bn.prototype.visitFloat32=gn(wn),bn.prototype.visitFloat64=gn(wn),bn.prototype.visitUtf8=gn(An),bn.prototype.visitLargeUtf8=gn(An),bn.prototype.visitBinary=gn(Sn),bn.prototype.visitLargeBinary=gn(Sn),bn.prototype.visitFixedSizeBinary=gn((({stride:t,values:e},i)=>e.subarray(t*i,t*(i+1)))),bn.prototype.visitDate=gn(((t,e)=>t.type.unit===Z.DAY?_n(t,e):mn(t,e))),bn.prototype.visitDateDay=gn(_n),bn.prototype.visitDateMillisecond=gn(mn),bn.prototype.visitTimestamp=gn(((t,e)=>{switch(t.type.unit){case X.SECOND:return Bn(t,e);case X.MILLISECOND:return Dn(t,e);case X.MICROSECOND:return Tn(t,e);case X.NANOSECOND:return On(t,e)}})),bn.prototype.visitTimestampSecond=gn(Bn),bn.prototype.visitTimestampMillisecond=gn(Dn),bn.prototype.visitTimestampMicrosecond=gn(Tn),bn.prototype.visitTimestampNanosecond=gn(On),bn.prototype.visitTime=gn(((t,e)=>{switch(t.type.unit){case X.SECOND:return Ln(t,e);case X.MILLISECOND:return xn(t,e);case X.MICROSECOND:return Mn(t,e);case X.NANOSECOND:return Fn(t,e)}})),bn.prototype.visitTimeSecond=gn(Ln),bn.prototype.visitTimeMillisecond=gn(xn),bn.prototype.visitTimeMicrosecond=gn(Mn),bn.prototype.visitTimeNanosecond=gn(Fn),bn.prototype.visitDecimal=gn((({values:t,stride:e},i)=>Jt.decimal(t.subarray(e*i,e*(i+1))))),bn.prototype.visitList=gn(((t,e)=>{const{valueOffsets:i,stride:n,children:r}=t,{[e*n]:s,[e*n+1]:o}=i,a=r[0].slice(s,o-s);return new Er([a])})),bn.prototype.visitStruct=gn(((t,e)=>new pn(t,e))),bn.prototype.visitUnion=gn(((t,e)=>t.type.mode===H.Dense?Nn(t,e):Un(t,e))),bn.prototype.visitDenseUnion=gn(Nn),bn.prototype.visitSparseUnion=gn(Un),bn.prototype.visitDictionary=gn(((t,e)=>{var i;return null===(i=t.dictionary)||void 0===i?void 0:i.get(t.values[e])})),bn.prototype.visitInterval=gn(((t,e)=>t.type.unit===K.DAY_TIME?Cn(t,e):En(t,e))),bn.prototype.visitIntervalDayTime=gn(Cn),bn.prototype.visitIntervalYearMonth=gn(En),bn.prototype.visitDuration=gn(((t,e)=>{switch(t.type.unit){case X.SECOND:return Vn(t,e);case X.MILLISECOND:return Rn(t,e);case X.MICROSECOND:return zn(t,e);case X.NANOSECOND:return Pn(t,e)}})),bn.prototype.visitDurationSecond=gn(Vn),bn.prototype.visitDurationMillisecond=gn(Rn),bn.prototype.visitDurationMicrosecond=gn(zn),bn.prototype.visitDurationNanosecond=gn(Pn),bn.prototype.visitFixedSizeList=gn(((t,e)=>{const{stride:i,children:n}=t,r=n[0].slice(e*i,i);return new Er([r])})),bn.prototype.visitMap=gn(((t,e)=>{const{valueOffsets:i,children:n}=t,{[e]:r,[e+1]:s}=i,o=n[0];return new Hn(o.slice(r,s-r))}));const jn=new bn,kn=Symbol.for("keys"),$n=Symbol.for("vals"),Wn=Symbol.for("kKeysAsStrings"),Yn=Symbol.for("_kKeysAsStrings");class Hn{constructor(t){return this[kn]=new Er([t.children[0]]).memoize(),this[$n]=t.children[1],new Proxy(this,new Zn)}get[Wn](){return this[Yn]||(this[Yn]=Array.from(this[kn].toArray(),String))}[Symbol.iterator](){return new Gn(this[kn],this[$n])}get size(){return this[kn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[kn],e=this[$n],i={};for(let n=-1,r=t.length;++n`${Vt(t)}: ${Vt(e)}`)).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Gn{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),jn.visit(this.vals,t)]})}}class Zn{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Wn]}has(t,e){return t[Wn].includes(e)}getOwnPropertyDescriptor(t,e){if(-1!==t[Wn].indexOf(e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[Wn].indexOf(e);if(-1!==i){const n=jn.visit(Reflect.get(t,$n),i);return Reflect.set(t,e,n),n}}set(t,e,i){const n=t[Wn].indexOf(e);return-1!==n?(cn.visit(Reflect.get(t,$n),n,i),Reflect.set(t,e,i)):!!Reflect.has(t,e)&&Reflect.set(t,e,i)}}let Xn;function Kn(t,e,i,n){const{length:r=0}=t;let s="number"!=typeof e?0:e,o="number"!=typeof i?r:i;return s<0&&(s=(s%r+r)%r),o<0&&(o=(o%r+r)%r),or&&(o=r),n?n(t,s,o):[s,o]}Object.defineProperties(Hn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[kn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[$n]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Yn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});const Jn=(t,e)=>t<0?e+t:t,qn=t=>t!=t;function Qn(t){if("object"!==typeof t||null===t)return qn(t)?qn:e=>e===t;if(t instanceof Date){const e=t.valueOf();return t=>t instanceof Date&&t.valueOf()===e}return ArrayBuffer.isView(t)?e=>!!e&&z(t,e):t instanceof Map?function(t){let e=-1;const i=[];for(const n of t.values())i[++e]=Qn(n);return tr(i)}(t):Array.isArray(t)?function(t){const e=[];for(let i=-1,n=t.length;++i!1;const n=[];for(let e=-1,r=i.length;++e{if(!i||"object"!=typeof i)return!1;switch(i.constructor){case Array:return function(t,e){const i=t.length;if(e.length!==i)return!1;for(let n=-1;++n>n}function sr(t,e,i){const n=i.byteLength+7&-8;if(t>0||i.byteLength>3):or(new ar(i,t,e,null,nr)).subarray(0,n)),r}return i}function or(t){const e=[];let i=0,n=0,r=0;for(const s of t)s&&(r|=1<0)&&(e[i++]=r);const s=new Uint8Array(e.length+7&-8);return s.set(e),s}class ar{constructor(t,e,i,n,r){this.bytes=t,this.length=i,this.context=n,this.get=r,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,r=e+(e%8==0?0:8-e%8);return lr(t,e,r)+lr(t,n,i)+ur(t,r>>3,n-r>>3)}function ur(t,e,i){let n=0,r=Math.trunc(e);const s=new DataView(t.buffer,t.byteOffset,t.byteLength),o=void 0===i?t.byteLength:r+i;for(;o-r>=4;)n+=cr(s.getUint32(r)),r+=4;for(;o-r>=2;)n+=cr(s.getUint16(r)),r+=2;for(;o-r>=1;)n+=cr(s.getUint8(r)),r+=1;return n}function cr(t){let e=Math.trunc(t);return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),16843009*(e+(e>>>4)&252645135)>>>24}var hr=Object.freeze({__proto__:null,getBool:nr,getBit:rr,setBool:function(t,e,i){return i?!!(t[e>>3]|=1<>3]&=~(1<t.nullable)):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:i,nullBitmap:n,typeIds:r}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),this.children.reduce(((t,e)=>t+e.byteLength),t)}get nullCount(){if(Ie.isUnion(this.type))return this.children.reduce(((t,e)=>t+e.nullCount),0);let t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=0===t.length?0:this.length-lr(t,this.offset,this.offset+this.length)),e}constructor(t,e,i,n,r,s=[],o){let a;this.type=t,this.children=s,this.dictionary=o,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1)),r instanceof dr?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=wi(t),r&&((a=r[0])&&(this.valueOffsets=a),(a=r[1])&&(this.values=a),(a=r[2])&&(this.nullBitmap=a),(a=r[3])&&(this.typeIds=a)))}getValid(t){const{type:e}=this;if(Ie.isUnion(e)){const i=e,n=this.children[i.typeIdToChildIndex[this.typeIds[t]]],r=i.mode===H.Dense?this.valueOffsets[t]:t;return n.getValid(r)}if(this.nullable&&this.nullCount>0){const e=this.offset+t;return 0!=(this.nullBitmap[e>>3]&1<>3;(!n||n.byteLength<=l)&&(n=new Uint8Array((r+s+63&-64)>>3).fill(255),this.nullCount>0?(n.set(sr(r,s,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));const u=n[l];i=0!=(u&a),n[l]=e?u|a:u&~a}return i!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,i=this.length,n=this._nullCount,r=this,s=this.children){return new dr(t,e,i,n,r,s,this.dictionary)}slice(t,e){const{stride:i,typeId:n,children:r}=this,s=+(0===this._nullCount)-1,o=16===n?i:1,a=this._sliceBuffers(t,e,i,n);return this.clone(this.type,this.offset+t,e,s,a,0===r.length||this.valueOffsets?r:this._sliceChildren(r,o*t,o*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===st.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:i}=this,n=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);n[e>>3]=(1<0&&n.set(sr(this.offset,e,this.nullBitmap),0);const r=this.buffers;return r[ot.VALIDITY]=n,this.clone(this.type,0,t,i+(t-e),r)}_sliceBuffers(t,e,i,n){let r;const{buffers:s}=this;return(r=s[ot.TYPE])&&(s[ot.TYPE]=r.subarray(t,t+e)),(r=s[ot.OFFSET])&&(s[ot.OFFSET]=r.subarray(t,t+e+1))||(r=s[ot.DATA])&&(s[ot.DATA]=6===n?r:r.subarray(i*t,i*(t+e))),s}_sliceChildren(t,e,i){return t.map((t=>t.slice(e,i)))}}dr.prototype.children=Object.freeze([]);class pr extends Ii{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{type:e,offset:i=0,length:n=0}=t;return new dr(e,i,n,n)}visitBool(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length>>3,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitInt(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitFloat(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitUtf8(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitLargeUtf8(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=M(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitBinary(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitLargeBinary(t){const{type:e,offset:i=0}=t,n=F(t.data),r=F(t.nullBitmap),s=M(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,n,r])}visitFixedSizeBinary(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitDate(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitTimestamp(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitTime(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitDecimal(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitList(t){const{type:e,offset:i=0,child:n}=t,r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,void 0,r],[n])}visitStruct(t){const{type:e,offset:i=0,children:n=[]}=t,r=F(t.nullBitmap),{length:s=n.reduce(((t,{length:e})=>Math.max(t,e)),0),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,void 0,r],n)}visitUnion(t){const{type:e,offset:i=0,children:n=[]}=t,r=L(e.ArrayType,t.typeIds),{length:s=r.length,nullCount:o=-1}=t;if(Ie.isSparseUnion(e))return new dr(e,i,s,o,[void 0,void 0,void 0,r],n);const a=x(t.valueOffsets);return new dr(e,i,s,o,[a,void 0,void 0,r],n)}visitDictionary(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.indices.ArrayType,t.data),{dictionary:s=new Er([(new pr).visit({type:e.dictionary})])}=t,{length:o=r.length,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[void 0,r,n],[],s)}visitInterval(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitDuration(t){const{type:e,offset:i=0}=t,n=F(t.nullBitmap),r=L(e.ArrayType,t.data),{length:s=r.length,nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,r,n])}visitFixedSizeList(t){const{type:e,offset:i=0,child:n=(new pr).visit({type:e.valueType})}=t,r=F(t.nullBitmap),{length:s=n.length/wi(e),nullCount:o=(t.nullBitmap?-1:0)}=t;return new dr(e,i,s,o,[void 0,void 0,r],[n])}visitMap(t){const{type:e,offset:i=0,child:n=(new pr).visit({type:e.childType})}=t,r=F(t.nullBitmap),s=x(t.valueOffsets),{length:o=s.length-1,nullCount:a=(t.nullBitmap?-1:0)}=t;return new dr(e,i,o,a,[s,void 0,r],[n])}}const yr=new pr;function fr(t){return yr.visit(t)}class br{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext+e.nullCount),0)}function vr(t){return t.reduce(((t,e,i)=>(t[i+1]=t[i]+e.length,t)),new Uint32Array(t.length+1))}function _r(t,e,i,n){const r=[];for(let s=-1,o=t.length;++s=n)break;if(i>=a+l)continue;if(a>=i&&a+l<=n){r.push(o);continue}const u=Math.max(0,i-a),c=Math.min(n-a,l);r.push(o.slice(u,c-u))}return 0===r.length&&r.push(t[0].slice(0,0)),r}function mr(t,e,i,n){let r=0,s=0,o=e.length-1;do{if(r>=o-1)return i0?0:-1},Br.prototype.visitBool=Dr,Br.prototype.visitInt=Dr,Br.prototype.visitInt8=Dr,Br.prototype.visitInt16=Dr,Br.prototype.visitInt32=Dr,Br.prototype.visitInt64=Dr,Br.prototype.visitUint8=Dr,Br.prototype.visitUint16=Dr,Br.prototype.visitUint32=Dr,Br.prototype.visitUint64=Dr,Br.prototype.visitFloat=Dr,Br.prototype.visitFloat16=Dr,Br.prototype.visitFloat32=Dr,Br.prototype.visitFloat64=Dr,Br.prototype.visitUtf8=Dr,Br.prototype.visitLargeUtf8=Dr,Br.prototype.visitBinary=Dr,Br.prototype.visitLargeBinary=Dr,Br.prototype.visitFixedSizeBinary=Dr,Br.prototype.visitDate=Dr,Br.prototype.visitDateDay=Dr,Br.prototype.visitDateMillisecond=Dr,Br.prototype.visitTimestamp=Dr,Br.prototype.visitTimestampSecond=Dr,Br.prototype.visitTimestampMillisecond=Dr,Br.prototype.visitTimestampMicrosecond=Dr,Br.prototype.visitTimestampNanosecond=Dr,Br.prototype.visitTime=Dr,Br.prototype.visitTimeSecond=Dr,Br.prototype.visitTimeMillisecond=Dr,Br.prototype.visitTimeMicrosecond=Dr,Br.prototype.visitTimeNanosecond=Dr,Br.prototype.visitDecimal=Dr,Br.prototype.visitList=Dr,Br.prototype.visitStruct=Dr,Br.prototype.visitUnion=Dr,Br.prototype.visitDenseUnion=Tr,Br.prototype.visitSparseUnion=Tr,Br.prototype.visitDictionary=Dr,Br.prototype.visitInterval=Dr,Br.prototype.visitIntervalDayTime=Dr,Br.prototype.visitIntervalYearMonth=Dr,Br.prototype.visitDuration=Dr,Br.prototype.visitDurationSecond=Dr,Br.prototype.visitDurationMillisecond=Dr,Br.prototype.visitDurationMicrosecond=Dr,Br.prototype.visitDurationNanosecond=Dr,Br.prototype.visitFixedSizeList=Dr,Br.prototype.visitMap=Dr;const Or=new Br;class Lr extends Ii{}function xr(t){const{type:e}=t;if(0===t.nullCount&&1===t.stride&&(Ie.isInt(e)&&64!==e.bitWidth||Ie.isTime(e)&&64!==e.bitWidth||Ie.isFloat(e)&&e.precision!==G.HALF))return new br(t.data.length,(e=>{const i=t.data[e];return i.values.subarray(0,i.length)[Symbol.iterator]()}));let i=0;return new br(t.data.length,(e=>{const n=t.data[e].length,r=t.slice(i,i+n);return i+=n,new Mr(r)}))}class Mr{constructor(t){this.vector=t,this.index=0}next(){return this.indext.data)):t;if(0===r.length||r.some((t=>!(t instanceof dr))))throw new TypeError("Vector constructor expects an Array of Data instances.");const s=null===(e=r[0])||void 0===e?void 0:e.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:t,set:e,indexOf:i}=Ur[s.typeId],n=r[0];this.isValid=t=>wr(n,t),this.get=e=>t(n,e),this.set=(t,i)=>e(n,t,i),this.indexOf=t=>i(n,t),this._offsets=[0,n.length];break}default:Object.setPrototypeOf(this,Cr[s.typeId]),this._offsets=vr(r)}this.data=r,this.type=s,this.stride=wi(s),this.numChildren=null!==(n=null===(i=s.children)||void 0===i?void 0:i.length)&&void 0!==n?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce(((t,e)=>t+e.byteLength),0)}get nullable(){return this.data.some((t=>t.nullable))}get nullCount(){return gr(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${st[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Jn(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Fr.visit(this)}concat(...t){return new Er(this.data.concat(t.flatMap((t=>t.data)).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new Er(Kn(this,t,e,(({data:t,_offsets:e},i,n)=>_r(t,e,i,n))))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:i,stride:n,ArrayType:r}=this;switch(t.typeId){case st.Int:case st.Float:case st.Decimal:case st.Time:case st.Timestamp:switch(e.length){case 0:return new r;case 1:return e[0].values.subarray(0,i*n);default:return e.reduce(((t,{values:e,length:i})=>(t.array.set(e.subarray(0,i*n),t.offset),t.offset+=i*n,t)),{array:new r(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt(null===(e=this.type.children)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&te[t]))):null}get isMemoized(){return!!Ie.isDictionary(this.type)&&this.data[0].dictionary.isMemoized}memoize(){if(Ie.isDictionary(this.type)){const t=new Vr(this.data[0].dictionary),e=this.data.map((e=>{const i=e.clone();return i.dictionary=t,i}));return new Er(e)}return new Vr(this)}unmemoize(){if(Ie.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map((e=>{const i=e.clone();return i.dictionary=t,i}));return new Er(e)}return this}}Nr=Symbol.toStringTag,Er[Nr]=(t=>{t.type=Ie.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(st).map((t=>st[t])).filter((t=>"number"==typeof t&&t!==st.NONE));for(const i of e){const e=jn.getVisitFnByTypeId(i),n=cn.getVisitFnByTypeId(i),r=Or.getVisitFnByTypeId(i);Ur[i]={get:e,set:n,indexOf:r},Cr[i]=Object.create(t,{isValid:{value:Ir(wr)},get:{value:Ir(jn.getVisitFnByTypeId(i))},set:{value:Sr(cn.getVisitFnByTypeId(i))},indexOf:{value:Ar(Or.getVisitFnByTypeId(i))}})}return"Vector"})(Er.prototype);class Vr extends Er{constructor(t){super(t.data);const e=this.get,i=this.set,n=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(t){const i=r[t];if(void 0!==i)return i;const n=e.call(this,t);return r[t]=n,n}}),Object.defineProperty(this,"set",{value(t,e){i.call(this,t,e),r[t]=e}}),Object.defineProperty(this,"slice",{value:(t,e)=>new Vr(n.call(this,t,e))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Er(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}function Rr(t){if(t){if(t instanceof dr)return new Er([t]);if(t instanceof Er)return new Er(t.data);if(t.type instanceof Ie)return new Er([fr(t)]);if(Array.isArray(t))return new Er(t.flatMap((t=>{return(e=t)instanceof dr?[e]:e instanceof Er?e.data:Rr(e).data;var e})));if(ArrayBuffer.isView(t)){t instanceof DataView&&(t=new Uint8Array(t.buffer));const e={offset:0,length:t.length,nullCount:-1,data:t};if(t instanceof Int8Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Be}))]);if(t instanceof Int16Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new De}))]);if(t instanceof Int32Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Te}))]);if(t instanceof BigInt64Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Oe}))]);if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)return new Er([fr(Object.assign(Object.assign({},e),{type:new Le}))]);if(t instanceof Uint16Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new xe}))]);if(t instanceof Uint32Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Me}))]);if(t instanceof BigUint64Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Fe}))]);if(t instanceof Float32Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Ce}))]);if(t instanceof Float64Array)return new Er([fr(Object.assign(Object.assign({},e),{type:new Ee}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function zr(t){if(!t||t.length<=0)return function(t){return!0};let e="";const i=t.filter((t=>t==t));return i.length>0&&(e=`\n switch (x) {${i.map((t=>`\n case ${function(t){if("bigint"!=typeof t)return Vt(t);return`${Vt(t)}n`}(t)}:`)).join("")}\n return false;\n }`),t.length!==i.length&&(e=`if (x !== x) return false;\n${e}`),new Function("x",`${e}\nreturn true;`)}function Pr(t,e){const i=Math.ceil(t)*e-1;return(i-i%64+64||64)/e}function jr(t,e=0){return t.length>=e?t.subarray(0,e):T(new t.constructor(e),t,0)}class kr{constructor(t,e=0,i=1){this.length=Math.ceil(e/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;const e=this.stride,i=this.length*e,n=this.buffer.length;i>=n&&this._resize(Pr(0===n?1*i:2*i,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Pr(t*this.stride,this.BYTES_PER_ELEMENT);const e=jr(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=jr(this.buffer,t)}}class $r extends kr{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}}class Wr extends $r{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){const{buffer:i}=this.reserve(t-this.length+1),n=t>>3,r=t%8,s=i[n]>>r&1;return e?0===s&&(i[n]|=1<=0&&n.fill(n[i],i,t),n[t]=n[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}class Hr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=wi(t),this._nulls=new Wr,e&&e.length>0&&(this._isValid=zr(e))}toVector(){return new Er([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0;const{_offsets:e,_values:i,_nulls:n,_typeIds:r,children:s}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),r&&(t+=r.byteLength),s.reduce(((t,e)=>t+e.byteLength),t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce(((t,e)=>t+e.reservedByteLength),t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,i,n;const{type:r,length:s,nullCount:o,_typeIds:a,_offsets:l,_values:u,_nulls:c}=this;(e=null==a?void 0:a.flush(s))?n=null==l?void 0:l.flush(s):t=(n=null==l?void 0:l.flush(s))?null==u?void 0:u.flush(l.last()):null==u?void 0:u.flush(s),o>0&&(i=null==c?void 0:c.flush(s));const h=this.children.map((t=>t.flush()));return this.clear(),fr({type:r,length:s,nullCount:o,children:h,child:h[0],data:t,typeIds:e,nullBitmap:i,valueOffsets:n})}finish(){this.finished=!0;for(const t of this.children)t.finish();return this}clear(){var t,e,i,n;this.length=0,null===(t=this._nulls)||void 0===t||t.clear(),null===(e=this._values)||void 0===e||e.clear(),null===(i=this._offsets)||void 0===i||i.clear(),null===(n=this._typeIds)||void 0===n||n.clear();for(const t of this.children)t.clear();return this}}Hr.prototype.length=1,Hr.prototype.stride=1,Hr.prototype.children=null,Hr.prototype.finished=!1,Hr.prototype.nullValues=null,Hr.prototype._isValid=()=>!0;class Gr extends Hr{constructor(t){super(t),this._values=new $r(this.ArrayType,0,this.stride)}setValue(t,e){const i=this._values;return i.reserve(t-i.length+1),super.setValue(t,e)}}class Zr extends Hr{constructor(t){super(t),this._pendingLength=0,this._offsets=new Yr(t.type)}setValue(t,e){const i=this._pending||(this._pending=new Map),n=i.get(t);n&&(this._pendingLength-=n.length),this._pendingLength+=e instanceof Hn?e[kn].length:e.length,i.set(t,e)}setValid(t,e){return!!super.setValid(t,e)||((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}class Xr{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,i,n){return t.prep(8,24),t.writeInt64(BigInt(null!=n?n:0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(null!=e?e:0)),t.offset()}}class Kr{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Kr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new Kr).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ct).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new Xr).__init(this.bb.__vector(this.bb_pos+i)+24*t,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const i=this.bb.__offset(this.bb_pos,10);return i?(e||new Xr).__init(this.bb.__vector(this.bb_pos+i)+24*t,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Y.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class Jr{constructor(t=[],e,i,n=Y.V5){this.fields=t||[],this.metadata=e||new Map,i||(i=ts(t)),this.dictionaries=i,this.metadataVersion=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map((t=>t.name))}toString(){return`Schema<{ ${this.fields.map(((t,e)=>`${e}: ${t}`)).join(", ")} }>`}select(t){const e=new Set(t),i=this.fields.filter((t=>e.has(t.name)));return new Jr(i,this.metadata)}selectAt(t){const e=t.map((t=>this.fields[t])).filter(Boolean);return new Jr(e,this.metadata)}assign(...t){const e=t[0]instanceof Jr?t[0]:Array.isArray(t[0])?new Jr(t[0]):new Jr(t),i=[...this.fields],n=Qr(Qr(new Map,this.metadata),e.metadata),r=e.fields.filter((t=>{const e=i.findIndex((e=>e.name===t.name));return!~e||(i[e]=t.clone({metadata:Qr(Qr(new Map,i[e].metadata),t.metadata)}))&&!1})),s=ts(r,new Map);return new Jr([...i,...r],n,new Map([...this.dictionaries,...s]))}}Jr.prototype.fields=null,Jr.prototype.metadata=null,Jr.prototype.dictionaries=null;class qr{static new(...t){let[e,i,n,r]=t;return t[0]&&"object"==typeof t[0]&&(({name:e}=t[0]),void 0===i&&(i=t[0].type),void 0===n&&(n=t[0].nullable),void 0===r&&(r=t[0].metadata)),new qr(`${e}`,i,n,r)}constructor(t,e,i=!1,n){this.name=t,this.type=e,this.nullable=i,this.metadata=n||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,i,n,r]=t;return t[0]&&"object"==typeof t[0]?({name:e=this.name,type:i=this.type,nullable:n=this.nullable,metadata:r=this.metadata}=t[0]):[e=this.name,i=this.type,n=this.nullable,r=this.metadata]=t,qr.new(e,i,n,r)}}function Qr(t,e){return new Map([...t||new Map,...e||new Map])}function ts(t,e=new Map){for(let i=-1,n=t.length;++i0&&ts(n.children,e)}return e}qr.prototype.type=null,qr.prototype.name=null,qr.prototype.nullable=null,qr.prototype.metadata=null;var es=o.Builder,is=o.ByteBuffer;class ns{static decode(t){t=new is(F(t));const e=Kr.getRootAsFooter(t),i=Jr.decode(e.schema(),new Map,e.version());return new rs(i,e)}static encode(t){const e=new es,i=Jr.encode(e,t.schema);Kr.startRecordBatchesVector(e,t.numRecordBatches);for(const i of[...t.recordBatches()].slice().reverse())ss.encode(e,i);const n=e.endVector();Kr.startDictionariesVector(e,t.numDictionaries);for(const i of[...t.dictionaryBatches()].slice().reverse())ss.encode(e,i);const r=e.endVector();return Kr.startFooter(e),Kr.addSchema(e,i),Kr.addVersion(e,Y.V5),Kr.addRecordBatches(e,n),Kr.addDictionaries(e,r),Kr.finishFooterBuffer(e,Kr.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=Y.V5,i,n){this.schema=t,this.version=e,i&&(this._recordBatches=i),n&&(this._dictionaryBatches=n)}*recordBatches(){for(let t,e=-1,i=this.numRecordBatches;++e=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t))}get closed(){return this._closedPromise}cancel(t){return r(this,void 0,void 0,(function*(){yield this.return(t)}))}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(os);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return j.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return j.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return r(this,void 0,void 0,(function*(){return yield this.abort(t),os}))}return(t){return r(this,void 0,void 0,(function*(){return yield this.close(),os}))}read(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise(((t,e)=>{this.resolvers.push({resolve:t,reject:e})})):Promise.resolve(os)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class cs extends us{write(t){if((t=F(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?u(this.toUint8Array(!0)):this.toUint8Array(!1).then(u)}toUint8Array(t=!1){return t?O(this._values)[0]:(()=>r(this,void 0,void 0,(function*(){var t,e,i,r;const s=[];let o=0;try{for(var a,l=!0,u=n(this);!(t=(a=yield u.next()).done);l=!0){r=a.value,l=!1;const t=r;s.push(t),o+=t.byteLength}}catch(t){e={error:t}}finally{try{l||t||!(i=u.return)||(yield i.call(u))}finally{if(e)throw e.error}}return O(s,o)[0]})))()}}class hs{constructor(t){t&&(this.source=new ps(j.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class ds{constructor(t){t instanceof ds?this.source=t.source:t instanceof cs?this.source=new ys(j.fromAsyncIterable(t)):A(t)?this.source=new ys(j.fromNodeStream(t)):S(t)?this.source=new ys(j.fromDOMStream(t)):w(t)?this.source=new ys(j.fromDOMStream(t.body)):b(t)?this.source=new ys(j.fromIterable(t)):(f(t)||g(t))&&(this.source=new ys(j.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class ps{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||os)}return(t){return Object.create(this.source.return&&this.source.return(t)||os)}}class ys{constructor(t){this.source=t,this._closedPromise=new Promise((t=>this._closedPromiseResolve=t))}cancel(t){return r(this,void 0,void 0,(function*(){yield this.return(t)}))}get closed(){return this._closedPromise}read(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"read")).value}))}peek(t){return r(this,void 0,void 0,(function*(){return(yield this.next(t,"peek")).value}))}next(t){return r(this,arguments,void 0,(function*(t,e="read"){return yield this.source.next({cmd:e,size:t})}))}throw(t){return r(this,void 0,void 0,(function*(){const e=this.source.throw&&(yield this.source.throw(t))||os;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}return(t){return r(this,void 0,void 0,(function*(){const e=this.source.return&&(yield this.source.return(t))||os;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}))}}class fs extends hs{constructor(t,e){super(),this.position=0,this.buffer=F(t),this.size=void 0===e?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),tr(this,void 0,void 0,(function*(){this.size=(yield t.stat()).size,delete this._pending})))()}readInt32(t){return r(this,void 0,void 0,(function*(){const{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}))}seek(t){return r(this,void 0,void 0,(function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),i=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]);let n=e[3]*i[3];this.buffer[0]=65535&n;let r=n>>>16;return n=e[2]*i[3],r+=n,n=e[3]*i[2]>>>0,r+=n,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0>>16,this.buffer[1]+=e[1]*i[3]+e[2]*i[2]+e[3]*i[1],this.buffer[1]+=e[0]*i[3]+e[1]*i[2]+e[2]*i[1]+e[3]*i[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${gs(this.buffer[3])} ${gs(this.buffer[2])} ${gs(this.buffer[1])} ${gs(this.buffer[0])}`}static multiply(t,e){return new Is(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Is(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Is.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Is.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const i=t.startsWith("-"),n=t.length,r=new Is(e);for(let e=i?1:0;e0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class Bs extends As{constructor(t,e,i,n,r){super(new Uint8Array(0),e,i,n,r),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):or(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return L(Uint8Array,L(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return L(Uint8Array,L(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:i}=this;return Ie.isTimestamp(t)||(Ie.isInt(t)||Ie.isTime(t))&&64===t.bitWidth||Ie.isDuration(t)||Ie.isDate(t)&&t.unit===Z.MILLISECOND?L(Uint8Array,ws.convertArray(i[e])):Ie.isDecimal(t)?L(Uint8Array,Is.convertArray(i[e])):Ie.isBinary(t)||Ie.isLargeBinary(t)||Ie.isFixedSizeBinary(t)?function(t){const e=t.join(""),i=new Uint8Array(e.length/2);for(let t=0;t>1]=Number.parseInt(e.slice(t,t+2),16);return i}(i[e]):Ie.isBool(t)?or(i[e]):Ie.isUtf8(t)||Ie.isLargeUtf8(t)?h(i[e].join("")):L(Uint8Array,L(t.ArrayType,i[e].map((t=>+t))))}}class Ds extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,F(e))}_flushPending(t,e){const i=this._offsets,n=this._values.reserve(e).buffer;let r=0;for(const[e,s]of t)if(void 0===s)i.set(e,0);else{const t=s.length;n.set(s,r),i.set(e,t),r+=t}}}class Ts extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,F(e))}_flushPending(t,e){const i=this._offsets,n=this._values.reserve(e).buffer;let r=0;for(const[e,s]of t)if(void 0===s)i.set(e,BigInt(0));else{const t=s.length;n.set(s,r),i.set(e,BigInt(t)),r+=t}}}class Os extends Hr{constructor(t){super(t),this._values=new Wr}setValue(t,e){this._values.set(t,+e)}}class Ls extends Gr{}Ls.prototype._setValue=ji;class xs extends Ls{}xs.prototype._setValue=Ei;class Ms extends Ls{}Ms.prototype._setValue=Vi;class Fs extends Gr{}Fs.prototype._setValue=qi;class Ns extends Hr{constructor({type:t,nullValues:e,dictionaryHashFunction:i}){super({type:new mi(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ro({type:this.type.indices,nullValues:e}),this.dictionary=Ro({type:this.type.dictionary,nullValues:null}),"function"==typeof i&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){const i=this.indices;return e=i.setValid(t,e),this.length=i.length,e}setValue(t,e){const i=this._keysToIndices,n=this.valueToKey(e);let r=i[n];return void 0===r&&(i[n]=r=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,r)}flush(){const t=this.type,e=this._dictionary,i=this.dictionary.toVector(),n=this.indices.flush().clone(t);return n.dictionary=e?e.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=n.dictionary,this.clear(),n}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return"string"==typeof t?t:`${t}`}}class Us extends Gr{}Us.prototype._setValue=Ri;class Cs extends Hr{setValue(t,e){const[i]=this.children,n=t*this.stride;for(let t=-1,r=e.length;++t0)throw new Error("FixedSizeListBuilder can only have one child.");const i=this.children.push(t);return this.type=new bi(this.type.listSize,new qr(e,t.type,!0)),i}}class Es extends Gr{setValue(t,e){this._values.set(t,e)}}class Vs extends Es{setValue(t,e){super.setValue(t,Oi(e))}}class Rs extends Es{}class zs extends Es{}class Ps extends Gr{}Ps.prototype._setValue=en;class js extends Ps{}js.prototype._setValue=nn;class ks extends Ps{}ks.prototype._setValue=rn;class $s extends Gr{}$s.prototype._setValue=un;class Ws extends $s{}Ws.prototype._setValue=sn;class Ys extends $s{}Ys.prototype._setValue=on;class Hs extends $s{}Hs.prototype._setValue=an;class Gs extends $s{}Gs.prototype._setValue=ln;class Zs extends Gr{setValue(t,e){this._values.set(t,e)}}class Xs extends Zs{}class Ks extends Zs{}class Js extends Zs{}class qs extends Zs{}class Qs extends Zs{}class to extends Zs{}class eo extends Zs{}class io extends Zs{}class no extends Zr{constructor(t){super(t),this._offsets=new Yr(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ci(new qr(e,t.type,!0)),this.numChildren-1}_flushPending(t){const e=this._offsets,[i]=this.children;for(const[n,r]of t)if(void 0===r)e.set(n,0);else{const t=r,s=t.length,o=e.set(n,s).buffer[n];for(let e=-1;++e0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new gi(new qr(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){const e=this._offsets,[i]=this.children;for(const[n,r]of t)if(void 0===r)e.set(n,0);else{let{[n]:t,[n+1]:s}=e.set(n,r.size).buffer;for(const e of r.entries())if(i.set(t,e),++t>=s)break}}}class so extends Hr{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}}class oo extends Hr{setValue(t,e){const{children:i,type:n}=this;switch(Array.isArray(e)||e.constructor){case!0:return n.children.forEach(((n,r)=>i[r].set(t,e[r])));case Map:return n.children.forEach(((n,r)=>i[r].set(t,e.get(n.name))));default:return n.children.forEach(((n,r)=>i[r].set(t,e[n.name])))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach((i=>i.setValid(t,e))),e}addChild(t,e=`${this.numChildren}`){const i=this.children.push(t);return this.type=new hi([...this.type.children,new qr(e,t.type,!0)]),i}}class ao extends Gr{}ao.prototype._setValue=Hi;class lo extends ao{}lo.prototype._setValue=ki;class uo extends ao{}uo.prototype._setValue=$i;class co extends ao{}co.prototype._setValue=Wi;class ho extends ao{}ho.prototype._setValue=Yi;class po extends Gr{}po.prototype._setValue=Ji;class yo extends po{}yo.prototype._setValue=Gi;class fo extends po{}fo.prototype._setValue=Zi;class bo extends po{}bo.prototype._setValue=Xi;class go extends po{}go.prototype._setValue=Ki;class vo extends Hr{constructor(t){super(t),this._typeIds=new $r(Int8Array,0,1),"function"==typeof t.valueToChildTypeId&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,i){return void 0===i&&(i=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,i),this}setValue(t,e,i){this._typeIds.set(t,i);const n=this.type.typeIdToChildIndex[i],r=this.children[n];null==r||r.set(t,e)}addChild(t,e=`${this.children.length}`){const i=this.children.push(t),{type:{children:n,mode:r,typeIds:s}}=this,o=[...n,new qr(e,t.type)];return this.type=new di(r,[...s,i],o),i}_valueToChildTypeId(t,e,i){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class _o extends vo{}class mo extends vo{constructor(t){super(t),this._offsets=new $r(Int32Array)}setValue(t,e,i){const n=this._typeIds.set(t,i).buffer[t],r=this.getChildAt(this.type.typeIdToChildIndex[n]),s=this._offsets.set(t,r.length).buffer[t];null==r||r.set(s,e)}}class wo extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,h(e))}_flushPending(t,e){}}wo.prototype._flushPending=Ds.prototype._flushPending;class Io extends Zr{constructor(t){super(t),this._values=new kr(Uint8Array)}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,h(e))}_flushPending(t,e){}}Io.prototype._flushPending=Ts.prototype._flushPending;const So=new class extends Ii{visitNull(){return so}visitBool(){return Os}visitInt(){return Zs}visitInt8(){return Xs}visitInt16(){return Ks}visitInt32(){return Js}visitInt64(){return qs}visitUint8(){return Qs}visitUint16(){return to}visitUint32(){return eo}visitUint64(){return io}visitFloat(){return Es}visitFloat16(){return Vs}visitFloat32(){return Rs}visitFloat64(){return zs}visitUtf8(){return wo}visitLargeUtf8(){return Io}visitBinary(){return Ds}visitLargeBinary(){return Ts}visitFixedSizeBinary(){return Us}visitDate(){return Ls}visitDateDay(){return xs}visitDateMillisecond(){return Ms}visitTimestamp(){return ao}visitTimestampSecond(){return lo}visitTimestampMillisecond(){return uo}visitTimestampMicrosecond(){return co}visitTimestampNanosecond(){return ho}visitTime(){return po}visitTimeSecond(){return yo}visitTimeMillisecond(){return fo}visitTimeMicrosecond(){return bo}visitTimeNanosecond(){return go}visitDecimal(){return Fs}visitList(){return no}visitStruct(){return oo}visitUnion(){return vo}visitDenseUnion(){return mo}visitSparseUnion(){return _o}visitDictionary(){return Ns}visitInterval(){return Ps}visitIntervalDayTime(){return js}visitIntervalYearMonth(){return ks}visitDuration(){return $s}visitDurationSecond(){return Ws}visitDurationMillisecond(){return Ys}visitDurationMicrosecond(){return Hs}visitDurationNanosecond(){return Gs}visitFixedSizeList(){return Cs}visitMap(){return ro}};class Ao extends Ii{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every(((t,i)=>this.compareFields(t,e[i])))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function Bo(t,e){return e instanceof t.constructor}function Do(t,e){return t===e||Bo(t,e)}function To(t,e){return t===e||Bo(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function Oo(t,e){return t===e||Bo(t,e)&&t.precision===e.precision}function Lo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit}function xo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function Mo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Fo(t,e){return t===e||Bo(t,e)&&t.mode===e.mode&&t.typeIds.every(((t,i)=>t===e.typeIds[i]))&&Co.compareManyFields(t.children,e.children)}function No(t,e){return t===e||Bo(t,e)&&t.unit===e.unit}function Uo(t,e){return t===e||Bo(t,e)&&t.unit===e.unit}Ao.prototype.visitNull=Do,Ao.prototype.visitBool=Do,Ao.prototype.visitInt=To,Ao.prototype.visitInt8=To,Ao.prototype.visitInt16=To,Ao.prototype.visitInt32=To,Ao.prototype.visitInt64=To,Ao.prototype.visitUint8=To,Ao.prototype.visitUint16=To,Ao.prototype.visitUint32=To,Ao.prototype.visitUint64=To,Ao.prototype.visitFloat=Oo,Ao.prototype.visitFloat16=Oo,Ao.prototype.visitFloat32=Oo,Ao.prototype.visitFloat64=Oo,Ao.prototype.visitUtf8=Do,Ao.prototype.visitLargeUtf8=Do,Ao.prototype.visitBinary=Do,Ao.prototype.visitLargeBinary=Do,Ao.prototype.visitFixedSizeBinary=function(t,e){return t===e||Bo(t,e)&&t.byteWidth===e.byteWidth},Ao.prototype.visitDate=Lo,Ao.prototype.visitDateDay=Lo,Ao.prototype.visitDateMillisecond=Lo,Ao.prototype.visitTimestamp=xo,Ao.prototype.visitTimestampSecond=xo,Ao.prototype.visitTimestampMillisecond=xo,Ao.prototype.visitTimestampMicrosecond=xo,Ao.prototype.visitTimestampNanosecond=xo,Ao.prototype.visitTime=Mo,Ao.prototype.visitTimeSecond=Mo,Ao.prototype.visitTimeMillisecond=Mo,Ao.prototype.visitTimeMicrosecond=Mo,Ao.prototype.visitTimeNanosecond=Mo,Ao.prototype.visitDecimal=Do,Ao.prototype.visitList=function(t,e){return t===e||Bo(t,e)&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)},Ao.prototype.visitStruct=function(t,e){return t===e||Bo(t,e)&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)},Ao.prototype.visitUnion=Fo,Ao.prototype.visitDenseUnion=Fo,Ao.prototype.visitSparseUnion=Fo,Ao.prototype.visitDictionary=function(t,e){return t===e||Bo(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&Co.visit(t.indices,e.indices)&&Co.visit(t.dictionary,e.dictionary)},Ao.prototype.visitInterval=No,Ao.prototype.visitIntervalDayTime=No,Ao.prototype.visitIntervalYearMonth=No,Ao.prototype.visitDuration=Uo,Ao.prototype.visitDurationSecond=Uo,Ao.prototype.visitDurationMillisecond=Uo,Ao.prototype.visitDurationMicrosecond=Uo,Ao.prototype.visitDurationNanosecond=Uo,Ao.prototype.visitFixedSizeList=function(t,e){return t===e||Bo(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)},Ao.prototype.visitMap=function(t,e){return t===e||Bo(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&Co.compareManyFields(t.children,e.children)};const Co=new Ao;function Eo(t,e){return Co.compareSchemas(t,e)}function Vo(t,e){return Co.visit(t,e)}function Ro(t){const e=t.type,i=new(So.getVisitFn(e)())(t);if(e.children&&e.children.length>0){const n=t.children||[],r={nullValues:t.nullValues},s=Array.isArray(n)?(t,e)=>n[e]||r:({name:t})=>n[t]||r;for(const[t,n]of e.children.entries()){const{type:e}=n,r=s(n,t);i.children.push(Ro(Object.assign(Object.assign({},r),{type:e})))}}return i}function zo(t,e){if(t instanceof dr||t instanceof Er||t.type instanceof Ie||ArrayBuffer.isView(t))return Rr(t);const i=[...ko({type:null!=e?e:jo(t),nullValues:[null]})(t)],n=1===i.length?i[0]:i.reduce(((t,e)=>t.concat(e)));return Ie.isDictionary(n.type)?n.memoize():n}function Po(t){const e=zo(t),i=new Jo(new Jr(e.type.children),e.data[0]);return new Zo(i)}function jo(t){if(0===t.length)return new Se;let e=0,i=0,n=0,r=0,s=0,o=0,a=0,l=0;for(const u of t){if(null!=u){switch(typeof u){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++r;continue;case"string":++s;continue;case"object":Array.isArray(u)?++i:"[object Date]"===Object.prototype.toString.call(u)?++l:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}++e}if(r+e===t.length)return new Ee;if(s+e===t.length)return new mi(new ze,new Te);if(o+e===t.length)return new Oe;if(a+e===t.length)return new je;if(l+e===t.length)return new Qe;if(i+e===t.length){const e=t,i=jo(e[e.findIndex((t=>null!=t))]);if(e.every((t=>null==t||Vo(i,jo(t)))))return new ci(new qr("",i,!0))}else if(n+e===t.length){const e=new Map;for(const i of t)for(const t of Object.keys(i))e.has(t)||null==i[t]||e.set(t,new qr(t,jo([i[t]]),!0));return new hi([...e.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function ko(t){const{queueingStrategy:e="count"}=t,{highWaterMark:i=("bytes"!==e?Number.POSITIVE_INFINITY:Math.pow(2,14))}=t,n="bytes"!==e?"length":"byteLength";return function*(e){let r=0;const s=Ro(t);for(const t of e)s.append(t)[n]>=i&&++r&&(yield s.toVector());(s.finish().length>0||0===r)&&(yield s.toVector())}}function $o(i){const{queueingStrategy:r="count"}=i,{highWaterMark:s=("bytes"!==r?Number.POSITIVE_INFINITY:Math.pow(2,14))}=i,o="bytes"!==r?"length":"byteLength";return function(r){return t(this,arguments,(function*(){var t,a,l,u;let c=0;const h=Ro(i);try{for(var d,p=!0,y=n(r);!(t=(d=yield e(y.next())).done);p=!0){u=d.value,p=!1;const t=u;h.append(t)[o]>=s&&++c&&(yield yield e(h.toVector()))}}catch(t){a={error:t}}finally{try{p||t||!(l=y.return)||(yield e(l.call(y)))}finally{if(a)throw a.error}}(h.finish().length>0||0===c)&&(yield yield e(h.toVector()))}))}}function Wo(t,e){return function(t,e){const i=[...t.fields],n=[],r={numBatches:e.reduce(((t,e)=>Math.max(t,e.length)),0)};let s=0,o=0,a=-1;const l=e.length;let u,c=[];for(;r.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(n[s++]=fr({type:new hi(i),length:o,nullCount:0,children:c.slice()})))}return[t=t.assign(i),n.map((e=>new Jo(t,e)))]}(t,e.map((t=>t.data.concat())))}function Yo(t,e,i,n,r){var s;const o=(e+63&-64)>>3;for(let a=-1,l=n.length;++a=e)u===e?i[a]=l:(i[a]=l.slice(0,e),r.numBatches=Math.max(r.numBatches,n[a].unshift(l.slice(e,u-e))));else{const n=t[a];t[a]=n.clone({nullable:!0}),i[a]=null!==(s=null==l?void 0:l._changeLengthAndBackfillNullBitmap(e))&&void 0!==s?s:fr({type:n.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)})}}return i}var Ho,Go;class Zo{constructor(...t){var e,i;if(0===t.length)return this.batches=[],this.schema=new Jr([]),this._offsets=[0],this;let n,r;t[0]instanceof Jr&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());const s=t=>{if(t){if(t instanceof Jo)return[t];if(t instanceof Zo)return t.batches;if(t instanceof dr){if(t.type instanceof hi)return[new Jo(new Jr(t.type.children),t)]}else{if(Array.isArray(t))return t.flatMap((t=>s(t)));if("function"==typeof t[Symbol.iterator])return[...t].flatMap((t=>s(t)));if("object"==typeof t){const e=Object.keys(t),i=e.map((e=>new Er([t[e]]))),r=null!=n?n:new Jr(e.map(((t,e)=>new qr(String(t),i[e].type,i[e].nullable)))),[,s]=Wo(r,i);return 0===s.length?[new Jo(t)]:s}}}return[]},o=t.flatMap((t=>s(t)));if(n=null!==(i=null!=n?n:null===(e=o[0])||void 0===e?void 0:e.schema)&&void 0!==i?i:new Jr([]),!(n instanceof Jr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const t of o){if(!(t instanceof Jo))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Eo(n,t.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=o,this._offsets=null!=r?r:vr(this.data)}get data(){return this.batches.map((({data:t})=>t))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce(((t,e)=>t+e.length),0)}get nullCount(){return-1===this._nullCount&&(this._nullCount=gr(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Jn(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Fr.visit(new Er(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(",\n ")}\n]`}concat(...t){const e=this.schema,i=this.data.concat(t.flatMap((({data:t})=>t)));return new Zo(e,i.map((t=>new Jo(e,t))))}slice(t,e){const i=this.schema;[t,e]=Kn({length:this.numRows},t,e);const n=_r(this.data,this._offsets,t,e);return new Zo(i,n.map((t=>new Jo(i,t))))}getChild(t){return this.getChildAt(this.schema.fields.findIndex((e=>e.name===t)))}getChildAt(t){if(t>-1&&te.children[t]));if(0===e.length){const{type:i}=this.schema.fields[t],n=fr({type:i,length:0,nullCount:0});e.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new Er(e)}return null}setChild(t,e){var i;return this.setChildAt(null===(i=this.schema.fields)||void 0===i?void 0:i.findIndex((e=>e.name===t)),e)}setChildAt(t,e){let i=this.schema,n=[...this.batches];if(t>-1&&tthis.getChildAt(e)));[r[t],o[t]]=[s,e],[i,n]=Wo(i,o)}return new Zo(i,n)}select(t){const e=this.schema.fields.reduce(((t,e,i)=>t.set(e.name,i)),new Map);return this.selectAt(t.map((t=>e.get(t))).filter((t=>t>-1)))}selectAt(t){const e=this.schema.selectAt(t),i=this.batches.map((e=>e.selectAt(t)));return new Zo(e,i)}assign(t){const e=this.schema.fields,[i,n]=t.schema.fields.reduce(((t,i,n)=>{const[r,s]=t,o=e.findIndex((t=>t.name===i.name));return~o?s[o]=n:r.push(n),t}),[[],[]]),r=this.schema.assign(t.schema),s=[...e.map(((t,e)=>[e,n[e]])).map((([e,i])=>void 0===i?this.getChildAt(e):t.getChildAt(i))),...i.map((e=>t.getChildAt(e)))].filter(Boolean);return new Zo(...Wo(r,s))}}function Xo(t){const e={},i=Object.entries(t);for(const[t,n]of i)e[t]=Rr(n);return new Zo(e)}function Ko(t){const e={},i=Object.entries(t);for(const[t,n]of i)e[t]=zo(n);return new Zo(e)}Ho=Symbol.toStringTag,Zo[Ho]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=Ir(wr),t.get=Ir(jn.getVisitFn(st.Struct)),t.set=Sr(cn.getVisitFn(st.Struct)),t.indexOf=Ar(Or.getVisitFn(st.Struct)),"Table"))(Zo.prototype);class Jo{constructor(...t){switch(t.length){case 2:if([this.schema]=t,!(this.schema instanceof Jr))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=fr({nullCount:0,type:new hi(this.schema.fields),children:this.schema.fields.map((t=>fr({type:t.type,nullCount:0})))})]=t,!(this.data instanceof dr))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=qo(this.schema,this.data.children);break;case 1:{const[e]=t,{fields:i,children:n,length:r}=Object.keys(e).reduce(((t,i,n)=>(t.children[n]=e[i],t.length=Math.max(t.length,e[i].length),t.fields[n]=qr.new({name:i,type:e[i].type,nullable:!0}),t)),{length:0,fields:new Array,children:new Array}),s=new Jr(i),o=fr({type:new hi(i),length:r,children:n,nullCount:0});[this.schema,this.data]=qo(s,o.children,r);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Qo(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return jn.visit(this.data,t)}at(t){return this.get(Jn(t,this.numRows))}set(t,e){return cn.visit(this.data,t,e)}indexOf(t,e){return Or.visit(this.data,t,e)}[Symbol.iterator](){return Fr.visit(new Er([this.data]))}toArray(){return[...this]}concat(...t){return new Zo(this.schema,[this,...t])}slice(t,e){const[i]=new Er([this.data]).slice(t,e).data;return new Jo(this.schema,i)}getChild(t){var e;return this.getChildAt(null===(e=this.schema.fields)||void 0===e?void 0:e.findIndex((e=>e.name===t)))}getChildAt(t){return t>-1&&te.name===t)),e)}setChildAt(t,e){let i=this.schema,n=this.data;if(t>-1&&tt.name===e));~t&&(n[t]=this.data.children[t])}return new Jo(e,fr({type:i,length:this.numRows,children:n}))}selectAt(t){const e=this.schema.selectAt(t),i=t.map((t=>this.data.children[t])).filter(Boolean),n=fr({type:new hi(e.fields),length:this.numRows,children:i});return new Jo(e,n)}}function qo(t,e,i=e.reduce(((t,e)=>Math.max(t,e.length)),0)){var n;const r=[...t.fields],s=[...e],o=(i+63&-64)>>3;for(const[a,l]of t.fields.entries()){const t=e[a];t&&t.length===i||(r[a]=l.clone({nullable:!0}),s[a]=null!==(n=null==t?void 0:t._changeLengthAndBackfillNullBitmap(i))&&void 0!==n?n:fr({type:l.type,length:i,nullCount:i,nullBitmap:new Uint8Array(o)}))}return[t.assign(r),fr({type:new hi(r),length:i,children:s})]}function Qo(t,e,i=new Map){var n,r;if((null!==(n=null==t?void 0:t.length)&&void 0!==n?n:0)>0&&(null==t?void 0:t.length)===(null==e?void 0:e.length))for(let n=-1,s=t.length;++n(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Jo.prototype);class ta extends Jo{constructor(t){const e=t.fields.map((t=>fr({type:t.type})));super(t,fr({type:new hi(t.fields),nullCount:0,children:e}))}}class ea{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new ea).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+o.SIZE_PREFIX_LENGTH),(e||new ea).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):rt.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Y.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,rt.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,i,n,r,s){return ea.startMessage(t),ea.addVersion(t,e),ea.addHeaderType(t,i),ea.addHeader(t,n),ea.addBodyLength(t,r),ea.addCustomMetadata(t,s),ea.endMessage(t)}}const ia=new class extends Ii{visit(t,e){return null==t||null==e?void 0:super.visit(t,e)}visitNull(t,e){return Ot.startNull(e),Ot.endNull(e)}visitInt(t,e){return dt.startInt(e),dt.addBitWidth(e,t.bitWidth),dt.addIsSigned(e,t.isSigned),dt.endInt(e)}visitFloat(t,e){return It.startFloatingPoint(e),It.addPrecision(e,t.precision),It.endFloatingPoint(e)}visitBinary(t,e){return ft.startBinary(e),ft.endBinary(e)}visitLargeBinary(t,e){return At.startLargeBinary(e),At.endLargeBinary(e)}visitBool(t,e){return bt.startBool(e),bt.endBool(e)}visitUtf8(t,e){return Nt.startUtf8(e),Nt.endUtf8(e)}visitLargeUtf8(t,e){return Bt.startLargeUtf8(e),Bt.endLargeUtf8(e)}visitDecimal(t,e){return vt.startDecimal(e),vt.addScale(e,t.scale),vt.addPrecision(e,t.precision),vt.addBitWidth(e,t.bitWidth),vt.endDecimal(e)}visitDate(t,e){return gt.startDate(e),gt.addUnit(e,t.unit),gt.endDate(e)}visitTime(t,e){return xt.startTime(e),xt.addUnit(e,t.unit),xt.addBitWidth(e,t.bitWidth),xt.endTime(e)}visitTimestamp(t,e){const i=t.timezone&&e.createString(t.timezone)||void 0;return Mt.startTimestamp(e),Mt.addUnit(e,t.unit),void 0!==i&&Mt.addTimezone(e,i),Mt.endTimestamp(e)}visitInterval(t,e){return St.startInterval(e),St.addUnit(e,t.unit),St.endInterval(e)}visitDuration(t,e){return _t.startDuration(e),_t.addUnit(e,t.unit),_t.endDuration(e)}visitList(t,e){return Dt.startList(e),Dt.endList(e)}visitStruct(t,e){return Lt.startStruct_(e),Lt.endStruct_(e)}visitUnion(t,e){Ft.startTypeIdsVector(e,t.typeIds.length);const i=Ft.createTypeIdsVector(e,t.typeIds);return Ft.startUnion(e),Ft.addMode(e,t.mode),Ft.addTypeIds(e,i),Ft.endUnion(e)}visitDictionary(t,e){const i=this.visit(t.indices,e);return pt.startDictionaryEncoding(e),pt.addId(e,BigInt(t.id)),pt.addIsOrdered(e,t.isOrdered),void 0!==i&&pt.addIndexType(e,i),pt.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return mt.startFixedSizeBinary(e),mt.addByteWidth(e,t.byteWidth),mt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return wt.startFixedSizeList(e),wt.addListSize(e,t.listSize),wt.endFixedSizeList(e)}visitMap(t,e){return Tt.startMap(e),Tt.addKeysSorted(e,t.keysSorted),Tt.endMap(e)}};function na(t){return new pa(t.count,sa(t.columns),oa(t.columns))}function ra(t,e){return(t.children||[]).filter(Boolean).map((t=>qr.fromJSON(t,e)))}function sa(t){return(t||[]).reduce(((t,e)=>{return[...t,new ba(e.count,(i=e.VALIDITY,(i||[]).reduce(((t,e)=>t+ +(0===e)),0))),...sa(e.children)];var i}),[])}function oa(t,e=[]){for(let i=-1,n=(t||[]).length;++i[t,e])))}function la(t){return new Ae(t.isSigned,t.bitWidth)}function ua(t,e){const i=t.type.name;switch(i){case"NONE":case"null":return new Se;case"binary":return new Ve;case"largebinary":return new Re;case"utf8":return new ze;case"largeutf8":return new Pe;case"bool":return new je;case"list":return new ci((e||[])[0]);case"struct":case"struct_":return new hi(e||[])}switch(i){case"int":{const e=t.type;return new Ae(e.isSigned,e.bitWidth)}case"floatingpoint":{const e=t.type;return new Ne(G[e.precision])}case"decimal":{const e=t.type;return new ke(e.scale,e.precision,e.bitWidth)}case"date":{const e=t.type;return new $e(Z[e.unit])}case"time":{const e=t.type;return new He(X[e.unit],e.bitWidth)}case"timestamp":{const e=t.type;return new Je(X[e.unit],e.timezone)}case"interval":{const e=t.type;return new ii(K[e.unit])}case"duration":{const e=t.type;return new si(X[e.unit])}case"union":{const i=t.type,[n,...r]=(i.mode+"").toLowerCase(),s=n.toUpperCase()+r.join("");return new di(H[s],i.typeIds||[],e||[])}case"fixedsizebinary":{const e=t.type;return new fi(e.byteWidth)}case"fixedsizelist":{const i=t.type;return new bi(i.listSize,(e||[])[0])}case"map":{const i=t.type;return new gi((e||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${i}"`)}var ca=o.Builder,ha=o.ByteBuffer;class da{static fromJSON(t,e){const i=new da(0,Y.V5,e);return i._createHeader=function(t,e){return()=>{switch(e){case rt.Schema:return Jr.fromJSON(t);case rt.RecordBatch:return pa.fromJSON(t);case rt.DictionaryBatch:return ya.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${rt[e]}, type: ${e} }`)}}(t,e),i}static decode(t){t=new ha(F(t));const e=ea.getRootAsMessage(t),i=e.bodyLength(),n=e.version(),r=e.headerType(),s=new da(i,n,r);return s._createHeader=function(t,e){return()=>{switch(e){case rt.Schema:return Jr.decode(t.header(new Ct),new Map,t.version());case rt.RecordBatch:return pa.decode(t.header(new ct),t.version());case rt.DictionaryBatch:return ya.decode(t.header(new ht),t.version())}throw new Error(`Unrecognized Message type: { name: ${rt[e]}, type: ${e} }`)}}(e,r),s}static encode(t){const e=new ca;let i=-1;return t.isSchema()?i=Jr.encode(e,t.header()):t.isRecordBatch()?i=pa.encode(e,t.header()):t.isDictionaryBatch()&&(i=ya.encode(e,t.header())),ea.startMessage(e),ea.addVersion(e,Y.V5),ea.addHeader(e,i),ea.addHeaderType(e,t.headerType),ea.addBodyLength(e,BigInt(t.bodyLength)),ea.finishMessageBuffer(e,ea.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof Jr)return new da(0,Y.V5,rt.Schema,t);if(t instanceof pa)return new da(e,Y.V5,rt.RecordBatch,t);if(t instanceof ya)return new da(e,Y.V5,rt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===rt.Schema}isRecordBatch(){return this.headerType===rt.RecordBatch}isDictionaryBatch(){return this.headerType===rt.DictionaryBatch}constructor(t,e,i,n){this._version=e,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=zt(t)}}class pa{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,i){this._nodes=e,this._buffers=i,this._length=zt(t)}}class ya{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=zt(e)}}class fa{constructor(t,e){this.offset=zt(t),this.length=zt(e)}}class ba{constructor(t,e){this.length=zt(t),this.nullCount=zt(e)}}function ga(t,e){const i=[];for(let n,r=-1,s=-1,o=t.childrenLength();++rqr.encode(t,e))),l=Ut.createChildrenVector(t,a),u=e.metadata&&e.metadata.size>0?Ut.createCustomMetadataVector(t,[...e.metadata].map((([e,i])=>{const n=t.createString(`${e}`),r=t.createString(`${i}`);return yt.startKeyValue(t),yt.addKey(t,n),yt.addValue(t,r),yt.endKeyValue(t)}))):-1;e.name&&(i=t.createString(e.name));Ut.startField(t),Ut.addType(t,n),Ut.addTypeType(t,o),Ut.addChildren(t,l),Ut.addNullable(t,!!e.nullable),-1!==i&&Ut.addName(t,i);-1!==r&&Ut.addDictionary(t,r);-1!==u&&Ut.addCustomMetadata(t,u);return Ut.endField(t)},qr.decode=function(t,e){let i,n,r,s,o,a;e&&(a=t.dictionary())?e.has(i=zt(a.id()))?(s=(s=a.indexType())?_a(s):new Te,o=new mi(e.get(i),s,i,a.isOrdered()),n=new qr(t.name(),o,t.nullable(),va(t))):(s=(s=a.indexType())?_a(s):new Te,e.set(i,r=ma(t,ga(t,e))),o=new mi(r,s,i,a.isOrdered()),n=new qr(t.name(),o,t.nullable(),va(t))):(r=ma(t,ga(t,e)),n=new qr(t.name(),r,t.nullable(),va(t)));return n||null},qr.fromJSON=function(t,e){let i,n,r,s,o,a;return e&&(s=t.dictionary)?e.has(i=s.id)?(n=(n=s.indexType)?la(n):new Te,a=new mi(e.get(i),n,i,s.isOrdered),r=new qr(t.name,a,t.nullable,aa(t.metadata))):(n=(n=s.indexType)?la(n):new Te,e.set(i,o=ua(t,ra(t,e))),a=new mi(o,n,i,s.isOrdered),r=new qr(t.name,a,t.nullable,aa(t.metadata))):(o=ua(t,ra(t,e)),r=new qr(t.name,o,t.nullable,aa(t.metadata))),r||null},Jr.encode=function(t,e){const i=e.fields.map((e=>qr.encode(t,e)));Ct.startFieldsVector(t,i.length);const n=Ct.createFieldsVector(t,i),r=e.metadata&&e.metadata.size>0?Ct.createCustomMetadataVector(t,[...e.metadata].map((([e,i])=>{const n=t.createString(`${e}`),r=t.createString(`${i}`);return yt.startKeyValue(t),yt.addKey(t,n),yt.addValue(t,r),yt.endKeyValue(t)}))):-1;Ct.startSchema(t),Ct.addFields(t,n),Ct.addEndianness(t,wa?Q.Little:Q.Big),-1!==r&&Ct.addCustomMetadata(t,r);return Ct.endSchema(t)},Jr.decode=function(t,e=new Map,i=Y.V5){const n=function(t,e){const i=[];for(let n,r=-1,s=-1,o=t.fieldsLength();++rqr.fromJSON(t,e)))}(t,e),aa(t.metadata),e)},pa.encode=function(t,e){const i=e.nodes||[],n=e.buffers||[];ct.startNodesVector(t,i.length);for(const e of i.slice().reverse())ba.encode(t,e);const r=t.endVector();ct.startBuffersVector(t,n.length);for(const e of n.slice().reverse())fa.encode(t,e);const s=t.endVector();return ct.startRecordBatch(t),ct.addLength(t,BigInt(e.length)),ct.addNodes(t,r),ct.addBuffers(t,s),ct.endRecordBatch(t)},pa.decode=function(t,e=Y.V5){if(null!==t.compression())throw new Error("Record batch compression not implemented");return new pa(t.length(),function(t){const e=[];for(let i,n=-1,r=-1,s=t.nodesLength();++n{const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]})(),Ia=t=>`Expected ${rt[t]} Message in stream, but was null or length 0.`,Sa=t=>`Header pointer of flatbuffer-encoded ${rt[t]} Message is null or length 0.`,Aa=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,Ba=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class Da{constructor(t){this.source=t instanceof hs?t:new hs(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?os:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Ia(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=F(this.source.read(t));if(e.byteLength[...e,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...t(i.children)]),[])}(this._body)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(Ia(t));return e.value}readSchema(){const t=rt.Schema,e=this.readMessage(t),i=null==e?void 0:e.header();if(!e||!i)throw new Error(Sa(t));return i}}const La=4,xa="ARROW1",Ma=new Uint8Array(6);for(let t=0;t<6;t+=1)Ma[t]=xa.codePointAt(t);function Fa(t,e=0){for(let i=-1,n=Ma.length;++ithis)):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return j.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return j.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Ea?e:v(e)?function(t){return new Va(new Ha(t))}(e):m(e)?function(t){return r(this,void 0,void 0,(function*(){const{size:e}=yield t.stat(),i=new bs(t,e);return e>=Ca&&Fa(yield i.readAt(0,Na+7&-8))?new Pa(new Ya(i)):new Ra(new $a(i))}))}(e):f(e)?(()=>r(this,void 0,void 0,(function*(){return yield Ea.from(yield e)})))():w(e)||S(e)||A(e)||g(e)?function(e){return r(this,void 0,void 0,(function*(){const i=yield e.peek(Na+7&-8);return i&&i.byteLength>=4?Fa(i)?new za(new Wa(yield e.read())):new Ra(new $a(e)):new Ra(new $a(function(){return t(this,arguments,(function*(){}))}()))}))}(new ds(e)):function(t){const e=t.peek(Na+7&-8);return e&&e.byteLength>=4?Fa(e)?new za(new Wa(t.read())):new Va(new ka(t)):new Va(new ka(function*(){}()))}(new hs(e))}static readAll(t){return t instanceof Ea?t.isSync()?Za(t):Xa(t):v(t)||ArrayBuffer.isView(t)||b(t)||_(t)?Za(t):Xa(t)}}class Va extends Ea{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return t(this,arguments,(function*(){yield e(yield*i(n(this[Symbol.iterator]())))}))}}class Ra extends Ea{constructor(t){super(t),this._impl=t}readAll(){return r(this,void 0,void 0,(function*(){var t,e,i,r;const s=new Array;try{for(var o,a=!0,l=n(this);!(t=(o=yield l.next()).done);a=!0){r=o.value,a=!1;const t=r;s.push(t)}}catch(t){e={error:t}}finally{try{a||t||!(i=l.return)||(yield i.call(l))}finally{if(e)throw e.error}}return s}))}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class za extends Va{constructor(t){super(t),this._impl=t}}class Pa extends Ra{constructor(t){super(t),this._impl=t}}class ja{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const i=this._loadVectors(t,e,this.schema.fields),n=fr({type:new hi(this.schema.fields),length:t.length,children:i});return new Jo(this.schema,n)}_loadDictionaryBatch(t,e){const{id:i,isDelta:n}=t,{dictionaries:r,schema:s}=this,o=r.get(i);if(n||!o){const r=s.dictionaries.get(i),a=this._loadVectors(t.data,e,[r]);return(o&&n?o.concat(new Er(a)):new Er(a)).memoize()}return o.memoize()}_loadVectors(t,e,i){return new As(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}}class ka extends ja{constructor(t,e){super(e),this._reader=v(t)?new Oa(this._handle=t):new Da(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Ga(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):os}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):os}next(){if(this.closed)return os;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),n=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),n=e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,r)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new ta(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class $a extends ja{constructor(t,e){super(e),this._reader=new Ta(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return r(this,void 0,void 0,(function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}))}open(t){return r(this,void 0,void 0,(function*(){return this.closed||(this.autoDestroy=Ga(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this}))}throw(t){return r(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):os}))}return(t){return r(this,void 0,void 0,(function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):os}))}next(){return r(this,void 0,void 0,(function*(){if(this.closed)return os;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),n=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),n=yield e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,r)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new ta(this.schema)}):yield this.return()}))}_readNextMessageAndValidate(t){return r(this,void 0,void 0,(function*(){return yield this._reader.readMessage(t)}))}}class Wa extends ka{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof fs?t:new fs(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const i=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){const t=this._reader.readMessage(rt.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),i=this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,i)}}return null}_readDictionaryBatch(t){var e;const i=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){const t=this._reader.readMessage(rt.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),i=this._reader.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(e,i);this.dictionaries.set(e.id,n)}}}_readFooter(){const{_handle:t}=this,e=t.size-Ua,i=t.readInt32(e),n=t.readAt(e-i,i);return ns.decode(n)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return r(this,void 0,void 0,(function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)}))}readRecordBatch(t){return r(this,void 0,void 0,(function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const i=null===(e=this._footer)||void 0===e?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){const t=yield this._reader.readMessage(rt.RecordBatch);if(null==t?void 0:t.isRecordBatch()){const e=t.header(),i=yield this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,i)}}return null}))}_readDictionaryBatch(t){return r(this,void 0,void 0,(function*(){var e;const i=null===(e=this._footer)||void 0===e?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){const t=yield this._reader.readMessage(rt.DictionaryBatch);if(null==t?void 0:t.isDictionaryBatch()){const e=t.header(),i=yield this._reader.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(e,i);this.dictionaries.set(e.id,n)}}}))}_readFooter(){return r(this,void 0,void 0,(function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Ua,i=yield t.readInt32(e),n=yield t.readAt(e-i,i);return ns.decode(n)}))}_readNextMessageAndValidate(t){return r(this,void 0,void 0,(function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndext.flatMap((t=>Array.isArray(t)?e(t):t instanceof Jo?t.data.children:t.data)),i=new Ka;return i.visitMany(e(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Er)return this.visitMany(t.data),this;const{type:e}=t;if(!Ie.isDictionary(e)){const{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Ie.isUnion(e))this.nodes.push(new ba(i,0));else{const{nullCount:n}=t;Ie.isNull(e)||Ja.call(this,n<=0?new Uint8Array(0):sr(t.offset,i,t.nullBitmap)),this.nodes.push(new ba(i,n))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function Ja(t){const e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new fa(this._byteLength,e)),this._byteLength+=e,this}function qa(t){return Ja.call(this,t.values.subarray(0,t.length*t.stride))}function Qa(t){const{length:e,values:i,valueOffsets:n}=t,r=zt(n[0]),s=zt(n[e]),o=Math.min(s-r,i.byteLength-r);return Ja.call(this,R(-r,e+1,n)),Ja.call(this,i.subarray(r,r+o)),this}function tl(t){const{length:e,valueOffsets:i}=t;if(i){const{0:n,[e]:r}=i;return Ja.call(this,R(-n,e+1,i)),this.visit(t.children[0].slice(n,r-n))}return this.visit(t.children[0])}function el(t){return this.visitMany(t.type.children.map(((e,i)=>t.children[i])).filter(Boolean))[0]}Ka.prototype.visitBool=function(t){let e;return t.nullCount>=t.length?Ja.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?Ja.call(this,sr(t.offset,t.length,e)):Ja.call(this,or(t.values))},Ka.prototype.visitInt=qa,Ka.prototype.visitFloat=qa,Ka.prototype.visitUtf8=Qa,Ka.prototype.visitLargeUtf8=Qa,Ka.prototype.visitBinary=Qa,Ka.prototype.visitLargeBinary=Qa,Ka.prototype.visitFixedSizeBinary=qa,Ka.prototype.visitDate=qa,Ka.prototype.visitTimestamp=qa,Ka.prototype.visitTime=qa,Ka.prototype.visitDecimal=qa,Ka.prototype.visitList=tl,Ka.prototype.visitStruct=el,Ka.prototype.visitUnion=function(t){var e;const{type:i,length:n,typeIds:r,valueOffsets:s}=t;if(Ja.call(this,r),i.mode===H.Sparse)return el.call(this,t);if(i.mode===H.Dense){if(t.offset<=0)return Ja.call(this,s),el.call(this,t);{const o=new Int32Array(n),a=Object.create(null),l=Object.create(null);for(let t,i,u=-1;++u{const r=i.typeIds[e],s=a[r],o=l[r];return t.slice(s,Math.min(n,o))})))}}return this},Ka.prototype.visitInterval=qa,Ka.prototype.visitDuration=qa,Ka.prototype.visitFixedSizeList=tl,Ka.prototype.visitMap=tl;class il extends Ii{visit(t){return null==t?void 0:super.visit(t)}visitNull({typeId:t}){return{name:et[t].toLowerCase()}}visitInt({typeId:t,bitWidth:e,isSigned:i}){return{name:et[t].toLowerCase(),bitWidth:e,isSigned:i}}visitFloat({typeId:t,precision:e}){return{name:et[t].toLowerCase(),precision:G[e]}}visitBinary({typeId:t}){return{name:et[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:et[t].toLowerCase()}}visitBool({typeId:t}){return{name:et[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:et[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:et[t].toLowerCase()}}visitDecimal({typeId:t,scale:e,precision:i,bitWidth:n}){return{name:et[t].toLowerCase(),scale:e,precision:i,bitWidth:n}}visitDate({typeId:t,unit:e}){return{name:et[t].toLowerCase(),unit:Z[e]}}visitTime({typeId:t,unit:e,bitWidth:i}){return{name:et[t].toLowerCase(),unit:X[e],bitWidth:i}}visitTimestamp({typeId:t,timezone:e,unit:i}){return{name:et[t].toLowerCase(),unit:X[i],timezone:e}}visitInterval({typeId:t,unit:e}){return{name:et[t].toLowerCase(),unit:K[e]}}visitDuration({typeId:t,unit:e}){return{name:et[t].toLocaleLowerCase(),unit:X[e]}}visitList({typeId:t}){return{name:et[t].toLowerCase()}}visitStruct({typeId:t}){return{name:et[t].toLowerCase()}}visitUnion({typeId:t,mode:e,typeIds:i}){return{name:et[t].toLowerCase(),mode:H[e].toUpperCase(),typeIds:[...i]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:e}){return{name:et[t].toLowerCase(),byteWidth:e}}visitFixedSizeList({typeId:t,listSize:e}){return{name:et[t].toLowerCase(),listSize:e}}visitMap({typeId:t,keysSorted:e}){return{name:et[t].toLowerCase(),keysSorted:e}}}class nl extends Ii{static assemble(...t){const e=new nl;return t.map((({schema:t,data:i})=>e.visitMany(t.fields,i.children)))}visit({name:t},e){const{length:i}=e,{offset:n,nullCount:r,nullBitmap:s}=e,o=Ie.isDictionary(e.type)?e.type.indices:e.type,a=Object.assign([],e.buffers,{[ot.VALIDITY]:void 0});return Object.assign({name:t,count:i,VALIDITY:Ie.isNull(o)||Ie.isUnion(o)?void 0:r<=0?Array.from({length:i},(()=>1)):[...new ar(s,n,i,null,rr)]},super.visit(e.clone(o,n,i,0,a)))}visitNull(){return{}}visitBool({values:t,offset:e,length:i}){return{DATA:[...new ar(t,e,i,null,nr)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...sl(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new Er([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new Er([t])],OFFSET:[...sl(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...rl(new Er([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...rl(new Er([t]))],OFFSET:[...sl(t.valueOffsets,2)]}}visitFixedSizeBinary(t){return{DATA:[...rl(new Er([t]))]}}visitDate(t){return{DATA:t.type.unit===Z.DAY?[...t.values]:[...sl(t.values,2)]}}visitTimestamp(t){return{DATA:[...sl(t.values,2)]}}visitTime(t){return{DATA:t.type.unit`${t}${("0"+(255&e).toString(16)).slice(-2)}`),"").toUpperCase()}function*sl(t,e){const i=new Uint32Array(t.buffer);for(let t=-1,n=i.length/e;++tthis.writeAll(t))):g(t)?hl(this,t):cl(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){var i;return t===this._sink||t instanceof cs?this._sink=t:(this._sink=new cs,t&&(y(i=t)&&p(i.abort)&&p(i.getWriter)&&!I(i))?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&(t=>y(t)&&p(t.end)&&p(t.write)&&d(t.writable)&&!I(t))(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,e&&Eo(e,this._schema)||(null==e?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(!this._sink)throw new Error("RecordBatchWriter is closed");if(null==t)return this.finish()&&void 0;if(t instanceof Zo&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Jo&&!(e=t.schema))return this.finish()&&void 0;if(e&&!Eo(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Jo?t instanceof ta||this._writeRecordBatch(t):t instanceof Zo?this.writeAll(t.batches):b(t)&&this.writeAll(t)}_writeMessage(t,e=8){const i=e-1,n=da.encode(t),r=n.byteLength,s=this._writeLegacyIpcFormat?4:8,o=r+s+i&~i,a=o-r-s;return t.headerType===rt.RecordBatch?this._recordBatchBlocks.push(new ss(o,t.bodyLength,this._position)):t.headerType===rt.DictionaryBatch&&this._dictionaryBlocks.push(new ss(o,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-s)),r>0&&this._write(n),this._writePadding(a)}_write(t){if(this._started){const e=F(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(da.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Ma)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:i,bufferRegions:n,buffers:r}=Ka.assemble(t),s=new pa(t.numRows,i,n),o=da.from(s,e);return this._writeDictionaries(t)._writeMessage(o)._writeBodyBuffers(r)}_writeDictionaryBatch(t,e,i=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));const{byteLength:n,nodes:r,bufferRegions:s,buffers:o}=Ka.assemble(new Er([t])),a=new pa(t.length,r,s),l=new ya(a,e,i),u=da.from(l,n);return this._writeMessage(u)._writeBodyBuffers(o)}_writeBodyBuffers(t){let e,i,n;for(let r=-1,s=t.length;++r0&&(this._write(e),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(t){for(let[e,i]of t.dictionaries){let t=this._dictionaryDeltaOffsets.get(e)||0;if(0===t||(i=null==i?void 0:i.slice(t)).length>0)for(const n of i.data)this._writeDictionaryBatch(n,e,t>0),t+=n.length}return this}}class al extends ol{static writeAll(t,e){const i=new al(e);return f(t)?t.then((t=>i.writeAll(t))):g(t)?hl(i,t):cl(i,t)}}class ll extends ol{static writeAll(t){const e=new ll;return f(t)?t.then((t=>e.writeAll(t))):g(t)?hl(e,t):cl(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=ns.encode(new ns(t,Y.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}class ul extends ol{static writeAll(t){return(new ul).writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._dictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{\n "schema": ${JSON.stringify({fields:t.fields.map((t=>dl(t)))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._dictionaries.push(t),this}_writeDictionaryBatch(t,e,i=!1){return this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0)),this._write(0===this._dictionaryBlocks.length?" ":",\n "),this._write(function(t,e,i=!1){const[n]=nl.assemble(new Jo({[e]:t}));return JSON.stringify({id:e,isDelta:i,data:{count:t.length,columns:n}},null,2)}(t,e,i)),this._dictionaryBlocks.push(new ss(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._dictionaries.length>0){this._write(',\n "dictionaries": [\n');for(const t of this._dictionaries)super._writeDictionaries(t);this._write("\n ]")}if(this._recordBatches.length>0){for(let t=-1,e=this._recordBatches.length;++tdl(t))),dictionary:Ie.isDictionary(e)?{id:e.id,isOrdered:e.isOrdered,indexType:n.visit(e.indices)}:void 0}}function pl(t){const[e]=nl.assemble(t);return JSON.stringify({count:t.numRows,columns:e},null,2)}class yl{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const{readableStrategy:e,writableStrategy:i,queueingStrategy:n="count"}=t,r=s(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ro(r),this._getSize="bytes"!==n?fl:bl;const{highWaterMark:o=("bytes"===n?Math.pow(2,14):1e3)}=Object.assign({},e),{highWaterMark:a=("bytes"===n?Math.pow(2,14):1e3)}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:t=>{this._maybeFlush(this._builder,this._controller=t)},start:t=>{this._maybeFlush(this._builder,this._controller=t)}},{highWaterMark:o,size:"bytes"!==n?fl:bl}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:t=>this._writeValueAndReturnChunkSize(t)})}_writeValueAndReturnChunkSize(t){const e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){null!=e&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||0===this._numChunks)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,null==e?t.close():t.enqueue(e)}}const fl=t=>{var e;return null!==(e=null==t?void 0:t.length)&&void 0!==e?e:0},bl=t=>{var e;return null!==(e=null==t?void 0:t.byteLength)&&void 0!==e?e:0};function gl(t,e){const i=new cs;let n=null;const s=new ReadableStream({cancel(){return r(this,void 0,void 0,(function*(){yield i.close()}))},start(t){return r(this,void 0,void 0,(function*(){yield o(t,n||(n=yield function(){return r(this,void 0,void 0,(function*(){return yield(yield Ea.from(i)).open(e)}))}()))}))},pull(t){return r(this,void 0,void 0,(function*(){n?yield o(t,n):t.close()}))}});return{writable:new WritableStream(i,Object.assign({highWaterMark:Math.pow(2,14)},t)),readable:s};function o(t,e){return r(this,void 0,void 0,(function*(){let i=t.desiredSize,n=null;for(;!(n=yield e.next()).done;)if(t.enqueue(n.value),null!=i&&--i<=0)return;t.close()}))}}function vl(t,e){const i=new this(t),n=new ds(i),s=new ReadableStream({cancel(){return r(this,void 0,void 0,(function*(){yield n.cancel()}))},pull(t){return r(this,void 0,void 0,(function*(){yield o(t)}))},start(t){return r(this,void 0,void 0,(function*(){yield o(t)}))}},Object.assign({highWaterMark:Math.pow(2,14)},e));return{writable:new WritableStream(i,t),readable:s};function o(t){return r(this,void 0,void 0,(function*(){let e=null,i=t.desiredSize;for(;e=yield n.read(i||null);)if(t.enqueue(e),null!=i&&(i-=e.byteLength)<=0)return;t.close()}))}}function _l(t){const e=Ea.from(t);return f(e)?e.then((t=>_l(t))):e.isAsync()?e.readAll().then((t=>new Zo(t))):new Zo(e.readAll())}function ml(t,e="stream"){return("stream"===e?al:ll).writeAll(t).toUint8Array(!0)}const wl=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},we),Ss),hr),Li),P),ir),Rt),{compareSchemas:Eo,compareFields:function(t,e){return Co.compareFields(t,e)},compareTypes:Vo});j.toDOMStream=function(t,e){if(g(t))return function(t,e){let i=null;const n="bytes"===(null==e?void 0:e.type)||!1,s=(null==e?void 0:e.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(e){return r(this,void 0,void 0,(function*(){yield o(e,i||(i=t[Symbol.asyncIterator]()))}))},pull(t){return r(this,void 0,void 0,(function*(){i?yield o(t,i):t.close()}))},cancel(){return r(this,void 0,void 0,(function*(){(null==i?void 0:i.return)&&(yield i.return()),i=null}))}}),Object.assign({highWaterMark:n?s:void 0},e));function o(t,e){return r(this,void 0,void 0,(function*(){let i,r=null,s=t.desiredSize||null;for(;!(r=yield e.next(n?s:null)).done;)if(ArrayBuffer.isView(r.value)&&(i=F(r.value))&&(null!=s&&n&&(s=s-i.byteLength+1),r.value=i),t.enqueue(r.value),null!=s&&--s<=0)return;t.close()}))}}(t,e);if(b(t))return function(t,e){let i=null;const n="bytes"===(null==e?void 0:e.type)||!1,r=(null==e?void 0:e.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},e),{start(e){s(e,i||(i=t[Symbol.iterator]()))},pull(t){i?s(t,i):t.close()},cancel(){(null==i?void 0:i.return)&&i.return(),i=null}}),Object.assign({highWaterMark:n?r:void 0},e));function s(t,e){let i,r=null,s=t.desiredSize||null;for(;!(r=e.next(n?s:null)).done;)if(ArrayBuffer.isView(r.value)&&(i=F(r.value))&&(null!=s&&n&&(s=s-i.byteLength+1),r.value=i),t.enqueue(r.value),null!=s&&--s<=0)return;t.close()}}(t,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")},Hr.throughDOM=function(t){return new yl(t)},Ea.throughDOM=gl,za.throughDOM=gl,Va.throughDOM=gl,ol.throughDOM=vl,ll.throughDOM=vl,al.throughDOM=vl;export{cs as AsyncByteQueue,ds as AsyncByteStream,Ta as AsyncMessageReader,Pa as AsyncRecordBatchFileReader,Ra as AsyncRecordBatchStreamReader,Ve as Binary,Ds as BinaryBuilder,je as Bool,Os as BoolBuilder,ot as BufferType,Hr as Builder,hs as ByteStream,dr as Data,Ie as DataType,Ls as DateBuilder,We as DateDay,xs as DateDayBuilder,Ye as DateMillisecond,Ms as DateMillisecondBuilder,Z as DateUnit,$e as Date_,ke as Decimal,Fs as DecimalBuilder,pi as DenseUnion,mo as DenseUnionBuilder,mi as Dictionary,Ns as DictionaryBuilder,si as Duration,$s as DurationBuilder,li as DurationMicrosecond,Hs as DurationMicrosecondBuilder,ai as DurationMillisecond,Ys as DurationMillisecondBuilder,ui as DurationNanosecond,Gs as DurationNanosecondBuilder,oi as DurationSecond,Ws as DurationSecondBuilder,qr as Field,fi as FixedSizeBinary,Us as FixedSizeBinaryBuilder,bi as FixedSizeList,Cs as FixedSizeListBuilder,Ne as Float,Ue as Float16,Vs as Float16Builder,Ce as Float32,Rs as Float32Builder,Ee as Float64,zs as Float64Builder,Es as FloatBuilder,Ae as Int,De as Int16,Ks as Int16Builder,Te as Int32,Js as Int32Builder,Oe as Int64,qs as Int64Builder,Be as Int8,Xs as Int8Builder,Zs as IntBuilder,ii as Interval,Ps as IntervalBuilder,ni as IntervalDayTime,js as IntervalDayTimeBuilder,K as IntervalUnit,ri as IntervalYearMonth,ks as IntervalYearMonthBuilder,Oa as JSONMessageReader,Re as LargeBinary,Ts as LargeBinaryBuilder,Pe as LargeUtf8,Io as LargeUtf8Builder,ci as List,no as ListBuilder,ro as MapBuilder,Hn as MapRow,gi as Map_,da as Message,rt as MessageHeader,Da as MessageReader,Y as MetadataVersion,Se as Null,so as NullBuilder,G as Precision,Jo as RecordBatch,za as RecordBatchFileReader,ll as RecordBatchFileWriter,ul as RecordBatchJSONWriter,Ea as RecordBatchReader,Va as RecordBatchStreamReader,al as RecordBatchStreamWriter,ol as RecordBatchWriter,Jr as Schema,yi as SparseUnion,_o as SparseUnionBuilder,hi as Struct,oo as StructBuilder,pn as StructRow,Zo as Table,He as Time,po as TimeBuilder,Xe as TimeMicrosecond,bo as TimeMicrosecondBuilder,Ze as TimeMillisecond,fo as TimeMillisecondBuilder,Ke as TimeNanosecond,go as TimeNanosecondBuilder,Ge as TimeSecond,yo as TimeSecondBuilder,X as TimeUnit,Je as Timestamp,ao as TimestampBuilder,ti as TimestampMicrosecond,co as TimestampMicrosecondBuilder,Qe as TimestampMillisecond,uo as TimestampMillisecondBuilder,ei as TimestampNanosecond,ho as TimestampNanosecondBuilder,qe as TimestampSecond,lo as TimestampSecondBuilder,st as Type,xe as Uint16,to as Uint16Builder,Me as Uint32,eo as Uint32Builder,Fe as Uint64,io as Uint64Builder,Le as Uint8,Qs as Uint8Builder,di as Union,vo as UnionBuilder,H as UnionMode,ze as Utf8,wo as Utf8Builder,Er as Vector,Ii as Visitor,$o as builderThroughAsyncIterable,ko as builderThroughIterable,Ro as makeBuilder,fr as makeData,Xo as makeTable,Rr as makeVector,Ko as tableFromArrays,_l as tableFromIPC,Po as tableFromJSON,ml as tableToIPC,wl as util,zo as vectorFromArray};export default null; diff --git a/isamples_export_client/ui/_npm/tslib@2.6.2/_esm.js b/isamples_export_client/ui/_npm/tslib@2.6.3/_esm.js similarity index 51% rename from isamples_export_client/ui/_npm/tslib@2.6.2/_esm.js rename to isamples_export_client/ui/_npm/tslib@2.6.3/_esm.js index 3a67142..f091874 100644 --- a/isamples_export_client/ui/_npm/tslib@2.6.2/_esm.js +++ b/isamples_export_client/ui/_npm/tslib@2.6.3/_esm.js @@ -1,7 +1,7 @@ /** * Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2. - * Original file: /npm/tslib@2.6.2/tslib.es6.mjs + * Original file: /npm/tslib@2.6.3/tslib.es6.mjs * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ -var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,f="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,s=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var d={};for(var h in n)d[h]="access"===h?{}:n[h];for(var h in n.access)d.access[h]=n.access[h];d.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var b=(0,r[y])("accessor"===u?{get:s.get,set:s.set}:s[f],d);if("accessor"===u){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(c=i(b.get))&&(s.get=c),(c=i(b.set))&&(s.set=c),(c=i(b.init))&&o.unshift(c)}else(c=i(b))&&("field"===u?o.unshift(c):s[f]=c)}l&&Object.defineProperty(l,n.name,s),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function v(){for(var e=[],t=0;t1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,f):l(a[0][2],r)}catch(e){l(a[0][3],e)}var r}function u(e){c("next",e)}function f(e){c("throw",e)}function l(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=h(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&y(t,e,r);return S(t,e),t}function x(e){return e&&e.__esModule?e:{default:e}}function T(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function k(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function I(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var R="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function A(e){function t(t){e.error=e.hasError?new R(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var C={__extends:t,__assign:r,__rest:n,__decorate:o,__param:a,__metadata:l,__awaiter:s,__generator:p,__createBinding:y,__exportStar:d,__values:h,__read:b,__spread:v,__spreadArrays:w,__spreadArray:_,__await:m,__asyncGenerator:g,__asyncDelegator:O,__asyncValues:j,__makeTemplateObject:P,__importStar:E,__importDefault:x,__classPrivateFieldGet:T,__classPrivateFieldSet:k,__classPrivateFieldIn:I,__addDisposableResource:D,__disposeResources:A};export{D as __addDisposableResource,r as __assign,O as __asyncDelegator,g as __asyncGenerator,j as __asyncValues,m as __await,s as __awaiter,T as __classPrivateFieldGet,I as __classPrivateFieldIn,k as __classPrivateFieldSet,y as __createBinding,o as __decorate,A as __disposeResources,i as __esDecorate,d as __exportStar,t as __extends,p as __generator,x as __importDefault,E as __importStar,P as __makeTemplateObject,l as __metadata,a as __param,u as __propKey,b as __read,n as __rest,c as __runInitializers,f as __setFunctionName,v as __spread,_ as __spreadArray,w as __spreadArrays,h as __values,C as default}; +var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,f="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,s=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var d={};for(var h in n)d[h]="access"===h?{}:n[h];for(var h in n.access)d.access[h]=n.access[h];d.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var v=(0,r[y])("accessor"===u?{get:s.get,set:s.set}:s[f],d);if("accessor"===u){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(c=i(v.get))&&(s.get=c),(c=i(v.set))&&(s.set=c),(c=i(v.init))&&o.unshift(c)}else(c=i(v))&&("field"===u?o.unshift(c):s[f]=c)}l&&Object.defineProperty(l,n.name,s),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)}))},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,f):l(a[0][2],r)}catch(e){l(a[0][3],e)}var r}function u(e){c("next",e)}function f(e){c("throw",e)}function l(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=h(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&y(t,e,r);return S(t,e),t}function x(e){return e&&e.__esModule?e:{default:e}}function T(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function k(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function I(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose],r&&(o=n)}if("function"!=typeof n)throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var R="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function A(e){function t(t){e.error=e.hasError?new R(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var C={__extends:t,__assign:r,__rest:n,__decorate:o,__param:a,__metadata:l,__awaiter:s,__generator:p,__createBinding:y,__exportStar:d,__values:h,__read:v,__spread:b,__spreadArrays:w,__spreadArray:_,__await:m,__asyncGenerator:g,__asyncDelegator:O,__asyncValues:j,__makeTemplateObject:P,__importStar:E,__importDefault:x,__classPrivateFieldGet:T,__classPrivateFieldSet:k,__classPrivateFieldIn:I,__addDisposableResource:D,__disposeResources:A};export{D as __addDisposableResource,r as __assign,O as __asyncDelegator,g as __asyncGenerator,j as __asyncValues,m as __await,s as __awaiter,T as __classPrivateFieldGet,I as __classPrivateFieldIn,k as __classPrivateFieldSet,y as __createBinding,o as __decorate,A as __disposeResources,i as __esDecorate,d as __exportStar,t as __extends,p as __generator,x as __importDefault,E as __importStar,P as __makeTemplateObject,l as __metadata,a as __param,u as __propKey,v as __read,n as __rest,c as __runInitializers,f as __setFunctionName,b as __spread,_ as __spreadArray,w as __spreadArrays,h as __values,C as default}; diff --git a/isamples_export_client/ui/_observablehq/client.js b/isamples_export_client/ui/_observablehq/client.js index 029a498..58ba101 100644 --- a/isamples_export_client/ui/_observablehq/client.js +++ b/isamples_export_client/ui/_observablehq/client.js @@ -1 +1 @@ -var Z=Object.defineProperty;var o=(e,t)=>Z(e,"name",{value:t,configurable:!0});import{Inspector as _,Runtime as J}from"./runtime.js";import{Generators as g,resize as W,FileAttachment as X,Mutable as Y}from"./stdlib.js";var ee=Object.defineProperty,j=o((e,t)=>ee(e,"name",{value:t,configurable:!0}),"o$3");const E=document.createElement("template");E.innerHTML='',A();function A(){for(const e of document.querySelectorAll("pre:not([data-copy=none])")){const t=e.parentNode;if(t.classList.contains("observablehq-pre-container"))continue;const a=t.insertBefore(document.createElement("div"),e);a.className="observablehq-pre-container",Object.assign(a.dataset,e.dataset),a.appendChild(E.content.cloneNode(!0).firstChild).addEventListener("click",D),a.appendChild(e)}}o(A,"r$2"),j(A,"enableCopyButtons");async function D({currentTarget:e}){await navigator.clipboard.writeText(e.nextElementSibling.textContent.trim());const[t]=e.getAnimations({subtree:!0});t&&(t.currentTime=0),e.classList.add("observablehq-pre-copied"),e.addEventListener("animationend",()=>e.classList.remove("observablehq-pre-copied"),{once:!0})}o(D,"c$2"),j(D,"copy");var te=Object.defineProperty,B=o((e,t)=>te(e,"name",{value:t,configurable:!0}),"s$4");const u=document.querySelector("#observablehq-sidebar-toggle");if(u){let e=u.indeterminate;u.onclick=()=>{const a=matchMedia("(min-width: calc(640px + 6rem + 272px))").matches;e?(u.checked=!a,e=!1):u.checked===a&&(e=!0),u.indeterminate=e,e?sessionStorage.removeItem("observablehq-sidebar"):sessionStorage.setItem("observablehq-sidebar",u.checked)},addEventListener("keypress",a=>{a.code==="KeyB"&&(a.metaKey||a.altKey)&&!a.ctrlKey&&(a.target===document.body||a.target===u||a.target?.closest("#observablehq-sidebar"))&&(u.click(),a.preventDefault())});const t=`Toggle sidebar ${/Mac|iPhone/.test(navigator.platform)?/Firefox/.test(navigator.userAgent)?"\u2325":"\u2318":"Alt-"}B`;for(const a of document.querySelectorAll("#observablehq-sidebar-toggle, label[for='observablehq-sidebar-toggle']"))a.title=t}function O(e){e.detail>1&&e.preventDefault()}o(O,"l$3"),B(O,"preventDoubleClick");function P(){sessionStorage.setItem(`observablehq-sidebar:${this.firstElementChild.textContent}`,this.open)}o(P,"i$3"),B(P,"persistOpen");for(const e of document.querySelectorAll("#observablehq-sidebar summary"))e.onmousedown=O,e.parentElement.ontoggle=P;var ae=Object.defineProperty,I=o((e,t)=>ae(e,"name",{value:t,configurable:!0}),"l$2");const q=document.querySelector("#observablehq-toc");if(q){const e=q.appendChild(document.createElement("div"));e.classList.add("observablehq-secondary-link-highlight");const t=document.querySelector("#observablehq-main"),a=Array.from(t.querySelectorAll(q.dataset.selector)).reverse(),s=q.querySelectorAll(".observablehq-secondary-link"),y=I(()=>{for(const c of s)c.classList.remove("observablehq-secondary-link-active");if(location.hash)for(const c of a){const h=encodeURI(`#${c.id}`);if(h===location.hash){const p=c.getBoundingClientRect().top;if(0=innerHeight*.5)continue;const h=c.querySelector("a[href]")?.hash;for(const p of s)if(p.querySelector("a[href]")?.hash===h)return p.classList.add("observablehq-secondary-link-active"),p;break}},"relink"),C=I(()=>{const c=y();e.style.cssText=c?`top: ${c.offsetTop}px; height: ${c.offsetHeight}px;`:""},"intersected"),m=new IntersectionObserver(C,{rootMargin:"0px 0px -50% 0px"});for(const c of a)m.observe(c)}var oe=Object.defineProperty,M=o((e,t)=>oe(e,"name",{value:t,configurable:!0}),"n$1");function z(e){const t=new _(document.createElement("div"));return t.fulfilled(e),t._node.firstChild}o(z,"i$2"),M(z,"inspect");function T(e){const t=new _(document.createElement("div"));t.rejected(e);const a=t._node.firstChild;return a.classList.add("observablehq--error"),a}o(T,"s$2"),M(T,"inspectError");var re=Object.defineProperty,r=o((e,t)=>re(e,"name",{value:t,configurable:!0}),"o$1");const ce=r(()=>import("../_npm/lodash@4.17.21/_esm.js").then(e=>e.default),"_"),ne=r(()=>import("../_npm/arquero@5.4.0/_esm.js"),"aq"),se=r(()=>import("../_npm/apache-arrow@16.1.0/_esm.js"),"Arrow"),ie=r(()=>import("../_npm/d3@7.9.0/_esm.js"),"d3"),le=r(()=>import("./stdlib/dot.js").then(e=>e.default),"dot"),de=r(()=>import("../_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/_esm.js"),"duckdb"),fe=r(()=>import("./stdlib/duckdb.js").then(e=>e.DuckDBClient),"DuckDBClient"),be=r(()=>import("../_npm/echarts@5.5.0/dist/echarts.esm.min.js._esm.js"),"echarts"),ue=r(()=>import("../_npm/htl@0.3.1/_esm.js"),"htl"),pe=r(()=>import("../_npm/htl@0.3.1/_esm.js").then(e=>e.html),"html"),he=r(()=>import("../_npm/htl@0.3.1/_esm.js").then(e=>e.svg),"svg"),me=r(()=>import("./stdlib/inputs.js"),"Inputs"),ve=r(()=>import("../_npm/leaflet@1.9.4/_esm.js"),"L"),ge=r(()=>import("../_npm/mapbox-gl@3.3.0/_esm.js").then(e=>e.default),"mapboxgl"),ye=r(()=>import("./stdlib/mermaid.js").then(e=>e.default),"mermaid"),$e=r(()=>import("../_npm/@observablehq/plot@0.6.14/_esm.js"),"Plot"),qe=r(()=>import("./stdlib/duckdb.js").then(e=>e.sql),"sql"),we=r(()=>import("./stdlib/sqlite.js").then(e=>e.default),"SQLite"),ke=r(()=>import("./stdlib/sqlite.js").then(e=>e.SQLiteDatabaseClient),"SQLiteDatabaseClient"),Ce=r(()=>import("./stdlib/tex.js").then(e=>e.default),"tex"),Se=r(()=>import("../_npm/topojson-client@3.1.0/_esm.js"),"topojson"),Le=r(()=>import("./stdlib/vgplot.js").then(e=>e.default()),"vg"),xe=r(()=>import("./stdlib/vega-lite.js").then(e=>e.default),"vl");var _e=Object.freeze({__proto__:null,Arrow:se,DuckDBClient:fe,Inputs:me,L:ve,Plot:$e,SQLite:we,SQLiteDatabaseClient:ke,_:ce,aq:ne,d3:ie,dot:le,duckdb:de,echarts:be,htl:ue,html:pe,mapboxgl:ge,mermaid:ye,sql:qe,svg:he,tex:Ce,topojson:Se,vg:Le,vl:xe}),je=Object.defineProperty,n=o((e,t)=>je(e,"name",{value:t,configurable:!0}),"e");const Ee=n(()=>i("https://static.observableusercontent.com/files/3ccff97fd2d93da734e76829b2b066eafdaac6a1fafdec0faf6ebc443271cfc109d29e80dd217468fcb2aff1e6bffdc73f356cc48feb657f35378e6abbbb63b9",!0),"aapl"),Ae=n(()=>i("https://static.observableusercontent.com/files/75d52e6c3130b1cae83cda89305e17b50f33e7420ef205587a135e8562bcfd22e483cf4fa2fb5df6dff66f9c5d19740be1cfaf47406286e2eb6574b49ffc685d",!0),"alphabet"),De=n(()=>i("https://static.observableusercontent.com/files/048ec3dfd528110c0665dfa363dd28bc516ffb7247231f3ab25005036717f5c4c232a5efc7bb74bc03037155cb72b1abe85a33d86eb9f1a336196030443be4f6",!0),"cars"),Be=n(()=>i("https://static.observableusercontent.com/files/39837ec5121fcc163131dbc2fe8c1a2e0b3423a5d1e96b5ce371e2ac2e20a290d78b71a4fb08b9fa6a0107776e17fb78af313b8ea70f4cc6648fad68ddf06f7a",!0),"citywages"),Oe=n(()=>i("https://static.observableusercontent.com/files/87942b1f5d061a21fa4bb8f2162db44e3ef0f7391301f867ab5ba718b225a63091af20675f0bfe7f922db097b217b377135203a7eab34651e21a8d09f4e37252",!0),"diamonds"),Pe=n(()=>i("https://static.observableusercontent.com/files/a6b0d94a7f5828fd133765a934f4c9746d2010e2f342d335923991f31b14120de96b5cb4f160d509d8dc627f0107d7f5b5070d2516f01e4c862b5b4867533000",!0),"flare"),Ie=n(()=>i("https://static.observableusercontent.com/files/76f13741128340cc88798c0a0b7fa5a2df8370f57554000774ab8ee9ae785ffa2903010cad670d4939af3e9c17e5e18e7e05ed2b38b848ac2fc1a0066aa0005f",!0),"industries"),Me=n(()=>N("https://static.observableusercontent.com/files/31d904f6e21d42d4963ece9c8cc4fbd75efcbdc404bf511bc79906f0a1be68b5a01e935f65123670ed04e35ca8cae3c2b943f82bf8db49c5a67c85cbb58db052"),"miserables"),ze=n(()=>i("https://static.observableusercontent.com/files/31ca24545a0603dce099d10ee89ee5ae72d29fa55e8fc7c9ffb5ded87ac83060d80f1d9e21f4ae8eb04c1e8940b7287d179fe8060d887fb1f055f430e210007c",!0),"olympians"),Te=n(()=>i("https://static.observableusercontent.com/files/715db1223e067f00500780077febc6cebbdd90c151d3d78317c802732252052ab0e367039872ab9c77d6ef99e5f55a0724b35ddc898a1c99cb14c31a379af80a",!0),"penguins"),Ne=n(()=>i("https://static.observableusercontent.com/files/c653108ab176088cacbb338eaf2344c4f5781681702bd6afb55697a3f91b511c6686ff469f3e3a27c75400001a2334dbd39a4499fe46b50a8b3c278b7d2f7fb5",!0),"pizza"),Qe=n(()=>i("https://static.observableusercontent.com/files/693a46b22b33db0f042728700e0c73e836fa13d55446df89120682d55339c6db7cc9e574d3d73f24ecc9bc7eb9ac9a1e7e104a1ee52c00aab1e77eb102913c1f",!0),"weather");async function N(e){const t=await fetch(e);if(!t.ok)throw new Error(`unable to fetch ${e}: status ${t.status}`);return t.json()}o(N,"y$1"),n(N,"json");async function Q(e){const t=await fetch(e);if(!t.ok)throw new Error(`unable to fetch ${e}: status ${t.status}`);return t.text()}o(Q,"$"),n(Q,"text");async function i(e,t){const[a,s]=await Promise.all([Q(e),import("../_npm/d3-dsv@3.0.1/_esm.js")]);return s.csvParse(a,t&&s.autoType)}o(i,"a"),n(i,"csv");var He=Object.freeze({__proto__:null,aapl:Ee,alphabet:Ae,cars:De,citywages:Be,diamonds:Oe,flare:Pe,industries:Ie,miserables:Me,olympians:ze,penguins:Te,pizza:Ne,weather:Qe}),Re=Object.defineProperty,f=o((e,t)=>Re(e,"name",{value:t,configurable:!0}),"t");const Fe={now:()=>g.now(),width:()=>g.width(document.querySelector("main")),dark:()=>g.dark(),resize:()=>W,FileAttachment:()=>X,Generators:()=>g,Mutable:()=>Y,..._e,...He},Ke=new J(Fe),H=Ke.module(),w=new Map;function R(e){const{id:t,inline:a,inputs:s=[],outputs:y=[],body:C}=e,m=[];w.get(t)?.variables.forEach(l=>l.delete()),w.set(t,{cell:e,variables:m});const c=document.querySelector(`#cell-${t}`),h=c.querySelector(".observablehq-loading"),p=f(()=>F(c,h),"pending"),v=f(l=>K(c,l),"rejected"),b=H.variable({_node:c,pending:p,rejected:v},{shadow:{}});if(s.includes("display")||s.includes("view")){let l=-1;const S=a?G:V,L=new b.constructor(2,b._module);if(L.define(s.filter(d=>d!=="display"&&d!=="view"),()=>{let d=b._version;return $=>{if(dl&&k(c),l=d,S(c,$),$}}),b._shadow.set("display",L),s.includes("view")){const d=new b.constructor(2,b._module,null,{shadow:{}});d._shadow.set("display",L),d.define(["display"],$=>U=>g.input($(U))),b._shadow.set("view",d)}}b.define(y.length?`cell ${t}`:null,s,C),m.push(b);for(const l of y)m.push(H.variable(!0).define(l,[`cell ${t}`],S=>S[l]))}o(R,"G"),f(R,"define");function F(e,t){e.classList.contains("observablehq--error")&&(e.classList.remove("observablehq--error"),k(e),t&&e.append(t))}o(F,"I"),f(F,"reset");function K(e,t){console.error(t),e.classList.add("observablehq--error"),k(e),e.append(T(t))}o(K,"N"),f(K,"reject");function k(e){e.textContent=""}o(k,"b"),f(k,"clear");function G(e,t){x(t)||typeof t=="string"||!t?.[Symbol.iterator]?e.append(t):e.append(...t)}o(G,"C"),f(G,"displayInline");function V(e,t){e.append(x(t)?t:z(t))}o(V,"D"),f(V,"displayBlock");function Ge(e){w.get(e)?.variables.forEach(t=>t.delete()),w.delete(e)}o(Ge,"R"),f(Ge,"undefine");function x(e){return e instanceof Node&&e instanceof e.constructor}o(x,"y"),f(x,"isNode");export{R as define}; +var ne=Object.defineProperty;var r=(e,t)=>ne(e,"name",{value:t,configurable:!0});import{Inspector as E,Runtime as se}from"./runtime.js";import{Generators as y,resize as ae,FileAttachment as ie,Mutable as le}from"./stdlib.js";var ce=Object.defineProperty,B=r((e,t)=>ce(e,"name",{value:t,configurable:!0}),"o$3");const N=document.createElement("template");N.innerHTML='',D();function D(){for(const e of document.querySelectorAll("pre:not([data-copy=none])")){const t=e.parentNode;if(t.classList.contains("observablehq-pre-container"))continue;const o=t.insertBefore(document.createElement("div"),e);o.className="observablehq-pre-container",Object.assign(o.dataset,e.dataset),o.appendChild(N.content.cloneNode(!0).firstChild).addEventListener("click",O),o.appendChild(e)}}r(D,"r$1"),B(D,"enableCopyButtons");async function O({currentTarget:e}){await navigator.clipboard.writeText(e.nextElementSibling.textContent.trim());const[t]=e.getAnimations({subtree:!0});t&&(t.currentTime=0),e.classList.add("observablehq-pre-copied"),e.addEventListener("animationend",()=>e.classList.remove("observablehq-pre-copied"),{once:!0})}r(O,"c$3"),B(O,"copy");var de=Object.defineProperty,A=r((e,t)=>de(e,"name",{value:t,configurable:!0}),"s$3");const m=document.querySelector("#observablehq-sidebar-toggle");if(m){let e=m.indeterminate;m.onclick=()=>{const o=matchMedia("(min-width: calc(640px + 6rem + 272px))").matches;e?(m.checked=!o,e=!1):m.checked===o&&(e=!0),m.indeterminate=e,e?sessionStorage.removeItem("observablehq-sidebar"):sessionStorage.setItem("observablehq-sidebar",m.checked)},addEventListener("keypress",o=>{o.code==="KeyB"&&(o.metaKey||o.altKey)&&!o.ctrlKey&&(o.target===document.body||o.target===m||o.target?.closest("#observablehq-sidebar"))&&(m.click(),o.preventDefault())});const t=`Toggle sidebar ${/Mac|iPhone/.test(navigator.platform)?/Firefox/.test(navigator.userAgent)?"\u2325":"\u2318":"Alt-"}B`;for(const o of document.querySelectorAll("#observablehq-sidebar-toggle, label[for='observablehq-sidebar-toggle']"))o.title=t}function R(e){e.detail>1&&e.preventDefault()}r(R,"l$4"),A(R,"preventDoubleClick");function I(){sessionStorage.setItem(`observablehq-sidebar:${this.firstElementChild.textContent}`,this.open)}r(I,"i$3"),A(I,"persistOpen");for(const e of document.querySelectorAll("#observablehq-sidebar summary"))e.onmousedown=R,e.parentElement.ontoggle=I;var pe=Object.defineProperty,P=r((e,t)=>pe(e,"name",{value:t,configurable:!0}),"l$3");const _=document.querySelector("#observablehq-toc");if(_){const e=_.appendChild(document.createElement("div"));e.classList.add("observablehq-secondary-link-highlight");const t=document.querySelector("#observablehq-main"),o=Array.from(t.querySelectorAll(_.dataset.selector)).reverse(),s=_.querySelectorAll(".observablehq-secondary-link"),q=P(()=>{for(const a of s)a.classList.remove("observablehq-secondary-link-active");if(location.hash)for(const a of o){const u=encodeURI(`#${a.id}`);if(u===location.hash){const f=a.getBoundingClientRect().top;if(0=innerHeight*.5)continue;const u=a.querySelector("a[href]")?.hash;for(const f of s)if(f.querySelector("a[href]")?.hash===u)return f.classList.add("observablehq-secondary-link-active"),f;break}},"relink"),C=P(()=>{const a=q();e.style.cssText=a?`top: ${a.offsetTop}px; height: ${a.offsetHeight}px;`:""},"intersected"),v=new IntersectionObserver(C,{rootMargin:"0px 0px -50% 0px"});for(const a of o)v.observe(a)}var me=Object.defineProperty,T=r((e,t)=>me(e,"name",{value:t,configurable:!0}),"n$1");function M(e){const t=new E(document.createElement("div"));return t.fulfilled(e),t._node.firstChild}r(M,"i$2"),T(M,"inspect");function z(e){const t=new E(document.createElement("div"));t.rejected(e);const o=t._node.firstChild;return o.classList.add("observablehq--error"),o}r(z,"s$1"),T(z,"inspectError");var ue=Object.defineProperty,n=r((e,t)=>ue(e,"name",{value:t,configurable:!0}),"o$1");const fe=n(()=>import("../_npm/lodash@4.17.21/_esm.js").then(e=>e.default),"_"),be=n(()=>import("../_npm/arquero@5.4.0/_esm.js"),"aq"),he=n(()=>import("../_npm/apache-arrow@16.1.0/_esm.js"),"Arrow"),ve=n(()=>import("../_npm/d3@7.9.0/_esm.js"),"d3"),ge=n(()=>import("./stdlib/dot.js").then(e=>e.default),"dot"),ye=n(()=>import("../_npm/@duckdb/duckdb-wasm@1.28.0/_esm.js"),"duckdb"),$e=n(()=>import("./stdlib/duckdb.js").then(e=>e.DuckDBClient),"DuckDBClient"),qe=n(()=>import("../_npm/echarts@5.5.0/dist/echarts.esm.min.js._esm.js"),"echarts"),we=n(()=>import("../_npm/htl@0.3.1/_esm.js"),"htl"),_e=n(()=>import("../_npm/htl@0.3.1/_esm.js").then(e=>e.html),"html"),ke=n(()=>import("../_npm/htl@0.3.1/_esm.js").then(e=>e.svg),"svg"),xe=n(()=>import("./stdlib/inputs.js"),"Inputs"),Ce=n(()=>import("../_npm/leaflet@1.9.4/_esm.js"),"L"),Le=n(()=>import("../_npm/mapbox-gl@3.4.0/_esm.js").then(e=>e.default),"mapboxgl"),Se=n(()=>import("./stdlib/mermaid.js").then(e=>e.default),"mermaid"),je=n(()=>import("../_npm/@observablehq/plot@0.6.15/_esm.js"),"Plot"),Ee=n(()=>import("../_npm/react@18.3.1/_esm.js"),"React"),Be=n(()=>import("../_npm/react-dom@18.3.1/_esm.js"),"ReactDOM"),Ne=n(()=>import("./stdlib/duckdb.js").then(e=>e.sql),"sql"),De=n(()=>import("./stdlib/sqlite.js").then(e=>e.default),"SQLite"),Oe=n(()=>import("./stdlib/sqlite.js").then(e=>e.SQLiteDatabaseClient),"SQLiteDatabaseClient"),Ae=n(()=>import("./stdlib/tex.js").then(e=>e.default),"tex"),Re=n(()=>import("../_npm/topojson-client@3.1.0/_esm.js"),"topojson"),Ie=n(()=>import("./stdlib/vgplot.js").then(e=>e.default()),"vg"),Pe=n(()=>import("./stdlib/vega-lite.js").then(e=>e.default),"vl");var Te=Object.freeze({__proto__:null,Arrow:he,DuckDBClient:$e,Inputs:xe,L:Ce,Plot:je,React:Ee,ReactDOM:Be,SQLite:De,SQLiteDatabaseClient:Oe,_:fe,aq:be,d3:ve,dot:ge,duckdb:ye,echarts:qe,htl:we,html:_e,mapboxgl:Le,mermaid:Se,sql:Ne,svg:ke,tex:Ae,topojson:Re,vg:Ie,vl:Pe}),Me=Object.defineProperty,l=r((e,t)=>Me(e,"name",{value:t,configurable:!0}),"e");const ze=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/aapl.csv"),!0),"aapl"),Qe=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/alphabet.csv"),!0),"alphabet"),He=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/cars.csv"),!0),"cars"),Ve=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/citywages.csv"),!0),"citywages"),Ke=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/diamonds.csv"),!0),"diamonds"),Fe=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/flare.csv"),!0),"flare"),Ge=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/industries.csv"),!0),"industries"),Je=l(()=>Q(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/miserables.json")),"miserables"),Ue=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/olympians.csv"),!0),"olympians"),We=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/penguins.csv"),!0),"penguins"),Ze=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/pizza.csv"),!0),"pizza"),Xe=l(()=>c(import.meta.resolve("../_npm/@observablehq/sample-datasets@1.0.1/weather.csv"),!0),"weather");async function Q(e){const t=await fetch(e);if(!t.ok)throw new Error(`unable to fetch ${e}: status ${t.status}`);return t.json()}r(Q,"w"),l(Q,"json");async function H(e){const t=await fetch(e);if(!t.ok)throw new Error(`unable to fetch ${e}: status ${t.status}`);return t.text()}r(H,"y"),l(H,"text");async function c(e,t){const[o,s]=await Promise.all([H(e),import("../_npm/d3-dsv@3.0.1/_esm.js")]);return s.csvParse(o,t&&s.autoType)}r(c,"t"),l(c,"csv");var Ye=Object.freeze({__proto__:null,aapl:ze,alphabet:Qe,cars:He,citywages:Ve,diamonds:Ke,flare:Fe,industries:Ge,miserables:Je,olympians:Ue,penguins:We,pizza:Ze,weather:Xe}),et=Object.defineProperty,i=r((e,t)=>et(e,"name",{value:t,configurable:!0}),"o");const tt={now:()=>y.now(),width:()=>y.width(document.querySelector("main")),dark:()=>y.dark(),resize:()=>ae,FileAttachment:()=>ie,Generators:()=>y,Mutable:()=>le,...Te,...Ye},ot=new se(tt),V=ot.module(),j=new Map,k=X(document.body);function K(e){const{id:t,mode:o,inputs:s=[],outputs:q=[],body:C}=e,v=[];j.set(t,{cell:e,variables:v});const a=k.get(t),u=te(a);a._nodes=[],u&&a._nodes.push(u);const f=i(()=>G(a,u),"pending"),g=i(b=>J(a,b),"rejected"),p=V.variable({_node:a.parentNode,pending:f,rejected:g},{shadow:{}});if(s.includes("display")||s.includes("view")){let b=-1;const L=o==="jsx"?F:$,oe=o==="inline"?W:o==="jsx"?U:Z,S=new p.constructor(2,p._module);if(S.define(s.filter(d=>d!=="display"&&d!=="view"),()=>{let d=p._version;return w=>{if(db&&L(a),b=d,oe(a,w),w}}),p._shadow.set("display",S),s.includes("view")){const d=new p.constructor(2,p._module,null,{shadow:{}});d._shadow.set("display",S),d.define(["display"],w=>re=>y.input(w(re))),p._shadow.set("view",d)}}p.define(q.length?`cell ${t}`:null,s,C),v.push(p);for(const b of q)v.push(V.variable(!0).define(b,[`cell ${t}`],L=>L[b]))}r(K,"F"),i(K,"define");function F(){}r(F,"O"),i(F,"noop");function $(e){for(const t of e._nodes)t.remove();e._nodes.length=0}r($,"p"),i($,"clear");function G(e,t){e._error&&(e._error=!1,$(e),t&&h(e,t))}r(G,"q"),i(G,"reset");function J(e,t){console.error(t),e._error=!0,$(e),h(e,z(t))}r(J,"C"),i(J,"reject");function U(e,t){return(e._root??=import("../_npm/react-dom@18.3.1/client._esm.js").then(({createRoot:o})=>{const s=document.createElement("DIV");return[s,o(s)]})).then(([o,s])=>{o.parentNode||(e._nodes.push(o),e.parentNode.insertBefore(o,e)),s.render(t)})}r(U,"H"),i(U,"displayJsx");function h(e,t){if(t.nodeType===11){let o;for(;o=t.firstChild;)e._nodes.push(o),e.parentNode.insertBefore(o,e)}else e._nodes.push(t),e.parentNode.insertBefore(t,e)}r(h,"l"),i(h,"displayNode");function W(e,t){if(x(t))h(e,t);else if(typeof t=="string"||!t?.[Symbol.iterator])h(e,document.createTextNode(t));else for(const o of t)h(e,x(o)?o:document.createTextNode(o))}r(W,"J"),i(W,"displayInline");function Z(e,t){h(e,x(t)?t:M(t))}r(Z,"Q"),i(Z,"displayBlock");function rt(e){$(k.get(e)),j.get(e).variables.forEach(t=>t.delete()),j.delete(e)}r(rt,"K"),i(rt,"undefine");function x(e){return e instanceof Node&&e instanceof e.constructor}r(x,"b"),i(x,"isNode");function X(e){const t=new Map,o=document.createNodeIterator(e,128,null);let s;for(;s=o.nextNode();)Y(s)&&t.set(s.data.slice(1,-1),s);return t}r(X,"B"),i(X,"findRoots");function Y(e){return e.nodeType===8&&/^:[0-9a-f]{8}(?:-\d+)?:$/.test(e.data)}r(Y,"P"),i(Y,"isRoot");function ee(e){return e.nodeType===1&&e.tagName==="OBSERVABLEHQ-LOADING"}r(ee,"U"),i(ee,"isLoading");function te(e){const t=e.previousSibling;return t&&ee(t)?t:null}r(te,"x"),i(te,"findLoading");function nt(e,t){t==null?k.delete(e):k.set(e,t)}r(nt,"W"),i(nt,"registerRoot");export{K as define}; diff --git a/isamples_export_client/ui/_observablehq/stdlib.js b/isamples_export_client/ui/_observablehq/stdlib.js index 9110e47..c6e61d5 100644 --- a/isamples_export_client/ui/_observablehq/stdlib.js +++ b/isamples_export_client/ui/_observablehq/stdlib.js @@ -1 +1 @@ -var T=Object.defineProperty;var i=(t,e)=>T(t,"name",{value:e,configurable:!0});var f,m,d,D=Object.defineProperty,u=i((t,e)=>D(t,"name",{value:e,configurable:!0}),"o$3");const h=new Map;function $(t,e){const r=new URL(t,location).href;e==null?h.delete(r):h.set(r,e)}i($,"y"),u($,"registerFile");function v(t,e=location){if(new.target!==void 0)throw new TypeError("FileAttachment is not a constructor");const r=new URL(t,e).href,n=h.get(r);if(!n)throw new Error(`File not found: ${t}`);const{path:a,mimeType:o,lastModified:s}=n;return new b(new URL(a,location).href,t.split("/").pop(),o,s)}i(v,"p$1"),u(v,"FileAttachment");async function c(t){const e=await fetch(await t.url());if(!e.ok)throw new Error(`Unable to load file: ${t.name}`);return e}i(c,"i$5"),u(c,"remote_fetch");const O=(f=class{constructor(e,r="application/octet-stream",n){Object.defineProperties(this,{name:{value:`${e}`,enumerable:!0},mimeType:{value:`${r}`,enumerable:!0},lastModified:{value:+n,enumerable:!0}})}async blob(){return(await c(this)).blob()}async arrayBuffer(){return(await c(this)).arrayBuffer()}async text(e){return e===void 0?(await c(this)).text():new TextDecoder(e).decode(await this.arrayBuffer())}async json(){return(await c(this)).json()}async stream(){return(await c(this)).body}async dsv({delimiter:e=",",array:r=!1,typed:n=!1}={}){const[a,o]=await Promise.all([this.text(),import("../_npm/d3-dsv@3.0.1/_esm.js")]),s=o.dsvFormat(e);return(r?s.parseRows:s.parse)(a,n&&o.autoType)}async csv(e){return this.dsv({...e,delimiter:","})}async tsv(e){return this.dsv({...e,delimiter:" "})}async image(e){const r=await this.url();return new Promise((n,a)=>{const o=new Image;new URL(r,document.baseURI).origin!==new URL(location).origin&&(o.crossOrigin="anonymous"),Object.assign(o,e),o.onload=()=>n(o),o.onerror=()=>a(new Error(`Unable to load file: ${this.name}`)),o.src=r})}async arrow(){const[e,r]=await Promise.all([import("../_npm/apache-arrow@16.1.0/_esm.js"),c(this)]);return e.tableFromIPC(r)}async parquet(){const[e,r,n]=await Promise.all([import("../_npm/apache-arrow@16.1.0/_esm.js"),import("../_npm/parquet-wasm@0.6.1/_esm.js").then(async a=>(await a.default(import.meta.resolve("../_npm/parquet-wasm@0.6.1/esm/parquet_wasm_bg.wasm")),a)),this.arrayBuffer()]);return e.tableFromIPC(r.readParquet(new Uint8Array(n)).intoIPCStream())}async sqlite(){const[{SQLiteDatabaseClient:e},r]=await Promise.all([import("./stdlib/sqlite.js"),this.arrayBuffer()]);return e.open(r)}async zip(){const[{ZipArchive:e},r]=await Promise.all([import("./stdlib/zip.js"),this.arrayBuffer()]);return e.from(r)}async xml(e="application/xml"){return new DOMParser().parseFromString(await this.text(),e)}async html(){return this.xml("text/html")}async xlsx(){const[{Workbook:e},r]=await Promise.all([import("./stdlib/xlsx.js"),this.arrayBuffer()]);return e.load(r)}},i(f,"m"),f);u(O,"AbstractFile");let j=O;const x=(m=class extends j{constructor(e,r,n,a){super(r,n,a),Object.defineProperty(this,"href",{value:e})}async url(){return this.href}},i(m,"w"),m);u(x,"FileAttachmentImpl");let b=x;Object.defineProperty(b,"name",{value:"FileAttachment"}),v.prototype=b.prototype;var _=Object.defineProperty,S=i((t,e)=>_(t,"name",{value:e,configurable:!0}),"r$2");async function*l(t){let e,r,n=!1;const a=t(o=>(r=o,e?(e(o),e=null):n=!0,o));if(a!=null&&typeof a!="function")throw new Error(typeof a.then=="function"?"async initializers are not supported":"initializer returned something, but not a dispose function");try{for(;;)yield n?(n=!1,r):new Promise(o=>e=o)}finally{a?.()}}i(l,"u"),S(l,"observe");var G=Object.defineProperty,F=i((t,e)=>G(t,"name",{value:e,configurable:!0}),"o$2");function A(){return l(t=>{let e;const r=matchMedia("(prefers-color-scheme: dark)"),n=F(()=>{const a=getComputedStyle(document.body).getPropertyValue("color-scheme")==="dark";e!==a&&t(e=a)},"changed");return n(),r.addEventListener("change",n),()=>r.removeEventListener("change",n)})}i(A,"m"),F(A,"dark");var N=Object.defineProperty,y=i((t,e)=>N(t,"name",{value:e,configurable:!0}),"e$2");function E(t){return l(e=>{const r=L(t);let n=w(t);const a=y(()=>e(w(t)),"inputted");return t.addEventListener(r,a),n!==void 0&&e(n),()=>t.removeEventListener(r,a)})}i(E,"o$1"),y(E,"input");function w(t){switch(t.type){case"range":case"number":return t.valueAsNumber;case"date":return t.valueAsDate;case"checkbox":return t.checked;case"file":return t.multiple?t.files:t.files[0];case"select-multiple":return Array.from(t.selectedOptions,e=>e.value);default:return t.value}}i(w,"a"),y(w,"valueof");function L(t){switch(t.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}i(L,"f$2"),y(L,"eventof");var Q=Object.defineProperty,V=i((t,e)=>Q(t,"name",{value:e,configurable:!0}),"e$1");async function*k(){for(;;)yield Date.now()}i(k,"i$3"),V(k,"now");var W=Object.defineProperty,Z=i((t,e)=>W(t,"name",{value:e,configurable:!0}),"r$1");async function*R(t){let e;const r=[],n=t(a=>(r.push(a),e&&(e(r.shift()),e=null),a));if(n!=null&&typeof n!="function")throw new Error(typeof n.then=="function"?"async initializers are not supported":"initializer returned something, but not a dispose function");try{for(;;)yield r.length?r.shift():new Promise(a=>e=a)}finally{n?.()}}i(R,"l$1"),Z(R,"queue");var H=Object.defineProperty,J=i((t,e)=>H(t,"name",{value:e,configurable:!0}),"i$2");function z(t,e){return l(r=>{let n;const a=new ResizeObserver(([o])=>{const s=o.contentRect.width;s!==n&&r(n=s)});return a.observe(t,e),()=>a.disconnect()})}i(z,"d$1"),J(z,"width");var K=Object.freeze({__proto__:null,dark:A,input:E,now:k,observe:l,queue:R,width:z}),X=Object.defineProperty,Y=i((t,e)=>X(t,"name",{value:e,configurable:!0}),"r");function U(t){let e;return Object.defineProperty(l(r=>{e=r,t!==void 0&&e(t)}),"value",{get:()=>t,set:r=>void e(t=r)})}i(U,"f$1"),Y(U,"Mutable");var ee=Object.defineProperty,q=i((t,e)=>ee(t,"name",{value:e,configurable:!0}),"l");function B(t,e){const r=document.createElement("div");r.style.position="relative",t.length!==1&&(r.style.height="100%");let n=0,a=0;const o=new ResizeObserver(async([s])=>{const{width:g,height:I}=s.contentRect,P=++n,p=g>0?await t(g,I):null;if(!(a>P)){for(a=P;r.lastChild;)r.lastChild.remove();p!=null&&(t.length!==1&&C(p)&&(p.style.position="absolute"),r.append(p))}});return o.observe(r),e?.then(()=>o.disconnect()),r}i(B,"p"),q(B,"resize");function C(t){return typeof t=="object"&&t.nodeType===1}i(C,"f"),q(C,"isElement");var te=Object.defineProperty,re=i((t,e)=>te(t,"name",{value:e,configurable:!0}),"o");const M=(d=class{},i(d,"e"),d);re(M,"Library");let ne=M;const ae=void 0;export{j as AbstractFile,v as FileAttachment,ae as FileAttachments,K as Generators,ne as Library,U as Mutable,$ as registerFile,B as resize}; +var T=Object.defineProperty;var i=(t,e)=>T(t,"name",{value:e,configurable:!0});var f,m,d,D=Object.defineProperty,u=i((t,e)=>D(t,"name",{value:e,configurable:!0}),"o$3");const h=new Map;function P(t,e){const r=new URL(t,location).href;if(e==null)h.delete(r);else{const{path:n,mimeType:a,lastModified:o}=e,s=new b(new URL(n,location).href,t.split("/").pop(),a,o);h.set(r,s)}}i(P,"y"),u(P,"registerFile");function v(t,e=location){if(new.target!==void 0)throw new TypeError("FileAttachment is not a constructor");const r=h.get(new URL(t,e).href);if(!r)throw new Error(`File not found: ${t}`);return r}i(v,"p$1"),u(v,"FileAttachment");async function c(t){const e=await fetch(await t.url());if(!e.ok)throw new Error(`Unable to load file: ${t.name}`);return e}i(c,"i$5"),u(c,"remote_fetch");const O=(f=class{constructor(e,r="application/octet-stream",n){Object.defineProperties(this,{name:{value:`${e}`,enumerable:!0},mimeType:{value:`${r}`,enumerable:!0},lastModified:{value:+n,enumerable:!0}})}async blob(){return(await c(this)).blob()}async arrayBuffer(){return(await c(this)).arrayBuffer()}async text(e){return e===void 0?(await c(this)).text():new TextDecoder(e).decode(await this.arrayBuffer())}async json(){return(await c(this)).json()}async stream(){return(await c(this)).body}async dsv({delimiter:e=",",array:r=!1,typed:n=!1}={}){const[a,o]=await Promise.all([this.text(),import("../_npm/d3-dsv@3.0.1/_esm.js")]),s=o.dsvFormat(e);return(r?s.parseRows:s.parse)(a,n&&o.autoType)}async csv(e){return this.dsv({...e,delimiter:","})}async tsv(e){return this.dsv({...e,delimiter:" "})}async image(e){const r=await this.url();return new Promise((n,a)=>{const o=new Image;new URL(r,document.baseURI).origin!==new URL(location).origin&&(o.crossOrigin="anonymous"),Object.assign(o,e),o.onload=()=>n(o),o.onerror=()=>a(new Error(`Unable to load file: ${this.name}`)),o.src=r})}async arrow(){const[e,r]=await Promise.all([import("../_npm/apache-arrow@16.1.0/_esm.js"),c(this)]);return e.tableFromIPC(r)}async parquet(){const[e,r,n]=await Promise.all([import("../_npm/apache-arrow@16.1.0/_esm.js"),import("../_npm/parquet-wasm@0.6.1/_esm.js").then(async a=>(await a.default(import.meta.resolve("../_npm/parquet-wasm@0.6.1/esm/parquet_wasm_bg.wasm")),a)),this.arrayBuffer()]);return e.tableFromIPC(r.readParquet(new Uint8Array(n)).intoIPCStream())}async sqlite(){const[{SQLiteDatabaseClient:e},r]=await Promise.all([import("./stdlib/sqlite.js"),this.arrayBuffer()]);return e.open(r)}async zip(){const[{ZipArchive:e},r]=await Promise.all([import("./stdlib/zip.js"),this.arrayBuffer()]);return e.from(r)}async xml(e="application/xml"){return new DOMParser().parseFromString(await this.text(),e)}async html(){return this.xml("text/html")}async xlsx(){const[{Workbook:e},r]=await Promise.all([import("./stdlib/xlsx.js"),this.arrayBuffer()]);return e.load(r)}},i(f,"m"),f);u(O,"AbstractFile");let j=O;const x=(m=class extends j{constructor(e,r,n,a){super(r,n,a),Object.defineProperty(this,"href",{value:e})}async url(){return this.href}},i(m,"w"),m);u(x,"FileAttachmentImpl");let b=x;Object.defineProperty(b,"name",{value:"FileAttachment"}),v.prototype=b.prototype;var _=Object.defineProperty,S=i((t,e)=>_(t,"name",{value:e,configurable:!0}),"r$2");async function*l(t){let e,r,n=!1;const a=t(o=>(r=o,e?(e(o),e=null):n=!0,o));if(a!=null&&typeof a!="function")throw new Error(typeof a.then=="function"?"async initializers are not supported":"initializer returned something, but not a dispose function");try{for(;;)yield n?(n=!1,r):new Promise(o=>e=o)}finally{a?.()}}i(l,"u"),S(l,"observe");var G=Object.defineProperty,F=i((t,e)=>G(t,"name",{value:e,configurable:!0}),"o$2");function A(){return l(t=>{let e;const r=matchMedia("(prefers-color-scheme: dark)"),n=F(()=>{const a=getComputedStyle(document.body).getPropertyValue("color-scheme")==="dark";e!==a&&t(e=a)},"changed");return n(),r.addEventListener("change",n),()=>r.removeEventListener("change",n)})}i(A,"m"),F(A,"dark");var N=Object.defineProperty,y=i((t,e)=>N(t,"name",{value:e,configurable:!0}),"e$2");function E(t){return l(e=>{const r=L(t);let n=w(t);const a=y(()=>e(w(t)),"inputted");return t.addEventListener(r,a),n!==void 0&&e(n),()=>t.removeEventListener(r,a)})}i(E,"o$1"),y(E,"input");function w(t){switch(t.type){case"range":case"number":return t.valueAsNumber;case"date":return t.valueAsDate;case"checkbox":return t.checked;case"file":return t.multiple?t.files:t.files[0];case"select-multiple":return Array.from(t.selectedOptions,e=>e.value);default:return t.value}}i(w,"a"),y(w,"valueof");function L(t){switch(t.type){case"button":case"submit":case"checkbox":return"click";case"file":return"change";default:return"input"}}i(L,"f$2"),y(L,"eventof");var Q=Object.defineProperty,V=i((t,e)=>Q(t,"name",{value:e,configurable:!0}),"e$1");async function*k(){for(;;)yield Date.now()}i(k,"i$3"),V(k,"now");var W=Object.defineProperty,Z=i((t,e)=>W(t,"name",{value:e,configurable:!0}),"r$1");async function*R(t){let e;const r=[],n=t(a=>(r.push(a),e&&(e(r.shift()),e=null),a));if(n!=null&&typeof n!="function")throw new Error(typeof n.then=="function"?"async initializers are not supported":"initializer returned something, but not a dispose function");try{for(;;)yield r.length?r.shift():new Promise(a=>e=a)}finally{n?.()}}i(R,"l$1"),Z(R,"queue");var H=Object.defineProperty,J=i((t,e)=>H(t,"name",{value:e,configurable:!0}),"i$2");function z(t,e){return l(r=>{let n;const a=new ResizeObserver(([o])=>{const s=o.contentRect.width;s!==n&&r(n=s)});return a.observe(t,e),()=>a.disconnect()})}i(z,"d$1"),J(z,"width");var K=Object.freeze({__proto__:null,dark:A,input:E,now:k,observe:l,queue:R,width:z}),X=Object.defineProperty,Y=i((t,e)=>X(t,"name",{value:e,configurable:!0}),"r");function U(t){let e;return Object.defineProperty(l(r=>{e=r,t!==void 0&&e(t)}),"value",{get:()=>t,set:r=>void e(t=r)})}i(U,"f$1"),Y(U,"Mutable");var ee=Object.defineProperty,q=i((t,e)=>ee(t,"name",{value:e,configurable:!0}),"l");function B(t,e){const r=document.createElement("div");r.style.position="relative",t.length!==1&&(r.style.height="100%");let n=0,a=0;const o=new ResizeObserver(async([s])=>{const{width:g,height:I}=s.contentRect,$=++n,p=g>0?await t(g,I):null;if(!(a>$)){for(a=$;r.lastChild;)r.lastChild.remove();p!=null&&(t.length!==1&&C(p)&&(p.style.position="absolute"),r.append(p))}});return o.observe(r),e?.then(()=>o.disconnect()),r}i(B,"p"),q(B,"resize");function C(t){return typeof t=="object"&&t.nodeType===1}i(C,"f"),q(C,"isElement");var te=Object.defineProperty,re=i((t,e)=>te(t,"name",{value:e,configurable:!0}),"o");const M=(d=class{},i(d,"e"),d);re(M,"Library");let ne=M;const ae=void 0;export{j as AbstractFile,v as FileAttachment,ae as FileAttachments,K as Generators,ne as Library,U as Mutable,P as registerFile,B as resize}; diff --git a/isamples_export_client/ui/_observablehq/stdlib/duckdb.js b/isamples_export_client/ui/_observablehq/stdlib/duckdb.js index 872ffc1..57b7790 100644 --- a/isamples_export_client/ui/_observablehq/stdlib/duckdb.js +++ b/isamples_export_client/ui/_observablehq/stdlib/duckdb.js @@ -1 +1 @@ -var L=Object.defineProperty;var s=(t,a)=>L(t,"name",{value:a,configurable:!0});var u;import*as l from"../../_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/_esm.js";var N=Object.defineProperty,o=s((t,a)=>N(t,"name",{value:a,configurable:!0}),"s");const E=await l.selectBundle({mvp:{mainModule:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/dist/duckdb-mvp.wasm"),mainWorker:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/dist/duckdb-browser-mvp.worker.js")},eh:{mainModule:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/dist/duckdb-eh.wasm"),mainWorker:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.1-dev195.0/dist/duckdb-browser-eh.worker.js")}}),O=new l.ConsoleLogger(l.LogLevel.WARNING);let m,d=[];const p=new Map;function q(t,a){a==null?(p.delete(t),m=w.of(),d=Array.from(p,e=>m.then(n=>f(n._db,...e)))):(p.set(t,a),m??=w.of(),d.push(m.then(e=>f(e._db,t,a))))}s(q,"q"),o(q,"registerTable");async function g(t,...a){return(await b()).query(t.join("?"),a)}s(g,"k"),o(g,"sql");async function b(){return await Promise.all(d),await(m??=w.of())}s(b,"p"),o(b,"getDefaultClient");const I=(u=class{constructor(a){Object.defineProperties(this,{_db:{value:a}})}async queryStream(a,e){const n=await this._db.connect();let r,i;try{if(e?.length>0?r=await(await n.prepare(a)).send(...e):r=await n.send(a),i=await r.next(),i.done)throw new Error("missing first batch")}catch(c){throw await n.close(),c}return{schema:i.value.schema,async*readRows(){try{for(;!i.done;)yield i.value.toArray(),i=await r.next()}finally{await n.close()}}}}async query(a,e){const n=await this._db.connect();let r;try{e?.length>0?r=await(await n.prepare(a)).query(...e):r=await n.query(a)}finally{await n.close()}return r}async queryRow(a,e){const n=(await this.queryStream(a,e)).readRows();try{const{done:r,value:i}=await n.next();return r||!i.length?null:i[0]}finally{await n.return()}}async sql(a,...e){return await this.query(a.join("?"),e)}queryTag(a,...e){return[a.join("?"),e]}escape(a){return`"${a}"`}async describeTables(){return Array.from(await this.query("SHOW TABLES"),({name:a})=>({name:a}))}async describeColumns({table:a}={}){return Array.from(await this.query(`DESCRIBE ${this.escape(a)}`),({column_name:e,column_type:n,null:r})=>({name:e,type:S(n),nullable:r!=="NO",databaseType:n}))}static async of(a={},e={}){const n=await R();return e.query?.castTimestampToDate===void 0&&(e={...e,query:{...e.query,castTimestampToDate:!0}}),e.query?.castBigIntToDouble===void 0&&(e={...e,query:{...e.query,castBigIntToDouble:!0}}),await n.open(e),await Promise.all(Object.entries(a).map(([r,i])=>f(n,r,i))),new u(n)}static sql(){return this.of.apply(this,arguments).then(a=>a.sql.bind(a))}},s(u,"y"),u);o(I,"DuckDBClient");let w=I;Object.defineProperty(w.prototype,"dialect",{value:"duckdb"});async function f(t,a,e){if(e=await e,B(e))return A(t,a,e);if(h(e))return y(t,a,e);if(Array.isArray(e))return T(t,a,e);if(D(e))return C(t,a,e);if(typeof e=="string")return k(t,a,e);if(e&&typeof e=="object"){if("data"in e){const{data:n,...r}=e;return h(n)?y(t,a,n,r):T(t,a,n,r)}if("file"in e){const{file:n,...r}=e;return A(t,a,n,r)}}throw new Error(`invalid source: ${e}`)}s(f,"f"),o(f,"insertSource");async function k(t,a,e){const n=await t.connect();try{await n.query(`CREATE VIEW '${a}' AS FROM '${e}'`)}finally{await n.close()}}s(k,"R"),o(k,"insertUrl");async function A(t,a,e,n){const r=await e.url();if(r.startsWith("blob:")){const c=await e.arrayBuffer();await t.registerFileBuffer(e.name,new Uint8Array(c))}else await t.registerFileURL(e.name,new URL(r,location).href,4);const i=await t.connect();try{switch(e.mimeType){case"text/csv":case"text/tab-separated-values":return await i.insertCSVFromPath(e.name,{name:a,schema:"main",...n}).catch(async c=>{if(c.toString().includes("Could not convert"))return await v(i,e,a);throw c});case"application/json":return await i.insertJSONFromPath(e.name,{name:a,schema:"main",...n});default:if(/\.arrow$/i.test(e.name)){const c=new Uint8Array(await e.arrayBuffer());return await i.insertArrowFromIPCStream(c,{name:a,schema:"main",...n})}if(/\.parquet$/i.test(e.name))return await i.query(`CREATE VIEW '${a}' AS SELECT * FROM parquet_scan('${e.name}')`);if(/\.(db|ddb|duckdb)$/i.test(e.name))return await i.query(`ATTACH '${e.name}' AS ${a} (READ_ONLY)`);throw new Error(`unknown file type: ${e.mimeType}`)}}finally{await i.close()}}s(A,"A"),o(A,"insertFile");async function v(t,a,e){return await(await t.prepare(`CREATE TABLE '${e}' AS SELECT * FROM read_csv_auto(?, ALL_VARCHAR=TRUE)`)).send(a.name)}s(v,"S"),o(v,"insertUntypedCSV");async function y(t,a,e,n){const r=await t.connect();try{await r.insertArrowTable(e,{name:a,schema:"main",...n})}finally{await r.close()}}s(y,"l"),o(y,"insertArrowTable");async function C(t,a,e){const n=(await import("../../_npm/apache-arrow@16.1.0/_esm.js")).tableFromIPC(e.toArrowBuffer());return await y(t,a,n)}s(C,"L"),o(C,"insertArqueroTable");async function T(t,a,e,n){const r=(await import("../../_npm/apache-arrow@16.1.0/_esm.js")).tableFromJSON(e);return await y(t,a,r,n)}s(T,"h"),o(T,"insertArray");async function R(){const t=await l.createWorker(E.mainWorker),a=new l.AsyncDuckDB(O,t);return await a.instantiate(E.mainModule),a}s(R,"N"),o(R,"createDuckDB");function S(t){switch(t){case"BIGINT":case"HUGEINT":case"UBIGINT":return"bigint";case"DOUBLE":case"REAL":case"FLOAT":return"number";case"INTEGER":case"SMALLINT":case"TINYINT":case"USMALLINT":case"UINTEGER":case"UTINYINT":return"integer";case"BOOLEAN":return"boolean";case"DATE":case"TIMESTAMP":case"TIMESTAMP WITH TIME ZONE":return"date";case"VARCHAR":case"UUID":return"string";default:return/^DECIMAL\(/.test(t)?"integer":"other"}}s(S,"g"),o(S,"getDuckDBType");function B(t){return t&&typeof t.name=="string"&&typeof t.url=="function"&&typeof t.arrayBuffer=="function"}s(B,"B"),o(B,"isFileAttachment");function D(t){return t&&typeof t.toArrowBuffer=="function"}s(D,"C"),o(D,"isArqueroTable");function h(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}s(h,"T"),o(h,"isArrowTable");export{w as DuckDBClient,b as getDefaultClient,q as registerTable,g as sql}; +var L=Object.defineProperty;var s=(t,a)=>L(t,"name",{value:a,configurable:!0});var u;import*as l from"../../_npm/@duckdb/duckdb-wasm@1.28.0/_esm.js";var N=Object.defineProperty,o=s((t,a)=>N(t,"name",{value:a,configurable:!0}),"s");const E=await l.selectBundle({mvp:{mainModule:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.0/dist/duckdb-mvp.wasm"),mainWorker:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.0/dist/duckdb-browser-mvp.worker.js")},eh:{mainModule:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.0/dist/duckdb-eh.wasm"),mainWorker:import.meta.resolve("../../_npm/@duckdb/duckdb-wasm@1.28.0/dist/duckdb-browser-eh.worker.js")}}),O=new l.ConsoleLogger(l.LogLevel.WARNING);let m,d=[];const p=new Map;function q(t,a){a==null?(p.delete(t),m=w.of(),d=Array.from(p,e=>m.then(n=>f(n._db,...e)))):(p.set(t,a),m??=w.of(),d.push(m.then(e=>f(e._db,t,a))))}s(q,"q"),o(q,"registerTable");async function g(t,...a){return(await b()).query(t.join("?"),a)}s(g,"k"),o(g,"sql");async function b(){return await Promise.all(d),await(m??=w.of())}s(b,"p"),o(b,"getDefaultClient");const I=(u=class{constructor(a){Object.defineProperties(this,{_db:{value:a}})}async queryStream(a,e){const n=await this._db.connect();let r,i;try{if(e?.length>0?r=await(await n.prepare(a)).send(...e):r=await n.send(a),i=await r.next(),i.done)throw new Error("missing first batch")}catch(c){throw await n.close(),c}return{schema:i.value.schema,async*readRows(){try{for(;!i.done;)yield i.value.toArray(),i=await r.next()}finally{await n.close()}}}}async query(a,e){const n=await this._db.connect();let r;try{e?.length>0?r=await(await n.prepare(a)).query(...e):r=await n.query(a)}finally{await n.close()}return r}async queryRow(a,e){const n=(await this.queryStream(a,e)).readRows();try{const{done:r,value:i}=await n.next();return r||!i.length?null:i[0]}finally{await n.return()}}async sql(a,...e){return await this.query(a.join("?"),e)}queryTag(a,...e){return[a.join("?"),e]}escape(a){return`"${a}"`}async describeTables(){return Array.from(await this.query("SHOW TABLES"),({name:a})=>({name:a}))}async describeColumns({table:a}={}){return Array.from(await this.query(`DESCRIBE ${this.escape(a)}`),({column_name:e,column_type:n,null:r})=>({name:e,type:S(n),nullable:r!=="NO",databaseType:n}))}static async of(a={},e={}){const n=await R();return e.query?.castTimestampToDate===void 0&&(e={...e,query:{...e.query,castTimestampToDate:!0}}),e.query?.castBigIntToDouble===void 0&&(e={...e,query:{...e.query,castBigIntToDouble:!0}}),await n.open(e),await Promise.all(Object.entries(a).map(([r,i])=>f(n,r,i))),new u(n)}static sql(){return this.of.apply(this,arguments).then(a=>a.sql.bind(a))}},s(u,"y"),u);o(I,"DuckDBClient");let w=I;Object.defineProperty(w.prototype,"dialect",{value:"duckdb"});async function f(t,a,e){if(e=await e,B(e))return A(t,a,e);if(h(e))return y(t,a,e);if(Array.isArray(e))return T(t,a,e);if(D(e))return C(t,a,e);if(typeof e=="string")return k(t,a,e);if(e&&typeof e=="object"){if("data"in e){const{data:n,...r}=e;return h(n)?y(t,a,n,r):T(t,a,n,r)}if("file"in e){const{file:n,...r}=e;return A(t,a,n,r)}}throw new Error(`invalid source: ${e}`)}s(f,"f"),o(f,"insertSource");async function k(t,a,e){const n=await t.connect();try{await n.query(`CREATE VIEW '${a}' AS FROM '${e}'`)}finally{await n.close()}}s(k,"R"),o(k,"insertUrl");async function A(t,a,e,n){const r=await e.url();if(r.startsWith("blob:")){const c=await e.arrayBuffer();await t.registerFileBuffer(e.name,new Uint8Array(c))}else await t.registerFileURL(e.name,new URL(r,location).href,4);const i=await t.connect();try{switch(e.mimeType){case"text/csv":case"text/tab-separated-values":return await i.insertCSVFromPath(e.name,{name:a,schema:"main",...n}).catch(async c=>{if(c.toString().includes("Could not convert"))return await v(i,e,a);throw c});case"application/json":return await i.insertJSONFromPath(e.name,{name:a,schema:"main",...n});default:if(/\.arrow$/i.test(e.name)){const c=new Uint8Array(await e.arrayBuffer());return await i.insertArrowFromIPCStream(c,{name:a,schema:"main",...n})}if(/\.parquet$/i.test(e.name))return await i.query(`CREATE VIEW '${a}' AS SELECT * FROM parquet_scan('${e.name}')`);if(/\.(db|ddb|duckdb)$/i.test(e.name))return await i.query(`ATTACH '${e.name}' AS ${a} (READ_ONLY)`);throw new Error(`unknown file type: ${e.mimeType}`)}}finally{await i.close()}}s(A,"A"),o(A,"insertFile");async function v(t,a,e){return await(await t.prepare(`CREATE TABLE '${e}' AS SELECT * FROM read_csv_auto(?, ALL_VARCHAR=TRUE)`)).send(a.name)}s(v,"S"),o(v,"insertUntypedCSV");async function y(t,a,e,n){const r=await t.connect();try{await r.insertArrowTable(e,{name:a,schema:"main",...n})}finally{await r.close()}}s(y,"l"),o(y,"insertArrowTable");async function C(t,a,e){const n=(await import("../../_npm/apache-arrow@16.1.0/_esm.js")).tableFromIPC(e.toArrowBuffer());return await y(t,a,n)}s(C,"L"),o(C,"insertArqueroTable");async function T(t,a,e,n){const r=(await import("../../_npm/apache-arrow@16.1.0/_esm.js")).tableFromJSON(e);return await y(t,a,r,n)}s(T,"h"),o(T,"insertArray");async function R(){const t=await l.createWorker(E.mainWorker),a=new l.AsyncDuckDB(O,t);return await a.instantiate(E.mainModule),a}s(R,"N"),o(R,"createDuckDB");function S(t){switch(t){case"BIGINT":case"HUGEINT":case"UBIGINT":return"bigint";case"DOUBLE":case"REAL":case"FLOAT":return"number";case"INTEGER":case"SMALLINT":case"TINYINT":case"USMALLINT":case"UINTEGER":case"UTINYINT":return"integer";case"BOOLEAN":return"boolean";case"DATE":case"TIMESTAMP":case"TIMESTAMP WITH TIME ZONE":return"date";case"VARCHAR":case"UUID":return"string";default:return/^DECIMAL\(/.test(t)?"integer":"other"}}s(S,"g"),o(S,"getDuckDBType");function B(t){return t&&typeof t.name=="string"&&typeof t.url=="function"&&typeof t.arrayBuffer=="function"}s(B,"B"),o(B,"isFileAttachment");function D(t){return t&&typeof t.toArrowBuffer=="function"}s(D,"C"),o(D,"isArqueroTable");function h(t){return t&&typeof t.getChild=="function"&&typeof t.toArray=="function"&&t.schema&&Array.isArray(t.schema.fields)}s(h,"T"),o(h,"isArrowTable");export{w as DuckDBClient,b as getDefaultClient,q as registerTable,g as sql}; diff --git a/isamples_export_client/ui/_observablehq/theme-air,near-midnight.css b/isamples_export_client/ui/_observablehq/theme-air,near-midnight.css index b3909e3..5078878 100644 --- a/isamples_export_client/ui/_observablehq/theme-air,near-midnight.css +++ b/isamples_export_client/ui/_observablehq/theme-air,near-midnight.css @@ -1 +1 @@ -:root{--monospace: Menlo, Consolas, monospace;--monospace-font: 14px/1.5 var(--monospace);--serif: "Source Serif Pro", "Iowan Old Style", "Apple Garamond", "Palatino Linotype", "Times New Roman", "Droid Serif", Times, serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--sans-serif: -apple-system, BlinkMacSystemFont, "avenir next", avenir, helvetica, "helvetica neue", ubuntu, roboto, noto, "segoe ui", arial, sans-serif;--theme-blue: #4269d0;--theme-green: #3ca951;--theme-red: #ff725c;--theme-yellow: #efb118}html{-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:var(--theme-background);color:var(--theme-foreground)}body{font:17px/1.5 var(--serif);margin:0}a[href]{color:var(--theme-foreground-focus)}h1,h2,h3,h4,h5,h6{color:var(--theme-foreground-alt);font-weight:700;line-height:1.15;margin-top:0;margin-bottom:.25rem;scroll-margin-top:1rem;text-wrap:balance}h2+p,h3+p,h4+p,h2+table,h3+table,h4+table{margin-top:0}h1+h2{color:var(--theme-foreground);font-size:20px;font-style:italic;font-weight:400;margin-bottom:1rem}a[href]{text-decoration:none}a[href]:hover,a[href]:focus{text-decoration:underline}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:90%}pre{line-height:1.5}pre,code,tt{font-family:var(--monospace);font-size:14px}img{max-width:calc(100vw - 28px)}p,table,figure,figcaption,h1,h2,h3,h4,h5,h6,.katex-display{max-width:640px}blockquote,ol,ul{max-width:600px}blockquote{margin:1rem 1.5rem}ul ol{padding-left:28px}hr{height:1px;margin:1rem 0;padding:1rem 0;border:none;background:no-repeat center/100% 1px linear-gradient(to right,var(--theme-foreground-faintest),var(--theme-foreground-faintest))}pre{background-color:var(--theme-background-alt);border-radius:4px;margin:1rem -1rem;max-width:960px;min-height:1.5em;padding:.5rem 1rem;overflow-x:auto;box-sizing:border-box}input:not([type]),input[type=email],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=url]{width:240px}input,canvas,button{vertical-align:middle}button,input,textarea{accent-color:var(--theme-blue)}table{width:100%;border-collapse:collapse;font:13px/1.2 var(--sans-serif)}table pre,table code,table tt{font-size:inherit;line-height:inherit}th>pre:only-child,td>pre:only-child{margin:0;padding:0}th{color:var(--theme-foreground);text-align:left;vertical-align:bottom}td{color:var(--theme-foreground-alt);vertical-align:top}th,td{padding:3px 6.5px 3px 0}th:last-child,td:last-child{padding-right:0}tr:not(:last-child){border-bottom:solid 1px var(--theme-foreground-faintest)}thead tr{border-bottom:solid 1px var(--theme-foreground-fainter)}figure,table{margin:1rem 0}figure img{max-width:100%}figure>h2,figure>h3{font-family:var(--sans-serif)}figure>h2{font-size:20px}figure>h3{font-size:16px;font-weight:400}figcaption{font:small var(--sans-serif);color:var(--theme-foreground-muted)}a[href].observablehq-header-anchor{color:inherit}:root{--font-big: 700 32px/1 var(--sans-serif);--font-small: 14px var(--sans-serif)}.big{font:var(--font-big)}.small{font:var(--font-small)}.red{color:var(--theme-red)}.yellow{color:var(--theme-yellow)}.green{color:var(--theme-green)}.blue{color:var(--theme-blue)}.muted{color:var(--theme-foreground-muted)}.observablehq--draft>h1:first-of-type:after{content:" [DRAFT]";color:var(--theme-foreground-muted)}:root{--theme-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M5 7L8.125 9.5L11.25 7' stroke='black' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");--theme-toggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m10.5,11 2.5-3-2.5-3 M6,8h7' fill='none' stroke='black' stroke-width='2'/%3E%3Crect x='2' y='2' fill='currentColor' height='12' rx='0.5' width='2'/%3E%3C/svg%3E");--theme-magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath stroke='currentColor' stroke-width='2' fill='none' d='M15,15L10.5,10.5a3,3 0 1,0 -6 -6a3,3 0 1,0 6 6'%3E%3C/path%3E%3C/svg%3E")}#observablehq-main,#observablehq-header,#observablehq-footer{margin:1rem auto;max-width:1152px}#observablehq-main{min-height:calc(100vh - 20rem);position:relative;z-index:0}#observablehq-footer{display:block;margin-top:10rem;font:12px var(--sans-serif);color:var(--theme-foreground-faint)}#observablehq-footer nav{display:grid;max-width:640px;grid-template-columns:1fr 1fr;column-gap:1rem;margin-bottom:1rem}#observablehq-footer nav a{display:flex;flex-direction:column;border:1px solid var(--theme-foreground-fainter);border-radius:8px;padding:1rem;line-height:1rem;text-decoration:none}#observablehq-footer nav a span{font-size:14px}#observablehq-footer nav a:hover span{text-decoration:underline}#observablehq-footer nav a:hover{border-color:var(--theme-foreground-focus)}#observablehq-footer nav a[rel=prev]{grid-column:1;align-items:start}#observablehq-footer nav a[rel=next]{grid-column:2;align-items:end}#observablehq-footer nav a:before{color:var(--theme-foreground-faint)}#observablehq-footer nav a[rel=prev]:before{content:"Previous page"}#observablehq-footer nav a[rel=next]:before{content:"Next page"}#observablehq-center{margin:1rem 2rem}#observablehq-sidebar{position:fixed;background:var(--theme-background-alt);color:var(--theme-foreground-muted);font:14px var(--sans-serif);visibility:hidden;font-weight:500;width:272px;z-index:2;top:0;bottom:0;left:-272px;box-sizing:border-box;padding:0 .5rem 1rem;overflow-y:auto}#observablehq-sidebar ol,#observablehq-toc ol{list-style:none;margin:0;padding:0}#observablehq-sidebar>ol,#observablehq-sidebar>details,#observablehq-sidebar>section{position:relative;padding-bottom:.5rem;margin:.5rem 0;border-bottom:solid 1px var(--theme-foreground-faintest)}#observablehq-sidebar>ol:first-child{position:sticky;top:0;z-index:1;background:var(--theme-background-alt);font-size:16px;font-weight:700;padding-top:1rem;padding-left:.5rem;margin:0;margin-left:-.5rem;color:var(--theme-foreground)}#observablehq-sidebar>ol:last-child,#observablehq-sidebar>details:last-child,#observablehq-sidebar>section:last-child{border-bottom:none}#observablehq-sidebar summary{font-weight:700;color:var(--theme-foreground);cursor:default}#observablehq-sidebar summary::-webkit-details-marker,#observablehq-sidebar summary::marker{display:none}#observablehq-sidebar details summary:after{position:absolute;right:.5rem;width:1rem;height:1rem;background:var(--theme-foreground-muted);content:"";-webkit-mask:var(--theme-caret);mask:var(--theme-caret);transition:transform .25s ease;transform:rotate(-90deg);transform-origin:50% 50%}#observablehq-sidebar details summary:hover:after{color:var(--theme-foreground)}#observablehq-sidebar details[open] summary:after{transform:rotate(0)}#observablehq-sidebar-toggle{position:fixed;appearance:none;background:none;top:0;left:0;height:100%;width:2rem;display:flex;align-items:center;justify-content:center;cursor:e-resize;margin:0;color:var(--theme-foreground-muted);z-index:1}#observablehq-sidebar-close{position:absolute;top:1rem;right:0;width:2rem;height:2.2rem;display:flex;align-items:center;justify-content:center;color:var(--theme-foreground-muted);cursor:w-resize;z-index:2}#observablehq-sidebar-toggle:before,#observablehq-sidebar-close:before{content:"";width:1rem;height:1rem;background:currentColor;-webkit-mask:var(--theme-toggle);mask:var(--theme-toggle)}#observablehq-sidebar-close:before{transform:scaleX(-1)}#observablehq-sidebar summary,.observablehq-link a{display:flex;padding:.5rem 1rem .5rem 1.5rem;margin-left:-.5rem;align-items:center}#observablehq-sidebar details summary:hover,.observablehq-link-active a,.observablehq-link a:hover{background:var(--theme-background)}.observablehq-link a:hover{color:var(--theme-foreground-focus)}#observablehq-toc{display:none;position:fixed;color:var(--theme-foreground-muted);font:400 14px var(--sans-serif);z-index:1;top:0;right:0;bottom:0;overflow-y:auto}#observablehq-toc nav{width:192px;margin:2rem 0;padding:0 1rem;box-sizing:border-box;border-left:solid 1px var(--theme-foreground-faintest)}#observablehq-toc div{font-weight:700;color:var(--theme-foreground);margin-bottom:.5rem}.observablehq-secondary-link a{display:block;padding:.25rem 0}.observablehq-link:not(.observablehq-link-active) a[href]:not(:hover),.observablehq-secondary-link:not(.observablehq-secondary-link-active) a[href]:not(:hover){color:inherit}.observablehq-link-active,.observablehq-secondary-link-active{position:relative}.observablehq-link-active:before,.observablehq-secondary-link-highlight{content:"";position:absolute;width:3px;background:var(--theme-foreground-focus)}.observablehq-link-active:before{top:0;bottom:0;left:-.5rem}.observablehq-secondary-link-highlight{left:1px;top:2rem;height:0;transition:top .15s ease,height .15s ease}#observablehq-sidebar{transition:visibility .15s 0ms,left .15s 0ms ease}#observablehq-sidebar:focus-within,#observablehq-sidebar-toggle:checked~#observablehq-sidebar{left:0;visibility:initial;box-shadow:0 0 8px 4px #0000001a;transition:visibility 0ms 0ms,left .15s 0ms ease}#observablehq-sidebar-backdrop{display:none;position:fixed;inset:0;z-index:2}#observablehq-sidebar-backdrop:has(~#observablehq-sidebar:focus-within),#observablehq-sidebar-toggle:checked~#observablehq-sidebar-backdrop{display:initial}@media (prefers-color-scheme: dark){#observablehq-sidebar:focus-within,#observablehq-sidebar-toggle:checked~#observablehq-sidebar{box-shadow:0 0 8px 4px #00000080}}@media (min-width: calc(912px + 6rem)){#observablehq-sidebar{transition:none!important}#observablehq-sidebar-toggle:checked~#observablehq-sidebar-backdrop{display:none}#observablehq-sidebar-toggle:checked~#observablehq-sidebar,#observablehq-sidebar-toggle:indeterminate~#observablehq-sidebar{left:0;visibility:initial;box-shadow:none;border-right:solid 1px var(--theme-foreground-faintest)}#observablehq-sidebar-toggle:checked~#observablehq-center,#observablehq-sidebar-toggle:indeterminate~#observablehq-center{padding-left:calc(272px + 1rem);padding-right:1rem}}@media (min-width: calc(832px + 6rem)){#observablehq-toc~#observablehq-center{padding-right:calc(192px + 1rem)}#observablehq-toc{display:block}}@media (min-width: calc(912px + 6rem)){#observablehq-sidebar-toggle:checked~#observablehq-toc,#observablehq-sidebar-toggle:indeterminate~#observablehq-toc{display:none}}@media (min-width: calc(1104px + 6rem)){#observablehq-sidebar-toggle:checked~#observablehq-toc,#observablehq-sidebar-toggle:indeterminate~#observablehq-toc,#observablehq-toc{display:block}#observablehq-sidebar-toggle:checked~#observablehq-toc~#observablehq-center,#observablehq-sidebar-toggle:indeterminate~#observablehq-toc~#observablehq-center,#observablehq-toc~#observablehq-center{padding-right:calc(192px + 1rem)}}.observablehq-pre-container{position:relative;margin:1rem -1rem;max-width:960px}.observablehq-pre-container:after{position:absolute;top:0;right:0;height:21px;font:12px var(--sans-serif);color:var(--theme-foreground-muted);background:linear-gradient(to right,transparent,var(--theme-background-alt) 40%);padding:.5rem .5rem .5rem 1.5rem}.observablehq-pre-container[data-language]:after{content:attr(data-language)}.observablehq-pre-container pre{padding-right:4rem;margin:0;max-width:none}.observablehq-pre-copy{position:absolute;top:0;right:0;background:none;color:transparent;border:none;border-radius:4px;padding:0 8px;margin:4px;height:29px;cursor:pointer;z-index:1;display:flex;align-items:center}.observablehq-pre-copied:before{content:"Copied!";position:absolute;right:calc(100% + .25rem);background:linear-gradient(to right,transparent,var(--theme-background-alt) 10%);color:var(--theme-green);font:var(--font-small);padding:4px 8px 4px 16px;pointer-events:none;animation-name:observablehq-pre-copied;animation-duration:.25s;animation-direction:alternate;animation-iteration-count:2}@keyframes observablehq-pre-copied{0%{opacity:0;transform:translate(.5rem)}50%{opacity:1}to{transform:translate(0)}}.observablehq-pre-container[data-copy] .observablehq-pre-copy,.observablehq-pre-container:hover .observablehq-pre-copy,.observablehq-pre-container .observablehq-pre-copy:focus{background:var(--theme-background-alt);color:var(--theme-foreground-faint)}.observablehq-pre-container .observablehq-pre-copy:hover{color:var(--theme-foreground-muted)}.observablehq-pre-container .observablehq-pre-copy:active{color:var(--theme-foreground);background:var(--theme-foreground-faintest)}#observablehq-sidebar.observablehq-search-results>ol:not(:first-child),#observablehq-sidebar.observablehq-search-results>details,#observablehq-sidebar.observablehq-search-results>section{display:none}#observablehq-search{position:relative;padding:.5rem 0 0;display:flex;align-items:center}#observablehq-search input{padding:6px 4px 6px 2.2em;width:100%;border:none;border-radius:4px;background-color:var(--theme-background);font-size:13.3px;height:28px}#observablehq-search input::placeholder{color:var(--theme-foreground-faint)}#observablehq-search:before{position:absolute;left:.5rem;content:"";width:1rem;height:1rem;background:currentColor;-webkit-mask:var(--theme-magnifier);mask:var(--theme-magnifier);pointer-events:none}#observablehq-search:after{position:absolute;right:6px;content:attr(data-shortcut);pointer-events:none}#observablehq-search:focus-within:after{content:""}#observablehq-search-results{--relevance-width: 32px;position:absolute;overflow-y:auto;top:6.5rem;left:0;right:.5rem;bottom:0}#observablehq-search-results a span{max-width:184px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#observablehq-search-results div{text-align:right;font-size:10px;margin:.5em}#observablehq-search-results li{position:relative;display:flex;align-items:center}#observablehq-search-results a{flex-grow:1}#observablehq-search-results li:after,#observablehq-search-results a:after{content:"";width:var(--relevance-width);height:4px;position:absolute;right:.5em;border-radius:2px;background:var(--theme-foreground-muted)}#observablehq-search-results li.observablehq-link-active:after{background:var(--theme-foreground-focus)}#observablehq-search-results a:after{background:var(--theme-foreground-faintest)}#observablehq-search-results li[data-score="0"]:after{width:calc(var(--relevance-width) * .125)}#observablehq-search-results li[data-score="1"]:after{width:calc(var(--relevance-width) * .25)}#observablehq-search-results li[data-score="2"]:after{width:calc(var(--relevance-width) * .4375)}#observablehq-search-results li[data-score="3"]:after{width:calc(var(--relevance-width) * .625)}#observablehq-search-results li[data-score="4"]:after{width:calc(var(--relevance-width) * .8125)}@media print{#observablehq-center{padding-left:1em!important}#observablehq-sidebar,#observablehq-footer{display:none!important}}#observablehq-center{container-type:inline-size}.grid{margin:1rem 0;display:grid;gap:1rem;grid-auto-rows:1fr}.grid svg{overflow:visible}.grid figure{margin:0}.grid>*>p:first-child{margin-top:0}.grid>*>p:last-child{margin-bottom:0}@container (min-width: 640px){.grid-cols-2,.grid-cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-2 .grid-colspan-2,.grid-cols-2 .grid-colspan-3,.grid-cols-2 .grid-colspan-4,.grid-cols-4 .grid-colspan-2,.grid-cols-4 .grid-colspan-3,.grid-cols-4 .grid-colspan-4{grid-column:span 2}}@container (min-width: 720px){.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-3 .grid-colspan-2{grid-column:span 2}.grid-cols-3 .grid-colspan-3{grid-column:span 3}}@container (min-width: 1080px){.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-4 .grid-colspan-3{grid-column:span 3}.grid-cols-4 .grid-colspan-4{grid-column:span 4}}.grid-rowspan-2{grid-row:span 2}.grid-rowspan-3{grid-row:span 3}.grid-rowspan-4{grid-row:span 4}.note,.tip,.warning,.caution{border-left:solid 1px;border-radius:0 4px 4px 0;padding:1rem 2rem;margin:1rem 0;box-sizing:border-box;max-width:640px}.note:before,.tip:before,.warning:before,.caution:before{display:block;margin-bottom:1rem;font-weight:700}.note{border-left-color:var(--theme-foreground-fainter);background-color:var(--theme-background-alt)}.note:before{content:"Note";color:var(--theme-foreground-muted)}.tip{border-left-color:var(--theme-green);background-color:color-mix(in srgb,var(--theme-green),var(--theme-background) 90%)}.tip:before{content:"Tip";color:var(--theme-green)}.warning{border-left-color:var(--theme-yellow);background-color:color-mix(in srgb,var(--theme-yellow),var(--theme-background) 90%)}.warning:before{content:"Warning";color:var(--theme-yellow)}.caution{border-left-color:var(--theme-red);background-color:color-mix(in srgb,var(--theme-red),var(--theme-background) 90%)}.caution:before{content:"Caution";color:var(--theme-red)}.note[label]:before,.tip[label]:before,.warning[label]:before,.caution[label]:before{content:attr(label)}.note>:first-child,.tip>:first-child,.warning>:first-child,.caution>:first-child{margin-top:0}.note>:last-child,.tip>:last-child,.warning>:last-child,.caution>:last-child{margin-bottom:0}.card{background:var(--theme-background-alt);border:solid 1px var(--theme-foreground-faintest);border-radius:.75rem;padding:1rem;margin:1rem 0;font:14px var(--sans-serif)}.grid>.card,.card figure{margin:0}.card h2,.card h3{font-size:inherit}.card h2{font-weight:500;font-size:15px}.card h3{font-weight:400;color:var(--theme-foreground-muted)}.card h2~svg,.card h3~svg,.card h2~p,.card h3~p{margin-top:1rem}.observablehq--block:empty{margin:0}@keyframes observablehq-loading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.observablehq-loading{font:var(--monospace-font);color:var(--theme-foreground-muted);display:inline-block;transform-origin:.32em 55%;animation-name:observablehq-loading;animation-timing-function:linear;animation-duration:1s;animation-iteration-count:infinite}.observablehq-loading:before{content:"\21bb"}.observablehq--block .observablehq-loading{display:block}.observablehq--block{margin:1rem 0}.observablehq--block .observablehq,.observablehq--block .observablehq--inspect{display:block}.observablehq--collapsed,.observablehq--expanded.observablehq--inspect a{cursor:pointer}.observablehq--caret{margin-right:4px;vertical-align:baseline}.observablehq--field{text-indent:-1rem;margin-left:1rem}.observablehq--inspect{font:var(--monospace-font);overflow-x:auto;white-space:pre}.observablehq--inspect.observablehq--import{white-space:normal}.observablehq--inspect::-webkit-scrollbar{display:none}.observablehq--error .observablehq--inspect{word-break:break-all;white-space:pre-wrap}.observablehq--string-expand{margin-left:6px;padding:2px 6px;border-radius:2px;font-size:80%;background:var(--theme-background-alt);cursor:pointer;vertical-align:middle}.observablehq--keyword,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:var(--syntax-keyword)}.observablehq--symbol,.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:var(--syntax-entity)}.observablehq--index,.observablehq--key,.hljs-attr,.hljs-attribute,.hljs-meta,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:var(--syntax-constant)}.observablehq--regexp,.observablehq--string,.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:var(--syntax-string)}.observablehq--null,.observablehq--undefined,.hljs-built_in,.hljs-literal,.hljs-symbol{color:var(--syntax-variable)}.observablehq--prototype-key,.observablehq--empty,.hljs-comment,.hljs-formula{color:var(--syntax-comment)}.observablehq--bigint,.observablehq--boolean,.observablehq--date,.observablehq--forbidden,.observablehq--number,.hljs-name,.hljs-number,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:var(--syntax-entity-tag)}.hljs-subst{color:var(--syntax-storage-modifier-import)}.hljs-section{color:var(--syntax-markup-heading);font-weight:700}.hljs-bullet{color:var(--syntax-markup-list)}.hljs-emphasis{color:var(--syntax-markup-italic);font-style:italic}.hljs-strong{color:var(--syntax-markup-bold);font-weight:700}.hljs-addition{color:var(--syntax-markup-inserted);background-color:var(--syntax-markup-inserted-background)}.hljs-deletion{color:var(--syntax-markup-deleted);background-color:var(--syntax-markup-deleted-background)}.observablehq--empty{font-style:oblique}.observablehq--error{color:var(--syntax-keyword)}.plot-d6a7b5{--plot-background: var(--theme-background)}p .plot-d6a7b5{display:inline-block}@media (prefers-color-scheme: light){:root{--syntax-keyword: #d73a49;--syntax-entity: #6f42c1;--syntax-constant: #005cc5;--syntax-string: #032f62;--syntax-variable: #e36209;--syntax-comment: var(--theme-foreground-muted);--syntax-entity-tag: #22863a;--syntax-storage-modifier-import: #24292e;--syntax-markup-heading: #005cc5;--syntax-markup-list: #735c0f;--syntax-markup-italic: #24292e;--syntax-markup-bold: #24292e;--syntax-markup-inserted: #22863a;--syntax-markup-inserted-background: #f0fff4;--syntax-markup-deleted: #b31d28;--syntax-markup-deleted-background: #ffeef0}}@media (prefers-color-scheme: light){:root{--theme-background-b: color-mix(in srgb, var(--theme-foreground) 4%, var(--theme-background-a));--theme-background: var(--theme-background-a);--theme-background-alt: var(--theme-background-b);--theme-foreground-alt: color-mix(in srgb, var(--theme-foreground) 90%, var(--theme-background-a));--theme-foreground-muted: color-mix(in srgb, var(--theme-foreground) 60%, var(--theme-background-a));--theme-foreground-faint: color-mix(in srgb, var(--theme-foreground) 50%, var(--theme-background-a));--theme-foreground-fainter: color-mix(in srgb, var(--theme-foreground) 30%, var(--theme-background-a));--theme-foreground-faintest: color-mix(in srgb, var(--theme-foreground) 14%, var(--theme-background-a));color-scheme:light}}@media (prefers-color-scheme: light){:root{--theme-foreground: #1b1e23;--theme-foreground-focus: #3b5fc0;--theme-background-a: #ffffff}}@media (prefers-color-scheme: dark){:root{--syntax-keyword: #ff7b72;--syntax-entity: #d2a8ff;--syntax-constant: #79c0ff;--syntax-string: #a5d6ff;--syntax-variable: #ffa657;--syntax-comment: var(--theme-foreground-muted);--syntax-entity-tag: #7ee787;--syntax-storage-modifier-import: #c9d1d9;--syntax-markup-heading: #1f6feb;--syntax-markup-list: #f2cc60;--syntax-markup-italic: #c9d1d9;--syntax-markup-bold: #c9d1d9;--syntax-markup-inserted: #aff5b4;--syntax-markup-inserted-background: #033a16;--syntax-markup-deleted: #ffdcd7;--syntax-markup-deleted-background: #67060c}}@media (prefers-color-scheme: dark){:root{--theme-background-a: color-mix(in srgb, var(--theme-foreground) 4%, var(--theme-background-b));--theme-background: var(--theme-background-a);--theme-background-alt: var(--theme-background-b);--theme-foreground-alt: color-mix(in srgb, var(--theme-foreground) 90%, var(--theme-background-b));--theme-foreground-muted: color-mix(in srgb, var(--theme-foreground) 60%, var(--theme-background-b));--theme-foreground-faint: color-mix(in srgb, var(--theme-foreground) 50%, var(--theme-background-b));--theme-foreground-fainter: color-mix(in srgb, var(--theme-foreground) 30%, var(--theme-background-b));--theme-foreground-faintest: color-mix(in srgb, var(--theme-foreground) 14%, var(--theme-background-b));color-scheme:dark}}@media (prefers-color-scheme: dark){:root{--theme-foreground: #dfdfd6;--theme-foreground-focus: oklch(.712564 .257662 265.758);--theme-background-b: #161616}} +:root{--monospace: Menlo, Consolas, monospace;--monospace-font: 14px/1.5 var(--monospace);--serif: "Source Serif Pro", "Iowan Old Style", "Apple Garamond", "Palatino Linotype", "Times New Roman", "Droid Serif", Times, serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--sans-serif: -apple-system, BlinkMacSystemFont, "avenir next", avenir, helvetica, "helvetica neue", ubuntu, roboto, noto, "segoe ui", arial, sans-serif;--theme-blue: #4269d0;--theme-green: #3ca951;--theme-red: #ff725c;--theme-yellow: #efb118}html{-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background:var(--theme-background);color:var(--theme-foreground)}body{font:17px/1.5 var(--serif);margin:0}a[href]{color:var(--theme-foreground-focus)}h1,h2,h3,h4,h5,h6{color:var(--theme-foreground-alt);font-weight:700;line-height:1.15;margin-top:0;margin-bottom:.25rem;scroll-margin-top:1rem;text-wrap:balance}h2+p,h3+p,h4+p,h2+table,h3+table,h4+table{margin-top:0}h1+h2{color:var(--theme-foreground);font-size:20px;font-style:italic;font-weight:400;margin-bottom:1rem}a[href]{text-decoration:none}a[href]:hover,a[href]:focus{text-decoration:underline}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:90%}pre{line-height:1.5}pre,code,tt{font-family:var(--monospace);font-size:14px}img{max-width:calc(100vw - 28px)}p,table,figure,figcaption,h1,h2,h3,h4,h5,h6,.katex-display{max-width:640px}blockquote,ol,ul{max-width:600px}blockquote{margin:1rem 1.5rem}ul ol{padding-left:28px}hr{height:1px;margin:1rem 0;padding:1rem 0;border:none;background:no-repeat center/100% 1px linear-gradient(to right,var(--theme-foreground-faintest),var(--theme-foreground-faintest))}pre{background-color:var(--theme-background-alt);border-radius:4px;margin:1rem -1rem;max-width:960px;min-height:1.5em;padding:.5rem 1rem;overflow-x:auto;box-sizing:border-box}input:not([type]),input[type=email],input[type=number],input[type=password],input[type=range],input[type=search],input[type=tel],input[type=text],input[type=url]{width:240px}input,canvas,button{vertical-align:middle}button,input,textarea{accent-color:var(--theme-blue)}table{width:100%;border-collapse:collapse;font:13px/1.2 var(--sans-serif)}table pre,table code,table tt{font-size:inherit;line-height:inherit}th>pre:only-child,td>pre:only-child{margin:0;padding:0}th{color:var(--theme-foreground);text-align:left;vertical-align:bottom}td{color:var(--theme-foreground-alt);vertical-align:top}th,td{padding:3px 6.5px 3px 0}th:last-child,td:last-child{padding-right:0}tr:not(:last-child){border-bottom:solid 1px var(--theme-foreground-faintest)}thead tr{border-bottom:solid 1px var(--theme-foreground-fainter)}figure,table{margin:1rem 0}figure img{max-width:100%}figure>h2,figure>h3{font-family:var(--sans-serif)}figure>h2{font-size:20px}figure>h3{font-size:16px;font-weight:400}figcaption{font:small var(--sans-serif);color:var(--theme-foreground-muted)}a[href].observablehq-header-anchor{color:inherit}:root{--font-big: 700 32px/1 var(--sans-serif);--font-small: 14px var(--sans-serif)}.big{font:var(--font-big)}.small{font:var(--font-small)}.red{color:var(--theme-red)}.yellow{color:var(--theme-yellow)}.green{color:var(--theme-green)}.blue{color:var(--theme-blue)}.muted{color:var(--theme-foreground-muted)}.observablehq--draft>h1:first-of-type:after{content:" [DRAFT]";color:var(--theme-foreground-muted)}:root{--theme-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M5 7L8.125 9.5L11.25 7' stroke='black' stroke-width='1.5' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");--theme-toggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m10.5,11 2.5-3-2.5-3 M6,8h7' fill='none' stroke='black' stroke-width='2'/%3E%3Crect x='2' y='2' fill='currentColor' height='12' rx='0.5' width='2'/%3E%3C/svg%3E");--theme-magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath stroke='currentColor' stroke-width='2' fill='none' d='M15,15L10.5,10.5a3,3 0 1,0 -6 -6a3,3 0 1,0 6 6'%3E%3C/path%3E%3C/svg%3E")}#observablehq-main,#observablehq-header,#observablehq-footer{margin:1rem auto;max-width:1152px}#observablehq-main{min-height:calc(100vh - 20rem);position:relative;z-index:0}#observablehq-footer{display:block;margin-top:10rem;font:12px var(--sans-serif);color:var(--theme-foreground-faint)}#observablehq-footer nav{display:grid;max-width:640px;grid-template-columns:1fr 1fr;column-gap:1rem;margin-bottom:1rem}#observablehq-footer nav a{display:flex;flex-direction:column;border:1px solid var(--theme-foreground-fainter);border-radius:8px;padding:1rem;line-height:1rem;text-decoration:none}#observablehq-footer nav a span{font-size:14px}#observablehq-footer nav a:hover span{text-decoration:underline}#observablehq-footer nav a:hover{border-color:var(--theme-foreground-focus)}#observablehq-footer nav a[rel=prev]{grid-column:1;align-items:start}#observablehq-footer nav a[rel=next]{grid-column:2;align-items:end}#observablehq-footer nav a:before{color:var(--theme-foreground-faint)}#observablehq-footer nav a[rel=prev]:before{content:"Previous page"}#observablehq-footer nav a[rel=next]:before{content:"Next page"}#observablehq-center{margin:1rem 2rem}#observablehq-sidebar{position:fixed;background:var(--theme-background-alt);color:var(--theme-foreground-muted);font:14px var(--sans-serif);visibility:hidden;font-weight:500;width:272px;z-index:2;top:0;bottom:0;left:-272px;box-sizing:border-box;padding:0 .5rem 1rem;overflow-y:auto}#observablehq-sidebar ol,#observablehq-toc ol{list-style:none;margin:0;padding:0}#observablehq-sidebar>ol,#observablehq-sidebar>details,#observablehq-sidebar>section{position:relative;padding-bottom:.5rem;margin:.5rem 0;border-bottom:solid 1px var(--theme-foreground-faintest)}#observablehq-sidebar>ol:first-child{position:sticky;top:0;z-index:1;background:var(--theme-background-alt);font-size:16px;font-weight:700;padding-top:1rem;padding-left:.5rem;margin:0;margin-left:-.5rem;color:var(--theme-foreground)}#observablehq-sidebar>ol:last-child,#observablehq-sidebar>details:last-child,#observablehq-sidebar>section:last-child{border-bottom:none}#observablehq-sidebar summary{font-weight:700;color:var(--theme-foreground);cursor:default}#observablehq-sidebar summary::-webkit-details-marker,#observablehq-sidebar summary::marker{display:none}#observablehq-sidebar details summary:after{position:absolute;right:0;width:1rem;height:1rem;background:var(--theme-foreground-muted);content:"";-webkit-mask:var(--theme-caret);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask:var(--theme-caret);mask-repeat:no-repeat;mask-position:center;padding:.5rem;transition:transform .25s ease;transform:rotate(-90deg);transform-origin:50% 50%}#observablehq-sidebar details summary:hover:after{color:var(--theme-foreground)}#observablehq-sidebar details[open] summary:after{transform:rotate(0)}#observablehq-sidebar-toggle{position:fixed;appearance:none;background:none;top:0;left:0;height:100%;width:2rem;display:flex;align-items:center;justify-content:center;cursor:e-resize;margin:0;color:var(--theme-foreground-muted);z-index:1}#observablehq-sidebar-close{position:absolute;top:1rem;right:0;width:2rem;height:2.2rem;display:flex;align-items:center;justify-content:center;color:var(--theme-foreground-muted);cursor:w-resize;z-index:2}#observablehq-sidebar-toggle:before,#observablehq-sidebar-close:before{content:"";width:1rem;height:1rem;background:currentColor;-webkit-mask:var(--theme-toggle);mask:var(--theme-toggle)}#observablehq-sidebar-close:before{transform:scaleX(-1)}#observablehq-sidebar summary,.observablehq-link a{display:flex;padding:.5rem 1rem .5rem 1.5rem;margin-left:-.5rem;align-items:center}#observablehq-sidebar summary a{flex-grow:1;color:inherit}#observablehq-sidebar summary.observablehq-link{padding:0;margin-left:0}#observablehq-sidebar details summary:hover,.observablehq-link-active a,.observablehq-link a:hover{background:var(--theme-background)}.observablehq-link a:hover{color:var(--theme-foreground-focus)}#observablehq-toc{display:none;position:fixed;color:var(--theme-foreground-muted);font:400 14px var(--sans-serif);z-index:1;top:0;right:0;bottom:0;overflow-y:auto}#observablehq-toc nav{width:192px;margin:2rem 0;padding:0 1rem;box-sizing:border-box;border-left:solid 1px var(--theme-foreground-faintest)}#observablehq-toc div{font-weight:700;color:var(--theme-foreground);margin-bottom:.5rem}.observablehq-secondary-link a{display:block;padding:.25rem 0}.observablehq-link:not(.observablehq-link-active) a[href]:not(:hover),.observablehq-secondary-link:not(.observablehq-secondary-link-active) a[href]:not(:hover){color:inherit}.observablehq-link-active,.observablehq-secondary-link-active{position:relative}.observablehq-link-active:before,.observablehq-secondary-link-highlight{content:"";position:absolute;width:3px;background:var(--theme-foreground-focus)}.observablehq-link-active:before{top:0;bottom:0;left:-.5rem}.observablehq-secondary-link-highlight{left:1px;top:2rem;height:0;transition:top .15s ease,height .15s ease}#observablehq-sidebar{transition:visibility .15s 0ms,left .15s 0ms ease}#observablehq-sidebar:focus-within,#observablehq-sidebar-toggle:checked~#observablehq-sidebar{left:0;visibility:initial;box-shadow:0 0 8px 4px #0000001a;transition:visibility 0ms 0ms,left .15s 0ms ease}#observablehq-sidebar-backdrop{display:none;position:fixed;inset:0;z-index:2}#observablehq-sidebar-backdrop:has(~#observablehq-sidebar:focus-within),#observablehq-sidebar-toggle:checked~#observablehq-sidebar-backdrop{display:initial}@media (prefers-color-scheme: dark){#observablehq-sidebar:focus-within,#observablehq-sidebar-toggle:checked~#observablehq-sidebar{box-shadow:0 0 8px 4px #00000080}}@media (min-width: calc(912px + 6rem)){#observablehq-sidebar{transition:none!important}#observablehq-sidebar-toggle:checked~#observablehq-sidebar-backdrop{display:none}#observablehq-sidebar-toggle:checked~#observablehq-sidebar,#observablehq-sidebar-toggle:indeterminate~#observablehq-sidebar{left:0;visibility:initial;box-shadow:none;border-right:solid 1px var(--theme-foreground-faintest)}#observablehq-sidebar-toggle:checked~#observablehq-center,#observablehq-sidebar-toggle:indeterminate~#observablehq-center{padding-left:calc(272px + 1rem);padding-right:1rem}}@media (min-width: calc(832px + 6rem)){#observablehq-toc~#observablehq-center{padding-right:calc(192px + 1rem)}#observablehq-toc{display:block}}@media (min-width: calc(912px + 6rem)){#observablehq-sidebar-toggle:checked~#observablehq-toc,#observablehq-sidebar-toggle:indeterminate~#observablehq-toc{display:none}}@media (min-width: calc(1104px + 6rem)){#observablehq-sidebar-toggle:checked~#observablehq-toc,#observablehq-sidebar-toggle:indeterminate~#observablehq-toc,#observablehq-toc{display:block}#observablehq-sidebar-toggle:checked~#observablehq-toc~#observablehq-center,#observablehq-sidebar-toggle:indeterminate~#observablehq-toc~#observablehq-center,#observablehq-toc~#observablehq-center{padding-right:calc(192px + 1rem)}}.observablehq-pre-container{position:relative;margin:1rem -1rem;max-width:960px}.observablehq-pre-container:after{position:absolute;top:0;right:0;height:21px;font:12px var(--sans-serif);color:var(--theme-foreground-muted);background:linear-gradient(to right,transparent,var(--theme-background-alt) 40%);padding:.5rem .5rem .5rem 1.5rem}.observablehq-pre-container[data-language]:after{content:attr(data-language)}.observablehq-pre-container pre{padding-right:4rem;margin:0;max-width:none}.observablehq-pre-copy{position:absolute;top:0;right:0;background:none;color:transparent;border:none;border-radius:4px;padding:0 8px;margin:4px;height:29px;cursor:pointer;z-index:1;display:flex;align-items:center}.observablehq-pre-copied:before{content:"Copied!";position:absolute;right:calc(100% + .25rem);background:linear-gradient(to right,transparent,var(--theme-background-alt) 10%);color:var(--theme-green);font:var(--font-small);padding:4px 8px 4px 16px;pointer-events:none;animation-name:observablehq-pre-copied;animation-duration:.25s;animation-direction:alternate;animation-iteration-count:2}@keyframes observablehq-pre-copied{0%{opacity:0;transform:translate(.5rem)}50%{opacity:1}to{transform:translate(0)}}.observablehq-pre-container[data-copy] .observablehq-pre-copy,.observablehq-pre-container:hover .observablehq-pre-copy,.observablehq-pre-container .observablehq-pre-copy:focus{background:var(--theme-background-alt);color:var(--theme-foreground-faint)}.observablehq-pre-container .observablehq-pre-copy:hover{color:var(--theme-foreground-muted)}.observablehq-pre-container .observablehq-pre-copy:active{color:var(--theme-foreground);background:var(--theme-foreground-faintest)}#observablehq-sidebar.observablehq-search-results>ol:not(:first-child),#observablehq-sidebar.observablehq-search-results>details,#observablehq-sidebar.observablehq-search-results>section{display:none}#observablehq-search{position:relative;padding:.5rem 0 0;display:flex;align-items:center}#observablehq-search input{padding:6px 4px 6px 2.2em;width:100%;border:none;border-radius:4px;background-color:var(--theme-background);font-size:13.3px;height:28px}#observablehq-search input::placeholder{color:var(--theme-foreground-faint)}#observablehq-search:before{position:absolute;left:.5rem;content:"";width:1rem;height:1rem;background:currentColor;-webkit-mask:var(--theme-magnifier);mask:var(--theme-magnifier);pointer-events:none}#observablehq-search:after{position:absolute;right:6px;content:attr(data-shortcut);pointer-events:none}#observablehq-search:focus-within:after{content:""}#observablehq-search-results{--relevance-width: 32px;position:absolute;overflow-y:auto;top:6.5rem;left:0;right:.5rem;bottom:0}#observablehq-search-results a span{max-width:184px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#observablehq-search-results div{text-align:right;font-size:10px;margin:.5em}#observablehq-search-results li{position:relative;display:flex;align-items:center}#observablehq-search-results a{flex-grow:1}#observablehq-search-results li:after,#observablehq-search-results a span:after{content:"";width:var(--relevance-width);height:4px;position:absolute;top:14px;right:.5em;border-radius:2px;background:var(--theme-foreground-muted)}#observablehq-search-results li.observablehq-link-active:after{background:var(--theme-foreground-focus)}#observablehq-search-results a span:after{background:var(--theme-foreground-faintest)}#observablehq-search-results li[data-score="0"]:after{width:calc(var(--relevance-width) * .125)}#observablehq-search-results li[data-score="1"]:after{width:calc(var(--relevance-width) * .25)}#observablehq-search-results li[data-score="2"]:after{width:calc(var(--relevance-width) * .4375)}#observablehq-search-results li[data-score="3"]:after{width:calc(var(--relevance-width) * .625)}#observablehq-search-results li[data-score="4"]:after{width:calc(var(--relevance-width) * .8125)}@media print{#observablehq-center{padding-left:1em!important}#observablehq-sidebar,#observablehq-footer{display:none!important}}#observablehq-center{container-type:inline-size}.grid{margin:1rem 0;display:grid;gap:1rem;grid-auto-rows:1fr}.grid svg{overflow:visible}.grid figure{margin:0}.grid>*>p:first-child{margin-top:0}.grid>*>p:last-child{margin-bottom:0}@container (min-width: 640px){.grid-cols-2,.grid-cols-4{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-2 .grid-colspan-2,.grid-cols-2 .grid-colspan-3,.grid-cols-2 .grid-colspan-4,.grid-cols-4 .grid-colspan-2,.grid-cols-4 .grid-colspan-3,.grid-cols-4 .grid-colspan-4{grid-column:span 2}}@container (min-width: 720px){.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-3 .grid-colspan-2{grid-column:span 2}.grid-cols-3 .grid-colspan-3{grid-column:span 3}}@container (min-width: 1080px){.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-4 .grid-colspan-3{grid-column:span 3}.grid-cols-4 .grid-colspan-4{grid-column:span 4}}.grid-rowspan-2{grid-row:span 2}.grid-rowspan-3{grid-row:span 3}.grid-rowspan-4{grid-row:span 4}.note,.tip,.warning,.caution{border-left:solid 1px;border-radius:0 4px 4px 0;padding:1rem 2rem;margin:1rem 0;box-sizing:border-box;max-width:640px}.note:before,.tip:before,.warning:before,.caution:before{display:block;margin-bottom:1rem;font-weight:700}.note{border-left-color:var(--theme-foreground-fainter);background-color:var(--theme-background-alt)}.note:before{content:"Note";color:var(--theme-foreground-muted)}.tip{border-left-color:var(--theme-green);background-color:color-mix(in srgb,var(--theme-green),var(--theme-background) 90%)}.tip:before{content:"Tip";color:var(--theme-green)}.warning{border-left-color:var(--theme-yellow);background-color:color-mix(in srgb,var(--theme-yellow),var(--theme-background) 90%)}.warning:before{content:"Warning";color:var(--theme-yellow)}.caution{border-left-color:var(--theme-red);background-color:color-mix(in srgb,var(--theme-red),var(--theme-background) 90%)}.caution:before{content:"Caution";color:var(--theme-red)}.note[label]:before,.tip[label]:before,.warning[label]:before,.caution[label]:before{content:attr(label)}.note>:first-child,.tip>:first-child,.warning>:first-child,.caution>:first-child{margin-top:0}.note>:last-child,.tip>:last-child,.warning>:last-child,.caution>:last-child{margin-bottom:0}.card{background:var(--theme-background-alt);border:solid 1px var(--theme-foreground-faintest);border-radius:.75rem;padding:1rem;margin:1rem 0;font:14px var(--sans-serif)}.grid>.card,.card figure{margin:0}.card h2,.card h3{font-size:inherit}.card h2{font-weight:500;font-size:15px}.card h3{font-weight:400;color:var(--theme-foreground-muted)}.card h2~svg,.card h3~svg,.card h2~p,.card h3~p{margin-top:1rem}.observablehq--block:empty{margin:0}@keyframes observablehq-loading{0%{transform:rotate(0)}to{transform:rotate(360deg)}}observablehq-loading{font:var(--monospace-font);color:var(--theme-foreground-muted);display:inline-block;transform-origin:.32em 55%;animation-name:observablehq-loading;animation-timing-function:linear;animation-duration:1s;animation-iteration-count:infinite}observablehq-loading:before{content:"\21bb"}.observablehq--block observablehq-loading{display:block}.observablehq--block{margin:1rem 0}.observablehq--block .observablehq,.observablehq--block .observablehq--inspect{display:block}.observablehq--collapsed,.observablehq--expanded.observablehq--inspect a{cursor:pointer}.observablehq--caret{margin-right:4px;vertical-align:baseline}.observablehq--field{text-indent:-1rem;margin-left:1rem}.observablehq--inspect{font:var(--monospace-font);overflow-x:auto;white-space:pre}.observablehq--inspect.observablehq--import{white-space:normal}.observablehq--inspect::-webkit-scrollbar{display:none}.observablehq--error .observablehq--inspect{word-break:break-all;white-space:pre-wrap}.observablehq--string-expand{margin-left:6px;padding:2px 6px;border-radius:2px;font-size:80%;background:var(--theme-background-alt);cursor:pointer;vertical-align:middle}.observablehq--keyword,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:var(--syntax-keyword)}.observablehq--symbol,.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:var(--syntax-entity)}.observablehq--index,.observablehq--key,.hljs-attr,.hljs-attribute,.hljs-meta,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:var(--syntax-constant)}.observablehq--regexp,.observablehq--string,.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:var(--syntax-string)}.observablehq--null,.observablehq--undefined,.hljs-built_in,.hljs-literal,.hljs-symbol{color:var(--syntax-variable)}.observablehq--prototype-key,.observablehq--empty,.hljs-comment,.hljs-formula{color:var(--syntax-comment)}.observablehq--bigint,.observablehq--boolean,.observablehq--date,.observablehq--forbidden,.observablehq--number,.hljs-name,.hljs-number,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:var(--syntax-entity-tag)}.hljs-subst{color:var(--syntax-storage-modifier-import)}.hljs-section{color:var(--syntax-markup-heading);font-weight:700}.hljs-bullet{color:var(--syntax-markup-list)}.hljs-emphasis{color:var(--syntax-markup-italic);font-style:italic}.hljs-strong{color:var(--syntax-markup-bold);font-weight:700}.hljs-addition{color:var(--syntax-markup-inserted);background-color:var(--syntax-markup-inserted-background)}.hljs-deletion{color:var(--syntax-markup-deleted);background-color:var(--syntax-markup-deleted-background)}.observablehq--empty{font-style:oblique}.observablehq--error{color:var(--syntax-keyword)}.plot-d6a7b5{--plot-background: var(--theme-background)}p .plot-d6a7b5{display:inline-block}@media (prefers-color-scheme: light){:root{--syntax-keyword: #d73a49;--syntax-entity: #6f42c1;--syntax-constant: #005cc5;--syntax-string: #032f62;--syntax-variable: #e36209;--syntax-comment: var(--theme-foreground-muted);--syntax-entity-tag: #22863a;--syntax-storage-modifier-import: #24292e;--syntax-markup-heading: #005cc5;--syntax-markup-list: #735c0f;--syntax-markup-italic: #24292e;--syntax-markup-bold: #24292e;--syntax-markup-inserted: #22863a;--syntax-markup-inserted-background: #f0fff4;--syntax-markup-deleted: #b31d28;--syntax-markup-deleted-background: #ffeef0}}@media (prefers-color-scheme: light){:root{--theme-background-b: color-mix(in srgb, var(--theme-foreground) 4%, var(--theme-background-a));--theme-background: var(--theme-background-a);--theme-background-alt: var(--theme-background-b);--theme-foreground-alt: color-mix(in srgb, var(--theme-foreground) 90%, var(--theme-background-a));--theme-foreground-muted: color-mix(in srgb, var(--theme-foreground) 60%, var(--theme-background-a));--theme-foreground-faint: color-mix(in srgb, var(--theme-foreground) 50%, var(--theme-background-a));--theme-foreground-fainter: color-mix(in srgb, var(--theme-foreground) 30%, var(--theme-background-a));--theme-foreground-faintest: color-mix(in srgb, var(--theme-foreground) 14%, var(--theme-background-a));color-scheme:light}}@media (prefers-color-scheme: light){:root{--theme-foreground: #1b1e23;--theme-foreground-focus: #3b5fc0;--theme-background-a: #ffffff}}@media (prefers-color-scheme: dark){:root{--syntax-keyword: #ff7b72;--syntax-entity: #d2a8ff;--syntax-constant: #79c0ff;--syntax-string: #a5d6ff;--syntax-variable: #ffa657;--syntax-comment: var(--theme-foreground-muted);--syntax-entity-tag: #7ee787;--syntax-storage-modifier-import: #c9d1d9;--syntax-markup-heading: #1f6feb;--syntax-markup-list: #f2cc60;--syntax-markup-italic: #c9d1d9;--syntax-markup-bold: #c9d1d9;--syntax-markup-inserted: #aff5b4;--syntax-markup-inserted-background: #033a16;--syntax-markup-deleted: #ffdcd7;--syntax-markup-deleted-background: #67060c}}@media (prefers-color-scheme: dark){:root{--theme-background-a: color-mix(in srgb, var(--theme-foreground) 4%, var(--theme-background-b));--theme-background: var(--theme-background-a);--theme-background-alt: var(--theme-background-b);--theme-foreground-alt: color-mix(in srgb, var(--theme-foreground) 90%, var(--theme-background-b));--theme-foreground-muted: color-mix(in srgb, var(--theme-foreground) 60%, var(--theme-background-b));--theme-foreground-faint: color-mix(in srgb, var(--theme-foreground) 50%, var(--theme-background-b));--theme-foreground-fainter: color-mix(in srgb, var(--theme-foreground) 30%, var(--theme-background-b));--theme-foreground-faintest: color-mix(in srgb, var(--theme-foreground) 14%, var(--theme-background-b));color-scheme:dark}}@media (prefers-color-scheme: dark){:root{--theme-foreground: #dfdfd6;--theme-foreground-focus: oklch(.712564 .257662 265.758);--theme-background-b: #161616}} diff --git a/isamples_export_client/ui/data_source.html b/isamples_export_client/ui/data_source.html index d942bf4..3459080 100644 --- a/isamples_export_client/ui/data_source.html +++ b/isamples_export_client/ui/data_source.html @@ -26,7 +26,7 @@ return {default_data_source,source_entry}; }}); -define({id: "efa45c6e", inline: true, inputs: ["source_entry","display"], body: async (source_entry,display) => { +define({id: "efa45c6e", mode: "inline", inputs: ["source_entry","display"], body: async (source_entry,display) => { display(await( source_entry )) @@ -40,17 +40,15 @@ -
    -
    - Viewer -
      +
      + Viewer +
        -
      -
      -
    +
+
-
-

+
+