(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=e(r);fetch(r.href,s)}})();function Go(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var $r={exports:{}},x={};/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var J=typeof Symbol=="function"&&Symbol.for,Ri=J?Symbol.for("react.element"):60103,xi=J?Symbol.for("react.portal"):60106,Kn=J?Symbol.for("react.fragment"):60107,Gn=J?Symbol.for("react.strict_mode"):60108,qn=J?Symbol.for("react.profiler"):60114,Zn=J?Symbol.for("react.provider"):60109,Qn=J?Symbol.for("react.context"):60110,Ei=J?Symbol.for("react.async_mode"):60111,Xn=J?Symbol.for("react.concurrent_mode"):60111,ti=J?Symbol.for("react.forward_ref"):60112,ei=J?Symbol.for("react.suspense"):60113,qo=J?Symbol.for("react.suspense_list"):60120,ni=J?Symbol.for("react.memo"):60115,ii=J?Symbol.for("react.lazy"):60116,Zo=J?Symbol.for("react.block"):60121,Qo=J?Symbol.for("react.fundamental"):60117,Xo=J?Symbol.for("react.responder"):60118,ta=J?Symbol.for("react.scope"):60119;function ut(n){if(typeof n=="object"&&n!==null){var t=n.$$typeof;switch(t){case Ri:switch(n=n.type,n){case Ei:case Xn:case Kn:case qn:case Gn:case ei:return n;default:switch(n=n&&n.$$typeof,n){case Qn:case ti:case ii:case ni:case Zn:return n;default:return t}}case xi:return t}}}function Wr(n){return ut(n)===Xn}x.AsyncMode=Ei;x.ConcurrentMode=Xn;x.ContextConsumer=Qn;x.ContextProvider=Zn;x.Element=Ri;x.ForwardRef=ti;x.Fragment=Kn;x.Lazy=ii;x.Memo=ni;x.Portal=xi;x.Profiler=qn;x.StrictMode=Gn;x.Suspense=ei;x.isAsyncMode=function(n){return Wr(n)||ut(n)===Ei};x.isConcurrentMode=Wr;x.isContextConsumer=function(n){return ut(n)===Qn};x.isContextProvider=function(n){return ut(n)===Zn};x.isElement=function(n){return typeof n=="object"&&n!==null&&n.$$typeof===Ri};x.isForwardRef=function(n){return ut(n)===ti};x.isFragment=function(n){return ut(n)===Kn};x.isLazy=function(n){return ut(n)===ii};x.isMemo=function(n){return ut(n)===ni};x.isPortal=function(n){return ut(n)===xi};x.isProfiler=function(n){return ut(n)===qn};x.isStrictMode=function(n){return ut(n)===Gn};x.isSuspense=function(n){return ut(n)===ei};x.isValidElementType=function(n){return typeof n=="string"||typeof n=="function"||n===Kn||n===Xn||n===qn||n===Gn||n===ei||n===qo||typeof n=="object"&&n!==null&&(n.$$typeof===ii||n.$$typeof===ni||n.$$typeof===Zn||n.$$typeof===Qn||n.$$typeof===ti||n.$$typeof===Qo||n.$$typeof===Xo||n.$$typeof===ta||n.$$typeof===Zo)};x.typeOf=ut;$r.exports=x;var ea=$r.exports,Yr=ea,na={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},ia={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Hr={};Hr[Yr.ForwardRef]=na;Hr[Yr.Memo]=ia;var Jr={exports:{}},E={};/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var gr=Object.getOwnPropertySymbols,ra=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable;function oa(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function aa(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var i=Object.getOwnPropertyNames(t).map(function(s){return t[s]});if(i.join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(s){r[s]=s}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var ca=aa()?Object.assign:function(n,t){for(var e,i=oa(n),r,s=1;s<arguments.length;s++){e=Object(arguments[s]);for(var o in e)ra.call(e,o)&&(i[o]=e[o]);if(gr){r=gr(e);for(var a=0;a<r.length;a++)sa.call(e,r[a])&&(i[r[a]]=e[r[a]])}}return i};/** @license React v16.14.0
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ci=ca,gt=typeof Symbol=="function"&&Symbol.for,Qe=gt?Symbol.for("react.element"):60103,la=gt?Symbol.for("react.portal"):60106,ua=gt?Symbol.for("react.fragment"):60107,ha=gt?Symbol.for("react.strict_mode"):60108,da=gt?Symbol.for("react.profiler"):60114,fa=gt?Symbol.for("react.provider"):60109,pa=gt?Symbol.for("react.context"):60110,ya=gt?Symbol.for("react.forward_ref"):60112,ma=gt?Symbol.for("react.suspense"):60113,ba=gt?Symbol.for("react.memo"):60115,ga=gt?Symbol.for("react.lazy"):60116,_r=typeof Symbol=="function"&&Symbol.iterator;function Xe(n){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+n,e=1;e<arguments.length;e++)t+="&args[]="+encodeURIComponent(arguments[e]);return"Minified React error #"+n+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Kr={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Gr={};function Ee(n,t,e){this.props=n,this.context=t,this.refs=Gr,this.updater=e||Kr}Ee.prototype.isReactComponent={};Ee.prototype.setState=function(n,t){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error(Xe(85));this.updater.enqueueSetState(this,n,t,"setState")};Ee.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function qr(){}qr.prototype=Ee.prototype;function Vi(n,t,e){this.props=n,this.context=t,this.refs=Gr,this.updater=e||Kr}var Pi=Vi.prototype=new qr;Pi.constructor=Vi;Ci(Pi,Ee.prototype);Pi.isPureReactComponent=!0;var ki={current:null},Zr=Object.prototype.hasOwnProperty,Qr={key:!0,ref:!0,__self:!0,__source:!0};function Xr(n,t,e){var i,r={},s=null,o=null;if(t!=null)for(i in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)Zr.call(t,i)&&!Qr.hasOwnProperty(i)&&(r[i]=t[i]);var a=arguments.length-2;if(a===1)r.children=e;else if(1<a){for(var c=Array(a),u=0;u<a;u++)c[u]=arguments[u+2];r.children=c}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);return{$$typeof:Qe,type:n,key:s,ref:o,props:r,_owner:ki.current}}function _a(n,t){return{$$typeof:Qe,type:n.type,key:t,ref:n.ref,props:n.props,_owner:n._owner}}function ji(n){return typeof n=="object"&&n!==null&&n.$$typeof===Qe}function va(n){var t={"=":"=0",":":"=2"};return"$"+(""+n).replace(/[=:]/g,function(e){return t[e]})}var ts=/\/+/g,gn=[];function es(n,t,e,i){if(gn.length){var r=gn.pop();return r.result=n,r.keyPrefix=t,r.func=e,r.context=i,r.count=0,r}return{result:n,keyPrefix:t,func:e,context:i,count:0}}function ns(n){n.result=null,n.keyPrefix=null,n.func=null,n.context=null,n.count=0,10>gn.length&&gn.push(n)}function bi(n,t,e,i){var r=typeof n;(r==="undefined"||r==="boolean")&&(n=null);var s=!1;if(n===null)s=!0;else switch(r){case"string":case"number":s=!0;break;case"object":switch(n.$$typeof){case Qe:case la:s=!0}}if(s)return e(i,n,t===""?"."+li(n,0):t),1;if(s=0,t=t===""?".":t+":",Array.isArray(n))for(var o=0;o<n.length;o++){r=n[o];var a=t+li(r,o);s+=bi(r,a,e,i)}else if(n===null||typeof n!="object"?a=null:(a=_r&&n[_r]||n["@@iterator"],a=typeof a=="function"?a:null),typeof a=="function")for(n=a.call(n),o=0;!(r=n.next()).done;)r=r.value,a=t+li(r,o++),s+=bi(r,a,e,i);else if(r==="object")throw e=""+n,Error(Xe(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e,""));return s}function gi(n,t,e){return n==null?0:bi(n,"",t,e)}function li(n,t){return typeof n=="object"&&n!==null&&n.key!=null?va(n.key):t.toString(36)}function wa(n,t){n.func.call(n.context,t,n.count++)}function Sa(n,t,e){var i=n.result,r=n.keyPrefix;n=n.func.call(n.context,t,n.count++),Array.isArray(n)?_i(n,i,e,function(s){return s}):n!=null&&(ji(n)&&(n=_a(n,r+(!n.key||t&&t.key===n.key?"":(""+n.key).replace(ts,"$&/")+"/")+e)),i.push(n))}function _i(n,t,e,i,r){var s="";e!=null&&(s=(""+e).replace(ts,"$&/")+"/"),t=es(t,s,i,r),gi(n,Sa,t),ns(t)}var is={current:null};function $t(){var n=is.current;if(n===null)throw Error(Xe(321));return n}var Ia={ReactCurrentDispatcher:is,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:ki,IsSomeRendererActing:{current:!1},assign:Ci};E.Children={map:function(n,t,e){if(n==null)return n;var i=[];return _i(n,i,null,t,e),i},forEach:function(n,t,e){if(n==null)return n;t=es(null,null,t,e),gi(n,wa,t),ns(t)},count:function(n){return gi(n,function(){return null},null)},toArray:function(n){var t=[];return _i(n,t,null,function(e){return e}),t},only:function(n){if(!ji(n))throw Error(Xe(143));return n}};E.Component=Ee;E.Fragment=ua;E.Profiler=da;E.PureComponent=Vi;E.StrictMode=ha;E.Suspense=ma;E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ia;E.cloneElement=function(n,t,e){if(n==null)throw Error(Xe(267,n));var i=Ci({},n.props),r=n.key,s=n.ref,o=n._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=ki.current),t.key!==void 0&&(r=""+t.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(c in t)Zr.call(t,c)&&!Qr.hasOwnProperty(c)&&(i[c]=t[c]===void 0&&a!==void 0?a[c]:t[c])}var c=arguments.length-2;if(c===1)i.children=e;else if(1<c){a=Array(c);for(var u=0;u<c;u++)a[u]=arguments[u+2];i.children=a}return{$$typeof:Qe,type:n.type,key:r,ref:s,props:i,_owner:o}};E.createContext=function(n,t){return t===void 0&&(t=null),n={$$typeof:pa,_calculateChangedBits:t,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null},n.Provider={$$typeof:fa,_context:n},n.Consumer=n};E.createElement=Xr;E.createFactory=function(n){var t=Xr.bind(null,n);return t.type=n,t};E.createRef=function(){return{current:null}};E.forwardRef=function(n){return{$$typeof:ya,render:n}};E.isValidElement=ji;E.lazy=function(n){return{$$typeof:ga,_ctor:n,_status:-1,_result:null}};E.memo=function(n,t){return{$$typeof:ba,type:n,compare:t===void 0?null:t}};E.useCallback=function(n,t){return $t().useCallback(n,t)};E.useContext=function(n,t){return $t().useContext(n,t)};E.useDebugValue=function(){};E.useEffect=function(n,t){return $t().useEffect(n,t)};E.useImperativeHandle=function(n,t,e){return $t().useImperativeHandle(n,t,e)};E.useLayoutEffect=function(n,t){return $t().useLayoutEffect(n,t)};E.useMemo=function(n,t){return $t().useMemo(n,t)};E.useReducer=function(n,t,e){return $t().useReducer(n,t,e)};E.useRef=function(n){return $t().useRef(n)};E.useState=function(n){return $t().useState(n)};E.version="16.14.0";Jr.exports=E;var Ba=Jr.exports;const Aa=Go(Ba);function p(n,t,e,i){function r(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(h){try{u(i.next(h))}catch(d){o(d)}}function c(h){try{u(i.throw(h))}catch(d){o(d)}}function u(h){h.done?s(h.value):r(h.value).then(a,c)}u((i=i.apply(n,t||[])).next())})}function vr(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],i=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(n){return this instanceof B?(this.v=n,this):new B(n)}function Tt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=e.apply(n,t||[]),r,s=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),r[Symbol.asyncIterator]=function(){return this},r;function o(f){return function($){return Promise.resolve($).then(f,d)}}function a(f,$){i[f]&&(r[f]=function(be){return new Promise(function(ci,Ht){s.push([f,be,ci,Ht])>1||c(f,be)})},$&&(r[f]=$(r[f])))}function c(f,$){try{u(i[f]($))}catch(be){A(s[0][3],be)}}function u(f){f.value instanceof B?Promise.resolve(f.value.v).then(h,d):A(s[0][2],f)}function h(f){c("next",f)}function d(f){c("throw",f)}function A(f,$){f($),s.shift(),s.length&&c(s[0][0],s[0][1])}}function hn(n){var t,e;return t={},i("next"),i("throw",function(r){throw r}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(r,s){t[r]=n[r]?function(o){return(e=!e)?{value:B(n[r](o)),done:!1}:s?s(o):o}:s}}function fe(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof vr=="function"?vr(n):n[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(s){e[s]=n[s]&&function(o){return new Promise(function(a,c){o=n[s](o),r(a,c,o.done,o.value)})}}function r(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}const Oa=new TextDecoder("utf-8"),vi=n=>Oa.decode(n),Fa=new TextEncoder,zi=n=>Fa.encode(n),[yu,Da]=(()=>{const n=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw n()}return t.asIntN=()=>{throw n()},t.asUintN=()=>{throw n()},typeof BigInt<"u"?[BigInt,!0]:[t,!1]})(),[tn,mu]=(()=>{const n=()=>{throw new Error("BigInt64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw n()}static from(){throw n()}constructor(){throw n()}}return typeof BigInt64Array<"u"?[BigInt64Array,!0]:[t,!1]})(),[en,bu]=(()=>{const n=()=>{throw new Error("BigUint64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw n()}static from(){throw n()}constructor(){throw n()}}return typeof BigUint64Array<"u"?[BigUint64Array,!0]:[t,!1]})(),Ta=n=>typeof n=="number",rs=n=>typeof n=="boolean",Y=n=>typeof n=="function",nt=n=>n!=null&&Object(n)===n,qt=n=>nt(n)&&Y(n.then),nn=n=>nt(n)&&Y(n[Symbol.iterator]),Ce=n=>nt(n)&&Y(n[Symbol.asyncIterator]),wi=n=>nt(n)&&nt(n.schema),ss=n=>nt(n)&&"done"in n&&"value"in n,os=n=>nt(n)&&Y(n.stat)&&Ta(n.fd),as=n=>nt(n)&&$i(n.body),ri=n=>"_getDOMStream"in n&&"_getNodeStream"in n,Ma=n=>nt(n)&&Y(n.abort)&&Y(n.getWriter)&&!ri(n),$i=n=>nt(n)&&Y(n.cancel)&&Y(n.getReader)&&!ri(n),Na=n=>nt(n)&&Y(n.end)&&Y(n.write)&&rs(n.writable)&&!ri(n),cs=n=>nt(n)&&Y(n.read)&&Y(n.pipe)&&rs(n.readable)&&!ri(n),La=n=>nt(n)&&Y(n.clear)&&Y(n.bytes)&&Y(n.position)&&Y(n.setPosition)&&Y(n.capacity)&&Y(n.getBufferIdentifier)&&Y(n.createLong),Wi=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ua(n){const t=n[0]?[n[0]]:[];let e,i,r,s;for(let o,a,c=0,u=0,h=n.length;++c<h;){if(o=t[u],a=n[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++u]=a);continue}if({byteOffset:e,byteLength:r}=o,{byteOffset:i,byteLength:s}=a,e+r<i||i+s<e){a&&(t[++u]=a);continue}t[u]=new Uint8Array(o.buffer,e,i-e+s)}return t}function wr(n,t,e=0,i=t.byteLength){const r=n.byteLength,s=new Uint8Array(n.buffer,n.byteOffset,r),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,r));return s.set(o,e),n}function Nt(n,t){const e=Ua(n),i=e.reduce((h,d)=>h+d.byteLength,0);let r,s,o,a=0,c=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,i);for(const h=e.length;++c<h;){if(r=e[c],s=r.subarray(0,Math.min(r.length,u-a)),u<=a+s.length){s.length<r.length?e[c]=r.subarray(s.length):s.length===r.length&&c++,o?wr(o,s,a):o=s;break}wr(o||(o=new Uint8Array(u)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),i-(o?o.byteLength:0)]}function C(n,t){let e=ss(t)?t.value:t;return e instanceof n?n===Uint8Array?new n(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=zi(e)),e instanceof ArrayBuffer?new n(e):e instanceof Wi?new n(e):La(e)?C(n,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new n(0):new n(e.buffer,e.byteOffset,e.byteLength/n.BYTES_PER_ELEMENT):n.from(e)):new n(0)}const Pe=n=>C(Int32Array,n),T=n=>C(Uint8Array,n),Si=n=>(n.next(),n);function*Ra(n,t){const e=function*(r){yield r},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Wi?e(t):nn(t)?t:e(t);return yield*Si(function*(r){let s=null;do s=r.next(yield C(n,s));while(!s.done)}(i[Symbol.iterator]())),new n}const xa=n=>Ra(Uint8Array,n);function ls(n,t){return Tt(this,arguments,function*(){if(qt(t))return yield B(yield B(yield*hn(fe(ls(n,yield B(t))))));const i=function(o){return Tt(this,arguments,function*(){yield yield B(yield B(o))})},r=function(o){return Tt(this,arguments,function*(){yield B(yield*hn(fe(Si(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 Wi?i(t):nn(t)?r(t):Ce(t)?t:i(t);return yield B(yield*hn(fe(Si(function(o){return Tt(this,arguments,function*(){let a=null;do a=yield B(o.next(yield yield B(C(n,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield B(new n)})}const Ea=n=>ls(Uint8Array,n);function Yi(n,t,e){if(n!==0){e=e.slice(0,t+1);for(let i=-1;++i<=t;)e[i]+=n}return e}function Ca(n,t){let e=0;const i=n.length;if(i!==t.length)return!1;if(i>0)do if(n[e]!==t[e])return!1;while(++e<i);return!0}const dt={fromIterable(n){return cn(Va(n))},fromAsyncIterable(n){return cn(Pa(n))},fromDOMStream(n){return cn(ka(n))},fromNodeStream(n){return cn(za(n))},toDOMStream(n,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(n,t){throw new Error('"toNodeStream" not available in this environment')}},cn=n=>(n.next(),n);function*Va(n){let t,e=!1,i=[],r,s,o,a=0;function c(){return s==="peek"?Nt(i,o)[0]:([r,i,a]=Nt(i,o),r)}({cmd:s,size:o}=yield null);const u=xa(n)[Symbol.iterator]();try{do if({done:t,value:r}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&r.byteLength>0&&(i.push(r),a+=r.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(h){(e=!0)&&typeof u.throw=="function"&&u.throw(h)}finally{e===!1&&typeof u.return=="function"&&u.return(null)}return null}function Pa(n){return Tt(this,arguments,function*(){let e,i=!1,r=[],s,o,a,c=0;function u(){return o==="peek"?Nt(r,a)[0]:([s,r,c]=Nt(r,a),s)}({cmd:o,size:a}=yield yield B(null));const h=Ea(n)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield B(h.next()):yield B(h.next(a-c)),!e&&s.byteLength>0&&(r.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield B(u()));while(a<c);while(!e)}catch(d){(i=!0)&&typeof h.throw=="function"&&(yield B(h.throw(d)))}finally{i===!1&&typeof h.return=="function"&&(yield B(h.return(new Uint8Array(0))))}return yield B(null)})}function ka(n){return Tt(this,arguments,function*(){let e=!1,i=!1,r=[],s,o,a,c=0;function u(){return o==="peek"?Nt(r,a)[0]:([s,r,c]=Nt(r,a),s)}({cmd:o,size:a}=yield yield B(null));const h=new ja(n);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield B(h.read()):yield B(h.read(a-c)),!e&&s.byteLength>0&&(r.push(T(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield B(u()));while(a<c);while(!e)}catch(d){(i=!0)&&(yield B(h.cancel(d)))}finally{i===!1?yield B(h.cancel()):n.locked&&h.releaseLock()}return yield B(null)})}class ja{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 p(this,void 0,void 0,function*(){const{reader:e,source:i}=this;e&&(yield e.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return p(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=T(e)),e})}}const ui=(n,t)=>{const e=r=>i([t,r]);let i;return[t,e,new Promise(r=>(i=r)&&n.once(t,e))]};function za(n){return Tt(this,arguments,function*(){const e=[];let i="error",r=!1,s=null,o,a,c=0,u=[],h;function d(){return o==="peek"?Nt(u,a)[0]:([h,u,c]=Nt(u,a),h)}if({cmd:o,size:a}=yield yield B(null),n.isTTY)return yield yield B(new Uint8Array(0)),yield B(null);try{e[0]=ui(n,"end"),e[1]=ui(n,"error");do{if(e[2]=ui(n,"readable"),[i,s]=yield B(Promise.race(e.map(f=>f[2]))),i==="error")break;if((r=i==="end")||(Number.isFinite(a-c)?(h=T(n.read(a-c)),h.byteLength<a-c&&(h=T(n.read()))):h=T(n.read()),h.byteLength>0&&(u.push(h),c+=h.byteLength)),r||a<=c)do({cmd:o,size:a}=yield yield B(d()));while(a<c)}while(!r)}finally{yield B(A(e,i==="error"?s:null))}return yield B(null);function A(f,$){return h=u=null,new Promise((be,ci)=>{for(const[Ht,Ko]of f)n.off(Ht,Ko);try{const Ht=n.destroy;Ht&&Ht.call(n,$),$=void 0}catch(Ht){$=Ht||$}finally{$!=null?ci($):be()}})}})}var at;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(at||(at={}));var ct;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(ct||(ct={}));var et;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(et||(et={}));var zt;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(zt||(zt={}));var M;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(M||(M={}));var Zt;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Zt||(Zt={}));var N;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(N||(N={}));var l;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.Float=3]="Float",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct=13]="Struct",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Dictionary=-1]="Dictionary",n[n.Int8=-2]="Int8",n[n.Int16=-3]="Int16",n[n.Int32=-4]="Int32",n[n.Int64=-5]="Int64",n[n.Uint8=-6]="Uint8",n[n.Uint16=-7]="Uint16",n[n.Uint32=-8]="Uint32",n[n.Uint64=-9]="Uint64",n[n.Float16=-10]="Float16",n[n.Float32=-11]="Float32",n[n.Float64=-12]="Float64",n[n.DateDay=-13]="DateDay",n[n.DateMillisecond=-14]="DateMillisecond",n[n.TimestampSecond=-15]="TimestampSecond",n[n.TimestampMillisecond=-16]="TimestampMillisecond",n[n.TimestampMicrosecond=-17]="TimestampMicrosecond",n[n.TimestampNanosecond=-18]="TimestampNanosecond",n[n.TimeSecond=-19]="TimeSecond",n[n.TimeMillisecond=-20]="TimeMillisecond",n[n.TimeMicrosecond=-21]="TimeMicrosecond",n[n.TimeNanosecond=-22]="TimeNanosecond",n[n.DenseUnion=-23]="DenseUnion",n[n.SparseUnion=-24]="SparseUnion",n[n.IntervalDayTime=-25]="IntervalDayTime",n[n.IntervalYearMonth=-26]="IntervalYearMonth"})(l||(l={}));var xt;(function(n){n[n.OFFSET=0]="OFFSET",n[n.DATA=1]="DATA",n[n.VALIDITY=2]="VALIDITY",n[n.TYPE=3]="TYPE"})(xt||(xt={}));const $a=void 0;function Ye(n){if(n===null)return"null";if(n===$a)return"undefined";switch(typeof n){case"number":return`${n}`;case"bigint":return`${n}`;case"string":return`"${n}"`}return typeof n[Symbol.toPrimitive]=="function"?n[Symbol.toPrimitive]("string"):ArrayBuffer.isView(n)?n instanceof tn||n instanceof en?`[${[...n].map(t=>Ye(t))}]`:`[${n}]`:ArrayBuffer.isView(n)?`[${n}]`:JSON.stringify(n,(t,e)=>typeof e=="bigint"?`${e}`:e)}const Wa=Symbol.for("isArrowBigNum");function _t(n,...t){return t.length===0?Object.setPrototypeOf(C(this.TypedArray,n),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(n,...t),this.constructor.prototype)}_t.prototype[Wa]=!0;_t.prototype.toJSON=function(){return`"${pe(this)}"`};_t.prototype.valueOf=function(){return us(this)};_t.prototype.toString=function(){return pe(this)};_t.prototype[Symbol.toPrimitive]=function(n="default"){switch(n){case"number":return us(this);case"string":return pe(this);case"default":return Ii(this)}return pe(this)};function Be(...n){return _t.apply(this,n)}function Ae(...n){return _t.apply(this,n)}function He(...n){return _t.apply(this,n)}Object.setPrototypeOf(Be.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Ae.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(He.prototype,Object.create(Uint32Array.prototype));Object.assign(Be.prototype,_t.prototype,{constructor:Be,signed:!0,TypedArray:Int32Array,BigIntArray:tn});Object.assign(Ae.prototype,_t.prototype,{constructor:Ae,signed:!1,TypedArray:Uint32Array,BigIntArray:en});Object.assign(He.prototype,_t.prototype,{constructor:He,signed:!0,TypedArray:Uint32Array,BigIntArray:en});function us(n){const{buffer:t,byteOffset:e,length:i,signed:r}=n,s=new en(t,e,i),o=r&&s[s.length-1]&BigInt(1)<<BigInt(63);let a=BigInt(o?1:0),c=BigInt(0);if(o){for(const u of s)a+=~u*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(const u of s)a+=u*(BigInt(1)<<BigInt(32)*c++);return a}let pe,Ii;Da?(Ii=n=>n.byteLength===8?new n.BigIntArray(n.buffer,n.byteOffset,1)[0]:hi(n),pe=n=>n.byteLength===8?`${new n.BigIntArray(n.buffer,n.byteOffset,1)[0]}`:hi(n)):(pe=hi,Ii=pe);function hi(n){let t="";const e=new Uint32Array(2);let i=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);const r=new Uint32Array((i=new Uint16Array(i).reverse()).buffer);let s=-1;const 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(r[0]||r[1]||r[2]||r[3]);return t??"0"}class Hi{static new(t,e){switch(e){case!0:return new Be(t);case!1:return new Ae(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case tn:return new Be(t)}return t.byteLength===16?new He(t):new Ae(t)}static signed(t){return new Be(t)}static unsigned(t){return new Ae(t)}static decimal(t){return new He(t)}constructor(t,e){return Hi.new(t,e)}}var hs,ds,fs,ps,ys,ms,bs,gs,_s,vs,ws,Ss,Is,Bs,As,Os,Fs,Ds,Ts;class y{static isNull(t){return(t==null?void 0:t.typeId)===l.Null}static isInt(t){return(t==null?void 0:t.typeId)===l.Int}static isFloat(t){return(t==null?void 0:t.typeId)===l.Float}static isBinary(t){return(t==null?void 0:t.typeId)===l.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===l.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===l.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===l.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===l.Date}static isTime(t){return(t==null?void 0:t.typeId)===l.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===l.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===l.Interval}static isList(t){return(t==null?void 0:t.typeId)===l.List}static isStruct(t){return(t==null?void 0:t.typeId)===l.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===l.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===l.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===l.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===l.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===l.Dictionary}static isDenseUnion(t){return y.isUnion(t)&&t.mode===ct.Dense}static isSparseUnion(t){return y.isUnion(t)&&t.mode===ct.Sparse}get typeId(){return l.NONE}}hs=Symbol.toStringTag;y[hs]=(n=>(n.children=null,n.ArrayType=Array,n[Symbol.toStringTag]="DataType"))(y.prototype);let Qt=class extends y{toString(){return"Null"}get typeId(){return l.Null}};ds=Symbol.toStringTag;Qt[ds]=(n=>n[Symbol.toStringTag]="Null")(Qt.prototype);class Xt extends y{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return l.Int}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?tn:en}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}fs=Symbol.toStringTag;Xt[fs]=(n=>(n.isSigned=null,n.bitWidth=null,n[Symbol.toStringTag]="Int"))(Xt.prototype);class Je extends Xt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Je.prototype,"ArrayType",{value:Int32Array});class Ke extends y{constructor(t){super(),this.precision=t}get typeId(){return l.Float}get ArrayType(){switch(this.precision){case et.HALF:return Uint16Array;case et.SINGLE:return Float32Array;case et.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}ps=Symbol.toStringTag;Ke[ps]=(n=>(n.precision=null,n[Symbol.toStringTag]="Float"))(Ke.prototype);let _n=class extends y{constructor(){super()}get typeId(){return l.Binary}toString(){return"Binary"}};ys=Symbol.toStringTag;_n[ys]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Binary"))(_n.prototype);let vn=class extends y{constructor(){super()}get typeId(){return l.Utf8}toString(){return"Utf8"}};ms=Symbol.toStringTag;vn[ms]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Utf8"))(vn.prototype);let wn=class extends y{constructor(){super()}get typeId(){return l.Bool}toString(){return"Bool"}};bs=Symbol.toStringTag;wn[bs]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Bool"))(wn.prototype);let Sn=class extends y{constructor(t,e,i=128){super(),this.scale=t,this.precision=e,this.bitWidth=i}get typeId(){return l.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};gs=Symbol.toStringTag;Sn[gs]=(n=>(n.scale=null,n.precision=null,n.ArrayType=Uint32Array,n[Symbol.toStringTag]="Decimal"))(Sn.prototype);class In extends y{constructor(t){super(),this.unit=t}get typeId(){return l.Date}toString(){return`Date${(this.unit+1)*32}<${zt[this.unit]}>`}}_s=Symbol.toStringTag;In[_s]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Date"))(In.prototype);class Ge extends y{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return l.Time}toString(){return`Time${this.bitWidth}<${M[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return tn}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}vs=Symbol.toStringTag;Ge[vs]=(n=>(n.unit=null,n.bitWidth=null,n[Symbol.toStringTag]="Time"))(Ge.prototype);class Bn extends y{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return l.Timestamp}toString(){return`Timestamp<${M[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ws=Symbol.toStringTag;Bn[ws]=(n=>(n.unit=null,n.timezone=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Timestamp"))(Bn.prototype);class An extends y{constructor(t){super(),this.unit=t}get typeId(){return l.Interval}toString(){return`Interval<${Zt[this.unit]}>`}}Ss=Symbol.toStringTag;An[Ss]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Interval"))(An.prototype);let On=class extends y{constructor(t){super(),this.children=[t]}get typeId(){return l.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Is=Symbol.toStringTag;On[Is]=(n=>(n.children=null,n[Symbol.toStringTag]="List"))(On.prototype);class G extends y{constructor(t){super(),this.children=t}get typeId(){return l.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Bs=Symbol.toStringTag;G[Bs]=(n=>(n.children=null,n[Symbol.toStringTag]="Struct"))(G.prototype);class Fn extends y{constructor(t,e,i){super(),this.mode=t,this.children=i,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((r,s,o)=>(r[s]=o)&&r||r,Object.create(null))}get typeId(){return l.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}As=Symbol.toStringTag;Fn[As]=(n=>(n.mode=null,n.typeIds=null,n.children=null,n.typeIdToChildIndex=null,n.ArrayType=Int8Array,n[Symbol.toStringTag]="Union"))(Fn.prototype);let Dn=class extends y{constructor(t){super(),this.byteWidth=t}get typeId(){return l.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Os=Symbol.toStringTag;Dn[Os]=(n=>(n.byteWidth=null,n.ArrayType=Uint8Array,n[Symbol.toStringTag]="FixedSizeBinary"))(Dn.prototype);let Tn=class extends y{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return l.FixedSizeList}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}>`}};Fs=Symbol.toStringTag;Tn[Fs]=(n=>(n.children=null,n.listSize=null,n[Symbol.toStringTag]="FixedSizeList"))(Tn.prototype);class Mn extends y{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return l.Map}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(", ")}}>`}}Ds=Symbol.toStringTag;Mn[Ds]=(n=>(n.children=null,n.keysSorted=null,n[Symbol.toStringTag]="Map_"))(Mn.prototype);const Ya=(n=>()=>++n)(-1);class Te extends y{constructor(t,e,i,r){super(),this.indices=e,this.dictionary=t,this.isOrdered=r||!1,this.id=i==null?Ya():typeof i=="number"?i:i.low}get typeId(){return l.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Ts=Symbol.toStringTag;Te[Ts]=(n=>(n.id=null,n.indices=null,n.isOrdered=null,n.dictionary=null,n[Symbol.toStringTag]="Dictionary"))(Te.prototype);function Et(n){const t=n;switch(n.typeId){case l.Decimal:return n.bitWidth/32;case l.Timestamp:return 2;case l.Date:return 1+t.unit;case l.Interval:return 1+t.unit;case l.FixedSizeList:return t.listSize;case l.FixedSizeBinary:return t.byteWidth;default:return 1}}class D{visitMany(t,...e){return t.map((i,r)=>this.visit(i,...e.map(s=>s[r])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Ha(this,t,e)}getVisitFnByTypeId(t,e=!0){return _e(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}visitBinary(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}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Ha(n,t,e=!0){return typeof t=="number"?_e(n,t,e):typeof t=="string"&&t in l?_e(n,l[t],e):t&&t instanceof y?_e(n,Sr(t),e):t!=null&&t.type&&t.type instanceof y?_e(n,Sr(t.type),e):_e(n,l.NONE,e)}function _e(n,t,e=!0){let i=null;switch(t){case l.Null:i=n.visitNull;break;case l.Bool:i=n.visitBool;break;case l.Int:i=n.visitInt;break;case l.Int8:i=n.visitInt8||n.visitInt;break;case l.Int16:i=n.visitInt16||n.visitInt;break;case l.Int32:i=n.visitInt32||n.visitInt;break;case l.Int64:i=n.visitInt64||n.visitInt;break;case l.Uint8:i=n.visitUint8||n.visitInt;break;case l.Uint16:i=n.visitUint16||n.visitInt;break;case l.Uint32:i=n.visitUint32||n.visitInt;break;case l.Uint64:i=n.visitUint64||n.visitInt;break;case l.Float:i=n.visitFloat;break;case l.Float16:i=n.visitFloat16||n.visitFloat;break;case l.Float32:i=n.visitFloat32||n.visitFloat;break;case l.Float64:i=n.visitFloat64||n.visitFloat;break;case l.Utf8:i=n.visitUtf8;break;case l.Binary:i=n.visitBinary;break;case l.FixedSizeBinary:i=n.visitFixedSizeBinary;break;case l.Date:i=n.visitDate;break;case l.DateDay:i=n.visitDateDay||n.visitDate;break;case l.DateMillisecond:i=n.visitDateMillisecond||n.visitDate;break;case l.Timestamp:i=n.visitTimestamp;break;case l.TimestampSecond:i=n.visitTimestampSecond||n.visitTimestamp;break;case l.TimestampMillisecond:i=n.visitTimestampMillisecond||n.visitTimestamp;break;case l.TimestampMicrosecond:i=n.visitTimestampMicrosecond||n.visitTimestamp;break;case l.TimestampNanosecond:i=n.visitTimestampNanosecond||n.visitTimestamp;break;case l.Time:i=n.visitTime;break;case l.TimeSecond:i=n.visitTimeSecond||n.visitTime;break;case l.TimeMillisecond:i=n.visitTimeMillisecond||n.visitTime;break;case l.TimeMicrosecond:i=n.visitTimeMicrosecond||n.visitTime;break;case l.TimeNanosecond:i=n.visitTimeNanosecond||n.visitTime;break;case l.Decimal:i=n.visitDecimal;break;case l.List:i=n.visitList;break;case l.Struct:i=n.visitStruct;break;case l.Union:i=n.visitUnion;break;case l.DenseUnion:i=n.visitDenseUnion||n.visitUnion;break;case l.SparseUnion:i=n.visitSparseUnion||n.visitUnion;break;case l.Dictionary:i=n.visitDictionary;break;case l.Interval:i=n.visitInterval;break;case l.IntervalDayTime:i=n.visitIntervalDayTime||n.visitInterval;break;case l.IntervalYearMonth:i=n.visitIntervalYearMonth||n.visitInterval;break;case l.FixedSizeList:i=n.visitFixedSizeList;break;case l.Map:i=n.visitMap;break}if(typeof i=="function")return i;if(!e)return()=>null;throw new Error(`Unrecognized type '${l[t]}'`)}function Sr(n){switch(n.typeId){case l.Null:return l.Null;case l.Int:{const{bitWidth:t,isSigned:e}=n;switch(t){case 8:return e?l.Int8:l.Uint8;case 16:return e?l.Int16:l.Uint16;case 32:return e?l.Int32:l.Uint32;case 64:return e?l.Int64:l.Uint64}return l.Int}case l.Float:switch(n.precision){case et.HALF:return l.Float16;case et.SINGLE:return l.Float32;case et.DOUBLE:return l.Float64}return l.Float;case l.Binary:return l.Binary;case l.Utf8:return l.Utf8;case l.Bool:return l.Bool;case l.Decimal:return l.Decimal;case l.Time:switch(n.unit){case M.SECOND:return l.TimeSecond;case M.MILLISECOND:return l.TimeMillisecond;case M.MICROSECOND:return l.TimeMicrosecond;case M.NANOSECOND:return l.TimeNanosecond}return l.Time;case l.Timestamp:switch(n.unit){case M.SECOND:return l.TimestampSecond;case M.MILLISECOND:return l.TimestampMillisecond;case M.MICROSECOND:return l.TimestampMicrosecond;case M.NANOSECOND:return l.TimestampNanosecond}return l.Timestamp;case l.Date:switch(n.unit){case zt.DAY:return l.DateDay;case zt.MILLISECOND:return l.DateMillisecond}return l.Date;case l.Interval:switch(n.unit){case Zt.DAY_TIME:return l.IntervalDayTime;case Zt.YEAR_MONTH:return l.IntervalYearMonth}return l.Interval;case l.Map:return l.Map;case l.List:return l.List;case l.Struct:return l.Struct;case l.Union:switch(n.mode){case ct.Dense:return l.DenseUnion;case ct.Sparse:return l.SparseUnion}return l.Union;case l.FixedSizeBinary:return l.FixedSizeBinary;case l.FixedSizeList:return l.FixedSizeList;case l.Dictionary:return l.Dictionary}throw new Error(`Unrecognized type '${l[n.typeId]}'`)}D.prototype.visitInt8=null;D.prototype.visitInt16=null;D.prototype.visitInt32=null;D.prototype.visitInt64=null;D.prototype.visitUint8=null;D.prototype.visitUint16=null;D.prototype.visitUint32=null;D.prototype.visitUint64=null;D.prototype.visitFloat16=null;D.prototype.visitFloat32=null;D.prototype.visitFloat64=null;D.prototype.visitDateDay=null;D.prototype.visitDateMillisecond=null;D.prototype.visitTimestampSecond=null;D.prototype.visitTimestampMillisecond=null;D.prototype.visitTimestampMicrosecond=null;D.prototype.visitTimestampNanosecond=null;D.prototype.visitTimeSecond=null;D.prototype.visitTimeMillisecond=null;D.prototype.visitTimeMicrosecond=null;D.prototype.visitTimeNanosecond=null;D.prototype.visitDenseUnion=null;D.prototype.visitSparseUnion=null;D.prototype.visitIntervalDayTime=null;D.prototype.visitIntervalYearMonth=null;const Ms=new Float64Array(1),ge=new Uint32Array(Ms.buffer);function Ns(n){const t=(n&31744)>>10,e=(n&1023)/1024,i=Math.pow(-1,(n&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 Ja(n){if(n!==n)return 32256;Ms[0]=n;const t=(ge[1]&2147483648)>>16&65535;let e=ge[1]&2146435072,i=0;return e>=1089470464?ge[0]>0?e=31744:(e=(e&2080374784)>>16,i=(ge[1]&1048575)>>10):e<=1056964608?(i=1048576+(ge[1]&1048575),i=1048576+(i<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,i=(ge[1]&1048575)+512>>10),t|e|i&65535}class v extends D{}function I(n){return(t,e,i)=>{if(t.setValid(e,i!=null))return n(t,e,i)}}const Ka=(n,t,e)=>{n[t]=Math.trunc(e/864e5)},Ji=(n,t,e)=>{n[t]=Math.trunc(e%4294967296),n[t+1]=Math.trunc(e/4294967296)},Ga=(n,t,e)=>{n[t]=Math.trunc(e*1e3%4294967296),n[t+1]=Math.trunc(e*1e3/4294967296)},qa=(n,t,e)=>{n[t]=Math.trunc(e*1e6%4294967296),n[t+1]=Math.trunc(e*1e6/4294967296)},Ls=(n,t,e,i)=>{if(e+1<t.length){const{[e]:r,[e+1]:s}=t;n.set(i.subarray(0,s-r),r)}},Za=({offset:n,values:t},e,i)=>{const r=n+e;i?t[r>>3]|=1<<r%8:t[r>>3]&=~(1<<r%8)},Wt=({values:n},t,e)=>{n[t]=e},Ki=({values:n},t,e)=>{n[t]=e},Us=({values:n},t,e)=>{n[t]=Ja(e)},Qa=(n,t,e)=>{switch(n.type.precision){case et.HALF:return Us(n,t,e);case et.SINGLE:case et.DOUBLE:return Ki(n,t,e)}},Rs=({values:n},t,e)=>{Ka(n,t,e.valueOf())},xs=({values:n},t,e)=>{Ji(n,t*2,e.valueOf())},Xa=({stride:n,values:t},e,i)=>{t.set(i.subarray(0,n),n*e)},tc=({values:n,valueOffsets:t},e,i)=>Ls(n,t,e,i),ec=({values:n,valueOffsets:t},e,i)=>{Ls(n,t,e,zi(i))},nc=(n,t,e)=>{n.type.unit===zt.DAY?Rs(n,t,e):xs(n,t,e)},Es=({values:n},t,e)=>Ji(n,t*2,e/1e3),Cs=({values:n},t,e)=>Ji(n,t*2,e),Vs=({values:n},t,e)=>Ga(n,t*2,e),Ps=({values:n},t,e)=>qa(n,t*2,e),ic=(n,t,e)=>{switch(n.type.unit){case M.SECOND:return Es(n,t,e);case M.MILLISECOND:return Cs(n,t,e);case M.MICROSECOND:return Vs(n,t,e);case M.NANOSECOND:return Ps(n,t,e)}},ks=({values:n},t,e)=>{n[t]=e},js=({values:n},t,e)=>{n[t]=e},zs=({values:n},t,e)=>{n[t]=e},$s=({values:n},t,e)=>{n[t]=e},rc=(n,t,e)=>{switch(n.type.unit){case M.SECOND:return ks(n,t,e);case M.MILLISECOND:return js(n,t,e);case M.MICROSECOND:return zs(n,t,e);case M.NANOSECOND:return $s(n,t,e)}},sc=({values:n,stride:t},e,i)=>{n.set(i.subarray(0,t),t*e)},oc=(n,t,e)=>{const i=n.children[0],r=n.valueOffsets,s=yt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=r[t],c=r[t+1];a<c;)s(i,a++,e[++o]);else for(let o=-1,a=r[t],c=r[t+1];a<c;)s(i,a++,e.get(++o))},ac=(n,t,e)=>{const i=n.children[0],{valueOffsets:r}=n,s=yt.getVisitFn(i);let{[t]:o,[t+1]:a}=r;const c=e instanceof Map?e.entries():Object.entries(e);for(const u of c)if(s(i,o,u),++o>=a)break},cc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t[s]),lc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t.get(s)),uc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t.get(r.name)),hc=(n,t)=>(e,i,r,s)=>i&&e(i,n,t[r.name]),dc=(n,t,e)=>{const i=n.type.children.map(s=>yt.getVisitFn(s.type)),r=e instanceof Map?uc(t,e):e instanceof L?lc(t,e):Array.isArray(e)?cc(t,e):hc(t,e);n.type.children.forEach((s,o)=>r(i[o],n.children[o],s,o))},fc=(n,t,e)=>{n.type.mode===ct.Dense?Ws(n,t,e):Ys(n,t,e)},Ws=(n,t,e)=>{const i=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[i];yt.visit(r,n.valueOffsets[t],e)},Ys=(n,t,e)=>{const i=n.type.typeIdToChildIndex[n.typeIds[t]],r=n.children[i];yt.visit(r,t,e)},pc=(n,t,e)=>{var i;(i=n.dictionary)===null||i===void 0||i.set(n.values[t],e)},yc=(n,t,e)=>{n.type.unit===Zt.DAY_TIME?Hs(n,t,e):Js(n,t,e)},Hs=({values:n},t,e)=>{n.set(e.subarray(0,2),2*t)},Js=({values:n},t,e)=>{n[t]=e[0]*12+e[1]%12},mc=(n,t,e)=>{const{stride:i}=n,r=n.children[0],s=yt.getVisitFn(r);if(Array.isArray(e))for(let o=-1,a=t*i;++o<i;)s(r,a+o,e[o]);else for(let o=-1,a=t*i;++o<i;)s(r,a+o,e.get(o))};v.prototype.visitBool=I(Za);v.prototype.visitInt=I(Wt);v.prototype.visitInt8=I(Wt);v.prototype.visitInt16=I(Wt);v.prototype.visitInt32=I(Wt);v.prototype.visitInt64=I(Wt);v.prototype.visitUint8=I(Wt);v.prototype.visitUint16=I(Wt);v.prototype.visitUint32=I(Wt);v.prototype.visitUint64=I(Wt);v.prototype.visitFloat=I(Qa);v.prototype.visitFloat16=I(Us);v.prototype.visitFloat32=I(Ki);v.prototype.visitFloat64=I(Ki);v.prototype.visitUtf8=I(ec);v.prototype.visitBinary=I(tc);v.prototype.visitFixedSizeBinary=I(Xa);v.prototype.visitDate=I(nc);v.prototype.visitDateDay=I(Rs);v.prototype.visitDateMillisecond=I(xs);v.prototype.visitTimestamp=I(ic);v.prototype.visitTimestampSecond=I(Es);v.prototype.visitTimestampMillisecond=I(Cs);v.prototype.visitTimestampMicrosecond=I(Vs);v.prototype.visitTimestampNanosecond=I(Ps);v.prototype.visitTime=I(rc);v.prototype.visitTimeSecond=I(ks);v.prototype.visitTimeMillisecond=I(js);v.prototype.visitTimeMicrosecond=I(zs);v.prototype.visitTimeNanosecond=I($s);v.prototype.visitDecimal=I(sc);v.prototype.visitList=I(oc);v.prototype.visitStruct=I(dc);v.prototype.visitUnion=I(fc);v.prototype.visitDenseUnion=I(Ws);v.prototype.visitSparseUnion=I(Ys);v.prototype.visitDictionary=I(pc);v.prototype.visitInterval=I(yc);v.prototype.visitIntervalDayTime=I(Hs);v.prototype.visitIntervalYearMonth=I(Js);v.prototype.visitFixedSizeList=I(mc);v.prototype.visitMap=I(ac);const yt=new v,mt=Symbol.for("parent"),Oe=Symbol.for("rowIndex");class Gi{constructor(t,e){return this[mt]=t,this[Oe]=e,new Proxy(this,new gc)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Oe],e=this[mt],i=e.type.children,r={};for(let s=-1,o=i.length;++s<o;)r[i[s].name]=it.visit(e.children[s],t);return r}toString(){return`{${[...this].map(([t,e])=>`${Ye(t)}: ${Ye(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new bc(this[mt],this[Oe])}}class bc{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,it.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Gi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[mt]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Oe]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class gc{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[mt].type.children.map(e=>e.name)}has(t,e){return t[mt].type.children.findIndex(i=>i.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[mt].type.children.findIndex(i=>i.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[mt].type.children.findIndex(r=>r.name===e);if(i!==-1){const r=it.visit(t[mt].children[i],t[Oe]);return Reflect.set(t,e,r),r}}set(t,e,i){const r=t[mt].type.children.findIndex(s=>s.name===e);return r!==-1?(yt.visit(t[mt].children[r],t[Oe],i),Reflect.set(t,e,i)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,i):!1}}class m extends D{}function w(n){return(t,e)=>t.getValid(e)?n(t,e):null}const _c=(n,t)=>864e5*n[t],qi=(n,t)=>4294967296*n[t+1]+(n[t]>>>0),vc=(n,t)=>4294967296*(n[t+1]/1e3)+(n[t]>>>0)/1e3,wc=(n,t)=>4294967296*(n[t+1]/1e6)+(n[t]>>>0)/1e6,Ks=n=>new Date(n),Sc=(n,t)=>Ks(_c(n,t)),Ic=(n,t)=>Ks(qi(n,t)),Bc=(n,t)=>null,Gs=(n,t,e)=>{if(e+1>=t.length)return null;const i=t[e],r=t[e+1];return n.subarray(i,r)},Ac=({offset:n,values:t},e)=>{const i=n+e;return(t[i>>3]&1<<i%8)!==0},qs=({values:n},t)=>Sc(n,t),Zs=({values:n},t)=>Ic(n,t*2),ie=({stride:n,values:t},e)=>t[n*e],Oc=({stride:n,values:t},e)=>Ns(t[n*e]),Qs=({values:n},t)=>n[t],Fc=({stride:n,values:t},e)=>t.subarray(n*e,n*(e+1)),Dc=({values:n,valueOffsets:t},e)=>Gs(n,t,e),Tc=({values:n,valueOffsets:t},e)=>{const i=Gs(n,t,e);return i!==null?vi(i):null},Mc=({values:n},t)=>n[t],Nc=({type:n,values:t},e)=>n.precision!==et.HALF?t[e]:Ns(t[e]),Lc=(n,t)=>n.type.unit===zt.DAY?qs(n,t):Zs(n,t),Xs=({values:n},t)=>1e3*qi(n,t*2),to=({values:n},t)=>qi(n,t*2),eo=({values:n},t)=>vc(n,t*2),no=({values:n},t)=>wc(n,t*2),Uc=(n,t)=>{switch(n.type.unit){case M.SECOND:return Xs(n,t);case M.MILLISECOND:return to(n,t);case M.MICROSECOND:return eo(n,t);case M.NANOSECOND:return no(n,t)}},io=({values:n},t)=>n[t],ro=({values:n},t)=>n[t],so=({values:n},t)=>n[t],oo=({values:n},t)=>n[t],Rc=(n,t)=>{switch(n.type.unit){case M.SECOND:return io(n,t);case M.MILLISECOND:return ro(n,t);case M.MICROSECOND:return so(n,t);case M.NANOSECOND:return oo(n,t)}},xc=({values:n,stride:t},e)=>Hi.decimal(n.subarray(t*e,t*(e+1))),Ec=(n,t)=>{const{valueOffsets:e,stride:i,children:r}=n,{[t*i]:s,[t*i+1]:o}=e,c=r[0].slice(s,o-s);return new L([c])},Cc=(n,t)=>{const{valueOffsets:e,children:i}=n,{[t]:r,[t+1]:s}=e,o=i[0];return new Zi(o.slice(r,s-r))},Vc=(n,t)=>new Gi(n,t),Pc=(n,t)=>n.type.mode===ct.Dense?ao(n,t):co(n,t),ao=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[e];return it.visit(i,n.valueOffsets[t])},co=(n,t)=>{const e=n.type.typeIdToChildIndex[n.typeIds[t]],i=n.children[e];return it.visit(i,t)},kc=(n,t)=>{var e;return(e=n.dictionary)===null||e===void 0?void 0:e.get(n.values[t])},jc=(n,t)=>n.type.unit===Zt.DAY_TIME?lo(n,t):uo(n,t),lo=({values:n},t)=>n.subarray(2*t,2*(t+1)),uo=({values:n},t)=>{const e=n[t],i=new Int32Array(2);return i[0]=Math.trunc(e/12),i[1]=Math.trunc(e%12),i},zc=(n,t)=>{const{stride:e,children:i}=n,s=i[0].slice(t*e,e);return new L([s])};m.prototype.visitNull=w(Bc);m.prototype.visitBool=w(Ac);m.prototype.visitInt=w(Mc);m.prototype.visitInt8=w(ie);m.prototype.visitInt16=w(ie);m.prototype.visitInt32=w(ie);m.prototype.visitInt64=w(Qs);m.prototype.visitUint8=w(ie);m.prototype.visitUint16=w(ie);m.prototype.visitUint32=w(ie);m.prototype.visitUint64=w(Qs);m.prototype.visitFloat=w(Nc);m.prototype.visitFloat16=w(Oc);m.prototype.visitFloat32=w(ie);m.prototype.visitFloat64=w(ie);m.prototype.visitUtf8=w(Tc);m.prototype.visitBinary=w(Dc);m.prototype.visitFixedSizeBinary=w(Fc);m.prototype.visitDate=w(Lc);m.prototype.visitDateDay=w(qs);m.prototype.visitDateMillisecond=w(Zs);m.prototype.visitTimestamp=w(Uc);m.prototype.visitTimestampSecond=w(Xs);m.prototype.visitTimestampMillisecond=w(to);m.prototype.visitTimestampMicrosecond=w(eo);m.prototype.visitTimestampNanosecond=w(no);m.prototype.visitTime=w(Rc);m.prototype.visitTimeSecond=w(io);m.prototype.visitTimeMillisecond=w(ro);m.prototype.visitTimeMicrosecond=w(so);m.prototype.visitTimeNanosecond=w(oo);m.prototype.visitDecimal=w(xc);m.prototype.visitList=w(Ec);m.prototype.visitStruct=w(Vc);m.prototype.visitUnion=w(Pc);m.prototype.visitDenseUnion=w(ao);m.prototype.visitSparseUnion=w(co);m.prototype.visitDictionary=w(kc);m.prototype.visitInterval=w(jc);m.prototype.visitIntervalDayTime=w(lo);m.prototype.visitIntervalYearMonth=w(uo);m.prototype.visitFixedSizeList=w(zc);m.prototype.visitMap=w(Cc);const it=new m,It=Symbol.for("keys"),Fe=Symbol.for("vals");class Zi{constructor(t){return this[It]=new L([t.children[0]]).memoize(),this[Fe]=t.children[1],new Proxy(this,new Wc)}[Symbol.iterator](){return new $c(this[It],this[Fe])}get size(){return this[It].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[It],e=this[Fe],i={};for(let r=-1,s=t.length;++r<s;)i[t.get(r)]=it.visit(e,r);return i}toString(){return`{${[...this].map(([t,e])=>`${Ye(t)}: ${Ye(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class $c{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),it.visit(this.vals,t)]})}}class Wc{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[It].toArray().map(String)}has(t,e){return t[It].includes(e)}getOwnPropertyDescriptor(t,e){if(t[It].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const i=t[It].indexOf(e);if(i!==-1){const r=it.visit(Reflect.get(t,Fe),i);return Reflect.set(t,e,r),r}}set(t,e,i){const r=t[It].indexOf(e);return r!==-1?(yt.visit(Reflect.get(t,Fe),r,i),Reflect.set(t,e,i)):Reflect.has(t,e)?Reflect.set(t,e,i):!1}}Object.defineProperties(Zi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[It]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Fe]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Ir;function ho(n,t,e,i){const{length:r=0}=n;let s=typeof t!="number"?0:t,o=typeof e!="number"?r:e;return s<0&&(s=(s%r+r)%r),o<0&&(o=(o%r+r)%r),o<s&&(Ir=s,s=o,o=Ir),o>r&&(o=r),i?i(n,s,o):[s,o]}const Br=n=>n!==n;function Ve(n){if(typeof n!=="object"||n===null)return Br(n)?Br:e=>e===n;if(n instanceof Date){const e=n.valueOf();return i=>i instanceof Date?i.valueOf()===e:!1}return ArrayBuffer.isView(n)?e=>e?Ca(n,e):!1:n instanceof Map?Hc(n):Array.isArray(n)?Yc(n):n instanceof L?Jc(n):Kc(n,!0)}function Yc(n){const t=[];for(let e=-1,i=n.length;++e<i;)t[e]=Ve(n[e]);return si(t)}function Hc(n){let t=-1;const e=[];for(const i of n.values())e[++t]=Ve(i);return si(e)}function Jc(n){const t=[];for(let e=-1,i=n.length;++e<i;)t[e]=Ve(n.get(e));return si(t)}function Kc(n,t=!1){const e=Object.keys(n);if(!t&&e.length===0)return()=>!1;const i=[];for(let r=-1,s=e.length;++r<s;)i[r]=Ve(n[e[r]]);return si(i,e)}function si(n,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Gc(n,e);case Map:return Ar(n,e,e.keys());case Zi:case Gi:case Object:case void 0:return Ar(n,e,t||Object.keys(e))}return e instanceof L?qc(n,e):!1}}function Gc(n,t){const e=n.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!n[i](t[i]))return!1;return!0}function qc(n,t){const e=n.length;if(t.length!==e)return!1;for(let i=-1;++i<e;)if(!n[i](t.get(i)))return!1;return!0}function Ar(n,t,e){const i=e[Symbol.iterator](),r=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let o=0;const a=n.length;let c=s.next(),u=i.next(),h=r.next();for(;o<a&&!u.done&&!h.done&&!c.done&&!(u.value!==h.value||!n[o](c.value));++o,u=i.next(),h=r.next(),c=s.next());return o===a&&u.done&&h.done&&c.done?!0:(i.return&&i.return(),r.return&&r.return(),s.return&&s.return(),!1)}function fo(n,t,e,i){return(e&1<<i)!==0}function Zc(n,t,e,i){return(e&1<<i)>>i}function Qi(n,t,e){const i=e.byteLength+7&-8;if(n>0||e.byteLength<i){const r=new Uint8Array(i);return r.set(n%8===0?e.subarray(n>>3):Nn(new Xi(e,n,t,null,fo)).subarray(0,i)),r}return e}function Nn(n){const t=[];let e=0,i=0,r=0;for(const o of n)o&&(r|=1<<i),++i===8&&(t[e++]=r,r=i=0);(e===0||i>0)&&(t[e++]=r);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class Xi{constructor(t,e,i,r,s){this.bytes=t,this.length=i,this.context=r,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 Bi(n,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(const o of new Xi(n,t,e-t,n,Zc))s+=o;return s}const i=e>>3<<3,r=t+(t%8===0?0:8-t%8);return Bi(n,t,r)+Bi(n,i,e)+Qc(n,r>>3,i-r>>3)}function Qc(n,t,e){let i=0,r=Math.trunc(t);const s=new DataView(n.buffer,n.byteOffset,n.byteLength),o=e===void 0?n.byteLength:r+e;for(;o-r>=4;)i+=di(s.getUint32(r)),r+=4;for(;o-r>=2;)i+=di(s.getUint16(r)),r+=2;for(;o-r>=1;)i+=di(s.getUint8(r)),r+=1;return i}function di(n){let t=Math.trunc(n);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Xc=-1;class P{constructor(t,e,i,r,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(r||0,-1));let c;s instanceof P?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Et(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))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0;const{valueOffsets:e,values:i,nullBitmap:r,typeIds:s}=this;return e&&(t+=e.byteLength),i&&(t+=i.byteLength),r&&(t+=r.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=Xc&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Bi(e,this.offset,this.offset+this.length)),t}getValid(t){if(this.nullable&&this.nullCount>0){const e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){const{nullBitmap:c}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:c,_nullCount:0})}const{nullBitmap:i,offset:r}=this,s=r+t>>3,o=(r+t)%8,a=i[s]>>o&1;return e?a===0&&(i[s]|=1<<o,this._nullCount=this.nullCount+1):a===1&&(i[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,i=this.length,r=this._nullCount,s=this,o=this.children){return new P(t,e,i,r,s,o,this.dictionary)}slice(t,e){const{stride:i,typeId:r,children:s}=this,o=+(this._nullCount===0)-1,a=r===16?i:1,c=this._sliceBuffers(t,e,i,r);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===l.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:i}=this,r=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);r[e>>3]=(1<<e-(e&-8))-1,i>0&&r.set(Qi(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[xt.VALIDITY]=r,this.clone(this.type,0,t,i+(t-e),s)}_sliceBuffers(t,e,i,r){let s;const{buffers:o}=this;return(s=o[xt.TYPE])&&(o[xt.TYPE]=s.subarray(t,t+e)),(s=o[xt.OFFSET])&&(o[xt.OFFSET]=s.subarray(t,t+e+1))||(s=o[xt.DATA])&&(o[xt.DATA]=r===6?s:s.subarray(i*t,i*(t+e))),o}_sliceChildren(t,e,i){return t.map(r=>r.slice(e,i))}}P.prototype.children=Object.freeze([]);class ze extends D{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:i=0,["length"]:r=0}=t;return new P(e,i,r,0)}visitBool(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitInt(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitFloat(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitUtf8(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.data),s=T(t.nullBitmap),o=Pe(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new P(e,i,a,c,[o,r,s])}visitBinary(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.data),s=T(t.nullBitmap),o=Pe(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new P(e,i,a,c,[o,r,s])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitDate(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitTimestamp(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitTime(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitDecimal(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitList(t){const{["type"]:e,["offset"]:i=0,["child"]:r}=t,s=T(t.nullBitmap),o=Pe(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new P(e,i,a,c,[o,void 0,s],[r])}visitStruct(t){const{["type"]:e,["offset"]:i=0,["children"]:r=[]}=t,s=T(t.nullBitmap),{length:o=r.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,void 0,s],r)}visitUnion(t){const{["type"]:e,["offset"]:i=0,["children"]:r=[]}=t,s=T(t.nullBitmap),o=C(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(y.isSparseUnion(e))return new P(e,i,a,c,[void 0,void 0,s,o],r);const u=Pe(t.valueOffsets);return new P(e,i,a,c,[u,void 0,s,o],r)}visitDictionary(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.indices.ArrayType,t.data),{["dictionary"]:o=new L([new ze().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new P(e,i,a,c,[void 0,s,r],[],o)}visitInterval(t){const{["type"]:e,["offset"]:i=0}=t,r=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,s,r])}visitFixedSizeList(t){const{["type"]:e,["offset"]:i=0,["child"]:r=new ze().visit({type:e.valueType})}=t,s=T(t.nullBitmap),{["length"]:o=r.length/Et(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new P(e,i,o,a,[void 0,void 0,s],[r])}visitMap(t){const{["type"]:e,["offset"]:i=0,["child"]:r=new ze().visit({type:e.childType})}=t,s=T(t.nullBitmap),o=Pe(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new P(e,i,a,c,[o,void 0,s],[r])}}function F(n){return new ze().visit(n)}class Or{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const 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 po(n){return n.reduce((t,e)=>t+e.nullCount,0)}function yo(n){return n.reduce((t,e,i)=>(t[i+1]=t[i]+e.length,t),new Uint32Array(n.length+1))}function mo(n,t,e,i){const r=[];for(let s=-1,o=n.length;++s<o;){const a=n[s],c=t[s],{length:u}=a;if(c>=i)break;if(e>=c+u)continue;if(c>=e&&c+u<=i){r.push(a);continue}const h=Math.max(0,e-c),d=Math.min(i-c,u);r.push(a.slice(h,d-h))}return r.length===0&&r.push(n[0].slice(0,0)),r}function tr(n,t,e,i){let r=0,s=0,o=t.length-1;do{if(r>=o-1)return e<t[o]?i(n,r,e-t[r]):null;s=r+Math.trunc((o-r)*.5),e<t[s]?o=s:r=s}while(r<o)}function er(n,t){return n.getValid(t)}function De(n){function t(e,i,r){return n(e[i],r)}return function(e){const i=this.data;return tr(i,this._offsets,e,t)}}function bo(n){let t;function e(i,r,s){return n(i[r],s,t)}return function(i,r){const s=this.data;t=r;const o=tr(s,this._offsets,i,e);return t=void 0,o}}function go(n){let t;function e(i,r,s){let o=s,a=0,c=0;for(let u=r-1,h=i.length;++u<h;){const d=i[u];if(~(a=n(d,t,o)))return c+a;o=0,c+=d.length}return-1}return function(i,r){t=i;const s=this.data,o=typeof r!="number"?e(s,0,0):tr(s,this._offsets,r,e);return t=void 0,o}}class b extends D{}function tl(n,t){return t===null&&n.length>0?0:-1}function el(n,t){const{nullBitmap:e}=n;if(!e||n.nullCount<=0)return-1;let i=0;for(const r of new Xi(e,n.offset+(t||0),n.length,e,fo)){if(!r)return i;++i}return-1}function O(n,t,e){if(t===void 0)return-1;if(t===null)return el(n,e);const i=it.getVisitFn(n),r=Ve(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(r(i(n,s)))return s;return-1}function _o(n,t,e){const i=it.getVisitFn(n),r=Ve(t);for(let s=(e||0)-1,o=n.length;++s<o;)if(r(i(n,s)))return s;return-1}b.prototype.visitNull=tl;b.prototype.visitBool=O;b.prototype.visitInt=O;b.prototype.visitInt8=O;b.prototype.visitInt16=O;b.prototype.visitInt32=O;b.prototype.visitInt64=O;b.prototype.visitUint8=O;b.prototype.visitUint16=O;b.prototype.visitUint32=O;b.prototype.visitUint64=O;b.prototype.visitFloat=O;b.prototype.visitFloat16=O;b.prototype.visitFloat32=O;b.prototype.visitFloat64=O;b.prototype.visitUtf8=O;b.prototype.visitBinary=O;b.prototype.visitFixedSizeBinary=O;b.prototype.visitDate=O;b.prototype.visitDateDay=O;b.prototype.visitDateMillisecond=O;b.prototype.visitTimestamp=O;b.prototype.visitTimestampSecond=O;b.prototype.visitTimestampMillisecond=O;b.prototype.visitTimestampMicrosecond=O;b.prototype.visitTimestampNanosecond=O;b.prototype.visitTime=O;b.prototype.visitTimeSecond=O;b.prototype.visitTimeMillisecond=O;b.prototype.visitTimeMicrosecond=O;b.prototype.visitTimeNanosecond=O;b.prototype.visitDecimal=O;b.prototype.visitList=O;b.prototype.visitStruct=O;b.prototype.visitUnion=O;b.prototype.visitDenseUnion=_o;b.prototype.visitSparseUnion=_o;b.prototype.visitDictionary=O;b.prototype.visitInterval=O;b.prototype.visitIntervalDayTime=O;b.prototype.visitIntervalYearMonth=O;b.prototype.visitFixedSizeList=O;b.prototype.visitMap=O;const Ln=new b;class g extends D{}function S(n){const{type:t}=n;if(n.nullCount===0&&n.stride===1&&(t.typeId===l.Timestamp||t instanceof Xt&&t.bitWidth!==64||t instanceof Ge&&t.bitWidth!==64||t instanceof Ke&&t.precision!==et.HALF))return new Or(n.data.length,i=>{const r=n.data[i];return r.values.subarray(0,r.length)[Symbol.iterator]()});let e=0;return new Or(n.data.length,i=>{const s=n.data[i].length,o=n.slice(e,e+s);return e+=s,new nl(o)})}class nl{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}}g.prototype.visitNull=S;g.prototype.visitBool=S;g.prototype.visitInt=S;g.prototype.visitInt8=S;g.prototype.visitInt16=S;g.prototype.visitInt32=S;g.prototype.visitInt64=S;g.prototype.visitUint8=S;g.prototype.visitUint16=S;g.prototype.visitUint32=S;g.prototype.visitUint64=S;g.prototype.visitFloat=S;g.prototype.visitFloat16=S;g.prototype.visitFloat32=S;g.prototype.visitFloat64=S;g.prototype.visitUtf8=S;g.prototype.visitBinary=S;g.prototype.visitFixedSizeBinary=S;g.prototype.visitDate=S;g.prototype.visitDateDay=S;g.prototype.visitDateMillisecond=S;g.prototype.visitTimestamp=S;g.prototype.visitTimestampSecond=S;g.prototype.visitTimestampMillisecond=S;g.prototype.visitTimestampMicrosecond=S;g.prototype.visitTimestampNanosecond=S;g.prototype.visitTime=S;g.prototype.visitTimeSecond=S;g.prototype.visitTimeMillisecond=S;g.prototype.visitTimeMicrosecond=S;g.prototype.visitTimeNanosecond=S;g.prototype.visitDecimal=S;g.prototype.visitList=S;g.prototype.visitStruct=S;g.prototype.visitUnion=S;g.prototype.visitDenseUnion=S;g.prototype.visitSparseUnion=S;g.prototype.visitDictionary=S;g.prototype.visitInterval=S;g.prototype.visitIntervalDayTime=S;g.prototype.visitIntervalYearMonth=S;g.prototype.visitFixedSizeList=S;g.prototype.visitMap=S;const nr=new g,il=(n,t)=>n+t;class re extends D{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===M.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((i,r)=>i+Lt.visit(r,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((i,r)=>i+Lt.visit(r,e),0)}visitDictionary(t,e){var i;return t.type.indices.bitWidth/8+(((i=t.dictionary)===null||i===void 0?void 0:i.getByteLength(t.values[e]))||0)}}const rl=({valueOffsets:n},t)=>8+(n[t+1]-n[t]),sl=({valueOffsets:n},t)=>8+(n[t+1]-n[t]),ol=({valueOffsets:n,stride:t,children:e},i)=>{const r=e[0],{[i*t]:s}=n,{[i*t+1]:o}=n,a=Lt.getVisitFn(r.type),c=r.slice(s,o-s);let u=8;for(let h=-1,d=o-s;++h<d;)u+=a(c,h);return u},al=({stride:n,children:t},e)=>{const i=t[0],r=i.slice(e*n,n),s=Lt.getVisitFn(i.type);let o=0;for(let a=-1,c=r.length;++a<c;)o+=s(r,a);return o},cl=(n,t)=>n.type.mode===ct.Dense?vo(n,t):wo(n,t),vo=({type:n,children:t,typeIds:e,valueOffsets:i},r)=>{const s=n.typeIdToChildIndex[e[r]];return 8+Lt.visit(t[s],i[r])},wo=({children:n},t)=>4+Lt.visitMany(n,n.map(()=>t)).reduce(il,0);re.prototype.visitUtf8=rl;re.prototype.visitBinary=sl;re.prototype.visitList=ol;re.prototype.visitFixedSizeList=al;re.prototype.visitUnion=cl;re.prototype.visitDenseUnion=vo;re.prototype.visitSparseUnion=wo;const Lt=new re;var So;const Io={},Bo={};class L{constructor(t){var e,i,r;const s=t[0]instanceof L?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof P)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:c,indexOf:u,byteLength:h}=Io[o.typeId],d=s[0];this.isValid=A=>er(d,A),this.get=A=>a(d,A),this.set=(A,f)=>c(d,A,f),this.indexOf=A=>u(d,A),this.getByteLength=A=>h(d,A),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,Bo[o.typeId]),this._offsets=yo(s);break}this.data=s,this.type=o,this.stride=Et(o),this.numChildren=(r=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0,this.length=this._offsets[this._offsets.length-1]}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=po(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${l[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return nr.visit(this)}concat(...t){return new L(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new L(ho(this,t,e,({data:i,_offsets:r},s,o)=>mo(i,r,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:i,stride:r,ArrayType:s}=this;switch(t.typeId){case l.Int:case l.Float:case l.Decimal:case l.Time:case l.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,i*r);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*r),o.offset),o.offset+=c*r,o),{array:new s(i*r),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 L(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return y.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(y.isDictionary(this.type)){const t=new Un(this.data[0].dictionary),e=this.data.map(i=>{const r=i.clone();return r.dictionary=t,r});return new L(e)}return new Un(this)}unmemoize(){if(y.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(i=>{const r=i.clone();return r.dictionary=t,r});return new L(e)}return this}}So=Symbol.toStringTag;L[So]=(n=>{n.type=y.prototype,n.data=[],n.length=0,n.stride=1,n.numChildren=0,n._nullCount=-1,n._byteLength=-1,n._offsets=new Uint32Array([0]),n[Symbol.isConcatSpreadable]=!0;const t=Object.keys(l).map(e=>l[e]).filter(e=>typeof e=="number"&&e!==l.NONE);for(const e of t){const i=it.getVisitFnByTypeId(e),r=yt.getVisitFnByTypeId(e),s=Ln.getVisitFnByTypeId(e),o=Lt.getVisitFnByTypeId(e);Io[e]={get:i,set:r,indexOf:s,byteLength:o},Bo[e]=Object.create(n,{isValid:{value:De(er)},get:{value:De(it.getVisitFnByTypeId(e))},set:{value:bo(yt.getVisitFnByTypeId(e))},indexOf:{value:go(Ln.getVisitFnByTypeId(e))},getByteLength:{value:De(Lt.getVisitFnByTypeId(e))}})}return"Vector"})(L.prototype);class Un extends L{constructor(t){super(t.data);const e=this.get,i=this.set,r=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const 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 Un(r.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new L(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Ai{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,r){return t.prep(8,24),t.writeInt64(r),t.pad(4),t.writeInt32(i),t.writeInt64(e),t.offset()}}const fi=2,Bt=4,Vt=4,V=4,Kt=new Int32Array(2),Fr=new Float32Array(Kt.buffer),Dr=new Float64Array(Kt.buffer),ln=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;let kt=class Oi{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?Oi.ZERO:new Oi(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};kt.ZERO=new kt(0,0);var Fi;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Fi||(Fi={}));let Me=class Ao{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new Ao(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 new kt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new kt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return Kt[0]=this.readInt32(t),Fr[0]}readFloat64(t){return Kt[ln?0:1]=this.readInt32(t),Kt[ln?1:0]=this.readInt32(t+4),Dr[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,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){Fr[0]=e,this.writeInt32(t,Kt[0])}writeFloat64(t,e){Dr[0]=e,this.writeInt32(t,Kt[ln?0:1]),this.writeInt32(t+4,Kt[ln?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Bt+Vt)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<Vt;e++)t+=String.fromCharCode(this.readInt8(this.position_+Bt+e));return t}__offset(t,e){const 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);const i=this.readInt32(t);let r="",s=0;if(t+=Bt,e===Fi.UTF8_BYTES)return this.bytes_.subarray(t,t+i);for(;s<i;){let o;const a=this.readUint8(t+s++);if(a<192)o=a;else{const c=this.readUint8(t+s++);if(a<224)o=(a&31)<<6|c&63;else{const u=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(c&63)<<6|u&63;else{const h=this.readUint8(t+s++);o=(a&7)<<18|(c&63)<<12|(u&63)<<6|h&63}}}o<65536?r+=String.fromCharCode(o):(o-=65536,r+=String.fromCharCode((o>>10)+55296,(o&1023)+56320))}return r}__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)+Bt}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=Vt)throw new Error("FlatBuffers: file identifier must be length "+Vt);for(let e=0;e<Vt;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+Bt+e))return!1;return!0}createLong(t,e){return kt.create(t,e)}createScalarList(t,e){const i=[];for(let r=0;r<e;++r)t(r)!==null&&i.push(t(r));return i}createObjList(t,e){const i=[];for(let r=0;r<e;++r){const s=t(r);s!==null&&i.push(s.unpack())}return i}},Oo=class Fo{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;let e;t?e=t:e=1024,this.bb=Me.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);const i=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<i+t+e;){const r=this.bb.capacity();this.bb=Fo.growByteBuffer(this.bb),this.space+=this.bb.capacity()-r}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.equals(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 Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("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){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const i=e<<1,r=Me.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r}addOffset(t){this.prep(Bt,0),this.writeInt32(this.offset()-t+Bt)}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);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const i=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const r=2;this.addInt16(t-this.object_start);const s=(i+r)*fi;this.addInt16(s);let o=0;const a=this.space;t:for(e=0;e<this.vtables.length;e++){const c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let u=fi;u<s;u+=fi)if(this.bb.readInt16(a+u)!=this.bb.readInt16(c+u))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){const r=i?V:0;if(e){const s=e;if(this.prep(this.minalign,Bt+Vt+r),s.length!=Vt)throw new Error("FlatBuffers: file identifier must be length "+Vt);for(let o=Vt-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Bt+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(this.bb.readInt16(r+e)!=0))throw new Error("FlatBuffers: field "+e+" must be set")}startVector(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(Bt,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);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(!t)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let i=0;for(;i<t.length;){let r;const s=t.charCodeAt(i++);if(s<55296||s>=56320)r=s;else{const o=t.charCodeAt(i++);r=(s<<10)+o+-56613888}r<128?e.push(r):(r<2048?e.push(r>>6&31|192):(r<65536?e.push(r>>12&15|224):e.push(r>>18&7|240,r>>12&63|128),e.push(r>>6&63|128)),e.push(r&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let i=0,r=this.space,s=this.bb.bytes();i<e.length;i++)s[r++]=e[i];return this.endVector()}createLong(t,e){return kt.create(t,e)}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let i=0;i<t.length;++i){const r=t[i];if(r!==null)e.push(this.createObjectOffset(r));else throw new Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}};class H{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 H).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+V),(e||new H).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,i){return H.startKeyValue(t),H.addKey(t,e),H.addValue(t,i),H.endKeyValue(t)}}var Ne;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(Ne||(Ne={}));var Le;(function(n){n[n.Little=0]="Little",n[n.Big=1]="Big"})(Le||(Le={}));var Rn;(function(n){n[n.DenseArray=0]="DenseArray"})(Rn||(Rn={}));class ot{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 ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+V),(e||new ot).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!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 ot.startInt(t),ot.addBitWidth(t,e),ot.addIsSigned(t,i),ot.endInt(t)}}class Pt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+V),(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new ot).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Rn.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,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,Rn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class ae{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 ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+V),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ae.startBinary(t),ae.endBinary(t)}}class ce{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+V),(e||new ce).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return ce.startBool(t),ce.endBool(t)}}var xn;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(xn||(xn={}));let dn=class ve{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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+V),(e||new ve).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):xn.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,xn.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return ve.startDate(t),ve.addUnit(t,e),ve.endDate(t)}};class Q{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 Q).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+V),(e||new Q).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,i,r){return Q.startDecimal(t),Q.addPrecision(t,e),Q.addScale(t,i),Q.addBitWidth(t,r),Q.endDecimal(t)}}var Ue;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(Ue||(Ue={}));class At{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 At).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+V),(e||new At).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return At.startFixedSizeBinary(t),At.addByteWidth(t,e),At.endFixedSizeBinary(t)}}class Ot{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 Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+V),(e||new Ot).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return Ot.startFixedSizeList(t),Ot.addListSize(t,e),Ot.endFixedSizeList(t)}}var En;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(En||(En={}));class Ft{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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+V),(e||new Ft).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):En.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,En.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Ft.startFloatingPoint(t),Ft.addPrecision(t,e),Ft.endFloatingPoint(t)}}var Cn;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Cn||(Cn={}));class Dt{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 Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+V),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Cn.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Cn.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Dt.startInterval(t),Dt.addUnit(t,e),Dt.endInterval(t)}}class le{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+V),(e||new le).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return le.startList(t),le.endList(t)}}let fn=class we{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 we).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+V),(e||new we).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!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 we.startMap(t),we.addKeysSorted(t,e),we.endMap(t)}};class ue{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 ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+V),(e||new ue).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return ue.startNull(t),ue.endNull(t)}}class he{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 he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+V),(e||new he).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return he.startStruct_(t),he.endStruct_(t)}}class ft{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 ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+V),(e||new ft).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ue.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Ue.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return ft.startTime(t),ft.addUnit(t,e),ft.addBitWidth(t,i),ft.endTime(t)}}class pt{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 pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+V),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ue.SECOND}timezone(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Ue.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return pt.startTimestamp(t),pt.addUnit(t,e),pt.addTimezone(t,i),pt.endTimestamp(t)}}var Vn;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(Vn||(Vn={}));class X{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 X).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+V),(e||new X).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vn.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Vn.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 X.startUnion(t),X.addMode(t,e),X.addTypeIds(t,i),X.endUnion(t)}}class de{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 de).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+V),(e||new de).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return de.startUtf8(t),de.endUtf8(t)}}var j;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.FloatingPoint=3]="FloatingPoint",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct_=13]="Struct_",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Duration=18]="Duration",n[n.LargeBinary=19]="LargeBinary",n[n.LargeUtf8=20]="LargeUtf8",n[n.LargeList=21]="LargeList"})(j||(j={}));let ht=class pn{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 pn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+V),(e||new pn).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):j.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const i=this.bb.__offset(this.bb_pos,14);return i?(e||new pn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,16);return i?(e||new H).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,j.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()}},wt=class Rt{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 Rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+V),(e||new Rt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Le.Little}fields(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new H).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):this.bb.createLong(0,0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Le.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,r,s){return Rt.startSchema(t),Rt.addEndianness(t,e),Rt.addFields(t,i),Rt.addCustomMetadata(t,r),Rt.addFeatures(t,s),Rt.endSchema(t)}};class st{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 st).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+V),(e||new st).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ne.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new wt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new Ai).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const i=this.bb.__offset(this.bb_pos,10);return i?(e||new Ai).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new H).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Ne.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class U{constructor(t=[],e,i){this.fields=t||[],this.metadata=e||new Map,i||(i=Di(t)),this.dictionaries=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),i=this.fields.filter(r=>e.has(r.name));return new U(i,this.metadata)}selectAt(t){const e=t.map(i=>this.fields[i]).filter(Boolean);return new U(e,this.metadata)}assign(...t){const e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),i=[...this.fields],r=un(un(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{const c=i.findIndex(u=>u.name===a.name);return~c?(i[c]=a.clone({metadata:un(un(new Map,i[c].metadata),a.metadata)}))&&!1:!0}),o=Di(s,new Map);return new U([...i,...s],r,new Map([...this.dictionaries,...o]))}}U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;class k{constructor(t,e,i=!1,r){this.name=t,this.type=e,this.nullable=i,this.metadata=r||new Map}static new(...t){let[e,i,r,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],i===void 0&&(i=t[0].type),r===void 0&&(r=t[0].nullable),s===void 0&&(s=t[0].metadata)),new k(`${e}`,i,r,s)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,i,r,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,i=this.type,r=this.nullable,s=this.metadata]=t:{name:e=this.name,type:i=this.type,nullable:r=this.nullable,metadata:s=this.metadata}=t[0],k.new(e,i,r,s)}}k.prototype.type=null;k.prototype.name=null;k.prototype.nullable=null;k.prototype.metadata=null;function un(n,t){return new Map([...n||new Map,...t||new Map])}function Di(n,t=new Map){for(let e=-1,i=n.length;++e<i;){const s=n[e].type;if(y.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Di(s.children,t)}return t}var Tr=kt,ll=Oo,ul=Me;class qe{constructor(t,e=at.V4,i,r){this.schema=t,this.version=e,i&&(this._recordBatches=i),r&&(this._dictionaryBatches=r)}static decode(t){t=new ul(T(t));const e=st.getRootAsFooter(t),i=U.decode(e.schema());return new hl(i,e)}static encode(t){const e=new ll,i=U.encode(e,t.schema);st.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())te.encode(e,o);const r=e.endVector();st.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())te.encode(e,o);const s=e.endVector();return st.startFooter(e),st.addSchema(e,i),st.addVersion(e,at.V4),st.addRecordBatches(e,r),st.addDictionaries(e,s),st.finishFooterBuffer(e,st.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*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}}class hl extends qe{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const e=this._footer.recordBatches(t);if(e)return te.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return te.decode(e)}return null}}class te{constructor(t,e,i){this.metaDataLength=t,this.offset=typeof i=="number"?i:i.low,this.bodyLength=typeof e=="number"?e:e.low}static decode(t){return new te(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:i}=e,r=new Tr(e.offset,0),s=new Tr(e.bodyLength,0);return Ai.createBlock(t,r,i,s)}}const z=Object.freeze({done:!0,value:void 0});class Mr{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class ir{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())}}class dl extends ir{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return p(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(z);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return dt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return dt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return p(this,void 0,void 0,function*(){return yield this.abort(t),z})}return(t){return p(this,void 0,void 0,function*(){return yield this.close(),z})}read(t){return p(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return p(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(z)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class yn extends dl{write(t){if((t=T(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?vi(this.toUint8Array(!0)):this.toUint8Array(!1).then(vi)}toUint8Array(t=!1){return t?Nt(this._values)[0]:p(this,void 0,void 0,function*(){var e,i;const r=[];let s=0;try{for(var o=fe(this),a;a=yield o.next(),!a.done;){const c=a.value;r.push(c),s+=c.byteLength}}catch(c){e={error:c}}finally{try{a&&!a.done&&(i=o.return)&&(yield i.call(o))}finally{if(e)throw e.error}}return Nt(r,s)[0]})}}class Pn{constructor(t){t&&(this.source=new fl(dt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Re{constructor(t){t instanceof Re?this.source=t.source:t instanceof yn?this.source=new oe(dt.fromAsyncIterable(t)):cs(t)?this.source=new oe(dt.fromNodeStream(t)):$i(t)?this.source=new oe(dt.fromDOMStream(t)):as(t)?this.source=new oe(dt.fromDOMStream(t.body)):nn(t)?this.source=new oe(dt.fromIterable(t)):qt(t)?this.source=new oe(dt.fromAsyncIterable(t)):Ce(t)&&(this.source=new oe(dt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class fl{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||z)}return(t){return Object.create(this.source.return&&this.source.return(t)||z)}}class oe{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return p(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return p(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return p(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return p(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return p(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return p(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class Nr extends Pn{constructor(t,e){super(),this.position=0,this.buffer=T(t),this.size=typeof e>"u"?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:i}=this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:i,position:r}=this;return e&&r<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,r+Math.min(i-r,t)),e.subarray(r,this.position)):null}readAt(t,e){const i=this.buffer,r=Math.min(this.size,t+e);return i?i.subarray(t,r):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}}}class kn extends Re{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=p(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return p(this,void 0,void 0,function*(){const{buffer:e,byteOffset:i}=yield this.readAt(t,4);return new DataView(e,i).getInt32(0,!0)})}seek(t){return p(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 p(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:e,size:i,position:r}=this;if(e&&r<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=r,o=0,a=0;const c=Math.min(i,s+Math.min(i-s,t)),u=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<u.byteLength;)({bytesRead:a}=yield e.read(u,o,u.byteLength-o,s));return u}return null})}readAt(t,e){return p(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:i,size:r}=this;if(i&&t+e<r){const s=Math.min(r,t+e),o=new Uint8Array(s-t);return(yield i.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return p(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return p(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return p(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const pl=65536;function Ie(n){return n<0&&(n=4294967295+n+1),`0x${n.toString(16)}`}const xe=8,rr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Do{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const 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]);let r=e[3]*i[3];this.buffer[0]=r&65535;let s=r>>>16;return r=e[2]*i[3],s+=r,r=e[3]*i[2]>>>0,s+=r,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<r?pl: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){const 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`${Ie(this.buffer[1])} ${Ie(this.buffer[0])}`}}class R extends Do{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)){const i=t.length,r=new R(e);for(let s=0;s<i;){const o=xe<i-s?xe:i-s,a=new R(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new R(new Uint32Array([rr[o],0]));r.times(c),r.plus(a),s+=o}return r}static convertArray(t){const e=new Uint32Array(t.length*2);for(let i=-1,r=t.length;++i<r;)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)}}class Z extends Do{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){const 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 Z.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Z.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const i=t.startsWith("-"),r=t.length,s=new Z(e);for(let o=i?1:0;o<r;){const a=xe<r-o?xe:r-o,c=new Z(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),u=new Z(new Uint32Array([rr[a],0]));s.times(u),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){const e=new Uint32Array(t.length*2);for(let i=-1,r=t.length;++i<r;)Z.from(t[i],new Uint32Array(e.buffer,e.byteOffset+2*i*4,2));return e}static multiply(t,e){return new Z(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Z(new Uint32Array(t.buffer)).plus(e)}}class St{constructor(t){this.buffer=t}high(){return new Z(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Z(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){const e=new R(new Uint32Array([this.buffer[3],0])),i=new R(new Uint32Array([this.buffer[2],0])),r=new R(new Uint32Array([this.buffer[1],0])),s=new R(new Uint32Array([this.buffer[0],0])),o=new R(new Uint32Array([t.buffer[3],0])),a=new R(new Uint32Array([t.buffer[2],0])),c=new R(new Uint32Array([t.buffer[1],0])),u=new R(new Uint32Array([t.buffer[0],0]));let h=R.multiply(s,u);this.buffer[0]=h.low();const d=new R(new Uint32Array([h.high(),0]));return h=R.multiply(r,u),d.plus(h),h=R.multiply(s,c),d.plus(h),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(h)?1:0,this.buffer[2]=d.high(),new R(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(R.multiply(i,u)).plus(R.multiply(r,c)).plus(R.multiply(s,a)),this.buffer[3]+=R.multiply(e,u).plus(R.multiply(i,c)).plus(R.multiply(r,a)).plus(R.multiply(s,o)).low(),this}plus(t){const 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`${Ie(this.buffer[3])} ${Ie(this.buffer[2])} ${Ie(this.buffer[1])} ${Ie(this.buffer[0])}`}static multiply(t,e){return new St(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new St(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return St.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return St.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const i=t.startsWith("-"),r=t.length,s=new St(e);for(let o=i?1:0;o<r;){const a=xe<r-o?xe:r-o,c=new St(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),u=new St(new Uint32Array([rr[a],0,0,0]));s.times(u),s.plus(c),o+=a}return i?s.negate():s}static convertArray(t){const e=new Uint32Array(t.length*4);for(let i=-1,r=t.length;++i<r;)St.from(t[i],new Uint32Array(e.buffer,e.byteOffset+4*4*i,4));return e}}class To extends D{constructor(t,e,i,r){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=i,this.dictionaries=r}visit(t){return super.visit(t instanceof k?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return F({type:t,length:e})}visitBool(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({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 F({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 F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({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 F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===ct.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({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 F({type:t,length:e,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:i}=this.nextFieldNode()){return F({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 F({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)}}class yl extends To{constructor(t,e,i,r){super(new Uint8Array(0),e,i,r),this.sources=t}readNullBitmap(t,e,{offset:i}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Nn(this.sources[i])}readOffsets(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:i}=this;return y.isTimestamp(t)||(y.isInt(t)||y.isTime(t))&&t.bitWidth===64||y.isDate(t)&&t.unit===zt.MILLISECOND?C(Uint8Array,Z.convertArray(i[e])):y.isDecimal(t)?C(Uint8Array,St.convertArray(i[e])):y.isBinary(t)||y.isFixedSizeBinary(t)?ml(i[e]):y.isBool(t)?Nn(i[e]):y.isUtf8(t)?zi(i[e].join("")):C(Uint8Array,C(t.ArrayType,i[e].map(r=>+r)))}}function ml(n){const t=n.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}class _ extends D{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,r)=>this.compareFields(i,e[r]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function rt(n,t){return t instanceof n.constructor}function rn(n,t){return n===t||rt(n,t)}function Yt(n,t){return n===t||rt(n,t)&&n.bitWidth===t.bitWidth&&n.isSigned===t.isSigned}function oi(n,t){return n===t||rt(n,t)&&n.precision===t.precision}function bl(n,t){return n===t||rt(n,t)&&n.byteWidth===t.byteWidth}function sr(n,t){return n===t||rt(n,t)&&n.unit===t.unit}function sn(n,t){return n===t||rt(n,t)&&n.unit===t.unit&&n.timezone===t.timezone}function on(n,t){return n===t||rt(n,t)&&n.unit===t.unit&&n.bitWidth===t.bitWidth}function gl(n,t){return n===t||rt(n,t)&&n.children.length===t.children.length&&ee.compareManyFields(n.children,t.children)}function _l(n,t){return n===t||rt(n,t)&&n.children.length===t.children.length&&ee.compareManyFields(n.children,t.children)}function or(n,t){return n===t||rt(n,t)&&n.mode===t.mode&&n.typeIds.every((e,i)=>e===t.typeIds[i])&&ee.compareManyFields(n.children,t.children)}function vl(n,t){return n===t||rt(n,t)&&n.id===t.id&&n.isOrdered===t.isOrdered&&ee.visit(n.indices,t.indices)&&ee.visit(n.dictionary,t.dictionary)}function ar(n,t){return n===t||rt(n,t)&&n.unit===t.unit}function wl(n,t){return n===t||rt(n,t)&&n.listSize===t.listSize&&n.children.length===t.children.length&&ee.compareManyFields(n.children,t.children)}function Sl(n,t){return n===t||rt(n,t)&&n.keysSorted===t.keysSorted&&n.children.length===t.children.length&&ee.compareManyFields(n.children,t.children)}_.prototype.visitNull=rn;_.prototype.visitBool=rn;_.prototype.visitInt=Yt;_.prototype.visitInt8=Yt;_.prototype.visitInt16=Yt;_.prototype.visitInt32=Yt;_.prototype.visitInt64=Yt;_.prototype.visitUint8=Yt;_.prototype.visitUint16=Yt;_.prototype.visitUint32=Yt;_.prototype.visitUint64=Yt;_.prototype.visitFloat=oi;_.prototype.visitFloat16=oi;_.prototype.visitFloat32=oi;_.prototype.visitFloat64=oi;_.prototype.visitUtf8=rn;_.prototype.visitBinary=rn;_.prototype.visitFixedSizeBinary=bl;_.prototype.visitDate=sr;_.prototype.visitDateDay=sr;_.prototype.visitDateMillisecond=sr;_.prototype.visitTimestamp=sn;_.prototype.visitTimestampSecond=sn;_.prototype.visitTimestampMillisecond=sn;_.prototype.visitTimestampMicrosecond=sn;_.prototype.visitTimestampNanosecond=sn;_.prototype.visitTime=on;_.prototype.visitTimeSecond=on;_.prototype.visitTimeMillisecond=on;_.prototype.visitTimeMicrosecond=on;_.prototype.visitTimeNanosecond=on;_.prototype.visitDecimal=rn;_.prototype.visitList=gl;_.prototype.visitStruct=_l;_.prototype.visitUnion=or;_.prototype.visitDenseUnion=or;_.prototype.visitSparseUnion=or;_.prototype.visitDictionary=vl;_.prototype.visitInterval=ar;_.prototype.visitIntervalDayTime=ar;_.prototype.visitIntervalYearMonth=ar;_.prototype.visitFixedSizeList=wl;_.prototype.visitMap=Sl;const ee=new _;function Ti(n,t){return ee.compareSchemas(n,t)}function pi(n,t){return Il(n,t.map(e=>e.data.concat()))}function Il(n,t){const e=[...n.fields],i=[],r={numBatches:t.reduce((d,A)=>Math.max(d,A.length),0)};let s=0,o=0,a=-1;const c=t.length;let u,h=[];for(;r.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=u=t[a].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(h=Bl(e,o,h,t,r),o>0&&(i[s++]=F({type:new G(e),length:o,nullCount:0,children:h.slice()})))}return[n=n.assign(e),i.map(d=>new tt(n,d))]}function Bl(n,t,e,i,r){var s;const o=(t+63&-64)>>3;for(let a=-1,c=i.length;++a<c;){const u=e[a],h=u==null?void 0:u.length;if(h>=t)h===t?e[a]=u:(e[a]=u.slice(0,t),r.numBatches=Math.max(r.numBatches,i[a].unshift(u.slice(t,h-t))));else{const d=n[a];n[a]=d.clone({nullable:!0}),e[a]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:F({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Mo;class K{constructor(...t){var e,i;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let r,s;t[0]instanceof U&&(r=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());const o=c=>{if(c){if(c instanceof tt)return[c];if(c instanceof K)return c.batches;if(c instanceof P){if(c.type instanceof G)return[new tt(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){const u=Object.keys(c),h=u.map(f=>new L([c[f]])),d=new U(u.map((f,$)=>new k(String(f),h[$].type))),[,A]=pi(d,h);return A.length===0?[new tt(c)]:A}}}return[]},a=t.flatMap(c=>o(c));if(r=(i=r??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&i!==void 0?i:new U([]),!(r instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof tt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Ti(r,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=r,this.batches=a,this._offsets=s??yo(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=po(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?nr.visit(new L(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
  ${this.toArray().join(`,
  `)}
]`}concat(...t){const e=this.schema,i=this.data.concat(t.flatMap(({data:r})=>r));return new K(e,i.map(r=>new tt(e,r)))}slice(t,e){const i=this.schema;[t,e]=ho({length:this.numRows},t,e);const r=mo(this.data,this._offsets,t,e);return new K(i,r.map(s=>new tt(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){const e=this.data.map(i=>i.children[t]);if(e.length===0){const{type:i}=this.schema.fields[t],r=F({type:i,length:0,nullCount:0});e.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new L(e)}return null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(r=>r.name===t),e)}setChildAt(t,e){let i=this.schema,r=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new L([F({type:new Qt,length:this.numRows})]));const s=i.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,u)=>this.getChildAt(u));[s[t],a[t]]=[o,e],[i,r]=pi(i,a)}return new K(i,r)}select(t){const e=this.schema.fields.reduce((i,r,s)=>i.set(r.name,s),new Map);return this.selectAt(t.map(i=>e.get(i)).filter(i=>i>-1))}selectAt(t){const e=this.schema.selectAt(t),i=this.batches.map(r=>r.selectAt(t));return new K(e,i)}assign(t){const e=this.schema.fields,[i,r]=t.schema.fields.reduce((a,c,u)=>{const[h,d]=a,A=e.findIndex(f=>f.name===c.name);return~A?d[A]=u:h.push(u),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,r[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new K(...pi(s,o))}}Mo=Symbol.toStringTag;K[Mo]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=De(er),n.get=De(it.getVisitFn(l.Struct)),n.set=bo(yt.getVisitFn(l.Struct)),n.indexOf=go(Ln.getVisitFn(l.Struct)),n.getByteLength=De(Lt.getVisitFn(l.Struct)),"Table"))(K.prototype);var No;let tt=class ke{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=F({nullCount:0,type:new G(this.schema.fields),children:this.schema.fields.map(e=>F({type:e.type,nullCount:0}))})]=t,!(this.data instanceof P))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Lr(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:i,children:r,length:s}=Object.keys(e).reduce((c,u,h)=>(c.children[h]=e[u],c.length=Math.max(c.length,e[u].length),c.fields[h]=k.new({name:u,type:e[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new U(i),a=F({type:new G(i),length:s,children:r,nullCount:0});[this.schema,this.data]=Lr(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=Lo(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 it.visit(this.data,t)}set(t,e){return yt.visit(this.data,t,e)}indexOf(t,e){return Ln.visit(this.data,t,e)}getByteLength(t){return Lt.visit(this.data,t)}[Symbol.iterator](){return nr.visit(new L([this.data]))}toArray(){return[...this]}concat(...t){return new K(this.schema,[this,...t])}slice(t,e){const[i]=new L([this.data]).slice(t,e).data;return new ke(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 L([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(r=>r.name===t),e)}setChildAt(t,e){let i=this.schema,r=this.data;if(t>-1&&t<this.numCols){e||(e=new L([F({type:new Qt,length:this.numRows})]));const s=i.fields.slice(),o=r.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],i=new U(s,new Map(this.schema.metadata)),r=F({type:new G(s),children:o})}return new ke(i,r)}select(t){const e=this.schema.select(t),i=new G(e.fields),r=[];for(const s of t){const o=this.schema.fields.findIndex(a=>a.name===s);~o&&(r[o]=this.data.children[o])}return new ke(e,F({type:i,length:this.numRows,children:r}))}selectAt(t){const e=this.schema.selectAt(t),i=t.map(s=>this.data.children[s]).filter(Boolean),r=F({type:new G(e.fields),length:this.numRows,children:i});return new ke(e,r)}};No=Symbol.toStringTag;tt[No]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(tt.prototype);function Lr(n,t,e=t.reduce((i,r)=>Math.max(i,r.length),0)){var i;const r=[...n.fields],s=[...t],o=(e+63&-64)>>3;for(const[a,c]of n.fields.entries()){const u=t[a];(!u||u.length!==e)&&(r[a]=c.clone({nullable:!0}),s[a]=(i=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:F({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[n.assign(r),F({type:new G(r),length:e,children:s})]}function Lo(n,t,e=new Map){for(let i=-1,r=n.length;++i<r;){const o=n[i].type,a=t[i];if(y.isDictionary(o)){if(!e.has(o.id))a.dictionary&&e.set(o.id,a.dictionary);else if(e.get(o.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Lo(o.children,a.children,e)}return e}class cr extends tt{constructor(t){const e=t.fields.map(r=>F({type:r.type})),i=F({type:new G(t.fields),nullCount:0,children:e});super(t,i)}}var jn;(function(n){n[n.BUFFER=0]="BUFFER"})(jn||(jn={}));var zn;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(zn||(zn={}));class Gt{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 Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+V),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):zn.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):jn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,zn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,jn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,i){return Gt.startBodyCompression(t),Gt.addCodec(t,e),Gt.addMethod(t,i),Gt.endBodyCompression(t)}}class Uo{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(i),t.writeInt64(e),t.offset()}}let Ro=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(i),t.writeInt64(e),t.offset()}},Ct=class Mi{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 Mi).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+V),(e||new Mi).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}nodes(t,e){const i=this.bb.__offset(this.bb_pos,6);return i?(e||new Ro).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const i=this.bb.__offset(this.bb_pos,8);return i?(e||new Uo).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new Gt).__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,t.createLong(0,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()}},Se=class Ni{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 Ni).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+V),(e||new Ni).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ct).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,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 $n;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})($n||($n={}));let Jt=class vt{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 vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+V),(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ne.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):$n.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}customMetadata(t,e){const i=this.bb.__offset(this.bb_pos,12);return i?(e||new H).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Ne.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,$n.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,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,r,s,o){return vt.startMessage(t),vt.addVersion(t,e),vt.addHeaderType(t,i),vt.addHeader(t,r),vt.addBodyLength(t,s),vt.addCustomMetadata(t,o),vt.endMessage(t)}};var Al=kt;class Ol extends D{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return ue.startNull(e),ue.endNull(e)}visitInt(t,e){return ot.startInt(e),ot.addBitWidth(e,t.bitWidth),ot.addIsSigned(e,t.isSigned),ot.endInt(e)}visitFloat(t,e){return Ft.startFloatingPoint(e),Ft.addPrecision(e,t.precision),Ft.endFloatingPoint(e)}visitBinary(t,e){return ae.startBinary(e),ae.endBinary(e)}visitBool(t,e){return ce.startBool(e),ce.endBool(e)}visitUtf8(t,e){return de.startUtf8(e),de.endUtf8(e)}visitDecimal(t,e){return Q.startDecimal(e),Q.addScale(e,t.scale),Q.addPrecision(e,t.precision),Q.addBitWidth(e,t.bitWidth),Q.endDecimal(e)}visitDate(t,e){return dn.startDate(e),dn.addUnit(e,t.unit),dn.endDate(e)}visitTime(t,e){return ft.startTime(e),ft.addUnit(e,t.unit),ft.addBitWidth(e,t.bitWidth),ft.endTime(e)}visitTimestamp(t,e){const i=t.timezone&&e.createString(t.timezone)||void 0;return pt.startTimestamp(e),pt.addUnit(e,t.unit),i!==void 0&&pt.addTimezone(e,i),pt.endTimestamp(e)}visitInterval(t,e){return Dt.startInterval(e),Dt.addUnit(e,t.unit),Dt.endInterval(e)}visitList(t,e){return le.startList(e),le.endList(e)}visitStruct(t,e){return he.startStruct_(e),he.endStruct_(e)}visitUnion(t,e){X.startTypeIdsVector(e,t.typeIds.length);const i=X.createTypeIdsVector(e,t.typeIds);return X.startUnion(e),X.addMode(e,t.mode),X.addTypeIds(e,i),X.endUnion(e)}visitDictionary(t,e){const i=this.visit(t.indices,e);return Pt.startDictionaryEncoding(e),Pt.addId(e,new Al(t.id,0)),Pt.addIsOrdered(e,t.isOrdered),i!==void 0&&Pt.addIndexType(e,i),Pt.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return At.startFixedSizeBinary(e),At.addByteWidth(e,t.byteWidth),At.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Ot.startFixedSizeList(e),Ot.addListSize(e,t.listSize),Ot.endFixedSizeList(e)}visitMap(t,e){return fn.startMap(e),fn.addKeysSorted(e,t.keysSorted),fn.endMap(e)}}const yi=new Ol;function Fl(n,t=new Map){return new U(Tl(n,t),mn(n.customMetadata),t)}function xo(n){return new lt(n.count,Eo(n.columns),Co(n.columns))}function Dl(n){return new Ut(xo(n.data),n.id,n.isDelta)}function Tl(n,t){return(n.fields||[]).filter(Boolean).map(e=>k.fromJSON(e,t))}function Ur(n,t){return(n.children||[]).filter(Boolean).map(e=>k.fromJSON(e,t))}function Eo(n){return(n||[]).reduce((t,e)=>[...t,new me(e.count,Ml(e.VALIDITY)),...Eo(e.children)],[])}function Co(n,t=[]){for(let e=-1,i=(n||[]).length;++e<i;){const r=n[e];r.VALIDITY&&t.push(new Mt(t.length,r.VALIDITY.length)),r.TYPE&&t.push(new Mt(t.length,r.TYPE.length)),r.OFFSET&&t.push(new Mt(t.length,r.OFFSET.length)),r.DATA&&t.push(new Mt(t.length,r.DATA.length)),t=Co(r.children,t)}return t}function Ml(n){return(n||[]).reduce((t,e)=>t+ +(e===0),0)}function Nl(n,t){let e,i,r,s,o,a;return!t||!(s=n.dictionary)?(o=xr(n,Ur(n,t)),r=new k(n.name,o,n.nullable,mn(n.customMetadata))):t.has(e=s.id)?(i=(i=s.indexType)?Rr(i):new Je,a=new Te(t.get(e),i,e,s.isOrdered),r=new k(n.name,a,n.nullable,mn(n.customMetadata))):(i=(i=s.indexType)?Rr(i):new Je,t.set(e,o=xr(n,Ur(n,t))),a=new Te(o,i,e,s.isOrdered),r=new k(n.name,a,n.nullable,mn(n.customMetadata))),r||null}function mn(n){return new Map(Object.entries(n||{}))}function Rr(n){return new Xt(n.isSigned,n.bitWidth)}function xr(n,t){const e=n.type.name;switch(e){case"NONE":return new Qt;case"null":return new Qt;case"binary":return new _n;case"utf8":return new vn;case"bool":return new wn;case"list":return new On((t||[])[0]);case"struct":return new G(t||[]);case"struct_":return new G(t||[])}switch(e){case"int":{const i=n.type;return new Xt(i.isSigned,i.bitWidth)}case"floatingpoint":{const i=n.type;return new Ke(et[i.precision])}case"decimal":{const i=n.type;return new Sn(i.scale,i.precision,i.bitWidth)}case"date":{const i=n.type;return new In(zt[i.unit])}case"time":{const i=n.type;return new Ge(M[i.unit],i.bitWidth)}case"timestamp":{const i=n.type;return new Bn(M[i.unit],i.timezone)}case"interval":{const i=n.type;return new An(Zt[i.unit])}case"union":{const i=n.type;return new Fn(ct[i.mode],i.typeIds||[],t||[])}case"fixedsizebinary":{const i=n.type;return new Dn(i.byteWidth)}case"fixedsizelist":{const i=n.type;return new Tn(i.listSize,(t||[])[0])}case"map":{const i=n.type;return new Mn((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var ye=kt,Ll=Oo,Ul=Me;class q{constructor(t,e,i,r){this._version=e,this._headerType=i,this.body=new Uint8Array(0),r&&(this._createHeader=()=>r),this._bodyLength=typeof t=="number"?t:t.low}static fromJSON(t,e){const i=new q(0,at.V4,e);return i._createHeader=Rl(t,e),i}static decode(t){t=new Ul(T(t));const e=Jt.getRootAsMessage(t),i=e.bodyLength(),r=e.version(),s=e.headerType(),o=new q(i,r,s);return o._createHeader=xl(e,s),o}static encode(t){const e=new Ll;let i=-1;return t.isSchema()?i=U.encode(e,t.header()):t.isRecordBatch()?i=lt.encode(e,t.header()):t.isDictionaryBatch()&&(i=Ut.encode(e,t.header())),Jt.startMessage(e),Jt.addVersion(e,at.V4),Jt.addHeader(e,i),Jt.addHeaderType(e,t.headerType),Jt.addBodyLength(e,new ye(t.bodyLength,0)),Jt.finishMessageBuffer(e,Jt.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new q(0,at.V4,N.Schema,t);if(t instanceof lt)return new q(e,at.V4,N.RecordBatch,t);if(t instanceof Ut)return new q(e,at.V4,N.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===N.Schema}isRecordBatch(){return this.headerType===N.RecordBatch}isDictionaryBatch(){return this.headerType===N.DictionaryBatch}}class lt{constructor(t,e,i){this._nodes=e,this._buffers=i,this._length=typeof t=="number"?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}}class Ut{constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=typeof e=="number"?e:e.low}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}}class Mt{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}}class me{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}}function Rl(n,t){return()=>{switch(t){case N.Schema:return U.fromJSON(n);case N.RecordBatch:return lt.fromJSON(n);case N.DictionaryBatch:return Ut.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${N[t]}, type: ${t} }`)}}function xl(n,t){return()=>{switch(t){case N.Schema:return U.decode(n.header(new wt));case N.RecordBatch:return lt.decode(n.header(new Ct),n.version());case N.DictionaryBatch:return Ut.decode(n.header(new Se),n.version())}throw new Error(`Unrecognized Message type: { name: ${N[t]}, type: ${t} }`)}}k.encode=Hl;k.decode=Wl;k.fromJSON=Nl;U.encode=Yl;U.decode=El;U.fromJSON=Fl;lt.encode=Jl;lt.decode=Cl;lt.fromJSON=xo;Ut.encode=Kl;Ut.decode=Vl;Ut.fromJSON=Dl;me.encode=Gl;me.decode=kl;Mt.encode=ql;Mt.decode=Pl;function El(n,t=new Map){const e=$l(n,t);return new U(e,bn(n),t)}function Cl(n,t=at.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new lt(n.length(),jl(n),zl(n,t))}function Vl(n,t=at.V4){return new Ut(lt.decode(n.data(),t),n.id(),n.isDelta())}function Pl(n){return new Mt(n.offset(),n.length())}function kl(n){return new me(n.length(),n.nullCount())}function jl(n){const t=[];for(let e,i=-1,r=-1,s=n.nodesLength();++i<s;)(e=n.nodes(i))&&(t[++r]=me.decode(e));return t}function zl(n,t){const e=[];for(let i,r=-1,s=-1,o=n.buffersLength();++r<o;)(i=n.buffers(r))&&(t<at.V4&&(i.bb_pos+=8*(r+1)),e[++s]=Mt.decode(i));return e}function $l(n,t){const e=[];for(let i,r=-1,s=-1,o=n.fieldsLength();++r<o;)(i=n.fields(r))&&(e[++s]=k.decode(i,t));return e}function Er(n,t){const e=[];for(let i,r=-1,s=-1,o=n.childrenLength();++r<o;)(i=n.children(r))&&(e[++s]=k.decode(i,t));return e}function Wl(n,t){let e,i,r,s,o,a;return!t||!(a=n.dictionary())?(r=Vr(n,Er(n,t)),i=new k(n.name(),r,n.nullable(),bn(n))):t.has(e=a.id().low)?(s=(s=a.indexType())?Cr(s):new Je,o=new Te(t.get(e),s,e,a.isOrdered()),i=new k(n.name(),o,n.nullable(),bn(n))):(s=(s=a.indexType())?Cr(s):new Je,t.set(e,r=Vr(n,Er(n,t))),o=new Te(r,s,e,a.isOrdered()),i=new k(n.name(),o,n.nullable(),bn(n))),i||null}function bn(n){const t=new Map;if(n)for(let e,i,r=-1,s=Math.trunc(n.customMetadataLength());++r<s;)(e=n.customMetadata(r))&&(i=e.key())!=null&&t.set(i,e.value());return t}function Cr(n){return new Xt(n.isSigned(),n.bitWidth())}function Vr(n,t){const e=n.typeType();switch(e){case j.NONE:return new Qt;case j.Null:return new Qt;case j.Binary:return new _n;case j.Utf8:return new vn;case j.Bool:return new wn;case j.List:return new On((t||[])[0]);case j.Struct_:return new G(t||[])}switch(e){case j.Int:{const i=n.type(new ot);return new Xt(i.isSigned(),i.bitWidth())}case j.FloatingPoint:{const i=n.type(new Ft);return new Ke(i.precision())}case j.Decimal:{const i=n.type(new Q);return new Sn(i.scale(),i.precision(),i.bitWidth())}case j.Date:{const i=n.type(new dn);return new In(i.unit())}case j.Time:{const i=n.type(new ft);return new Ge(i.unit(),i.bitWidth())}case j.Timestamp:{const i=n.type(new pt);return new Bn(i.unit(),i.timezone())}case j.Interval:{const i=n.type(new Dt);return new An(i.unit())}case j.Union:{const i=n.type(new X);return new Fn(i.mode(),i.typeIdsArray()||[],t||[])}case j.FixedSizeBinary:{const i=n.type(new At);return new Dn(i.byteWidth())}case j.FixedSizeList:{const i=n.type(new Ot);return new Tn(i.listSize(),(t||[])[0])}case j.Map:{const i=n.type(new fn);return new Mn((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${j[e]}" (${e})`)}function Yl(n,t){const e=t.fields.map(s=>k.encode(n,s));wt.startFieldsVector(n,e.length);const i=wt.createFieldsVector(n,e),r=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(n,[...t.metadata].map(([s,o])=>{const a=n.createString(`${s}`),c=n.createString(`${o}`);return H.startKeyValue(n),H.addKey(n,a),H.addValue(n,c),H.endKeyValue(n)})):-1;return wt.startSchema(n),wt.addFields(n,i),wt.addEndianness(n,Zl?Le.Little:Le.Big),r!==-1&&wt.addCustomMetadata(n,r),wt.endSchema(n)}function Hl(n,t){let e=-1,i=-1,r=-1;const s=t.type;let o=t.typeId;y.isDictionary(s)?(o=s.dictionary.typeId,r=yi.visit(s,n),i=yi.visit(s.dictionary,n)):i=yi.visit(s,n);const a=(s.children||[]).map(h=>k.encode(n,h)),c=ht.createChildrenVector(n,a),u=t.metadata&&t.metadata.size>0?ht.createCustomMetadataVector(n,[...t.metadata].map(([h,d])=>{const A=n.createString(`${h}`),f=n.createString(`${d}`);return H.startKeyValue(n),H.addKey(n,A),H.addValue(n,f),H.endKeyValue(n)})):-1;return t.name&&(e=n.createString(t.name)),ht.startField(n),ht.addType(n,i),ht.addTypeType(n,o),ht.addChildren(n,c),ht.addNullable(n,!!t.nullable),e!==-1&&ht.addName(n,e),r!==-1&&ht.addDictionary(n,r),u!==-1&&ht.addCustomMetadata(n,u),ht.endField(n)}function Jl(n,t){const e=t.nodes||[],i=t.buffers||[];Ct.startNodesVector(n,e.length);for(const o of e.slice().reverse())me.encode(n,o);const r=n.endVector();Ct.startBuffersVector(n,i.length);for(const o of i.slice().reverse())Mt.encode(n,o);const s=n.endVector();return Ct.startRecordBatch(n),Ct.addLength(n,new ye(t.length,0)),Ct.addNodes(n,r),Ct.addBuffers(n,s),Ct.endRecordBatch(n)}function Kl(n,t){const e=lt.encode(n,t.data);return Se.startDictionaryBatch(n),Se.addId(n,new ye(t.id,0)),Se.addIsDelta(n,t.isDelta),Se.addData(n,e),Se.endDictionaryBatch(n)}function Gl(n,t){return Ro.createFieldNode(n,new ye(t.length,0),new ye(t.nullCount,0))}function ql(n,t){return Uo.createBuffer(n,new ye(t.offset,0),new ye(t.length,0))}const Zl=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),lr=n=>`Expected ${N[n]} Message in stream, but was null or length 0.`,ur=n=>`Header pointer of flatbuffer-encoded ${N[n]} Message is null or length 0.`,Vo=(n,t)=>`Expected to read ${n} metadata bytes, but only read ${t}.`,Po=(n,t)=>`Expected to read ${n} bytes for message body, but only read ${t}.`;class ko{constructor(t){this.source=t instanceof Pn?t:new Pn(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?z:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(lr(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=T(this.source.read(t));if(e.byteLength<t)throw new Error(Po(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=N.Schema,i=this.readMessage(e),r=i==null?void 0:i.header();if(t&&!r)throw new Error(ur(e));return r}readMetadataLength(){const t=this.source.read(ai),e=t&&new Me(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}}readMetadata(t){const e=this.source.read(t);if(!e)return z;if(e.byteLength<t)throw new Error(Vo(t,e.byteLength));return{done:!1,value:q.decode(e)}}}class Ql{constructor(t,e){this.source=t instanceof Re?t:os(t)?new kn(t,e):new Re(t)}[Symbol.asyncIterator](){return this}next(){return p(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||t.value===-1&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?z:t})}throw(t){return p(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return p(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return p(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(lr(t));return e.value})}readMessageBody(t){return p(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=T(yield this.source.read(t));if(e.byteLength<t)throw new Error(Po(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return p(this,void 0,void 0,function*(){const e=N.Schema,i=yield this.readMessage(e),r=i==null?void 0:i.header();if(t&&!r)throw new Error(ur(e));return r})}readMetadataLength(){return p(this,void 0,void 0,function*(){const t=yield this.source.read(ai),e=t&&new Me(t),i=(e==null?void 0:e.readInt32(0))||0;return{done:i===0,value:i}})}readMetadata(t){return p(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return z;if(e.byteLength<t)throw new Error(Vo(t,e.byteLength));return{done:!1,value:q.decode(e)}})}}class Xl extends ko{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Mr?t:new Mr(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:q.fromJSON(t.schema,N.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:q.fromJSON(e,N.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:q.fromJSON(e,N.RecordBatch)}}return this._body=[],z}readMessageBody(t){return e(this._body);function e(i){return(i||[]).reduce((r,s)=>[...r,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...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(lr(t));return e.value}readSchema(){const t=N.Schema,e=this.readMessage(t),i=e==null?void 0:e.header();if(!e||!i)throw new Error(ur(t));return i}}const ai=4,Li="ARROW1",Ze=new Uint8Array(Li.length);for(let n=0;n<Li.length;n+=1)Ze[n]=Li.codePointAt(n);function hr(n,t=0){for(let e=-1,i=Ze.length;++e<i;)if(Ze[e]!==n[t+e])return!1;return!0}const an=Ze.length,jo=an+ai,tu=an*2+ai;class jt extends ir{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){const e=this._impl.open(t);return qt(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return dt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return dt.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 jt?t:wi(t)?ru(t):os(t)?au(t):qt(t)?p(this,void 0,void 0,function*(){return yield jt.from(yield t)}):as(t)||$i(t)||cs(t)||Ce(t)?ou(new Re(t)):su(new Pn(t))}static readAll(t){return t instanceof jt?t.isSync()?Pr(t):kr(t):wi(t)||ArrayBuffer.isView(t)||nn(t)||ss(t)?Pr(t):kr(t)}}class Wn extends jt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Tt(this,arguments,function*(){yield B(yield*hn(fe(this[Symbol.iterator]())))})}}class Yn extends jt{constructor(t){super(t),this._impl=t}readAll(){var t,e;return p(this,void 0,void 0,function*(){const i=new Array;try{for(var r=fe(this),s;s=yield r.next(),!s.done;){const o=s.value;i.push(o)}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=r.return)&&(yield e.call(r))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class zo extends Wn{constructor(t){super(t),this._impl=t}}class eu extends Yn{constructor(t){super(t),this._impl=t}}class $o{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const i=this._loadVectors(t,e,this.schema.fields),r=F({type:new G(this.schema.fields),length:t.length,children:i});return new tt(this.schema,r)}_loadDictionaryBatch(t,e){const{id:i,isDelta:r}=t,{dictionaries:s,schema:o}=this,a=s.get(i);if(r||!a){const c=o.dictionaries.get(i),u=this._loadVectors(t.data,e,[c]);return(a&&r?a.concat(new L(u)):new L(u)).memoize()}return a.memoize()}_loadVectors(t,e,i){return new To(e,t.nodes,t.buffers,this.dictionaries).visitMany(i)}}class Hn extends $o{constructor(t,e){super(e),this._reader=wi(t)?new Xl(this._handle=t):new ko(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=Yo(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):z}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):z}next(){if(this.closed)return z;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),r=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,r)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),r=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,r);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cr(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Jn extends $o{constructor(t,e){super(e),this._reader=new Ql(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return p(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 p(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Yo(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return p(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):z})}return(t){return p(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):z})}next(){return p(this,void 0,void 0,function*(){if(this.closed)return z;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const i=t.header(),r=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,r)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const i=t.header(),r=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,r);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cr(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return p(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Wo extends Hn{constructor(t,e){super(t instanceof Nr?t:new Nr(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const 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();const i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){const r=this._reader.readMessage(N.RecordBatch);if(r!=null&&r.isRecordBatch()){const s=r.header(),o=this._reader.readMessageBody(r.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;const i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){const r=this._reader.readMessage(N.DictionaryBatch);if(r!=null&&r.isDictionaryBatch()){const s=r.header(),o=this._reader.readMessageBody(r.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-jo,i=t.readInt32(e),r=t.readAt(e-i,i);return qe.decode(r)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const 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}}class nu extends Jn{constructor(t,...e){const i=typeof e[0]!="number"?e.shift():void 0,r=e[0]instanceof Map?e.shift():void 0;super(t instanceof kn?t:new kn(t,i),r)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return p(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return p(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){const r=yield this._reader.readMessage(N.RecordBatch);if(r!=null&&r.isRecordBatch()){const s=r.header(),o=yield this._reader.readMessageBody(r.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return p(this,void 0,void 0,function*(){const i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){const r=yield this._reader.readMessage(N.DictionaryBatch);if(r!=null&&r.isDictionaryBatch()){const s=r.header(),o=yield this._reader.readMessageBody(r.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return p(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-jo,i=yield t.readInt32(e),r=yield t.readAt(e-i,i);return qe.decode(r)})}_readNextMessageAndValidate(t){return p(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}}class iu extends Hn{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new yl(e,t.nodes,t.buffers,this.dictionaries).visitMany(i)}}function Yo(n,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:n.autoDestroy}function*Pr(n){const t=jt.from(n);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function kr(n){return Tt(this,arguments,function*(){const e=yield B(jt.from(n));try{if(!(yield B(e.open({autoDestroy:!1}))).closed)do yield yield B(e);while(!(yield B(e.reset().open())).closed)}finally{yield B(e.cancel())}})}function ru(n){return new Wn(new iu(n))}function su(n){const t=n.peek(an+7&-8);return t&&t.byteLength>=4?hr(t)?new zo(new Wo(n.read())):new Wn(new Hn(n)):new Wn(new Hn(function*(){}()))}function ou(n){return p(this,void 0,void 0,function*(){const t=yield n.peek(an+7&-8);return t&&t.byteLength>=4?hr(t)?new zo(new Wo(yield n.read())):new Yn(new Jn(n)):new Yn(new Jn(function(){return Tt(this,arguments,function*(){})}()))})}function au(n){return p(this,void 0,void 0,function*(){const{size:t}=yield n.stat(),e=new kn(n,t);return t>=tu&&hr(yield e.readAt(0,an+7&-8))?new eu(new nu(e)):new Yn(new Jn(e))})}class W extends D{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){const e=r=>r.flatMap(s=>Array.isArray(s)?e(s):s instanceof tt?s.data.children:s.data),i=new W;return i.visitMany(e(t)),i}visit(t){if(t instanceof L)return this.visitMany(t.data),this;const{type:e}=t;if(!y.isDictionary(e)){const{length:i,nullCount:r}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");y.isNull(e)||bt.call(this,r<=0?new Uint8Array(0):Qi(t.offset,i,t.nullBitmap)),this.nodes.push(new me(i,r))}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 bt(n){const t=n.byteLength+7&-8;return this.buffers.push(n),this.bufferRegions.push(new Mt(this._byteLength,t)),this._byteLength+=t,this}function cu(n){const{type:t,length:e,typeIds:i,valueOffsets:r}=n;if(bt.call(this,i),t.mode===ct.Sparse)return Ui.call(this,n);if(t.mode===ct.Dense){if(n.offset<=0)return bt.call(this,r),Ui.call(this,n);{const s=i.reduce((h,d)=>Math.max(h,d),i[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),c=new Int32Array(e),u=Yi(-r[0],e,r);for(let h,d,A=-1;++A<e;)(d=a[h=i[A]])===-1&&(d=a[h]=u[h]),c[A]=u[A]-d,++o[h];bt.call(this,c);for(let h,d=-1,A=t.children.length;++d<A;)if(h=n.children[d]){const f=t.typeIds[d],$=Math.min(e,o[f]);this.visit(h.slice(a[f],$))}}}return this}function lu(n){let t;return n.nullCount>=n.length?bt.call(this,new Uint8Array(0)):(t=n.values)instanceof Uint8Array?bt.call(this,Qi(n.offset,n.length,t)):bt.call(this,Nn(n.values))}function se(n){return bt.call(this,n.values.subarray(0,n.length*n.stride))}function Ho(n){const{length:t,values:e,valueOffsets:i}=n,r=i[0],s=i[t],o=Math.min(s-r,e.byteLength-r);return bt.call(this,Yi(-i[0],t,i)),bt.call(this,e.subarray(r,r+o)),this}function dr(n){const{length:t,valueOffsets:e}=n;return e&&bt.call(this,Yi(e[0],t,e)),this.visit(n.children[0])}function Ui(n){return this.visitMany(n.type.children.map((t,e)=>n.children[e]).filter(Boolean))[0]}W.prototype.visitBool=lu;W.prototype.visitInt=se;W.prototype.visitFloat=se;W.prototype.visitUtf8=Ho;W.prototype.visitBinary=Ho;W.prototype.visitFixedSizeBinary=se;W.prototype.visitDate=se;W.prototype.visitTimestamp=se;W.prototype.visitTime=se;W.prototype.visitDecimal=se;W.prototype.visitList=dr;W.prototype.visitStruct=Ui;W.prototype.visitUnion=cu;W.prototype.visitInterval=se;W.prototype.visitFixedSizeList=dr;W.prototype.visitMap=dr;class Jo extends ir{constructor(t){super(),this._position=0,this._started=!1,this._sink=new yn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,nt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}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')}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return qt(t)?t.then(e=>this.writeAll(e)):Ce(t)?mr(this,t):yr(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 yn?this._sink=t:(this._sink=new yn,t&&Ma(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Na(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!Ti(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof K&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof tt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!Ti(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof tt?t instanceof cr||this._writeRecordBatch(t):t instanceof K?this.writeAll(t.batches):nn(t)&&this.writeAll(t)}_writeMessage(t,e=8){const i=e-1,r=q.encode(t),s=r.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+i&~i,c=a-s-o;return t.headerType===N.RecordBatch?this._recordBatchBlocks.push(new te(a,t.bodyLength,this._position)):t.headerType===N.DictionaryBatch&&this._dictionaryBlocks.push(new te(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(r),this._writePadding(c)}_write(t){if(this._started){const e=T(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(q.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Ze)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:i,bufferRegions:r,buffers:s}=W.assemble(t),o=new lt(t.numRows,i,r),a=q.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,i=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));const{byteLength:r,nodes:s,bufferRegions:o,buffers:a}=W.assemble(new L([t])),c=new lt(t.length,s,o),u=new Ut(c,e,i),h=q.from(u,r);return this._writeMessage(h)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,i,r;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(i=e.byteLength)>0&&(this._write(e),(r=(i+7&-8)-i)>0&&this._writePadding(r));return this}_writeDictionaries(t){for(let[e,i]of t.dictionaries){let r=this._dictionaryDeltaOffsets.get(e)||0;if(r===0||(i=i==null?void 0:i.slice(r)).length>0)for(const s of i.data)this._writeDictionaryBatch(s,e,r>0),r+=s.length}return this}}class fr extends Jo{static writeAll(t,e){const i=new fr(e);return qt(t)?t.then(r=>i.writeAll(r)):Ce(t)?mr(i,t):yr(i,t)}}class pr extends Jo{static writeAll(t){const e=new pr;return qt(t)?t.then(i=>e.writeAll(i)):Ce(t)?mr(e,t):yr(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=qe.encode(new qe(t,at.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function yr(n,t){let e=t;t instanceof K&&(e=t.batches,n.reset(void 0,t.schema));for(const i of e)n.write(i);return n.finish()}function mr(n,t){var e,i,r,s;return p(this,void 0,void 0,function*(){try{for(e=fe(t);i=yield e.next(),!i.done;){const o=i.value;n.write(o)}}catch(o){r={error:o}}finally{try{i&&!i.done&&(s=e.return)&&(yield s.call(e))}finally{if(r)throw r.error}}return n.finish()})}function je(n){const t=jt.from(n);return qt(t)?t.then(e=>je(e)):t.isAsync()?t.readAll().then(e=>new K(e)):new K(t.readAll())}function mi(n,t="stream"){return(t==="stream"?fr:pr).writeAll(n).toUint8Array(!0)}var jr=function(){function n(t,e,i,r){var s=this;this.getCell=function(o,a){var c=o<s.headerRows&&a<s.headerColumns,u=o>=s.headerRows&&a<s.headerColumns,h=o<s.headerRows&&a>=s.headerColumns;if(c){var d=["blank"];return a>0&&d.push("level"+o),{type:"blank",classNames:d.join(" "),content:""}}else if(h){var A=a-s.headerColumns,d=["col_heading","level"+o,"col"+A];return{type:"columns",classNames:d.join(" "),content:s.getContent(s.columnsTable,A,o)}}else if(u){var f=o-s.headerRows,d=["row_heading","level"+a,"row"+f];return{type:"index",id:"T_".concat(s.uuid,"level").concat(a,"_row").concat(f),classNames:d.join(" "),content:s.getContent(s.indexTable,f,a)}}else{var f=o-s.headerRows,A=a-s.headerColumns,d=["data","row"+f,"col"+A],$=s.styler?s.getContent(s.styler.displayValuesTable,f,A):s.getContent(s.dataTable,f,A);return{type:"data",id:"T_".concat(s.uuid,"row").concat(f,"_col").concat(A),classNames:d.join(" "),content:$}}},this.getContent=function(o,a,c){var u=o.getChildAt(c);if(u===null)return"";var h=s.getColumnTypeId(o,c);switch(h){case l.Timestamp:return s.nanosToDate(u.get(a));default:return u.get(a)}},this.dataTable=je(t),this.indexTable=je(e),this.columnsTable=je(i),this.styler=r?{caption:r.caption,displayValuesTable:je(r.displayValues),styles:r.styles,uuid:r.uuid}:void 0}return Object.defineProperty(n.prototype,"rows",{get:function(){return this.indexTable.numRows+this.columnsTable.numCols},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.numRows},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dataRows",{get:function(){return this.dataTable.numRows},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"table",{get:function(){return this.dataTable},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"index",{get:function(){return this.indexTable},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!1,configurable:!0}),n.prototype.serialize=function(){return{data:mi(this.dataTable),index:mi(this.indexTable),columns:mi(this.columnsTable)}},n.prototype.getColumnTypeId=function(t,e){return t.schema.fields[e].type.typeId},n.prototype.nanosToDate=function(t){return new Date(t/1e6)},n}(),$e=function(){return $e=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},$e.apply(this,arguments)},We;(function(n){n.COMPONENT_READY="streamlit:componentReady",n.SET_COMPONENT_VALUE="streamlit:setComponentValue",n.SET_FRAME_HEIGHT="streamlit:setFrameHeight"})(We||(We={}));var ne=function(){function n(){}return n.API_VERSION=1,n.RENDER_EVENT="streamlit:render",n.events=new EventTarget,n.registeredMessageListener=!1,n.setComponentReady=function(){n.registeredMessageListener||(window.addEventListener("message",n.onMessageEvent),n.registeredMessageListener=!0),n.sendBackMsg(We.COMPONENT_READY,{apiVersion:n.API_VERSION})},n.setFrameHeight=function(t){t===void 0&&(t=document.body.scrollHeight),t!==n.lastFrameHeight&&(n.lastFrameHeight=t,n.sendBackMsg(We.SET_FRAME_HEIGHT,{height:t}))},n.setComponentValue=function(t){var e;t instanceof jr?(e="dataframe",t=t.serialize()):hu(t)?(e="bytes",t=new Uint8Array(t.buffer)):t instanceof ArrayBuffer?(e="bytes",t=new Uint8Array(t)):e="json",n.sendBackMsg(We.SET_COMPONENT_VALUE,{value:t,dataType:e})},n.onMessageEvent=function(t){var e=t.data.type;switch(e){case n.RENDER_EVENT:n.onRenderMessage(t.data);break}},n.onRenderMessage=function(t){var e=t.args;e==null&&(console.error("Got null args in onRenderMessage. This should never happen"),e={});var i=t.dfs&&t.dfs.length>0?n.argsDataframeToObject(t.dfs):{};e=$e($e({},e),i);var r=!!t.disabled,s=t.theme;s&&uu(s);var o={disabled:r,args:e,theme:s},a=new CustomEvent(n.RENDER_EVENT,{detail:o});n.events.dispatchEvent(a)},n.argsDataframeToObject=function(t){var e=t.map(function(i){var r=i.key,s=i.value;return[r,n.toArrowTable(s)]});return Object.fromEntries(e)},n.toArrowTable=function(t){var e,i=(e=t.data,e.data),r=e.index,s=e.columns,o=e.styler;return new jr(i,r,s,o)},n.sendBackMsg=function(t,e){window.parent.postMessage($e({isStreamlitMessage:!0,type:t},e),"*")},n}(),uu=function(n){var t=document.createElement("style");document.head.appendChild(t),t.innerHTML=`
    :root {
      --primary-color: `.concat(n.primaryColor,`;
      --background-color: `).concat(n.backgroundColor,`;
      --secondary-background-color: `).concat(n.secondaryBackgroundColor,`;
      --text-color: `).concat(n.textColor,`;
      --font: `).concat(n.font,`;
    }

    body {
      background-color: var(--background-color);
      color: var(--text-color);
    }
  `)};function hu(n){var t=!1;try{t=n instanceof BigInt64Array||n instanceof BigUint64Array}catch{}return n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array||t}var du=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();(function(n){du(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){ne.setFrameHeight()},t.prototype.componentDidUpdate=function(){ne.setFrameHeight()},t})(Aa.PureComponent);const fu=document.body.appendChild(document.createElement("span")),br=fu.appendChild(document.createElement("button"));br.textContent="按这里";let zr=0;br.onclick=function(){zr+=1,ne.setComponentValue(zr)};function pu(n){ne.setFrameHeight(br.offsetHeight+10)}ne.events.addEventListener(ne.RENDER_EVENT,pu);ne.setComponentReady();ne.setFrameHeight();
