@influxdata/influxdb3-client-browser 0.13.0-nightly.7641 → 1.1.0-nightly.8102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.gz +0 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +6 -6
- package/dist/index.browser.mjs.gz +0 -0
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +6 -6
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.gz +0 -0
- package/dist/index.mjs.map +1 -1
- package/dist/influxdb.js +11 -11
- package/dist/influxdb.js.gz +0 -0
- package/dist/influxdb.js.map +1 -1
- package/package.json +3 -3
package/dist/influxdb.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";var influxdb=(()=>{var
|
|
2
|
-
\r `,["\\,","\\ ","\\n","\\r","\\t"]),quoted:
|
|
3
|
-
\r `,["\\,","\\ ","\\=","\\n","\\r","\\t"])};var qc="000000000";function Kc(r){return!1}Kc(!0);var Wc=Date.now(),Yo=0;function Zo(){{let r=Date.now();r!==Wc?(Wc=r,Yo=0):Yo++;let t=String(Yo);return String(r)+qc.substr(0,6-t.length)+t}}function $c(){return String(Date.now())+qc.substr(0,3)}function Hc(){return String(Date.now())}function Jc(){return String(Math.floor(Date.now()/1e3))}var Gc={s:Jc,ms:Hc,us:$c,ns:Zo,seconds:Jc,millis:Hc,micros:$c,nanos:Zo},Xc={s:r=>`${Math.floor(r.getTime()/1e3)}`,ms:r=>`${r.getTime()}`,us:r=>`${r.getTime()}000`,ns:r=>`${r.getTime()}000000`};function Qo(r){return r===void 0?Zo():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?`${r.getTime()}000000`:String(typeof r=="number"?Math.floor(r):r)}var ta=(r,t="ns")=>r===void 0?Gc[t]():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?Xc[t](r):String(typeof r=="number"?Math.floor(r):r);var qr=r=>{throw r},Yc=r=>r!==void 0,Zc=r=>r instanceof Array||r instanceof Object&&typeof r.length=="number"&&(r.length===0||Object.getOwnPropertyNames(r).some(t=>t==="0")),Qc=r=>{let t=new Uint8Array(4);return t[0]=r>>0,t[1]=r>>8,t[2]=r>>16,t[3]=r>>24,t},tl=async r=>{let t=[];for await(let e of r)t.push(e);return t};var ea=(r,t)=>{let e=Zc(r)&&typeof r!="string"?Array.from(r):[r];return e.length===0?[]:typeof e[0]=="string"?e:e.map(n=>n.toLineProtocol(void 0,t)).filter(Yc)};var Af=r=>typeof r=="number"?"float":typeof r=="string"?"string":typeof r=="boolean"?"boolean":void 0,zn=class r extends Error{constructor(t,e,i){super(`field ${t} of type ${i} doesn't match expected type ${e}!`),this.name="GetFieldTypeMissmatchError",Object.setPrototypeOf(this,r.prototype)}},cr=class r{constructor(){this._tags={};this._fields={}}getMeasurement(){return this._name}setMeasurement(t){return this._name=t,this}getTimestamp(){return this._time}setTimestamp(t){return this._time=t,this}getTag(t){return this._tags[t]}setTag(t,e){return this._tags[t]=e,this}removeTag(t){return delete this._tags[t],this}getTagNames(){return Object.keys(this._tags)}getFloatField(t){return this.getField(t,"float")}setFloatField(t,e){let i;if(typeof e=="number"?i=e:i=parseFloat(e),!isFinite(i))throw new Error(`invalid float value for field '${t}': '${e}'!`);return this._fields[t]=["float",i],this}getIntegerField(t){return this.getField(t,"integer")}setIntegerField(t,e){let i;if(typeof e=="number"?i=e:i=parseInt(String(e)),isNaN(i)||i<=-9223372036854776e3||i>=9223372036854776e3)throw new Error(`invalid integer value for field '${t}': '${e}'!`);return this._fields[t]=["integer",Math.floor(i)],this}getUintegerField(t){return this.getField(t,"uinteger")}setUintegerField(t,e){if(typeof e=="number"){if(isNaN(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${t}' out of range: ${e}`);this._fields[t]=["uinteger",Math.floor(e)]}else{let i=String(e);for(let n=0;n<i.length;n++){let s=i.charCodeAt(n);if(s<48||s>57)throw new Error(`uint value has an unsupported character at pos ${n}: ${e}`)}if(i.length>20||i.length===20&&i.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${t}' out of range: ${i}`);this._fields[t]=["uinteger",+i]}return this}getStringField(t){return this.getField(t,"string")}setStringField(t,e){return e!=null&&(typeof e!="string"&&(e=String(e)),this._fields[t]=["string",e]),this}getBooleanField(t){return this.getField(t,"boolean")}setBooleanField(t,e){return this._fields[t]=["boolean",!!e],this}getField(t,e){let i=this._fields[t];if(!i)return;let[n,s]=i;if(e!==void 0&&e!==n)throw new zn(t,e,n);return s}getFieldType(t){let e=this._fields[t];if(e)return e[0]}setField(t,e,i){switch(i!=null?i:Af(e)){case"string":return this.setStringField(t,e);case"boolean":return this.setBooleanField(t,e);case"float":return this.setFloatField(t,e);case"integer":return this.setIntegerField(t,e);case"uinteger":return this.setUintegerField(t,e);case void 0:return this;default:throw new Error(`invalid field type for field '${t}': type -> ${i}, value -> ${e}!`)}}setFields(t){for(let[e,i]of Object.entries(t))this.setField(e,i);return this}removeField(t){return delete this._fields[t],this}getFieldNames(){return Object.keys(this._fields)}hasFields(){return this.getFieldNames().length>0}copy(){let t=new r;return t._name=this._name,t._time=this._time,t._tags=Object.fromEntries(Object.entries(this._tags)),t._fields=Object.fromEntries(Object.entries(this._fields).map(e=>[...e])),t}asPoint(t){return Si.fromValues(t?this.setMeasurement(t):this)}};var Nf=(r,t)=>{switch(r){case"string":return Ne.quoted(t);case"boolean":return t?"T":"F";case"float":return`${t}`;case"integer":return`${t}i`;case"uinteger":return`${t}u`}},Si=class r{constructor(t){t instanceof cr?this._values=t:this._values=new cr,typeof t=="string"&&this._values.setMeasurement(t)}static measurement(t){return new r(t)}static fromValues(t){if(!t.getMeasurement()||t.getMeasurement()==="")throw new Error("Cannot convert values to point without measurement set!");return new r(t)}getMeasurement(){return this._values.getMeasurement()}setMeasurement(t){return t!==""&&this._values.setMeasurement(t),this}getTimestamp(){return this._values.getTimestamp()}setTimestamp(t){return this._values.setTimestamp(t),this}getTag(t){return this._values.getTag(t)}setTag(t,e){return this._values.setTag(t,e),this}removeTag(t){return this._values.removeTag(t),this}getTagNames(){return this._values.getTagNames()}getFloatField(t){return this._values.getFloatField(t)}setFloatField(t,e){return this._values.setFloatField(t,e),this}getIntegerField(t){return this._values.getIntegerField(t)}setIntegerField(t,e){return this._values.setIntegerField(t,e),this}getUintegerField(t){return this._values.getUintegerField(t)}setUintegerField(t,e){return this._values.setUintegerField(t,e),this}getStringField(t){return this._values.getStringField(t)}setStringField(t,e){return this._values.setStringField(t,e),this}getBooleanField(t){return this._values.getBooleanField(t)}setBooleanField(t,e){return this._values.setBooleanField(t,e),this}getField(t,e){return this._values.getField(t,e)}getFieldType(t){return this._values.getFieldType(t)}setField(t,e,i){return this._values.setField(t,e,i),this}setFields(t){return this._values.setFields(t),this}removeField(t){return this._values.removeField(t),this}getFieldNames(){return this._values.getFieldNames()}hasFields(){return this._values.hasFields()}copy(){return new r(this._values.copy())}toLineProtocol(t,e){if(!this._values.getMeasurement())return;let i="";if(this._values.getFieldNames().sort().forEach(a=>{if(a){let c=this._values.getFieldType(a),l=this._values.getField(a);if(c===void 0||l===void 0)return;let u=Nf(c,l);i.length>0&&(i+=","),i+=`${Ne.tag(a)}=${u}`}}),i.length===0)return;let n="",s=this._values.getTagNames();if(e){let a=new Set(s),c=Object.keys(e);for(let l=c.length;l--;)a.has(c[l])&&c.splice(l,1);c.sort().forEach(l=>{if(l){let u=e[l];u&&(n+=",",n+=`${Ne.tag(l)}=${Ne.tag(u)}`)}})}s.sort().forEach(a=>{if(a){let c=this._values.getTag(a);c&&(n+=",",n+=`${Ne.tag(a)}=${Ne.tag(c)}`)}});let o=this._values.getTimestamp();return t?typeof t=="string"?o=ta(o,t):o=t(o):o=Qo(o),`${Ne.measurement(this.getMeasurement())}${n} ${i}${o!==void 0?` ${o}`:""}`}toString(){let t=this.toLineProtocol(void 0);return t||`invalid point: ${JSON.stringify(this,void 0)}`}};function ra(r={}){let t=0,e={next:i=>{if(t===0&&r.next&&i!==null&&i!==void 0)return r.next(i)},error:i=>{t===0&&(t=1,r.error&&r.error(i))},complete:()=>{t===0&&(t=2,r.complete&&r.complete())},responseStarted:(i,n)=>{r.responseStarted&&r.responseStarted(i,n)}};return r.useCancellable&&(e.useCancellable=r.useCancellable.bind(r)),r.useResume&&(e.useResume=r.useResume.bind(r)),e}function Wn(r){let t={};return r.headers.forEach((e,i)=>{let n=t[i];n===void 0?t[i]=e:Array.isArray(n)?n.push(e):t[i]=[n,e]}),t}var xi=class{constructor(t){this._connectionOptions=t;this.chunkCombiner=Ho();this.requestDecorator=function(){};var e;if(this._defaultHeaders={"content-type":"application/json; charset=utf-8",...t.headers},this._connectionOptions.token){let i=(e=this._connectionOptions.authScheme)!=null?e:"Token";this._defaultHeaders.Authorization=`${i} ${this._connectionOptions.token}`}this._url=String(this._connectionOptions.host),this._url.endsWith("/")&&(this._url=this._url.substring(0,this._url.length-1)),this._url.endsWith("/api/v2")&&(this._url=this._url.substring(0,this._url.length-7),Br.warn(`Please remove '/api/v2' context path from InfluxDB base url, using ${this._url} !`))}send(t,e,i,n){let s=ra(n),o=!1,a=i.signal,c,l=()=>{},u=l;if(n&&n.useCancellable){let d=new AbortController;a||(a=d.signal,i={...i,signal:a}),a.addEventListener("abort",()=>{u()}),n.useCancellable({cancel(){o=!0,d.abort()},isCancelled(){return o||a.aborted}})}this._fetch(t,e,i).then(async d=>{if(n!=null&&n.responseStarted&&s.responseStarted(Wn(d),d.status),await this._throwOnErrorResponse(d),d.body){let p=d.body.getReader(),v;do{if(c&&await c,o)break;if(v=await p.read(),s.next(v.value)===!1){let _=s.useResume;if(!_){let X="Unable to pause, useResume is not configured!";return await p.cancel(X),Promise.reject(new Error(X))}c=new Promise(X=>{u=()=>{X(),c=void 0,u=l},_(u)})}}while(!v.done)}else if(d.arrayBuffer){let p=await d.arrayBuffer();s.next(new Uint8Array(p))}else{let p=await d.text();s.next(new TextEncoder().encode(p))}}).catch(d=>{o||s.error(d)}).finally(()=>s.complete())}async _throwOnErrorResponse(t){if(t.status>=300){let e="";try{if(e=await t.text(),!e){let i=t.headers.get("x-influxdb-error");i&&(e=i)}}catch(i){throw Br.warn("Unable to receive error body",i),new Ae(t.status,t.statusText,void 0,t.headers.get("content-type"),Wn(t))}throw new Ae(t.status,t.statusText,e,t.headers.get("content-type"),Wn(t))}}async*iterate(t,e,i){var s;let n=await this._fetch(t,e,i);if(await this._throwOnErrorResponse(n),n.body){let o=n.body.getReader();for(;;){let{value:a,done:c}=await o.read();if(c)break;if((s=i.signal)!=null&&s.aborted)throw await n.body.cancel(),new Ii;yield a}}else if(n.arrayBuffer){let o=await n.arrayBuffer();yield new Uint8Array(o)}else{let o=await n.text();yield new TextEncoder().encode(o)}}async request(t,e,i,n){var l,u;let s=await this._fetch(t,e,i),{headers:o}=s,a=o.get("content-type")||"";n&&n(Wn(s),s.status),await this._throwOnErrorResponse(s);let c=(u=(l=i.headers)==null?void 0:l.accept)!=null?u:a;if(c.includes("json"))return await s.json();if(c.includes("text")||c.startsWith("application/csv"))return await s.text()}_fetch(t,e,i){let{method:n,headers:s,...o}=i,a=`${this._url}${t}`,c={method:n,body:n==="GET"||n==="HEAD"?void 0:typeof e=="string"?e:JSON.stringify(e),headers:{...this._defaultHeaders,...s},credentials:"omit",...this._connectionOptions.transportOptions,...o};return this.requestDecorator(c,i,a),fetch(a,c)}};function Or(r){let t=typeof r;if(t=="object"){if(Array.isArray(r))return"array";if(r===null)return"null"}return t}function ia(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}var Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),$n=[];for(let r=0;r<Ee.length;r++)$n[Ee[r].charCodeAt(0)]=r;$n[45]=Ee.indexOf("+");$n[95]=Ee.indexOf("/");function Ti(r){let t=r.length*3/4;r[r.length-2]=="="?t-=2:r[r.length-1]=="="&&(t-=1);let e=new Uint8Array(t),i=0,n=0,s,o=0;for(let a=0;a<r.length;a++){if(s=$n[r.charCodeAt(a)],s===void 0)switch(r[a]){case"=":n=0;case`
|
|
4
|
-
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(n){case 0:o=s,n=1;break;case 1:e[i++]=o<<2|(s&48)>>4,o=s,n=2;break;case 2:e[i++]=(o&15)<<4|(s&60)>>2,o=s,n=3;break;case 3:e[i++]=(o&3)<<6|s,n=0;break}}if(n==1)throw Error("invalid base64 string.");return e.subarray(0,i)}function Bi(r){let t="",e=0,i,n=0;for(let s=0;s<r.length;s++)switch(i=r[s],e){case 0:t+=Ee[i>>2],n=(i&3)<<4,e=1;break;case 1:t+=Ee[n|i>>4],n=(i&15)<<2,e=2;break;case 2:t+=Ee[n|i>>6],t+=Ee[i&63],e=0;break}return e&&(t+=Ee[n],t+="=",e==1&&(t+="=")),t}var Dr;(function(r){r.symbol=Symbol.for("protobuf-ts/unknown"),r.onRead=(e,i,n,s,o)=>{(t(i)?i[r.symbol]:i[r.symbol]=[]).push({no:n,wireType:s,data:o})},r.onWrite=(e,i,n)=>{for(let{no:s,wireType:o,data:a}of r.list(i))n.tag(s,o).raw(a)},r.list=(e,i)=>{if(t(e)){let n=e[r.symbol];return i?n.filter(s=>s.no==i):n}return[]},r.last=(e,i)=>r.list(e,i).slice(-1)[0];let t=e=>e&&Array.isArray(e[r.symbol])})(Dr||(Dr={}));function na(r,t){return Object.assign(Object.assign({},r),t)}var nt;(function(r){r[r.Varint=0]="Varint",r[r.Bit64=1]="Bit64",r[r.LengthDelimited=2]="LengthDelimited",r[r.StartGroup=3]="StartGroup",r[r.EndGroup=4]="EndGroup",r[r.Bit32=5]="Bit32"})(nt||(nt={}));function el(){let r=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(r|=(n&127)<<i,!(n&128))return this.assertBounds(),[r,t]}let e=this.buf[this.pos++];if(r|=(e&15)<<28,t=(e&112)>>4,!(e&128))return this.assertBounds(),[r,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(n&127)<<i,!(n&128))return this.assertBounds(),[r,t]}throw new Error("invalid varint")}function Jn(r,t,e){for(let s=0;s<28;s=s+7){let o=r>>>s,a=!(!(o>>>7)&&t==0),c=(a?o|128:o)&255;if(e.push(c),!a)return}let i=r>>>28&15|(t&7)<<4,n=!!(t>>3);if(e.push((n?i|128:i)&255),!!n){for(let s=3;s<31;s=s+7){let o=t>>>s,a=!!(o>>>7),c=(a?o|128:o)&255;if(e.push(c),!a)return}e.push(t>>>31&1)}}var Hn=65536*65536;function sa(r){let t=r[0]=="-";t&&(r=r.slice(1));let e=1e6,i=0,n=0;function s(o,a){let c=Number(r.slice(o,a));n*=e,i=i*e+c,i>=Hn&&(n=n+(i/Hn|0),i=i%Hn)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[t,i,n]}function qn(r,t){if(t>>>0<=2097151)return""+(Hn*t+(r>>>0));let e=r&16777215,i=(r>>>24|t<<8)>>>0&16777215,n=t>>16&65535,s=e+i*6777216+n*6710656,o=i+n*8147497,a=n*2,c=1e7;s>=c&&(o+=Math.floor(s/c),s%=c),o>=c&&(a+=Math.floor(o/c),o%=c);function l(u,d){let p=u?String(u):"";return d?"0000000".slice(p.length)+p:p}return l(a,0)+l(o,a)+l(s,1)}function oa(r,t){if(r>=0){for(;r>127;)t.push(r&127|128),r=r>>>7;t.push(r)}else{for(let e=0;e<9;e++)t.push(r&127|128),r=r>>7;t.push(1)}}function rl(){let r=this.buf[this.pos++],t=r&127;if(!(r&128))return this.assertBounds(),t;if(r=this.buf[this.pos++],t|=(r&127)<<7,!(r&128))return this.assertBounds(),t;if(r=this.buf[this.pos++],t|=(r&127)<<14,!(r&128))return this.assertBounds(),t;if(r=this.buf[this.pos++],t|=(r&127)<<21,!(r&128))return this.assertBounds(),t;r=this.buf[this.pos++],t|=(r&15)<<28;for(let e=5;r&128&&e<10;e++)r=this.buf[this.pos++];if(r&128)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var tt;function Ef(){let r=new DataView(new ArrayBuffer(8));tt=globalThis.BigInt!==void 0&&typeof r.getBigInt64=="function"&&typeof r.getBigUint64=="function"&&typeof r.setBigInt64=="function"&&typeof r.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:r}:void 0}Ef();function il(r){if(!r)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var nl=/^-?[0-9]+$/,Gn=4294967296,Kn=2147483648,Xn=class{constructor(t,e){this.lo=t|0,this.hi=e|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let t=this.hi*Gn+(this.lo>>>0);if(!Number.isSafeInteger(t))throw new Error("cannot convert to safe number");return t}},ut=class r extends Xn{static from(t){if(tt)switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=="")throw new Error("string is no integer");t=tt.C(t);case"number":if(t===0)return this.ZERO;t=tt.C(t);case"bigint":if(!t)return this.ZERO;if(t<tt.UMIN)throw new Error("signed value for ulong");if(t>tt.UMAX)throw new Error("ulong too large");return tt.V.setBigUint64(0,t,!0),new r(tt.V.getInt32(0,!0),tt.V.getInt32(4,!0))}else switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=t.trim(),!nl.test(t))throw new Error("string is no integer");let[e,i,n]=sa(t);if(e)throw new Error("signed value for ulong");return new r(i,n);case"number":if(t==0)return this.ZERO;if(!Number.isSafeInteger(t))throw new Error("number is no integer");if(t<0)throw new Error("signed value for ulong");return new r(t,t/Gn)}throw new Error("unknown value "+typeof t)}toString(){return tt?this.toBigInt().toString():qn(this.lo,this.hi)}toBigInt(){return il(tt),tt.V.setInt32(0,this.lo,!0),tt.V.setInt32(4,this.hi,!0),tt.V.getBigUint64(0,!0)}};ut.ZERO=new ut(0,0);var K=class r extends Xn{static from(t){if(tt)switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=="")throw new Error("string is no integer");t=tt.C(t);case"number":if(t===0)return this.ZERO;t=tt.C(t);case"bigint":if(!t)return this.ZERO;if(t<tt.MIN)throw new Error("signed long too small");if(t>tt.MAX)throw new Error("signed long too large");return tt.V.setBigInt64(0,t,!0),new r(tt.V.getInt32(0,!0),tt.V.getInt32(4,!0))}else switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=t.trim(),!nl.test(t))throw new Error("string is no integer");let[e,i,n]=sa(t);if(e){if(n>Kn||n==Kn&&i!=0)throw new Error("signed long too small")}else if(n>=Kn)throw new Error("signed long too large");let s=new r(i,n);return e?s.negate():s;case"number":if(t==0)return this.ZERO;if(!Number.isSafeInteger(t))throw new Error("number is no integer");return t>0?new r(t,t/Gn):new r(-t,-t/Gn).negate()}throw new Error("unknown value "+typeof t)}isNegative(){return(this.hi&Kn)!==0}negate(){let t=~this.hi,e=this.lo;return e?e=~e+1:t+=1,new r(e,t)}toString(){if(tt)return this.toBigInt().toString();if(this.isNegative()){let t=this.negate();return"-"+qn(t.lo,t.hi)}return qn(this.lo,this.hi)}toBigInt(){return il(tt),tt.V.setInt32(0,this.lo,!0),tt.V.setInt32(4,this.hi,!0),tt.V.getBigInt64(0,!0)}};K.ZERO=new K(0,0);var sl={readUnknownField:!0,readerFactory:r=>new aa(r)};function ol(r){return r?Object.assign(Object.assign({},sl),r):sl}var aa=class{constructor(t,e){this.varint64=el,this.uint32=rl,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.textDecoder=e!=null?e:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let t=this.uint32(),e=t>>>3,i=t&7;if(e<=0||i<0||i>5)throw new Error("illegal tag: field no "+e+" wire type "+i);return[e,i]}skip(t){let e=this.pos;switch(t){case nt.Varint:for(;this.buf[this.pos++]&128;);break;case nt.Bit64:this.pos+=4;case nt.Bit32:this.pos+=4;break;case nt.LengthDelimited:let i=this.uint32();this.pos+=i;break;case nt.StartGroup:let n;for(;(n=this.tag()[1])!==nt.EndGroup;)this.skip(n);break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(e,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return new K(...this.varint64())}uint64(){return new ut(...this.varint64())}sint64(){let[t,e]=this.varint64(),i=-(t&1);return t=(t>>>1|(e&1)<<31)^i,e=e>>>1^i,new K(t,e)}bool(){let[t,e]=this.varint64();return t!==0||e!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new ut(this.sfixed32(),this.sfixed32())}sfixed64(){return new K(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),e=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(e,e+t)}string(){return this.textDecoder.decode(this.bytes())}};function M(r,t){if(!r)throw new Error(t)}function ca(r,t){throw new Error(t!=null?t:"Unexpected object: "+r)}var Lf=34028234663852886e22,Uf=-34028234663852886e22,Mf=4294967295,Rf=2147483647,kf=-2147483648;function Le(r){if(typeof r!="number")throw new Error("invalid int 32: "+typeof r);if(!Number.isInteger(r)||r>Rf||r<kf)throw new Error("invalid int 32: "+r)}function lr(r){if(typeof r!="number")throw new Error("invalid uint 32: "+typeof r);if(!Number.isInteger(r)||r>Mf||r<0)throw new Error("invalid uint 32: "+r)}function Fr(r){if(typeof r!="number")throw new Error("invalid float 32: "+typeof r);if(Number.isFinite(r)&&(r>Lf||r<Uf))throw new Error("invalid float 32: "+r)}var al={writeUnknownFields:!0,writerFactory:()=>new la};function cl(r){return r?Object.assign(Object.assign({},al),r):al}var la=class{constructor(t){this.stack=[],this.textEncoder=t!=null?t:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let t=0;for(let n=0;n<this.chunks.length;n++)t+=this.chunks[n].length;let e=new Uint8Array(t),i=0;for(let n=0;n<this.chunks.length;n++)e.set(this.chunks[n],i),i+=this.chunks[n].length;return this.chunks=[],e}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),e=this.stack.pop();if(!e)throw new Error("invalid state, fork stack empty");return this.chunks=e.chunks,this.buf=e.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,e){return this.uint32((t<<3|e)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(lr(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Le(t),oa(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let e=this.textEncoder.encode(t);return this.uint32(e.byteLength),this.raw(e)}float(t){Fr(t);let e=new Uint8Array(4);return new DataView(e.buffer).setFloat32(0,t,!0),this.raw(e)}double(t){let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t,!0),this.raw(e)}fixed32(t){lr(t);let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t,!0),this.raw(e)}sfixed32(t){Le(t);let e=new Uint8Array(4);return new DataView(e.buffer).setInt32(0,t,!0),this.raw(e)}sint32(t){return Le(t),t=(t<<1^t>>31)>>>0,oa(t,this.buf),this}sfixed64(t){let e=new Uint8Array(8),i=new DataView(e.buffer),n=K.from(t);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(e)}fixed64(t){let e=new Uint8Array(8),i=new DataView(e.buffer),n=ut.from(t);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(e)}int64(t){let e=K.from(t);return Jn(e.lo,e.hi,this.buf),this}sint64(t){let e=K.from(t),i=e.hi>>31,n=e.lo<<1^i,s=(e.hi<<1|e.lo>>>31)^i;return Jn(n,s,this.buf),this}uint64(t){let e=ut.from(t);return Jn(e.lo,e.hi,this.buf),this}};var ll={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},ul={ignoreUnknownFields:!1};function ua(r){return r?Object.assign(Object.assign({},ul),r):ul}function fa(r){return r?Object.assign(Object.assign({},ll),r):ll}function da(r,t){var e,i;let n=Object.assign(Object.assign({},r),t);return n.typeRegistry=[...(e=r==null?void 0:r.typeRegistry)!==null&&e!==void 0?e:[],...(i=t==null?void 0:t.typeRegistry)!==null&&i!==void 0?i:[]],n}var Yn=Symbol.for("protobuf-ts/message-type");function Kr(r){let t=!1,e=[];for(let i=0;i<r.length;i++){let n=r.charAt(i);n=="_"?t=!0:/\d/.test(n)?(e.push(n),t=!0):t?(e.push(n.toUpperCase()),t=!1):i==0?e.push(n.toLowerCase()):e.push(n)}return e.join("")}var h;(function(r){r[r.DOUBLE=1]="DOUBLE",r[r.FLOAT=2]="FLOAT",r[r.INT64=3]="INT64",r[r.UINT64=4]="UINT64",r[r.INT32=5]="INT32",r[r.FIXED64=6]="FIXED64",r[r.FIXED32=7]="FIXED32",r[r.BOOL=8]="BOOL",r[r.STRING=9]="STRING",r[r.BYTES=12]="BYTES",r[r.UINT32=13]="UINT32",r[r.SFIXED32=15]="SFIXED32",r[r.SFIXED64=16]="SFIXED64",r[r.SINT32=17]="SINT32",r[r.SINT64=18]="SINT64"})(h||(h={}));var St;(function(r){r[r.BIGINT=0]="BIGINT",r[r.STRING=1]="STRING",r[r.NUMBER=2]="NUMBER"})(St||(St={}));var Oi;(function(r){r[r.NO=0]="NO",r[r.PACKED=1]="PACKED",r[r.UNPACKED=2]="UNPACKED"})(Oi||(Oi={}));function fl(r){var t,e,i,n;return r.localName=(t=r.localName)!==null&&t!==void 0?t:Kr(r.name),r.jsonName=(e=r.jsonName)!==null&&e!==void 0?e:Kr(r.name),r.repeat=(i=r.repeat)!==null&&i!==void 0?i:Oi.NO,r.opt=(n=r.opt)!==null&&n!==void 0?n:r.repeat||r.oneof?!1:r.kind=="message",r}function dl(r){if(typeof r!="object"||r===null||!r.hasOwnProperty("oneofKind"))return!1;switch(typeof r.oneofKind){case"string":return r[r.oneofKind]===void 0?!1:Object.keys(r).length==2;case"undefined":return Object.keys(r).length==1;default:return!1}}var Zn=class{constructor(t){var e;this.fields=(e=t.fields)!==null&&e!==void 0?e:[]}prepare(){if(this.data)return;let t=[],e=[],i=[];for(let n of this.fields)if(n.oneof)i.includes(n.oneof)||(i.push(n.oneof),t.push(n.oneof),e.push(n.oneof));else switch(e.push(n.localName),n.kind){case"scalar":case"enum":(!n.opt||n.repeat)&&t.push(n.localName);break;case"message":n.repeat&&t.push(n.localName);break;case"map":t.push(n.localName);break}this.data={req:t,known:e,oneofs:Object.values(i)}}is(t,e,i=!1){if(e<0)return!0;if(t==null||typeof t!="object")return!1;this.prepare();let n=Object.keys(t),s=this.data;if(n.length<s.req.length||s.req.some(o=>!n.includes(o))||!i&&n.some(o=>!s.known.includes(o)))return!1;if(e<1)return!0;for(let o of s.oneofs){let a=t[o];if(!dl(a))return!1;if(a.oneofKind===void 0)continue;let c=this.fields.find(l=>l.localName===a.oneofKind);if(!c||!this.field(a[a.oneofKind],c,i,e))return!1}for(let o of this.fields)if(o.oneof===void 0&&!this.field(t[o.localName],o,i,e))return!1;return!0}field(t,e,i,n){let s=e.repeat;switch(e.kind){case"scalar":return t===void 0?e.opt:s?this.scalars(t,e.T,n,e.L):this.scalar(t,e.T,e.L);case"enum":return t===void 0?e.opt:s?this.scalars(t,h.INT32,n):this.scalar(t,h.INT32);case"message":return t===void 0?!0:s?this.messages(t,e.T(),i,n):this.message(t,e.T(),i,n);case"map":if(typeof t!="object"||t===null)return!1;if(n<2)return!0;if(!this.mapKeys(t,e.K,n))return!1;switch(e.V.kind){case"scalar":return this.scalars(Object.values(t),e.V.T,n,e.V.L);case"enum":return this.scalars(Object.values(t),h.INT32,n);case"message":return this.messages(Object.values(t),e.V.T(),i,n)}break}return!0}message(t,e,i,n){return i?e.isAssignable(t,n):e.is(t,n)}messages(t,e,i,n){if(!Array.isArray(t))return!1;if(n<2)return!0;if(i){for(let s=0;s<t.length&&s<n;s++)if(!e.isAssignable(t[s],n-1))return!1}else for(let s=0;s<t.length&&s<n;s++)if(!e.is(t[s],n-1))return!1;return!0}scalar(t,e,i){let n=typeof t;switch(e){case h.UINT64:case h.FIXED64:case h.INT64:case h.SFIXED64:case h.SINT64:switch(i){case St.BIGINT:return n=="bigint";case St.NUMBER:return n=="number"&&!isNaN(t);default:return n=="string"}case h.BOOL:return n=="boolean";case h.STRING:return n=="string";case h.BYTES:return t instanceof Uint8Array;case h.DOUBLE:case h.FLOAT:return n=="number"&&!isNaN(t);default:return n=="number"&&Number.isInteger(t)}}scalars(t,e,i,n){if(!Array.isArray(t))return!1;if(i<2)return!0;if(Array.isArray(t)){for(let s=0;s<t.length&&s<i;s++)if(!this.scalar(t[s],e,n))return!1}return!0}mapKeys(t,e,i){let n=Object.keys(t);switch(e){case h.INT32:case h.FIXED32:case h.SFIXED32:case h.SINT32:case h.UINT32:return this.scalars(n.slice(0,i).map(s=>parseInt(s)),e,i);case h.BOOL:return this.scalars(n.slice(0,i).map(s=>s=="true"?!0:s=="false"?!1:s),e,i);default:return this.scalars(n,e,i,St.STRING)}}};function Ot(r,t){switch(t){case St.BIGINT:return r.toBigInt();case St.NUMBER:return r.toNumber();default:return r.toString()}}var Qn=class{constructor(t){this.info=t}prepare(){var t;if(this.fMap===void 0){this.fMap={};let e=(t=this.info.fields)!==null&&t!==void 0?t:[];for(let i of e)this.fMap[i.name]=i,this.fMap[i.jsonName]=i,this.fMap[i.localName]=i}}assert(t,e,i){if(!t){let n=Or(i);throw(n=="number"||n=="boolean")&&(n=i.toString()),new Error(`Cannot parse JSON ${n} for ${this.info.typeName}#${e}`)}}read(t,e,i){this.prepare();let n=[];for(let[s,o]of Object.entries(t)){let a=this.fMap[s];if(!a){if(!i.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let c=a.localName,l;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(n.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);n.push(a.oneof),l=e[a.oneof]={oneofKind:c}}else l=e;if(a.kind=="map"){if(o===null)continue;this.assert(ia(o),a.name,o);let u=l[c];for(let[d,p]of Object.entries(o)){this.assert(p!==null,a.name+" map value",null);let v;switch(a.V.kind){case"message":v=a.V.T().internalJsonRead(p,i);break;case"enum":if(v=this.enum(a.V.T(),p,a.name,i.ignoreUnknownFields),v===!1)continue;break;case"scalar":v=this.scalar(p,a.V.T,a.V.L,a.name);break}this.assert(v!==void 0,a.name+" map value",p);let _=d;a.K==h.BOOL&&(_=_=="true"?!0:_=="false"?!1:_),_=this.scalar(_,a.K,St.STRING,a.name).toString(),u[_]=v}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);let u=l[c];for(let d of o){this.assert(d!==null,a.name,null);let p;switch(a.kind){case"message":p=a.T().internalJsonRead(d,i);break;case"enum":if(p=this.enum(a.T(),d,a.name,i.ignoreUnknownFields),p===!1)continue;break;case"scalar":p=this.scalar(d,a.T,a.L,a.name);break}this.assert(p!==void 0,a.name,o),u.push(p)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}l[c]=a.T().internalJsonRead(o,i,l[c]);break;case"enum":let u=this.enum(a.T(),o,a.name,i.ignoreUnknownFields);if(u===!1)continue;l[c]=u;break;case"scalar":l[c]=this.scalar(o,a.T,a.L,a.name);break}}}enum(t,e,i,n){if(t[0]=="google.protobuf.NullValue"&&M(e===null||e==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${i}, enum ${t[0]} only accepts null.`),e===null)return 0;switch(typeof e){case"number":return M(Number.isInteger(e),`Unable to parse field ${this.info.typeName}#${i}, enum can only be integral number, got ${e}.`),e;case"string":let s=e;t[2]&&e.substring(0,t[2].length)===t[2]&&(s=e.substring(t[2].length));let o=t[1][s];return typeof o=="undefined"&&n?!1:(M(typeof o=="number",`Unable to parse field ${this.info.typeName}#${i}, enum ${t[0]} has no value for "${e}".`),o)}M(!1,`Unable to parse field ${this.info.typeName}#${i}, cannot parse enum value from ${typeof e}".`)}scalar(t,e,i,n){let s;try{switch(e){case h.DOUBLE:case h.FLOAT:if(t===null)return 0;if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""){s="empty string";break}if(typeof t=="string"&&t.trim().length!==t.length){s="extra whitespace";break}if(typeof t!="string"&&typeof t!="number")break;let o=Number(t);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return e==h.FLOAT&&Fr(o),o;case h.INT32:case h.FIXED32:case h.SFIXED32:case h.SINT32:case h.UINT32:if(t===null)return 0;let a;if(typeof t=="number"?a=t:t===""?s="empty string":typeof t=="string"&&(t.trim().length!==t.length?s="extra whitespace":a=Number(t)),a===void 0)break;return e==h.UINT32?lr(a):Le(a),a;case h.INT64:case h.SFIXED64:case h.SINT64:if(t===null)return Ot(K.ZERO,i);if(typeof t!="number"&&typeof t!="string")break;return Ot(K.from(t),i);case h.FIXED64:case h.UINT64:if(t===null)return Ot(ut.ZERO,i);if(typeof t!="number"&&typeof t!="string")break;return Ot(ut.from(t),i);case h.BOOL:if(t===null)return!1;if(typeof t!="boolean")break;return t;case h.STRING:if(t===null)return"";if(typeof t!="string"){s="extra whitespace";break}try{encodeURIComponent(t)}catch(c){c="invalid UTF8";break}return t;case h.BYTES:if(t===null||t==="")return new Uint8Array(0);if(typeof t!="string")break;return Ti(t)}}catch(o){s=o.message}this.assert(!1,n+(s?" - "+s:""),t)}};var ts=class{constructor(t){var e;this.fields=(e=t.fields)!==null&&e!==void 0?e:[]}write(t,e){let i={},n=t;for(let s of this.fields){if(!s.oneof){let l=this.field(s,n[s.localName],e);l!==void 0&&(i[e.useProtoFieldName?s.name:s.jsonName]=l);continue}let o=n[s.oneof];if(o.oneofKind!==s.localName)continue;let a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},e),{emitDefaultValues:!0}):e,c=this.field(s,o[s.localName],a);M(c!==void 0),i[e.useProtoFieldName?s.name:s.jsonName]=c}return i}field(t,e,i){let n;if(t.kind=="map"){M(typeof e=="object"&&e!==null);let s={};switch(t.V.kind){case"scalar":for(let[c,l]of Object.entries(e)){let u=this.scalar(t.V.T,l,t.name,!1,!0);M(u!==void 0),s[c.toString()]=u}break;case"message":let o=t.V.T();for(let[c,l]of Object.entries(e)){let u=this.message(o,l,t.name,i);M(u!==void 0),s[c.toString()]=u}break;case"enum":let a=t.V.T();for(let[c,l]of Object.entries(e)){M(l===void 0||typeof l=="number");let u=this.enum(a,l,t.name,!1,!0,i.enumAsInteger);M(u!==void 0),s[c.toString()]=u}break}(i.emitDefaultValues||Object.keys(s).length>0)&&(n=s)}else if(t.repeat){M(Array.isArray(e));let s=[];switch(t.kind){case"scalar":for(let c=0;c<e.length;c++){let l=this.scalar(t.T,e[c],t.name,t.opt,!0);M(l!==void 0),s.push(l)}break;case"enum":let o=t.T();for(let c=0;c<e.length;c++){M(e[c]===void 0||typeof e[c]=="number");let l=this.enum(o,e[c],t.name,t.opt,!0,i.enumAsInteger);M(l!==void 0),s.push(l)}break;case"message":let a=t.T();for(let c=0;c<e.length;c++){let l=this.message(a,e[c],t.name,i);M(l!==void 0),s.push(l)}break}(i.emitDefaultValues||s.length>0||i.emitDefaultValues)&&(n=s)}else switch(t.kind){case"scalar":n=this.scalar(t.T,e,t.name,t.opt,i.emitDefaultValues);break;case"enum":n=this.enum(t.T(),e,t.name,t.opt,i.emitDefaultValues,i.enumAsInteger);break;case"message":n=this.message(t.T(),e,t.name,i);break}return n}enum(t,e,i,n,s,o){if(t[0]=="google.protobuf.NullValue")return!s&&!n?void 0:null;if(e===void 0){M(n);return}if(!(e===0&&!s&&!n))return M(typeof e=="number"),M(Number.isInteger(e)),o||!t[1].hasOwnProperty(e)?e:t[2]?t[2]+t[1][e]:t[1][e]}message(t,e,i,n){return e===void 0?n.emitDefaultValues?null:void 0:t.internalJsonWrite(e,n)}scalar(t,e,i,n,s){if(e===void 0){M(n);return}let o=s||n;switch(t){case h.INT32:case h.SFIXED32:case h.SINT32:return e===0?o?0:void 0:(Le(e),e);case h.FIXED32:case h.UINT32:return e===0?o?0:void 0:(lr(e),e);case h.FLOAT:Fr(e);case h.DOUBLE:return e===0?o?0:void 0:(M(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e);case h.STRING:return e===""?o?"":void 0:(M(typeof e=="string"),e);case h.BOOL:return e===!1?o?!1:void 0:(M(typeof e=="boolean"),e);case h.UINT64:case h.FIXED64:M(typeof e=="number"||typeof e=="string"||typeof e=="bigint");let a=ut.from(e);return a.isZero()&&!o?void 0:a.toString();case h.INT64:case h.SFIXED64:case h.SINT64:M(typeof e=="number"||typeof e=="string"||typeof e=="bigint");let c=K.from(e);return c.isZero()&&!o?void 0:c.toString();case h.BYTES:return M(e instanceof Uint8Array),e.byteLength?Bi(e):o?"":void 0}}};function Di(r,t=St.STRING){switch(r){case h.BOOL:return!1;case h.UINT64:case h.FIXED64:return Ot(ut.ZERO,t);case h.INT64:case h.SFIXED64:case h.SINT64:return Ot(K.ZERO,t);case h.DOUBLE:case h.FLOAT:return 0;case h.BYTES:return new Uint8Array(0);case h.STRING:return"";default:return 0}}var es=class{constructor(t){this.info=t}prepare(){var t;if(!this.fieldNoToField){let e=(t=this.info.fields)!==null&&t!==void 0?t:[];this.fieldNoToField=new Map(e.map(i=>[i.no,i]))}}read(t,e,i,n){this.prepare();let s=n===void 0?t.len:t.pos+n;for(;t.pos<s;){let[o,a]=t.tag(),c=this.fieldNoToField.get(o);if(!c){let p=i.readUnknownField;if(p=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let v=t.skip(a);p!==!1&&(p===!0?Dr.onRead:p)(this.info.typeName,e,o,a,v);continue}let l=e,u=c.repeat,d=c.localName;switch(c.oneof&&(l=l[c.oneof],l.oneofKind!==d&&(l=e[c.oneof]={oneofKind:d})),c.kind){case"scalar":case"enum":let p=c.kind=="enum"?h.INT32:c.T,v=c.kind=="scalar"?c.L:void 0;if(u){let Y=l[d];if(a==nt.LengthDelimited&&p!=h.STRING&&p!=h.BYTES){let bt=t.uint32()+t.pos;for(;t.pos<bt;)Y.push(this.scalar(t,p,v))}else Y.push(this.scalar(t,p,v))}else l[d]=this.scalar(t,p,v);break;case"message":if(u){let Y=l[d],bt=c.T().internalBinaryRead(t,t.uint32(),i);Y.push(bt)}else l[d]=c.T().internalBinaryRead(t,t.uint32(),i,l[d]);break;case"map":let[_,X]=this.mapEntry(c,t,i);l[d][_]=X;break}}}mapEntry(t,e,i){let n=e.uint32(),s=e.pos+n,o,a;for(;e.pos<s;){let[c,l]=e.tag();switch(c){case 1:t.K==h.BOOL?o=e.bool().toString():o=this.scalar(e,t.K,St.STRING);break;case 2:switch(t.V.kind){case"scalar":a=this.scalar(e,t.V.T,t.V.L);break;case"enum":a=e.int32();break;case"message":a=t.V.T().internalBinaryRead(e,e.uint32(),i);break}break;default:throw new Error(`Unknown field ${c} (wire type ${l}) in map entry for ${this.info.typeName}#${t.name}`)}}if(o===void 0){let c=Di(t.K);o=t.K==h.BOOL?c.toString():c}if(a===void 0)switch(t.V.kind){case"scalar":a=Di(t.V.T,t.V.L);break;case"enum":a=0;break;case"message":a=t.V.T().create();break}return[o,a]}scalar(t,e,i){switch(e){case h.INT32:return t.int32();case h.STRING:return t.string();case h.BOOL:return t.bool();case h.DOUBLE:return t.double();case h.FLOAT:return t.float();case h.INT64:return Ot(t.int64(),i);case h.UINT64:return Ot(t.uint64(),i);case h.FIXED64:return Ot(t.fixed64(),i);case h.FIXED32:return t.fixed32();case h.BYTES:return t.bytes();case h.UINT32:return t.uint32();case h.SFIXED32:return t.sfixed32();case h.SFIXED64:return Ot(t.sfixed64(),i);case h.SINT32:return t.sint32();case h.SINT64:return Ot(t.sint64(),i)}}};var rs=class{constructor(t){this.info=t}prepare(){if(!this.fields){let t=this.info.fields?this.info.fields.concat():[];this.fields=t.sort((e,i)=>e.no-i.no)}}write(t,e,i){this.prepare();for(let s of this.fields){let o,a,c=s.repeat,l=s.localName;if(s.oneof){let u=t[s.oneof];if(u.oneofKind!==l)continue;o=u[l],a=!0}else o=t[l],a=!1;switch(s.kind){case"scalar":case"enum":let u=s.kind=="enum"?h.INT32:s.T;if(c)if(M(Array.isArray(o)),c==Oi.PACKED)this.packed(e,u,s.no,o);else for(let d of o)this.scalar(e,u,s.no,d,!0);else o===void 0?M(s.opt):this.scalar(e,u,s.no,o,a||s.opt);break;case"message":if(c){M(Array.isArray(o));for(let d of o)this.message(e,i,s.T(),s.no,d)}else this.message(e,i,s.T(),s.no,o);break;case"map":M(typeof o=="object"&&o!==null);for(let[d,p]of Object.entries(o))this.mapEntry(e,i,s,d,p);break}}let n=i.writeUnknownFields;n!==!1&&(n===!0?Dr.onWrite:n)(this.info.typeName,t,e)}mapEntry(t,e,i,n,s){t.tag(i.no,nt.LengthDelimited),t.fork();let o=n;switch(i.K){case h.INT32:case h.FIXED32:case h.UINT32:case h.SFIXED32:case h.SINT32:o=Number.parseInt(n);break;case h.BOOL:M(n=="true"||n=="false"),o=n=="true";break}switch(this.scalar(t,i.K,1,o,!0),i.V.kind){case"scalar":this.scalar(t,i.V.T,2,s,!0);break;case"enum":this.scalar(t,h.INT32,2,s,!0);break;case"message":this.message(t,e,i.V.T(),2,s);break}t.join()}message(t,e,i,n,s){s!==void 0&&(i.internalBinaryWrite(s,t.tag(n,nt.LengthDelimited).fork(),e),t.join())}scalar(t,e,i,n,s){let[o,a,c]=this.scalarInfo(e,n);(!c||s)&&(t.tag(i,o),t[a](n))}packed(t,e,i,n){if(!n.length)return;M(e!==h.BYTES&&e!==h.STRING),t.tag(i,nt.LengthDelimited),t.fork();let[,s]=this.scalarInfo(e);for(let o=0;o<n.length;o++)t[s](n[o]);t.join()}scalarInfo(t,e){let i=nt.Varint,n,s=e===void 0,o=e===0;switch(t){case h.INT32:n="int32";break;case h.STRING:o=s||!e.length,i=nt.LengthDelimited,n="string";break;case h.BOOL:o=e===!1,n="bool";break;case h.UINT32:n="uint32";break;case h.DOUBLE:i=nt.Bit64,n="double";break;case h.FLOAT:i=nt.Bit32,n="float";break;case h.INT64:o=s||K.from(e).isZero(),n="int64";break;case h.UINT64:o=s||ut.from(e).isZero(),n="uint64";break;case h.FIXED64:o=s||ut.from(e).isZero(),i=nt.Bit64,n="fixed64";break;case h.BYTES:o=s||!e.byteLength,i=nt.LengthDelimited,n="bytes";break;case h.FIXED32:i=nt.Bit32,n="fixed32";break;case h.SFIXED32:i=nt.Bit32,n="sfixed32";break;case h.SFIXED64:o=s||K.from(e).isZero(),i=nt.Bit64,n="sfixed64";break;case h.SINT32:n="sint32";break;case h.SINT64:o=s||K.from(e).isZero(),n="sint64";break}return[i,n,s||o]}};function hl(r){let t=r.messagePrototype?Object.create(r.messagePrototype):Object.defineProperty({},Yn,{value:r});for(let e of r.fields){let i=e.localName;if(!e.opt)if(e.oneof)t[e.oneof]={oneofKind:void 0};else if(e.repeat)t[i]=[];else switch(e.kind){case"scalar":t[i]=Di(e.T,e.L);break;case"enum":t[i]=0;break;case"map":t[i]={};break}}return t}function is(r,t,e){let i,n=e,s;for(let o of r.fields){let a=o.localName;if(o.oneof){let c=n[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(i=c[a],s=t[o.oneof],s.oneofKind=c.oneofKind,i==null){delete s[a];continue}}else if(i=n[a],s=t,i==null)continue;switch(o.repeat&&(s[a].length=i.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let l=0;l<i.length;l++)s[a][l]=i[l];else s[a]=i;break;case"message":let c=o.T();if(o.repeat)for(let l=0;l<i.length;l++)s[a][l]=c.create(i[l]);else s[a]===void 0?s[a]=c.create(i):c.mergePartial(s[a],i);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(s[a],i);break;case"message":let l=o.V.T();for(let u of Object.keys(i))s[a][u]=l.create(i[u]);break}break}}}function yl(r,t,e){if(t===e)return!0;if(!t||!e)return!1;for(let i of r.fields){let n=i.localName,s=i.oneof?t[i.oneof][n]:t[n],o=i.oneof?e[i.oneof][n]:e[n];switch(i.kind){case"enum":case"scalar":let a=i.kind=="enum"?h.INT32:i.T;if(!(i.repeat?pl(a,s,o):gl(a,s,o)))return!1;break;case"map":if(!(i.V.kind=="message"?ml(i.V.T(),ns(s),ns(o)):pl(i.V.kind=="enum"?h.INT32:i.V.T,ns(s),ns(o))))return!1;break;case"message":let c=i.T();if(!(i.repeat?ml(c,s,o):c.equals(s,o)))return!1;break}}return!0}var ns=Object.values;function gl(r,t,e){if(t===e)return!0;if(r!==h.BYTES)return!1;let i=t,n=e;if(i.length!==n.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!=n[s])return!1;return!0}function pl(r,t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!gl(r,t[i],e[i]))return!1;return!0}function ml(r,t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!r.equals(t[i],e[i]))return!1;return!0}var Cf=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),et=class{constructor(t,e,i){this.defaultCheckDepth=16,this.typeName=t,this.fields=e.map(fl),this.options=i!=null?i:{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},Cf),{[Yn]:{value:this}})),this.refTypeCheck=new Zn(this),this.refJsonReader=new Qn(this),this.refJsonWriter=new ts(this),this.refBinReader=new es(this),this.refBinWriter=new rs(this)}create(t){let e=hl(this);return t!==void 0&&is(this,e,t),e}clone(t){let e=this.create();return is(this,e,t),e}equals(t,e){return yl(this,t,e)}is(t,e=this.defaultCheckDepth){return this.refTypeCheck.is(t,e,!1)}isAssignable(t,e=this.defaultCheckDepth){return this.refTypeCheck.is(t,e,!0)}mergePartial(t,e){is(this,t,e)}fromBinary(t,e){let i=ol(e);return this.internalBinaryRead(i.readerFactory(t),t.byteLength,i)}fromJson(t,e){return this.internalJsonRead(t,ua(e))}fromJsonString(t,e){let i=JSON.parse(t);return this.fromJson(i,e)}toJson(t,e){return this.internalJsonWrite(t,fa(e))}toJsonString(t,e){var i;let n=this.toJson(t,e);return JSON.stringify(n,null,(i=e==null?void 0:e.prettySpaces)!==null&&i!==void 0?i:0)}toBinary(t,e){let i=cl(e);return this.internalBinaryWrite(t,i.writerFactory(),i).finish()}internalJsonRead(t,e,i){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let n=i!=null?i:this.create();return this.refJsonReader.read(t,n,e),n}throw new Error(`Unable to parse message ${this.typeName} from JSON ${Or(t)}.`)}internalJsonWrite(t,e){return this.refJsonWriter.write(t,e)}internalBinaryWrite(t,e,i){return this.refBinWriter.write(t,e,i),e}internalBinaryRead(t,e,i,n){let s=n!=null?n:this.create();return this.refBinReader.read(t,s,i,e),s}};function bl(r,t){var e,i,n;let s=r;return s.service=t,s.localName=(e=s.localName)!==null&&e!==void 0?e:Kr(s.name),s.serverStreaming=!!s.serverStreaming,s.clientStreaming=!!s.clientStreaming,s.options=(i=s.options)!==null&&i!==void 0?i:{},s.idempotency=(n=s.idempotency)!==null&&n!==void 0?n:void 0,s}var Fi=class{constructor(t,e,i){this.typeName=t,this.methods=e.map(n=>bl(n,this)),this.options=i!=null?i:{}}};var z=class extends Error{constructor(t,e="UNKNOWN",i){super(t),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.meta=i!=null?i:{}}toString(){let t=[this.name+": "+this.message];this.code&&(t.push(""),t.push("Code: "+this.code)),this.serviceName&&this.methodName&&t.push("Method: "+this.serviceName+"/"+this.methodName);let e=Object.entries(this.meta);if(e.length){t.push(""),t.push("Meta:");for(let[i,n]of e)t.push(` ${i}: ${n}`)}return t.join(`
|
|
5
|
-
`)}};function
|
|
6
|
-
`)){if(e=="")continue;let[i,...n]=e.split(":"),s=n.join(":").trim();i=i.trim();let o=t[i];typeof o=="string"?t[i]=[o,s]:Array.isArray(o)?o.push(s):t[i]=s}return t}function
|
|
7
|
-
`),v,d),c}async close(){this._closed=!0}};function xl(r,t){var e={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(e[i[n]]=r[i[n]]);return e}function y(r,t,e,i){function n(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):n(u.value).then(a,c)}l((i=i.apply(r,t||[])).next())})}function Sl(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function U(r){return this instanceof U?(this.v=r,this):new U(r)}function kt(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=e.apply(r,t||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(p){i[p]&&(n[p]=function(v){return new Promise(function(_,X){s.push([p,v,_,X])>1||a(p,v)})})}function a(p,v){try{c(i[p](v))}catch(_){d(s[0][3],_)}}function c(p){p.value instanceof U?Promise.resolve(p.value.v).then(l,u):d(s[0][2],p)}function l(p){a("next",p)}function u(p){a("throw",p)}function d(p,v){p(v),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Gr(r){var t,e;return t={},i("next"),i("throw",function(n){throw n}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(n,s){t[n]=r[n]?function(o){return(e=!e)?{value:U(r[n](o)),done:!1}:s?s(o):o}:s}}function te(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Sl=="function"?Sl(r):r[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),n(a,c,o.done,o.value)})}}function n(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var Sa={};or(Sa,{compareArrayLike:()=>Ia,joinUint8Arrays:()=>Ct,memcpy:()=>Ci,rebaseValueOffsets:()=>ps,toArrayBufferView:()=>R,toArrayBufferViewAsyncIterator:()=>ie,toArrayBufferViewIterator:()=>_e,toBigInt64Array:()=>hs,toBigUint64Array:()=>rd,toFloat32Array:()=>id,toFloat32ArrayAsyncIterator:()=>_d,toFloat32ArrayIterator:()=>fd,toFloat64Array:()=>nd,toFloat64ArrayAsyncIterator:()=>wd,toFloat64ArrayIterator:()=>dd,toInt16Array:()=>Qf,toInt16ArrayAsyncIterator:()=>md,toInt16ArrayIterator:()=>ad,toInt32Array:()=>Ar,toInt32ArrayAsyncIterator:()=>yd,toInt32ArrayIterator:()=>cd,toInt8Array:()=>Zf,toInt8ArrayAsyncIterator:()=>pd,toInt8ArrayIterator:()=>od,toUint16Array:()=>td,toUint16ArrayAsyncIterator:()=>gd,toUint16ArrayIterator:()=>ld,toUint32Array:()=>ed,toUint32ArrayAsyncIterator:()=>bd,toUint32ArrayIterator:()=>ud,toUint8Array:()=>D,toUint8ArrayAsyncIterator:()=>va,toUint8ArrayIterator:()=>wa,toUint8ClampedArray:()=>sd,toUint8ClampedArrayAsyncIterator:()=>vd,toUint8ClampedArrayIterator:()=>hd});var Kf=new TextDecoder("utf-8"),Ri=r=>Kf.decode(r),Gf=new TextEncoder,be=r=>Gf.encode(r);var Xf=r=>typeof r=="number",Tl=r=>typeof r=="boolean",pt=r=>typeof r=="function",xt=r=>r!=null&&Object(r)===r,ee=r=>xt(r)&&pt(r.then);var re=r=>xt(r)&&pt(r[Symbol.iterator]),qt=r=>xt(r)&&pt(r[Symbol.asyncIterator]),as=r=>xt(r)&&xt(r.schema);var cs=r=>xt(r)&&"done"in r&&"value"in r;var ls=r=>xt(r)&&pt(r.stat)&&Xf(r.fd);var us=r=>xt(r)&&ki(r.body),fs=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Bl=r=>xt(r)&&pt(r.abort)&&pt(r.getWriter)&&!fs(r),ki=r=>xt(r)&&pt(r.cancel)&&pt(r.getReader)&&!fs(r),Ol=r=>xt(r)&&pt(r.end)&&pt(r.write)&&Tl(r.writable)&&!fs(r),ds=r=>xt(r)&&pt(r.read)&&pt(r.pipe)&&Tl(r.readable)&&!fs(r),Dl=r=>xt(r)&&pt(r.clear)&&pt(r.bytes)&&pt(r.position)&&pt(r.setPosition)&&pt(r.capacity)&&pt(r.getBufferIdentifier)&&pt(r.createLong);var _a=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:ArrayBuffer;function Yf(r){let t=r[0]?[r[0]]:[],e,i,n,s;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:n}=o,{byteOffset:i,byteLength:s}=a,e+n<i||i+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,i-e+s)}return t}function Ci(r,t,e=0,i=t.byteLength){let n=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,n),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,n));return s.set(o,e),r}function Ct(r,t){let e=Yf(r),i=e.reduce((u,d)=>u+d.byteLength,0),n,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,i);for(let u=e.length;++c<u;){if(n=e[c],s=n.subarray(0,Math.min(n.length,l-a)),l<=a+s.length){s.length<n.length?e[c]=n.subarray(s.length):s.length===n.length&&c++,o?Ci(o,s,a):o=s;break}Ci(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),i-(o?o.byteLength:0)]}function R(r,t){let e=cs(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=be(e)),e instanceof ArrayBuffer?new r(e):e instanceof _a?new r(e):Dl(e)?R(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var Zf=r=>R(Int8Array,r),Qf=r=>R(Int16Array,r),Ar=r=>R(Int32Array,r),hs=r=>R(BigInt64Array,r),D=r=>R(Uint8Array,r),td=r=>R(Uint16Array,r),ed=r=>R(Uint32Array,r),rd=r=>R(BigUint64Array,r),id=r=>R(Float32Array,r),nd=r=>R(Float64Array,r),sd=r=>R(Uint8ClampedArray,r),ba=r=>(r.next(),r);function*_e(r,t){let e=function*(n){yield n},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof _a?e(t):re(t)?t:e(t);return yield*ba(function*(n){let s=null;do s=n.next(yield R(r,s));while(!s.done)}(i[Symbol.iterator]())),new r}var od=r=>_e(Int8Array,r),ad=r=>_e(Int16Array,r),cd=r=>_e(Int32Array,r),wa=r=>_e(Uint8Array,r),ld=r=>_e(Uint16Array,r),ud=r=>_e(Uint32Array,r),fd=r=>_e(Float32Array,r),dd=r=>_e(Float64Array,r),hd=r=>_e(Uint8ClampedArray,r);function ie(r,t){return kt(this,arguments,function*(){if(ee(t))return yield U(yield U(yield*Gr(te(ie(r,yield U(t))))));let i=function(o){return kt(this,arguments,function*(){yield yield U(yield U(o))})},n=function(o){return kt(this,arguments,function*(){yield U(yield*Gr(te(ba(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof _a?i(t):re(t)?n(t):qt(t)?t:i(t);return yield U(yield*Gr(te(ba(function(o){return kt(this,arguments,function*(){let a=null;do a=yield U(o.next(yield yield U(R(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield U(new r)})}var pd=r=>ie(Int8Array,r),md=r=>ie(Int16Array,r),yd=r=>ie(Int32Array,r),va=r=>ie(Uint8Array,r),gd=r=>ie(Uint16Array,r),bd=r=>ie(Uint32Array,r),_d=r=>ie(Float32Array,r),wd=r=>ie(Float64Array,r),vd=r=>ie(Uint8ClampedArray,r);function ps(r,t,e){if(r!==0){e=e.slice(0,t);for(let i=-1,n=e.length;++i<n;)e[i]+=r}return e.subarray(0,t)}function Ia(r,t){let e=0,i=r.length;if(i!==t.length)return!1;if(i>0)do if(r[e]!==t[e])return!1;while(++e<i);return!0}var _t={fromIterable(r){return ms(Id(r))},fromAsyncIterable(r){return ms(Sd(r))},fromDOMStream(r){return ms(xd(r))},fromNodeStream(r){return ms(Td(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},ms=r=>(r.next(),r);function*Id(r){let t,e=!1,i=[],n,s,o,a=0;function c(){return s==="peek"?Ct(i,o)[0]:([n,i,a]=Ct(i,o),n)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});let l=wa(r)[Symbol.iterator]();try{do if({done:t,value:n}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&n.byteLength>0&&(i.push(n),a+=n.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function Sd(r){return kt(this,arguments,function*(){let e,i=!1,n=[],s,o,a,c=0;function l(){return o==="peek"?Ct(n,a)[0]:([s,n,c]=Ct(n,a),s)}({cmd:o,size:a}=(yield yield U(null))||{cmd:"read",size:0});let u=va(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.next()):yield U(u.next(a-c)),!e&&s.byteLength>0&&(n.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(d){(i=!0)&&typeof u.throw=="function"&&(yield U(u.throw(d)))}finally{i===!1&&typeof u.return=="function"&&(yield U(u.return(new Uint8Array(0))))}return yield U(null)})}function xd(r){return kt(this,arguments,function*(){let e=!1,i=!1,n=[],s,o,a,c=0;function l(){return o==="peek"?Ct(n,a)[0]:([s,n,c]=Ct(n,a),s)}({cmd:o,size:a}=(yield yield U(null))||{cmd:"read",size:0});let u=new Ta(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.read()):yield U(u.read(a-c)),!e&&s.byteLength>0&&(n.push(D(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(d){(i=!0)&&(yield U(u.cancel(d)))}finally{i===!1?yield U(u.cancel()):r.locked&&u.releaseLock()}return yield U(null)})}var Ta=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return y(this,void 0,void 0,function*(){let{reader:e,source:i}=this;e&&(yield e.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=D(e)),e})}},xa=(r,t)=>{let e=n=>i([t,n]),i;return[t,e,new Promise(n=>(i=n)&&r.once(t,e))]};function Td(r){return kt(this,arguments,function*(){let e=[],i="error",n=!1,s=null,o,a,c=0,l=[],u;function d(){return o==="peek"?Ct(l,a)[0]:([u,l,c]=Ct(l,a),u)}if({cmd:o,size:a}=(yield yield U(null))||{cmd:"read",size:0},r.isTTY)return yield yield U(new Uint8Array(0)),yield U(null);try{e[0]=xa(r,"end"),e[1]=xa(r,"error");do{if(e[2]=xa(r,"readable"),[i,s]=yield U(Promise.race(e.map(v=>v[2]))),i==="error")break;if((n=i==="end")||(Number.isFinite(a-c)?(u=D(r.read(a-c)),u.byteLength<a-c&&(u=D(r.read()))):u=D(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),n||a<=c)do({cmd:o,size:a}=yield yield U(d()));while(a<c)}while(!n)}finally{yield U(p(e,i==="error"?s:null))}return yield U(null);function p(v,_){return u=l=null,new Promise((X,Y)=>{for(let[bt,$t]of v)r.off(bt,$t);try{let bt=r.destroy;bt&&bt.call(r,_),_=void 0}catch(bt){_=bt||_}finally{_!=null?Y(_):X()}})}})}var H;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(H||(H={}));var Z;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Z||(Z={}));var G;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(G||(G={}));var ct;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(ct||(ct={}));var b;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(b||(b={}));var mt;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(mt||(mt={}));var we=new Int32Array(2),ys=new Float32Array(we.buffer),gs=new Float64Array(we.buffer),Xr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Vi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Vi||(Vi={}));var Vt=class r{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new r(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return we[0]=this.readInt32(t),ys[0]}readFloat64(t){return we[Xr?0:1]=this.readInt32(t),we[Xr?1:0]=this.readInt32(t+4),gs[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){ys[0]=e,this.writeInt32(t,we[0])}writeFloat64(t,e){gs[0]=e,this.writeInt32(t,we[Xr?0:1]),this.writeInt32(t+4,we[Xr?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let n=this.bytes_.subarray(t,t+i);return e===Vi.UTF8_BYTES?n:this.text_decoder_.decode(n)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let i=[];for(let n=0;n<e;++n){let s=t(n);s!==null&&i.push(s)}return i}createObjList(t,e){let i=[];for(let n=0;n<e;++n){let s=t(n);s!==null&&i.push(s.unpack())}return i}};var Nr=class r{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Vt.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){let n=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=e<<1,n=Vt.allocate(i);return n.setPosition(i-e),n.bytes().set(t.bytes(),i-e),n}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let n=2;this.addInt16(t-this.object_start);let s=(i+n)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=2;l<s;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){let n=i?4:0;if(e){let s=e;if(this.prep(this.minalign,8+n),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=3;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+n),this.addOffset(t),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let i=this.bb.capacity()-t,n=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(n)&&this.bb.readInt16(n+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let i=0;i<t.length;++i){let n=t[i];if(n!==null)e.push(this.createObjectOffset(n));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Pi;(function(r){r[r.BUFFER=0]="BUFFER"})(Pi||(Pi={}));var ji;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ji||(ji={}));var _s=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ji.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Pi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ji.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Pi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return r.startBodyCompression(t),r.addCodec(t,e),r.addMethod(t,i),r.endBodyCompression(t)}};var Yr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(i!=null?i:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Zr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(i!=null?i:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Pt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let i=this.bb.__offset(this.bb_pos,6);return i?(e||new Zr).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new Yr).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new _s).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var Ue=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var ur;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(ur||(ur={}));var zi;(function(r){r[r.DenseArray=0]="DenseArray"})(zi||(zi={}));var se=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,i){return r.startInt(t),r.addBitWidth(t,e),r.addIsSigned(t,i),r.endInt(t)}};var ve=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new se).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):zi.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,zi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var yt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,i),r.endKeyValue(t)}};var Wi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return r.startBinary(t),r.endBinary(t)}};var $i=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return r.startBool(t),r.endBool(t)}};var fr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,ct.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var Ie=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,n){return r.startDecimal(t),r.addPrecision(t,e),r.addScale(t,i),r.addBitWidth(t,n),r.endDecimal(t)}};var dr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):b.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,b.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}};var hr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return r.startFixedSizeBinary(t),r.addByteWidth(t,e),r.endFixedSizeBinary(t)}};var pr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return r.startFixedSizeList(t),r.addListSize(t,e),r.endFixedSizeList(t)}};var mr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):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 r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var yr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):mt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,mt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var Hi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return r.startLargeBinary(t),r.endLargeBinary(t)}};var Ji=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return r.startLargeUtf8(t),r.endLargeUtf8(t)}};var qi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}};var gr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return r.startMap(t),r.addKeysSorted(t,e),r.endMap(t)}};var Ki=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return r.startNull(t),r.endNull(t)}};var Gi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return r.startStruct_(t),r.endStruct_(t)}};var Me=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):b.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,b.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,i),r.endTime(t)}};var Re=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):b.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,b.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,i),r.endTimestamp(t)}};var oe=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Z.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Z.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 r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,i),r.endUnion(t)}};var Xi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}};var Q;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Q||(Q={}));var It=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Q.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ve).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let i=this.bb.__offset(this.bb_pos,14);return i?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,16);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Q.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()}};var Ft=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ur.Little}fields(t,e){let i=this.bb.__offset(this.bb_pos,6);return i?(e||new It).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,ur.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,s){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,i),r.addCustomMetadata(t,n),r.addFeatures(t,s),r.endSchema(t)}};var V;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(V||(V={}));var f;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(f||(f={}));var Gt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Gt||(Gt={}));var Ha={};or(Ha,{clampRange:()=>tn,createElementComparator:()=>vr,wrapIndex:()=>Er});var Ba={};or(Ba,{valueToString:()=>ae});function ae(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>ae(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Aa={};or(Aa,{BN:()=>Zi,bigNumToBigInt:()=>Al,bigNumToNumber:()=>Fa,bigNumToString:()=>ei,isArrowBigNumSymbol:()=>Fl});function j(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Oa(r,t){return j(r/t)+j(r%t)/j(t)}var Fl=Symbol.for("isArrowBigNum");function ce(r,...t){return t.length===0?Object.setPrototypeOf(R(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}ce.prototype[Fl]=!0;ce.prototype.toJSON=function(){return`"${ei(this)}"`};ce.prototype.valueOf=function(r){return Fa(this,r)};ce.prototype.toString=function(){return ei(this)};ce.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Fa(this);case"string":return ei(this);case"default":return Al(this)}return ei(this)};function Qr(...r){return ce.apply(this,r)}function ti(...r){return ce.apply(this,r)}function Yi(...r){return ce.apply(this,r)}Object.setPrototypeOf(Qr.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(ti.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Yi.prototype,Object.create(Uint32Array.prototype));Object.assign(Qr.prototype,ce.prototype,{constructor:Qr,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(ti.prototype,ce.prototype,{constructor:ti,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Yi.prototype,ce.prototype,{constructor:Yi,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Bd=BigInt(4294967296)*BigInt(4294967296),Od=Bd-BigInt(1);function Fa(r,t){let{buffer:e,byteOffset:i,byteLength:n,signed:s}=r,o=new BigUint64Array(e,i,n/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let u of o)c|=(u^Od)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let u of o)c|=u*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let u=BigInt(Math.pow(10,t)),d=c/u,p=c%u;return j(d)+j(p)/j(u)}return j(c)}function ei(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Da(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Da(r);t=t.slice();let i=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+i;t[s]=a,i&=o===0?1:0}return`-${Da(t)}`}function Al(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:ei(r)}function Da(r){let t="",e=new Uint32Array(2),i=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),n=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),s=-1,o=i.length-1;do{for(e[0]=i[s=0];s<o;)i[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+i[s];i[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(n[0]||n[1]||n[2]||n[3]);return t!=null?t:"0"}var Zi=class r{static new(t,e){switch(e){case!0:return new Qr(t);case!1:return new ti(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Qr(t)}return t.byteLength===16?new Yi(t):new ti(t)}static signed(t){return new Qr(t)}static unsigned(t){return new ti(t)}static decimal(t){return new Yi(t)}constructor(t,e){return r.new(t,e)}};var Nl,El,Ll,Ul,Ml,Rl,kl,Cl,Vl,Pl,jl,zl,Wl,$l,Hl,Jl,ql,Kl,Gl,Xl,Yl,Zl,g=class r{static isNull(t){return(t==null?void 0:t.typeId)===f.Null}static isInt(t){return(t==null?void 0:t.typeId)===f.Int}static isFloat(t){return(t==null?void 0:t.typeId)===f.Float}static isBinary(t){return(t==null?void 0:t.typeId)===f.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===f.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===f.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===f.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===f.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===f.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===f.Date}static isTime(t){return(t==null?void 0:t.typeId)===f.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===f.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===f.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===f.Duration}static isList(t){return(t==null?void 0:t.typeId)===f.List}static isStruct(t){return(t==null?void 0:t.typeId)===f.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===f.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===f.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===f.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===f.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===f.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===Z.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===Z.Sparse}constructor(t){this.typeId=t}};Nl=Symbol.toStringTag;g[Nl]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(g.prototype);var Tt=class extends g{constructor(){super(f.Null)}toString(){return"Null"}};El=Symbol.toStringTag;Tt[El]=(r=>r[Symbol.toStringTag]="Null")(Tt.prototype);var gt=class extends g{constructor(t,e){super(f.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Ll=Symbol.toStringTag;gt[Ll]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(gt.prototype);var ws=class extends gt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},vs=class extends gt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Se=class extends gt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Is=class extends gt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ss=class extends gt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},xs=class extends gt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ts=class extends gt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Bs=class extends gt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ws.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(vs.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Se.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Is.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ss.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(xs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ts.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Bs.prototype,"ArrayType",{value:BigUint64Array});var Xt=class extends g{constructor(t){super(f.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}`}};Ul=Symbol.toStringTag;Xt[Ul]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Xt.prototype);var Os=class extends Xt{constructor(){super(G.HALF)}},Ds=class extends Xt{constructor(){super(G.SINGLE)}},Fs=class extends Xt{constructor(){super(G.DOUBLE)}};Object.defineProperty(Os.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Fs.prototype,"ArrayType",{value:Float64Array});var ke=class extends g{constructor(){super(f.Binary)}toString(){return"Binary"}};Ml=Symbol.toStringTag;ke[Ml]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ke.prototype);var Ce=class extends g{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Rl=Symbol.toStringTag;Ce[Rl]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Ce.prototype);var Ve=class extends g{constructor(){super(f.Utf8)}toString(){return"Utf8"}};kl=Symbol.toStringTag;Ve[kl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Ve.prototype);var Pe=class extends g{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Cl=Symbol.toStringTag;Pe[Cl]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Pe.prototype);var je=class extends g{constructor(){super(f.Bool)}toString(){return"Bool"}};Vl=Symbol.toStringTag;je[Vl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(je.prototype);var ze=class extends g{constructor(t,e,i=128){super(f.Decimal),this.scale=t,this.precision=e,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Pl=Symbol.toStringTag;ze[Pl]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ze.prototype);var We=class extends g{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ct[this.unit]}>`}get ArrayType(){return this.unit===ct.DAY?Int32Array:BigInt64Array}};jl=Symbol.toStringTag;We[jl]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(We.prototype);var $e=class extends g{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${b[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};zl=Symbol.toStringTag;$e[zl]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))($e.prototype);var He=class extends g{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${b[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Wl=Symbol.toStringTag;He[Wl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(He.prototype);var Je=class extends g{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${mt[this.unit]}>`}};$l=Symbol.toStringTag;Je[$l]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Je.prototype);var qe=class extends g{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${b[this.unit]}>`}};Hl=Symbol.toStringTag;qe[Hl]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(qe.prototype);var le=class extends g{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Jl=Symbol.toStringTag;le[Jl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(le.prototype);var rt=class extends g{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ql=Symbol.toStringTag;rt[ql]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(rt.prototype);var ue=class extends g{constructor(t,e,i){super(f.Union),this.mode=t,this.children=i,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((n,s,o)=>(n[s]=o)&&n||n,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Kl=Symbol.toStringTag;ue[Kl]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ue.prototype);var Ke=class extends g{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Gl=Symbol.toStringTag;Ke[Gl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ke.prototype);var fe=class extends g{constructor(t,e){super(f.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Xl=Symbol.toStringTag;fe[Xl]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(fe.prototype);var de=class extends g{constructor(t,e=!1){var i,n,s;if(super(f.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((i=t==null?void 0:t.type)===null||i===void 0)&&i.children)){let o=(n=t==null?void 0:t.type)===null||n===void 0?void 0:n.children[0];o&&(o.name="key");let a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Yl=Symbol.toStringTag;de[Yl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(de.prototype);var Dd=(r=>()=>++r)(-1),jt=class extends g{constructor(t,e,i,n){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=n||!1,this.id=i==null?Dd():j(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}>`}};Zl=Symbol.toStringTag;jt[Zl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(jt.prototype);function zt(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var I=class{visitMany(t,...e){return t.map((i,n)=>this.visit(i,...e.map(s=>s[n])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Fd(this,t,e)}getVisitFnByTypeId(t,e=!0){return ri(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 Fd(r,t,e=!0){return typeof t=="number"?ri(r,t,e):typeof t=="string"&&t in f?ri(r,f[t],e):t&&t instanceof g?ri(r,Ql(t),e):t!=null&&t.type&&t.type instanceof g?ri(r,Ql(t.type),e):ri(r,f.NONE,e)}function ri(r,t,e=!0){let i=null;switch(t){case f.Null:i=r.visitNull;break;case f.Bool:i=r.visitBool;break;case f.Int:i=r.visitInt;break;case f.Int8:i=r.visitInt8||r.visitInt;break;case f.Int16:i=r.visitInt16||r.visitInt;break;case f.Int32:i=r.visitInt32||r.visitInt;break;case f.Int64:i=r.visitInt64||r.visitInt;break;case f.Uint8:i=r.visitUint8||r.visitInt;break;case f.Uint16:i=r.visitUint16||r.visitInt;break;case f.Uint32:i=r.visitUint32||r.visitInt;break;case f.Uint64:i=r.visitUint64||r.visitInt;break;case f.Float:i=r.visitFloat;break;case f.Float16:i=r.visitFloat16||r.visitFloat;break;case f.Float32:i=r.visitFloat32||r.visitFloat;break;case f.Float64:i=r.visitFloat64||r.visitFloat;break;case f.Utf8:i=r.visitUtf8;break;case f.LargeUtf8:i=r.visitLargeUtf8;break;case f.Binary:i=r.visitBinary;break;case f.LargeBinary:i=r.visitLargeBinary;break;case f.FixedSizeBinary:i=r.visitFixedSizeBinary;break;case f.Date:i=r.visitDate;break;case f.DateDay:i=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:i=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:i=r.visitTimestamp;break;case f.TimestampSecond:i=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:i=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:i=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:i=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:i=r.visitTime;break;case f.TimeSecond:i=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:i=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:i=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:i=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:i=r.visitDecimal;break;case f.List:i=r.visitList;break;case f.Struct:i=r.visitStruct;break;case f.Union:i=r.visitUnion;break;case f.DenseUnion:i=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:i=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:i=r.visitDictionary;break;case f.Interval:i=r.visitInterval;break;case f.IntervalDayTime:i=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:i=r.visitIntervalYearMonth||r.visitInterval;break;case f.Duration:i=r.visitDuration;break;case f.DurationSecond:i=r.visitDurationSecond||r.visitDuration;break;case f.DurationMillisecond:i=r.visitDurationMillisecond||r.visitDuration;break;case f.DurationMicrosecond:i=r.visitDurationMicrosecond||r.visitDuration;break;case f.DurationNanosecond:i=r.visitDurationNanosecond||r.visitDuration;break;case f.FixedSizeList:i=r.visitFixedSizeList;break;case f.Map:i=r.visitMap;break}if(typeof i=="function")return i;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Ql(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case G.HALF:return f.Float16;case G.SINGLE:return f.Float32;case G.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case b.SECOND:return f.TimeSecond;case b.MILLISECOND:return f.TimeMillisecond;case b.MICROSECOND:return f.TimeMicrosecond;case b.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case b.SECOND:return f.TimestampSecond;case b.MILLISECOND:return f.TimestampMillisecond;case b.MICROSECOND:return f.TimestampMicrosecond;case b.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case ct.DAY:return f.DateDay;case ct.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case mt.DAY_TIME:return f.IntervalDayTime;case mt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case b.SECOND:return f.DurationSecond;case b.MILLISECOND:return f.DurationMillisecond;case b.MICROSECOND:return f.DurationMicrosecond;case b.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case Z.Dense:return f.DenseUnion;case Z.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}I.prototype.visitInt8=null;I.prototype.visitInt16=null;I.prototype.visitInt32=null;I.prototype.visitInt64=null;I.prototype.visitUint8=null;I.prototype.visitUint16=null;I.prototype.visitUint32=null;I.prototype.visitUint64=null;I.prototype.visitFloat16=null;I.prototype.visitFloat32=null;I.prototype.visitFloat64=null;I.prototype.visitDateDay=null;I.prototype.visitDateMillisecond=null;I.prototype.visitTimestampSecond=null;I.prototype.visitTimestampMillisecond=null;I.prototype.visitTimestampMicrosecond=null;I.prototype.visitTimestampNanosecond=null;I.prototype.visitTimeSecond=null;I.prototype.visitTimeMillisecond=null;I.prototype.visitTimeMicrosecond=null;I.prototype.visitTimeNanosecond=null;I.prototype.visitDenseUnion=null;I.prototype.visitSparseUnion=null;I.prototype.visitIntervalDayTime=null;I.prototype.visitIntervalYearMonth=null;I.prototype.visitDuration=null;I.prototype.visitDurationSecond=null;I.prototype.visitDurationMillisecond=null;I.prototype.visitDurationMicrosecond=null;I.prototype.visitDurationNanosecond=null;var Na={};or(Na,{float64ToUint16:()=>Qi,uint16ToFloat64:()=>As});var tu=new Float64Array(1),ii=new Uint32Array(tu.buffer);function As(r){let t=(r&31744)>>10,e=(r&1023)/1024,i=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return i*(e?Number.NaN:1/0);case 0:return i*(e?6103515625e-14*e:0)}return i*Math.pow(2,t-15)*(1+e)}function Qi(r){if(r!==r)return 32256;tu[0]=r;let t=(ii[1]&2147483648)>>16&65535,e=ii[1]&2146435072,i=0;return e>=1089470464?ii[0]>0?e=31744:(e=(e&2080374784)>>16,i=(ii[1]&1048575)>>10):e<=1056964608?(i=1048576+(ii[1]&1048575),i=1048576+(i<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,i=(ii[1]&1048575)+512>>10),t|e|i&65535}var O=class extends I{};function N(r){return(t,e,i)=>{if(t.setValid(e,i!=null))return r(t,e,i)}}var Ad=(r,t,e)=>{r[t]=Math.floor(e/864e5)},eu=(r,t,e,i)=>{if(e+1<t.length){let n=j(t[e]),s=j(t[e+1]);r.set(i.subarray(0,s-n),n)}},Nd=({offset:r,values:t},e,i)=>{let n=r+e;i?t[n>>3]|=1<<n%8:t[n>>3]&=~(1<<n%8)},Ge=({values:r},t,e)=>{r[t]=e},Ea=({values:r},t,e)=>{r[t]=e},ru=({values:r},t,e)=>{r[t]=Qi(e)},Ed=(r,t,e)=>{switch(r.type.precision){case G.HALF:return ru(r,t,e);case G.SINGLE:case G.DOUBLE:return Ea(r,t,e)}},Ns=({values:r},t,e)=>{Ad(r,t,e.valueOf())},Es=({values:r},t,e)=>{r[t]=BigInt(e)},La=({stride:r,values:t},e,i)=>{t.set(i.subarray(0,r),r*e)},iu=({values:r,valueOffsets:t},e,i)=>eu(r,t,e,i),nu=({values:r,valueOffsets:t},e,i)=>eu(r,t,e,be(i)),Ua=(r,t,e)=>{r.type.unit===ct.DAY?Ns(r,t,e):Es(r,t,e)},Ls=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},Us=({values:r},t,e)=>{r[t]=BigInt(e)},Ms=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},Rs=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Ma=(r,t,e)=>{switch(r.type.unit){case b.SECOND:return Ls(r,t,e);case b.MILLISECOND:return Us(r,t,e);case b.MICROSECOND:return Ms(r,t,e);case b.NANOSECOND:return Rs(r,t,e)}},ks=({values:r},t,e)=>{r[t]=e},Cs=({values:r},t,e)=>{r[t]=e},Vs=({values:r},t,e)=>{r[t]=e},Ps=({values:r},t,e)=>{r[t]=e},Ra=(r,t,e)=>{switch(r.type.unit){case b.SECOND:return ks(r,t,e);case b.MILLISECOND:return Cs(r,t,e);case b.MICROSECOND:return Vs(r,t,e);case b.NANOSECOND:return Ps(r,t,e)}},ka=({values:r,stride:t},e,i)=>{r.set(i.subarray(0,t),t*e)},Ld=(r,t,e)=>{let i=r.children[0],n=r.valueOffsets,s=wt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=n[t],c=n[t+1];a<c;)s(i,a++,e[++o]);else for(let o=-1,a=n[t],c=n[t+1];a<c;)s(i,a++,e.get(++o))},Ud=(r,t,e)=>{let i=r.children[0],{valueOffsets:n}=r,s=wt.getVisitFn(i),{[t]:o,[t+1]:a}=n,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(s(i,o,l),++o>=a)break},Md=(r,t)=>(e,i,n,s)=>i&&e(i,r,t[s]),Rd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t.get(s)),kd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t.get(n.name)),Cd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t[n.name]),Vd=(r,t,e)=>{let i=r.type.children.map(s=>wt.getVisitFn(s.type)),n=e instanceof Map?kd(t,e):e instanceof P?Rd(t,e):Array.isArray(e)?Md(t,e):Cd(t,e);r.type.children.forEach((s,o)=>n(i[o],r.children[o],s,o))},Pd=(r,t,e)=>{r.type.mode===Z.Dense?su(r,t,e):ou(r,t,e)},su=(r,t,e)=>{let i=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[i];wt.visit(n,r.valueOffsets[t],e)},ou=(r,t,e)=>{let i=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[i];wt.visit(n,t,e)},jd=(r,t,e)=>{var i;(i=r.dictionary)===null||i===void 0||i.set(r.values[t],e)},Ca=(r,t,e)=>{r.type.unit===mt.DAY_TIME?js(r,t,e):zs(r,t,e)},js=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},zs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Ws=({values:r},t,e)=>{r[t]=e},$s=({values:r},t,e)=>{r[t]=e},Hs=({values:r},t,e)=>{r[t]=e},Js=({values:r},t,e)=>{r[t]=e},Va=(r,t,e)=>{switch(r.type.unit){case b.SECOND:return Ws(r,t,e);case b.MILLISECOND:return $s(r,t,e);case b.MICROSECOND:return Hs(r,t,e);case b.NANOSECOND:return Js(r,t,e)}},zd=(r,t,e)=>{let{stride:i}=r,n=r.children[0],s=wt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=t*i;++o<i;)s(n,a+o,e[o]);else for(let o=-1,a=t*i;++o<i;)s(n,a+o,e.get(o))};O.prototype.visitBool=N(Nd);O.prototype.visitInt=N(Ge);O.prototype.visitInt8=N(Ge);O.prototype.visitInt16=N(Ge);O.prototype.visitInt32=N(Ge);O.prototype.visitInt64=N(Ge);O.prototype.visitUint8=N(Ge);O.prototype.visitUint16=N(Ge);O.prototype.visitUint32=N(Ge);O.prototype.visitUint64=N(Ge);O.prototype.visitFloat=N(Ed);O.prototype.visitFloat16=N(ru);O.prototype.visitFloat32=N(Ea);O.prototype.visitFloat64=N(Ea);O.prototype.visitUtf8=N(nu);O.prototype.visitLargeUtf8=N(nu);O.prototype.visitBinary=N(iu);O.prototype.visitLargeBinary=N(iu);O.prototype.visitFixedSizeBinary=N(La);O.prototype.visitDate=N(Ua);O.prototype.visitDateDay=N(Ns);O.prototype.visitDateMillisecond=N(Es);O.prototype.visitTimestamp=N(Ma);O.prototype.visitTimestampSecond=N(Ls);O.prototype.visitTimestampMillisecond=N(Us);O.prototype.visitTimestampMicrosecond=N(Ms);O.prototype.visitTimestampNanosecond=N(Rs);O.prototype.visitTime=N(Ra);O.prototype.visitTimeSecond=N(ks);O.prototype.visitTimeMillisecond=N(Cs);O.prototype.visitTimeMicrosecond=N(Vs);O.prototype.visitTimeNanosecond=N(Ps);O.prototype.visitDecimal=N(ka);O.prototype.visitList=N(Ld);O.prototype.visitStruct=N(Vd);O.prototype.visitUnion=N(Pd);O.prototype.visitDenseUnion=N(su);O.prototype.visitSparseUnion=N(ou);O.prototype.visitDictionary=N(jd);O.prototype.visitInterval=N(Ca);O.prototype.visitIntervalDayTime=N(js);O.prototype.visitIntervalYearMonth=N(zs);O.prototype.visitDuration=N(Va);O.prototype.visitDurationSecond=N(Ws);O.prototype.visitDurationMillisecond=N($s);O.prototype.visitDurationMicrosecond=N(Hs);O.prototype.visitDurationNanosecond=N(Js);O.prototype.visitFixedSizeList=N(zd);O.prototype.visitMap=N(Ud);var wt=new O;var he=Symbol.for("parent"),ni=Symbol.for("rowIndex"),br=class{constructor(t,e){return this[he]=t,this[ni]=e,new Proxy(this,Wd)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ni],e=this[he],i=e.type.children,n={};for(let s=-1,o=i.length;++s<o;)n[i[s].name]=ft.visit(e.children[s],t);return n}toString(){return`{${[...this].map(([t,e])=>`${ae(t)}: ${ae(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Pa(this[he],this[ni])}},Pa=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ft.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(br.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[he]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ni]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ja=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[he].type.children.map(e=>e.name)}has(t,e){return t[he].type.children.some(i=>i.name===e)}getOwnPropertyDescriptor(t,e){if(t[he].type.children.some(i=>i.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let i=t[he].type.children.findIndex(n=>n.name===e);if(i!==-1){let n=ft.visit(t[he].children[i],t[ni]);return Reflect.set(t,e,n),n}}set(t,e,i){let n=t[he].type.children.findIndex(s=>s.name===e);return n!==-1?(wt.visit(t[he].children[n],t[ni],i),Reflect.set(t,e,i)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,i):!1}},Wd=new ja;var S=class extends I{};function F(r){return(t,e)=>t.getValid(e)?r(t,e):null}var $d=(r,t)=>864e5*r[t],Hd=(r,t)=>null,au=(r,t,e)=>{if(e+1>=t.length)return null;let i=j(t[e]),n=j(t[e+1]);return r.subarray(i,n)},Jd=({offset:r,values:t},e)=>{let i=r+e;return(t[i>>3]&1<<i%8)!==0},cu=({values:r},t)=>$d(r,t),lu=({values:r},t)=>j(r[t]),_r=({stride:r,values:t},e)=>t[r*e],qd=({stride:r,values:t},e)=>As(t[r*e]),uu=({values:r},t)=>r[t],Kd=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),fu=({values:r,valueOffsets:t},e)=>au(r,t,e),du=({values:r,valueOffsets:t},e)=>{let i=au(r,t,e);return i!==null?Ri(i):null},Gd=({values:r},t)=>r[t],Xd=({type:r,values:t},e)=>r.precision!==G.HALF?t[e]:As(t[e]),Yd=(r,t)=>r.type.unit===ct.DAY?cu(r,t):lu(r,t),hu=({values:r},t)=>1e3*j(r[t]),pu=({values:r},t)=>j(r[t]),mu=({values:r},t)=>Oa(r[t],BigInt(1e3)),yu=({values:r},t)=>Oa(r[t],BigInt(1e6)),Zd=(r,t)=>{switch(r.type.unit){case b.SECOND:return hu(r,t);case b.MILLISECOND:return pu(r,t);case b.MICROSECOND:return mu(r,t);case b.NANOSECOND:return yu(r,t)}},gu=({values:r},t)=>r[t],bu=({values:r},t)=>r[t],_u=({values:r},t)=>r[t],wu=({values:r},t)=>r[t],Qd=(r,t)=>{switch(r.type.unit){case b.SECOND:return gu(r,t);case b.MILLISECOND:return bu(r,t);case b.MICROSECOND:return _u(r,t);case b.NANOSECOND:return wu(r,t)}},th=({values:r,stride:t},e)=>Zi.decimal(r.subarray(t*e,t*(e+1))),eh=(r,t)=>{let{valueOffsets:e,stride:i,children:n}=r,{[t*i]:s,[t*i+1]:o}=e,c=n[0].slice(s,o-s);return new P([c])},rh=(r,t)=>{let{valueOffsets:e,children:i}=r,{[t]:n,[t+1]:s}=e,o=i[0];return new xe(o.slice(n,s-n))},ih=(r,t)=>new br(r,t),nh=(r,t)=>r.type.mode===Z.Dense?vu(r,t):Iu(r,t),vu=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[e];return ft.visit(i,r.valueOffsets[t])},Iu=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[e];return ft.visit(i,t)},sh=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},oh=(r,t)=>r.type.unit===mt.DAY_TIME?Su(r,t):xu(r,t),Su=({values:r},t)=>r.subarray(2*t,2*(t+1)),xu=({values:r},t)=>{let e=r[t],i=new Int32Array(2);return i[0]=Math.trunc(e/12),i[1]=Math.trunc(e%12),i},Tu=({values:r},t)=>r[t],Bu=({values:r},t)=>r[t],Ou=({values:r},t)=>r[t],Du=({values:r},t)=>r[t],ah=(r,t)=>{switch(r.type.unit){case b.SECOND:return Tu(r,t);case b.MILLISECOND:return Bu(r,t);case b.MICROSECOND:return Ou(r,t);case b.NANOSECOND:return Du(r,t)}},ch=(r,t)=>{let{stride:e,children:i}=r,s=i[0].slice(t*e,e);return new P([s])};S.prototype.visitNull=F(Hd);S.prototype.visitBool=F(Jd);S.prototype.visitInt=F(Gd);S.prototype.visitInt8=F(_r);S.prototype.visitInt16=F(_r);S.prototype.visitInt32=F(_r);S.prototype.visitInt64=F(uu);S.prototype.visitUint8=F(_r);S.prototype.visitUint16=F(_r);S.prototype.visitUint32=F(_r);S.prototype.visitUint64=F(uu);S.prototype.visitFloat=F(Xd);S.prototype.visitFloat16=F(qd);S.prototype.visitFloat32=F(_r);S.prototype.visitFloat64=F(_r);S.prototype.visitUtf8=F(du);S.prototype.visitLargeUtf8=F(du);S.prototype.visitBinary=F(fu);S.prototype.visitLargeBinary=F(fu);S.prototype.visitFixedSizeBinary=F(Kd);S.prototype.visitDate=F(Yd);S.prototype.visitDateDay=F(cu);S.prototype.visitDateMillisecond=F(lu);S.prototype.visitTimestamp=F(Zd);S.prototype.visitTimestampSecond=F(hu);S.prototype.visitTimestampMillisecond=F(pu);S.prototype.visitTimestampMicrosecond=F(mu);S.prototype.visitTimestampNanosecond=F(yu);S.prototype.visitTime=F(Qd);S.prototype.visitTimeSecond=F(gu);S.prototype.visitTimeMillisecond=F(bu);S.prototype.visitTimeMicrosecond=F(_u);S.prototype.visitTimeNanosecond=F(wu);S.prototype.visitDecimal=F(th);S.prototype.visitList=F(eh);S.prototype.visitStruct=F(ih);S.prototype.visitUnion=F(nh);S.prototype.visitDenseUnion=F(vu);S.prototype.visitSparseUnion=F(Iu);S.prototype.visitDictionary=F(sh);S.prototype.visitInterval=F(oh);S.prototype.visitIntervalDayTime=F(Su);S.prototype.visitIntervalYearMonth=F(xu);S.prototype.visitDuration=F(ah);S.prototype.visitDurationSecond=F(Tu);S.prototype.visitDurationMillisecond=F(Bu);S.prototype.visitDurationMicrosecond=F(Ou);S.prototype.visitDurationNanosecond=F(Du);S.prototype.visitFixedSizeList=F(ch);S.prototype.visitMap=F(rh);var ft=new S;var wr=Symbol.for("keys"),oi=Symbol.for("vals"),si=Symbol.for("kKeysAsStrings"),za=Symbol.for("_kKeysAsStrings"),xe=class{constructor(t){return this[wr]=new P([t.children[0]]).memoize(),this[oi]=t.children[1],new Proxy(this,new $a)}get[si](){return this[za]||(this[za]=Array.from(this[wr].toArray(),String))}[Symbol.iterator](){return new Wa(this[wr],this[oi])}get size(){return this[wr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[wr],e=this[oi],i={};for(let n=-1,s=t.length;++n<s;)i[t.get(n)]=ft.visit(e,n);return i}toString(){return`{${[...this].map(([t,e])=>`${ae(t)}: ${ae(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Wa=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ft.visit(this.vals,t)]})}},$a=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[si]}has(t,e){return t[si].includes(e)}getOwnPropertyDescriptor(t,e){if(t[si].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let i=t[si].indexOf(e);if(i!==-1){let n=ft.visit(Reflect.get(t,oi),i);return Reflect.set(t,e,n),n}}set(t,e,i){let n=t[si].indexOf(e);return n!==-1?(wt.visit(Reflect.get(t,oi),n,i),Reflect.set(t,e,i)):Reflect.has(t,e)?Reflect.set(t,e,i):!1}};Object.defineProperties(xe.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[oi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[za]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Fu;function tn(r,t,e,i){let{length:n=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?n:e;return s<0&&(s=(s%n+n)%n),o<0&&(o=(o%n+n)%n),o<s&&(Fu=s,s=o,o=Fu),o>n&&(o=n),i?i(r,s,o):[s,o]}var Er=(r,t)=>r<0?t+r:r,Au=r=>r!==r;function vr(r){if(typeof r!=="object"||r===null)return Au(r)?Au:e=>e===r;if(r instanceof Date){let e=r.valueOf();return i=>i instanceof Date?i.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?Ia(r,e):!1:r instanceof Map?uh(r):Array.isArray(r)?lh(r):r instanceof P?fh(r):dh(r,!0)}function lh(r){let t=[];for(let e=-1,i=r.length;++e<i;)t[e]=vr(r[e]);return qs(t)}function uh(r){let t=-1,e=[];for(let i of r.values())e[++t]=vr(i);return qs(e)}function fh(r){let t=[];for(let e=-1,i=r.length;++e<i;)t[e]=vr(r.get(e));return qs(t)}function dh(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let i=[];for(let n=-1,s=e.length;++n<s;)i[n]=vr(r[e[n]]);return qs(i,e)}function qs(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return hh(r,e);case Map:return Nu(r,e,e.keys());case xe:case br:case Object:case void 0:return Nu(r,e,t||Object.keys(e))}return e instanceof P?ph(r,e):!1}}function hh(r,t){let e=r.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!r[i](t[i]))return!1;return!0}function ph(r,t){let e=r.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!r[i](t.get(i)))return!1;return!0}function Nu(r,t,e){let i=e[Symbol.iterator](),n=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),l=i.next(),u=n.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=i.next(),u=n.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(i.return&&i.return(),n.return&&n.return(),s.return&&s.return(),!1)}var Ja={};or(Ja,{BitIterator:()=>Lr,getBit:()=>Eu,getBool:()=>Gs,packBools:()=>Mr,popcnt_array:()=>Lu,popcnt_bit_range:()=>en,popcnt_uint32:()=>Ks,setBool:()=>mh,truncateBitmap:()=>Ur});function Gs(r,t,e,i){return(e&1<<i)!==0}function Eu(r,t,e,i){return(e&1<<i)>>i}function mh(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Ur(r,t,e){let i=e.byteLength+7&-8;if(r>0||e.byteLength<i){let n=new Uint8Array(i);return n.set(r%8===0?e.subarray(r>>3):Mr(new Lr(e,r,t,null,Gs)).subarray(0,i)),n}return e}function Mr(r){let t=[],e=0,i=0,n=0;for(let o of r)o&&(n|=1<<i),++i===8&&(t[e++]=n,n=i=0);(e===0||i>0)&&(t[e++]=n);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var Lr=class{constructor(t,e,i,n,s){this.bytes=t,this.length=i,this.context=n,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function en(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new Lr(r,t,e-t,r,Eu))s+=o;return s}let i=e>>3<<3,n=t+(t%8===0?0:8-t%8);return en(r,t,n)+en(r,i,e)+Lu(r,n>>3,i-n>>3)}function Lu(r,t,e){let i=0,n=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:n+e;for(;o-n>=4;)i+=Ks(s.getUint32(n)),n+=4;for(;o-n>=2;)i+=Ks(s.getUint16(n)),n+=2;for(;o-n>=1;)i+=Ks(s.getUint8(n)),n+=1;return i}function Ks(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var yh=-1,W=class r{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return g.isSparseUnion(t)?this.children.some(e=>e.nullable):g.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:i,nullBitmap:n,typeIds:s}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(g.isUnion(this.type))return this.children.reduce((i,n)=>i+n.nullCount,0);let t=this._nullCount,e;return t<=yh&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-en(e,this.offset,this.offset+this.length)),t}constructor(t,e,i,n,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1));let c;s instanceof r?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=zt(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(g.isUnion(e)){let i=e,n=this.children[i.typeIdToChildIndex[this.typeIds[t]]],s=i.mode===Z.Dense?this.valueOffsets[t]:t;return n.getValid(s)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(t,e){let i,{type:n}=this;if(g.isUnion(n)){let s=n,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===Z.Dense?this.valueOffsets[t]:t;i=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Ur(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let d=s[u];i=(d&l)!==0,s[u]=e?d|l:d&~l}return i!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,i=this.length,n=this._nullCount,s=this,o=this.children){return new r(t,e,i,n,s,o,this.dictionary)}slice(t,e){let{stride:i,typeId:n,children:s}=this,o=+(this._nullCount===0)-1,a=n===16?i:1,c=this._sliceBuffers(t,e,i,n);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:i}=this,n=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);n[e>>3]=(1<<e-(e&-8))-1,i>0&&n.set(Ur(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Gt.VALIDITY]=n,this.clone(this.type,0,t,i+(t-e),s)}_sliceBuffers(t,e,i,n){let s,{buffers:o}=this;return(s=o[Gt.TYPE])&&(o[Gt.TYPE]=s.subarray(t,t+e)),(s=o[Gt.OFFSET])&&(o[Gt.OFFSET]=s.subarray(t,t+e+1))||(s=o[Gt.DATA])&&(o[Gt.DATA]=n===6?s:s.subarray(i*t,i*(t+e))),o}_sliceChildren(t,e,i){return t.map(n=>n.slice(e,i))}};W.prototype.children=Object.freeze([]);var qa=class r extends I{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:i=0,["length"]:n=0}=t;return new W(e,i,n,n)}visitBool(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitInt(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitFloat(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitUtf8(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=hs(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitBinary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=hs(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitDate(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitTimestamp(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitTime(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitDecimal(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitList(t){let{["type"]:e,["offset"]:i=0,["child"]:n}=t,s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,void 0,s],[n])}visitStruct(t){let{["type"]:e,["offset"]:i=0,["children"]:n=[]}=t,s=D(t.nullBitmap),{length:o=n.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,void 0,s],n)}visitUnion(t){let{["type"]:e,["offset"]:i=0,["children"]:n=[]}=t,s=R(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(g.isSparseUnion(e))return new W(e,i,o,a,[void 0,void 0,void 0,s],n);let c=Ar(t.valueOffsets);return new W(e,i,o,a,[c,void 0,void 0,s],n)}visitDictionary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.indices.ArrayType,t.data),{["dictionary"]:o=new P([new r().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[void 0,s,n],[],o)}visitInterval(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitDuration(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitFixedSizeList(t){let{["type"]:e,["offset"]:i=0,["child"]:n=new r().visit({type:e.valueType})}=t,s=D(t.nullBitmap),{["length"]:o=n.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,void 0,s],[n])}visitMap(t){let{["type"]:e,["offset"]:i=0,["child"]:n=new r().visit({type:e.childType})}=t,s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,void 0,s],[n])}},gh=new qa;function E(r){return gh.visit(r)}var rn=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Uu(r){return r.some(t=>t.nullable)}function Xs(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Ys(r){return r.reduce((t,e,i)=>(t[i+1]=t[i]+e.length,t),new Uint32Array(r.length+1))}function Zs(r,t,e,i){let n=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:l}=a;if(c>=i)break;if(e>=c+l)continue;if(c>=e&&c+l<=i){n.push(a);continue}let u=Math.max(0,e-c),d=Math.min(i-c,l);n.push(a.slice(u,d-u))}return n.length===0&&n.push(r[0].slice(0,0)),n}function Ka(r,t,e,i){let n=0,s=0,o=t.length-1;do{if(n>=o-1)return e<t[o]?i(r,n,e-t[n]):null;s=n+Math.trunc((o-n)*.5),e<t[s]?o=s:n=s}while(n<o)}function nn(r,t){return r.getValid(t)}function ai(r){function t(e,i,n){return r(e[i],n)}return function(e){let i=this.data;return Ka(i,this._offsets,e,t)}}function Qs(r){let t;function e(i,n,s){return r(i[n],s,t)}return function(i,n){let s=this.data;t=n;let o=Ka(s,this._offsets,i,e);return t=void 0,o}}function to(r){let t;function e(i,n,s){let o=s,a=0,c=0;for(let l=n-1,u=i.length;++l<u;){let d=i[l];if(~(a=r(d,t,o)))return c+a;o=0,c+=d.length}return-1}return function(i,n){t=i;let s=this.data,o=typeof n!="number"?e(s,0,0):Ka(s,this._offsets,n,e);return t=void 0,o}}var x=class extends I{};function bh(r,t){return t===null&&r.length>0?0:-1}function _h(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let i=0;for(let n of new Lr(e,r.offset+(t||0),r.length,e,Gs)){if(!n)return i;++i}return-1}function L(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case f.Union:break;case f.Dictionary:break;default:return _h(r,e)}let i=ft.getVisitFn(r),n=vr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(n(i(r,s)))return s;return-1}function Mu(r,t,e){let i=ft.getVisitFn(r),n=vr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(n(i(r,s)))return s;return-1}x.prototype.visitNull=bh;x.prototype.visitBool=L;x.prototype.visitInt=L;x.prototype.visitInt8=L;x.prototype.visitInt16=L;x.prototype.visitInt32=L;x.prototype.visitInt64=L;x.prototype.visitUint8=L;x.prototype.visitUint16=L;x.prototype.visitUint32=L;x.prototype.visitUint64=L;x.prototype.visitFloat=L;x.prototype.visitFloat16=L;x.prototype.visitFloat32=L;x.prototype.visitFloat64=L;x.prototype.visitUtf8=L;x.prototype.visitLargeUtf8=L;x.prototype.visitBinary=L;x.prototype.visitLargeBinary=L;x.prototype.visitFixedSizeBinary=L;x.prototype.visitDate=L;x.prototype.visitDateDay=L;x.prototype.visitDateMillisecond=L;x.prototype.visitTimestamp=L;x.prototype.visitTimestampSecond=L;x.prototype.visitTimestampMillisecond=L;x.prototype.visitTimestampMicrosecond=L;x.prototype.visitTimestampNanosecond=L;x.prototype.visitTime=L;x.prototype.visitTimeSecond=L;x.prototype.visitTimeMillisecond=L;x.prototype.visitTimeMicrosecond=L;x.prototype.visitTimeNanosecond=L;x.prototype.visitDecimal=L;x.prototype.visitList=L;x.prototype.visitStruct=L;x.prototype.visitUnion=L;x.prototype.visitDenseUnion=Mu;x.prototype.visitSparseUnion=Mu;x.prototype.visitDictionary=L;x.prototype.visitInterval=L;x.prototype.visitIntervalDayTime=L;x.prototype.visitIntervalYearMonth=L;x.prototype.visitDuration=L;x.prototype.visitDurationSecond=L;x.prototype.visitDurationMillisecond=L;x.prototype.visitDurationMicrosecond=L;x.prototype.visitDurationNanosecond=L;x.prototype.visitFixedSizeList=L;x.prototype.visitMap=L;var Rr=new x;var T=class extends I{};function A(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(g.isInt(t)&&t.bitWidth!==64||g.isTime(t)&&t.bitWidth!==64||g.isFloat(t)&&t.precision!==G.HALF))return new rn(r.data.length,i=>{let n=r.data[i];return n.values.subarray(0,n.length)[Symbol.iterator]()});let e=0;return new rn(r.data.length,i=>{let s=r.data[i].length,o=r.slice(e,e+s);return e+=s,new Ga(o)})}var Ga=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};T.prototype.visitNull=A;T.prototype.visitBool=A;T.prototype.visitInt=A;T.prototype.visitInt8=A;T.prototype.visitInt16=A;T.prototype.visitInt32=A;T.prototype.visitInt64=A;T.prototype.visitUint8=A;T.prototype.visitUint16=A;T.prototype.visitUint32=A;T.prototype.visitUint64=A;T.prototype.visitFloat=A;T.prototype.visitFloat16=A;T.prototype.visitFloat32=A;T.prototype.visitFloat64=A;T.prototype.visitUtf8=A;T.prototype.visitLargeUtf8=A;T.prototype.visitBinary=A;T.prototype.visitLargeBinary=A;T.prototype.visitFixedSizeBinary=A;T.prototype.visitDate=A;T.prototype.visitDateDay=A;T.prototype.visitDateMillisecond=A;T.prototype.visitTimestamp=A;T.prototype.visitTimestampSecond=A;T.prototype.visitTimestampMillisecond=A;T.prototype.visitTimestampMicrosecond=A;T.prototype.visitTimestampNanosecond=A;T.prototype.visitTime=A;T.prototype.visitTimeSecond=A;T.prototype.visitTimeMillisecond=A;T.prototype.visitTimeMicrosecond=A;T.prototype.visitTimeNanosecond=A;T.prototype.visitDecimal=A;T.prototype.visitList=A;T.prototype.visitStruct=A;T.prototype.visitUnion=A;T.prototype.visitDenseUnion=A;T.prototype.visitSparseUnion=A;T.prototype.visitDictionary=A;T.prototype.visitInterval=A;T.prototype.visitIntervalDayTime=A;T.prototype.visitIntervalYearMonth=A;T.prototype.visitDuration=A;T.prototype.visitDurationSecond=A;T.prototype.visitDurationMillisecond=A;T.prototype.visitDurationMicrosecond=A;T.prototype.visitDurationNanosecond=A;T.prototype.visitFixedSizeList=A;T.prototype.visitMap=A;var ci=new T;var Ru,ku={},Cu={},P=class r{constructor(t){var e,i,n;let s=t[0]instanceof r?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof W)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=ku[o.typeId],u=s[0];this.isValid=d=>nn(u,d),this.get=d=>a(u,d),this.set=(d,p)=>c(u,d,p),this.indexOf=d=>l(u,d),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,Cu[o.typeId]),this._offsets=Ys(s);break}this.data=s,this.type=o,this.stride=zt(o),this.numChildren=(n=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&n!==void 0?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Uu(this.data)}get nullCount(){return Xs(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Er(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return ci.visit(this)}concat(...t){return new r(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new r(tn(this,t,e,({data:i,_offsets:n},s,o)=>Zs(i,n,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:i,stride:n,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,i*n);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*n),o.offset),o.offset+=c*n,o),{array:new s(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new r(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return g.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(g.isDictionary(this.type)){let t=new eo(this.data[0].dictionary),e=this.data.map(i=>{let n=i.clone();return n.dictionary=t,n});return new r(e)}return new eo(this)}unmemoize(){if(g.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(i=>{let n=i.clone();return n.dictionary=t,n});return new r(e)}return this}};Ru=Symbol.toStringTag;P[Ru]=(r=>{r.type=g.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let i=ft.getVisitFnByTypeId(e),n=wt.getVisitFnByTypeId(e),s=Rr.getVisitFnByTypeId(e);ku[e]={get:i,set:n,indexOf:s},Cu[e]=Object.create(r,{isValid:{value:ai(nn)},get:{value:ai(ft.getVisitFnByTypeId(e))},set:{value:Qs(wt.getVisitFnByTypeId(e))},indexOf:{value:to(Rr.getVisitFnByTypeId(e))}})}return"Vector"})(P.prototype);var eo=class r extends P{constructor(t){super(t.data);let e=this.get,i=this.set,n=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(n.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new P(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Vu(r){if(!r||r.length<=0)return function(n){return!0};let t="",e=r.filter(i=>i===i);return e.length>0&&(t=`
|
|
1
|
+
"use strict";var influxdb=(()=>{var $o=Object.defineProperty;var Bf=Object.getOwnPropertyDescriptor;var Of=Object.getOwnPropertyNames;var Df=Object.prototype.hasOwnProperty;var or=(r,t)=>{for(var e in t)$o(r,e,{get:t[e],enumerable:!0})},Ff=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Of(t))!Df.call(r,n)&&n!==e&&$o(r,n,{get:()=>t[n],enumerable:!(i=Bf(t,n))||i.enumerable});return r};var Af=r=>Ff($o({},"__esModule",{value:!0}),r);var Bp={};or(Bp,{AbortError:()=>Si,DEFAULT_ConnectionOptions:()=>qo,DEFAULT_QueryOptions:()=>jn,DEFAULT_WriteOptions:()=>Ko,GetFieldTypeMissmatchError:()=>Wn,HttpError:()=>Ae,IllegalArgumentError:()=>ar,InfluxDBClient:()=>Pn,Log:()=>Br,Point:()=>xi,PointValues:()=>cr,RequestTimedOutError:()=>Ho,collectAll:()=>rl,consoleLogger:()=>$c,convertTime:()=>ea,convertTimeToNanos:()=>ta,createTextDecoderCombiner:()=>Jo,currentTime:()=>Yc,dateToProtocolTimestamp:()=>Zc,escape:()=>Ne,fromConnectionString:()=>Go,fromEnv:()=>Xo,isNumber:()=>Kr,setLogger:()=>Nf,useProcessHrtime:()=>Xc,writableDataToLineProtocol:()=>ra});var ar=class r extends Error{constructor(t){super(t),this.name="IllegalArgumentError",Object.setPrototypeOf(this,r.prototype)}},Ae=class r extends Error{constructor(e,i,n,s,o,a){var c;super();this.statusCode=e;this.statusMessage=i;this.body=n;this.contentType=s;this.headers=o;if(Object.setPrototypeOf(this,r.prototype),a)this.message=a;else if(n&&(s!=null&&s.startsWith("application/json")||!s))try{if(this.json=JSON.parse(n),this.message=this.json.message,this.code=this.json.code,!this.message){let l=this.json;(c=l.data)!=null&&c.error_message?this.message=l.data.error_message:l.error&&(this.message=l.error)}}catch(l){}this.message||(this.message=`${e} ${i} : ${n}`),this.name="HttpError"}},Ho=class r extends Error{constructor(){super(),Object.setPrototypeOf(this,r.prototype),this.name="RequestTimedOutError",this.message="Request timed out"}},Si=class r extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,r.prototype),this.message="Response aborted"}};function Jo(){let r=new TextDecoder("utf-8");return{concat(t,e){let i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i},copy(t,e,i){let n=new Uint8Array(i-e);return n.set(t.subarray(e,i)),n},toUtf8String(t,e,i){return r.decode(t.subarray(e,i))}}}var qo={timeout:1e4,queryTimeout:6e4},Ko={precision:"ns",gzipThreshold:1e3},jn={type:"sql"};function Go(r){if(!r)throw Error("Connection string not set!");let t=new URL(r.trim(),"http://localhost"),e={host:r.indexOf("://")>0?t.origin+t.pathname:t.pathname};return t.searchParams.has("token")&&(e.token=t.searchParams.get("token")),t.searchParams.has("authScheme")&&(e.authScheme=t.searchParams.get("authScheme")),t.searchParams.has("database")&&(e.database=t.searchParams.get("database")),t.searchParams.has("timeout")&&(e.timeout=parseInt(t.searchParams.get("timeout"))),t.searchParams.has("precision")&&(e.writeOptions||(e.writeOptions={}),e.writeOptions.precision=t.searchParams.get("precision")),t.searchParams.has("gzipThreshold")&&(e.writeOptions||(e.writeOptions={}),e.writeOptions.gzipThreshold=parseInt(t.searchParams.get("gzipThreshold"))),e}function Xo(){if(!process.env.INFLUX_HOST)throw Error("INFLUX_HOST variable not set!");if(!process.env.INFLUX_TOKEN)throw Error("INFLUX_TOKEN variable not set!");let r={host:process.env.INFLUX_HOST.trim()};return process.env.INFLUX_TOKEN&&(r.token=process.env.INFLUX_TOKEN.trim()),process.env.INFLUX_AUTH_SCHEME&&(r.authScheme=process.env.INFLUX_AUTH_SCHEME.trim()),process.env.INFLUX_DATABASE&&(r.database=process.env.INFLUX_DATABASE.trim()),process.env.INFLUX_TIMEOUT&&(r.timeout=parseInt(process.env.INFLUX_TIMEOUT.trim())),process.env.INFLUX_PRECISION&&(r.writeOptions||(r.writeOptions={}),r.writeOptions.precision=process.env.INFLUX_PRECISION),process.env.INFLUX_GZIP_THRESHOLD&&(r.writeOptions||(r.writeOptions={}),r.writeOptions.gzipThreshold=parseInt(process.env.INFLUX_GZIP_THRESHOLD)),r}var $c={error(r,t){console.error(`ERROR: ${r}`,t||"")},warn(r,t){console.warn(`WARN: ${r}`,t||"")}},zn=$c,Br={error(r,t){zn.error(r,t)},warn(r,t){zn.warn(r,t)}};function Nf(r){let t=zn;return zn=r,t}function Yo(r,t){return function(e){let i="",n=0,s=0;for(;s<e.length;){let o=r.indexOf(e[s]);o>=0&&(i+=e.substring(n,s),i+=t[o],n=s+1),s++}return n==0?e:(n<e.length&&(i+=e.substring(n,e.length)),i)}}function Ef(r,t){let e=Yo(r,t);return i=>`"${e(i)}"`}var Ne={measurement:Yo(`,
|
|
2
|
+
\r `,["\\,","\\ ","\\n","\\r","\\t"]),quoted:Ef('"\\',['\\"',"\\\\"]),tag:Yo(`, =
|
|
3
|
+
\r `,["\\,","\\ ","\\=","\\n","\\r","\\t"])};var Gc="000000000";function Xc(r){return!1}Xc(!0);var Hc=Date.now(),Zo=0;function Qo(){{let r=Date.now();r!==Hc?(Hc=r,Zo=0):Zo++;let t=String(Zo);return String(r)+Gc.substr(0,6-t.length)+t}}function Jc(){return String(Date.now())+Gc.substr(0,3)}function qc(){return String(Date.now())}function Kc(){return String(Math.floor(Date.now()/1e3))}var Yc={s:Kc,ms:qc,us:Jc,ns:Qo,seconds:Kc,millis:qc,micros:Jc,nanos:Qo},Zc={s:r=>`${Math.floor(r.getTime()/1e3)}`,ms:r=>`${r.getTime()}`,us:r=>`${r.getTime()}000`,ns:r=>`${r.getTime()}000000`};function ta(r){return r===void 0?Qo():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?`${r.getTime()}000000`:String(typeof r=="number"?Math.floor(r):r)}var ea=(r,t="ns")=>r===void 0?Yc[t]():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?Zc[t](r):String(typeof r=="number"?Math.floor(r):r);var qr=r=>{throw r},Qc=r=>r!==void 0,tl=r=>r instanceof Array||r instanceof Object&&typeof r.length=="number"&&(r.length===0||Object.getOwnPropertyNames(r).some(t=>t==="0")),el=r=>{let t=new Uint8Array(4);return t[0]=r>>0,t[1]=r>>8,t[2]=r>>16,t[3]=r>>24,t},rl=async r=>{let t=[];for await(let e of r)t.push(e);return t},Kr=r=>r===null||typeof r=="string"&&(r===""||r.indexOf(" ")!==-1)?!1:r!==""&&!isNaN(Number(r==null?void 0:r.toString())),il=r=>Kr(r)?typeof r=="string"?Number(r)>=0:typeof r=="number"&&r>=0:!1;var ra=(r,t)=>{let e=tl(r)&&typeof r!="string"?Array.from(r):[r];return e.length===0?[]:typeof e[0]=="string"?e:e.map(n=>n.toLineProtocol(void 0,t)).filter(Qc)};var Lf=r=>typeof r=="number"?"float":typeof r=="string"?"string":typeof r=="boolean"?"boolean":void 0,Wn=class r extends Error{constructor(t,e,i){super(`field ${t} of type ${i} doesn't match expected type ${e}!`),this.name="GetFieldTypeMissmatchError",Object.setPrototypeOf(this,r.prototype)}},cr=class r{constructor(){this._tags={};this._fields={}}getMeasurement(){return this._name}setMeasurement(t){return this._name=t,this}getTimestamp(){return this._time}setTimestamp(t){return this._time=t,this}getTag(t){return this._tags[t]}setTag(t,e){return this._tags[t]=e,this}removeTag(t){return delete this._tags[t],this}getTagNames(){return Object.keys(this._tags)}getFloatField(t){return this.getField(t,"float")}setFloatField(t,e){let i;if(typeof e=="number"?i=e:i=parseFloat(e),!isFinite(i))throw new Error(`invalid float value for field '${t}': '${e}'!`);return this._fields[t]=["float",i],this}getIntegerField(t){return this.getField(t,"integer")}setIntegerField(t,e){let i;if(typeof e=="number"?i=e:i=parseInt(String(e)),isNaN(i)||i<=-9223372036854776e3||i>=9223372036854776e3)throw new Error(`invalid integer value for field '${t}': '${e}'!`);return this._fields[t]=["integer",Math.floor(i)],this}getUintegerField(t){return this.getField(t,"uinteger")}setUintegerField(t,e){if(typeof e=="number"){if(isNaN(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${t}' out of range: ${e}`);this._fields[t]=["uinteger",Math.floor(e)]}else{let i=String(e);for(let n=0;n<i.length;n++){let s=i.charCodeAt(n);if(s<48||s>57)throw new Error(`uint value has an unsupported character at pos ${n}: ${e}`)}if(i.length>20||i.length===20&&i.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${t}' out of range: ${i}`);this._fields[t]=["uinteger",+i]}return this}getStringField(t){return this.getField(t,"string")}setStringField(t,e){return e!=null&&(typeof e!="string"&&(e=String(e)),this._fields[t]=["string",e]),this}getBooleanField(t){return this.getField(t,"boolean")}setBooleanField(t,e){return this._fields[t]=["boolean",!!e],this}getField(t,e){let i=this._fields[t];if(!i)return;let[n,s]=i;if(e!==void 0&&e!==n)throw new Wn(t,e,n);return s}getFieldType(t){let e=this._fields[t];if(e)return e[0]}setField(t,e,i){switch(i!=null?i:Lf(e)){case"string":return this.setStringField(t,e);case"boolean":return this.setBooleanField(t,e);case"float":return this.setFloatField(t,e);case"integer":return this.setIntegerField(t,e);case"uinteger":return this.setUintegerField(t,e);case void 0:return this;default:throw new Error(`invalid field type for field '${t}': type -> ${i}, value -> ${e}!`)}}setFields(t){for(let[e,i]of Object.entries(t))this.setField(e,i);return this}removeField(t){return delete this._fields[t],this}getFieldNames(){return Object.keys(this._fields)}hasFields(){return this.getFieldNames().length>0}copy(){let t=new r;return t._name=this._name,t._time=this._time,t._tags=Object.fromEntries(Object.entries(this._tags)),t._fields=Object.fromEntries(Object.entries(this._fields).map(e=>[...e])),t}asPoint(t){return xi.fromValues(t?this.setMeasurement(t):this)}};var Uf=(r,t)=>{switch(r){case"string":return Ne.quoted(t);case"boolean":return t?"T":"F";case"float":return`${t}`;case"integer":return`${t}i`;case"uinteger":return`${t}u`}},xi=class r{constructor(t){t instanceof cr?this._values=t:this._values=new cr,typeof t=="string"&&this._values.setMeasurement(t)}static measurement(t){return new r(t)}static fromValues(t){if(!t.getMeasurement()||t.getMeasurement()==="")throw new Error("Cannot convert values to point without measurement set!");return new r(t)}getMeasurement(){return this._values.getMeasurement()}setMeasurement(t){return t!==""&&this._values.setMeasurement(t),this}getTimestamp(){return this._values.getTimestamp()}setTimestamp(t){return this._values.setTimestamp(t),this}getTag(t){return this._values.getTag(t)}setTag(t,e){return this._values.setTag(t,e),this}removeTag(t){return this._values.removeTag(t),this}getTagNames(){return this._values.getTagNames()}getFloatField(t){return this._values.getFloatField(t)}setFloatField(t,e){return this._values.setFloatField(t,e),this}getIntegerField(t){return this._values.getIntegerField(t)}setIntegerField(t,e){return this._values.setIntegerField(t,e),this}getUintegerField(t){return this._values.getUintegerField(t)}setUintegerField(t,e){return this._values.setUintegerField(t,e),this}getStringField(t){return this._values.getStringField(t)}setStringField(t,e){return this._values.setStringField(t,e),this}getBooleanField(t){return this._values.getBooleanField(t)}setBooleanField(t,e){return this._values.setBooleanField(t,e),this}getField(t,e){return this._values.getField(t,e)}getFieldType(t){return this._values.getFieldType(t)}setField(t,e,i){return this._values.setField(t,e,i),this}setFields(t){return this._values.setFields(t),this}removeField(t){return this._values.removeField(t),this}getFieldNames(){return this._values.getFieldNames()}hasFields(){return this._values.hasFields()}copy(){return new r(this._values.copy())}toLineProtocol(t,e){if(!this._values.getMeasurement())return;let i="";if(this._values.getFieldNames().sort().forEach(a=>{if(a){let c=this._values.getFieldType(a),l=this._values.getField(a);if(c===void 0||l===void 0)return;let u=Uf(c,l);i.length>0&&(i+=","),i+=`${Ne.tag(a)}=${u}`}}),i.length===0)return;let n="",s=this._values.getTagNames();if(e){let a=new Set(s),c=Object.keys(e);for(let l=c.length;l--;)a.has(c[l])&&c.splice(l,1);c.sort().forEach(l=>{if(l){let u=e[l];u&&(n+=",",n+=`${Ne.tag(l)}=${Ne.tag(u)}`)}})}s.sort().forEach(a=>{if(a){let c=this._values.getTag(a);c&&(n+=",",n+=`${Ne.tag(a)}=${Ne.tag(c)}`)}});let o=this._values.getTimestamp();return t?typeof t=="string"?o=ea(o,t):o=t(o):o=ta(o),`${Ne.measurement(this.getMeasurement())}${n} ${i}${o!==void 0?` ${o}`:""}`}toString(){let t=this.toLineProtocol(void 0);return t||`invalid point: ${JSON.stringify(this,void 0)}`}};function ia(r={}){let t=0,e={next:i=>{if(t===0&&r.next&&i!==null&&i!==void 0)return r.next(i)},error:i=>{t===0&&(t=1,r.error&&r.error(i))},complete:()=>{t===0&&(t=2,r.complete&&r.complete())},responseStarted:(i,n)=>{r.responseStarted&&r.responseStarted(i,n)}};return r.useCancellable&&(e.useCancellable=r.useCancellable.bind(r)),r.useResume&&(e.useResume=r.useResume.bind(r)),e}function $n(r){let t={};return r.headers.forEach((e,i)=>{let n=t[i];n===void 0?t[i]=e:Array.isArray(n)?n.push(e):t[i]=[n,e]}),t}var Ti=class{constructor(t){this._connectionOptions=t;this.chunkCombiner=Jo();this.requestDecorator=function(){};var e;if(this._defaultHeaders={"content-type":"application/json; charset=utf-8",...t.headers},this._connectionOptions.token){let i=(e=this._connectionOptions.authScheme)!=null?e:"Token";this._defaultHeaders.Authorization=`${i} ${this._connectionOptions.token}`}this._url=String(this._connectionOptions.host),this._url.endsWith("/")&&(this._url=this._url.substring(0,this._url.length-1)),this._url.endsWith("/api/v2")&&(this._url=this._url.substring(0,this._url.length-7),Br.warn(`Please remove '/api/v2' context path from InfluxDB base url, using ${this._url} !`))}send(t,e,i,n){let s=ia(n),o=!1,a=i.signal,c,l=()=>{},u=l;if(n&&n.useCancellable){let d=new AbortController;a||(a=d.signal,i={...i,signal:a}),a.addEventListener("abort",()=>{u()}),n.useCancellable({cancel(){o=!0,d.abort()},isCancelled(){return o||a.aborted}})}this._fetch(t,e,i).then(async d=>{if(n!=null&&n.responseStarted&&s.responseStarted($n(d),d.status),await this._throwOnErrorResponse(d),d.body){let p=d.body.getReader(),I;do{if(c&&await c,o)break;if(I=await p.read(),s.next(I.value)===!1){let _=s.useResume;if(!_){let X="Unable to pause, useResume is not configured!";return await p.cancel(X),Promise.reject(new Error(X))}c=new Promise(X=>{u=()=>{X(),c=void 0,u=l},_(u)})}}while(!I.done)}else if(d.arrayBuffer){let p=await d.arrayBuffer();s.next(new Uint8Array(p))}else{let p=await d.text();s.next(new TextEncoder().encode(p))}}).catch(d=>{o||s.error(d)}).finally(()=>s.complete())}async _throwOnErrorResponse(t){if(t.status>=300){let e="";try{if(e=await t.text(),!e){let i=t.headers.get("x-influxdb-error");i&&(e=i)}}catch(i){throw Br.warn("Unable to receive error body",i),new Ae(t.status,t.statusText,void 0,t.headers.get("content-type"),$n(t))}throw new Ae(t.status,t.statusText,e,t.headers.get("content-type"),$n(t))}}async*iterate(t,e,i){var s;let n=await this._fetch(t,e,i);if(await this._throwOnErrorResponse(n),n.body){let o=n.body.getReader();for(;;){let{value:a,done:c}=await o.read();if(c)break;if((s=i.signal)!=null&&s.aborted)throw await n.body.cancel(),new Si;yield a}}else if(n.arrayBuffer){let o=await n.arrayBuffer();yield new Uint8Array(o)}else{let o=await n.text();yield new TextEncoder().encode(o)}}async request(t,e,i,n){var l,u;let s=await this._fetch(t,e,i),{headers:o}=s,a=o.get("content-type")||"";n&&n($n(s),s.status),await this._throwOnErrorResponse(s);let c=(u=(l=i.headers)==null?void 0:l.accept)!=null?u:a;if(c.includes("json"))return await s.json();if(c.includes("text")||c.startsWith("application/csv"))return await s.text()}_fetch(t,e,i){let{method:n,headers:s,...o}=i,a=`${this._url}${t}`,c={method:n,body:n==="GET"||n==="HEAD"?void 0:typeof e=="string"?e:JSON.stringify(e),headers:{...this._defaultHeaders,...s},credentials:"omit",...this._connectionOptions.transportOptions,...o};return this.requestDecorator(c,i,a),fetch(a,c)}};function Or(r){let t=typeof r;if(t=="object"){if(Array.isArray(r))return"array";if(r===null)return"null"}return t}function na(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}var Ee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Hn=[];for(let r=0;r<Ee.length;r++)Hn[Ee[r].charCodeAt(0)]=r;Hn[45]=Ee.indexOf("+");Hn[95]=Ee.indexOf("/");function Bi(r){let t=r.length*3/4;r[r.length-2]=="="?t-=2:r[r.length-1]=="="&&(t-=1);let e=new Uint8Array(t),i=0,n=0,s,o=0;for(let a=0;a<r.length;a++){if(s=Hn[r.charCodeAt(a)],s===void 0)switch(r[a]){case"=":n=0;case`
|
|
4
|
+
`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(n){case 0:o=s,n=1;break;case 1:e[i++]=o<<2|(s&48)>>4,o=s,n=2;break;case 2:e[i++]=(o&15)<<4|(s&60)>>2,o=s,n=3;break;case 3:e[i++]=(o&3)<<6|s,n=0;break}}if(n==1)throw Error("invalid base64 string.");return e.subarray(0,i)}function Oi(r){let t="",e=0,i,n=0;for(let s=0;s<r.length;s++)switch(i=r[s],e){case 0:t+=Ee[i>>2],n=(i&3)<<4,e=1;break;case 1:t+=Ee[n|i>>4],n=(i&15)<<2,e=2;break;case 2:t+=Ee[n|i>>6],t+=Ee[i&63],e=0;break}return e&&(t+=Ee[n],t+="=",e==1&&(t+="=")),t}var Dr;(function(r){r.symbol=Symbol.for("protobuf-ts/unknown"),r.onRead=(e,i,n,s,o)=>{(t(i)?i[r.symbol]:i[r.symbol]=[]).push({no:n,wireType:s,data:o})},r.onWrite=(e,i,n)=>{for(let{no:s,wireType:o,data:a}of r.list(i))n.tag(s,o).raw(a)},r.list=(e,i)=>{if(t(e)){let n=e[r.symbol];return i?n.filter(s=>s.no==i):n}return[]},r.last=(e,i)=>r.list(e,i).slice(-1)[0];let t=e=>e&&Array.isArray(e[r.symbol])})(Dr||(Dr={}));function sa(r,t){return Object.assign(Object.assign({},r),t)}var nt;(function(r){r[r.Varint=0]="Varint",r[r.Bit64=1]="Bit64",r[r.LengthDelimited=2]="LengthDelimited",r[r.StartGroup=3]="StartGroup",r[r.EndGroup=4]="EndGroup",r[r.Bit32=5]="Bit32"})(nt||(nt={}));function nl(){let r=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(r|=(n&127)<<i,!(n&128))return this.assertBounds(),[r,t]}let e=this.buf[this.pos++];if(r|=(e&15)<<28,t=(e&112)>>4,!(e&128))return this.assertBounds(),[r,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(n&127)<<i,!(n&128))return this.assertBounds(),[r,t]}throw new Error("invalid varint")}function qn(r,t,e){for(let s=0;s<28;s=s+7){let o=r>>>s,a=!(!(o>>>7)&&t==0),c=(a?o|128:o)&255;if(e.push(c),!a)return}let i=r>>>28&15|(t&7)<<4,n=!!(t>>3);if(e.push((n?i|128:i)&255),!!n){for(let s=3;s<31;s=s+7){let o=t>>>s,a=!!(o>>>7),c=(a?o|128:o)&255;if(e.push(c),!a)return}e.push(t>>>31&1)}}var Jn=65536*65536;function oa(r){let t=r[0]=="-";t&&(r=r.slice(1));let e=1e6,i=0,n=0;function s(o,a){let c=Number(r.slice(o,a));n*=e,i=i*e+c,i>=Jn&&(n=n+(i/Jn|0),i=i%Jn)}return s(-24,-18),s(-18,-12),s(-12,-6),s(-6),[t,i,n]}function Kn(r,t){if(t>>>0<=2097151)return""+(Jn*t+(r>>>0));let e=r&16777215,i=(r>>>24|t<<8)>>>0&16777215,n=t>>16&65535,s=e+i*6777216+n*6710656,o=i+n*8147497,a=n*2,c=1e7;s>=c&&(o+=Math.floor(s/c),s%=c),o>=c&&(a+=Math.floor(o/c),o%=c);function l(u,d){let p=u?String(u):"";return d?"0000000".slice(p.length)+p:p}return l(a,0)+l(o,a)+l(s,1)}function aa(r,t){if(r>=0){for(;r>127;)t.push(r&127|128),r=r>>>7;t.push(r)}else{for(let e=0;e<9;e++)t.push(r&127|128),r=r>>7;t.push(1)}}function sl(){let r=this.buf[this.pos++],t=r&127;if(!(r&128))return this.assertBounds(),t;if(r=this.buf[this.pos++],t|=(r&127)<<7,!(r&128))return this.assertBounds(),t;if(r=this.buf[this.pos++],t|=(r&127)<<14,!(r&128))return this.assertBounds(),t;if(r=this.buf[this.pos++],t|=(r&127)<<21,!(r&128))return this.assertBounds(),t;r=this.buf[this.pos++],t|=(r&15)<<28;for(let e=5;r&128&&e<10;e++)r=this.buf[this.pos++];if(r&128)throw new Error("invalid varint");return this.assertBounds(),t>>>0}var tt;function Mf(){let r=new DataView(new ArrayBuffer(8));tt=globalThis.BigInt!==void 0&&typeof r.getBigInt64=="function"&&typeof r.getBigUint64=="function"&&typeof r.setBigInt64=="function"&&typeof r.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:r}:void 0}Mf();function ol(r){if(!r)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var al=/^-?[0-9]+$/,Xn=4294967296,Gn=2147483648,Yn=class{constructor(t,e){this.lo=t|0,this.hi=e|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let t=this.hi*Xn+(this.lo>>>0);if(!Number.isSafeInteger(t))throw new Error("cannot convert to safe number");return t}},ut=class r extends Yn{static from(t){if(tt)switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=="")throw new Error("string is no integer");t=tt.C(t);case"number":if(t===0)return this.ZERO;t=tt.C(t);case"bigint":if(!t)return this.ZERO;if(t<tt.UMIN)throw new Error("signed value for ulong");if(t>tt.UMAX)throw new Error("ulong too large");return tt.V.setBigUint64(0,t,!0),new r(tt.V.getInt32(0,!0),tt.V.getInt32(4,!0))}else switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=t.trim(),!al.test(t))throw new Error("string is no integer");let[e,i,n]=oa(t);if(e)throw new Error("signed value for ulong");return new r(i,n);case"number":if(t==0)return this.ZERO;if(!Number.isSafeInteger(t))throw new Error("number is no integer");if(t<0)throw new Error("signed value for ulong");return new r(t,t/Xn)}throw new Error("unknown value "+typeof t)}toString(){return tt?this.toBigInt().toString():Kn(this.lo,this.hi)}toBigInt(){return ol(tt),tt.V.setInt32(0,this.lo,!0),tt.V.setInt32(4,this.hi,!0),tt.V.getBigUint64(0,!0)}};ut.ZERO=new ut(0,0);var K=class r extends Yn{static from(t){if(tt)switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=="")throw new Error("string is no integer");t=tt.C(t);case"number":if(t===0)return this.ZERO;t=tt.C(t);case"bigint":if(!t)return this.ZERO;if(t<tt.MIN)throw new Error("signed long too small");if(t>tt.MAX)throw new Error("signed long too large");return tt.V.setBigInt64(0,t,!0),new r(tt.V.getInt32(0,!0),tt.V.getInt32(4,!0))}else switch(typeof t){case"string":if(t=="0")return this.ZERO;if(t=t.trim(),!al.test(t))throw new Error("string is no integer");let[e,i,n]=oa(t);if(e){if(n>Gn||n==Gn&&i!=0)throw new Error("signed long too small")}else if(n>=Gn)throw new Error("signed long too large");let s=new r(i,n);return e?s.negate():s;case"number":if(t==0)return this.ZERO;if(!Number.isSafeInteger(t))throw new Error("number is no integer");return t>0?new r(t,t/Xn):new r(-t,-t/Xn).negate()}throw new Error("unknown value "+typeof t)}isNegative(){return(this.hi&Gn)!==0}negate(){let t=~this.hi,e=this.lo;return e?e=~e+1:t+=1,new r(e,t)}toString(){if(tt)return this.toBigInt().toString();if(this.isNegative()){let t=this.negate();return"-"+Kn(t.lo,t.hi)}return Kn(this.lo,this.hi)}toBigInt(){return ol(tt),tt.V.setInt32(0,this.lo,!0),tt.V.setInt32(4,this.hi,!0),tt.V.getBigInt64(0,!0)}};K.ZERO=new K(0,0);var cl={readUnknownField:!0,readerFactory:r=>new ca(r)};function ll(r){return r?Object.assign(Object.assign({},cl),r):cl}var ca=class{constructor(t,e){this.varint64=nl,this.uint32=sl,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.textDecoder=e!=null?e:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let t=this.uint32(),e=t>>>3,i=t&7;if(e<=0||i<0||i>5)throw new Error("illegal tag: field no "+e+" wire type "+i);return[e,i]}skip(t){let e=this.pos;switch(t){case nt.Varint:for(;this.buf[this.pos++]&128;);break;case nt.Bit64:this.pos+=4;case nt.Bit32:this.pos+=4;break;case nt.LengthDelimited:let i=this.uint32();this.pos+=i;break;case nt.StartGroup:let n;for(;(n=this.tag()[1])!==nt.EndGroup;)this.skip(n);break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(e,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return new K(...this.varint64())}uint64(){return new ut(...this.varint64())}sint64(){let[t,e]=this.varint64(),i=-(t&1);return t=(t>>>1|(e&1)<<31)^i,e=e>>>1^i,new K(t,e)}bool(){let[t,e]=this.varint64();return t!==0||e!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new ut(this.sfixed32(),this.sfixed32())}sfixed64(){return new K(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),e=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(e,e+t)}string(){return this.textDecoder.decode(this.bytes())}};function M(r,t){if(!r)throw new Error(t)}function la(r,t){throw new Error(t!=null?t:"Unexpected object: "+r)}var Rf=34028234663852886e22,kf=-34028234663852886e22,Cf=4294967295,Vf=2147483647,Pf=-2147483648;function Le(r){if(typeof r!="number")throw new Error("invalid int 32: "+typeof r);if(!Number.isInteger(r)||r>Vf||r<Pf)throw new Error("invalid int 32: "+r)}function lr(r){if(typeof r!="number")throw new Error("invalid uint 32: "+typeof r);if(!Number.isInteger(r)||r>Cf||r<0)throw new Error("invalid uint 32: "+r)}function Fr(r){if(typeof r!="number")throw new Error("invalid float 32: "+typeof r);if(Number.isFinite(r)&&(r>Rf||r<kf))throw new Error("invalid float 32: "+r)}var ul={writeUnknownFields:!0,writerFactory:()=>new ua};function fl(r){return r?Object.assign(Object.assign({},ul),r):ul}var ua=class{constructor(t){this.stack=[],this.textEncoder=t!=null?t:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let t=0;for(let n=0;n<this.chunks.length;n++)t+=this.chunks[n].length;let e=new Uint8Array(t),i=0;for(let n=0;n<this.chunks.length;n++)e.set(this.chunks[n],i),i+=this.chunks[n].length;return this.chunks=[],e}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),e=this.stack.pop();if(!e)throw new Error("invalid state, fork stack empty");return this.chunks=e.chunks,this.buf=e.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,e){return this.uint32((t<<3|e)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(lr(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return Le(t),aa(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let e=this.textEncoder.encode(t);return this.uint32(e.byteLength),this.raw(e)}float(t){Fr(t);let e=new Uint8Array(4);return new DataView(e.buffer).setFloat32(0,t,!0),this.raw(e)}double(t){let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t,!0),this.raw(e)}fixed32(t){lr(t);let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t,!0),this.raw(e)}sfixed32(t){Le(t);let e=new Uint8Array(4);return new DataView(e.buffer).setInt32(0,t,!0),this.raw(e)}sint32(t){return Le(t),t=(t<<1^t>>31)>>>0,aa(t,this.buf),this}sfixed64(t){let e=new Uint8Array(8),i=new DataView(e.buffer),n=K.from(t);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(e)}fixed64(t){let e=new Uint8Array(8),i=new DataView(e.buffer),n=ut.from(t);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(e)}int64(t){let e=K.from(t);return qn(e.lo,e.hi,this.buf),this}sint64(t){let e=K.from(t),i=e.hi>>31,n=e.lo<<1^i,s=(e.hi<<1|e.lo>>>31)^i;return qn(n,s,this.buf),this}uint64(t){let e=ut.from(t);return qn(e.lo,e.hi,this.buf),this}};var dl={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},hl={ignoreUnknownFields:!1};function fa(r){return r?Object.assign(Object.assign({},hl),r):hl}function da(r){return r?Object.assign(Object.assign({},dl),r):dl}function ha(r,t){var e,i;let n=Object.assign(Object.assign({},r),t);return n.typeRegistry=[...(e=r==null?void 0:r.typeRegistry)!==null&&e!==void 0?e:[],...(i=t==null?void 0:t.typeRegistry)!==null&&i!==void 0?i:[]],n}var Zn=Symbol.for("protobuf-ts/message-type");function Gr(r){let t=!1,e=[];for(let i=0;i<r.length;i++){let n=r.charAt(i);n=="_"?t=!0:/\d/.test(n)?(e.push(n),t=!0):t?(e.push(n.toUpperCase()),t=!1):i==0?e.push(n.toLowerCase()):e.push(n)}return e.join("")}var h;(function(r){r[r.DOUBLE=1]="DOUBLE",r[r.FLOAT=2]="FLOAT",r[r.INT64=3]="INT64",r[r.UINT64=4]="UINT64",r[r.INT32=5]="INT32",r[r.FIXED64=6]="FIXED64",r[r.FIXED32=7]="FIXED32",r[r.BOOL=8]="BOOL",r[r.STRING=9]="STRING",r[r.BYTES=12]="BYTES",r[r.UINT32=13]="UINT32",r[r.SFIXED32=15]="SFIXED32",r[r.SFIXED64=16]="SFIXED64",r[r.SINT32=17]="SINT32",r[r.SINT64=18]="SINT64"})(h||(h={}));var St;(function(r){r[r.BIGINT=0]="BIGINT",r[r.STRING=1]="STRING",r[r.NUMBER=2]="NUMBER"})(St||(St={}));var Di;(function(r){r[r.NO=0]="NO",r[r.PACKED=1]="PACKED",r[r.UNPACKED=2]="UNPACKED"})(Di||(Di={}));function pl(r){var t,e,i,n;return r.localName=(t=r.localName)!==null&&t!==void 0?t:Gr(r.name),r.jsonName=(e=r.jsonName)!==null&&e!==void 0?e:Gr(r.name),r.repeat=(i=r.repeat)!==null&&i!==void 0?i:Di.NO,r.opt=(n=r.opt)!==null&&n!==void 0?n:r.repeat||r.oneof?!1:r.kind=="message",r}function ml(r){if(typeof r!="object"||r===null||!r.hasOwnProperty("oneofKind"))return!1;switch(typeof r.oneofKind){case"string":return r[r.oneofKind]===void 0?!1:Object.keys(r).length==2;case"undefined":return Object.keys(r).length==1;default:return!1}}var Qn=class{constructor(t){var e;this.fields=(e=t.fields)!==null&&e!==void 0?e:[]}prepare(){if(this.data)return;let t=[],e=[],i=[];for(let n of this.fields)if(n.oneof)i.includes(n.oneof)||(i.push(n.oneof),t.push(n.oneof),e.push(n.oneof));else switch(e.push(n.localName),n.kind){case"scalar":case"enum":(!n.opt||n.repeat)&&t.push(n.localName);break;case"message":n.repeat&&t.push(n.localName);break;case"map":t.push(n.localName);break}this.data={req:t,known:e,oneofs:Object.values(i)}}is(t,e,i=!1){if(e<0)return!0;if(t==null||typeof t!="object")return!1;this.prepare();let n=Object.keys(t),s=this.data;if(n.length<s.req.length||s.req.some(o=>!n.includes(o))||!i&&n.some(o=>!s.known.includes(o)))return!1;if(e<1)return!0;for(let o of s.oneofs){let a=t[o];if(!ml(a))return!1;if(a.oneofKind===void 0)continue;let c=this.fields.find(l=>l.localName===a.oneofKind);if(!c||!this.field(a[a.oneofKind],c,i,e))return!1}for(let o of this.fields)if(o.oneof===void 0&&!this.field(t[o.localName],o,i,e))return!1;return!0}field(t,e,i,n){let s=e.repeat;switch(e.kind){case"scalar":return t===void 0?e.opt:s?this.scalars(t,e.T,n,e.L):this.scalar(t,e.T,e.L);case"enum":return t===void 0?e.opt:s?this.scalars(t,h.INT32,n):this.scalar(t,h.INT32);case"message":return t===void 0?!0:s?this.messages(t,e.T(),i,n):this.message(t,e.T(),i,n);case"map":if(typeof t!="object"||t===null)return!1;if(n<2)return!0;if(!this.mapKeys(t,e.K,n))return!1;switch(e.V.kind){case"scalar":return this.scalars(Object.values(t),e.V.T,n,e.V.L);case"enum":return this.scalars(Object.values(t),h.INT32,n);case"message":return this.messages(Object.values(t),e.V.T(),i,n)}break}return!0}message(t,e,i,n){return i?e.isAssignable(t,n):e.is(t,n)}messages(t,e,i,n){if(!Array.isArray(t))return!1;if(n<2)return!0;if(i){for(let s=0;s<t.length&&s<n;s++)if(!e.isAssignable(t[s],n-1))return!1}else for(let s=0;s<t.length&&s<n;s++)if(!e.is(t[s],n-1))return!1;return!0}scalar(t,e,i){let n=typeof t;switch(e){case h.UINT64:case h.FIXED64:case h.INT64:case h.SFIXED64:case h.SINT64:switch(i){case St.BIGINT:return n=="bigint";case St.NUMBER:return n=="number"&&!isNaN(t);default:return n=="string"}case h.BOOL:return n=="boolean";case h.STRING:return n=="string";case h.BYTES:return t instanceof Uint8Array;case h.DOUBLE:case h.FLOAT:return n=="number"&&!isNaN(t);default:return n=="number"&&Number.isInteger(t)}}scalars(t,e,i,n){if(!Array.isArray(t))return!1;if(i<2)return!0;if(Array.isArray(t)){for(let s=0;s<t.length&&s<i;s++)if(!this.scalar(t[s],e,n))return!1}return!0}mapKeys(t,e,i){let n=Object.keys(t);switch(e){case h.INT32:case h.FIXED32:case h.SFIXED32:case h.SINT32:case h.UINT32:return this.scalars(n.slice(0,i).map(s=>parseInt(s)),e,i);case h.BOOL:return this.scalars(n.slice(0,i).map(s=>s=="true"?!0:s=="false"?!1:s),e,i);default:return this.scalars(n,e,i,St.STRING)}}};function Ot(r,t){switch(t){case St.BIGINT:return r.toBigInt();case St.NUMBER:return r.toNumber();default:return r.toString()}}var ts=class{constructor(t){this.info=t}prepare(){var t;if(this.fMap===void 0){this.fMap={};let e=(t=this.info.fields)!==null&&t!==void 0?t:[];for(let i of e)this.fMap[i.name]=i,this.fMap[i.jsonName]=i,this.fMap[i.localName]=i}}assert(t,e,i){if(!t){let n=Or(i);throw(n=="number"||n=="boolean")&&(n=i.toString()),new Error(`Cannot parse JSON ${n} for ${this.info.typeName}#${e}`)}}read(t,e,i){this.prepare();let n=[];for(let[s,o]of Object.entries(t)){let a=this.fMap[s];if(!a){if(!i.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${s}`);continue}let c=a.localName,l;if(a.oneof){if(o===null&&(a.kind!=="enum"||a.T()[0]!=="google.protobuf.NullValue"))continue;if(n.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);n.push(a.oneof),l=e[a.oneof]={oneofKind:c}}else l=e;if(a.kind=="map"){if(o===null)continue;this.assert(na(o),a.name,o);let u=l[c];for(let[d,p]of Object.entries(o)){this.assert(p!==null,a.name+" map value",null);let I;switch(a.V.kind){case"message":I=a.V.T().internalJsonRead(p,i);break;case"enum":if(I=this.enum(a.V.T(),p,a.name,i.ignoreUnknownFields),I===!1)continue;break;case"scalar":I=this.scalar(p,a.V.T,a.V.L,a.name);break}this.assert(I!==void 0,a.name+" map value",p);let _=d;a.K==h.BOOL&&(_=_=="true"?!0:_=="false"?!1:_),_=this.scalar(_,a.K,St.STRING,a.name).toString(),u[_]=I}}else if(a.repeat){if(o===null)continue;this.assert(Array.isArray(o),a.name,o);let u=l[c];for(let d of o){this.assert(d!==null,a.name,null);let p;switch(a.kind){case"message":p=a.T().internalJsonRead(d,i);break;case"enum":if(p=this.enum(a.T(),d,a.name,i.ignoreUnknownFields),p===!1)continue;break;case"scalar":p=this.scalar(d,a.T,a.L,a.name);break}this.assert(p!==void 0,a.name,o),u.push(p)}}else switch(a.kind){case"message":if(o===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}l[c]=a.T().internalJsonRead(o,i,l[c]);break;case"enum":let u=this.enum(a.T(),o,a.name,i.ignoreUnknownFields);if(u===!1)continue;l[c]=u;break;case"scalar":l[c]=this.scalar(o,a.T,a.L,a.name);break}}}enum(t,e,i,n){if(t[0]=="google.protobuf.NullValue"&&M(e===null||e==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${i}, enum ${t[0]} only accepts null.`),e===null)return 0;switch(typeof e){case"number":return M(Number.isInteger(e),`Unable to parse field ${this.info.typeName}#${i}, enum can only be integral number, got ${e}.`),e;case"string":let s=e;t[2]&&e.substring(0,t[2].length)===t[2]&&(s=e.substring(t[2].length));let o=t[1][s];return typeof o=="undefined"&&n?!1:(M(typeof o=="number",`Unable to parse field ${this.info.typeName}#${i}, enum ${t[0]} has no value for "${e}".`),o)}M(!1,`Unable to parse field ${this.info.typeName}#${i}, cannot parse enum value from ${typeof e}".`)}scalar(t,e,i,n){let s;try{switch(e){case h.DOUBLE:case h.FLOAT:if(t===null)return 0;if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""){s="empty string";break}if(typeof t=="string"&&t.trim().length!==t.length){s="extra whitespace";break}if(typeof t!="string"&&typeof t!="number")break;let o=Number(t);if(Number.isNaN(o)){s="not a number";break}if(!Number.isFinite(o)){s="too large or small";break}return e==h.FLOAT&&Fr(o),o;case h.INT32:case h.FIXED32:case h.SFIXED32:case h.SINT32:case h.UINT32:if(t===null)return 0;let a;if(typeof t=="number"?a=t:t===""?s="empty string":typeof t=="string"&&(t.trim().length!==t.length?s="extra whitespace":a=Number(t)),a===void 0)break;return e==h.UINT32?lr(a):Le(a),a;case h.INT64:case h.SFIXED64:case h.SINT64:if(t===null)return Ot(K.ZERO,i);if(typeof t!="number"&&typeof t!="string")break;return Ot(K.from(t),i);case h.FIXED64:case h.UINT64:if(t===null)return Ot(ut.ZERO,i);if(typeof t!="number"&&typeof t!="string")break;return Ot(ut.from(t),i);case h.BOOL:if(t===null)return!1;if(typeof t!="boolean")break;return t;case h.STRING:if(t===null)return"";if(typeof t!="string"){s="extra whitespace";break}try{encodeURIComponent(t)}catch(c){c="invalid UTF8";break}return t;case h.BYTES:if(t===null||t==="")return new Uint8Array(0);if(typeof t!="string")break;return Bi(t)}}catch(o){s=o.message}this.assert(!1,n+(s?" - "+s:""),t)}};var es=class{constructor(t){var e;this.fields=(e=t.fields)!==null&&e!==void 0?e:[]}write(t,e){let i={},n=t;for(let s of this.fields){if(!s.oneof){let l=this.field(s,n[s.localName],e);l!==void 0&&(i[e.useProtoFieldName?s.name:s.jsonName]=l);continue}let o=n[s.oneof];if(o.oneofKind!==s.localName)continue;let a=s.kind=="scalar"||s.kind=="enum"?Object.assign(Object.assign({},e),{emitDefaultValues:!0}):e,c=this.field(s,o[s.localName],a);M(c!==void 0),i[e.useProtoFieldName?s.name:s.jsonName]=c}return i}field(t,e,i){let n;if(t.kind=="map"){M(typeof e=="object"&&e!==null);let s={};switch(t.V.kind){case"scalar":for(let[c,l]of Object.entries(e)){let u=this.scalar(t.V.T,l,t.name,!1,!0);M(u!==void 0),s[c.toString()]=u}break;case"message":let o=t.V.T();for(let[c,l]of Object.entries(e)){let u=this.message(o,l,t.name,i);M(u!==void 0),s[c.toString()]=u}break;case"enum":let a=t.V.T();for(let[c,l]of Object.entries(e)){M(l===void 0||typeof l=="number");let u=this.enum(a,l,t.name,!1,!0,i.enumAsInteger);M(u!==void 0),s[c.toString()]=u}break}(i.emitDefaultValues||Object.keys(s).length>0)&&(n=s)}else if(t.repeat){M(Array.isArray(e));let s=[];switch(t.kind){case"scalar":for(let c=0;c<e.length;c++){let l=this.scalar(t.T,e[c],t.name,t.opt,!0);M(l!==void 0),s.push(l)}break;case"enum":let o=t.T();for(let c=0;c<e.length;c++){M(e[c]===void 0||typeof e[c]=="number");let l=this.enum(o,e[c],t.name,t.opt,!0,i.enumAsInteger);M(l!==void 0),s.push(l)}break;case"message":let a=t.T();for(let c=0;c<e.length;c++){let l=this.message(a,e[c],t.name,i);M(l!==void 0),s.push(l)}break}(i.emitDefaultValues||s.length>0||i.emitDefaultValues)&&(n=s)}else switch(t.kind){case"scalar":n=this.scalar(t.T,e,t.name,t.opt,i.emitDefaultValues);break;case"enum":n=this.enum(t.T(),e,t.name,t.opt,i.emitDefaultValues,i.enumAsInteger);break;case"message":n=this.message(t.T(),e,t.name,i);break}return n}enum(t,e,i,n,s,o){if(t[0]=="google.protobuf.NullValue")return!s&&!n?void 0:null;if(e===void 0){M(n);return}if(!(e===0&&!s&&!n))return M(typeof e=="number"),M(Number.isInteger(e)),o||!t[1].hasOwnProperty(e)?e:t[2]?t[2]+t[1][e]:t[1][e]}message(t,e,i,n){return e===void 0?n.emitDefaultValues?null:void 0:t.internalJsonWrite(e,n)}scalar(t,e,i,n,s){if(e===void 0){M(n);return}let o=s||n;switch(t){case h.INT32:case h.SFIXED32:case h.SINT32:return e===0?o?0:void 0:(Le(e),e);case h.FIXED32:case h.UINT32:return e===0?o?0:void 0:(lr(e),e);case h.FLOAT:Fr(e);case h.DOUBLE:return e===0?o?0:void 0:(M(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e);case h.STRING:return e===""?o?"":void 0:(M(typeof e=="string"),e);case h.BOOL:return e===!1?o?!1:void 0:(M(typeof e=="boolean"),e);case h.UINT64:case h.FIXED64:M(typeof e=="number"||typeof e=="string"||typeof e=="bigint");let a=ut.from(e);return a.isZero()&&!o?void 0:a.toString();case h.INT64:case h.SFIXED64:case h.SINT64:M(typeof e=="number"||typeof e=="string"||typeof e=="bigint");let c=K.from(e);return c.isZero()&&!o?void 0:c.toString();case h.BYTES:return M(e instanceof Uint8Array),e.byteLength?Oi(e):o?"":void 0}}};function Fi(r,t=St.STRING){switch(r){case h.BOOL:return!1;case h.UINT64:case h.FIXED64:return Ot(ut.ZERO,t);case h.INT64:case h.SFIXED64:case h.SINT64:return Ot(K.ZERO,t);case h.DOUBLE:case h.FLOAT:return 0;case h.BYTES:return new Uint8Array(0);case h.STRING:return"";default:return 0}}var rs=class{constructor(t){this.info=t}prepare(){var t;if(!this.fieldNoToField){let e=(t=this.info.fields)!==null&&t!==void 0?t:[];this.fieldNoToField=new Map(e.map(i=>[i.no,i]))}}read(t,e,i,n){this.prepare();let s=n===void 0?t.len:t.pos+n;for(;t.pos<s;){let[o,a]=t.tag(),c=this.fieldNoToField.get(o);if(!c){let p=i.readUnknownField;if(p=="throw")throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);let I=t.skip(a);p!==!1&&(p===!0?Dr.onRead:p)(this.info.typeName,e,o,a,I);continue}let l=e,u=c.repeat,d=c.localName;switch(c.oneof&&(l=l[c.oneof],l.oneofKind!==d&&(l=e[c.oneof]={oneofKind:d})),c.kind){case"scalar":case"enum":let p=c.kind=="enum"?h.INT32:c.T,I=c.kind=="scalar"?c.L:void 0;if(u){let Y=l[d];if(a==nt.LengthDelimited&&p!=h.STRING&&p!=h.BYTES){let ft=t.uint32()+t.pos;for(;t.pos<ft;)Y.push(this.scalar(t,p,I))}else Y.push(this.scalar(t,p,I))}else l[d]=this.scalar(t,p,I);break;case"message":if(u){let Y=l[d],ft=c.T().internalBinaryRead(t,t.uint32(),i);Y.push(ft)}else l[d]=c.T().internalBinaryRead(t,t.uint32(),i,l[d]);break;case"map":let[_,X]=this.mapEntry(c,t,i);l[d][_]=X;break}}}mapEntry(t,e,i){let n=e.uint32(),s=e.pos+n,o,a;for(;e.pos<s;){let[c,l]=e.tag();switch(c){case 1:t.K==h.BOOL?o=e.bool().toString():o=this.scalar(e,t.K,St.STRING);break;case 2:switch(t.V.kind){case"scalar":a=this.scalar(e,t.V.T,t.V.L);break;case"enum":a=e.int32();break;case"message":a=t.V.T().internalBinaryRead(e,e.uint32(),i);break}break;default:throw new Error(`Unknown field ${c} (wire type ${l}) in map entry for ${this.info.typeName}#${t.name}`)}}if(o===void 0){let c=Fi(t.K);o=t.K==h.BOOL?c.toString():c}if(a===void 0)switch(t.V.kind){case"scalar":a=Fi(t.V.T,t.V.L);break;case"enum":a=0;break;case"message":a=t.V.T().create();break}return[o,a]}scalar(t,e,i){switch(e){case h.INT32:return t.int32();case h.STRING:return t.string();case h.BOOL:return t.bool();case h.DOUBLE:return t.double();case h.FLOAT:return t.float();case h.INT64:return Ot(t.int64(),i);case h.UINT64:return Ot(t.uint64(),i);case h.FIXED64:return Ot(t.fixed64(),i);case h.FIXED32:return t.fixed32();case h.BYTES:return t.bytes();case h.UINT32:return t.uint32();case h.SFIXED32:return t.sfixed32();case h.SFIXED64:return Ot(t.sfixed64(),i);case h.SINT32:return t.sint32();case h.SINT64:return Ot(t.sint64(),i)}}};var is=class{constructor(t){this.info=t}prepare(){if(!this.fields){let t=this.info.fields?this.info.fields.concat():[];this.fields=t.sort((e,i)=>e.no-i.no)}}write(t,e,i){this.prepare();for(let s of this.fields){let o,a,c=s.repeat,l=s.localName;if(s.oneof){let u=t[s.oneof];if(u.oneofKind!==l)continue;o=u[l],a=!0}else o=t[l],a=!1;switch(s.kind){case"scalar":case"enum":let u=s.kind=="enum"?h.INT32:s.T;if(c)if(M(Array.isArray(o)),c==Di.PACKED)this.packed(e,u,s.no,o);else for(let d of o)this.scalar(e,u,s.no,d,!0);else o===void 0?M(s.opt):this.scalar(e,u,s.no,o,a||s.opt);break;case"message":if(c){M(Array.isArray(o));for(let d of o)this.message(e,i,s.T(),s.no,d)}else this.message(e,i,s.T(),s.no,o);break;case"map":M(typeof o=="object"&&o!==null);for(let[d,p]of Object.entries(o))this.mapEntry(e,i,s,d,p);break}}let n=i.writeUnknownFields;n!==!1&&(n===!0?Dr.onWrite:n)(this.info.typeName,t,e)}mapEntry(t,e,i,n,s){t.tag(i.no,nt.LengthDelimited),t.fork();let o=n;switch(i.K){case h.INT32:case h.FIXED32:case h.UINT32:case h.SFIXED32:case h.SINT32:o=Number.parseInt(n);break;case h.BOOL:M(n=="true"||n=="false"),o=n=="true";break}switch(this.scalar(t,i.K,1,o,!0),i.V.kind){case"scalar":this.scalar(t,i.V.T,2,s,!0);break;case"enum":this.scalar(t,h.INT32,2,s,!0);break;case"message":this.message(t,e,i.V.T(),2,s);break}t.join()}message(t,e,i,n,s){s!==void 0&&(i.internalBinaryWrite(s,t.tag(n,nt.LengthDelimited).fork(),e),t.join())}scalar(t,e,i,n,s){let[o,a,c]=this.scalarInfo(e,n);(!c||s)&&(t.tag(i,o),t[a](n))}packed(t,e,i,n){if(!n.length)return;M(e!==h.BYTES&&e!==h.STRING),t.tag(i,nt.LengthDelimited),t.fork();let[,s]=this.scalarInfo(e);for(let o=0;o<n.length;o++)t[s](n[o]);t.join()}scalarInfo(t,e){let i=nt.Varint,n,s=e===void 0,o=e===0;switch(t){case h.INT32:n="int32";break;case h.STRING:o=s||!e.length,i=nt.LengthDelimited,n="string";break;case h.BOOL:o=e===!1,n="bool";break;case h.UINT32:n="uint32";break;case h.DOUBLE:i=nt.Bit64,n="double";break;case h.FLOAT:i=nt.Bit32,n="float";break;case h.INT64:o=s||K.from(e).isZero(),n="int64";break;case h.UINT64:o=s||ut.from(e).isZero(),n="uint64";break;case h.FIXED64:o=s||ut.from(e).isZero(),i=nt.Bit64,n="fixed64";break;case h.BYTES:o=s||!e.byteLength,i=nt.LengthDelimited,n="bytes";break;case h.FIXED32:i=nt.Bit32,n="fixed32";break;case h.SFIXED32:i=nt.Bit32,n="sfixed32";break;case h.SFIXED64:o=s||K.from(e).isZero(),i=nt.Bit64,n="sfixed64";break;case h.SINT32:n="sint32";break;case h.SINT64:o=s||K.from(e).isZero(),n="sint64";break}return[i,n,s||o]}};function yl(r){let t=r.messagePrototype?Object.create(r.messagePrototype):Object.defineProperty({},Zn,{value:r});for(let e of r.fields){let i=e.localName;if(!e.opt)if(e.oneof)t[e.oneof]={oneofKind:void 0};else if(e.repeat)t[i]=[];else switch(e.kind){case"scalar":t[i]=Fi(e.T,e.L);break;case"enum":t[i]=0;break;case"map":t[i]={};break}}return t}function ns(r,t,e){let i,n=e,s;for(let o of r.fields){let a=o.localName;if(o.oneof){let c=n[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(i=c[a],s=t[o.oneof],s.oneofKind=c.oneofKind,i==null){delete s[a];continue}}else if(i=n[a],s=t,i==null)continue;switch(o.repeat&&(s[a].length=i.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let l=0;l<i.length;l++)s[a][l]=i[l];else s[a]=i;break;case"message":let c=o.T();if(o.repeat)for(let l=0;l<i.length;l++)s[a][l]=c.create(i[l]);else s[a]===void 0?s[a]=c.create(i):c.mergePartial(s[a],i);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(s[a],i);break;case"message":let l=o.V.T();for(let u of Object.keys(i))s[a][u]=l.create(i[u]);break}break}}}function _l(r,t,e){if(t===e)return!0;if(!t||!e)return!1;for(let i of r.fields){let n=i.localName,s=i.oneof?t[i.oneof][n]:t[n],o=i.oneof?e[i.oneof][n]:e[n];switch(i.kind){case"enum":case"scalar":let a=i.kind=="enum"?h.INT32:i.T;if(!(i.repeat?gl(a,s,o):wl(a,s,o)))return!1;break;case"map":if(!(i.V.kind=="message"?bl(i.V.T(),ss(s),ss(o)):gl(i.V.kind=="enum"?h.INT32:i.V.T,ss(s),ss(o))))return!1;break;case"message":let c=i.T();if(!(i.repeat?bl(c,s,o):c.equals(s,o)))return!1;break}}return!0}var ss=Object.values;function wl(r,t,e){if(t===e)return!0;if(r!==h.BYTES)return!1;let i=t,n=e;if(i.length!==n.length)return!1;for(let s=0;s<i.length;s++)if(i[s]!=n[s])return!1;return!0}function gl(r,t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!wl(r,t[i],e[i]))return!1;return!0}function bl(r,t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!r.equals(t[i],e[i]))return!1;return!0}var jf=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),et=class{constructor(t,e,i){this.defaultCheckDepth=16,this.typeName=t,this.fields=e.map(pl),this.options=i!=null?i:{},this.messagePrototype=Object.create(null,Object.assign(Object.assign({},jf),{[Zn]:{value:this}})),this.refTypeCheck=new Qn(this),this.refJsonReader=new ts(this),this.refJsonWriter=new es(this),this.refBinReader=new rs(this),this.refBinWriter=new is(this)}create(t){let e=yl(this);return t!==void 0&&ns(this,e,t),e}clone(t){let e=this.create();return ns(this,e,t),e}equals(t,e){return _l(this,t,e)}is(t,e=this.defaultCheckDepth){return this.refTypeCheck.is(t,e,!1)}isAssignable(t,e=this.defaultCheckDepth){return this.refTypeCheck.is(t,e,!0)}mergePartial(t,e){ns(this,t,e)}fromBinary(t,e){let i=ll(e);return this.internalBinaryRead(i.readerFactory(t),t.byteLength,i)}fromJson(t,e){return this.internalJsonRead(t,fa(e))}fromJsonString(t,e){let i=JSON.parse(t);return this.fromJson(i,e)}toJson(t,e){return this.internalJsonWrite(t,da(e))}toJsonString(t,e){var i;let n=this.toJson(t,e);return JSON.stringify(n,null,(i=e==null?void 0:e.prettySpaces)!==null&&i!==void 0?i:0)}toBinary(t,e){let i=fl(e);return this.internalBinaryWrite(t,i.writerFactory(),i).finish()}internalJsonRead(t,e,i){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let n=i!=null?i:this.create();return this.refJsonReader.read(t,n,e),n}throw new Error(`Unable to parse message ${this.typeName} from JSON ${Or(t)}.`)}internalJsonWrite(t,e){return this.refJsonWriter.write(t,e)}internalBinaryWrite(t,e,i){return this.refBinWriter.write(t,e,i),e}internalBinaryRead(t,e,i,n){let s=n!=null?n:this.create();return this.refBinReader.read(t,s,i,e),s}};function Il(r,t){var e,i,n;let s=r;return s.service=t,s.localName=(e=s.localName)!==null&&e!==void 0?e:Gr(s.name),s.serverStreaming=!!s.serverStreaming,s.clientStreaming=!!s.clientStreaming,s.options=(i=s.options)!==null&&i!==void 0?i:{},s.idempotency=(n=s.idempotency)!==null&&n!==void 0?n:void 0,s}var Ai=class{constructor(t,e,i){this.typeName=t,this.methods=e.map(n=>Il(n,this)),this.options=i!=null?i:{}}};var z=class extends Error{constructor(t,e="UNKNOWN",i){super(t),this.name="RpcError",Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.meta=i!=null?i:{}}toString(){let t=[this.name+": "+this.message];this.code&&(t.push(""),t.push("Code: "+this.code)),this.serviceName&&this.methodName&&t.push("Method: "+this.serviceName+"/"+this.methodName);let e=Object.entries(this.meta);if(e.length){t.push(""),t.push("Meta:");for(let[i,n]of e)t.push(` ${i}: ${n}`)}return t.join(`
|
|
5
|
+
`)}};function pa(r,t){if(!t)return r;let e={};os(r,e),os(t,e);for(let i of Object.keys(t)){let n=t[i];switch(i){case"jsonOptions":e.jsonOptions=ha(r.jsonOptions,e.jsonOptions);break;case"binaryOptions":e.binaryOptions=sa(r.binaryOptions,e.binaryOptions);break;case"meta":e.meta={},os(r.meta,e.meta),os(t.meta,e.meta);break;case"interceptors":e.interceptors=r.interceptors?r.interceptors.concat(n):n.concat();break}}return e}function os(r,t){if(!r)return;let e=t;for(let[i,n]of Object.entries(r))n instanceof Date?e[i]=new Date(n.getTime()):Array.isArray(n)?e[i]=n.concat():e[i]=n}var Dt;(function(r){r[r.PENDING=0]="PENDING",r[r.REJECTED=1]="REJECTED",r[r.RESOLVED=2]="RESOLVED"})(Dt||(Dt={}));var Rt=class{constructor(t=!0){this._state=Dt.PENDING,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i}),t&&this._promise.catch(e=>{})}get state(){return this._state}get promise(){return this._promise}resolve(t){if(this.state!==Dt.PENDING)throw new Error(`cannot resolve ${Dt[this.state].toLowerCase()}`);this._resolve(t),this._state=Dt.RESOLVED}reject(t){if(this.state!==Dt.PENDING)throw new Error(`cannot reject ${Dt[this.state].toLowerCase()}`);this._reject(t),this._state=Dt.REJECTED}resolvePending(t){this._state===Dt.PENDING&&this.resolve(t)}rejectPending(t){this._state===Dt.PENDING&&this.reject(t)}};var Ni=class{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1}onNext(t){return this.addLis(t,this._lis.nxt)}onMessage(t){return this.addLis(t,this._lis.msg)}onError(t){return this.addLis(t,this._lis.err)}onComplete(t){return this.addLis(t,this._lis.cmp)}addLis(t,e){return e.push(t),()=>{let i=e.indexOf(t);i>=0&&e.splice(i,1)}}clearLis(){for(let t of Object.values(this._lis))t.splice(0,t.length)}get closed(){return this._closed!==!1}notifyNext(t,e,i){M((t?1:0)+(e?1:0)+(i?1:0)<=1,"only one emission at a time"),t&&this.notifyMessage(t),e&&this.notifyError(e),i&&this.notifyComplete()}notifyMessage(t){M(!this.closed,"stream is closed"),this.pushIt({value:t,done:!1}),this._lis.msg.forEach(e=>e(t)),this._lis.nxt.forEach(e=>e(t,void 0,!1))}notifyError(t){M(!this.closed,"stream is closed"),this._closed=t,this.pushIt(t),this._lis.err.forEach(e=>e(t)),this._lis.nxt.forEach(e=>e(void 0,t,!1)),this.clearLis()}notifyComplete(){M(!this.closed,"stream is closed"),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(t=>t()),this._lis.nxt.forEach(t=>t(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._itState||(this._itState={q:[]}),this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let t=this._itState;M(t,"bad state"),M(!t.p,"iterator contract broken");let e=t.q.shift();return e?"value"in e?Promise.resolve(e):Promise.reject(e):(t.p=new Rt,t.p.promise)}}}pushIt(t){let e=this._itState;if(e)if(e.p){let i=e.p;M(i.state==Dt.PENDING,"iterator contract broken"),"value"in t?i.resolve(t):i.reject(t),delete e.p}else e.q.push(t)}};var zf=function(r,t,e,i){function n(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):n(u.value).then(a,c)}l((i=i.apply(r,t||[])).next())})},Ei=class{constructor(t,e,i,n,s,o,a){this.method=t,this.requestHeaders=e,this.request=i,this.headers=n,this.response=s,this.status=o,this.trailers=a}then(t,e){return this.promiseFinished().then(i=>t?Promise.resolve(t(i)):i,i=>e?Promise.resolve(e(i)):Promise.reject(i))}promiseFinished(){return zf(this,void 0,void 0,function*(){let[t,e,i,n]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:t,response:e,status:i,trailers:n}})}};var Wf=function(r,t,e,i){function n(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):n(u.value).then(a,c)}l((i=i.apply(r,t||[])).next())})},Li=class{constructor(t,e,i,n,s,o,a){this.method=t,this.requestHeaders=e,this.request=i,this.headers=n,this.responses=s,this.status=o,this.trailers=a}then(t,e){return this.promiseFinished().then(i=>t?Promise.resolve(t(i)):i,i=>e?Promise.resolve(e(i)):Promise.reject(i))}promiseFinished(){return Wf(this,void 0,void 0,function*(){let[t,e,i]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:t,status:e,trailers:i}})}};function Ht(r,t,e,i,n){var s,o,a,c;if(r=="unary"){let l=(u,d,p)=>t.unary(u,d,p);for(let u of((s=i.interceptors)!==null&&s!==void 0?s:[]).filter(d=>d.interceptUnary).reverse()){let d=l;l=(p,I,_)=>u.interceptUnary(d,p,I,_)}return l(e,n,i)}if(r=="serverStreaming"){let l=(u,d,p)=>t.serverStreaming(u,d,p);for(let u of((o=i.interceptors)!==null&&o!==void 0?o:[]).filter(d=>d.interceptServerStreaming).reverse()){let d=l;l=(p,I,_)=>u.interceptServerStreaming(d,p,I,_)}return l(e,n,i)}if(r=="clientStreaming"){let l=(u,d)=>t.clientStreaming(u,d);for(let u of((a=i.interceptors)!==null&&a!==void 0?a:[]).filter(d=>d.interceptClientStreaming).reverse()){let d=l;l=(p,I)=>u.interceptClientStreaming(d,p,I)}return l(e,i)}if(r=="duplex"){let l=(u,d)=>t.duplex(u,d);for(let u of((c=i.interceptors)!==null&&c!==void 0?c:[]).filter(d=>d.interceptDuplex).reverse()){let d=l;l=(p,I)=>u.interceptDuplex(d,p,I)}return l(e,i)}la(r)}var m;(function(r){r[r.OK=0]="OK",r[r.CANCELLED=1]="CANCELLED",r[r.UNKNOWN=2]="UNKNOWN",r[r.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",r[r.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",r[r.NOT_FOUND=5]="NOT_FOUND",r[r.ALREADY_EXISTS=6]="ALREADY_EXISTS",r[r.PERMISSION_DENIED=7]="PERMISSION_DENIED",r[r.UNAUTHENTICATED=16]="UNAUTHENTICATED",r[r.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",r[r.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",r[r.ABORTED=10]="ABORTED",r[r.OUT_OF_RANGE=11]="OUT_OF_RANGE",r[r.UNIMPLEMENTED=12]="UNIMPLEMENTED",r[r.INTERNAL=13]="INTERNAL",r[r.UNAVAILABLE=14]="UNAVAILABLE",r[r.DATA_LOSS=15]="DATA_LOSS"})(m||(m={}));var $f=function(r,t,e,i){function n(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):n(u.value).then(a,c)}l((i=i.apply(r,t||[])).next())})};function ma(r,t,e,i,n){if(i)for(let[s,o]of Object.entries(i))if(typeof o=="string")r.append(s,o);else for(let a of o)r.append(s,a);if(r.set("Content-Type",t==="text"?"application/grpc-web-text":"application/grpc-web+proto"),t=="text"&&r.set("Accept","application/grpc-web-text"),r.set("X-Grpc-Web","1"),n&&r.set("X-User-Agent",n),typeof e=="number"){if(e<=0)throw new z(`timeout ${e} ms exceeded`,m[m.DEADLINE_EXCEEDED]);r.set("grpc-timeout",`${e}m`)}else if(e){let s=e.getTime(),o=Date.now();if(s<=o)throw new z(`deadline ${e} exceeded`,m[m.DEADLINE_EXCEEDED]);r.set("grpc-timeout",`${s-o}m`)}return r}function ya(r,t){let e=new Uint8Array(5+r.length);e[0]=Jt.DATA;for(let i=r.length,n=4;n>0;n--)e[n]=i%256,i>>>=8;return e.set(r,5),t==="binary"?e:Oi(e)}function as(r,t,e){if(arguments.length===1){let c=r,l;try{l=c.type}catch(u){}switch(l){case"error":case"opaque":case"opaqueredirect":throw new z(`fetch response type ${c.type}`,m[m.UNKNOWN])}return as(Kf(c.headers),c.status,c.statusText)}let i=r,n=t>=200&&t<300,s=xl(i),[o,a]=Sl(i);return(o===void 0||o===m.OK)&&!n&&(o=Gf(t),a=e),[o,a,s]}function ga(r){let t=qf(r),[e,i]=Sl(t),n=xl(t);return[e!=null?e:m.OK,i,n]}var Jt;(function(r){r[r.DATA=0]="DATA",r[r.TRAILER=128]="TRAILER"})(Jt||(Jt={}));function ba(r,t,e){return $f(this,void 0,void 0,function*(){let i,n="",s=new Uint8Array(0),o=Jf(t);if(Hf(r)){let a=r.getReader();i={next:()=>a.read()}}else i=r[Symbol.asyncIterator]();for(;;){let a=yield i.next();if(a.value!==void 0){if(o==="text"){for(let l=0;l<a.value.length;l++)n+=String.fromCharCode(a.value[l]);let c=n.length-n.length%4;if(c===0)continue;s=vl(s,Bi(n.substring(0,c))),n=n.substring(c)}else s=vl(s,a.value);for(;s.length>=5&&s[0]===Jt.DATA;){let c=0;for(let l=1;l<5;l++)c=(c<<8)+s[l];if(s.length-5>=c)e(Jt.DATA,s.subarray(5,5+c)),s=s.subarray(5+c);else break}}if(a.done){if(s.length===0)break;if(s[0]!==Jt.TRAILER||s.length<5)throw new z("premature EOF",m[m.DATA_LOSS]);e(Jt.TRAILER,s.subarray(5));break}}})}var Hf=r=>typeof r.getReader=="function";function vl(r,t){let e=new Uint8Array(r.length+t.length);return e.set(r),e.set(t,r.length),e}function Jf(r){switch(r){case"application/grpc-web-text":case"application/grpc-web-text+proto":return"text";case"application/grpc-web":case"application/grpc-web+proto":return"binary";case void 0:case null:throw new z("missing response content type",m[m.INTERNAL]);default:throw new z("unexpected response content type: "+r,m[m.INTERNAL])}}function Sl(r){let t,e,i=r["grpc-message"];if(i!==void 0){if(Array.isArray(i))return[m.INTERNAL,"invalid grpc-web message"];e=i}let n=r["grpc-status"];if(n!==void 0){if(Array.isArray(n))return[m.INTERNAL,"invalid grpc-web status"];if(t=parseInt(n,10),m[t]===void 0)return[m.INTERNAL,"invalid grpc-web status"]}return[t,e]}function xl(r){let t={};for(let[e,i]of Object.entries(r))switch(e){case"grpc-message":case"grpc-status":case"content-type":break;default:t[e]=i}return t}function qf(r){let t={};for(let e of String.fromCharCode.apply(String,r).trim().split(`\r
|
|
6
|
+
`)){if(e=="")continue;let[i,...n]=e.split(":"),s=n.join(":").trim();i=i.trim();let o=t[i];typeof o=="string"?t[i]=[o,s]:Array.isArray(o)?o.push(s):t[i]=s}return t}function Kf(r){let t={};return r.forEach((e,i)=>{let n=t[i];typeof n=="string"?t[i]=[n,e]:Array.isArray(n)?n.push(e):t[i]=e}),t}function Gf(r){switch(r){case 200:return m.OK;case 400:return m.INVALID_ARGUMENT;case 401:return m.UNAUTHENTICATED;case 403:return m.PERMISSION_DENIED;case 404:return m.NOT_FOUND;case 409:return m.ABORTED;case 412:return m.FAILED_PRECONDITION;case 429:return m.RESOURCE_EXHAUSTED;case 499:return m.CANCELLED;case 500:return m.UNKNOWN;case 501:return m.UNIMPLEMENTED;case 503:return m.UNAVAILABLE;case 504:return m.DEADLINE_EXCEEDED;default:return m.UNKNOWN}}var Ui=class{constructor(t){this.defaultOptions=t}mergeOptions(t){return pa(this.defaultOptions,t)}makeUrl(t,e){let i=e.baseUrl;return i.endsWith("/")&&(i=i.substring(0,i.length-1)),`${i}/${t.service.typeName}/${t.name}`}clientStreaming(t){let e=new z("Client streaming is not supported by grpc-web",m[m.UNIMPLEMENTED]);throw e.methodName=t.name,e.serviceName=t.service.typeName,e}duplex(t){let e=new z("Duplex streaming is not supported by grpc-web",m[m.UNIMPLEMENTED]);throw e.methodName=t.name,e.serviceName=t.service.typeName,e}serverStreaming(t,e,i){var n,s,o,a;let c=i,l=(n=c.format)!==null&&n!==void 0?n:"text",u=(s=c.fetchInit)!==null&&s!==void 0?s:{},d=this.makeUrl(t,c),p=t.I.toBinary(e,c.binaryOptions),I=new Rt,_=new Ni,X=!0,Y,ft=new Rt,$t,Tr=new Rt;return globalThis.fetch(d,Object.assign(Object.assign({},u),{method:"POST",headers:ma(new globalThis.Headers,l,c.timeout,c.meta),body:ya(p,l),signal:(o=i.abort)!==null&&o!==void 0?o:null})).then($=>{let[C,pt,Mt]=as($);if(I.resolve(Mt),C!=null&&C!==m.OK)throw new z(pt!=null?pt:m[C],m[C],Mt);return C!=null&&(Y={code:m[C],detail:pt!=null?pt:m[C]}),$}).then($=>{if(!$.body)throw new z("missing response body",m[m.INTERNAL]);return ba($.body,$.headers.get("content-type"),(C,pt)=>{switch(C){case Jt.DATA:_.notifyMessage(t.O.fromBinary(pt,c.binaryOptions)),X=!1;break;case Jt.TRAILER:let Mt,Fe;[Mt,Fe,$t]=ga(pt),Y={code:m[Mt],detail:Fe!=null?Fe:m[Mt]};break}})}).then(()=>{if(!$t&&!X)throw new z("missing trailers",m[m.DATA_LOSS]);if(!Y)throw new z("missing status",m[m.INTERNAL]);if(Y.code!=="OK")throw new z(Y.detail,Y.code,$t);_.notifyComplete(),ft.resolve(Y),Tr.resolve($t||{})}).catch($=>{let C;$ instanceof z?C=$:$ instanceof Error&&$.name==="AbortError"?C=new z($.message,m[m.CANCELLED]):C=new z($ instanceof Error?$.message:""+$,m[m.INTERNAL]),C.methodName=t.name,C.serviceName=t.service.typeName,I.rejectPending(C),_.notifyError(C),ft.rejectPending(C),Tr.rejectPending(C)}),new Li(t,(a=c.meta)!==null&&a!==void 0?a:{},e,I.promise,_,ft.promise,Tr.promise)}unary(t,e,i){var n,s,o,a;let c=i,l=(n=c.format)!==null&&n!==void 0?n:"text",u=(s=c.fetchInit)!==null&&s!==void 0?s:{},d=this.makeUrl(t,c),p=t.I.toBinary(e,c.binaryOptions),I=new Rt,_,X=new Rt,Y,ft=new Rt,$t,Tr=new Rt;return globalThis.fetch(d,Object.assign(Object.assign({},u),{method:"POST",headers:ma(new globalThis.Headers,l,c.timeout,c.meta),body:ya(p,l),signal:(o=i.abort)!==null&&o!==void 0?o:null})).then($=>{let[C,pt,Mt]=as($);if(I.resolve(Mt),C!=null&&C!==m.OK)throw new z(pt!=null?pt:m[C],m[C],Mt);return C!=null&&(Y={code:m[C],detail:pt!=null?pt:m[C]}),$}).then($=>{if(!$.body)throw new z("missing response body",m[m.INTERNAL]);return ba($.body,$.headers.get("content-type"),(C,pt)=>{switch(C){case Jt.DATA:if(_)throw new z("unary call received 2nd message",m[m.DATA_LOSS]);_=t.O.fromBinary(pt,c.binaryOptions);break;case Jt.TRAILER:let Mt,Fe;[Mt,Fe,$t]=ga(pt),Y={code:m[Mt],detail:Fe!=null?Fe:m[Mt]};break}})}).then(()=>{if(!$t&&_)throw new z("missing trailers",m[m.DATA_LOSS]);if(!Y)throw new z("missing status",m[m.INTERNAL]);if(!_&&Y.code==="OK")throw new z("expected error status",m[m.DATA_LOSS]);if(!_)throw new z(Y.detail,Y.code,$t);if(X.resolve(_),Y.code!=="OK")throw new z(Y.detail,Y.code,$t);ft.resolve(Y),Tr.resolve($t||{})}).catch($=>{let C;$ instanceof z?C=$:$ instanceof Error&&$.name==="AbortError"?C=new z($.message,m[m.CANCELLED]):C=new z($ instanceof Error?$.message:""+$,m[m.INTERNAL]),C.methodName=t.name,C.serviceName=t.service.typeName,I.rejectPending(C),X.rejectPending(C),ft.rejectPending(C),Tr.rejectPending(C)}),new Ei(t,(a=c.meta)!==null&&a!==void 0?a:{},e,I.promise,X.promise,ft.promise,Tr.promise)}};var Tl=({host:r,timeout:t})=>new Ui({baseUrl:r,timeout:t});var Xf={writeTransport:r=>new Ti(r),queryTransport:Tl},Mi=Xf;var Ri=class{constructor(t){this._options=t;this._closed=!1;var e;this._transport=(e=this._options.transport)!=null?e:Mi.writeTransport(this._options),this.doWrite=this.doWrite.bind(this)}_createWritePath(t,e,i){let n=[`bucket=${encodeURIComponent(t)}`,`precision=${e.precision}`];return i&&n.push(`org=${encodeURIComponent(i)}`),`/api/v2/write?${n.join("&")}`}doWrite(t,e,i,n){if(this._closed)return Promise.reject(new Error("writeApi: already closed!"));if(t.length<=0||t.length===1&&t[0]==="")return Promise.resolve();let o,a,c=new Promise((_,X)=>{o=_,a=X}),l,u,d={responseStarted(_,X){l=X,u=_},error(_){if(_ instanceof Ae&&_.json&&typeof _.json.error=="string"&&_.json.error.includes("hinted handoff queue not empty")){Br.warn(`Write to InfluxDB returns: ${_.json.error}`),l=204,d.complete();return}Br.error("Write to InfluxDB failed.",_),a(_)},complete(){if(l==null||l>=200&&l<300)o();else{let _=`2xx HTTP response status code expected, but ${l} returned`,X=new Ae(l,_,void 0,"0",u);X.message=_,d.error(X)}}},p={...Ko,...n},I={method:"POST",headers:{"content-type":"text/plain; charset=utf-8",...n==null?void 0:n.headers},gzipThreshold:p.gzipThreshold};return this._transport.send(this._createWritePath(e,p,i),t.join(`
|
|
7
|
+
`),I,d),c}async close(){this._closed=!0}};function Ol(r,t){var e={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(e[i[n]]=r[i[n]]);return e}function y(r,t,e,i){function n(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?s(u.value):n(u.value).then(a,c)}l((i=i.apply(r,t||[])).next())})}function Bl(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function U(r){return this instanceof U?(this.v=r,this):new U(r)}function kt(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=e.apply(r,t||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(p){i[p]&&(n[p]=function(I){return new Promise(function(_,X){s.push([p,I,_,X])>1||a(p,I)})})}function a(p,I){try{c(i[p](I))}catch(_){d(s[0][3],_)}}function c(p){p.value instanceof U?Promise.resolve(p.value.v).then(l,u):d(s[0][2],p)}function l(p){a("next",p)}function u(p){a("throw",p)}function d(p,I){p(I),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Xr(r){var t,e;return t={},i("next"),i("throw",function(n){throw n}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(n,s){t[n]=r[n]?function(o){return(e=!e)?{value:U(r[n](o)),done:!1}:s?s(o):o}:s}}function te(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Bl=="function"?Bl(r):r[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),n(a,c,o.done,o.value)})}}function n(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var xa={};or(xa,{compareArrayLike:()=>Sa,joinUint8Arrays:()=>Ct,memcpy:()=>Vi,rebaseValueOffsets:()=>ms,toArrayBufferView:()=>R,toArrayBufferViewAsyncIterator:()=>ie,toArrayBufferViewIterator:()=>_e,toBigInt64Array:()=>ps,toBigUint64Array:()=>sd,toFloat32Array:()=>od,toFloat32ArrayAsyncIterator:()=>vd,toFloat32ArrayIterator:()=>pd,toFloat64Array:()=>ad,toFloat64ArrayAsyncIterator:()=>Sd,toFloat64ArrayIterator:()=>md,toInt16Array:()=>rd,toInt16ArrayAsyncIterator:()=>bd,toInt16ArrayIterator:()=>ud,toInt32Array:()=>Ar,toInt32ArrayAsyncIterator:()=>_d,toInt32ArrayIterator:()=>fd,toInt8Array:()=>ed,toInt8ArrayAsyncIterator:()=>gd,toInt8ArrayIterator:()=>ld,toUint16Array:()=>id,toUint16ArrayAsyncIterator:()=>wd,toUint16ArrayIterator:()=>dd,toUint32Array:()=>nd,toUint32ArrayAsyncIterator:()=>Id,toUint32ArrayIterator:()=>hd,toUint8Array:()=>D,toUint8ArrayAsyncIterator:()=>va,toUint8ArrayIterator:()=>Ia,toUint8ClampedArray:()=>cd,toUint8ClampedArrayAsyncIterator:()=>xd,toUint8ClampedArrayIterator:()=>yd});var Yf=new TextDecoder("utf-8"),ki=r=>Yf.decode(r),Zf=new TextEncoder,be=r=>Zf.encode(r);var Qf=r=>typeof r=="number",Dl=r=>typeof r=="boolean",mt=r=>typeof r=="function",xt=r=>r!=null&&Object(r)===r,ee=r=>xt(r)&&mt(r.then);var re=r=>xt(r)&&mt(r[Symbol.iterator]),qt=r=>xt(r)&&mt(r[Symbol.asyncIterator]),cs=r=>xt(r)&&xt(r.schema);var ls=r=>xt(r)&&"done"in r&&"value"in r;var us=r=>xt(r)&&mt(r.stat)&&Qf(r.fd);var fs=r=>xt(r)&&Ci(r.body),ds=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Fl=r=>xt(r)&&mt(r.abort)&&mt(r.getWriter)&&!ds(r),Ci=r=>xt(r)&&mt(r.cancel)&&mt(r.getReader)&&!ds(r),Al=r=>xt(r)&&mt(r.end)&&mt(r.write)&&Dl(r.writable)&&!ds(r),hs=r=>xt(r)&&mt(r.read)&&mt(r.pipe)&&Dl(r.readable)&&!ds(r),Nl=r=>xt(r)&&mt(r.clear)&&mt(r.bytes)&&mt(r.position)&&mt(r.setPosition)&&mt(r.capacity)&&mt(r.getBufferIdentifier)&&mt(r.createLong);var wa=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:ArrayBuffer;function td(r){let t=r[0]?[r[0]]:[],e,i,n,s;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:n}=o,{byteOffset:i,byteLength:s}=a,e+n<i||i+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,i-e+s)}return t}function Vi(r,t,e=0,i=t.byteLength){let n=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,n),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,n));return s.set(o,e),r}function Ct(r,t){let e=td(r),i=e.reduce((u,d)=>u+d.byteLength,0),n,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,i);for(let u=e.length;++c<u;){if(n=e[c],s=n.subarray(0,Math.min(n.length,l-a)),l<=a+s.length){s.length<n.length?e[c]=n.subarray(s.length):s.length===n.length&&c++,o?Vi(o,s,a):o=s;break}Vi(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),i-(o?o.byteLength:0)]}function R(r,t){let e=ls(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=be(e)),e instanceof ArrayBuffer?new r(e):e instanceof wa?new r(e):Nl(e)?R(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var ed=r=>R(Int8Array,r),rd=r=>R(Int16Array,r),Ar=r=>R(Int32Array,r),ps=r=>R(BigInt64Array,r),D=r=>R(Uint8Array,r),id=r=>R(Uint16Array,r),nd=r=>R(Uint32Array,r),sd=r=>R(BigUint64Array,r),od=r=>R(Float32Array,r),ad=r=>R(Float64Array,r),cd=r=>R(Uint8ClampedArray,r),_a=r=>(r.next(),r);function*_e(r,t){let e=function*(n){yield n},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof wa?e(t):re(t)?t:e(t);return yield*_a(function*(n){let s=null;do s=n.next(yield R(r,s));while(!s.done)}(i[Symbol.iterator]())),new r}var ld=r=>_e(Int8Array,r),ud=r=>_e(Int16Array,r),fd=r=>_e(Int32Array,r),Ia=r=>_e(Uint8Array,r),dd=r=>_e(Uint16Array,r),hd=r=>_e(Uint32Array,r),pd=r=>_e(Float32Array,r),md=r=>_e(Float64Array,r),yd=r=>_e(Uint8ClampedArray,r);function ie(r,t){return kt(this,arguments,function*(){if(ee(t))return yield U(yield U(yield*Xr(te(ie(r,yield U(t))))));let i=function(o){return kt(this,arguments,function*(){yield yield U(yield U(o))})},n=function(o){return kt(this,arguments,function*(){yield U(yield*Xr(te(_a(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof wa?i(t):re(t)?n(t):qt(t)?t:i(t);return yield U(yield*Xr(te(_a(function(o){return kt(this,arguments,function*(){let a=null;do a=yield U(o.next(yield yield U(R(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield U(new r)})}var gd=r=>ie(Int8Array,r),bd=r=>ie(Int16Array,r),_d=r=>ie(Int32Array,r),va=r=>ie(Uint8Array,r),wd=r=>ie(Uint16Array,r),Id=r=>ie(Uint32Array,r),vd=r=>ie(Float32Array,r),Sd=r=>ie(Float64Array,r),xd=r=>ie(Uint8ClampedArray,r);function ms(r,t,e){if(r!==0){e=e.slice(0,t);for(let i=-1,n=e.length;++i<n;)e[i]+=r}return e.subarray(0,t)}function Sa(r,t){let e=0,i=r.length;if(i!==t.length)return!1;if(i>0)do if(r[e]!==t[e])return!1;while(++e<i);return!0}var _t={fromIterable(r){return ys(Td(r))},fromAsyncIterable(r){return ys(Bd(r))},fromDOMStream(r){return ys(Od(r))},fromNodeStream(r){return ys(Dd(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},ys=r=>(r.next(),r);function*Td(r){let t,e=!1,i=[],n,s,o,a=0;function c(){return s==="peek"?Ct(i,o)[0]:([n,i,a]=Ct(i,o),n)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});let l=Ia(r)[Symbol.iterator]();try{do if({done:t,value:n}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&n.byteLength>0&&(i.push(n),a+=n.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function Bd(r){return kt(this,arguments,function*(){let e,i=!1,n=[],s,o,a,c=0;function l(){return o==="peek"?Ct(n,a)[0]:([s,n,c]=Ct(n,a),s)}({cmd:o,size:a}=(yield yield U(null))||{cmd:"read",size:0});let u=va(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.next()):yield U(u.next(a-c)),!e&&s.byteLength>0&&(n.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(d){(i=!0)&&typeof u.throw=="function"&&(yield U(u.throw(d)))}finally{i===!1&&typeof u.return=="function"&&(yield U(u.return(new Uint8Array(0))))}return yield U(null)})}function Od(r){return kt(this,arguments,function*(){let e=!1,i=!1,n=[],s,o,a,c=0;function l(){return o==="peek"?Ct(n,a)[0]:([s,n,c]=Ct(n,a),s)}({cmd:o,size:a}=(yield yield U(null))||{cmd:"read",size:0});let u=new Ba(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.read()):yield U(u.read(a-c)),!e&&s.byteLength>0&&(n.push(D(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(d){(i=!0)&&(yield U(u.cancel(d)))}finally{i===!1?yield U(u.cancel()):r.locked&&u.releaseLock()}return yield U(null)})}var Ba=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return y(this,void 0,void 0,function*(){let{reader:e,source:i}=this;e&&(yield e.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=D(e)),e})}},Ta=(r,t)=>{let e=n=>i([t,n]),i;return[t,e,new Promise(n=>(i=n)&&r.once(t,e))]};function Dd(r){return kt(this,arguments,function*(){let e=[],i="error",n=!1,s=null,o,a,c=0,l=[],u;function d(){return o==="peek"?Ct(l,a)[0]:([u,l,c]=Ct(l,a),u)}if({cmd:o,size:a}=(yield yield U(null))||{cmd:"read",size:0},r.isTTY)return yield yield U(new Uint8Array(0)),yield U(null);try{e[0]=Ta(r,"end"),e[1]=Ta(r,"error");do{if(e[2]=Ta(r,"readable"),[i,s]=yield U(Promise.race(e.map(I=>I[2]))),i==="error")break;if((n=i==="end")||(Number.isFinite(a-c)?(u=D(r.read(a-c)),u.byteLength<a-c&&(u=D(r.read()))):u=D(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),n||a<=c)do({cmd:o,size:a}=yield yield U(d()));while(a<c)}while(!n)}finally{yield U(p(e,i==="error"?s:null))}return yield U(null);function p(I,_){return u=l=null,new Promise((X,Y)=>{for(let[ft,$t]of I)r.off(ft,$t);try{let ft=r.destroy;ft&&ft.call(r,_),_=void 0}catch(ft){_=ft||_}finally{_!=null?Y(_):X()}})}})}var H;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(H||(H={}));var Z;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Z||(Z={}));var G;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(G||(G={}));var ct;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(ct||(ct={}));var b;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(b||(b={}));var yt;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(yt||(yt={}));var we=new Int32Array(2),gs=new Float32Array(we.buffer),bs=new Float64Array(we.buffer),Yr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Pi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Pi||(Pi={}));var Vt=class r{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new r(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return we[0]=this.readInt32(t),gs[0]}readFloat64(t){return we[Yr?0:1]=this.readInt32(t),we[Yr?1:0]=this.readInt32(t+4),bs[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){gs[0]=e,this.writeInt32(t,we[0])}writeFloat64(t,e){bs[0]=e,this.writeInt32(t,we[Yr?0:1]),this.writeInt32(t+4,we[Yr?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let n=this.bytes_.subarray(t,t+i);return e===Pi.UTF8_BYTES?n:this.text_decoder_.decode(n)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let i=[];for(let n=0;n<e;++n){let s=t(n);s!==null&&i.push(s)}return i}createObjList(t,e){let i=[];for(let n=0;n<e;++n){let s=t(n);s!==null&&i.push(s.unpack())}return i}};var Nr=class r{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Vt.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){let n=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,i){e!=i&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=e<<1,n=Vt.allocate(i);return n.setPosition(i-e),n.bytes().set(t.bytes(),i-e),n}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let n=2;this.addInt16(t-this.object_start);let s=(i+n)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=2;l<s;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,i){let n=i?4:0;if(e){let s=e;if(this.prep(this.minalign,8+n),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=3;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+n),this.addOffset(t),n&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let i=this.bb.capacity()-t,n=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(n)&&this.bb.readInt16(n+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let i=0;i<t.length;++i){let n=t[i];if(n!==null)e.push(this.createObjectOffset(n));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var ji;(function(r){r[r.BUFFER=0]="BUFFER"})(ji||(ji={}));var zi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(zi||(zi={}));var ws=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):zi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ji.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,zi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ji.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return r.startBodyCompression(t),r.addCodec(t,e),r.addMethod(t,i),r.endBodyCompression(t)}};var Zr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}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(i!=null?i:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Qr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,i){return t.prep(8,16),t.writeInt64(BigInt(i!=null?i:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Pt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let i=this.bb.__offset(this.bb_pos,6);return i?(e||new Qr).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new Zr).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new ws).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var Ue=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var ur;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(ur||(ur={}));var Wi;(function(r){r[r.DenseArray=0]="DenseArray"})(Wi||(Wi={}));var se=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,i){return r.startInt(t),r.addBitWidth(t,e),r.addIsSigned(t,i),r.endInt(t)}};var Ie=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new se).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Wi.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,Wi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var gt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,i),r.endKeyValue(t)}};var $i=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return r.startBinary(t),r.endBinary(t)}};var Hi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return r.startBool(t),r.endBool(t)}};var fr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ct.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,ct.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var ve=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,n){return r.startDecimal(t),r.addPrecision(t,e),r.addScale(t,i),r.addBitWidth(t,n),r.endDecimal(t)}};var dr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):b.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,b.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}};var hr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return r.startFixedSizeBinary(t),r.addByteWidth(t,e),r.endFixedSizeBinary(t)}};var pr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return r.startFixedSizeList(t),r.addListSize(t,e),r.endFixedSizeList(t)}};var mr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):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 r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var yr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):yt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,yt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var Ji=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return r.startLargeBinary(t),r.endLargeBinary(t)}};var qi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return r.startLargeUtf8(t),r.endLargeUtf8(t)}};var Ki=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}};var gr=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return r.startMap(t),r.addKeysSorted(t,e),r.endMap(t)}};var Gi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return r.startNull(t),r.endNull(t)}};var Xi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return r.startStruct_(t),r.endStruct_(t)}};var Me=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):b.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,b.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,i),r.endTime(t)}};var Re=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):b.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,b.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,i),r.endTimestamp(t)}};var oe=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Z.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Z.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 r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,i),r.endUnion(t)}};var Yi=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}};var Q;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Q||(Q={}));var vt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Q.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new Ie).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let i=this.bb.__offset(this.bb_pos,14);return i?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,16);return i?(e||new gt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Q.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()}};var Ft=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ur.Little}fields(t,e){let i=this.bb.__offset(this.bb_pos,6);return i?(e||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new gt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,ur.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,s){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,i),r.addCustomMetadata(t,n),r.addFeatures(t,s),r.endSchema(t)}};var V;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(V||(V={}));var f;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(f||(f={}));var Gt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Gt||(Gt={}));var Ja={};or(Ja,{clampRange:()=>en,createElementComparator:()=>Ir,wrapIndex:()=>Er});var Oa={};or(Oa,{valueToString:()=>ae});function ae(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>ae(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Na={};or(Na,{BN:()=>Qi,bigNumToBigInt:()=>Ll,bigNumToNumber:()=>Aa,bigNumToString:()=>ri,isArrowBigNumSymbol:()=>El});function j(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Da(r,t){return j(r/t)+j(r%t)/j(t)}var El=Symbol.for("isArrowBigNum");function ce(r,...t){return t.length===0?Object.setPrototypeOf(R(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}ce.prototype[El]=!0;ce.prototype.toJSON=function(){return`"${ri(this)}"`};ce.prototype.valueOf=function(r){return Aa(this,r)};ce.prototype.toString=function(){return ri(this)};ce.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Aa(this);case"string":return ri(this);case"default":return Ll(this)}return ri(this)};function ti(...r){return ce.apply(this,r)}function ei(...r){return ce.apply(this,r)}function Zi(...r){return ce.apply(this,r)}Object.setPrototypeOf(ti.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(ei.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Zi.prototype,Object.create(Uint32Array.prototype));Object.assign(ti.prototype,ce.prototype,{constructor:ti,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(ei.prototype,ce.prototype,{constructor:ei,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Zi.prototype,ce.prototype,{constructor:Zi,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Fd=BigInt(4294967296)*BigInt(4294967296),Ad=Fd-BigInt(1);function Aa(r,t){let{buffer:e,byteOffset:i,byteLength:n,signed:s}=r,o=new BigUint64Array(e,i,n/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let u of o)c|=(u^Ad)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let u of o)c|=u*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let u=BigInt(Math.pow(10,t)),d=c/u,p=c%u;return j(d)+j(p)/j(u)}return j(c)}function ri(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Fa(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Fa(r);t=t.slice();let i=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+i;t[s]=a,i&=o===0?1:0}return`-${Fa(t)}`}function Ll(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:ri(r)}function Fa(r){let t="",e=new Uint32Array(2),i=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),n=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),s=-1,o=i.length-1;do{for(e[0]=i[s=0];s<o;)i[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+i[s];i[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(n[0]||n[1]||n[2]||n[3]);return t!=null?t:"0"}var Qi=class r{static new(t,e){switch(e){case!0:return new ti(t);case!1:return new ei(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new ti(t)}return t.byteLength===16?new Zi(t):new ei(t)}static signed(t){return new ti(t)}static unsigned(t){return new ei(t)}static decimal(t){return new Zi(t)}constructor(t,e){return r.new(t,e)}};var Ul,Ml,Rl,kl,Cl,Vl,Pl,jl,zl,Wl,$l,Hl,Jl,ql,Kl,Gl,Xl,Yl,Zl,Ql,tu,eu,g=class r{static isNull(t){return(t==null?void 0:t.typeId)===f.Null}static isInt(t){return(t==null?void 0:t.typeId)===f.Int}static isFloat(t){return(t==null?void 0:t.typeId)===f.Float}static isBinary(t){return(t==null?void 0:t.typeId)===f.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===f.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===f.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===f.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===f.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===f.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===f.Date}static isTime(t){return(t==null?void 0:t.typeId)===f.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===f.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===f.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===f.Duration}static isList(t){return(t==null?void 0:t.typeId)===f.List}static isStruct(t){return(t==null?void 0:t.typeId)===f.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===f.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===f.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===f.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===f.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===f.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===Z.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===Z.Sparse}constructor(t){this.typeId=t}};Ul=Symbol.toStringTag;g[Ul]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(g.prototype);var Tt=class extends g{constructor(){super(f.Null)}toString(){return"Null"}};Ml=Symbol.toStringTag;Tt[Ml]=(r=>r[Symbol.toStringTag]="Null")(Tt.prototype);var bt=class extends g{constructor(t,e){super(f.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Rl=Symbol.toStringTag;bt[Rl]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(bt.prototype);var Is=class extends bt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},vs=class extends bt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Se=class extends bt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Ss=class extends bt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},xs=class extends bt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Ts=class extends bt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Bs=class extends bt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Os=class extends bt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Is.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(vs.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Se.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Ss.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(xs.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ts.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Bs.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Os.prototype,"ArrayType",{value:BigUint64Array});var Xt=class extends g{constructor(t){super(f.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}`}};kl=Symbol.toStringTag;Xt[kl]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Xt.prototype);var Ds=class extends Xt{constructor(){super(G.HALF)}},Fs=class extends Xt{constructor(){super(G.SINGLE)}},As=class extends Xt{constructor(){super(G.DOUBLE)}};Object.defineProperty(Ds.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Fs.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(As.prototype,"ArrayType",{value:Float64Array});var ke=class extends g{constructor(){super(f.Binary)}toString(){return"Binary"}};Cl=Symbol.toStringTag;ke[Cl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ke.prototype);var Ce=class extends g{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Vl=Symbol.toStringTag;Ce[Vl]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Ce.prototype);var Ve=class extends g{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Pl=Symbol.toStringTag;Ve[Pl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Ve.prototype);var Pe=class extends g{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};jl=Symbol.toStringTag;Pe[jl]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Pe.prototype);var je=class extends g{constructor(){super(f.Bool)}toString(){return"Bool"}};zl=Symbol.toStringTag;je[zl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(je.prototype);var ze=class extends g{constructor(t,e,i=128){super(f.Decimal),this.scale=t,this.precision=e,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Wl=Symbol.toStringTag;ze[Wl]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ze.prototype);var We=class extends g{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ct[this.unit]}>`}get ArrayType(){return this.unit===ct.DAY?Int32Array:BigInt64Array}};$l=Symbol.toStringTag;We[$l]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(We.prototype);var $e=class extends g{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${b[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Hl=Symbol.toStringTag;$e[Hl]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))($e.prototype);var He=class extends g{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${b[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Jl=Symbol.toStringTag;He[Jl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(He.prototype);var Je=class extends g{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${yt[this.unit]}>`}};ql=Symbol.toStringTag;Je[ql]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Je.prototype);var qe=class extends g{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${b[this.unit]}>`}};Kl=Symbol.toStringTag;qe[Kl]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(qe.prototype);var le=class extends g{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Gl=Symbol.toStringTag;le[Gl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(le.prototype);var rt=class extends g{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Xl=Symbol.toStringTag;rt[Xl]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(rt.prototype);var ue=class extends g{constructor(t,e,i){super(f.Union),this.mode=t,this.children=i,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((n,s,o)=>(n[s]=o)&&n||n,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Yl=Symbol.toStringTag;ue[Yl]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ue.prototype);var Ke=class extends g{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Zl=Symbol.toStringTag;Ke[Zl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ke.prototype);var fe=class extends g{constructor(t,e){super(f.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Ql=Symbol.toStringTag;fe[Ql]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(fe.prototype);var de=class extends g{constructor(t,e=!1){var i,n,s;if(super(f.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((i=t==null?void 0:t.type)===null||i===void 0)&&i.children)){let o=(n=t==null?void 0:t.type)===null||n===void 0?void 0:n.children[0];o&&(o.name="key");let a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};tu=Symbol.toStringTag;de[tu]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(de.prototype);var Nd=(r=>()=>++r)(-1),jt=class extends g{constructor(t,e,i,n){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=n||!1,this.id=i==null?Nd():j(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}>`}};eu=Symbol.toStringTag;jt[eu]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(jt.prototype);function zt(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var v=class{visitMany(t,...e){return t.map((i,n)=>this.visit(i,...e.map(s=>s[n])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Ed(this,t,e)}getVisitFnByTypeId(t,e=!0){return ii(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 Ed(r,t,e=!0){return typeof t=="number"?ii(r,t,e):typeof t=="string"&&t in f?ii(r,f[t],e):t&&t instanceof g?ii(r,ru(t),e):t!=null&&t.type&&t.type instanceof g?ii(r,ru(t.type),e):ii(r,f.NONE,e)}function ii(r,t,e=!0){let i=null;switch(t){case f.Null:i=r.visitNull;break;case f.Bool:i=r.visitBool;break;case f.Int:i=r.visitInt;break;case f.Int8:i=r.visitInt8||r.visitInt;break;case f.Int16:i=r.visitInt16||r.visitInt;break;case f.Int32:i=r.visitInt32||r.visitInt;break;case f.Int64:i=r.visitInt64||r.visitInt;break;case f.Uint8:i=r.visitUint8||r.visitInt;break;case f.Uint16:i=r.visitUint16||r.visitInt;break;case f.Uint32:i=r.visitUint32||r.visitInt;break;case f.Uint64:i=r.visitUint64||r.visitInt;break;case f.Float:i=r.visitFloat;break;case f.Float16:i=r.visitFloat16||r.visitFloat;break;case f.Float32:i=r.visitFloat32||r.visitFloat;break;case f.Float64:i=r.visitFloat64||r.visitFloat;break;case f.Utf8:i=r.visitUtf8;break;case f.LargeUtf8:i=r.visitLargeUtf8;break;case f.Binary:i=r.visitBinary;break;case f.LargeBinary:i=r.visitLargeBinary;break;case f.FixedSizeBinary:i=r.visitFixedSizeBinary;break;case f.Date:i=r.visitDate;break;case f.DateDay:i=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:i=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:i=r.visitTimestamp;break;case f.TimestampSecond:i=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:i=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:i=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:i=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:i=r.visitTime;break;case f.TimeSecond:i=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:i=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:i=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:i=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:i=r.visitDecimal;break;case f.List:i=r.visitList;break;case f.Struct:i=r.visitStruct;break;case f.Union:i=r.visitUnion;break;case f.DenseUnion:i=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:i=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:i=r.visitDictionary;break;case f.Interval:i=r.visitInterval;break;case f.IntervalDayTime:i=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:i=r.visitIntervalYearMonth||r.visitInterval;break;case f.Duration:i=r.visitDuration;break;case f.DurationSecond:i=r.visitDurationSecond||r.visitDuration;break;case f.DurationMillisecond:i=r.visitDurationMillisecond||r.visitDuration;break;case f.DurationMicrosecond:i=r.visitDurationMicrosecond||r.visitDuration;break;case f.DurationNanosecond:i=r.visitDurationNanosecond||r.visitDuration;break;case f.FixedSizeList:i=r.visitFixedSizeList;break;case f.Map:i=r.visitMap;break}if(typeof i=="function")return i;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function ru(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case G.HALF:return f.Float16;case G.SINGLE:return f.Float32;case G.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case b.SECOND:return f.TimeSecond;case b.MILLISECOND:return f.TimeMillisecond;case b.MICROSECOND:return f.TimeMicrosecond;case b.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case b.SECOND:return f.TimestampSecond;case b.MILLISECOND:return f.TimestampMillisecond;case b.MICROSECOND:return f.TimestampMicrosecond;case b.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case ct.DAY:return f.DateDay;case ct.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case yt.DAY_TIME:return f.IntervalDayTime;case yt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case b.SECOND:return f.DurationSecond;case b.MILLISECOND:return f.DurationMillisecond;case b.MICROSECOND:return f.DurationMicrosecond;case b.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case Z.Dense:return f.DenseUnion;case Z.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}v.prototype.visitInt8=null;v.prototype.visitInt16=null;v.prototype.visitInt32=null;v.prototype.visitInt64=null;v.prototype.visitUint8=null;v.prototype.visitUint16=null;v.prototype.visitUint32=null;v.prototype.visitUint64=null;v.prototype.visitFloat16=null;v.prototype.visitFloat32=null;v.prototype.visitFloat64=null;v.prototype.visitDateDay=null;v.prototype.visitDateMillisecond=null;v.prototype.visitTimestampSecond=null;v.prototype.visitTimestampMillisecond=null;v.prototype.visitTimestampMicrosecond=null;v.prototype.visitTimestampNanosecond=null;v.prototype.visitTimeSecond=null;v.prototype.visitTimeMillisecond=null;v.prototype.visitTimeMicrosecond=null;v.prototype.visitTimeNanosecond=null;v.prototype.visitDenseUnion=null;v.prototype.visitSparseUnion=null;v.prototype.visitIntervalDayTime=null;v.prototype.visitIntervalYearMonth=null;v.prototype.visitDuration=null;v.prototype.visitDurationSecond=null;v.prototype.visitDurationMillisecond=null;v.prototype.visitDurationMicrosecond=null;v.prototype.visitDurationNanosecond=null;var Ea={};or(Ea,{float64ToUint16:()=>tn,uint16ToFloat64:()=>Ns});var iu=new Float64Array(1),ni=new Uint32Array(iu.buffer);function Ns(r){let t=(r&31744)>>10,e=(r&1023)/1024,i=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return i*(e?Number.NaN:1/0);case 0:return i*(e?6103515625e-14*e:0)}return i*Math.pow(2,t-15)*(1+e)}function tn(r){if(r!==r)return 32256;iu[0]=r;let t=(ni[1]&2147483648)>>16&65535,e=ni[1]&2146435072,i=0;return e>=1089470464?ni[0]>0?e=31744:(e=(e&2080374784)>>16,i=(ni[1]&1048575)>>10):e<=1056964608?(i=1048576+(ni[1]&1048575),i=1048576+(i<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,i=(ni[1]&1048575)+512>>10),t|e|i&65535}var O=class extends v{};function N(r){return(t,e,i)=>{if(t.setValid(e,i!=null))return r(t,e,i)}}var Ld=(r,t,e)=>{r[t]=Math.floor(e/864e5)},nu=(r,t,e,i)=>{if(e+1<t.length){let n=j(t[e]),s=j(t[e+1]);r.set(i.subarray(0,s-n),n)}},Ud=({offset:r,values:t},e,i)=>{let n=r+e;i?t[n>>3]|=1<<n%8:t[n>>3]&=~(1<<n%8)},Ge=({values:r},t,e)=>{r[t]=e},La=({values:r},t,e)=>{r[t]=e},su=({values:r},t,e)=>{r[t]=tn(e)},Md=(r,t,e)=>{switch(r.type.precision){case G.HALF:return su(r,t,e);case G.SINGLE:case G.DOUBLE:return La(r,t,e)}},Es=({values:r},t,e)=>{Ld(r,t,e.valueOf())},Ls=({values:r},t,e)=>{r[t]=BigInt(e)},Ua=({stride:r,values:t},e,i)=>{t.set(i.subarray(0,r),r*e)},ou=({values:r,valueOffsets:t},e,i)=>nu(r,t,e,i),au=({values:r,valueOffsets:t},e,i)=>nu(r,t,e,be(i)),Ma=(r,t,e)=>{r.type.unit===ct.DAY?Es(r,t,e):Ls(r,t,e)},Us=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},Ms=({values:r},t,e)=>{r[t]=BigInt(e)},Rs=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},ks=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Ra=(r,t,e)=>{switch(r.type.unit){case b.SECOND:return Us(r,t,e);case b.MILLISECOND:return Ms(r,t,e);case b.MICROSECOND:return Rs(r,t,e);case b.NANOSECOND:return ks(r,t,e)}},Cs=({values:r},t,e)=>{r[t]=e},Vs=({values:r},t,e)=>{r[t]=e},Ps=({values:r},t,e)=>{r[t]=e},js=({values:r},t,e)=>{r[t]=e},ka=(r,t,e)=>{switch(r.type.unit){case b.SECOND:return Cs(r,t,e);case b.MILLISECOND:return Vs(r,t,e);case b.MICROSECOND:return Ps(r,t,e);case b.NANOSECOND:return js(r,t,e)}},Ca=({values:r,stride:t},e,i)=>{r.set(i.subarray(0,t),t*e)},Rd=(r,t,e)=>{let i=r.children[0],n=r.valueOffsets,s=wt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=n[t],c=n[t+1];a<c;)s(i,a++,e[++o]);else for(let o=-1,a=n[t],c=n[t+1];a<c;)s(i,a++,e.get(++o))},kd=(r,t,e)=>{let i=r.children[0],{valueOffsets:n}=r,s=wt.getVisitFn(i),{[t]:o,[t+1]:a}=n,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(s(i,o,l),++o>=a)break},Cd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t[s]),Vd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t.get(s)),Pd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t.get(n.name)),jd=(r,t)=>(e,i,n,s)=>i&&e(i,r,t[n.name]),zd=(r,t,e)=>{let i=r.type.children.map(s=>wt.getVisitFn(s.type)),n=e instanceof Map?Pd(t,e):e instanceof P?Vd(t,e):Array.isArray(e)?Cd(t,e):jd(t,e);r.type.children.forEach((s,o)=>n(i[o],r.children[o],s,o))},Wd=(r,t,e)=>{r.type.mode===Z.Dense?cu(r,t,e):lu(r,t,e)},cu=(r,t,e)=>{let i=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[i];wt.visit(n,r.valueOffsets[t],e)},lu=(r,t,e)=>{let i=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[i];wt.visit(n,t,e)},$d=(r,t,e)=>{var i;(i=r.dictionary)===null||i===void 0||i.set(r.values[t],e)},Va=(r,t,e)=>{r.type.unit===yt.DAY_TIME?zs(r,t,e):Ws(r,t,e)},zs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Ws=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},$s=({values:r},t,e)=>{r[t]=e},Hs=({values:r},t,e)=>{r[t]=e},Js=({values:r},t,e)=>{r[t]=e},qs=({values:r},t,e)=>{r[t]=e},Pa=(r,t,e)=>{switch(r.type.unit){case b.SECOND:return $s(r,t,e);case b.MILLISECOND:return Hs(r,t,e);case b.MICROSECOND:return Js(r,t,e);case b.NANOSECOND:return qs(r,t,e)}},Hd=(r,t,e)=>{let{stride:i}=r,n=r.children[0],s=wt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=t*i;++o<i;)s(n,a+o,e[o]);else for(let o=-1,a=t*i;++o<i;)s(n,a+o,e.get(o))};O.prototype.visitBool=N(Ud);O.prototype.visitInt=N(Ge);O.prototype.visitInt8=N(Ge);O.prototype.visitInt16=N(Ge);O.prototype.visitInt32=N(Ge);O.prototype.visitInt64=N(Ge);O.prototype.visitUint8=N(Ge);O.prototype.visitUint16=N(Ge);O.prototype.visitUint32=N(Ge);O.prototype.visitUint64=N(Ge);O.prototype.visitFloat=N(Md);O.prototype.visitFloat16=N(su);O.prototype.visitFloat32=N(La);O.prototype.visitFloat64=N(La);O.prototype.visitUtf8=N(au);O.prototype.visitLargeUtf8=N(au);O.prototype.visitBinary=N(ou);O.prototype.visitLargeBinary=N(ou);O.prototype.visitFixedSizeBinary=N(Ua);O.prototype.visitDate=N(Ma);O.prototype.visitDateDay=N(Es);O.prototype.visitDateMillisecond=N(Ls);O.prototype.visitTimestamp=N(Ra);O.prototype.visitTimestampSecond=N(Us);O.prototype.visitTimestampMillisecond=N(Ms);O.prototype.visitTimestampMicrosecond=N(Rs);O.prototype.visitTimestampNanosecond=N(ks);O.prototype.visitTime=N(ka);O.prototype.visitTimeSecond=N(Cs);O.prototype.visitTimeMillisecond=N(Vs);O.prototype.visitTimeMicrosecond=N(Ps);O.prototype.visitTimeNanosecond=N(js);O.prototype.visitDecimal=N(Ca);O.prototype.visitList=N(Rd);O.prototype.visitStruct=N(zd);O.prototype.visitUnion=N(Wd);O.prototype.visitDenseUnion=N(cu);O.prototype.visitSparseUnion=N(lu);O.prototype.visitDictionary=N($d);O.prototype.visitInterval=N(Va);O.prototype.visitIntervalDayTime=N(zs);O.prototype.visitIntervalYearMonth=N(Ws);O.prototype.visitDuration=N(Pa);O.prototype.visitDurationSecond=N($s);O.prototype.visitDurationMillisecond=N(Hs);O.prototype.visitDurationMicrosecond=N(Js);O.prototype.visitDurationNanosecond=N(qs);O.prototype.visitFixedSizeList=N(Hd);O.prototype.visitMap=N(kd);var wt=new O;var he=Symbol.for("parent"),si=Symbol.for("rowIndex"),br=class{constructor(t,e){return this[he]=t,this[si]=e,new Proxy(this,Jd)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[si],e=this[he],i=e.type.children,n={};for(let s=-1,o=i.length;++s<o;)n[i[s].name]=dt.visit(e.children[s],t);return n}toString(){return`{${[...this].map(([t,e])=>`${ae(t)}: ${ae(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ja(this[he],this[si])}},ja=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,dt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(br.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[he]:{writable:!0,enumerable:!1,configurable:!1,value:null},[si]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var za=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[he].type.children.map(e=>e.name)}has(t,e){return t[he].type.children.some(i=>i.name===e)}getOwnPropertyDescriptor(t,e){if(t[he].type.children.some(i=>i.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let i=t[he].type.children.findIndex(n=>n.name===e);if(i!==-1){let n=dt.visit(t[he].children[i],t[si]);return Reflect.set(t,e,n),n}}set(t,e,i){let n=t[he].type.children.findIndex(s=>s.name===e);return n!==-1?(wt.visit(t[he].children[n],t[si],i),Reflect.set(t,e,i)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,i):!1}},Jd=new za;var S=class extends v{};function F(r){return(t,e)=>t.getValid(e)?r(t,e):null}var qd=(r,t)=>864e5*r[t],Kd=(r,t)=>null,uu=(r,t,e)=>{if(e+1>=t.length)return null;let i=j(t[e]),n=j(t[e+1]);return r.subarray(i,n)},Gd=({offset:r,values:t},e)=>{let i=r+e;return(t[i>>3]&1<<i%8)!==0},fu=({values:r},t)=>qd(r,t),du=({values:r},t)=>j(r[t]),_r=({stride:r,values:t},e)=>t[r*e],Xd=({stride:r,values:t},e)=>Ns(t[r*e]),hu=({values:r},t)=>r[t],Yd=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),pu=({values:r,valueOffsets:t},e)=>uu(r,t,e),mu=({values:r,valueOffsets:t},e)=>{let i=uu(r,t,e);return i!==null?ki(i):null},Zd=({values:r},t)=>r[t],Qd=({type:r,values:t},e)=>r.precision!==G.HALF?t[e]:Ns(t[e]),th=(r,t)=>r.type.unit===ct.DAY?fu(r,t):du(r,t),yu=({values:r},t)=>1e3*j(r[t]),gu=({values:r},t)=>j(r[t]),bu=({values:r},t)=>Da(r[t],BigInt(1e3)),_u=({values:r},t)=>Da(r[t],BigInt(1e6)),eh=(r,t)=>{switch(r.type.unit){case b.SECOND:return yu(r,t);case b.MILLISECOND:return gu(r,t);case b.MICROSECOND:return bu(r,t);case b.NANOSECOND:return _u(r,t)}},wu=({values:r},t)=>r[t],Iu=({values:r},t)=>r[t],vu=({values:r},t)=>r[t],Su=({values:r},t)=>r[t],rh=(r,t)=>{switch(r.type.unit){case b.SECOND:return wu(r,t);case b.MILLISECOND:return Iu(r,t);case b.MICROSECOND:return vu(r,t);case b.NANOSECOND:return Su(r,t)}},ih=({values:r,stride:t},e)=>Qi.decimal(r.subarray(t*e,t*(e+1))),nh=(r,t)=>{let{valueOffsets:e,stride:i,children:n}=r,{[t*i]:s,[t*i+1]:o}=e,c=n[0].slice(s,o-s);return new P([c])},sh=(r,t)=>{let{valueOffsets:e,children:i}=r,{[t]:n,[t+1]:s}=e,o=i[0];return new xe(o.slice(n,s-n))},oh=(r,t)=>new br(r,t),ah=(r,t)=>r.type.mode===Z.Dense?xu(r,t):Tu(r,t),xu=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[e];return dt.visit(i,r.valueOffsets[t])},Tu=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[e];return dt.visit(i,t)},ch=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},lh=(r,t)=>r.type.unit===yt.DAY_TIME?Bu(r,t):Ou(r,t),Bu=({values:r},t)=>r.subarray(2*t,2*(t+1)),Ou=({values:r},t)=>{let e=r[t],i=new Int32Array(2);return i[0]=Math.trunc(e/12),i[1]=Math.trunc(e%12),i},Du=({values:r},t)=>r[t],Fu=({values:r},t)=>r[t],Au=({values:r},t)=>r[t],Nu=({values:r},t)=>r[t],uh=(r,t)=>{switch(r.type.unit){case b.SECOND:return Du(r,t);case b.MILLISECOND:return Fu(r,t);case b.MICROSECOND:return Au(r,t);case b.NANOSECOND:return Nu(r,t)}},fh=(r,t)=>{let{stride:e,children:i}=r,s=i[0].slice(t*e,e);return new P([s])};S.prototype.visitNull=F(Kd);S.prototype.visitBool=F(Gd);S.prototype.visitInt=F(Zd);S.prototype.visitInt8=F(_r);S.prototype.visitInt16=F(_r);S.prototype.visitInt32=F(_r);S.prototype.visitInt64=F(hu);S.prototype.visitUint8=F(_r);S.prototype.visitUint16=F(_r);S.prototype.visitUint32=F(_r);S.prototype.visitUint64=F(hu);S.prototype.visitFloat=F(Qd);S.prototype.visitFloat16=F(Xd);S.prototype.visitFloat32=F(_r);S.prototype.visitFloat64=F(_r);S.prototype.visitUtf8=F(mu);S.prototype.visitLargeUtf8=F(mu);S.prototype.visitBinary=F(pu);S.prototype.visitLargeBinary=F(pu);S.prototype.visitFixedSizeBinary=F(Yd);S.prototype.visitDate=F(th);S.prototype.visitDateDay=F(fu);S.prototype.visitDateMillisecond=F(du);S.prototype.visitTimestamp=F(eh);S.prototype.visitTimestampSecond=F(yu);S.prototype.visitTimestampMillisecond=F(gu);S.prototype.visitTimestampMicrosecond=F(bu);S.prototype.visitTimestampNanosecond=F(_u);S.prototype.visitTime=F(rh);S.prototype.visitTimeSecond=F(wu);S.prototype.visitTimeMillisecond=F(Iu);S.prototype.visitTimeMicrosecond=F(vu);S.prototype.visitTimeNanosecond=F(Su);S.prototype.visitDecimal=F(ih);S.prototype.visitList=F(nh);S.prototype.visitStruct=F(oh);S.prototype.visitUnion=F(ah);S.prototype.visitDenseUnion=F(xu);S.prototype.visitSparseUnion=F(Tu);S.prototype.visitDictionary=F(ch);S.prototype.visitInterval=F(lh);S.prototype.visitIntervalDayTime=F(Bu);S.prototype.visitIntervalYearMonth=F(Ou);S.prototype.visitDuration=F(uh);S.prototype.visitDurationSecond=F(Du);S.prototype.visitDurationMillisecond=F(Fu);S.prototype.visitDurationMicrosecond=F(Au);S.prototype.visitDurationNanosecond=F(Nu);S.prototype.visitFixedSizeList=F(fh);S.prototype.visitMap=F(sh);var dt=new S;var wr=Symbol.for("keys"),ai=Symbol.for("vals"),oi=Symbol.for("kKeysAsStrings"),Wa=Symbol.for("_kKeysAsStrings"),xe=class{constructor(t){return this[wr]=new P([t.children[0]]).memoize(),this[ai]=t.children[1],new Proxy(this,new Ha)}get[oi](){return this[Wa]||(this[Wa]=Array.from(this[wr].toArray(),String))}[Symbol.iterator](){return new $a(this[wr],this[ai])}get size(){return this[wr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[wr],e=this[ai],i={};for(let n=-1,s=t.length;++n<s;)i[t.get(n)]=dt.visit(e,n);return i}toString(){return`{${[...this].map(([t,e])=>`${ae(t)}: ${ae(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},$a=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),dt.visit(this.vals,t)]})}},Ha=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[oi]}has(t,e){return t[oi].includes(e)}getOwnPropertyDescriptor(t,e){if(t[oi].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let i=t[oi].indexOf(e);if(i!==-1){let n=dt.visit(Reflect.get(t,ai),i);return Reflect.set(t,e,n),n}}set(t,e,i){let n=t[oi].indexOf(e);return n!==-1?(wt.visit(Reflect.get(t,ai),n,i),Reflect.set(t,e,i)):Reflect.has(t,e)?Reflect.set(t,e,i):!1}};Object.defineProperties(xe.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ai]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wa]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Eu;function en(r,t,e,i){let{length:n=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?n:e;return s<0&&(s=(s%n+n)%n),o<0&&(o=(o%n+n)%n),o<s&&(Eu=s,s=o,o=Eu),o>n&&(o=n),i?i(r,s,o):[s,o]}var Er=(r,t)=>r<0?t+r:r,Lu=r=>r!==r;function Ir(r){if(typeof r!=="object"||r===null)return Lu(r)?Lu:e=>e===r;if(r instanceof Date){let e=r.valueOf();return i=>i instanceof Date?i.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?Sa(r,e):!1:r instanceof Map?hh(r):Array.isArray(r)?dh(r):r instanceof P?ph(r):mh(r,!0)}function dh(r){let t=[];for(let e=-1,i=r.length;++e<i;)t[e]=Ir(r[e]);return Ks(t)}function hh(r){let t=-1,e=[];for(let i of r.values())e[++t]=Ir(i);return Ks(e)}function ph(r){let t=[];for(let e=-1,i=r.length;++e<i;)t[e]=Ir(r.get(e));return Ks(t)}function mh(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let i=[];for(let n=-1,s=e.length;++n<s;)i[n]=Ir(r[e[n]]);return Ks(i,e)}function Ks(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return yh(r,e);case Map:return Uu(r,e,e.keys());case xe:case br:case Object:case void 0:return Uu(r,e,t||Object.keys(e))}return e instanceof P?gh(r,e):!1}}function yh(r,t){let e=r.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!r[i](t[i]))return!1;return!0}function gh(r,t){let e=r.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!r[i](t.get(i)))return!1;return!0}function Uu(r,t,e){let i=e[Symbol.iterator](),n=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),l=i.next(),u=n.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=i.next(),u=n.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(i.return&&i.return(),n.return&&n.return(),s.return&&s.return(),!1)}var qa={};or(qa,{BitIterator:()=>Lr,getBit:()=>Mu,getBool:()=>Xs,packBools:()=>Mr,popcnt_array:()=>Ru,popcnt_bit_range:()=>rn,popcnt_uint32:()=>Gs,setBool:()=>bh,truncateBitmap:()=>Ur});function Xs(r,t,e,i){return(e&1<<i)!==0}function Mu(r,t,e,i){return(e&1<<i)>>i}function bh(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Ur(r,t,e){let i=e.byteLength+7&-8;if(r>0||e.byteLength<i){let n=new Uint8Array(i);return n.set(r%8===0?e.subarray(r>>3):Mr(new Lr(e,r,t,null,Xs)).subarray(0,i)),n}return e}function Mr(r){let t=[],e=0,i=0,n=0;for(let o of r)o&&(n|=1<<i),++i===8&&(t[e++]=n,n=i=0);(e===0||i>0)&&(t[e++]=n);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var Lr=class{constructor(t,e,i,n,s){this.bytes=t,this.length=i,this.context=n,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function rn(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new Lr(r,t,e-t,r,Mu))s+=o;return s}let i=e>>3<<3,n=t+(t%8===0?0:8-t%8);return rn(r,t,n)+rn(r,i,e)+Ru(r,n>>3,i-n>>3)}function Ru(r,t,e){let i=0,n=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:n+e;for(;o-n>=4;)i+=Gs(s.getUint32(n)),n+=4;for(;o-n>=2;)i+=Gs(s.getUint16(n)),n+=2;for(;o-n>=1;)i+=Gs(s.getUint8(n)),n+=1;return i}function Gs(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var _h=-1,W=class r{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return g.isSparseUnion(t)?this.children.some(e=>e.nullable):g.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:i,nullBitmap:n,typeIds:s}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(g.isUnion(this.type))return this.children.reduce((i,n)=>i+n.nullCount,0);let t=this._nullCount,e;return t<=_h&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-rn(e,this.offset,this.offset+this.length)),t}constructor(t,e,i,n,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(n||0,-1));let c;s instanceof r?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=zt(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(g.isUnion(e)){let i=e,n=this.children[i.typeIdToChildIndex[this.typeIds[t]]],s=i.mode===Z.Dense?this.valueOffsets[t]:t;return n.getValid(s)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(t,e){let i,{type:n}=this;if(g.isUnion(n)){let s=n,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===Z.Dense?this.valueOffsets[t]:t;i=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Ur(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let d=s[u];i=(d&l)!==0,s[u]=e?d|l:d&~l}return i!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,i=this.length,n=this._nullCount,s=this,o=this.children){return new r(t,e,i,n,s,o,this.dictionary)}slice(t,e){let{stride:i,typeId:n,children:s}=this,o=+(this._nullCount===0)-1,a=n===16?i:1,c=this._sliceBuffers(t,e,i,n);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:i}=this,n=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);n[e>>3]=(1<<e-(e&-8))-1,i>0&&n.set(Ur(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Gt.VALIDITY]=n,this.clone(this.type,0,t,i+(t-e),s)}_sliceBuffers(t,e,i,n){let s,{buffers:o}=this;return(s=o[Gt.TYPE])&&(o[Gt.TYPE]=s.subarray(t,t+e)),(s=o[Gt.OFFSET])&&(o[Gt.OFFSET]=s.subarray(t,t+e+1))||(s=o[Gt.DATA])&&(o[Gt.DATA]=n===6?s:s.subarray(i*t,i*(t+e))),o}_sliceChildren(t,e,i){return t.map(n=>n.slice(e,i))}};W.prototype.children=Object.freeze([]);var Ka=class r extends v{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:i=0,["length"]:n=0}=t;return new W(e,i,n,n)}visitBool(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitInt(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitFloat(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitUtf8(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=ps(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitBinary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.data),s=D(t.nullBitmap),o=ps(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,n,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitDate(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitTimestamp(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitTime(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitDecimal(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitList(t){let{["type"]:e,["offset"]:i=0,["child"]:n}=t,s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,void 0,s],[n])}visitStruct(t){let{["type"]:e,["offset"]:i=0,["children"]:n=[]}=t,s=D(t.nullBitmap),{length:o=n.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,void 0,s],n)}visitUnion(t){let{["type"]:e,["offset"]:i=0,["children"]:n=[]}=t,s=R(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(g.isSparseUnion(e))return new W(e,i,o,a,[void 0,void 0,void 0,s],n);let c=Ar(t.valueOffsets);return new W(e,i,o,a,[c,void 0,void 0,s],n)}visitDictionary(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.indices.ArrayType,t.data),{["dictionary"]:o=new P([new r().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[void 0,s,n],[],o)}visitInterval(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitDuration(t){let{["type"]:e,["offset"]:i=0}=t,n=D(t.nullBitmap),s=R(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,s,n])}visitFixedSizeList(t){let{["type"]:e,["offset"]:i=0,["child"]:n=new r().visit({type:e.valueType})}=t,s=D(t.nullBitmap),{["length"]:o=n.length/zt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new W(e,i,o,a,[void 0,void 0,s],[n])}visitMap(t){let{["type"]:e,["offset"]:i=0,["child"]:n=new r().visit({type:e.childType})}=t,s=D(t.nullBitmap),o=Ar(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new W(e,i,a,c,[o,void 0,s],[n])}},wh=new Ka;function E(r){return wh.visit(r)}var nn=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function ku(r){return r.some(t=>t.nullable)}function Ys(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Zs(r){return r.reduce((t,e,i)=>(t[i+1]=t[i]+e.length,t),new Uint32Array(r.length+1))}function Qs(r,t,e,i){let n=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:l}=a;if(c>=i)break;if(e>=c+l)continue;if(c>=e&&c+l<=i){n.push(a);continue}let u=Math.max(0,e-c),d=Math.min(i-c,l);n.push(a.slice(u,d-u))}return n.length===0&&n.push(r[0].slice(0,0)),n}function Ga(r,t,e,i){let n=0,s=0,o=t.length-1;do{if(n>=o-1)return e<t[o]?i(r,n,e-t[n]):null;s=n+Math.trunc((o-n)*.5),e<t[s]?o=s:n=s}while(n<o)}function sn(r,t){return r.getValid(t)}function ci(r){function t(e,i,n){return r(e[i],n)}return function(e){let i=this.data;return Ga(i,this._offsets,e,t)}}function to(r){let t;function e(i,n,s){return r(i[n],s,t)}return function(i,n){let s=this.data;t=n;let o=Ga(s,this._offsets,i,e);return t=void 0,o}}function eo(r){let t;function e(i,n,s){let o=s,a=0,c=0;for(let l=n-1,u=i.length;++l<u;){let d=i[l];if(~(a=r(d,t,o)))return c+a;o=0,c+=d.length}return-1}return function(i,n){t=i;let s=this.data,o=typeof n!="number"?e(s,0,0):Ga(s,this._offsets,n,e);return t=void 0,o}}var x=class extends v{};function Ih(r,t){return t===null&&r.length>0?0:-1}function vh(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let i=0;for(let n of new Lr(e,r.offset+(t||0),r.length,e,Xs)){if(!n)return i;++i}return-1}function L(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case f.Union:break;case f.Dictionary:break;default:return vh(r,e)}let i=dt.getVisitFn(r),n=Ir(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(n(i(r,s)))return s;return-1}function Cu(r,t,e){let i=dt.getVisitFn(r),n=Ir(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(n(i(r,s)))return s;return-1}x.prototype.visitNull=Ih;x.prototype.visitBool=L;x.prototype.visitInt=L;x.prototype.visitInt8=L;x.prototype.visitInt16=L;x.prototype.visitInt32=L;x.prototype.visitInt64=L;x.prototype.visitUint8=L;x.prototype.visitUint16=L;x.prototype.visitUint32=L;x.prototype.visitUint64=L;x.prototype.visitFloat=L;x.prototype.visitFloat16=L;x.prototype.visitFloat32=L;x.prototype.visitFloat64=L;x.prototype.visitUtf8=L;x.prototype.visitLargeUtf8=L;x.prototype.visitBinary=L;x.prototype.visitLargeBinary=L;x.prototype.visitFixedSizeBinary=L;x.prototype.visitDate=L;x.prototype.visitDateDay=L;x.prototype.visitDateMillisecond=L;x.prototype.visitTimestamp=L;x.prototype.visitTimestampSecond=L;x.prototype.visitTimestampMillisecond=L;x.prototype.visitTimestampMicrosecond=L;x.prototype.visitTimestampNanosecond=L;x.prototype.visitTime=L;x.prototype.visitTimeSecond=L;x.prototype.visitTimeMillisecond=L;x.prototype.visitTimeMicrosecond=L;x.prototype.visitTimeNanosecond=L;x.prototype.visitDecimal=L;x.prototype.visitList=L;x.prototype.visitStruct=L;x.prototype.visitUnion=L;x.prototype.visitDenseUnion=Cu;x.prototype.visitSparseUnion=Cu;x.prototype.visitDictionary=L;x.prototype.visitInterval=L;x.prototype.visitIntervalDayTime=L;x.prototype.visitIntervalYearMonth=L;x.prototype.visitDuration=L;x.prototype.visitDurationSecond=L;x.prototype.visitDurationMillisecond=L;x.prototype.visitDurationMicrosecond=L;x.prototype.visitDurationNanosecond=L;x.prototype.visitFixedSizeList=L;x.prototype.visitMap=L;var Rr=new x;var T=class extends v{};function A(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(g.isInt(t)&&t.bitWidth!==64||g.isTime(t)&&t.bitWidth!==64||g.isFloat(t)&&t.precision!==G.HALF))return new nn(r.data.length,i=>{let n=r.data[i];return n.values.subarray(0,n.length)[Symbol.iterator]()});let e=0;return new nn(r.data.length,i=>{let s=r.data[i].length,o=r.slice(e,e+s);return e+=s,new Xa(o)})}var Xa=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};T.prototype.visitNull=A;T.prototype.visitBool=A;T.prototype.visitInt=A;T.prototype.visitInt8=A;T.prototype.visitInt16=A;T.prototype.visitInt32=A;T.prototype.visitInt64=A;T.prototype.visitUint8=A;T.prototype.visitUint16=A;T.prototype.visitUint32=A;T.prototype.visitUint64=A;T.prototype.visitFloat=A;T.prototype.visitFloat16=A;T.prototype.visitFloat32=A;T.prototype.visitFloat64=A;T.prototype.visitUtf8=A;T.prototype.visitLargeUtf8=A;T.prototype.visitBinary=A;T.prototype.visitLargeBinary=A;T.prototype.visitFixedSizeBinary=A;T.prototype.visitDate=A;T.prototype.visitDateDay=A;T.prototype.visitDateMillisecond=A;T.prototype.visitTimestamp=A;T.prototype.visitTimestampSecond=A;T.prototype.visitTimestampMillisecond=A;T.prototype.visitTimestampMicrosecond=A;T.prototype.visitTimestampNanosecond=A;T.prototype.visitTime=A;T.prototype.visitTimeSecond=A;T.prototype.visitTimeMillisecond=A;T.prototype.visitTimeMicrosecond=A;T.prototype.visitTimeNanosecond=A;T.prototype.visitDecimal=A;T.prototype.visitList=A;T.prototype.visitStruct=A;T.prototype.visitUnion=A;T.prototype.visitDenseUnion=A;T.prototype.visitSparseUnion=A;T.prototype.visitDictionary=A;T.prototype.visitInterval=A;T.prototype.visitIntervalDayTime=A;T.prototype.visitIntervalYearMonth=A;T.prototype.visitDuration=A;T.prototype.visitDurationSecond=A;T.prototype.visitDurationMillisecond=A;T.prototype.visitDurationMicrosecond=A;T.prototype.visitDurationNanosecond=A;T.prototype.visitFixedSizeList=A;T.prototype.visitMap=A;var li=new T;var Vu,Pu={},ju={},P=class r{constructor(t){var e,i,n;let s=t[0]instanceof r?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof W)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=Pu[o.typeId],u=s[0];this.isValid=d=>sn(u,d),this.get=d=>a(u,d),this.set=(d,p)=>c(u,d,p),this.indexOf=d=>l(u,d),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,ju[o.typeId]),this._offsets=Zs(s);break}this.data=s,this.type=o,this.stride=zt(o),this.numChildren=(n=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&n!==void 0?n:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return ku(this.data)}get nullCount(){return Ys(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Er(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return li.visit(this)}concat(...t){return new r(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new r(en(this,t,e,({data:i,_offsets:n},s,o)=>Qs(i,n,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:i,stride:n,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,i*n);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*n),o.offset),o.offset+=c*n,o),{array:new s(i*n),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new r(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return g.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(g.isDictionary(this.type)){let t=new ro(this.data[0].dictionary),e=this.data.map(i=>{let n=i.clone();return n.dictionary=t,n});return new r(e)}return new ro(this)}unmemoize(){if(g.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(i=>{let n=i.clone();return n.dictionary=t,n});return new r(e)}return this}};Vu=Symbol.toStringTag;P[Vu]=(r=>{r.type=g.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let i=dt.getVisitFnByTypeId(e),n=wt.getVisitFnByTypeId(e),s=Rr.getVisitFnByTypeId(e);Pu[e]={get:i,set:n,indexOf:s},ju[e]=Object.create(r,{isValid:{value:ci(sn)},get:{value:ci(dt.getVisitFnByTypeId(e))},set:{value:to(wt.getVisitFnByTypeId(e))},indexOf:{value:eo(Rr.getVisitFnByTypeId(e))}})}return"Vector"})(P.prototype);var ro=class r extends P{constructor(t){super(t.data);let e=this.get,i=this.set,n=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(n.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new P(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function zu(r){if(!r||r.length<=0)return function(n){return!0};let t="",e=r.filter(i=>i===i);return e.length>0&&(t=`
|
|
8
8
|
switch (x) {${e.map(i=>`
|
|
9
|
-
case ${
|
|
9
|
+
case ${Sh(i)}:`).join("")}
|
|
10
10
|
return false;
|
|
11
11
|
}`),r.length!==e.length&&(t=`if (x !== x) return false;
|
|
12
12
|
${t}`),new Function("x",`${t}
|
|
13
|
-
return true;`)}function wh(r){return typeof r!="bigint"?ae(r):`${ae(r)}n`}function Xa(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function Pu(r,t=0){return r.length>=t?r.subarray(0,t):Ci(new r.constructor(t),r,0)}var pe=class{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;let e=this.stride,i=this.length*e,n=this.buffer.length;i>=n&&this._resize(n===0?Xa(i*1,this.BYTES_PER_ELEMENT):Xa(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Xa(t*this.stride,this.BYTES_PER_ELEMENT);let e=Pu(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Pu(this.buffer,t)}},Xe=class extends pe{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}},li=class extends Xe{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:i}=this.reserve(t-this.length+1),n=t>>3,s=t%8,o=i[n]>>s&1;return e?o===0&&(i[n]|=1<<s,++this.numValid):o===1&&(i[n]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ui=class extends Xe{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let i=this.length-1,n=this.reserve(t-i+1).buffer;return i<t++&&i>=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)}};var st=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=zt(t),this._nulls=new li,e&&e.length>0&&(this._isValid=Vu(e))}toVector(){return new P([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:i,_nulls:n,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),o.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,i)=>e+i.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,{type:s,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:d}=this;(e=c==null?void 0:c.flush(o))?n=l==null?void 0:l.flush(o):(n=l==null?void 0:l.flush(o))?t=u==null?void 0:u.flush(l.last()):t=u==null?void 0:u.flush(o),a>0&&(i=d==null?void 0:d.flush(o));let p=this.children.map(v=>v.flush());return this.clear(),E({type:s,length:o,nullCount:a,children:p,child:p[0],data:t,typeIds:e,nullBitmap:i,valueOffsets:n})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,i,n;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(n=this._typeIds)===null||n===void 0||n.clear();for(let s of this.children)s.clear();return this}};st.prototype.length=1;st.prototype.stride=1;st.prototype.children=null;st.prototype.finished=!1;st.prototype.nullValues=null;st.prototype._isValid=()=>!0;var dt=class extends st{constructor(t){super(t),this._values=new Xe(this.ArrayType,0,this.stride)}setValue(t,e){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,e)}},At=class extends st{constructor(t){super(t),this._pendingLength=0,this._offsets=new ui(t.type)}setValue(t,e){let i=this._pending||(this._pending=new Map),n=i.get(t);n&&(this._pendingLength-=n.length),this._pendingLength+=e instanceof xe?e[wr].length:e.length,i.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var kr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,i,n){return t.prep(8,24),t.writeInt64(BigInt(n!=null?n:0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Wt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):H.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ft).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new kr).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let i=this.bb.__offset(this.bb_pos,10);return i?(e||new kr).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,H.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let 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)}};var q=class r{constructor(t=[],e,i,n=H.V5){this.fields=t||[],this.metadata=e||new Map,i||(i=Ya(this.fields)),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){let e=new Set(t),i=this.fields.filter(n=>e.has(n.name));return new r(i,this.metadata)}selectAt(t){let e=t.map(i=>this.fields[i]).filter(Boolean);return new r(e,this.metadata)}assign(...t){let e=t[0]instanceof r?t[0]:Array.isArray(t[0])?new r(t[0]):new r(t),i=[...this.fields],n=ro(ro(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let c=i.findIndex(l=>l.name===a.name);return~c?(i[c]=a.clone({metadata:ro(ro(new Map,i[c].metadata),a.metadata)}))&&!1:!0}),o=Ya(s,new Map);return new r([...i,...s],n,new Map([...this.dictionaries,...o]))}};q.prototype.fields=null;q.prototype.metadata=null;q.prototype.dictionaries=null;var k=class r{static new(...t){let[e,i,n,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],i===void 0&&(i=t[0].type),n===void 0&&(n=t[0].nullable),s===void 0&&(s=t[0].metadata)),new r(`${e}`,i,n,s)}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,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,i=this.type,n=this.nullable,s=this.metadata]=t:{name:e=this.name,type:i=this.type,nullable:n=this.nullable,metadata:s=this.metadata}=t[0],r.new(e,i,n,s)}};k.prototype.type=null;k.prototype.name=null;k.prototype.nullable=null;k.prototype.metadata=null;function ro(r,t){return new Map([...r||new Map,...t||new Map])}function Ya(r,t=new Map){for(let e=-1,i=r.length;++e<i;){let s=r[e].type;if(g.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Ya(s.children,t)}return t}var vh=Nr,Ih=Vt,Ye=class{static decode(t){t=new Ih(D(t));let e=Wt.getRootAsFooter(t),i=q.decode(e.schema(),new Map,e.version());return new Za(i,e)}static encode(t){let e=new vh,i=q.encode(e,t.schema);Wt.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ze.encode(e,o);let n=e.endVector();Wt.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ze.encode(e,o);let s=e.endVector();return Wt.startFooter(e),Wt.addSchema(e,i),Wt.addVersion(e,H.V5),Wt.addRecordBatches(e,n),Wt.addDictionaries(e,s),Wt.finishFooterBuffer(e,Wt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=H.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<i;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,i=this.numDictionaries;++e<i;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Za=class extends Ye{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ze.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ze.decode(e)}return null}},Ze=class r{static decode(t){return new r(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:i}=e,n=BigInt(e.offset),s=BigInt(e.bodyLength);return kr.createBlock(t,n,i,s)}constructor(t,e,i){this.metaDataLength=t,this.offset=j(i),this.bodyLength=j(e)}};var it=Object.freeze({done:!0,value:void 0}),sn=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Cr=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},io=class extends Cr{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(it);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return _t.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return _t.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return y(this,void 0,void 0,function*(){return yield this.abort(t),it})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),it})}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,i)=>{this.resolvers.push({resolve:e,reject:i})}):Promise.resolve(it)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Te=class extends io{write(t){if((t=D(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Ri(this.toUint8Array(!0)):this.toUint8Array(!1).then(Ri)}toUint8Array(t=!1){return t?Ct(this._values)[0]:y(this,void 0,void 0,function*(){var e,i,n,s;let o=[],a=0;try{for(var c=!0,l=te(this),u;u=yield l.next(),e=u.done,!e;c=!0){s=u.value,c=!1;let d=s;o.push(d),a+=d.byteLength}}catch(d){i={error:d}}finally{try{!c&&!e&&(n=l.return)&&(yield n.call(l))}finally{if(i)throw i.error}}return Ct(o,a)[0]})}},Be=class{constructor(t){t&&(this.source=new Qa(_t.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)}},Yt=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof Te?this.source=new Qe(_t.fromAsyncIterable(t)):ds(t)?this.source=new Qe(_t.fromNodeStream(t)):ki(t)?this.source=new Qe(_t.fromDOMStream(t)):us(t)?this.source=new Qe(_t.fromDOMStream(t.body)):re(t)?this.source=new Qe(_t.fromIterable(t)):ee(t)?this.source=new Qe(_t.fromAsyncIterable(t)):qt(t)&&(this.source=new Qe(_t.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)}},Qa=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||it)}return(t){return Object.create(this.source.return&&this.source.return(t)||it)}},Qe=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return y(this,arguments,void 0,function*(e,i="read"){return yield this.source.next({cmd:i,size:e})})}throw(t){return y(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||it;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return y(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||it;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var on=class extends Be{constructor(t,e){super(),this.position=0,this.buffer=D(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:i,position:n}=this;return e&&n<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,n+Math.min(i-n,t)),e.subarray(n,this.position)):null}readAt(t,e){let i=this.buffer,n=Math.min(this.size,t+e);return i?i.subarray(t,n):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Ir=class extends Yt{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return y(this,void 0,void 0,function*(){let{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)})}seek(t){return y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:i,position:n}=this;if(e&&n<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=n,o=0,a=0,c=Math.min(i,s+Math.min(i-s,t)),l=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,s));return l}return null})}readAt(t,e){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:n}=this;if(i&&t+e<n){let s=Math.min(n,t+e),o=new Uint8Array(s-t);return(yield i.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ec={};or(ec,{BaseInt64:()=>an,Int128:()=>cn,Int64:()=>tr,Uint64:()=>at});function fi(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var di=8,tc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],an=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),n=e[3]*i[3];this.buffer[0]=n&65535;let s=n>>>16;return n=e[2]*i[3],s+=n,n=e[3]*i[2]>>>0,s+=n,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<n?65536:0,this.buffer[1]+=s>>>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){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${fi(this.buffer[1])} ${fi(this.buffer[0])}`}},at=class r extends an{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let i=t.length,n=new r(e);for(let s=0;s<i;){let o=di<i-s?di:i-s,a=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new r(new Uint32Array([tc[o],0]));n.times(c),n.plus(a),s+=o}return n}static convertArray(t){let e=new Uint32Array(t.length*2);for(let i=-1,n=t.length;++i<n;)r.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},tr=class r extends an{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,i=t.buffer[1]<<0;return e<i||e===i&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let i=t.startsWith("-"),n=t.length,s=new r(e);for(let o=i?1:0;o<n;){let a=di<n-o?di:n-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new r(new Uint32Array([tc[a],0]));s.times(l),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let i=-1,n=t.length;++i<n;)r.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},cn=class r{constructor(t){this.buffer=t}high(){return new tr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new tr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new at(new Uint32Array([this.buffer[3],0])),i=new at(new Uint32Array([this.buffer[2],0])),n=new at(new Uint32Array([this.buffer[1],0])),s=new at(new Uint32Array([this.buffer[0],0])),o=new at(new Uint32Array([t.buffer[3],0])),a=new at(new Uint32Array([t.buffer[2],0])),c=new at(new Uint32Array([t.buffer[1],0])),l=new at(new Uint32Array([t.buffer[0],0])),u=at.multiply(s,l);this.buffer[0]=u.low();let d=new at(new Uint32Array([u.high(),0]));return u=at.multiply(n,l),d.plus(u),u=at.multiply(s,c),d.plus(u),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(u)?1:0,this.buffer[2]=d.high(),new at(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(at.multiply(i,l)).plus(at.multiply(n,c)).plus(at.multiply(s,a)),this.buffer[3]+=at.multiply(e,l).plus(at.multiply(i,c)).plus(at.multiply(n,a)).plus(at.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${fi(this.buffer[3])} ${fi(this.buffer[2])} ${fi(this.buffer[1])} ${fi(this.buffer[0])}`}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let i=t.startsWith("-"),n=t.length,s=new r(e);for(let o=i?1:0;o<n;){let a=di<n-o?di:n-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new r(new Uint32Array([tc[a],0,0,0]));s.times(l),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let i=-1,n=t.length;++i<n;)r.from(t[i],new Uint32Array(e.buffer,e.byteOffset+4*4*i,4));return e}};var ln=class extends I{constructor(t,e,i,n,s=H.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=i,this.dictionaries=n,this.metadataVersion=s}visit(t){return super.visit(t instanceof k?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return E({type:t,length:e})}visitBool(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<H.V5&&this.readNullBitmap(t,i),t.mode===Z.Sparse?this.visitSparseUnion(t,{length:e,nullCount:i}):this.visitDenseUnion(t,{length:e,nullCount:i})}visitDenseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,i=this.nextBufferRange()){return e>0&&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)}},no=class extends ln{constructor(t,e,i,n,s){super(new Uint8Array(0),e,i,n,s),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Mr(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return R(Uint8Array,R(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return R(Uint8Array,R(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:i}=this;return g.isTimestamp(t)?R(Uint8Array,tr.convertArray(i[e])):(g.isInt(t)||g.isTime(t))&&t.bitWidth===64||g.isDuration(t)?R(Uint8Array,tr.convertArray(i[e])):g.isDate(t)&&t.unit===ct.MILLISECOND?R(Uint8Array,tr.convertArray(i[e])):g.isDecimal(t)?R(Uint8Array,cn.convertArray(i[e])):g.isBinary(t)||g.isLargeBinary(t)||g.isFixedSizeBinary(t)?Sh(i[e]):g.isBool(t)?Mr(i[e]):g.isUtf8(t)||g.isLargeUtf8(t)?be(i[e].join("")):R(Uint8Array,R(t.ArrayType,i[e].map(n=>+n)))}};function Sh(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)e[i>>1]=Number.parseInt(t.slice(i,i+2),16);return e}var hi=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,D(e))}_flushPending(t,e){let i=this._offsets,n=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)i.set(o,0);else{let c=a.length;n.set(a,s),i.set(o,c),s+=c}}};var pi=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,D(e))}_flushPending(t,e){let i=this._offsets,n=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)i.set(o,BigInt(0));else{let c=a.length;n.set(a,s),i.set(o,BigInt(c)),s+=c}}};var so=class extends st{constructor(t){super(t),this._values=new li}setValue(t,e){this._values.set(t,+e)}};var Vr=class extends dt{};Vr.prototype._setValue=Ua;var un=class extends Vr{};un.prototype._setValue=Ns;var fn=class extends Vr{};fn.prototype._setValue=Es;var dn=class extends dt{};dn.prototype._setValue=ka;var oo=class extends st{constructor({type:t,nullValues:e,dictionaryHashFunction:i}){super({type:new jt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Pr({type:this.type.indices,nullValues:e}),this.dictionary=Pr({type:this.type.dictionary,nullValues:null}),typeof i=="function"&&(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){let i=this.indices;return e=i.setValid(t,e),this.length=i.length,e}setValue(t,e){let i=this._keysToIndices,n=this.valueToKey(e),s=i[n];return s===void 0&&(i[n]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let 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 typeof t=="string"?t:`${t}`}};var hn=class extends dt{};hn.prototype._setValue=La;var ao=class extends st{setValue(t,e){let[i]=this.children,n=t*this.stride;for(let s=-1,o=e.length;++s<o;)i.set(n+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(t);return this.type=new fe(this.type.listSize,new k(e,t.type,!0)),i}};var jr=class extends dt{setValue(t,e){this._values.set(t,e)}},co=class extends jr{setValue(t,e){super.setValue(t,Qi(e))}},lo=class extends jr{},uo=class extends jr{};var zr=class extends dt{};zr.prototype._setValue=Ca;var pn=class extends zr{};pn.prototype._setValue=js;var mn=class extends zr{};mn.prototype._setValue=zs;var er=class extends dt{};er.prototype._setValue=Va;var yn=class extends er{};yn.prototype._setValue=Ws;var gn=class extends er{};gn.prototype._setValue=$s;var bn=class extends er{};bn.prototype._setValue=Hs;var _n=class extends er{};_n.prototype._setValue=Js;var Zt=class extends dt{setValue(t,e){this._values.set(t,e)}},fo=class extends Zt{},ho=class extends Zt{},po=class extends Zt{},mo=class extends Zt{},yo=class extends Zt{},go=class extends Zt{},bo=class extends Zt{},_o=class extends Zt{};var wo=class extends At{constructor(t){super(t),this._offsets=new ui(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 le(new k(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[i]=this.children;for(let[n,s]of t)if(typeof s=="undefined")e.set(n,0);else{let o=s,a=o.length,c=e.set(n,a).buffer[n];for(let l=-1;++l<a;)i.set(c+l,o[l])}}};var vo=class extends At{set(t,e){return super.set(t,e)}setValue(t,e){let i=e instanceof Map?e:new Map(Object.entries(e)),n=this._pending||(this._pending=new Map),s=n.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=i.size,n.set(t,i)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new de(new k(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[i]=this.children;for(let[n,s]of t)if(s===void 0)e.set(n,0);else{let{[n]:o,[n+1]:a}=e.set(n,s.size).buffer;for(let c of s.entries())if(i.set(o,c),++o>=a)break}}};var Io=class extends st{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var So=class extends st{setValue(t,e){let{children:i,type:n}=this;switch(Array.isArray(e)||e.constructor){case!0:return n.children.forEach((s,o)=>i[o].set(t,e[o]));case Map:return n.children.forEach((s,o)=>i[o].set(t,e.get(s.name)));default:return n.children.forEach((s,o)=>i[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(i=>i.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let i=this.children.push(t);return this.type=new rt([...this.type.children,new k(e,t.type,!0)]),i}};var rr=class extends dt{};rr.prototype._setValue=Ma;var wn=class extends rr{};wn.prototype._setValue=Ls;var vn=class extends rr{};vn.prototype._setValue=Us;var In=class extends rr{};In.prototype._setValue=Ms;var Sn=class extends rr{};Sn.prototype._setValue=Rs;var ir=class extends dt{};ir.prototype._setValue=Ra;var xn=class extends ir{};xn.prototype._setValue=ks;var Tn=class extends ir{};Tn.prototype._setValue=Cs;var Bn=class extends ir{};Bn.prototype._setValue=Vs;var On=class extends ir{};On.prototype._setValue=Ps;var mi=class extends st{constructor(t){super(t),this._typeIds=new Xe(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,i){return i===void 0&&(i=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,i),this}setValue(t,e,i){this._typeIds.set(t,i);let n=this.type.typeIdToChildIndex[i],s=this.children[n];s==null||s.set(t,e)}addChild(t,e=`${this.children.length}`){let i=this.children.push(t),{type:{children:n,mode:s,typeIds:o}}=this,a=[...n,new k(e,t.type)];return this.type=new ue(s,[...o,i],a),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.")}},xo=class extends mi{},To=class extends mi{constructor(t){super(t),this._offsets=new Xe(Int32Array)}setValue(t,e,i){let n=this._typeIds.set(t,i).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[n]),o=this._offsets.set(t,s.length).buffer[t];s==null||s.set(o,e)}};var Dn=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,be(e))}_flushPending(t,e){}};Dn.prototype._flushPending=hi.prototype._flushPending;var Fn=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,be(e))}_flushPending(t,e){}};Fn.prototype._flushPending=pi.prototype._flushPending;var rc=class extends I{visitNull(){return Io}visitBool(){return so}visitInt(){return Zt}visitInt8(){return fo}visitInt16(){return ho}visitInt32(){return po}visitInt64(){return mo}visitUint8(){return yo}visitUint16(){return go}visitUint32(){return bo}visitUint64(){return _o}visitFloat(){return jr}visitFloat16(){return co}visitFloat32(){return lo}visitFloat64(){return uo}visitUtf8(){return Dn}visitLargeUtf8(){return Fn}visitBinary(){return hi}visitLargeBinary(){return pi}visitFixedSizeBinary(){return hn}visitDate(){return Vr}visitDateDay(){return un}visitDateMillisecond(){return fn}visitTimestamp(){return rr}visitTimestampSecond(){return wn}visitTimestampMillisecond(){return vn}visitTimestampMicrosecond(){return In}visitTimestampNanosecond(){return Sn}visitTime(){return ir}visitTimeSecond(){return xn}visitTimeMillisecond(){return Tn}visitTimeMicrosecond(){return Bn}visitTimeNanosecond(){return On}visitDecimal(){return dn}visitList(){return wo}visitStruct(){return So}visitUnion(){return mi}visitDenseUnion(){return To}visitSparseUnion(){return xo}visitDictionary(){return oo}visitInterval(){return zr}visitIntervalDayTime(){return pn}visitIntervalYearMonth(){return mn}visitDuration(){return er}visitDurationSecond(){return yn}visitDurationMillisecond(){return gn}visitDurationMicrosecond(){return bn}visitDurationNanosecond(){return _n}visitFixedSizeList(){return ao}visitMap(){return vo}},ju=new rc;var B=class extends I{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((i,n)=>this.compareFields(i,e[n]))}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 Bt(r,t){return t instanceof r.constructor}function Wr(r,t){return r===t||Bt(r,t)}function nr(r,t){return r===t||Bt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Bo(r,t){return r===t||Bt(r,t)&&r.precision===t.precision}function xh(r,t){return r===t||Bt(r,t)&&r.byteWidth===t.byteWidth}function ic(r,t){return r===t||Bt(r,t)&&r.unit===t.unit}function An(r,t){return r===t||Bt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Nn(r,t){return r===t||Bt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function Th(r,t){return r===t||Bt(r,t)&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}function Bh(r,t){return r===t||Bt(r,t)&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}function nc(r,t){return r===t||Bt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,i)=>e===t.typeIds[i])&&Oe.compareManyFields(r.children,t.children)}function Oh(r,t){return r===t||Bt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Oe.visit(r.indices,t.indices)&&Oe.visit(r.dictionary,t.dictionary)}function sc(r,t){return r===t||Bt(r,t)&&r.unit===t.unit}function En(r,t){return r===t||Bt(r,t)&&r.unit===t.unit}function Dh(r,t){return r===t||Bt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}function Fh(r,t){return r===t||Bt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}B.prototype.visitNull=Wr;B.prototype.visitBool=Wr;B.prototype.visitInt=nr;B.prototype.visitInt8=nr;B.prototype.visitInt16=nr;B.prototype.visitInt32=nr;B.prototype.visitInt64=nr;B.prototype.visitUint8=nr;B.prototype.visitUint16=nr;B.prototype.visitUint32=nr;B.prototype.visitUint64=nr;B.prototype.visitFloat=Bo;B.prototype.visitFloat16=Bo;B.prototype.visitFloat32=Bo;B.prototype.visitFloat64=Bo;B.prototype.visitUtf8=Wr;B.prototype.visitLargeUtf8=Wr;B.prototype.visitBinary=Wr;B.prototype.visitLargeBinary=Wr;B.prototype.visitFixedSizeBinary=xh;B.prototype.visitDate=ic;B.prototype.visitDateDay=ic;B.prototype.visitDateMillisecond=ic;B.prototype.visitTimestamp=An;B.prototype.visitTimestampSecond=An;B.prototype.visitTimestampMillisecond=An;B.prototype.visitTimestampMicrosecond=An;B.prototype.visitTimestampNanosecond=An;B.prototype.visitTime=Nn;B.prototype.visitTimeSecond=Nn;B.prototype.visitTimeMillisecond=Nn;B.prototype.visitTimeMicrosecond=Nn;B.prototype.visitTimeNanosecond=Nn;B.prototype.visitDecimal=Wr;B.prototype.visitList=Th;B.prototype.visitStruct=Bh;B.prototype.visitUnion=nc;B.prototype.visitDenseUnion=nc;B.prototype.visitSparseUnion=nc;B.prototype.visitDictionary=Oh;B.prototype.visitInterval=sc;B.prototype.visitIntervalDayTime=sc;B.prototype.visitIntervalYearMonth=sc;B.prototype.visitDuration=En;B.prototype.visitDurationSecond=En;B.prototype.visitDurationMillisecond=En;B.prototype.visitDurationMicrosecond=En;B.prototype.visitDurationNanosecond=En;B.prototype.visitFixedSizeList=Dh;B.prototype.visitMap=Fh;var Oe=new B;function $r(r,t){return Oe.compareSchemas(r,t)}function zu(r,t){return Oe.compareFields(r,t)}function Wu(r,t){return Oe.visit(r,t)}function Pr(r){let t=r.type,e=new(ju.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let i=r.children||[],n={nullValues:r.nullValues},s=Array.isArray(i)?(o,a)=>i[a]||n:({name:o})=>i[o]||n;for(let[o,a]of t.children.entries()){let{type:c}=a,l=s(a,o);e.children.push(Pr(Object.assign(Object.assign({},l),{type:c})))}}return e}function Oo(r,t){return Ah(r,t.map(e=>e.data.concat()))}function Ah(r,t){let e=[...r.fields],i=[],n={numBatches:t.reduce((d,p)=>Math.max(d,p.length),0)},s=0,o=0,a=-1,c=t.length,l,u=[];for(;n.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=Nh(e,o,u,t,n),o>0&&(i[s++]=E({type:new rt(e),length:o,nullCount:0,children:u.slice()})))}return[r=r.assign(e),i.map(d=>new lt(r,d))]}function Nh(r,t,e,i,n){var s;let o=(t+63&-64)>>3;for(let a=-1,c=i.length;++a<c;){let l=e[a],u=l==null?void 0:l.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),n.numBatches=Math.max(n.numBatches,i[a].unshift(l.slice(t,u-t))));else{let d=r[a];r[a]=d.clone({nullable:!0}),e[a]=(s=l==null?void 0:l._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:E({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var $u,me=class r{constructor(...t){var e,i;if(t.length===0)return this.batches=[],this.schema=new q([]),this._offsets=[0],this;let n,s;t[0]instanceof q&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof lt)return[c];if(c instanceof r)return c.batches;if(c instanceof W){if(c.type instanceof rt)return[new lt(new q(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(v=>new P([c[v]])),d=n!=null?n:new q(l.map((v,_)=>new k(String(v),u[_].type,u[_].nullable))),[,p]=Oo(d,u);return p.length===0?[new lt(c)]:p}}}return[]},a=t.flatMap(c=>o(c));if(n=(i=n!=null?n:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&i!==void 0?i:new q([]),!(n instanceof q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof lt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!$r(n,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=a,this._offsets=s!=null?s:Ys(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Xs(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Er(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?ci.visit(new P(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
13
|
+
return true;`)}function Sh(r){return typeof r!="bigint"?ae(r):`${ae(r)}n`}function Ya(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function Wu(r,t=0){return r.length>=t?r.subarray(0,t):Vi(new r.constructor(t),r,0)}var pe=class{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;let e=this.stride,i=this.length*e,n=this.buffer.length;i>=n&&this._resize(n===0?Ya(i*1,this.BYTES_PER_ELEMENT):Ya(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ya(t*this.stride,this.BYTES_PER_ELEMENT);let e=Wu(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Wu(this.buffer,t)}},Xe=class extends pe{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}},ui=class extends Xe{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:i}=this.reserve(t-this.length+1),n=t>>3,s=t%8,o=i[n]>>s&1;return e?o===0&&(i[n]|=1<<s,++this.numValid):o===1&&(i[n]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},fi=class extends Xe{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let i=this.length-1,n=this.reserve(t-i+1).buffer;return i<t++&&i>=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)}};var st=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=zt(t),this._nulls=new ui,e&&e.length>0&&(this._isValid=zu(e))}toVector(){return new P([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:i,_nulls:n,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),o.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,i)=>e+i.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,{type:s,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:d}=this;(e=c==null?void 0:c.flush(o))?n=l==null?void 0:l.flush(o):(n=l==null?void 0:l.flush(o))?t=u==null?void 0:u.flush(l.last()):t=u==null?void 0:u.flush(o),a>0&&(i=d==null?void 0:d.flush(o));let p=this.children.map(I=>I.flush());return this.clear(),E({type:s,length:o,nullCount:a,children:p,child:p[0],data:t,typeIds:e,nullBitmap:i,valueOffsets:n})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,i,n;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(n=this._typeIds)===null||n===void 0||n.clear();for(let s of this.children)s.clear();return this}};st.prototype.length=1;st.prototype.stride=1;st.prototype.children=null;st.prototype.finished=!1;st.prototype.nullValues=null;st.prototype._isValid=()=>!0;var ht=class extends st{constructor(t){super(t),this._values=new Xe(this.ArrayType,0,this.stride)}setValue(t,e){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,e)}},At=class extends st{constructor(t){super(t),this._pendingLength=0,this._offsets=new fi(t.type)}setValue(t,e){let i=this._pending||(this._pending=new Map),n=i.get(t);n&&(this._pendingLength-=n.length),this._pendingLength+=e instanceof xe?e[wr].length:e.length,i.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var kr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,i,n){return t.prep(8,24),t.writeInt64(BigInt(n!=null?n:0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Wt=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):H.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ft).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let i=this.bb.__offset(this.bb_pos,8);return i?(e||new kr).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let i=this.bb.__offset(this.bb_pos,10);return i?(e||new kr).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new gt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,H.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let 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)}};var q=class r{constructor(t=[],e,i,n=H.V5){this.fields=t||[],this.metadata=e||new Map,i||(i=Za(this.fields)),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){let e=new Set(t),i=this.fields.filter(n=>e.has(n.name));return new r(i,this.metadata)}selectAt(t){let e=t.map(i=>this.fields[i]).filter(Boolean);return new r(e,this.metadata)}assign(...t){let e=t[0]instanceof r?t[0]:Array.isArray(t[0])?new r(t[0]):new r(t),i=[...this.fields],n=io(io(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let c=i.findIndex(l=>l.name===a.name);return~c?(i[c]=a.clone({metadata:io(io(new Map,i[c].metadata),a.metadata)}))&&!1:!0}),o=Za(s,new Map);return new r([...i,...s],n,new Map([...this.dictionaries,...o]))}};q.prototype.fields=null;q.prototype.metadata=null;q.prototype.dictionaries=null;var k=class r{static new(...t){let[e,i,n,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],i===void 0&&(i=t[0].type),n===void 0&&(n=t[0].nullable),s===void 0&&(s=t[0].metadata)),new r(`${e}`,i,n,s)}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,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,i=this.type,n=this.nullable,s=this.metadata]=t:{name:e=this.name,type:i=this.type,nullable:n=this.nullable,metadata:s=this.metadata}=t[0],r.new(e,i,n,s)}};k.prototype.type=null;k.prototype.name=null;k.prototype.nullable=null;k.prototype.metadata=null;function io(r,t){return new Map([...r||new Map,...t||new Map])}function Za(r,t=new Map){for(let e=-1,i=r.length;++e<i;){let s=r[e].type;if(g.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Za(s.children,t)}return t}var xh=Nr,Th=Vt,Ye=class{static decode(t){t=new Th(D(t));let e=Wt.getRootAsFooter(t),i=q.decode(e.schema(),new Map,e.version());return new Qa(i,e)}static encode(t){let e=new xh,i=q.encode(e,t.schema);Wt.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ze.encode(e,o);let n=e.endVector();Wt.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ze.encode(e,o);let s=e.endVector();return Wt.startFooter(e),Wt.addSchema(e,i),Wt.addVersion(e,H.V5),Wt.addRecordBatches(e,n),Wt.addDictionaries(e,s),Wt.finishFooterBuffer(e,Wt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=H.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<i;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,i=this.numDictionaries;++e<i;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Qa=class extends Ye{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ze.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ze.decode(e)}return null}},Ze=class r{static decode(t){return new r(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:i}=e,n=BigInt(e.offset),s=BigInt(e.bodyLength);return kr.createBlock(t,n,i,s)}constructor(t,e,i){this.metaDataLength=t,this.offset=j(i),this.bodyLength=j(e)}};var it=Object.freeze({done:!0,value:void 0}),on=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Cr=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},no=class extends Cr{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(it);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return _t.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return _t.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return y(this,void 0,void 0,function*(){return yield this.abort(t),it})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),it})}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,i)=>{this.resolvers.push({resolve:e,reject:i})}):Promise.resolve(it)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Te=class extends no{write(t){if((t=D(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ki(this.toUint8Array(!0)):this.toUint8Array(!1).then(ki)}toUint8Array(t=!1){return t?Ct(this._values)[0]:y(this,void 0,void 0,function*(){var e,i,n,s;let o=[],a=0;try{for(var c=!0,l=te(this),u;u=yield l.next(),e=u.done,!e;c=!0){s=u.value,c=!1;let d=s;o.push(d),a+=d.byteLength}}catch(d){i={error:d}}finally{try{!c&&!e&&(n=l.return)&&(yield n.call(l))}finally{if(i)throw i.error}}return Ct(o,a)[0]})}},Be=class{constructor(t){t&&(this.source=new tc(_t.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)}},Yt=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof Te?this.source=new Qe(_t.fromAsyncIterable(t)):hs(t)?this.source=new Qe(_t.fromNodeStream(t)):Ci(t)?this.source=new Qe(_t.fromDOMStream(t)):fs(t)?this.source=new Qe(_t.fromDOMStream(t.body)):re(t)?this.source=new Qe(_t.fromIterable(t)):ee(t)?this.source=new Qe(_t.fromAsyncIterable(t)):qt(t)&&(this.source=new Qe(_t.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)}},tc=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||it)}return(t){return Object.create(this.source.return&&this.source.return(t)||it)}},Qe=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return y(this,arguments,void 0,function*(e,i="read"){return yield this.source.next({cmd:i,size:e})})}throw(t){return y(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||it;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return y(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||it;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var an=class extends Be{constructor(t,e){super(),this.position=0,this.buffer=D(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:i,position:n}=this;return e&&n<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,n+Math.min(i-n,t)),e.subarray(n,this.position)):null}readAt(t,e){let i=this.buffer,n=Math.min(this.size,t+e);return i?i.subarray(t,n):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},vr=class extends Yt{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return y(this,void 0,void 0,function*(){let{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)})}seek(t){return y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:i,position:n}=this;if(e&&n<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=n,o=0,a=0,c=Math.min(i,s+Math.min(i-s,t)),l=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,s));return l}return null})}readAt(t,e){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:n}=this;if(i&&t+e<n){let s=Math.min(n,t+e),o=new Uint8Array(s-t);return(yield i.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var rc={};or(rc,{BaseInt64:()=>cn,Int128:()=>ln,Int64:()=>tr,Uint64:()=>at});function di(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var hi=8,ec=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],cn=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),n=e[3]*i[3];this.buffer[0]=n&65535;let s=n>>>16;return n=e[2]*i[3],s+=n,n=e[3]*i[2]>>>0,s+=n,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<n?65536:0,this.buffer[1]+=s>>>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){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${di(this.buffer[1])} ${di(this.buffer[0])}`}},at=class r extends cn{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let i=t.length,n=new r(e);for(let s=0;s<i;){let o=hi<i-s?hi:i-s,a=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new r(new Uint32Array([ec[o],0]));n.times(c),n.plus(a),s+=o}return n}static convertArray(t){let e=new Uint32Array(t.length*2);for(let i=-1,n=t.length;++i<n;)r.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},tr=class r extends cn{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,i=t.buffer[1]<<0;return e<i||e===i&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let i=t.startsWith("-"),n=t.length,s=new r(e);for(let o=i?1:0;o<n;){let a=hi<n-o?hi:n-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new r(new Uint32Array([ec[a],0]));s.times(l),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let i=-1,n=t.length;++i<n;)r.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},ln=class r{constructor(t){this.buffer=t}high(){return new tr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new tr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new at(new Uint32Array([this.buffer[3],0])),i=new at(new Uint32Array([this.buffer[2],0])),n=new at(new Uint32Array([this.buffer[1],0])),s=new at(new Uint32Array([this.buffer[0],0])),o=new at(new Uint32Array([t.buffer[3],0])),a=new at(new Uint32Array([t.buffer[2],0])),c=new at(new Uint32Array([t.buffer[1],0])),l=new at(new Uint32Array([t.buffer[0],0])),u=at.multiply(s,l);this.buffer[0]=u.low();let d=new at(new Uint32Array([u.high(),0]));return u=at.multiply(n,l),d.plus(u),u=at.multiply(s,c),d.plus(u),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(u)?1:0,this.buffer[2]=d.high(),new at(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(at.multiply(i,l)).plus(at.multiply(n,c)).plus(at.multiply(s,a)),this.buffer[3]+=at.multiply(e,l).plus(at.multiply(i,c)).plus(at.multiply(n,a)).plus(at.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${di(this.buffer[3])} ${di(this.buffer[2])} ${di(this.buffer[1])} ${di(this.buffer[0])}`}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let i=t.startsWith("-"),n=t.length,s=new r(e);for(let o=i?1:0;o<n;){let a=hi<n-o?hi:n-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new r(new Uint32Array([ec[a],0,0,0]));s.times(l),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let i=-1,n=t.length;++i<n;)r.from(t[i],new Uint32Array(e.buffer,e.byteOffset+4*4*i,4));return e}};var un=class extends v{constructor(t,e,i,n,s=H.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=i,this.dictionaries=n,this.metadataVersion=s}visit(t){return super.visit(t instanceof k?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return E({type:t,length:e})}visitBool(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<H.V5&&this.readNullBitmap(t,i),t.mode===Z.Sparse?this.visitSparseUnion(t,{length:e,nullCount:i}):this.visitDenseUnion(t,{length:e,nullCount:i})}visitDenseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:i}=this.nextFieldNode()){return E({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,i=this.nextBufferRange()){return e>0&&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)}},so=class extends un{constructor(t,e,i,n,s){super(new Uint8Array(0),e,i,n,s),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Mr(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return R(Uint8Array,R(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return R(Uint8Array,R(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:i}=this;return g.isTimestamp(t)?R(Uint8Array,tr.convertArray(i[e])):(g.isInt(t)||g.isTime(t))&&t.bitWidth===64||g.isDuration(t)?R(Uint8Array,tr.convertArray(i[e])):g.isDate(t)&&t.unit===ct.MILLISECOND?R(Uint8Array,tr.convertArray(i[e])):g.isDecimal(t)?R(Uint8Array,ln.convertArray(i[e])):g.isBinary(t)||g.isLargeBinary(t)||g.isFixedSizeBinary(t)?Bh(i[e]):g.isBool(t)?Mr(i[e]):g.isUtf8(t)||g.isLargeUtf8(t)?be(i[e].join("")):R(Uint8Array,R(t.ArrayType,i[e].map(n=>+n)))}};function Bh(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)e[i>>1]=Number.parseInt(t.slice(i,i+2),16);return e}var pi=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,D(e))}_flushPending(t,e){let i=this._offsets,n=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)i.set(o,0);else{let c=a.length;n.set(a,s),i.set(o,c),s+=c}}};var mi=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,D(e))}_flushPending(t,e){let i=this._offsets,n=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)i.set(o,BigInt(0));else{let c=a.length;n.set(a,s),i.set(o,BigInt(c)),s+=c}}};var oo=class extends st{constructor(t){super(t),this._values=new ui}setValue(t,e){this._values.set(t,+e)}};var Vr=class extends ht{};Vr.prototype._setValue=Ma;var fn=class extends Vr{};fn.prototype._setValue=Es;var dn=class extends Vr{};dn.prototype._setValue=Ls;var hn=class extends ht{};hn.prototype._setValue=Ca;var ao=class extends st{constructor({type:t,nullValues:e,dictionaryHashFunction:i}){super({type:new jt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Pr({type:this.type.indices,nullValues:e}),this.dictionary=Pr({type:this.type.dictionary,nullValues:null}),typeof i=="function"&&(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){let i=this.indices;return e=i.setValid(t,e),this.length=i.length,e}setValue(t,e){let i=this._keysToIndices,n=this.valueToKey(e),s=i[n];return s===void 0&&(i[n]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let 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 typeof t=="string"?t:`${t}`}};var pn=class extends ht{};pn.prototype._setValue=Ua;var co=class extends st{setValue(t,e){let[i]=this.children,n=t*this.stride;for(let s=-1,o=e.length;++s<o;)i.set(n+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(t);return this.type=new fe(this.type.listSize,new k(e,t.type,!0)),i}};var jr=class extends ht{setValue(t,e){this._values.set(t,e)}},lo=class extends jr{setValue(t,e){super.setValue(t,tn(e))}},uo=class extends jr{},fo=class extends jr{};var zr=class extends ht{};zr.prototype._setValue=Va;var mn=class extends zr{};mn.prototype._setValue=zs;var yn=class extends zr{};yn.prototype._setValue=Ws;var er=class extends ht{};er.prototype._setValue=Pa;var gn=class extends er{};gn.prototype._setValue=$s;var bn=class extends er{};bn.prototype._setValue=Hs;var _n=class extends er{};_n.prototype._setValue=Js;var wn=class extends er{};wn.prototype._setValue=qs;var Zt=class extends ht{setValue(t,e){this._values.set(t,e)}},ho=class extends Zt{},po=class extends Zt{},mo=class extends Zt{},yo=class extends Zt{},go=class extends Zt{},bo=class extends Zt{},_o=class extends Zt{},wo=class extends Zt{};var Io=class extends At{constructor(t){super(t),this._offsets=new fi(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 le(new k(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[i]=this.children;for(let[n,s]of t)if(typeof s=="undefined")e.set(n,0);else{let o=s,a=o.length,c=e.set(n,a).buffer[n];for(let l=-1;++l<a;)i.set(c+l,o[l])}}};var vo=class extends At{set(t,e){return super.set(t,e)}setValue(t,e){let i=e instanceof Map?e:new Map(Object.entries(e)),n=this._pending||(this._pending=new Map),s=n.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=i.size,n.set(t,i)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new de(new k(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[i]=this.children;for(let[n,s]of t)if(s===void 0)e.set(n,0);else{let{[n]:o,[n+1]:a}=e.set(n,s.size).buffer;for(let c of s.entries())if(i.set(o,c),++o>=a)break}}};var So=class extends st{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var xo=class extends st{setValue(t,e){let{children:i,type:n}=this;switch(Array.isArray(e)||e.constructor){case!0:return n.children.forEach((s,o)=>i[o].set(t,e[o]));case Map:return n.children.forEach((s,o)=>i[o].set(t,e.get(s.name)));default:return n.children.forEach((s,o)=>i[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(i=>i.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let i=this.children.push(t);return this.type=new rt([...this.type.children,new k(e,t.type,!0)]),i}};var rr=class extends ht{};rr.prototype._setValue=Ra;var In=class extends rr{};In.prototype._setValue=Us;var vn=class extends rr{};vn.prototype._setValue=Ms;var Sn=class extends rr{};Sn.prototype._setValue=Rs;var xn=class extends rr{};xn.prototype._setValue=ks;var ir=class extends ht{};ir.prototype._setValue=ka;var Tn=class extends ir{};Tn.prototype._setValue=Cs;var Bn=class extends ir{};Bn.prototype._setValue=Vs;var On=class extends ir{};On.prototype._setValue=Ps;var Dn=class extends ir{};Dn.prototype._setValue=js;var yi=class extends st{constructor(t){super(t),this._typeIds=new Xe(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,i){return i===void 0&&(i=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,i),this}setValue(t,e,i){this._typeIds.set(t,i);let n=this.type.typeIdToChildIndex[i],s=this.children[n];s==null||s.set(t,e)}addChild(t,e=`${this.children.length}`){let i=this.children.push(t),{type:{children:n,mode:s,typeIds:o}}=this,a=[...n,new k(e,t.type)];return this.type=new ue(s,[...o,i],a),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.")}},To=class extends yi{},Bo=class extends yi{constructor(t){super(t),this._offsets=new Xe(Int32Array)}setValue(t,e,i){let n=this._typeIds.set(t,i).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[n]),o=this._offsets.set(t,s.length).buffer[t];s==null||s.set(o,e)}};var Fn=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,be(e))}_flushPending(t,e){}};Fn.prototype._flushPending=pi.prototype._flushPending;var An=class extends At{constructor(t){super(t),this._values=new pe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,be(e))}_flushPending(t,e){}};An.prototype._flushPending=mi.prototype._flushPending;var ic=class extends v{visitNull(){return So}visitBool(){return oo}visitInt(){return Zt}visitInt8(){return ho}visitInt16(){return po}visitInt32(){return mo}visitInt64(){return yo}visitUint8(){return go}visitUint16(){return bo}visitUint32(){return _o}visitUint64(){return wo}visitFloat(){return jr}visitFloat16(){return lo}visitFloat32(){return uo}visitFloat64(){return fo}visitUtf8(){return Fn}visitLargeUtf8(){return An}visitBinary(){return pi}visitLargeBinary(){return mi}visitFixedSizeBinary(){return pn}visitDate(){return Vr}visitDateDay(){return fn}visitDateMillisecond(){return dn}visitTimestamp(){return rr}visitTimestampSecond(){return In}visitTimestampMillisecond(){return vn}visitTimestampMicrosecond(){return Sn}visitTimestampNanosecond(){return xn}visitTime(){return ir}visitTimeSecond(){return Tn}visitTimeMillisecond(){return Bn}visitTimeMicrosecond(){return On}visitTimeNanosecond(){return Dn}visitDecimal(){return hn}visitList(){return Io}visitStruct(){return xo}visitUnion(){return yi}visitDenseUnion(){return Bo}visitSparseUnion(){return To}visitDictionary(){return ao}visitInterval(){return zr}visitIntervalDayTime(){return mn}visitIntervalYearMonth(){return yn}visitDuration(){return er}visitDurationSecond(){return gn}visitDurationMillisecond(){return bn}visitDurationMicrosecond(){return _n}visitDurationNanosecond(){return wn}visitFixedSizeList(){return co}visitMap(){return vo}},$u=new ic;var B=class extends v{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((i,n)=>this.compareFields(i,e[n]))}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 Bt(r,t){return t instanceof r.constructor}function Wr(r,t){return r===t||Bt(r,t)}function nr(r,t){return r===t||Bt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Oo(r,t){return r===t||Bt(r,t)&&r.precision===t.precision}function Oh(r,t){return r===t||Bt(r,t)&&r.byteWidth===t.byteWidth}function nc(r,t){return r===t||Bt(r,t)&&r.unit===t.unit}function Nn(r,t){return r===t||Bt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function En(r,t){return r===t||Bt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function Dh(r,t){return r===t||Bt(r,t)&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}function Fh(r,t){return r===t||Bt(r,t)&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}function sc(r,t){return r===t||Bt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,i)=>e===t.typeIds[i])&&Oe.compareManyFields(r.children,t.children)}function Ah(r,t){return r===t||Bt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Oe.visit(r.indices,t.indices)&&Oe.visit(r.dictionary,t.dictionary)}function oc(r,t){return r===t||Bt(r,t)&&r.unit===t.unit}function Ln(r,t){return r===t||Bt(r,t)&&r.unit===t.unit}function Nh(r,t){return r===t||Bt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}function Eh(r,t){return r===t||Bt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Oe.compareManyFields(r.children,t.children)}B.prototype.visitNull=Wr;B.prototype.visitBool=Wr;B.prototype.visitInt=nr;B.prototype.visitInt8=nr;B.prototype.visitInt16=nr;B.prototype.visitInt32=nr;B.prototype.visitInt64=nr;B.prototype.visitUint8=nr;B.prototype.visitUint16=nr;B.prototype.visitUint32=nr;B.prototype.visitUint64=nr;B.prototype.visitFloat=Oo;B.prototype.visitFloat16=Oo;B.prototype.visitFloat32=Oo;B.prototype.visitFloat64=Oo;B.prototype.visitUtf8=Wr;B.prototype.visitLargeUtf8=Wr;B.prototype.visitBinary=Wr;B.prototype.visitLargeBinary=Wr;B.prototype.visitFixedSizeBinary=Oh;B.prototype.visitDate=nc;B.prototype.visitDateDay=nc;B.prototype.visitDateMillisecond=nc;B.prototype.visitTimestamp=Nn;B.prototype.visitTimestampSecond=Nn;B.prototype.visitTimestampMillisecond=Nn;B.prototype.visitTimestampMicrosecond=Nn;B.prototype.visitTimestampNanosecond=Nn;B.prototype.visitTime=En;B.prototype.visitTimeSecond=En;B.prototype.visitTimeMillisecond=En;B.prototype.visitTimeMicrosecond=En;B.prototype.visitTimeNanosecond=En;B.prototype.visitDecimal=Wr;B.prototype.visitList=Dh;B.prototype.visitStruct=Fh;B.prototype.visitUnion=sc;B.prototype.visitDenseUnion=sc;B.prototype.visitSparseUnion=sc;B.prototype.visitDictionary=Ah;B.prototype.visitInterval=oc;B.prototype.visitIntervalDayTime=oc;B.prototype.visitIntervalYearMonth=oc;B.prototype.visitDuration=Ln;B.prototype.visitDurationSecond=Ln;B.prototype.visitDurationMillisecond=Ln;B.prototype.visitDurationMicrosecond=Ln;B.prototype.visitDurationNanosecond=Ln;B.prototype.visitFixedSizeList=Nh;B.prototype.visitMap=Eh;var Oe=new B;function $r(r,t){return Oe.compareSchemas(r,t)}function Hu(r,t){return Oe.compareFields(r,t)}function Ju(r,t){return Oe.visit(r,t)}function Pr(r){let t=r.type,e=new($u.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let i=r.children||[],n={nullValues:r.nullValues},s=Array.isArray(i)?(o,a)=>i[a]||n:({name:o})=>i[o]||n;for(let[o,a]of t.children.entries()){let{type:c}=a,l=s(a,o);e.children.push(Pr(Object.assign(Object.assign({},l),{type:c})))}}return e}function Do(r,t){return Lh(r,t.map(e=>e.data.concat()))}function Lh(r,t){let e=[...r.fields],i=[],n={numBatches:t.reduce((d,p)=>Math.max(d,p.length),0)},s=0,o=0,a=-1,c=t.length,l,u=[];for(;n.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=Uh(e,o,u,t,n),o>0&&(i[s++]=E({type:new rt(e),length:o,nullCount:0,children:u.slice()})))}return[r=r.assign(e),i.map(d=>new lt(r,d))]}function Uh(r,t,e,i,n){var s;let o=(t+63&-64)>>3;for(let a=-1,c=i.length;++a<c;){let l=e[a],u=l==null?void 0:l.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),n.numBatches=Math.max(n.numBatches,i[a].unshift(l.slice(t,u-t))));else{let d=r[a];r[a]=d.clone({nullable:!0}),e[a]=(s=l==null?void 0:l._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:E({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var qu,me=class r{constructor(...t){var e,i;if(t.length===0)return this.batches=[],this.schema=new q([]),this._offsets=[0],this;let n,s;t[0]instanceof q&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof lt)return[c];if(c instanceof r)return c.batches;if(c instanceof W){if(c.type instanceof rt)return[new lt(new q(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(I=>new P([c[I]])),d=n!=null?n:new q(l.map((I,_)=>new k(String(I),u[_].type,u[_].nullable))),[,p]=Do(d,u);return p.length===0?[new lt(c)]:p}}}return[]},a=t.flatMap(c=>o(c));if(n=(i=n!=null?n:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&i!==void 0?i:new q([]),!(n instanceof q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof lt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!$r(n,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=n,this.batches=a,this._offsets=s!=null?s:Zs(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Ys(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Er(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?li.visit(new P(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
14
14
|
${this.toArray().join(`,
|
|
15
15
|
`)}
|
|
16
|
-
]`}concat(...t){let e=this.schema,i=this.data.concat(t.flatMap(({data:n})=>n));return new r(e,i.map(n=>new lt(e,n)))}slice(t,e){let i=this.schema;[t,e]=tn({length:this.numRows},t,e);let n=Zs(this.data,this._offsets,t,e);return new r(i,n.map(s=>new lt(i,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(i=>i.children[t]);if(e.length===0){let{type:i}=this.schema.fields[t],n=E({type:i,length:0,nullCount:0});e.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new P(e)}return null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),e)}setChildAt(t,e){let i=this.schema,n=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new P([E({type:new Tt,length:this.numRows})]));let s=i.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[i,n]=Oo(i,a)}return new r(i,n)}select(t){let e=this.schema.fields.reduce((i,n,s)=>i.set(n.name,s),new Map);return this.selectAt(t.map(i=>e.get(i)).filter(i=>i>-1))}selectAt(t){let e=this.schema.selectAt(t),i=this.batches.map(n=>n.selectAt(t));return new r(e,i)}assign(t){let e=this.schema.fields,[i,n]=t.schema.fields.reduce((a,c,l)=>{let[u,d]=a,p=e.findIndex(v=>v.name===c.name);return~p?d[p]=l:u.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,n[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new r(...Oo(s,o))}};$u=Symbol.toStringTag;me[$u]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=ai(nn),r.get=ai(ft.getVisitFn(f.Struct)),r.set=Qs(wt.getVisitFn(f.Struct)),r.indexOf=to(Rr.getVisitFn(f.Struct)),"Table"))(me.prototype);var Ju,lt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=E({nullCount:0,type:new rt(this.schema.fields),children:this.schema.fields.map(e=>E({type:e.type,nullCount:0}))})]=t,!(this.data instanceof W))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Hu(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:i,children:n,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=k.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new q(i),a=E({type:new rt(i),length:s,children:n,nullCount:0});[this.schema,this.data]=Hu(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=qu(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 ft.visit(this.data,t)}at(t){return this.get(Er(t,this.numRows))}set(t,e){return wt.visit(this.data,t,e)}indexOf(t,e){return Rr.visit(this.data,t,e)}[Symbol.iterator](){return ci.visit(new P([this.data]))}toArray(){return[...this]}concat(...t){return new me(this.schema,[this,...t])}slice(t,e){let[i]=new P([this.data]).slice(t,e).data;return new r(this.schema,i)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new P([this.data.children[t]]):null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),e)}setChildAt(t,e){let i=this.schema,n=this.data;if(t>-1&&t<this.numCols){e||(e=new P([E({type:new Tt,length:this.numRows})]));let s=i.fields.slice(),o=n.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],i=new q(s,new Map(this.schema.metadata)),n=E({type:new rt(s),children:o})}return new r(i,n)}select(t){let e=this.schema.select(t),i=new rt(e.fields),n=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(n[o]=this.data.children[o])}return new r(e,E({type:i,length:this.numRows,children:n}))}selectAt(t){let e=this.schema.selectAt(t),i=t.map(s=>this.data.children[s]).filter(Boolean),n=E({type:new rt(e.fields),length:this.numRows,children:i});return new r(e,n)}};Ju=Symbol.toStringTag;lt[Ju]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(lt.prototype);function Hu(r,t,e=t.reduce((i,n)=>Math.max(i,n.length),0)){var i;let n=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(n[a]=c.clone({nullable:!0}),s[a]=(i=l==null?void 0:l._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:E({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(n),E({type:new rt(n),length:e,children:s})]}function qu(r,t,e=new Map){var i,n;if(((i=r==null?void 0:r.length)!==null&&i!==void 0?i:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((n=c==null?void 0:c.dictionary)===null||n===void 0?void 0:n.data)||[]])qu(a.children,l==null?void 0:l.children,e);if(g.isDictionary(a)){let{id:l}=a;if(!e.has(l))c!=null&&c.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var Hr=class extends lt{constructor(t){let e=t.fields.map(n=>E({type:n.type})),i=E({type:new rt(t.fields),nullCount:0,children:e});super(t,i)}};var ye=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):H.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):V.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,H.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,V.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,s,o){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,i),r.addHeader(t,n),r.addBodyLength(t,s),r.addCustomMetadata(t,o),r.endMessage(t)}};var oc=class extends I{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ki.startNull(e),Ki.endNull(e)}visitInt(t,e){return se.startInt(e),se.addBitWidth(e,t.bitWidth),se.addIsSigned(e,t.isSigned),se.endInt(e)}visitFloat(t,e){return mr.startFloatingPoint(e),mr.addPrecision(e,t.precision),mr.endFloatingPoint(e)}visitBinary(t,e){return Wi.startBinary(e),Wi.endBinary(e)}visitLargeBinary(t,e){return Hi.startLargeBinary(e),Hi.endLargeBinary(e)}visitBool(t,e){return $i.startBool(e),$i.endBool(e)}visitUtf8(t,e){return Xi.startUtf8(e),Xi.endUtf8(e)}visitLargeUtf8(t,e){return Ji.startLargeUtf8(e),Ji.endLargeUtf8(e)}visitDecimal(t,e){return Ie.startDecimal(e),Ie.addScale(e,t.scale),Ie.addPrecision(e,t.precision),Ie.addBitWidth(e,t.bitWidth),Ie.endDecimal(e)}visitDate(t,e){return fr.startDate(e),fr.addUnit(e,t.unit),fr.endDate(e)}visitTime(t,e){return Me.startTime(e),Me.addUnit(e,t.unit),Me.addBitWidth(e,t.bitWidth),Me.endTime(e)}visitTimestamp(t,e){let i=t.timezone&&e.createString(t.timezone)||void 0;return Re.startTimestamp(e),Re.addUnit(e,t.unit),i!==void 0&&Re.addTimezone(e,i),Re.endTimestamp(e)}visitInterval(t,e){return yr.startInterval(e),yr.addUnit(e,t.unit),yr.endInterval(e)}visitDuration(t,e){return dr.startDuration(e),dr.addUnit(e,t.unit),dr.endDuration(e)}visitList(t,e){return qi.startList(e),qi.endList(e)}visitStruct(t,e){return Gi.startStruct_(e),Gi.endStruct_(e)}visitUnion(t,e){oe.startTypeIdsVector(e,t.typeIds.length);let i=oe.createTypeIdsVector(e,t.typeIds);return oe.startUnion(e),oe.addMode(e,t.mode),oe.addTypeIds(e,i),oe.endUnion(e)}visitDictionary(t,e){let i=this.visit(t.indices,e);return ve.startDictionaryEncoding(e),ve.addId(e,BigInt(t.id)),ve.addIsOrdered(e,t.isOrdered),i!==void 0&&ve.addIndexType(e,i),ve.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return hr.startFixedSizeBinary(e),hr.addByteWidth(e,t.byteWidth),hr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return pr.startFixedSizeList(e),pr.addListSize(e,t.listSize),pr.endFixedSizeList(e)}visitMap(t,e){return gr.startMap(e),gr.addKeysSorted(e,t.keysSorted),gr.endMap(e)}},Do=new oc;function Yu(r,t=new Map){return new q(Lh(r,t),Fo(r.metadata),t)}function ac(r){return new vt(r.count,Qu(r.columns),tf(r.columns))}function Zu(r){return new Et(ac(r.data),r.id,r.isDelta)}function Lh(r,t){return(r.fields||[]).filter(Boolean).map(e=>k.fromJSON(e,t))}function Ku(r,t){return(r.children||[]).filter(Boolean).map(e=>k.fromJSON(e,t))}function Qu(r){return(r||[]).reduce((t,e)=>[...t,new Qt(e.count,Uh(e.VALIDITY)),...Qu(e.children)],[])}function tf(r,t=[]){for(let e=-1,i=(r||[]).length;++e<i;){let n=r[e];n.VALIDITY&&t.push(new Nt(t.length,n.VALIDITY.length)),n.TYPE_ID&&t.push(new Nt(t.length,n.TYPE_ID.length)),n.OFFSET&&t.push(new Nt(t.length,n.OFFSET.length)),n.DATA&&t.push(new Nt(t.length,n.DATA.length)),t=tf(n.children,t)}return t}function Uh(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function ef(r,t){let e,i,n,s,o,a;return!t||!(s=r.dictionary)?(o=Xu(r,Ku(r,t)),n=new k(r.name,o,r.nullable,Fo(r.metadata))):t.has(e=s.id)?(i=(i=s.indexType)?Gu(i):new Se,a=new jt(t.get(e),i,e,s.isOrdered),n=new k(r.name,a,r.nullable,Fo(r.metadata))):(i=(i=s.indexType)?Gu(i):new Se,t.set(e,o=Xu(r,Ku(r,t))),a=new jt(o,i,e,s.isOrdered),n=new k(r.name,a,r.nullable,Fo(r.metadata))),n||null}function Fo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function Gu(r){return new gt(r.isSigned,r.bitWidth)}function Xu(r,t){let e=r.type.name;switch(e){case"NONE":return new Tt;case"null":return new Tt;case"binary":return new ke;case"largebinary":return new Ce;case"utf8":return new Ve;case"largeutf8":return new Pe;case"bool":return new je;case"list":return new le((t||[])[0]);case"struct":return new rt(t||[]);case"struct_":return new rt(t||[])}switch(e){case"int":{let i=r.type;return new gt(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=r.type;return new Xt(G[i.precision])}case"decimal":{let i=r.type;return new ze(i.scale,i.precision,i.bitWidth)}case"date":{let i=r.type;return new We(ct[i.unit])}case"time":{let i=r.type;return new $e(b[i.unit],i.bitWidth)}case"timestamp":{let i=r.type;return new He(b[i.unit],i.timezone)}case"interval":{let i=r.type;return new Je(mt[i.unit])}case"duration":{let i=r.type;return new qe(b[i.unit])}case"union":{let i=r.type,[n,...s]=(i.mode+"").toLowerCase(),o=n.toUpperCase()+s.join("");return new ue(Z[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=r.type;return new Ke(i.byteWidth)}case"fixedsizelist":{let i=r.type;return new fe(i.listSize,(t||[])[0])}case"map":{let i=r.type;return new de((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Mh=Nr,Rh=Vt,Lt=class r{static fromJSON(t,e){let i=new r(0,H.V5,e);return i._createHeader=kh(t,e),i}static decode(t){t=new Rh(D(t));let e=ye.getRootAsMessage(t),i=e.bodyLength(),n=e.version(),s=e.headerType(),o=new r(i,n,s);return o._createHeader=Ch(e,s),o}static encode(t){let e=new Mh,i=-1;return t.isSchema()?i=q.encode(e,t.header()):t.isRecordBatch()?i=vt.encode(e,t.header()):t.isDictionaryBatch()&&(i=Et.encode(e,t.header())),ye.startMessage(e),ye.addVersion(e,H.V5),ye.addHeader(e,i),ye.addHeaderType(e,t.headerType),ye.addBodyLength(e,BigInt(t.bodyLength)),ye.finishMessageBuffer(e,ye.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof q)return new r(0,H.V5,V.Schema,t);if(t instanceof vt)return new r(e,H.V5,V.RecordBatch,t);if(t instanceof Et)return new r(e,H.V5,V.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===V.Schema}isRecordBatch(){return this.headerType===V.RecordBatch}isDictionaryBatch(){return this.headerType===V.DictionaryBatch}constructor(t,e,i,n){this._version=e,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=j(t)}},vt=class{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=j(t)}},Et=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=j(e)}},Nt=class{constructor(t,e){this.offset=j(t),this.length=j(e)}},Qt=class{constructor(t,e){this.length=j(t),this.nullCount=j(e)}};function kh(r,t){return()=>{switch(t){case V.Schema:return q.fromJSON(r);case V.RecordBatch:return vt.fromJSON(r);case V.DictionaryBatch:return Et.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${V[t]}, type: ${t} }`)}}function Ch(r,t){return()=>{switch(t){case V.Schema:return q.decode(r.header(new Ft),new Map,r.version());case V.RecordBatch:return vt.decode(r.header(new Pt),r.version());case V.DictionaryBatch:return Et.decode(r.header(new Ue),r.version())}throw new Error(`Unrecognized Message type: { name: ${V[t]}, type: ${t} }`)}}k.encode=Gh;k.decode=qh;k.fromJSON=ef;q.encode=Kh;q.decode=Vh;q.fromJSON=Yu;vt.encode=Xh;vt.decode=Ph;vt.fromJSON=ac;Et.encode=Yh;Et.decode=jh;Et.fromJSON=Zu;Qt.encode=Zh;Qt.decode=Wh;Nt.encode=Qh;Nt.decode=zh;function Vh(r,t=new Map,e=H.V5){let i=Jh(r,t);return new q(i,Ao(r),t,e)}function Ph(r,t=H.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new vt(r.length(),$h(r),Hh(r,t))}function jh(r,t=H.V5){return new Et(vt.decode(r.data(),t),r.id(),r.isDelta())}function zh(r){return new Nt(r.offset(),r.length())}function Wh(r){return new Qt(r.length(),r.nullCount())}function $h(r){let t=[];for(let e,i=-1,n=-1,s=r.nodesLength();++i<s;)(e=r.nodes(i))&&(t[++n]=Qt.decode(e));return t}function Hh(r,t){let e=[];for(let i,n=-1,s=-1,o=r.buffersLength();++n<o;)(i=r.buffers(n))&&(t<H.V4&&(i.bb_pos+=8*(n+1)),e[++s]=Nt.decode(i));return e}function Jh(r,t){let e=[];for(let i,n=-1,s=-1,o=r.fieldsLength();++n<o;)(i=r.fields(n))&&(e[++s]=k.decode(i,t));return e}function rf(r,t){let e=[];for(let i,n=-1,s=-1,o=r.childrenLength();++n<o;)(i=r.children(n))&&(e[++s]=k.decode(i,t));return e}function qh(r,t){let e,i,n,s,o,a;return!t||!(a=r.dictionary())?(n=sf(r,rf(r,t)),i=new k(r.name(),n,r.nullable(),Ao(r))):t.has(e=j(a.id()))?(s=(s=a.indexType())?nf(s):new Se,o=new jt(t.get(e),s,e,a.isOrdered()),i=new k(r.name(),o,r.nullable(),Ao(r))):(s=(s=a.indexType())?nf(s):new Se,t.set(e,n=sf(r,rf(r,t))),o=new jt(n,s,e,a.isOrdered()),i=new k(r.name(),o,r.nullable(),Ao(r))),i||null}function Ao(r){let t=new Map;if(r)for(let e,i,n=-1,s=Math.trunc(r.customMetadataLength());++n<s;)(e=r.customMetadata(n))&&(i=e.key())!=null&&t.set(i,e.value());return t}function nf(r){return new gt(r.isSigned(),r.bitWidth())}function sf(r,t){let e=r.typeType();switch(e){case Q.NONE:return new Tt;case Q.Null:return new Tt;case Q.Binary:return new ke;case Q.LargeBinary:return new Ce;case Q.Utf8:return new Ve;case Q.LargeUtf8:return new Pe;case Q.Bool:return new je;case Q.List:return new le((t||[])[0]);case Q.Struct_:return new rt(t||[])}switch(e){case Q.Int:{let i=r.type(new se);return new gt(i.isSigned(),i.bitWidth())}case Q.FloatingPoint:{let i=r.type(new mr);return new Xt(i.precision())}case Q.Decimal:{let i=r.type(new Ie);return new ze(i.scale(),i.precision(),i.bitWidth())}case Q.Date:{let i=r.type(new fr);return new We(i.unit())}case Q.Time:{let i=r.type(new Me);return new $e(i.unit(),i.bitWidth())}case Q.Timestamp:{let i=r.type(new Re);return new He(i.unit(),i.timezone())}case Q.Interval:{let i=r.type(new yr);return new Je(i.unit())}case Q.Duration:{let i=r.type(new dr);return new qe(i.unit())}case Q.Union:{let i=r.type(new oe);return new ue(i.mode(),i.typeIdsArray()||[],t||[])}case Q.FixedSizeBinary:{let i=r.type(new hr);return new Ke(i.byteWidth())}case Q.FixedSizeList:{let i=r.type(new pr);return new fe(i.listSize(),(t||[])[0])}case Q.Map:{let i=r.type(new gr);return new de((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${Q[e]}" (${e})`)}function Kh(r,t){let e=t.fields.map(s=>k.encode(r,s));Ft.startFieldsVector(r,e.length);let i=Ft.createFieldsVector(r,e),n=t.metadata&&t.metadata.size>0?Ft.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return yt.startKeyValue(r),yt.addKey(r,a),yt.addValue(r,c),yt.endKeyValue(r)})):-1;return Ft.startSchema(r),Ft.addFields(r,i),Ft.addEndianness(r,tp?ur.Little:ur.Big),n!==-1&&Ft.addCustomMetadata(r,n),Ft.endSchema(r)}function Gh(r,t){let e=-1,i=-1,n=-1,s=t.type,o=t.typeId;g.isDictionary(s)?(o=s.dictionary.typeId,n=Do.visit(s,r),i=Do.visit(s.dictionary,r)):i=Do.visit(s,r);let a=(s.children||[]).map(u=>k.encode(r,u)),c=It.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?It.createCustomMetadataVector(r,[...t.metadata].map(([u,d])=>{let p=r.createString(`${u}`),v=r.createString(`${d}`);return yt.startKeyValue(r),yt.addKey(r,p),yt.addValue(r,v),yt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),It.startField(r),It.addType(r,i),It.addTypeType(r,o),It.addChildren(r,c),It.addNullable(r,!!t.nullable),e!==-1&&It.addName(r,e),n!==-1&&It.addDictionary(r,n),l!==-1&&It.addCustomMetadata(r,l),It.endField(r)}function Xh(r,t){let e=t.nodes||[],i=t.buffers||[];Pt.startNodesVector(r,e.length);for(let o of e.slice().reverse())Qt.encode(r,o);let n=r.endVector();Pt.startBuffersVector(r,i.length);for(let o of i.slice().reverse())Nt.encode(r,o);let s=r.endVector();return Pt.startRecordBatch(r),Pt.addLength(r,BigInt(t.length)),Pt.addNodes(r,n),Pt.addBuffers(r,s),Pt.endRecordBatch(r)}function Yh(r,t){let e=vt.encode(r,t.data);return Ue.startDictionaryBatch(r),Ue.addId(r,BigInt(t.id)),Ue.addIsDelta(r,t.isDelta),Ue.addData(r,e),Ue.endDictionaryBatch(r)}function Zh(r,t){return Zr.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Qh(r,t){return Yr.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var tp=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var lc=r=>`Expected ${V[r]} Message in stream, but was null or length 0.`,uc=r=>`Header pointer of flatbuffer-encoded ${V[r]} Message is null or length 0.`,of=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,af=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,yi=class{constructor(t){this.source=t instanceof Be?t:new Be(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?it:t.value===-1&&(t=this.readMetadataLength()).done?it:(t=this.readMetadata(t.value)).done?it:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(lc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=D(this.source.read(t));if(e.byteLength<t)throw new Error(af(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=V.Schema,i=this.readMessage(e),n=i==null?void 0:i.header();if(t&&!n)throw new Error(uc(e));return n}readMetadataLength(){let t=this.source.read(No),e=t&&new Vt(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}}readMetadata(t){let e=this.source.read(t);if(!e)return it;if(e.byteLength<t)throw new Error(of(t,e.byteLength));return{done:!1,value:Lt.decode(e)}}},Ln=class{constructor(t,e){this.source=t instanceof Yt?t:ls(t)?new Ir(t,e):new Yt(t)}[Symbol.asyncIterator](){return this}next(){return y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?it:t.value===-1&&(t=yield this.readMetadataLength()).done?it:(t=yield this.readMetadata(t.value)).done?it:t})}throw(t){return y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return y(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(lc(t));return e.value})}readMessageBody(t){return y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=D(yield this.source.read(t));if(e.byteLength<t)throw new Error(af(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return y(this,arguments,void 0,function*(t=!1){let e=V.Schema,i=yield this.readMessage(e),n=i==null?void 0:i.header();if(t&&!n)throw new Error(uc(e));return n})}readMetadataLength(){return y(this,void 0,void 0,function*(){let t=yield this.source.read(No),e=t&&new Vt(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}})}readMetadata(t){return y(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return it;if(e.byteLength<t)throw new Error(of(t,e.byteLength));return{done:!1,value:Lt.decode(e)}})}},Un=class extends yi{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof sn?t:new sn(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Lt.fromJSON(t.schema,V.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Lt.fromJSON(e,V.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Lt.fromJSON(e,V.RecordBatch)}}return this._body=[],it}readMessageBody(t){return e(this._body);function e(i){return(i||[]).reduce((n,s)=>[...n,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(lc(t));return e.value}readSchema(){let t=V.Schema,e=this.readMessage(t),i=e==null?void 0:e.header();if(!e||!i)throw new Error(uc(t));return i}},No=4,cc="ARROW1",gi=new Uint8Array(cc.length);for(let r=0;r<cc.length;r+=1)gi[r]=cc.codePointAt(r);function Eo(r,t=0){for(let e=-1,i=gi.length;++e<i;)if(gi[e]!==r[t+e])return!1;return!0}var bi=gi.length,fc=bi+No,cf=bi*2+No;var Ut=class r extends Cr{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return ee(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return _t.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return _t.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof r?t:as(t)?rp(t):ls(t)?sp(t):ee(t)?y(this,void 0,void 0,function*(){return yield r.from(yield t)}):us(t)||ki(t)||ds(t)||qt(t)?np(new Yt(t)):ip(new Be(t))}static readAll(t){return t instanceof r?t.isSync()?lf(t):uf(t):as(t)||ArrayBuffer.isView(t)||re(t)||cs(t)?lf(t):uf(t)}},De=class extends Ut{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return kt(this,arguments,function*(){yield U(yield*Gr(te(this[Symbol.iterator]())))})}},Sr=class extends Ut{constructor(t){super(t),this._impl=t}readAll(){return y(this,void 0,void 0,function*(){var t,e,i,n;let s=new Array;try{for(var o=!0,a=te(this),c;c=yield a.next(),t=c.done,!t;o=!0){n=c.value,o=!1;let l=n;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},xr=class extends De{constructor(t){super(t),this._impl=t}},Mn=class extends Sr{constructor(t){super(t),this._impl=t}},Lo=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let i=this._loadVectors(t,e,this.schema.fields),n=E({type:new rt(this.schema.fields),length:t.length,children:i});return new lt(this.schema,n)}_loadDictionaryBatch(t,e){let{id:i,isDelta:n}=t,{dictionaries:s,schema:o}=this,a=s.get(i),c=o.dictionaries.get(i),l=this._loadVectors(t.data,e,[c]);return(a&&n?a.concat(new P(l)):new P(l)).memoize()}_loadVectors(t,e,i){return new ln(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},_i=class extends Lo{constructor(t,e){super(e),this._reader=as(t)?new Un(this._handle=t):new yi(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=ff(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):it}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):it}next(){if(this.closed)return it;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hr(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},wi=class extends Lo{constructor(t,e){super(e),this._reader=new Ln(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=ff(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):it})}return(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):it})}next(){return y(this,void 0,void 0,function*(){if(this.closed)return it;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hr(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Uo=class extends _i{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 on?t:new on(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(V.RecordBatch);if(n!=null&&n.isRecordBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(V.DictionaryBatch);if(n!=null&&n.isDictionaryBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-fc,i=t.readInt32(e),n=t.readAt(e-i,i);return Ye.decode(n)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},dc=class extends wi{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let i=typeof e[0]!="number"?e.shift():void 0,n=e[0]instanceof Map?e.shift():void 0;super(t instanceof Ir?t:new Ir(t,i),n)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return y(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(V.RecordBatch);if(n!=null&&n.isRecordBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return y(this,void 0,void 0,function*(){var e;let i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(V.DictionaryBatch);if(n!=null&&n.isDictionaryBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-fc,i=yield t.readInt32(e),n=yield t.readAt(e-i,i);return Ye.decode(n)})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},hc=class extends _i{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new no(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function ff(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*lf(r){let t=Ut.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function uf(r){return kt(this,arguments,function*(){let e=yield U(Ut.from(r));try{if(!(yield U(e.open({autoDestroy:!1}))).closed)do yield yield U(e);while(!(yield U(e.reset().open())).closed)}finally{yield U(e.cancel())}})}function rp(r){return new De(new hc(r))}function ip(r){let t=r.peek(bi+7&-8);return t&&t.byteLength>=4?Eo(t)?new xr(new Uo(r.read())):new De(new _i(r)):new De(new _i(function*(){}()))}function np(r){return y(this,void 0,void 0,function*(){let t=yield r.peek(bi+7&-8);return t&&t.byteLength>=4?Eo(t)?new xr(new Uo(yield r.read())):new Sr(new wi(r)):new Sr(new wi(function(){return kt(this,arguments,function*(){})}()))})}function sp(r){return y(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Ir(r,t);return t>=cf&&Eo(yield e.readAt(0,bi+7&-8))?new Mn(new dc(e)):new Sr(new wi(e))})}var ot=class r extends I{static assemble(...t){let e=n=>n.flatMap(s=>Array.isArray(s)?e(s):s instanceof lt?s.data.children:s.data),i=new r;return i.visitMany(e(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof P)return this.visitMany(t.data),this;let{type:e}=t;if(!g.isDictionary(e)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(g.isUnion(e))this.nodes.push(new Qt(i,0));else{let{nullCount:n}=t;g.isNull(e)||ge.call(this,n<=0?new Uint8Array(0):Ur(t.offset,i,t.nullBitmap)),this.nodes.push(new Qt(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 ge(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Nt(this._byteLength,t)),this._byteLength+=t,this}function op(r){var t;let{type:e,length:i,typeIds:n,valueOffsets:s}=r;if(ge.call(this,n),e.mode===Z.Sparse)return pc.call(this,r);if(e.mode===Z.Dense){if(r.offset<=0)return ge.call(this,s),pc.call(this,r);{let o=new Int32Array(i),a=Object.create(null),c=Object.create(null);for(let l,u,d=-1;++d<i;)(l=n[d])!==void 0&&((u=a[l])===void 0&&(u=a[l]=s[d]),o[d]=s[d]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);ge.call(this,o),this.visitMany(r.children.map((l,u)=>{let d=e.typeIds[u],p=a[d],v=c[d];return l.slice(p,Math.min(i,v))}))}}return this}function ap(r){let t;return r.nullCount>=r.length?ge.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?ge.call(this,Ur(r.offset,r.length,t)):ge.call(this,Mr(r.values))}function sr(r){return ge.call(this,r.values.subarray(0,r.length*r.stride))}function Mo(r){let{length:t,values:e,valueOffsets:i}=r,n=j(i[0]),s=j(i[t]),o=Math.min(s-n,e.byteLength-n);return ge.call(this,ps(-n,t+1,i)),ge.call(this,e.subarray(n,n+o)),this}function mc(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:i,[t]:n}=e;return ge.call(this,ps(-i,t+1,e)),this.visit(r.children[0].slice(i,n-i))}return this.visit(r.children[0])}function pc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}ot.prototype.visitBool=ap;ot.prototype.visitInt=sr;ot.prototype.visitFloat=sr;ot.prototype.visitUtf8=Mo;ot.prototype.visitLargeUtf8=Mo;ot.prototype.visitBinary=Mo;ot.prototype.visitLargeBinary=Mo;ot.prototype.visitFixedSizeBinary=sr;ot.prototype.visitDate=sr;ot.prototype.visitTimestamp=sr;ot.prototype.visitTime=sr;ot.prototype.visitDecimal=sr;ot.prototype.visitList=mc;ot.prototype.visitStruct=pc;ot.prototype.visitUnion=op;ot.prototype.visitInterval=sr;ot.prototype.visitDuration=sr;ot.prototype.visitFixedSizeList=mc;ot.prototype.visitMap=mc;var Jr=class extends Cr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Te,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,xt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ee(t)?t.then(e=>this.writeAll(e)):qt(t)?gc(this,t):yc(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Te?this._sink=t:(this._sink=new Te,t&&Bl(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Ol(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!$r(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof me&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof lt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!$r(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof lt?t instanceof Hr||this._writeRecordBatch(t):t instanceof me?this.writeAll(t.batches):re(t)&&this.writeAll(t)}_writeMessage(t,e=8){let i=e-1,n=Lt.encode(t),s=n.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+i&~i,c=a-s-o;return t.headerType===V.RecordBatch?this._recordBatchBlocks.push(new Ze(a,t.bodyLength,this._position)):t.headerType===V.DictionaryBatch&&this._dictionaryBlocks.push(new Ze(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(n),this._writePadding(c)}_write(t){if(this._started){let e=D(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Lt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(gi)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:i,bufferRegions:n,buffers:s}=ot.assemble(t),o=new vt(t.numRows,i,n),a=Lt.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,i=!1){let{byteLength:n,nodes:s,bufferRegions:o,buffers:a}=ot.assemble(new P([t])),c=new vt(t.length,s,o),l=new Et(c,e,i),u=Lt.from(l,n);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,i,n;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(i=e.byteLength)>0&&(this._write(e),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(t){var e,i;for(let[n,s]of t.dictionaries){let o=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(n),c=(i=this._dictionaryDeltaOffsets.get(n))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[l,u]of o.entries())this._writeDictionaryBatch(u,n,l>0);else if(c<o.length)for(let l of o.slice(c))this._writeDictionaryBatch(l,n,!0);this._seenDictionaries.set(n,s),this._dictionaryDeltaOffsets.set(n,o.length)}return this}},Rn=class r extends Jr{static writeAll(t,e){let i=new r(e);return ee(t)?t.then(n=>i.writeAll(n)):qt(t)?gc(i,t):yc(i,t)}},kn=class r extends Jr{static writeAll(t){let e=new r;return ee(t)?t.then(i=>e.writeAll(i)):qt(t)?gc(e,t):yc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,i=!1){if(!i&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,i)}_writeFooter(t){let e=Ye.encode(new Ye(t,H.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function yc(r,t){let e=t;t instanceof me&&(e=t.batches,r.reset(void 0,t.schema));for(let i of e)r.write(i);return r.finish()}function gc(r,t){return y(this,void 0,void 0,function*(){var e,i,n,s,o,a,c;try{for(e=!0,i=te(t);n=yield i.next(),s=n.done,!s;e=!0){c=n.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return r.finish()})}function df(r,t){if(qt(r))return lp(r,t);if(re(r))return cp(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function cp(r,t){let e=null,i=(t==null?void 0:t.type)==="bytes"||!1,n=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(i?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=D(l.value))&&(u!=null&&i&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function lp(r,t){let e=null,i=(t==null?void 0:t.type)==="bytes"||!1,n=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return y(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return y(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return y(this,void 0,void 0,function*(){(e!=null&&e.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,a){return y(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(i?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=D(l.value))&&(u!=null&&i&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}function mf(r){return new bc(r)}var bc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:i,["queueingStrategy"]:n="count"}=t,s=xl(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Pr(s),this._getSize=n!=="bytes"?hf:pf;let{["highWaterMark"]:o=n==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=n==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:n!=="bytes"?hf:pf}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},hf=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},pf=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Ro(r,t){let e=new Te,i=null,n=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield e.close()})},start(a){return y(this,void 0,void 0,function*(){yield o(a,i||(i=yield s()))})},pull(a){return y(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:n};function s(){return y(this,void 0,void 0,function*(){return yield(yield Ut.from(e)).open(t)})}function o(a,c){return y(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function ko(r,t){let e=new this(r),i=new Yt(e),n=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return y(this,void 0,void 0,function*(){yield s(o)})},start(o){return y(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:n};function s(o){return y(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield i.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}var up=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Aa),ec),Ja),Na),Sa),Ha),Ba),{compareSchemas:$r,compareFields:zu,compareTypes:Wu});_t.toDOMStream=df;st.throughDOM=mf;Ut.throughDOM=Ro;xr.throughDOM=Ro;De.throughDOM=Ro;Jr.throughDOM=ko;kn.throughDOM=ko;Rn.throughDOM=ko;var _c=class extends et{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){let t=this.create(),e=Date.now();return t.seconds=K.from(Math.floor(e/1e3)).toBigInt(),t.nanos=e%1e3*1e6,t}toDate(t){return new Date(K.from(t.seconds).toNumber()*1e3+Math.ceil(t.nanos/1e6))}fromDate(t){let e=this.create(),i=t.getTime();return e.seconds=K.from(Math.floor(i/1e3)).toBigInt(),e.nanos=i%1e3*1e6,e}internalJsonWrite(t,e){let i=K.from(t.seconds).toNumber()*1e3;if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(t.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let n="Z";if(t.nanos>0){let s=(t.nanos+1e9).toString().substring(1);s.substring(3)==="000000"?n="."+s.substring(0,3)+"Z":s.substring(6)==="000"?n="."+s.substring(0,6)+"Z":n="."+s+"Z"}return new Date(i).toISOString().replace(".000Z",n)}internalJsonRead(t,e,i){if(typeof t!="string")throw new Error("Unable to parse Timestamp from JSON "+Or(t)+".");let n=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let s=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(s))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(s<Date.parse("0001-01-01T00:00:00Z")||s>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return i||(i=this.create()),i.seconds=K.from(s/1e3).toBigInt(),i.nanos=0,n[7]&&(i.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),i}},wc=new _c;var yf=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.PATH=1]="PATH",i[i.CMD=2]="CMD",i))(yf||{}),gf=(n=>(n[n.UNSPECIFIED=0]="UNSPECIFIED",n[n.CANCELLED=1]="CANCELLED",n[n.CANCELLING=2]="CANCELLING",n[n.NOT_CANCELLABLE=3]="NOT_CANCELLABLE",n))(gf||{}),vc=class extends et{constructor(){super("arrow.flight.protocol.HandshakeRequest",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},fp=new vc,Ic=class extends et{constructor(){super("arrow.flight.protocol.HandshakeResponse",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},dp=new Ic,Sc=class extends et{constructor(){super("arrow.flight.protocol.BasicAuth",[{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"password",kind:"scalar",T:9}])}},lB=new Sc,xc=class extends et{constructor(){super("arrow.flight.protocol.Empty",[])}},hp=new xc,Tc=class extends et{constructor(){super("arrow.flight.protocol.ActionType",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9}])}},pp=new Tc,Bc=class extends et{constructor(){super("arrow.flight.protocol.Criteria",[{no:1,name:"expression",kind:"scalar",T:12}])}},mp=new Bc,Oc=class extends et{constructor(){super("arrow.flight.protocol.Action",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"body",kind:"scalar",T:12}])}},yp=new Oc,Dc=class extends et{constructor(){super("arrow.flight.protocol.CancelFlightInfoRequest",[{no:1,name:"info",kind:"message",T:()=>Vo}])}},uB=new Dc,Fc=class extends et{constructor(){super("arrow.flight.protocol.RenewFlightEndpointRequest",[{no:1,name:"endpoint",kind:"message",T:()=>bf}])}},fB=new Fc,Ac=class extends et{constructor(){super("arrow.flight.protocol.Result",[{no:1,name:"body",kind:"scalar",T:12}])}},gp=new Ac,Nc=class extends et{constructor(){super("arrow.flight.protocol.CancelFlightInfoResult",[{no:1,name:"status",kind:"enum",T:()=>["arrow.flight.protocol.CancelStatus",gf,"CANCEL_STATUS_"]}])}},dB=new Nc,Ec=class extends et{constructor(){super("arrow.flight.protocol.SchemaResult",[{no:1,name:"schema",kind:"scalar",T:12}])}},bp=new Ec,Lc=class extends et{constructor(){super("arrow.flight.protocol.FlightDescriptor",[{no:1,name:"type",kind:"enum",T:()=>["arrow.flight.protocol.FlightDescriptor.DescriptorType",yf]},{no:2,name:"cmd",kind:"scalar",T:12},{no:3,name:"path",kind:"scalar",repeat:2,T:9}])}},vi=new Lc,Uc=class extends et{constructor(){super("arrow.flight.protocol.FlightInfo",[{no:1,name:"schema",kind:"scalar",T:12},{no:2,name:"flight_descriptor",kind:"message",T:()=>vi},{no:3,name:"endpoint",kind:"message",repeat:1,T:()=>bf},{no:4,name:"total_records",kind:"scalar",T:3,L:0},{no:5,name:"total_bytes",kind:"scalar",T:3,L:0},{no:6,name:"ordered",kind:"scalar",T:8},{no:7,name:"app_metadata",kind:"scalar",T:12}])}},Vo=new Uc,Mc=class extends et{constructor(){super("arrow.flight.protocol.PollInfo",[{no:1,name:"info",kind:"message",T:()=>Vo},{no:2,name:"flight_descriptor",kind:"message",T:()=>vi},{no:3,name:"progress",kind:"scalar",opt:!0,T:1},{no:4,name:"expiration_time",kind:"message",T:()=>wc}])}},_p=new Mc,Rc=class extends et{constructor(){super("arrow.flight.protocol.FlightEndpoint",[{no:1,name:"ticket",kind:"message",T:()=>Po},{no:2,name:"location",kind:"message",repeat:1,T:()=>wp},{no:3,name:"expiration_time",kind:"message",T:()=>wc},{no:4,name:"app_metadata",kind:"scalar",T:12}])}},bf=new Rc,kc=class extends et{constructor(){super("arrow.flight.protocol.Location",[{no:1,name:"uri",kind:"scalar",T:9}])}},wp=new kc,Cc=class extends et{constructor(){super("arrow.flight.protocol.Ticket",[{no:1,name:"ticket",kind:"scalar",T:12}])}},Po=new Cc,Vc=class extends et{constructor(){super("arrow.flight.protocol.FlightData",[{no:1,name:"flight_descriptor",kind:"message",T:()=>vi},{no:2,name:"data_header",kind:"scalar",T:12},{no:3,name:"app_metadata",kind:"scalar",T:12},{no:1e3,name:"data_body",kind:"scalar",T:12}])}},Co=new Vc,Pc=class extends et{constructor(){super("arrow.flight.protocol.PutResult",[{no:1,name:"app_metadata",kind:"scalar",T:12}])}},vp=new Pc,jo=new Fi("arrow.flight.protocol.FlightService",[{name:"Handshake",serverStreaming:!0,clientStreaming:!0,options:{},I:fp,O:dp},{name:"ListFlights",serverStreaming:!0,options:{},I:mp,O:Vo},{name:"GetFlightInfo",options:{},I:vi,O:Vo},{name:"PollFlightInfo",options:{},I:vi,O:_p},{name:"GetSchema",options:{},I:vi,O:bp},{name:"DoGet",serverStreaming:!0,options:{},I:Po,O:Co},{name:"DoPut",serverStreaming:!0,clientStreaming:!0,options:{},I:Co,O:vp},{name:"DoExchange",serverStreaming:!0,clientStreaming:!0,options:{},I:Co,O:Co},{name:"DoAction",serverStreaming:!0,options:{},I:yp,O:gp},{name:"ListActions",serverStreaming:!0,options:{},I:hp,O:pp}]);var zo=class{constructor(t){this._transport=t;this.typeName=jo.typeName;this.methods=jo.methods;this.options=jo.options}handshake(t){let e=this.methods[0],i=this._transport.mergeOptions(t);return Ht("duplex",this._transport,e,i)}listFlights(t,e){let i=this.methods[1],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}getFlightInfo(t,e){let i=this.methods[2],n=this._transport.mergeOptions(e);return Ht("unary",this._transport,i,n,t)}pollFlightInfo(t,e){let i=this.methods[3],n=this._transport.mergeOptions(e);return Ht("unary",this._transport,i,n,t)}getSchema(t,e){let i=this.methods[4],n=this._transport.mergeOptions(e);return Ht("unary",this._transport,i,n,t)}doGet(t,e){let i=this.methods[5],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}doPut(t){let e=this.methods[6],i=this._transport.mergeOptions(t);return Ht("duplex",this._transport,e,i)}doExchange(t){let e=this.methods[7],i=this._transport.mergeOptions(t);return Ht("duplex",this._transport,e,i)}doAction(t,e){let i=this.methods[8],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}listActions(t,e){let i=this.methods[9],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}};var _f=/\$(\w+)/g;function wf(r){return!!r.match(_f)}function vf(r,t){let e=r.match(_f);if(e)for(let i of e)t[i.trim().replace("$","")]||qr(new Error(`No parameter matching ${i} provided in the query params map`));return!0}var Ip="0.13.0.nightly",If=`influxdb3-js/${Ip}`;var Cn=class{constructor(t){this._options=t;this._closed=!1;let{host:e,queryTimeout:i}=this._options;this._defaultHeaders=this._options.headers,this._transport=Ui.queryTransport({host:e,timeout:i}),this._flightClient=new zo(this._transport)}prepareTicket(t,e,i){let n={database:t,sql_query:e,query_type:i.type};if(i.params){let s={};for(let o of Object.keys(i.params))i.params[o]&&(s[o]=i.params[o]);n.params=s}return Po.create({ticket:new TextEncoder().encode(JSON.stringify(n))})}prepareMetadata(t){let e={"User-Agent":If,...this._defaultHeaders,...t},i=this._options.token;return i&&(e.authorization=`Bearer ${i}`),e}async*_queryRawBatches(t,e,i){if(i.params&&wf(t)&&vf(t,i.params),this._closed)throw new Error("queryApi: already closed!");let n=this._flightClient,s=this.prepareTicket(e,t,i),a={meta:this.prepareMetadata(i.headers)},c=n.doGet(s,a),l=async function*(){for await(let d of c.responses)yield Qc(d.dataHeader.length),yield d.dataHeader,yield d.dataBody}();yield*await Ut.from(l)}async*query(t,e,i){let n=this._queryRawBatches(t,e,i);for await(let s of n){let o={};for(let a of s){for(let c of s.schema.fields)o[c.name]=a[c.name];yield o}}}async*queryPoints(t,e,i){var s;let n=this._queryRawBatches(t,e,i);for await(let o of n)for(let a=0;a<o.numRows;a++){let c=new cr;for(let l=0;l<o.numCols;l++){let u=o.schema.fields[l],d=u.name,p=(s=o.getChildAt(l))==null?void 0:s.get(a),v=u.typeId,_=u.metadata.get("iox::column::type");if(p==null)continue;if((d==="measurement"||d=="iox::measurement")&&typeof p=="string"){c.setMeasurement(p);continue}if(!_){d==="time"&&v===f.Timestamp?c.setTimestamp(p):c.setField(d,p);continue}let[,,X,Y]=_.split("::");X==="field"?Y&&p!==void 0&&p!==null&&c.setField(d,p,Y):X==="tag"?c.setTag(d,p):X==="timestamp"&&c.setTimestamp(p)}yield c}}async close(){var t,e;this._closed=!0,(e=(t=this._transport).close)==null||e.call(t)}};var jc=`Please specify the 'database' as a method parameter or use default configuration at 'ClientOptions.database'
|
|
17
|
-
`,
|
|
16
|
+
]`}concat(...t){let e=this.schema,i=this.data.concat(t.flatMap(({data:n})=>n));return new r(e,i.map(n=>new lt(e,n)))}slice(t,e){let i=this.schema;[t,e]=en({length:this.numRows},t,e);let n=Qs(this.data,this._offsets,t,e);return new r(i,n.map(s=>new lt(i,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(i=>i.children[t]);if(e.length===0){let{type:i}=this.schema.fields[t],n=E({type:i,length:0,nullCount:0});e.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new P(e)}return null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),e)}setChildAt(t,e){let i=this.schema,n=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new P([E({type:new Tt,length:this.numRows})]));let s=i.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[i,n]=Do(i,a)}return new r(i,n)}select(t){let e=this.schema.fields.reduce((i,n,s)=>i.set(n.name,s),new Map);return this.selectAt(t.map(i=>e.get(i)).filter(i=>i>-1))}selectAt(t){let e=this.schema.selectAt(t),i=this.batches.map(n=>n.selectAt(t));return new r(e,i)}assign(t){let e=this.schema.fields,[i,n]=t.schema.fields.reduce((a,c,l)=>{let[u,d]=a,p=e.findIndex(I=>I.name===c.name);return~p?d[p]=l:u.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,n[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new r(...Do(s,o))}};qu=Symbol.toStringTag;me[qu]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=ci(sn),r.get=ci(dt.getVisitFn(f.Struct)),r.set=to(wt.getVisitFn(f.Struct)),r.indexOf=eo(Rr.getVisitFn(f.Struct)),"Table"))(me.prototype);var Gu,lt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=E({nullCount:0,type:new rt(this.schema.fields),children:this.schema.fields.map(e=>E({type:e.type,nullCount:0}))})]=t,!(this.data instanceof W))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ku(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:i,children:n,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=k.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new q(i),a=E({type:new rt(i),length:s,children:n,nullCount:0});[this.schema,this.data]=Ku(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Xu(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 dt.visit(this.data,t)}at(t){return this.get(Er(t,this.numRows))}set(t,e){return wt.visit(this.data,t,e)}indexOf(t,e){return Rr.visit(this.data,t,e)}[Symbol.iterator](){return li.visit(new P([this.data]))}toArray(){return[...this]}concat(...t){return new me(this.schema,[this,...t])}slice(t,e){let[i]=new P([this.data]).slice(t,e).data;return new r(this.schema,i)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new P([this.data.children[t]]):null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),e)}setChildAt(t,e){let i=this.schema,n=this.data;if(t>-1&&t<this.numCols){e||(e=new P([E({type:new Tt,length:this.numRows})]));let s=i.fields.slice(),o=n.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],i=new q(s,new Map(this.schema.metadata)),n=E({type:new rt(s),children:o})}return new r(i,n)}select(t){let e=this.schema.select(t),i=new rt(e.fields),n=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(n[o]=this.data.children[o])}return new r(e,E({type:i,length:this.numRows,children:n}))}selectAt(t){let e=this.schema.selectAt(t),i=t.map(s=>this.data.children[s]).filter(Boolean),n=E({type:new rt(e.fields),length:this.numRows,children:i});return new r(e,n)}};Gu=Symbol.toStringTag;lt[Gu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(lt.prototype);function Ku(r,t,e=t.reduce((i,n)=>Math.max(i,n.length),0)){var i;let n=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(n[a]=c.clone({nullable:!0}),s[a]=(i=l==null?void 0:l._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:E({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(n),E({type:new rt(n),length:e,children:s})]}function Xu(r,t,e=new Map){var i,n;if(((i=r==null?void 0:r.length)!==null&&i!==void 0?i:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((n=c==null?void 0:c.dictionary)===null||n===void 0?void 0:n.data)||[]])Xu(a.children,l==null?void 0:l.children,e);if(g.isDictionary(a)){let{id:l}=a;if(!e.has(l))c!=null&&c.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var Hr=class extends lt{constructor(t){let e=t.fields.map(n=>E({type:n.type})),i=E({type:new rt(t.fields),nullCount:0,children:e});super(t,i)}};var ye=class r{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 r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):H.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):V.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new gt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,H.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,V.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,s,o){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,i),r.addHeader(t,n),r.addBodyLength(t,s),r.addCustomMetadata(t,o),r.endMessage(t)}};var ac=class extends v{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Gi.startNull(e),Gi.endNull(e)}visitInt(t,e){return se.startInt(e),se.addBitWidth(e,t.bitWidth),se.addIsSigned(e,t.isSigned),se.endInt(e)}visitFloat(t,e){return mr.startFloatingPoint(e),mr.addPrecision(e,t.precision),mr.endFloatingPoint(e)}visitBinary(t,e){return $i.startBinary(e),$i.endBinary(e)}visitLargeBinary(t,e){return Ji.startLargeBinary(e),Ji.endLargeBinary(e)}visitBool(t,e){return Hi.startBool(e),Hi.endBool(e)}visitUtf8(t,e){return Yi.startUtf8(e),Yi.endUtf8(e)}visitLargeUtf8(t,e){return qi.startLargeUtf8(e),qi.endLargeUtf8(e)}visitDecimal(t,e){return ve.startDecimal(e),ve.addScale(e,t.scale),ve.addPrecision(e,t.precision),ve.addBitWidth(e,t.bitWidth),ve.endDecimal(e)}visitDate(t,e){return fr.startDate(e),fr.addUnit(e,t.unit),fr.endDate(e)}visitTime(t,e){return Me.startTime(e),Me.addUnit(e,t.unit),Me.addBitWidth(e,t.bitWidth),Me.endTime(e)}visitTimestamp(t,e){let i=t.timezone&&e.createString(t.timezone)||void 0;return Re.startTimestamp(e),Re.addUnit(e,t.unit),i!==void 0&&Re.addTimezone(e,i),Re.endTimestamp(e)}visitInterval(t,e){return yr.startInterval(e),yr.addUnit(e,t.unit),yr.endInterval(e)}visitDuration(t,e){return dr.startDuration(e),dr.addUnit(e,t.unit),dr.endDuration(e)}visitList(t,e){return Ki.startList(e),Ki.endList(e)}visitStruct(t,e){return Xi.startStruct_(e),Xi.endStruct_(e)}visitUnion(t,e){oe.startTypeIdsVector(e,t.typeIds.length);let i=oe.createTypeIdsVector(e,t.typeIds);return oe.startUnion(e),oe.addMode(e,t.mode),oe.addTypeIds(e,i),oe.endUnion(e)}visitDictionary(t,e){let i=this.visit(t.indices,e);return Ie.startDictionaryEncoding(e),Ie.addId(e,BigInt(t.id)),Ie.addIsOrdered(e,t.isOrdered),i!==void 0&&Ie.addIndexType(e,i),Ie.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return hr.startFixedSizeBinary(e),hr.addByteWidth(e,t.byteWidth),hr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return pr.startFixedSizeList(e),pr.addListSize(e,t.listSize),pr.endFixedSizeList(e)}visitMap(t,e){return gr.startMap(e),gr.addKeysSorted(e,t.keysSorted),gr.endMap(e)}},Fo=new ac;function tf(r,t=new Map){return new q(Rh(r,t),Ao(r.metadata),t)}function cc(r){return new It(r.count,rf(r.columns),nf(r.columns))}function ef(r){return new Et(cc(r.data),r.id,r.isDelta)}function Rh(r,t){return(r.fields||[]).filter(Boolean).map(e=>k.fromJSON(e,t))}function Yu(r,t){return(r.children||[]).filter(Boolean).map(e=>k.fromJSON(e,t))}function rf(r){return(r||[]).reduce((t,e)=>[...t,new Qt(e.count,kh(e.VALIDITY)),...rf(e.children)],[])}function nf(r,t=[]){for(let e=-1,i=(r||[]).length;++e<i;){let n=r[e];n.VALIDITY&&t.push(new Nt(t.length,n.VALIDITY.length)),n.TYPE_ID&&t.push(new Nt(t.length,n.TYPE_ID.length)),n.OFFSET&&t.push(new Nt(t.length,n.OFFSET.length)),n.DATA&&t.push(new Nt(t.length,n.DATA.length)),t=nf(n.children,t)}return t}function kh(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function sf(r,t){let e,i,n,s,o,a;return!t||!(s=r.dictionary)?(o=Qu(r,Yu(r,t)),n=new k(r.name,o,r.nullable,Ao(r.metadata))):t.has(e=s.id)?(i=(i=s.indexType)?Zu(i):new Se,a=new jt(t.get(e),i,e,s.isOrdered),n=new k(r.name,a,r.nullable,Ao(r.metadata))):(i=(i=s.indexType)?Zu(i):new Se,t.set(e,o=Qu(r,Yu(r,t))),a=new jt(o,i,e,s.isOrdered),n=new k(r.name,a,r.nullable,Ao(r.metadata))),n||null}function Ao(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function Zu(r){return new bt(r.isSigned,r.bitWidth)}function Qu(r,t){let e=r.type.name;switch(e){case"NONE":return new Tt;case"null":return new Tt;case"binary":return new ke;case"largebinary":return new Ce;case"utf8":return new Ve;case"largeutf8":return new Pe;case"bool":return new je;case"list":return new le((t||[])[0]);case"struct":return new rt(t||[]);case"struct_":return new rt(t||[])}switch(e){case"int":{let i=r.type;return new bt(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=r.type;return new Xt(G[i.precision])}case"decimal":{let i=r.type;return new ze(i.scale,i.precision,i.bitWidth)}case"date":{let i=r.type;return new We(ct[i.unit])}case"time":{let i=r.type;return new $e(b[i.unit],i.bitWidth)}case"timestamp":{let i=r.type;return new He(b[i.unit],i.timezone)}case"interval":{let i=r.type;return new Je(yt[i.unit])}case"duration":{let i=r.type;return new qe(b[i.unit])}case"union":{let i=r.type,[n,...s]=(i.mode+"").toLowerCase(),o=n.toUpperCase()+s.join("");return new ue(Z[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=r.type;return new Ke(i.byteWidth)}case"fixedsizelist":{let i=r.type;return new fe(i.listSize,(t||[])[0])}case"map":{let i=r.type;return new de((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ch=Nr,Vh=Vt,Lt=class r{static fromJSON(t,e){let i=new r(0,H.V5,e);return i._createHeader=Ph(t,e),i}static decode(t){t=new Vh(D(t));let e=ye.getRootAsMessage(t),i=e.bodyLength(),n=e.version(),s=e.headerType(),o=new r(i,n,s);return o._createHeader=jh(e,s),o}static encode(t){let e=new Ch,i=-1;return t.isSchema()?i=q.encode(e,t.header()):t.isRecordBatch()?i=It.encode(e,t.header()):t.isDictionaryBatch()&&(i=Et.encode(e,t.header())),ye.startMessage(e),ye.addVersion(e,H.V5),ye.addHeader(e,i),ye.addHeaderType(e,t.headerType),ye.addBodyLength(e,BigInt(t.bodyLength)),ye.finishMessageBuffer(e,ye.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof q)return new r(0,H.V5,V.Schema,t);if(t instanceof It)return new r(e,H.V5,V.RecordBatch,t);if(t instanceof Et)return new r(e,H.V5,V.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===V.Schema}isRecordBatch(){return this.headerType===V.RecordBatch}isDictionaryBatch(){return this.headerType===V.DictionaryBatch}constructor(t,e,i,n){this._version=e,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=j(t)}},It=class{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=j(t)}},Et=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=j(e)}},Nt=class{constructor(t,e){this.offset=j(t),this.length=j(e)}},Qt=class{constructor(t,e){this.length=j(t),this.nullCount=j(e)}};function Ph(r,t){return()=>{switch(t){case V.Schema:return q.fromJSON(r);case V.RecordBatch:return It.fromJSON(r);case V.DictionaryBatch:return Et.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${V[t]}, type: ${t} }`)}}function jh(r,t){return()=>{switch(t){case V.Schema:return q.decode(r.header(new Ft),new Map,r.version());case V.RecordBatch:return It.decode(r.header(new Pt),r.version());case V.DictionaryBatch:return Et.decode(r.header(new Ue),r.version())}throw new Error(`Unrecognized Message type: { name: ${V[t]}, type: ${t} }`)}}k.encode=Zh;k.decode=Xh;k.fromJSON=sf;q.encode=Yh;q.decode=zh;q.fromJSON=tf;It.encode=Qh;It.decode=Wh;It.fromJSON=cc;Et.encode=tp;Et.decode=$h;Et.fromJSON=ef;Qt.encode=ep;Qt.decode=Jh;Nt.encode=rp;Nt.decode=Hh;function zh(r,t=new Map,e=H.V5){let i=Gh(r,t);return new q(i,No(r),t,e)}function Wh(r,t=H.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new It(r.length(),qh(r),Kh(r,t))}function $h(r,t=H.V5){return new Et(It.decode(r.data(),t),r.id(),r.isDelta())}function Hh(r){return new Nt(r.offset(),r.length())}function Jh(r){return new Qt(r.length(),r.nullCount())}function qh(r){let t=[];for(let e,i=-1,n=-1,s=r.nodesLength();++i<s;)(e=r.nodes(i))&&(t[++n]=Qt.decode(e));return t}function Kh(r,t){let e=[];for(let i,n=-1,s=-1,o=r.buffersLength();++n<o;)(i=r.buffers(n))&&(t<H.V4&&(i.bb_pos+=8*(n+1)),e[++s]=Nt.decode(i));return e}function Gh(r,t){let e=[];for(let i,n=-1,s=-1,o=r.fieldsLength();++n<o;)(i=r.fields(n))&&(e[++s]=k.decode(i,t));return e}function of(r,t){let e=[];for(let i,n=-1,s=-1,o=r.childrenLength();++n<o;)(i=r.children(n))&&(e[++s]=k.decode(i,t));return e}function Xh(r,t){let e,i,n,s,o,a;return!t||!(a=r.dictionary())?(n=cf(r,of(r,t)),i=new k(r.name(),n,r.nullable(),No(r))):t.has(e=j(a.id()))?(s=(s=a.indexType())?af(s):new Se,o=new jt(t.get(e),s,e,a.isOrdered()),i=new k(r.name(),o,r.nullable(),No(r))):(s=(s=a.indexType())?af(s):new Se,t.set(e,n=cf(r,of(r,t))),o=new jt(n,s,e,a.isOrdered()),i=new k(r.name(),o,r.nullable(),No(r))),i||null}function No(r){let t=new Map;if(r)for(let e,i,n=-1,s=Math.trunc(r.customMetadataLength());++n<s;)(e=r.customMetadata(n))&&(i=e.key())!=null&&t.set(i,e.value());return t}function af(r){return new bt(r.isSigned(),r.bitWidth())}function cf(r,t){let e=r.typeType();switch(e){case Q.NONE:return new Tt;case Q.Null:return new Tt;case Q.Binary:return new ke;case Q.LargeBinary:return new Ce;case Q.Utf8:return new Ve;case Q.LargeUtf8:return new Pe;case Q.Bool:return new je;case Q.List:return new le((t||[])[0]);case Q.Struct_:return new rt(t||[])}switch(e){case Q.Int:{let i=r.type(new se);return new bt(i.isSigned(),i.bitWidth())}case Q.FloatingPoint:{let i=r.type(new mr);return new Xt(i.precision())}case Q.Decimal:{let i=r.type(new ve);return new ze(i.scale(),i.precision(),i.bitWidth())}case Q.Date:{let i=r.type(new fr);return new We(i.unit())}case Q.Time:{let i=r.type(new Me);return new $e(i.unit(),i.bitWidth())}case Q.Timestamp:{let i=r.type(new Re);return new He(i.unit(),i.timezone())}case Q.Interval:{let i=r.type(new yr);return new Je(i.unit())}case Q.Duration:{let i=r.type(new dr);return new qe(i.unit())}case Q.Union:{let i=r.type(new oe);return new ue(i.mode(),i.typeIdsArray()||[],t||[])}case Q.FixedSizeBinary:{let i=r.type(new hr);return new Ke(i.byteWidth())}case Q.FixedSizeList:{let i=r.type(new pr);return new fe(i.listSize(),(t||[])[0])}case Q.Map:{let i=r.type(new gr);return new de((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${Q[e]}" (${e})`)}function Yh(r,t){let e=t.fields.map(s=>k.encode(r,s));Ft.startFieldsVector(r,e.length);let i=Ft.createFieldsVector(r,e),n=t.metadata&&t.metadata.size>0?Ft.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return gt.startKeyValue(r),gt.addKey(r,a),gt.addValue(r,c),gt.endKeyValue(r)})):-1;return Ft.startSchema(r),Ft.addFields(r,i),Ft.addEndianness(r,ip?ur.Little:ur.Big),n!==-1&&Ft.addCustomMetadata(r,n),Ft.endSchema(r)}function Zh(r,t){let e=-1,i=-1,n=-1,s=t.type,o=t.typeId;g.isDictionary(s)?(o=s.dictionary.typeId,n=Fo.visit(s,r),i=Fo.visit(s.dictionary,r)):i=Fo.visit(s,r);let a=(s.children||[]).map(u=>k.encode(r,u)),c=vt.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?vt.createCustomMetadataVector(r,[...t.metadata].map(([u,d])=>{let p=r.createString(`${u}`),I=r.createString(`${d}`);return gt.startKeyValue(r),gt.addKey(r,p),gt.addValue(r,I),gt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),vt.startField(r),vt.addType(r,i),vt.addTypeType(r,o),vt.addChildren(r,c),vt.addNullable(r,!!t.nullable),e!==-1&&vt.addName(r,e),n!==-1&&vt.addDictionary(r,n),l!==-1&&vt.addCustomMetadata(r,l),vt.endField(r)}function Qh(r,t){let e=t.nodes||[],i=t.buffers||[];Pt.startNodesVector(r,e.length);for(let o of e.slice().reverse())Qt.encode(r,o);let n=r.endVector();Pt.startBuffersVector(r,i.length);for(let o of i.slice().reverse())Nt.encode(r,o);let s=r.endVector();return Pt.startRecordBatch(r),Pt.addLength(r,BigInt(t.length)),Pt.addNodes(r,n),Pt.addBuffers(r,s),Pt.endRecordBatch(r)}function tp(r,t){let e=It.encode(r,t.data);return Ue.startDictionaryBatch(r),Ue.addId(r,BigInt(t.id)),Ue.addIsDelta(r,t.isDelta),Ue.addData(r,e),Ue.endDictionaryBatch(r)}function ep(r,t){return Qr.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function rp(r,t){return Zr.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var ip=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var uc=r=>`Expected ${V[r]} Message in stream, but was null or length 0.`,fc=r=>`Header pointer of flatbuffer-encoded ${V[r]} Message is null or length 0.`,lf=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,uf=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,gi=class{constructor(t){this.source=t instanceof Be?t:new Be(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?it:t.value===-1&&(t=this.readMetadataLength()).done?it:(t=this.readMetadata(t.value)).done?it:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(uc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=D(this.source.read(t));if(e.byteLength<t)throw new Error(uf(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=V.Schema,i=this.readMessage(e),n=i==null?void 0:i.header();if(t&&!n)throw new Error(fc(e));return n}readMetadataLength(){let t=this.source.read(Eo),e=t&&new Vt(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}}readMetadata(t){let e=this.source.read(t);if(!e)return it;if(e.byteLength<t)throw new Error(lf(t,e.byteLength));return{done:!1,value:Lt.decode(e)}}},Un=class{constructor(t,e){this.source=t instanceof Yt?t:us(t)?new vr(t,e):new Yt(t)}[Symbol.asyncIterator](){return this}next(){return y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?it:t.value===-1&&(t=yield this.readMetadataLength()).done?it:(t=yield this.readMetadata(t.value)).done?it:t})}throw(t){return y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return y(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(uc(t));return e.value})}readMessageBody(t){return y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=D(yield this.source.read(t));if(e.byteLength<t)throw new Error(uf(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return y(this,arguments,void 0,function*(t=!1){let e=V.Schema,i=yield this.readMessage(e),n=i==null?void 0:i.header();if(t&&!n)throw new Error(fc(e));return n})}readMetadataLength(){return y(this,void 0,void 0,function*(){let t=yield this.source.read(Eo),e=t&&new Vt(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}})}readMetadata(t){return y(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return it;if(e.byteLength<t)throw new Error(lf(t,e.byteLength));return{done:!1,value:Lt.decode(e)}})}},Mn=class extends gi{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof on?t:new on(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Lt.fromJSON(t.schema,V.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Lt.fromJSON(e,V.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Lt.fromJSON(e,V.RecordBatch)}}return this._body=[],it}readMessageBody(t){return e(this._body);function e(i){return(i||[]).reduce((n,s)=>[...n,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(uc(t));return e.value}readSchema(){let t=V.Schema,e=this.readMessage(t),i=e==null?void 0:e.header();if(!e||!i)throw new Error(fc(t));return i}},Eo=4,lc="ARROW1",bi=new Uint8Array(lc.length);for(let r=0;r<lc.length;r+=1)bi[r]=lc.codePointAt(r);function Lo(r,t=0){for(let e=-1,i=bi.length;++e<i;)if(bi[e]!==r[t+e])return!1;return!0}var _i=bi.length,dc=_i+Eo,ff=_i*2+Eo;var Ut=class r extends Cr{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return ee(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return _t.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return _t.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof r?t:cs(t)?sp(t):us(t)?cp(t):ee(t)?y(this,void 0,void 0,function*(){return yield r.from(yield t)}):fs(t)||Ci(t)||hs(t)||qt(t)?ap(new Yt(t)):op(new Be(t))}static readAll(t){return t instanceof r?t.isSync()?df(t):hf(t):cs(t)||ArrayBuffer.isView(t)||re(t)||ls(t)?df(t):hf(t)}},De=class extends Ut{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return kt(this,arguments,function*(){yield U(yield*Xr(te(this[Symbol.iterator]())))})}},Sr=class extends Ut{constructor(t){super(t),this._impl=t}readAll(){return y(this,void 0,void 0,function*(){var t,e,i,n;let s=new Array;try{for(var o=!0,a=te(this),c;c=yield a.next(),t=c.done,!t;o=!0){n=c.value,o=!1;let l=n;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},xr=class extends De{constructor(t){super(t),this._impl=t}},Rn=class extends Sr{constructor(t){super(t),this._impl=t}},Uo=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let i=this._loadVectors(t,e,this.schema.fields),n=E({type:new rt(this.schema.fields),length:t.length,children:i});return new lt(this.schema,n)}_loadDictionaryBatch(t,e){let{id:i,isDelta:n}=t,{dictionaries:s,schema:o}=this,a=s.get(i),c=o.dictionaries.get(i),l=this._loadVectors(t.data,e,[c]);return(a&&n?a.concat(new P(l)):new P(l)).memoize()}_loadVectors(t,e,i){return new un(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},wi=class extends Uo{constructor(t,e){super(e),this._reader=cs(t)?new Mn(this._handle=t):new gi(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=pf(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):it}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):it}next(){if(this.closed)return it;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hr(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Ii=class extends Uo{constructor(t,e){super(e),this._reader=new Un(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=pf(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):it})}return(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):it})}next(){return y(this,void 0,void 0,function*(){if(this.closed)return it;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Hr(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Mo=class extends wi{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 an?t:new an(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(V.RecordBatch);if(n!=null&&n.isRecordBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(V.DictionaryBatch);if(n!=null&&n.isDictionaryBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-dc,i=t.readInt32(e),n=t.readAt(e-i,i);return Ye.decode(n)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},hc=class extends Ii{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let i=typeof e[0]!="number"?e.shift():void 0,n=e[0]instanceof Map?e.shift():void 0;super(t instanceof vr?t:new vr(t,i),n)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return y(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(V.RecordBatch);if(n!=null&&n.isRecordBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return y(this,void 0,void 0,function*(){var e;let i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(V.DictionaryBatch);if(n!=null&&n.isDictionaryBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-dc,i=yield t.readInt32(e),n=yield t.readAt(e-i,i);return Ye.decode(n)})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},pc=class extends wi{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new so(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function pf(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*df(r){let t=Ut.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function hf(r){return kt(this,arguments,function*(){let e=yield U(Ut.from(r));try{if(!(yield U(e.open({autoDestroy:!1}))).closed)do yield yield U(e);while(!(yield U(e.reset().open())).closed)}finally{yield U(e.cancel())}})}function sp(r){return new De(new pc(r))}function op(r){let t=r.peek(_i+7&-8);return t&&t.byteLength>=4?Lo(t)?new xr(new Mo(r.read())):new De(new wi(r)):new De(new wi(function*(){}()))}function ap(r){return y(this,void 0,void 0,function*(){let t=yield r.peek(_i+7&-8);return t&&t.byteLength>=4?Lo(t)?new xr(new Mo(yield r.read())):new Sr(new Ii(r)):new Sr(new Ii(function(){return kt(this,arguments,function*(){})}()))})}function cp(r){return y(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new vr(r,t);return t>=ff&&Lo(yield e.readAt(0,_i+7&-8))?new Rn(new hc(e)):new Sr(new Ii(e))})}var ot=class r extends v{static assemble(...t){let e=n=>n.flatMap(s=>Array.isArray(s)?e(s):s instanceof lt?s.data.children:s.data),i=new r;return i.visitMany(e(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof P)return this.visitMany(t.data),this;let{type:e}=t;if(!g.isDictionary(e)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(g.isUnion(e))this.nodes.push(new Qt(i,0));else{let{nullCount:n}=t;g.isNull(e)||ge.call(this,n<=0?new Uint8Array(0):Ur(t.offset,i,t.nullBitmap)),this.nodes.push(new Qt(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 ge(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Nt(this._byteLength,t)),this._byteLength+=t,this}function lp(r){var t;let{type:e,length:i,typeIds:n,valueOffsets:s}=r;if(ge.call(this,n),e.mode===Z.Sparse)return mc.call(this,r);if(e.mode===Z.Dense){if(r.offset<=0)return ge.call(this,s),mc.call(this,r);{let o=new Int32Array(i),a=Object.create(null),c=Object.create(null);for(let l,u,d=-1;++d<i;)(l=n[d])!==void 0&&((u=a[l])===void 0&&(u=a[l]=s[d]),o[d]=s[d]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);ge.call(this,o),this.visitMany(r.children.map((l,u)=>{let d=e.typeIds[u],p=a[d],I=c[d];return l.slice(p,Math.min(i,I))}))}}return this}function up(r){let t;return r.nullCount>=r.length?ge.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?ge.call(this,Ur(r.offset,r.length,t)):ge.call(this,Mr(r.values))}function sr(r){return ge.call(this,r.values.subarray(0,r.length*r.stride))}function Ro(r){let{length:t,values:e,valueOffsets:i}=r,n=j(i[0]),s=j(i[t]),o=Math.min(s-n,e.byteLength-n);return ge.call(this,ms(-n,t+1,i)),ge.call(this,e.subarray(n,n+o)),this}function yc(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:i,[t]:n}=e;return ge.call(this,ms(-i,t+1,e)),this.visit(r.children[0].slice(i,n-i))}return this.visit(r.children[0])}function mc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}ot.prototype.visitBool=up;ot.prototype.visitInt=sr;ot.prototype.visitFloat=sr;ot.prototype.visitUtf8=Ro;ot.prototype.visitLargeUtf8=Ro;ot.prototype.visitBinary=Ro;ot.prototype.visitLargeBinary=Ro;ot.prototype.visitFixedSizeBinary=sr;ot.prototype.visitDate=sr;ot.prototype.visitTimestamp=sr;ot.prototype.visitTime=sr;ot.prototype.visitDecimal=sr;ot.prototype.visitList=yc;ot.prototype.visitStruct=mc;ot.prototype.visitUnion=lp;ot.prototype.visitInterval=sr;ot.prototype.visitDuration=sr;ot.prototype.visitFixedSizeList=yc;ot.prototype.visitMap=yc;var Jr=class extends Cr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Te,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,xt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ee(t)?t.then(e=>this.writeAll(e)):qt(t)?bc(this,t):gc(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Te?this._sink=t:(this._sink=new Te,t&&Fl(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Al(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!$r(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof me&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof lt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!$r(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof lt?t instanceof Hr||this._writeRecordBatch(t):t instanceof me?this.writeAll(t.batches):re(t)&&this.writeAll(t)}_writeMessage(t,e=8){let i=e-1,n=Lt.encode(t),s=n.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+i&~i,c=a-s-o;return t.headerType===V.RecordBatch?this._recordBatchBlocks.push(new Ze(a,t.bodyLength,this._position)):t.headerType===V.DictionaryBatch&&this._dictionaryBlocks.push(new Ze(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(n),this._writePadding(c)}_write(t){if(this._started){let e=D(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Lt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(bi)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:i,bufferRegions:n,buffers:s}=ot.assemble(t),o=new It(t.numRows,i,n),a=Lt.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,i=!1){let{byteLength:n,nodes:s,bufferRegions:o,buffers:a}=ot.assemble(new P([t])),c=new It(t.length,s,o),l=new Et(c,e,i),u=Lt.from(l,n);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,i,n;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(i=e.byteLength)>0&&(this._write(e),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(t){var e,i;for(let[n,s]of t.dictionaries){let o=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(n),c=(i=this._dictionaryDeltaOffsets.get(n))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[l,u]of o.entries())this._writeDictionaryBatch(u,n,l>0);else if(c<o.length)for(let l of o.slice(c))this._writeDictionaryBatch(l,n,!0);this._seenDictionaries.set(n,s),this._dictionaryDeltaOffsets.set(n,o.length)}return this}},kn=class r extends Jr{static writeAll(t,e){let i=new r(e);return ee(t)?t.then(n=>i.writeAll(n)):qt(t)?bc(i,t):gc(i,t)}},Cn=class r extends Jr{static writeAll(t){let e=new r;return ee(t)?t.then(i=>e.writeAll(i)):qt(t)?bc(e,t):gc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,i=!1){if(!i&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,i)}_writeFooter(t){let e=Ye.encode(new Ye(t,H.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function gc(r,t){let e=t;t instanceof me&&(e=t.batches,r.reset(void 0,t.schema));for(let i of e)r.write(i);return r.finish()}function bc(r,t){return y(this,void 0,void 0,function*(){var e,i,n,s,o,a,c;try{for(e=!0,i=te(t);n=yield i.next(),s=n.done,!s;e=!0){c=n.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return r.finish()})}function mf(r,t){if(qt(r))return dp(r,t);if(re(r))return fp(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function fp(r,t){let e=null,i=(t==null?void 0:t.type)==="bytes"||!1,n=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(i?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=D(l.value))&&(u!=null&&i&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function dp(r,t){let e=null,i=(t==null?void 0:t.type)==="bytes"||!1,n=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return y(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return y(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return y(this,void 0,void 0,function*(){(e!=null&&e.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,a){return y(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(i?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=D(l.value))&&(u!=null&&i&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}function bf(r){return new _c(r)}var _c=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:i,["queueingStrategy"]:n="count"}=t,s=Ol(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Pr(s),this._getSize=n!=="bytes"?yf:gf;let{["highWaterMark"]:o=n==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=n==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:n!=="bytes"?yf:gf}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},yf=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},gf=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function ko(r,t){let e=new Te,i=null,n=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield e.close()})},start(a){return y(this,void 0,void 0,function*(){yield o(a,i||(i=yield s()))})},pull(a){return y(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:n};function s(){return y(this,void 0,void 0,function*(){return yield(yield Ut.from(e)).open(t)})}function o(a,c){return y(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Co(r,t){let e=new this(r),i=new Yt(e),n=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return y(this,void 0,void 0,function*(){yield s(o)})},start(o){return y(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:n};function s(o){return y(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield i.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}var hp=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Na),rc),qa),Ea),xa),Ja),Oa),{compareSchemas:$r,compareFields:Hu,compareTypes:Ju});_t.toDOMStream=mf;st.throughDOM=bf;Ut.throughDOM=ko;xr.throughDOM=ko;De.throughDOM=ko;Jr.throughDOM=Co;Cn.throughDOM=Co;kn.throughDOM=Co;var wc=class extends et{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){let t=this.create(),e=Date.now();return t.seconds=K.from(Math.floor(e/1e3)).toBigInt(),t.nanos=e%1e3*1e6,t}toDate(t){return new Date(K.from(t.seconds).toNumber()*1e3+Math.ceil(t.nanos/1e6))}fromDate(t){let e=this.create(),i=t.getTime();return e.seconds=K.from(Math.floor(i/1e3)).toBigInt(),e.nanos=i%1e3*1e6,e}internalJsonWrite(t,e){let i=K.from(t.seconds).toNumber()*1e3;if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(t.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let n="Z";if(t.nanos>0){let s=(t.nanos+1e9).toString().substring(1);s.substring(3)==="000000"?n="."+s.substring(0,3)+"Z":s.substring(6)==="000"?n="."+s.substring(0,6)+"Z":n="."+s+"Z"}return new Date(i).toISOString().replace(".000Z",n)}internalJsonRead(t,e,i){if(typeof t!="string")throw new Error("Unable to parse Timestamp from JSON "+Or(t)+".");let n=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let s=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(s))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(s<Date.parse("0001-01-01T00:00:00Z")||s>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return i||(i=this.create()),i.seconds=K.from(s/1e3).toBigInt(),i.nanos=0,n[7]&&(i.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),i}},Ic=new wc;var _f=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.PATH=1]="PATH",i[i.CMD=2]="CMD",i))(_f||{}),wf=(n=>(n[n.UNSPECIFIED=0]="UNSPECIFIED",n[n.CANCELLED=1]="CANCELLED",n[n.CANCELLING=2]="CANCELLING",n[n.NOT_CANCELLABLE=3]="NOT_CANCELLABLE",n))(wf||{}),vc=class extends et{constructor(){super("arrow.flight.protocol.HandshakeRequest",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},pp=new vc,Sc=class extends et{constructor(){super("arrow.flight.protocol.HandshakeResponse",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},mp=new Sc,xc=class extends et{constructor(){super("arrow.flight.protocol.BasicAuth",[{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"password",kind:"scalar",T:9}])}},dB=new xc,Tc=class extends et{constructor(){super("arrow.flight.protocol.Empty",[])}},yp=new Tc,Bc=class extends et{constructor(){super("arrow.flight.protocol.ActionType",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9}])}},gp=new Bc,Oc=class extends et{constructor(){super("arrow.flight.protocol.Criteria",[{no:1,name:"expression",kind:"scalar",T:12}])}},bp=new Oc,Dc=class extends et{constructor(){super("arrow.flight.protocol.Action",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"body",kind:"scalar",T:12}])}},_p=new Dc,Fc=class extends et{constructor(){super("arrow.flight.protocol.CancelFlightInfoRequest",[{no:1,name:"info",kind:"message",T:()=>Po}])}},hB=new Fc,Ac=class extends et{constructor(){super("arrow.flight.protocol.RenewFlightEndpointRequest",[{no:1,name:"endpoint",kind:"message",T:()=>If}])}},pB=new Ac,Nc=class extends et{constructor(){super("arrow.flight.protocol.Result",[{no:1,name:"body",kind:"scalar",T:12}])}},wp=new Nc,Ec=class extends et{constructor(){super("arrow.flight.protocol.CancelFlightInfoResult",[{no:1,name:"status",kind:"enum",T:()=>["arrow.flight.protocol.CancelStatus",wf,"CANCEL_STATUS_"]}])}},mB=new Ec,Lc=class extends et{constructor(){super("arrow.flight.protocol.SchemaResult",[{no:1,name:"schema",kind:"scalar",T:12}])}},Ip=new Lc,Uc=class extends et{constructor(){super("arrow.flight.protocol.FlightDescriptor",[{no:1,name:"type",kind:"enum",T:()=>["arrow.flight.protocol.FlightDescriptor.DescriptorType",_f]},{no:2,name:"cmd",kind:"scalar",T:12},{no:3,name:"path",kind:"scalar",repeat:2,T:9}])}},vi=new Uc,Mc=class extends et{constructor(){super("arrow.flight.protocol.FlightInfo",[{no:1,name:"schema",kind:"scalar",T:12},{no:2,name:"flight_descriptor",kind:"message",T:()=>vi},{no:3,name:"endpoint",kind:"message",repeat:1,T:()=>If},{no:4,name:"total_records",kind:"scalar",T:3,L:0},{no:5,name:"total_bytes",kind:"scalar",T:3,L:0},{no:6,name:"ordered",kind:"scalar",T:8},{no:7,name:"app_metadata",kind:"scalar",T:12}])}},Po=new Mc,Rc=class extends et{constructor(){super("arrow.flight.protocol.PollInfo",[{no:1,name:"info",kind:"message",T:()=>Po},{no:2,name:"flight_descriptor",kind:"message",T:()=>vi},{no:3,name:"progress",kind:"scalar",opt:!0,T:1},{no:4,name:"expiration_time",kind:"message",T:()=>Ic}])}},vp=new Rc,kc=class extends et{constructor(){super("arrow.flight.protocol.FlightEndpoint",[{no:1,name:"ticket",kind:"message",T:()=>jo},{no:2,name:"location",kind:"message",repeat:1,T:()=>Sp},{no:3,name:"expiration_time",kind:"message",T:()=>Ic},{no:4,name:"app_metadata",kind:"scalar",T:12}])}},If=new kc,Cc=class extends et{constructor(){super("arrow.flight.protocol.Location",[{no:1,name:"uri",kind:"scalar",T:9}])}},Sp=new Cc,Vc=class extends et{constructor(){super("arrow.flight.protocol.Ticket",[{no:1,name:"ticket",kind:"scalar",T:12}])}},jo=new Vc,Pc=class extends et{constructor(){super("arrow.flight.protocol.FlightData",[{no:1,name:"flight_descriptor",kind:"message",T:()=>vi},{no:2,name:"data_header",kind:"scalar",T:12},{no:3,name:"app_metadata",kind:"scalar",T:12},{no:1e3,name:"data_body",kind:"scalar",T:12}])}},Vo=new Pc,jc=class extends et{constructor(){super("arrow.flight.protocol.PutResult",[{no:1,name:"app_metadata",kind:"scalar",T:12}])}},xp=new jc,zo=new Ai("arrow.flight.protocol.FlightService",[{name:"Handshake",serverStreaming:!0,clientStreaming:!0,options:{},I:pp,O:mp},{name:"ListFlights",serverStreaming:!0,options:{},I:bp,O:Po},{name:"GetFlightInfo",options:{},I:vi,O:Po},{name:"PollFlightInfo",options:{},I:vi,O:vp},{name:"GetSchema",options:{},I:vi,O:Ip},{name:"DoGet",serverStreaming:!0,options:{},I:jo,O:Vo},{name:"DoPut",serverStreaming:!0,clientStreaming:!0,options:{},I:Vo,O:xp},{name:"DoExchange",serverStreaming:!0,clientStreaming:!0,options:{},I:Vo,O:Vo},{name:"DoAction",serverStreaming:!0,options:{},I:_p,O:wp},{name:"ListActions",serverStreaming:!0,options:{},I:yp,O:gp}]);var Wo=class{constructor(t){this._transport=t;this.typeName=zo.typeName;this.methods=zo.methods;this.options=zo.options}handshake(t){let e=this.methods[0],i=this._transport.mergeOptions(t);return Ht("duplex",this._transport,e,i)}listFlights(t,e){let i=this.methods[1],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}getFlightInfo(t,e){let i=this.methods[2],n=this._transport.mergeOptions(e);return Ht("unary",this._transport,i,n,t)}pollFlightInfo(t,e){let i=this.methods[3],n=this._transport.mergeOptions(e);return Ht("unary",this._transport,i,n,t)}getSchema(t,e){let i=this.methods[4],n=this._transport.mergeOptions(e);return Ht("unary",this._transport,i,n,t)}doGet(t,e){let i=this.methods[5],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}doPut(t){let e=this.methods[6],i=this._transport.mergeOptions(t);return Ht("duplex",this._transport,e,i)}doExchange(t){let e=this.methods[7],i=this._transport.mergeOptions(t);return Ht("duplex",this._transport,e,i)}doAction(t,e){let i=this.methods[8],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}listActions(t,e){let i=this.methods[9],n=this._transport.mergeOptions(e);return Ht("serverStreaming",this._transport,i,n,t)}};var vf=/\$(\w+)/g;function Sf(r){return!!r.match(vf)}function xf(r,t){let e=r.match(vf);if(e)for(let i of e)t[i.trim().replace("$","")]||qr(new Error(`No parameter matching ${i} provided in the query params map`));return!0}var Tp="1.1.0.nightly",Tf=`influxdb3-js/${Tp}`;function zc(r,t){if(t==null)return null;let e=r.metadata.get("iox::column::type");if(!e||r.typeId===f.Timestamp)return t;let[,,i,n]=e.split("::");if(i==="field")switch(n){case"integer":return Kr(t)?parseInt(t):(console.warn(`Value ${t} is not an integer`),t);case"uinteger":return il(t)?parseInt(t):(console.warn(`Value ${t} is not an unsigned integer`),t);case"float":return Kr(t)?parseFloat(t):(console.warn(`Value ${t} is not a float`),t);case"boolean":return typeof t=="boolean"||console.warn(`Value ${t} is not a boolean`),t;case"string":return typeof t=="string"?String(t):(console.warn(`Value ${t} is not a string`),t);default:return t}return t}var Vn=class{constructor(t){this._options=t;this._closed=!1;let{host:e,queryTimeout:i}=this._options;this._defaultHeaders=this._options.headers,this._transport=Mi.queryTransport({host:e,timeout:i}),this._flightClient=new Wo(this._transport)}prepareTicket(t,e,i){let n={database:t,sql_query:e,query_type:i.type};if(i.params){let s={};for(let o of Object.keys(i.params))i.params[o]&&(s[o]=i.params[o]);n.params=s}return jo.create({ticket:new TextEncoder().encode(JSON.stringify(n))})}prepareMetadata(t){let e={"User-Agent":Tf,...this._defaultHeaders,...t},i=this._options.token;return i&&(e.authorization=`Bearer ${i}`),e}async*_queryRawBatches(t,e,i){if(i.params&&Sf(t)&&xf(t,i.params),this._closed)throw new Error("queryApi: already closed!");let n=this._flightClient,s=this.prepareTicket(e,t,i),a={meta:this.prepareMetadata(i.headers)},c=n.doGet(s,a),l=async function*(){for await(let d of c.responses)yield el(d.dataHeader.length),yield d.dataHeader,yield d.dataBody}();yield*await Ut.from(l)}async*query(t,e,i){let n=this._queryRawBatches(t,e,i);for await(let s of n){let o={};for(let a of s){for(let c of s.schema.fields){let l=a[c.name];o[c.name]=zc(c,l)}yield o}}}async*queryPoints(t,e,i){var s;let n=this._queryRawBatches(t,e,i);for await(let o of n)for(let a=0;a<o.numRows;a++){let c=new cr;for(let l=0;l<o.numCols;l++){let u=o.schema.fields[l],d=u.name,p=(s=o.getChildAt(l))==null?void 0:s.get(a),I=u.typeId,_=u.metadata.get("iox::column::type");if(p==null)continue;if((d==="measurement"||d=="iox::measurement")&&typeof p=="string"){c.setMeasurement(p);continue}if(!_){d==="time"&&I===f.Timestamp?c.setTimestamp(p):c.setField(d,p);continue}let[,,X,Y]=_.split("::");if(X==="field"){if(Y&&p!==void 0&&p!==null){let ft=zc(u,p);c.setField(d,ft,Y)}}else X==="tag"?c.setTag(d,p):X==="timestamp"&&c.setTimestamp(p)}yield c}}async close(){var t,e;this._closed=!0,(e=(t=this._transport).close)==null||e.call(t)}};var Wc=`Please specify the 'database' as a method parameter or use default configuration at 'ClientOptions.database'
|
|
17
|
+
`,Pn=class{constructor(...t){this._mergeWriteOptions=t=>{var n;let e={...(n=this._options.writeOptions)==null?void 0:n.headers,...t==null?void 0:t.headers},i={...this._options.writeOptions,...t};return i.headers=e,i};this._mergeQueryOptions=t=>{var s,o;let e={...(s=this._options.queryOptions)==null?void 0:s.headers,...t==null?void 0:t.headers},i={...(o=this._options.queryOptions)==null?void 0:o.params,...t==null?void 0:t.params},n={...this._options.queryOptions,...t};return n.headers=e,n.params=i,n};let e;switch(t.length){case 0:{e=Xo();break}case 1:{if(t[0]==null)throw new ar("No configuration specified!");typeof t[0]=="string"?e=Go(t[0]):e=t[0];break}default:throw new ar("Multiple arguments specified!")}this._options={...qo,...e};let i=this._options.host;if(typeof i!="string")throw new ar("No host specified!");if(i.endsWith("/")&&(this._options.host=i.substring(0,i.length-1)),typeof this._options.token!="string")throw new ar("No token specified!");this._queryApi=new Vn(this._options),this._writeApi=new Ri(this._options)}async write(t,e,i,n){var o;let s=this._mergeWriteOptions(n);await this._writeApi.doWrite(ra(t,s==null?void 0:s.defaultTags),(o=e!=null?e:this._options.database)!=null?o:qr(new Error(Wc)),i,s)}query(t,e,i=(n=>(n=this._options.queryOptions)!=null?n:jn)()){var o;let s=this._mergeQueryOptions(i);return this._queryApi.query(t,(o=e!=null?e:this._options.database)!=null?o:qr(new Error(Wc)),s)}queryPoints(t,e,i=(n=>(n=this._options.queryOptions)!=null?n:jn)()){var o;let s=this._mergeQueryOptions(i);return this._queryApi.queryPoints(t,(o=e!=null?e:this._options.database)!=null?o:qr(new Error(Wc)),s)}async close(){await this._writeApi.close(),await this._queryApi.close()}};return Af(Bp);})();
|
|
18
18
|
//# sourceMappingURL=influxdb.js.map
|