(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();function Lo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wn={exports:{}},j={};/** @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 Ki;function Mo(){if(Ki)return j;Ki=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,s=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,b=e?Symbol.for("react.suspense"):60113,_=e?Symbol.for("react.suspense_list"):60120,v=e?Symbol.for("react.memo"):60115,C=e?Symbol.for("react.lazy"):60116,et=e?Symbol.for("react.block"):60121,ot=e?Symbol.for("react.fundamental"):60117,ut=e?Symbol.for("react.responder"):60118,zt=e?Symbol.for("react.scope"):60119;function X(g){if(typeof g=="object"&&g!==null){var yt=g.$$typeof;switch(yt){case t:switch(g=g.type,g){case c:case u:case n:case a:case s:case b:return g;default:switch(g=g&&g.$$typeof,g){case o:case d:case C:case v:case i:return g;default:return yt}}case r:return yt}}}function $t(g){return X(g)===u}return j.AsyncMode=c,j.ConcurrentMode=u,j.ContextConsumer=o,j.ContextProvider=i,j.Element=t,j.ForwardRef=d,j.Fragment=n,j.Lazy=C,j.Memo=v,j.Portal=r,j.Profiler=a,j.StrictMode=s,j.Suspense=b,j.isAsyncMode=function(g){return $t(g)||X(g)===c},j.isConcurrentMode=$t,j.isContextConsumer=function(g){return X(g)===o},j.isContextProvider=function(g){return X(g)===i},j.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===t},j.isForwardRef=function(g){return X(g)===d},j.isFragment=function(g){return X(g)===n},j.isLazy=function(g){return X(g)===C},j.isMemo=function(g){return X(g)===v},j.isPortal=function(g){return X(g)===r},j.isProfiler=function(g){return X(g)===a},j.isStrictMode=function(g){return X(g)===s},j.isSuspense=function(g){return X(g)===b},j.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===u||g===a||g===s||g===b||g===_||typeof g=="object"&&g!==null&&(g.$$typeof===C||g.$$typeof===v||g.$$typeof===i||g.$$typeof===o||g.$$typeof===d||g.$$typeof===ot||g.$$typeof===ut||g.$$typeof===zt||g.$$typeof===et)},j.typeOf=X,j}var Ji;function Eo(){return Ji||(Ji=1,wn.exports=Mo()),wn.exports}var vn,Gi;function Uo(){if(Gi)return vn;Gi=1;var e=Eo(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},n={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},a={};a[e.ForwardRef]=n,a[e.Memo]=s;function i(C){return e.isMemo(C)?s:a[C.$$typeof]||t}var o=Object.defineProperty,c=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,b=Object.getPrototypeOf,_=Object.prototype;function v(C,et,ot){if(typeof et!="string"){if(_){var ut=b(et);ut&&ut!==_&&v(C,ut,ot)}var zt=c(et);u&&(zt=zt.concat(u(et)));for(var X=i(C),$t=i(et),g=0;g<zt.length;++g){var yt=zt[g];if(!r[yt]&&!(ot&&ot[yt])&&!($t&&$t[yt])&&!(X&&X[yt])){var mr=d(et,yt);try{o(C,yt,mr)}catch{}}}}return C}return vn=v,vn}Uo();var In={exports:{}},P={};/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var Sn,Zi;function No(){if(Zi)return Sn;Zi=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function n(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function s(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var i={},o=0;o<10;o++)i["_"+String.fromCharCode(o)]=o;var c=Object.getOwnPropertyNames(i).map(function(d){return i[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Sn=s()?Object.assign:function(a,i){for(var o,c=n(a),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var b in o)t.call(o,b)&&(c[b]=o[b]);if(e){u=e(o);for(var _=0;_<u.length;_++)r.call(o,u[_])&&(c[u[_]]=o[u[_]])}}return c},Sn}/** @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 Qi;function Vo(){if(Qi)return P;Qi=1;var e=No(),t=typeof Symbol=="function"&&Symbol.for,r=t?Symbol.for("react.element"):60103,n=t?Symbol.for("react.portal"):60106,s=t?Symbol.for("react.fragment"):60107,a=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,o=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,u=t?Symbol.for("react.forward_ref"):60112,d=t?Symbol.for("react.suspense"):60113,b=t?Symbol.for("react.memo"):60115,_=t?Symbol.for("react.lazy"):60116,v=typeof Symbol=="function"&&Symbol.iterator;function C(h){for(var y="https://reactjs.org/docs/error-decoder.html?invariant="+h,x=1;x<arguments.length;x++)y+="&args[]="+encodeURIComponent(arguments[x]);return"Minified React error #"+h+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var et={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ot={};function ut(h,y,x){this.props=h,this.context=y,this.refs=ot,this.updater=x||et}ut.prototype.isReactComponent={},ut.prototype.setState=function(h,y){if(typeof h!="object"&&typeof h!="function"&&h!=null)throw Error(C(85));this.updater.enqueueSetState(this,h,y,"setState")},ut.prototype.forceUpdate=function(h){this.updater.enqueueForceUpdate(this,h,"forceUpdate")};function zt(){}zt.prototype=ut.prototype;function X(h,y,x){this.props=h,this.context=y,this.refs=ot,this.updater=x||et}var $t=X.prototype=new zt;$t.constructor=X,e($t,ut.prototype),$t.isPureReactComponent=!0;var g={current:null},yt=Object.prototype.hasOwnProperty,mr={key:!0,ref:!0,__self:!0,__source:!0};function pn(h,y,x){var $,R={},rt=null,It=null;if(y!=null)for($ in y.ref!==void 0&&(It=y.ref),y.key!==void 0&&(rt=""+y.key),y)yt.call(y,$)&&!mr.hasOwnProperty($)&&(R[$]=y[$]);var G=arguments.length-2;if(G===1)R.children=x;else if(1<G){for(var lt=Array(G),Yt=0;Yt<G;Yt++)lt[Yt]=arguments[Yt+2];R.children=lt}if(h&&h.defaultProps)for($ in G=h.defaultProps,G)R[$]===void 0&&(R[$]=G[$]);return{$$typeof:r,type:h,key:rt,ref:It,props:R,_owner:g.current}}function To(h,y){return{$$typeof:r,type:h.type,key:y,ref:h.ref,props:h.props,_owner:h._owner}}function yn(h){return typeof h=="object"&&h!==null&&h.$$typeof===r}function Fo(h){var y={"=":"=0",":":"=2"};return"$"+(""+h).replace(/[=:]/g,function(x){return y[x]})}var Wi=/\/+/g,gr=[];function Yi(h,y,x,$){if(gr.length){var R=gr.pop();return R.result=h,R.keyPrefix=y,R.func=x,R.context=$,R.count=0,R}return{result:h,keyPrefix:y,func:x,context:$,count:0}}function Hi(h){h.result=null,h.keyPrefix=null,h.func=null,h.context=null,h.count=0,10>gr.length&&gr.push(h)}function bn(h,y,x,$){var R=typeof h;(R==="undefined"||R==="boolean")&&(h=null);var rt=!1;if(h===null)rt=!0;else switch(R){case"string":case"number":rt=!0;break;case"object":switch(h.$$typeof){case r:case n:rt=!0}}if(rt)return x($,h,y===""?"."+gn(h,0):y),1;if(rt=0,y=y===""?".":y+":",Array.isArray(h))for(var It=0;It<h.length;It++){R=h[It];var G=y+gn(R,It);rt+=bn(R,G,x,$)}else if(h===null||typeof h!="object"?G=null:(G=v&&h[v]||h["@@iterator"],G=typeof G=="function"?G:null),typeof G=="function")for(h=G.call(h),It=0;!(R=h.next()).done;)R=R.value,G=y+gn(R,It++),rt+=bn(R,G,x,$);else if(R==="object")throw x=""+h,Error(C(31,x==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":x,""));return rt}function mn(h,y,x){return h==null?0:bn(h,"",y,x)}function gn(h,y){return typeof h=="object"&&h!==null&&h.key!=null?Fo(h.key):y.toString(36)}function Oo(h,y){h.func.call(h.context,y,h.count++)}function Do(h,y,x){var $=h.result,R=h.keyPrefix;h=h.func.call(h.context,y,h.count++),Array.isArray(h)?_n(h,$,x,function(rt){return rt}):h!=null&&(yn(h)&&(h=To(h,R+(!h.key||y&&y.key===h.key?"":(""+h.key).replace(Wi,"$&/")+"/")+x)),$.push(h))}function _n(h,y,x,$,R){var rt="";x!=null&&(rt=(""+x).replace(Wi,"$&/")+"/"),y=Yi(y,rt,$,R),mn(h,Do,y),Hi(y)}var qi={current:null};function Wt(){var h=qi.current;if(h===null)throw Error(C(321));return h}var xo={ReactCurrentDispatcher:qi,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:g,IsSomeRendererActing:{current:!1},assign:e};return P.Children={map:function(h,y,x){if(h==null)return h;var $=[];return _n(h,$,null,y,x),$},forEach:function(h,y,x){if(h==null)return h;y=Yi(null,null,y,x),mn(h,Oo,y),Hi(y)},count:function(h){return mn(h,function(){return null},null)},toArray:function(h){var y=[];return _n(h,y,null,function(x){return x}),y},only:function(h){if(!yn(h))throw Error(C(143));return h}},P.Component=ut,P.Fragment=s,P.Profiler=i,P.PureComponent=X,P.StrictMode=a,P.Suspense=d,P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xo,P.cloneElement=function(h,y,x){if(h==null)throw Error(C(267,h));var $=e({},h.props),R=h.key,rt=h.ref,It=h._owner;if(y!=null){if(y.ref!==void 0&&(rt=y.ref,It=g.current),y.key!==void 0&&(R=""+y.key),h.type&&h.type.defaultProps)var G=h.type.defaultProps;for(lt in y)yt.call(y,lt)&&!mr.hasOwnProperty(lt)&&($[lt]=y[lt]===void 0&&G!==void 0?G[lt]:y[lt])}var lt=arguments.length-2;if(lt===1)$.children=x;else if(1<lt){G=Array(lt);for(var Yt=0;Yt<lt;Yt++)G[Yt]=arguments[Yt+2];$.children=G}return{$$typeof:r,type:h.type,key:R,ref:rt,props:$,_owner:It}},P.createContext=function(h,y){return y===void 0&&(y=null),h={$$typeof:c,_calculateChangedBits:y,_currentValue:h,_currentValue2:h,_threadCount:0,Provider:null,Consumer:null},h.Provider={$$typeof:o,_context:h},h.Consumer=h},P.createElement=pn,P.createFactory=function(h){var y=pn.bind(null,h);return y.type=h,y},P.createRef=function(){return{current:null}},P.forwardRef=function(h){return{$$typeof:u,render:h}},P.isValidElement=yn,P.lazy=function(h){return{$$typeof:_,_ctor:h,_status:-1,_result:null}},P.memo=function(h,y){return{$$typeof:b,type:h,compare:y===void 0?null:y}},P.useCallback=function(h,y){return Wt().useCallback(h,y)},P.useContext=function(h,y){return Wt().useContext(h,y)},P.useDebugValue=function(){},P.useEffect=function(h,y){return Wt().useEffect(h,y)},P.useImperativeHandle=function(h,y,x){return Wt().useImperativeHandle(h,y,x)},P.useLayoutEffect=function(h,y){return Wt().useLayoutEffect(h,y)},P.useMemo=function(h,y){return Wt().useMemo(h,y)},P.useReducer=function(h,y,x){return Wt().useReducer(h,y,x)},P.useRef=function(h){return Wt().useRef(h)},P.useState=function(h){return Wt().useState(h)},P.version="16.14.0",P}var Xi;function Ro(){return Xi||(Xi=1,In.exports=Vo()),In.exports}var Co=Ro();const ko=Lo(Co),Es=new WeakMap,kn=new WeakMap;function J(e){const t=Es.get(e);return console.assert(t!=null,"'this' is expected an Event object, but got",e),t}function ts(e){if(e.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener);return}e.event.cancelable&&(e.canceled=!0,typeof e.event.preventDefault=="function"&&e.event.preventDefault())}function Oe(e,t){Es.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const r=Object.keys(t);for(let n=0;n<r.length;++n){const s=r[n];s in this||Object.defineProperty(this,s,Us(s))}}Oe.prototype={get type(){return J(this).event.type},get target(){return J(this).eventTarget},get currentTarget(){return J(this).currentTarget},composedPath(){const e=J(this).currentTarget;return e==null?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return J(this).eventPhase},stopPropagation(){const e=J(this);e.stopped=!0,typeof e.event.stopPropagation=="function"&&e.event.stopPropagation()},stopImmediatePropagation(){const e=J(this);e.stopped=!0,e.immediateStopped=!0,typeof e.event.stopImmediatePropagation=="function"&&e.event.stopImmediatePropagation()},get bubbles(){return!!J(this).event.bubbles},get cancelable(){return!!J(this).event.cancelable},preventDefault(){ts(J(this))},get defaultPrevented(){return J(this).canceled},get composed(){return!!J(this).event.composed},get timeStamp(){return J(this).timeStamp},get srcElement(){return J(this).eventTarget},get cancelBubble(){return J(this).stopped},set cancelBubble(e){if(!e)return;const t=J(this);t.stopped=!0,typeof t.event.cancelBubble=="boolean"&&(t.event.cancelBubble=!0)},get returnValue(){return!J(this).canceled},set returnValue(e){e||ts(J(this))},initEvent(){}};Object.defineProperty(Oe.prototype,"constructor",{value:Oe,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(Oe.prototype,window.Event.prototype),kn.set(window.Event.prototype,Oe));function Us(e){return{get(){return J(this).event[e]},set(t){J(this).event[e]=t},configurable:!0,enumerable:!0}}function jo(e){return{value(){const t=J(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function Po(e,t){const r=Object.keys(t);if(r.length===0)return e;function n(s,a){e.call(this,s,a)}n.prototype=Object.create(e.prototype,{constructor:{value:n,configurable:!0,writable:!0}});for(let s=0;s<r.length;++s){const a=r[s];if(!(a in e.prototype)){const o=typeof Object.getOwnPropertyDescriptor(t,a).value=="function";Object.defineProperty(n.prototype,a,o?jo(a):Us(a))}}return n}function Ns(e){if(e==null||e===Object.prototype)return Oe;let t=kn.get(e);return t==null&&(t=Po(Ns(Object.getPrototypeOf(e)),e),kn.set(e,t)),t}function zo(e,t){const r=Ns(Object.getPrototypeOf(t));return new r(e,t)}function $o(e){return J(e).immediateStopped}function Wo(e,t){J(e).eventPhase=t}function Yo(e,t){J(e).currentTarget=t}function es(e,t){J(e).passiveListener=t}const Vs=new WeakMap,rs=1,ns=2,Ar=3;function Tr(e){return e!==null&&typeof e=="object"}function Ye(e){const t=Vs.get(e);if(t==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function Ho(e){return{get(){let r=Ye(this).get(e);for(;r!=null;){if(r.listenerType===Ar)return r.listener;r=r.next}return null},set(t){typeof t!="function"&&!Tr(t)&&(t=null);const r=Ye(this);let n=null,s=r.get(e);for(;s!=null;)s.listenerType===Ar?n!==null?n.next=s.next:s.next!==null?r.set(e,s.next):r.delete(e):n=s,s=s.next;if(t!==null){const a={listener:t,listenerType:Ar,passive:!1,once:!1,next:null};n===null?r.set(e,a):n.next=a}},configurable:!0,enumerable:!0}}function qo(e,t){Object.defineProperty(e,`on${t}`,Ho(t))}function is(e){function t(){re.call(this)}t.prototype=Object.create(re.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let r=0;r<e.length;++r)qo(t.prototype,e[r]);return t}function re(){if(this instanceof re){Vs.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return is(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return is(e)}throw new TypeError("Cannot call a class as a function")}re.prototype={addEventListener(e,t,r){if(t==null)return;if(typeof t!="function"&&!Tr(t))throw new TypeError("'listener' should be a function or an object.");const n=Ye(this),s=Tr(r),i=(s?!!r.capture:!!r)?rs:ns,o={listener:t,listenerType:i,passive:s&&!!r.passive,once:s&&!!r.once,next:null};let c=n.get(e);if(c===void 0){n.set(e,o);return}let u=null;for(;c!=null;){if(c.listener===t&&c.listenerType===i)return;u=c,c=c.next}u.next=o},removeEventListener(e,t,r){if(t==null)return;const n=Ye(this),a=(Tr(r)?!!r.capture:!!r)?rs:ns;let i=null,o=n.get(e);for(;o!=null;){if(o.listener===t&&o.listenerType===a){i!==null?i.next=o.next:o.next!==null?n.set(e,o.next):n.delete(e);return}i=o,o=o.next}},dispatchEvent(e){if(e==null||typeof e.type!="string")throw new TypeError('"event.type" should be a string.');const t=Ye(this),r=e.type;let n=t.get(r);if(n==null)return!0;const s=zo(this,e);let a=null;for(;n!=null;){if(n.once?a!==null?a.next=n.next:n.next!==null?t.set(r,n.next):t.delete(r):a=n,es(s,n.passive?n.listener:null),typeof n.listener=="function")try{n.listener.call(this,s)}catch(i){typeof console<"u"&&typeof console.error=="function"&&console.error(i)}else n.listenerType!==Ar&&typeof n.listener.handleEvent=="function"&&n.listener.handleEvent(s);if($o(s))break;n=n.next}return es(s,null),Wo(s,0),Yo(s,null),!s.defaultPrevented}};Object.defineProperty(re.prototype,"constructor",{value:re,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(re.prototype,window.EventTarget.prototype);var f={};f.SIZEOF_SHORT=2;f.SIZEOF_INT=4;f.FILE_IDENTIFIER_LENGTH=4;f.Encoding={UTF8_BYTES:1,UTF16_STRING:2};f.int32=new Int32Array(2);f.float32=new Float32Array(f.int32.buffer);f.float64=new Float64Array(f.int32.buffer);f.isLittleEndian=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;f.Long=function(e,t){this.low=e|0,this.high=t|0};f.Long.create=function(e,t){return e==0&&t==0?f.Long.ZERO:new f.Long(e,t)};f.Long.prototype.toFloat64=function(){return(this.low>>>0)+this.high*4294967296};f.Long.prototype.equals=function(e){return this.low==e.low&&this.high==e.high};f.Long.ZERO=new f.Long(0,0);f.Builder=function(e){if(e)var t=e;else var t=1024;this.bb=f.ByteBuffer.allocate(t),this.space=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};f.Builder.prototype.clear=function(){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};f.Builder.prototype.forceDefaults=function(e){this.force_defaults=e};f.Builder.prototype.dataBuffer=function(){return this.bb};f.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())};f.Builder.prototype.prep=function(e,t){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+t)+1&e-1;this.space<r+e+t;){var n=this.bb.capacity();this.bb=f.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)};f.Builder.prototype.pad=function(e){for(var t=0;t<e;t++)this.bb.writeInt8(--this.space,0)};f.Builder.prototype.writeInt8=function(e){this.bb.writeInt8(this.space-=1,e)};f.Builder.prototype.writeInt16=function(e){this.bb.writeInt16(this.space-=2,e)};f.Builder.prototype.writeInt32=function(e){this.bb.writeInt32(this.space-=4,e)};f.Builder.prototype.writeInt64=function(e){this.bb.writeInt64(this.space-=8,e)};f.Builder.prototype.writeFloat32=function(e){this.bb.writeFloat32(this.space-=4,e)};f.Builder.prototype.writeFloat64=function(e){this.bb.writeFloat64(this.space-=8,e)};f.Builder.prototype.addInt8=function(e){this.prep(1,0),this.writeInt8(e)};f.Builder.prototype.addInt16=function(e){this.prep(2,0),this.writeInt16(e)};f.Builder.prototype.addInt32=function(e){this.prep(4,0),this.writeInt32(e)};f.Builder.prototype.addInt64=function(e){this.prep(8,0),this.writeInt64(e)};f.Builder.prototype.addFloat32=function(e){this.prep(4,0),this.writeFloat32(e)};f.Builder.prototype.addFloat64=function(e){this.prep(8,0),this.writeFloat64(e)};f.Builder.prototype.addFieldInt8=function(e,t,r){(this.force_defaults||t!=r)&&(this.addInt8(t),this.slot(e))};f.Builder.prototype.addFieldInt16=function(e,t,r){(this.force_defaults||t!=r)&&(this.addInt16(t),this.slot(e))};f.Builder.prototype.addFieldInt32=function(e,t,r){(this.force_defaults||t!=r)&&(this.addInt32(t),this.slot(e))};f.Builder.prototype.addFieldInt64=function(e,t,r){(this.force_defaults||!t.equals(r))&&(this.addInt64(t),this.slot(e))};f.Builder.prototype.addFieldFloat32=function(e,t,r){(this.force_defaults||t!=r)&&(this.addFloat32(t),this.slot(e))};f.Builder.prototype.addFieldFloat64=function(e,t,r){(this.force_defaults||t!=r)&&(this.addFloat64(t),this.slot(e))};f.Builder.prototype.addFieldOffset=function(e,t,r){(this.force_defaults||t!=r)&&(this.addOffset(t),this.slot(e))};f.Builder.prototype.addFieldStruct=function(e,t,r){t!=r&&(this.nested(t),this.slot(e))};f.Builder.prototype.nested=function(e){if(e!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")};f.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")};f.Builder.prototype.slot=function(e){this.vtable[e]=this.offset()};f.Builder.prototype.offset=function(){return this.bb.capacity()-this.space};f.Builder.growByteBuffer=function(e){var t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var r=t<<1,n=f.ByteBuffer.allocate(r);return n.setPosition(r-t),n.bytes().set(e.bytes(),r-t),n};f.Builder.prototype.addOffset=function(e){this.prep(f.SIZEOF_INT,0),this.writeInt32(this.offset()-e+f.SIZEOF_INT)};f.Builder.prototype.startObject=function(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(var t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()};f.Builder.prototype.endObject=function(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var e=this.offset(),t=this.vtable_in_use-1;t>=0&&this.vtable[t]==0;t--);for(var r=t+1;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);var n=2;this.addInt16(e-this.object_start);var s=(r+n)*f.SIZEOF_SHORT;this.addInt16(s);var a=0,i=this.space;t:for(t=0;t<this.vtables.length;t++){var o=this.bb.capacity()-this.vtables[t];if(s==this.bb.readInt16(o)){for(var c=f.SIZEOF_SHORT;c<s;c+=f.SIZEOF_SHORT)if(this.bb.readInt16(i+c)!=this.bb.readInt16(o+c))continue t;a=this.vtables[t];break}}return a?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,a-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e};f.Builder.prototype.finish=function(e,t){if(t){var r=t;if(this.prep(this.minalign,f.SIZEOF_INT+f.FILE_IDENTIFIER_LENGTH),r.length!=f.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+f.FILE_IDENTIFIER_LENGTH);for(var n=f.FILE_IDENTIFIER_LENGTH-1;n>=0;n--)this.writeInt8(r.charCodeAt(n))}this.prep(this.minalign,f.SIZEOF_INT),this.addOffset(e),this.bb.setPosition(this.space)};f.Builder.prototype.requiredField=function(e,t){var r=this.bb.capacity()-e,n=r-this.bb.readInt32(r),s=this.bb.readInt16(n+t)!=0;if(!s)throw new Error("FlatBuffers: field "+t+" must be set")};f.Builder.prototype.startVector=function(e,t,r){this.notNested(),this.vector_num_elems=t,this.prep(f.SIZEOF_INT,e*t),this.prep(r,e*t)};f.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()};f.Builder.prototype.createString=function(e){if(e instanceof Uint8Array)var t=e;else for(var t=[],r=0;r<e.length;){var n,s=e.charCodeAt(r++);if(s<55296||s>=56320)n=s;else{var a=e.charCodeAt(r++);n=(s<<10)+a+-56613888}n<128?t.push(n):(n<2048?t.push(n>>6&31|192):(n<65536?t.push(n>>12&15|224):t.push(n>>18&7|240,n>>12&63|128),t.push(n>>6&63|128)),t.push(n&63|128))}this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(var r=0,i=this.space,o=this.bb.bytes();r<t.length;r++)o[i++]=t[r];return this.endVector()};f.Builder.prototype.createLong=function(e,t){return f.Long.create(e,t)};f.ByteBuffer=function(e){this.bytes_=e,this.position_=0};f.ByteBuffer.allocate=function(e){return new f.ByteBuffer(new Uint8Array(e))};f.ByteBuffer.prototype.clear=function(){this.position_=0};f.ByteBuffer.prototype.bytes=function(){return this.bytes_};f.ByteBuffer.prototype.position=function(){return this.position_};f.ByteBuffer.prototype.setPosition=function(e){this.position_=e};f.ByteBuffer.prototype.capacity=function(){return this.bytes_.length};f.ByteBuffer.prototype.readInt8=function(e){return this.readUint8(e)<<24>>24};f.ByteBuffer.prototype.readUint8=function(e){return this.bytes_[e]};f.ByteBuffer.prototype.readInt16=function(e){return this.readUint16(e)<<16>>16};f.ByteBuffer.prototype.readUint16=function(e){return this.bytes_[e]|this.bytes_[e+1]<<8};f.ByteBuffer.prototype.readInt32=function(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24};f.ByteBuffer.prototype.readUint32=function(e){return this.readInt32(e)>>>0};f.ByteBuffer.prototype.readInt64=function(e){return new f.Long(this.readInt32(e),this.readInt32(e+4))};f.ByteBuffer.prototype.readUint64=function(e){return new f.Long(this.readUint32(e),this.readUint32(e+4))};f.ByteBuffer.prototype.readFloat32=function(e){return f.int32[0]=this.readInt32(e),f.float32[0]};f.ByteBuffer.prototype.readFloat64=function(e){return f.int32[f.isLittleEndian?0:1]=this.readInt32(e),f.int32[f.isLittleEndian?1:0]=this.readInt32(e+4),f.float64[0]};f.ByteBuffer.prototype.writeInt8=function(e,t){this.bytes_[e]=t};f.ByteBuffer.prototype.writeUint8=function(e,t){this.bytes_[e]=t};f.ByteBuffer.prototype.writeInt16=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8};f.ByteBuffer.prototype.writeUint16=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8};f.ByteBuffer.prototype.writeInt32=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24};f.ByteBuffer.prototype.writeUint32=function(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24};f.ByteBuffer.prototype.writeInt64=function(e,t){this.writeInt32(e,t.low),this.writeInt32(e+4,t.high)};f.ByteBuffer.prototype.writeUint64=function(e,t){this.writeUint32(e,t.low),this.writeUint32(e+4,t.high)};f.ByteBuffer.prototype.writeFloat32=function(e,t){f.float32[0]=t,this.writeInt32(e,f.int32[0])};f.ByteBuffer.prototype.writeFloat64=function(e,t){f.float64[0]=t,this.writeInt32(e,f.int32[f.isLittleEndian?0:1]),this.writeInt32(e+4,f.int32[f.isLittleEndian?1:0])};f.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+f.SIZEOF_INT+f.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var e="",t=0;t<f.FILE_IDENTIFIER_LENGTH;t++)e+=String.fromCharCode(this.readInt8(this.position_+f.SIZEOF_INT+t));return e};f.ByteBuffer.prototype.__offset=function(e,t){var r=e-this.readInt32(e);return t<this.readInt16(r)?this.readInt16(r+t):0};f.ByteBuffer.prototype.__union=function(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e};f.ByteBuffer.prototype.__string=function(e,t){e+=this.readInt32(e);var r=this.readInt32(e),n="",s=0;if(e+=f.SIZEOF_INT,t===f.Encoding.UTF8_BYTES)return this.bytes_.subarray(e,e+r);for(;s<r;){var a,i=this.readUint8(e+s++);if(i<192)a=i;else{var o=this.readUint8(e+s++);if(i<224)a=(i&31)<<6|o&63;else{var c=this.readUint8(e+s++);if(i<240)a=(i&15)<<12|(o&63)<<6|c&63;else{var u=this.readUint8(e+s++);a=(i&7)<<18|(o&63)<<12|(c&63)<<6|u&63}}}a<65536?n+=String.fromCharCode(a):(a-=65536,n+=String.fromCharCode((a>>10)+55296,(a&1023)+56320))}return n};f.ByteBuffer.prototype.__indirect=function(e){return e+this.readInt32(e)};f.ByteBuffer.prototype.__vector=function(e){return e+this.readInt32(e)+f.SIZEOF_INT};f.ByteBuffer.prototype.__vector_len=function(e){return this.readInt32(e+this.readInt32(e))};f.ByteBuffer.prototype.__has_identifier=function(e){if(e.length!=f.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+f.FILE_IDENTIFIER_LENGTH);for(var t=0;t<f.FILE_IDENTIFIER_LENGTH;t++)if(e.charCodeAt(t)!=this.readInt8(this.position_+f.SIZEOF_INT+t))return!1;return!0};f.ByteBuffer.prototype.createLong=function(e,t){return f.Long.create(e,t)};function qt(e,t,r){return t<=e&&e<=r}function Qr(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function Ko(e){for(var t=String(e),r=t.length,n=0,s=[];n<r;){var a=t.charCodeAt(n);if(a<55296||a>57343)s.push(a);else if(56320<=a&&a<=57343)s.push(65533);else if(55296<=a&&a<=56319)if(n===r-1)s.push(65533);else{var i=e.charCodeAt(n+1);if(56320<=i&&i<=57343){var o=a&1023,c=i&1023;s.push(65536+(o<<10)+c),n+=1}else s.push(65533)}n+=1}return s}function Jo(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return t}var Mr=-1;function Zn(e){this.tokens=[].slice.call(e)}Zn.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():Mr},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var De=-1;function Bn(e,t){if(e)throw TypeError("Decoder error");return t||65533}var Er="utf-8";function Ur(e,t){if(!(this instanceof Ur))return new Ur(e,t);if(e=e!==void 0?String(e).toLowerCase():Er,e!==Er)throw new Error("Encoding not supported. Only utf-8 is supported");t=Qr(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}Ur.prototype={decode:function(t,r){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),r=Qr(r),this._streaming||(this._decoder=new Go({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var s=new Zn(n),a=[],i;!s.endOfStream()&&(i=this._decoder.handler(s,s.read()),i!==De);)i!==null&&(Array.isArray(i)?a.push.apply(a,i):a.push(i));if(!this._streaming){do{if(i=this._decoder.handler(s,s.read()),i===De)break;i!==null&&(Array.isArray(i)?a.push.apply(a,i):a.push(i))}while(!s.endOfStream());this._decoder=null}return a.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(a[0]===65279?(this._BOMseen=!0,a.shift()):this._BOMseen=!0),Jo(a)}};function Nr(e,t){if(!(this instanceof Nr))return new Nr(e,t);if(e=e!==void 0?String(e).toLowerCase():Er,e!==Er)throw new Error("Encoding not supported. Only utf-8 is supported");t=Qr(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}Nr.prototype={encode:function(t,r){t=t?String(t):"",r=Qr(r),this._streaming||(this._encoder=new Zo(this._options)),this._streaming=!!r.stream;for(var n=[],s=new Zn(Ko(t)),a;!s.endOfStream()&&(a=this._encoder.handler(s,s.read()),a!==De);)Array.isArray(a)?n.push.apply(n,a):n.push(a);if(!this._streaming){for(;a=this._encoder.handler(s,s.read()),a!==De;)Array.isArray(a)?n.push.apply(n,a):n.push(a);this._encoder=null}return new Uint8Array(n)}};function Go(e){var t=e.fatal,r=0,n=0,s=0,a=128,i=191;this.handler=function(o,c){if(c===Mr&&s!==0)return s=0,Bn(t);if(c===Mr)return De;if(s===0){if(qt(c,0,127))return c;if(qt(c,194,223))s=1,r=c-192;else if(qt(c,224,239))c===224&&(a=160),c===237&&(i=159),s=2,r=c-224;else if(qt(c,240,244))c===240&&(a=144),c===244&&(i=143),s=3,r=c-240;else return Bn(t);return r=r<<6*s,null}if(!qt(c,a,i))return r=s=n=0,a=128,i=191,o.prepend(c),Bn(t);if(a=128,i=191,n+=1,r+=c-128<<6*(s-n),n!==s)return null;var u=r;return r=s=n=0,u}}function Zo(e){e.fatal,this.handler=function(t,r){if(r===Mr)return De;if(qt(r,0,127))return r;var n,s;qt(r,128,2047)?(n=1,s=192):qt(r,2048,65535)?(n=2,s=224):qt(r,65536,1114111)&&(n=3,s=240);for(var a=[(r>>6*n)+s];n>0;){var i=r>>6*(n-1);a.push(128|i&63),n-=1}return a}}const Vr=typeof Buffer=="function"?Buffer:null,Rs=typeof TextDecoder=="function"&&typeof TextEncoder=="function",jn=(e=>{if(Rs||!Vr){const t=new e("utf-8");return r=>t.decode(r)}return t=>{const{buffer:r,byteOffset:n,length:s}=U(t);return Vr.from(r,n,s).toString()}})(typeof TextDecoder<"u"?TextDecoder:Ur),Xr=(e=>{if(Rs||!Vr){const t=new e;return r=>t.encode(r)}return(t="")=>U(Vr.from(t,"utf8"))})(typeof TextEncoder<"u"?TextEncoder:Nr),Z=Object.freeze({done:!0,value:void 0});class ss{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class me{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class Qo extends me{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}async cancel(t){await 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 gt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return gt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}async throw(t){return await this.abort(t),Z}async return(t){return await this.close(),Z}async read(t){return(await this.next(t,"read")).value}async peek(t){return(await 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((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(Z)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(`${this} is closed`)}}const[Xo,tn]=(()=>{const e=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw e()}return t.asIntN=()=>{throw e()},t.asUintN=()=>{throw e()},typeof BigInt<"u"?[BigInt,!0]:[t,!1]})(),[ke,Lf]=(()=>{const e=()=>{throw new Error("BigInt64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw e()}static from(){throw e()}constructor(){throw e()}}return typeof BigInt64Array<"u"?[BigInt64Array,!0]:[t,!1]})(),[sr,Mf]=(()=>{const e=()=>{throw new Error("BigUint64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw e()}static from(){throw e()}constructor(){throw e()}}return typeof BigUint64Array<"u"?[BigUint64Array,!0]:[t,!1]})(),tc=e=>typeof e=="number",Cs=e=>typeof e=="boolean",Bt=e=>typeof e=="function",wt=e=>e!=null&&Object(e)===e,ne=e=>wt(e)&&Bt(e.then),xt=e=>wt(e)&&Bt(e[Symbol.iterator]),Gt=e=>wt(e)&&Bt(e[Symbol.asyncIterator]),Pn=e=>wt(e)&&wt(e.schema),ks=e=>wt(e)&&"done"in e&&"value"in e,js=e=>wt(e)&&Bt(e.stat)&&tc(e.fd),Ps=e=>wt(e)&&Qn(e.body),ec=e=>wt(e)&&Bt(e.abort)&&Bt(e.getWriter)&&!(e instanceof me),Qn=e=>wt(e)&&Bt(e.cancel)&&Bt(e.getReader)&&!(e instanceof me),rc=e=>wt(e)&&Bt(e.end)&&Bt(e.write)&&Cs(e.writable)&&!(e instanceof me),zs=e=>wt(e)&&Bt(e.read)&&Bt(e.pipe)&&Cs(e.readable)&&!(e instanceof me);var nc=f.ByteBuffer;const Xn=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function ic(e){let t=e[0]?[e[0]]:[],r,n,s,a;for(let i,o,c=0,u=0,d=e.length;++c<d;){if(i=t[u],o=e[c],!i||!o||i.buffer!==o.buffer||o.byteOffset<i.byteOffset){o&&(t[++u]=o);continue}if({byteOffset:r,byteLength:s}=i,{byteOffset:n,byteLength:a}=o,r+s<n||n+a<r){o&&(t[++u]=o);continue}t[u]=new Uint8Array(i.buffer,r,n-r+a)}return t}function Rr(e,t,r=0,n=t.byteLength){const s=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,s),i=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,s));return a.set(i,r),e}function Rt(e,t){let r=ic(e),n=r.reduce((d,b)=>d+b.byteLength,0),s,a,i,o=0,c=-1,u=Math.min(t||1/0,n);for(let d=r.length;++c<d;){if(s=r[c],a=s.subarray(0,Math.min(s.length,u-o)),u<=o+a.length){a.length<s.length?r[c]=s.subarray(a.length):a.length===s.length&&c++,i?Rr(i,a,o):i=a;break}Rr(i||(i=new Uint8Array(u)),a,o),o+=a.length}return[i||new Uint8Array(0),r.slice(c),n-(i?i.byteLength:0)]}function z(e,t){let r=ks(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Xr(r)),r instanceof ArrayBuffer?new e(r):r instanceof Xn?new e(r):r instanceof nc?z(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}const ze=e=>z(Int32Array,e),sc=e=>z(ke,e),U=e=>z(Uint8Array,e),ac=e=>z(sr,e),zn=e=>(e.next(),e);function*oc(e,t){const r=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xn?r(t):xt(t)?t:r(t);yield*zn(function*(s){let a=null;do a=s.next(yield z(e,a));while(!a.done)}(n[Symbol.iterator]()))}const cc=e=>oc(Uint8Array,e);async function*$s(e,t){if(ne(t))return yield*$s(e,await t);const r=async function*(a){yield await a},n=async function*(a){yield*zn(function*(i){let o=null;do o=i.next(yield o&&o.value);while(!o.done)}(a[Symbol.iterator]()))},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xn?r(t):xt(t)?n(t):Gt(t)?t:r(t);yield*zn(async function*(a){let i=null;do i=await a.next(yield z(e,i));while(!i.done)}(s[Symbol.asyncIterator]()))}const uc=e=>$s(Uint8Array,e);function ti(e,t,r){if(e!==0){r=r.slice(0,t+1);for(let n=-1;++n<=t;)r[n]+=e}return r}function lc(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}const gt={fromIterable(e){return _r(hc(e))},fromAsyncIterable(e){return _r(fc(e))},fromDOMStream(e){return _r(dc(e))},fromNodeStream(e){return _r(yc(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},_r=e=>(e.next(),e);function*hc(e){let t,r=!1,n=[],s,a,i,o=0;function c(){return a==="peek"?Rt(n,i)[0]:([s,n,o]=Rt(n,i),s)}({cmd:a,size:i}=yield null);let u=cc(e)[Symbol.iterator]();try{do if({done:t,value:s}=isNaN(i-o)?u.next(void 0):u.next(i-o),!t&&s.byteLength>0&&(n.push(s),o+=s.byteLength),t||i<=o)do({cmd:a,size:i}=yield c());while(i<o);while(!t)}catch(d){(r=!0)&&typeof u.throw=="function"&&u.throw(d)}finally{r===!1&&typeof u.return=="function"&&u.return()}}async function*fc(e){let t,r=!1,n=[],s,a,i,o=0;function c(){return a==="peek"?Rt(n,i)[0]:([s,n,o]=Rt(n,i),s)}({cmd:a,size:i}=yield null);let u=uc(e)[Symbol.asyncIterator]();try{do if({done:t,value:s}=isNaN(i-o)?await u.next(void 0):await u.next(i-o),!t&&s.byteLength>0&&(n.push(s),o+=s.byteLength),t||i<=o)do({cmd:a,size:i}=yield c());while(i<o);while(!t)}catch(d){(r=!0)&&typeof u.throw=="function"&&await u.throw(d)}finally{r===!1&&typeof u.return=="function"&&await u.return()}}async function*dc(e){let t=!1,r=!1,n=[],s,a,i,o=0;function c(){return a==="peek"?Rt(n,i)[0]:([s,n,o]=Rt(n,i),s)}({cmd:a,size:i}=yield null);let u=new pc(e);try{do if({done:t,value:s}=isNaN(i-o)?await u.read(void 0):await u.read(i-o),!t&&s.byteLength>0&&(n.push(U(s)),o+=s.byteLength),t||i<=o)do({cmd:a,size:i}=yield c());while(i<o);while(!t)}catch(d){(r=!0)&&await u.cancel(d)}finally{r===!1?await u.cancel():e.locked&&u.releaseLock()}}class pc{constructor(t){this.source=t,this.byobReader=null,this.defaultReader=null;try{this.supportsBYOB=!!(this.reader=this.getBYOBReader())}catch{this.supportsBYOB=!(this.reader=this.getDefaultReader())}}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=this.byobReader=this.defaultReader=null}async cancel(t){const{reader:r,source:n}=this;r&&await r.cancel(t).catch(()=>{}),n&&n.locked&&this.releaseLock()}async read(t){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const r=!this.supportsBYOB||typeof t!="number"?await this.getDefaultReader().read():await this.readFromBYOBReader(t);return!r.done&&(r.value=U(r)),r}getDefaultReader(){return this.byobReader&&this.releaseLock(),this.defaultReader||(this.defaultReader=this.source.getReader(),this.defaultReader.closed.catch(()=>{})),this.reader=this.defaultReader}getBYOBReader(){return this.defaultReader&&this.releaseLock(),this.byobReader||(this.byobReader=this.source.getReader({mode:"byob"}),this.byobReader.closed.catch(()=>{})),this.reader=this.byobReader}async readFromBYOBReader(t){return await Ws(this.getBYOBReader(),new ArrayBuffer(t),0,t)}}async function Ws(e,t,r,n){if(r>=n)return{done:!1,value:new Uint8Array(t,0,n)};const{done:s,value:a}=await e.read(new Uint8Array(t,r,n-r));return(r+=a.byteLength)<n&&!s?await Ws(e,a.buffer,r,n):{done:s,value:new Uint8Array(a.buffer,0,r)}}const An=(e,t)=>{let r=s=>n([t,s]),n;return[t,r,new Promise(s=>(n=s)&&e.once(t,r))]};async function*yc(e){let t=[],r="error",n=!1,s=null,a,i,o=0,c=[],u;function d(){return a==="peek"?Rt(c,i)[0]:([u,c,o]=Rt(c,i),u)}if({cmd:a,size:i}=yield null,e.isTTY)return yield new Uint8Array(0);try{t[0]=An(e,"end"),t[1]=An(e,"error");do{if(t[2]=An(e,"readable"),[r,s]=await Promise.race(t.map(_=>_[2])),r==="error")break;if((n=r==="end")||(isFinite(i-o)?(u=U(e.read(i-o)),u.byteLength<i-o&&(u=U(e.read(void 0)))):u=U(e.read(void 0)),u.byteLength>0&&(c.push(u),o+=u.byteLength)),n||i<=o)do({cmd:a,size:i}=yield d());while(i<o)}while(!n)}finally{await b(t,r==="error"?s:null)}function b(_,v){return u=c=null,new Promise(async(C,et)=>{for(const[ot,ut]of _)e.off(ot,ut);try{const ot=e.destroy;ot&&ot.call(e,v),v=void 0}catch(ot){v=ot||v}finally{v!=null?et(v):C()}})}}class N{}var p;(function(e){(function(t){(function(r){(function(n){(function(s){s[s.V1=0]="V1",s[s.V2=1]="V2",s[s.V3=2]="V3",s[s.V4=3]="V4"})(n.MetadataVersion||(n.MetadataVersion={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.Sparse=0]="Sparse",s[s.Dense=1]="Dense"})(n.UnionMode||(n.UnionMode={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.HALF=0]="HALF",s[s.SINGLE=1]="SINGLE",s[s.DOUBLE=2]="DOUBLE"})(n.Precision||(n.Precision={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.DAY=0]="DAY",s[s.MILLISECOND=1]="MILLISECOND"})(n.DateUnit||(n.DateUnit={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.SECOND=0]="SECOND",s[s.MILLISECOND=1]="MILLISECOND",s[s.MICROSECOND=2]="MICROSECOND",s[s.NANOSECOND=3]="NANOSECOND"})(n.TimeUnit||(n.TimeUnit={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.YEAR_MONTH=0]="YEAR_MONTH",s[s.DAY_TIME=1]="DAY_TIME"})(n.IntervalUnit||(n.IntervalUnit={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.NONE=0]="NONE",s[s.Null=1]="Null",s[s.Int=2]="Int",s[s.FloatingPoint=3]="FloatingPoint",s[s.Binary=4]="Binary",s[s.Utf8=5]="Utf8",s[s.Bool=6]="Bool",s[s.Decimal=7]="Decimal",s[s.Date=8]="Date",s[s.Time=9]="Time",s[s.Timestamp=10]="Timestamp",s[s.Interval=11]="Interval",s[s.List=12]="List",s[s.Struct_=13]="Struct_",s[s.Union=14]="Union",s[s.FixedSizeBinary=15]="FixedSizeBinary",s[s.FixedSizeList=16]="FixedSizeList",s[s.Map=17]="Map",s[s.Duration=18]="Duration",s[s.LargeBinary=19]="LargeBinary",s[s.LargeUtf8=20]="LargeUtf8",s[s.LargeList=21]="LargeList"})(n.Type||(n.Type={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.Little=0]="Little",s[s.Big=1]="Big"})(n.Endianness||(n.Endianness={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsNull(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startNull(i){i.startObject(0)}static endNull(i){return i.endObject()}static createNull(i){return s.startNull(i),s.endNull(i)}}n.Null=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsStruct_(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startStruct_(i){i.startObject(0)}static endStruct_(i){return i.endObject()}static createStruct_(i){return s.startStruct_(i),s.endStruct_(i)}}n.Struct_=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsList(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startList(i){i.startObject(0)}static endList(i){return i.endObject()}static createList(i){return s.startList(i),s.endList(i)}}n.List=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsLargeList(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startLargeList(i){i.startObject(0)}static endLargeList(i){return i.endObject()}static createLargeList(i){return s.startLargeList(i),s.endLargeList(i)}}n.LargeList=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsFixedSizeList(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}listSize(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt32(this.bb_pos+i):0}static startFixedSizeList(i){i.startObject(1)}static addListSize(i,o){i.addFieldInt32(0,o,0)}static endFixedSizeList(i){return i.endObject()}static createFixedSizeList(i,o){return s.startFixedSizeList(i),s.addListSize(i,o),s.endFixedSizeList(i)}}n.FixedSizeList=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsMap(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}keysSorted(){let i=this.bb.__offset(this.bb_pos,4);return i?!!this.bb.readInt8(this.bb_pos+i):!1}static startMap(i){i.startObject(1)}static addKeysSorted(i,o){i.addFieldInt8(0,+o,0)}static endMap(i){return i.endObject()}static createMap(i,o){return s.startMap(i),s.addKeysSorted(i,o),s.endMap(i)}}n.Map=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsUnion(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}mode(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.UnionMode.Sparse}typeIds(i){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.readInt32(this.bb.__vector(this.bb_pos+o)+i*4):0}typeIdsLength(){let i=this.bb.__offset(this.bb_pos,6);return i?this.bb.__vector_len(this.bb_pos+i):0}typeIdsArray(){let i=this.bb.__offset(this.bb_pos,6);return i?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+i),this.bb.__vector_len(this.bb_pos+i)):null}static startUnion(i){i.startObject(2)}static addMode(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.UnionMode.Sparse)}static addTypeIds(i,o){i.addFieldOffset(1,o,0)}static createTypeIdsVector(i,o){i.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)i.addInt32(o[c]);return i.endVector()}static startTypeIdsVector(i,o){i.startVector(4,o,4)}static endUnion(i){return i.endObject()}static createUnion(i,o,c){return s.startUnion(i),s.addMode(i,o),s.addTypeIds(i,c),s.endUnion(i)}}n.Union=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsInt(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}bitWidth(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt32(this.bb_pos+i):0}isSigned(){let i=this.bb.__offset(this.bb_pos,6);return i?!!this.bb.readInt8(this.bb_pos+i):!1}static startInt(i){i.startObject(2)}static addBitWidth(i,o){i.addFieldInt32(0,o,0)}static addIsSigned(i,o){i.addFieldInt8(1,+o,0)}static endInt(i){return i.endObject()}static createInt(i,o,c){return s.startInt(i),s.addBitWidth(i,o),s.addIsSigned(i,c),s.endInt(i)}}n.Int=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsFloatingPoint(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}precision(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.Precision.HALF}static startFloatingPoint(i){i.startObject(1)}static addPrecision(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.Precision.HALF)}static endFloatingPoint(i){return i.endObject()}static createFloatingPoint(i,o){return s.startFloatingPoint(i),s.addPrecision(i,o),s.endFloatingPoint(i)}}n.FloatingPoint=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsUtf8(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startUtf8(i){i.startObject(0)}static endUtf8(i){return i.endObject()}static createUtf8(i){return s.startUtf8(i),s.endUtf8(i)}}n.Utf8=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsBinary(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startBinary(i){i.startObject(0)}static endBinary(i){return i.endObject()}static createBinary(i){return s.startBinary(i),s.endBinary(i)}}n.Binary=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsLargeUtf8(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startLargeUtf8(i){i.startObject(0)}static endLargeUtf8(i){return i.endObject()}static createLargeUtf8(i){return s.startLargeUtf8(i),s.endLargeUtf8(i)}}n.LargeUtf8=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsLargeBinary(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startLargeBinary(i){i.startObject(0)}static endLargeBinary(i){return i.endObject()}static createLargeBinary(i){return s.startLargeBinary(i),s.endLargeBinary(i)}}n.LargeBinary=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsFixedSizeBinary(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}byteWidth(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt32(this.bb_pos+i):0}static startFixedSizeBinary(i){i.startObject(1)}static addByteWidth(i,o){i.addFieldInt32(0,o,0)}static endFixedSizeBinary(i){return i.endObject()}static createFixedSizeBinary(i,o){return s.startFixedSizeBinary(i),s.addByteWidth(i,o),s.endFixedSizeBinary(i)}}n.FixedSizeBinary=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsBool(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}static startBool(i){i.startObject(0)}static endBool(i){return i.endObject()}static createBool(i){return s.startBool(i),s.endBool(i)}}n.Bool=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsDecimal(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}precision(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt32(this.bb_pos+i):0}scale(){let i=this.bb.__offset(this.bb_pos,6);return i?this.bb.readInt32(this.bb_pos+i):0}static startDecimal(i){i.startObject(2)}static addPrecision(i,o){i.addFieldInt32(0,o,0)}static addScale(i,o){i.addFieldInt32(1,o,0)}static endDecimal(i){return i.endObject()}static createDecimal(i,o,c){return s.startDecimal(i),s.addPrecision(i,o),s.addScale(i,c),s.endDecimal(i)}}n.Decimal=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsDate(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}unit(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.DateUnit.MILLISECOND}static startDate(i){i.startObject(1)}static addUnit(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.DateUnit.MILLISECOND)}static endDate(i){return i.endObject()}static createDate(i,o){return s.startDate(i),s.addUnit(i,o),s.endDate(i)}}n.Date=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsTime(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}unit(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.TimeUnit.MILLISECOND}bitWidth(){let i=this.bb.__offset(this.bb_pos,6);return i?this.bb.readInt32(this.bb_pos+i):32}static startTime(i){i.startObject(2)}static addUnit(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static addBitWidth(i,o){i.addFieldInt32(1,o,32)}static endTime(i){return i.endObject()}static createTime(i,o,c){return s.startTime(i),s.addUnit(i,o),s.addBitWidth(i,c),s.endTime(i)}}n.Time=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsTimestamp(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}unit(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.TimeUnit.SECOND}timezone(i){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,i):null}static startTimestamp(i){i.startObject(2)}static addUnit(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.TimeUnit.SECOND)}static addTimezone(i,o){i.addFieldOffset(1,o,0)}static endTimestamp(i){return i.endObject()}static createTimestamp(i,o,c){return s.startTimestamp(i),s.addUnit(i,o),s.addTimezone(i,c),s.endTimestamp(i)}}n.Timestamp=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsInterval(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}unit(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH}static startInterval(i){i.startObject(1)}static addUnit(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH)}static endInterval(i){return i.endObject()}static createInterval(i,o){return s.startInterval(i),s.addUnit(i,o),s.endInterval(i)}}n.Interval=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsDuration(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}unit(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.TimeUnit.MILLISECOND}static startDuration(i){i.startObject(1)}static addUnit(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static endDuration(i){return i.endObject()}static createDuration(i,o){return s.startDuration(i),s.addUnit(i,o),s.endDuration(i)}}n.Duration=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsKeyValue(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}key(i){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,i):null}value(i){let o=this.bb.__offset(this.bb_pos,6);return o?this.bb.__string(this.bb_pos+o,i):null}static startKeyValue(i){i.startObject(2)}static addKey(i,o){i.addFieldOffset(0,o,0)}static addValue(i,o){i.addFieldOffset(1,o,0)}static endKeyValue(i){return i.endObject()}static createKeyValue(i,o,c){return s.startKeyValue(i),s.addKey(i,o),s.addValue(i,c),s.endKeyValue(i)}}n.KeyValue=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsDictionaryEncoding(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}id(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt64(this.bb_pos+i):this.bb.createLong(0,0)}indexType(i){let o=this.bb.__offset(this.bb_pos,6);return o?(i||new e.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}isOrdered(){let i=this.bb.__offset(this.bb_pos,8);return i?!!this.bb.readInt8(this.bb_pos+i):!1}static startDictionaryEncoding(i){i.startObject(3)}static addId(i,o){i.addFieldInt64(0,o,i.createLong(0,0))}static addIndexType(i,o){i.addFieldOffset(1,o,0)}static addIsOrdered(i,o){i.addFieldInt8(2,+o,0)}static endDictionaryEncoding(i){return i.endObject()}static createDictionaryEncoding(i,o,c,u){return s.startDictionaryEncoding(i),s.addId(i,o),s.addIndexType(i,c),s.addIsOrdered(i,u),s.endDictionaryEncoding(i)}}n.DictionaryEncoding=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsField(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}name(i){let o=this.bb.__offset(this.bb_pos,4);return o?this.bb.__string(this.bb_pos+o,i):null}nullable(){let i=this.bb.__offset(this.bb_pos,6);return i?!!this.bb.readInt8(this.bb_pos+i):!1}typeType(){let i=this.bb.__offset(this.bb_pos,8);return i?this.bb.readUint8(this.bb_pos+i):e.apache.arrow.flatbuf.Type.NONE}type(i){let o=this.bb.__offset(this.bb_pos,10);return o?this.bb.__union(i,this.bb_pos+o):null}dictionary(i){let o=this.bb.__offset(this.bb_pos,12);return o?(i||new e.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}children(i,o){let c=this.bb.__offset(this.bb_pos,14);return c?(o||new e.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+i*4),this.bb):null}childrenLength(){let i=this.bb.__offset(this.bb_pos,14);return i?this.bb.__vector_len(this.bb_pos+i):0}customMetadata(i,o){let c=this.bb.__offset(this.bb_pos,16);return c?(o||new e.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+i*4),this.bb):null}customMetadataLength(){let i=this.bb.__offset(this.bb_pos,16);return i?this.bb.__vector_len(this.bb_pos+i):0}static startField(i){i.startObject(7)}static addName(i,o){i.addFieldOffset(0,o,0)}static addNullable(i,o){i.addFieldInt8(1,+o,0)}static addTypeType(i,o){i.addFieldInt8(2,o,e.apache.arrow.flatbuf.Type.NONE)}static addType(i,o){i.addFieldOffset(3,o,0)}static addDictionary(i,o){i.addFieldOffset(4,o,0)}static addChildren(i,o){i.addFieldOffset(5,o,0)}static createChildrenVector(i,o){i.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)i.addOffset(o[c]);return i.endVector()}static startChildrenVector(i,o){i.startVector(4,o,4)}static addCustomMetadata(i,o){i.addFieldOffset(6,o,0)}static createCustomMetadataVector(i,o){i.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)i.addOffset(o[c]);return i.endVector()}static startCustomMetadataVector(i,o){i.startVector(4,o,4)}static endField(i){return i.endObject()}static createField(i,o,c,u,d,b,_,v){return s.startField(i),s.addName(i,o),s.addNullable(i,c),s.addTypeType(i,u),s.addType(i,d),s.addDictionary(i,b),s.addChildren(i,_),s.addCustomMetadata(i,v),s.endField(i)}}n.Field=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static createBuffer(i,o,c){return i.prep(8,16),i.writeInt64(c),i.writeInt64(o),i.offset()}}n.Buffer=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsSchema(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}endianness(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):e.apache.arrow.flatbuf.Endianness.Little}fields(i,o){let c=this.bb.__offset(this.bb_pos,6);return c?(o||new e.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+i*4),this.bb):null}fieldsLength(){let i=this.bb.__offset(this.bb_pos,6);return i?this.bb.__vector_len(this.bb_pos+i):0}customMetadata(i,o){let c=this.bb.__offset(this.bb_pos,8);return c?(o||new e.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+i*4),this.bb):null}customMetadataLength(){let i=this.bb.__offset(this.bb_pos,8);return i?this.bb.__vector_len(this.bb_pos+i):0}static startSchema(i){i.startObject(3)}static addEndianness(i,o){i.addFieldInt16(0,o,e.apache.arrow.flatbuf.Endianness.Little)}static addFields(i,o){i.addFieldOffset(1,o,0)}static createFieldsVector(i,o){i.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)i.addOffset(o[c]);return i.endVector()}static startFieldsVector(i,o){i.startVector(4,o,4)}static addCustomMetadata(i,o){i.addFieldOffset(2,o,0)}static createCustomMetadataVector(i,o){i.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)i.addOffset(o[c]);return i.endVector()}static startCustomMetadataVector(i,o){i.startVector(4,o,4)}static endSchema(i){return i.endObject()}static finishSchemaBuffer(i,o){i.finish(o)}static createSchema(i,o,c,u){return s.startSchema(i),s.addEndianness(i,o),s.addFields(i,c),s.addCustomMetadata(i,u),s.endSchema(i)}}n.Schema=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(p||(p={}));var at;(function(e){(function(t){(function(r){(function(n){n.Schema=p.apache.arrow.flatbuf.Schema})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(at||(at={}));(function(e){(function(t){(function(r){(function(n){(function(s){s[s.NONE=0]="NONE",s[s.Schema=1]="Schema",s[s.DictionaryBatch=2]="DictionaryBatch",s[s.RecordBatch=3]="RecordBatch",s[s.Tensor=4]="Tensor",s[s.SparseTensor=5]="SparseTensor"})(n.MessageHeader||(n.MessageHeader={}))})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(at||(at={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static createFieldNode(i,o,c){return i.prep(8,16),i.writeInt64(c),i.writeInt64(o),i.offset()}}n.FieldNode=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(at||(at={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsRecordBatch(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}length(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt64(this.bb_pos+i):this.bb.createLong(0,0)}nodes(i,o){let c=this.bb.__offset(this.bb_pos,6);return c?(o||new e.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos+c)+i*16,this.bb):null}nodesLength(){let i=this.bb.__offset(this.bb_pos,6);return i?this.bb.__vector_len(this.bb_pos+i):0}buffers(i,o){let c=this.bb.__offset(this.bb_pos,8);return c?(o||new p.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos+c)+i*16,this.bb):null}buffersLength(){let i=this.bb.__offset(this.bb_pos,8);return i?this.bb.__vector_len(this.bb_pos+i):0}static startRecordBatch(i){i.startObject(3)}static addLength(i,o){i.addFieldInt64(0,o,i.createLong(0,0))}static addNodes(i,o){i.addFieldOffset(1,o,0)}static startNodesVector(i,o){i.startVector(16,o,8)}static addBuffers(i,o){i.addFieldOffset(2,o,0)}static startBuffersVector(i,o){i.startVector(16,o,8)}static endRecordBatch(i){return i.endObject()}static createRecordBatch(i,o,c,u){return s.startRecordBatch(i),s.addLength(i,o),s.addNodes(i,c),s.addBuffers(i,u),s.endRecordBatch(i)}}n.RecordBatch=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(at||(at={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsDictionaryBatch(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}id(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt64(this.bb_pos+i):this.bb.createLong(0,0)}data(i){let o=this.bb.__offset(this.bb_pos,6);return o?(i||new e.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}isDelta(){let i=this.bb.__offset(this.bb_pos,8);return i?!!this.bb.readInt8(this.bb_pos+i):!1}static startDictionaryBatch(i){i.startObject(3)}static addId(i,o){i.addFieldInt64(0,o,i.createLong(0,0))}static addData(i,o){i.addFieldOffset(1,o,0)}static addIsDelta(i,o){i.addFieldInt8(2,+o,0)}static endDictionaryBatch(i){return i.endObject()}static createDictionaryBatch(i,o,c,u){return s.startDictionaryBatch(i),s.addId(i,o),s.addData(i,c),s.addIsDelta(i,u),s.endDictionaryBatch(i)}}n.DictionaryBatch=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(at||(at={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsMessage(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}version(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):p.apache.arrow.flatbuf.MetadataVersion.V1}headerType(){let i=this.bb.__offset(this.bb_pos,6);return i?this.bb.readUint8(this.bb_pos+i):e.apache.arrow.flatbuf.MessageHeader.NONE}header(i){let o=this.bb.__offset(this.bb_pos,8);return o?this.bb.__union(i,this.bb_pos+o):null}bodyLength(){let i=this.bb.__offset(this.bb_pos,10);return i?this.bb.readInt64(this.bb_pos+i):this.bb.createLong(0,0)}customMetadata(i,o){let c=this.bb.__offset(this.bb_pos,12);return c?(o||new p.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+c)+i*4),this.bb):null}customMetadataLength(){let i=this.bb.__offset(this.bb_pos,12);return i?this.bb.__vector_len(this.bb_pos+i):0}static startMessage(i){i.startObject(5)}static addVersion(i,o){i.addFieldInt16(0,o,p.apache.arrow.flatbuf.MetadataVersion.V1)}static addHeaderType(i,o){i.addFieldInt8(1,o,e.apache.arrow.flatbuf.MessageHeader.NONE)}static addHeader(i,o){i.addFieldOffset(2,o,0)}static addBodyLength(i,o){i.addFieldInt64(3,o,i.createLong(0,0))}static addCustomMetadata(i,o){i.addFieldOffset(4,o,0)}static createCustomMetadataVector(i,o){i.startVector(4,o.length,4);for(let c=o.length-1;c>=0;c--)i.addOffset(o[c]);return i.endVector()}static startCustomMetadataVector(i,o){i.startVector(4,o,4)}static endMessage(i){return i.endObject()}static finishMessageBuffer(i,o){i.finish(o)}static createMessage(i,o,c,u,d,b){return s.startMessage(i),s.addVersion(i,o),s.addHeaderType(i,c),s.addHeader(i,u),s.addBodyLength(i,d),s.addCustomMetadata(i,b),s.endMessage(i)}}n.Message=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(at||(at={}));p.apache.arrow.flatbuf.Type;var Ct=p.apache.arrow.flatbuf.DateUnit,Y=p.apache.arrow.flatbuf.TimeUnit,St=p.apache.arrow.flatbuf.Precision,Jt=p.apache.arrow.flatbuf.UnionMode,xe=p.apache.arrow.flatbuf.IntervalUnit,q=at.apache.arrow.flatbuf.MessageHeader,Tt=p.apache.arrow.flatbuf.MetadataVersion,l;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"})(l||(l={}));var w;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(w||(w={}));function Ys(e,t,r,n){return(r&1<<n)!==0}function bc(e,t,r,n){return(r&1<<n)>>n}function mc(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function ei(e,t,r){const n=r.byteLength+7&-8;if(e>0||r.byteLength<n){const s=new Uint8Array(n);return s.set(e%8===0?r.subarray(e>>3):Cr(en(r,e,t,null,Ys)).subarray(0,n)),s}return r}function Cr(e){let t=[],r=0,n=0,s=0;for(const i of e)i&&(s|=1<<n),++n===8&&(t[r++]=s,s=n=0);(r===0||n>0)&&(t[r++]=s);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}function*en(e,t,r,n,s){let a=t%8,i=t>>3,o=0,c=r;for(;c>0;a=0){let u=e[i++];do yield s(n,o++,u,a);while(--c>0&&++a<8)}}function $n(e,t,r){if(r-t<=0)return 0;if(r-t<8){let a=0;for(const i of en(e,t,r-t,e,bc))a+=i;return a}const n=r>>3<<3,s=t+(t%8===0?0:8-t%8);return $n(e,t,s)+$n(e,n,r)+gc(e,s>>3,n-s>>3)}function gc(e,t,r){let n=0,s=t|0;const a=new DataView(e.buffer,e.byteOffset,e.byteLength),i=r===void 0?e.byteLength:s+r;for(;i-s>=4;)n+=Tn(a.getUint32(s)),s+=4;for(;i-s>=2;)n+=Tn(a.getUint16(s)),s+=2;for(;i-s>=1;)n+=Tn(a.getUint8(s)),s+=1;return n}function Tn(e){let t=e|0;return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}class E{visitMany(t,...r){return t.map((n,s)=>this.visit(n,...r.map(a=>a[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return _c(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}}function _c(e,t,r=!0){let n=null,s=l.NONE;switch(t instanceof m||t instanceof N?s=Fn(t.type):t instanceof L?s=Fn(t):typeof(s=t)!="number"&&(s=l[t]),s){case l.Null:n=e.visitNull;break;case l.Bool:n=e.visitBool;break;case l.Int:n=e.visitInt;break;case l.Int8:n=e.visitInt8||e.visitInt;break;case l.Int16:n=e.visitInt16||e.visitInt;break;case l.Int32:n=e.visitInt32||e.visitInt;break;case l.Int64:n=e.visitInt64||e.visitInt;break;case l.Uint8:n=e.visitUint8||e.visitInt;break;case l.Uint16:n=e.visitUint16||e.visitInt;break;case l.Uint32:n=e.visitUint32||e.visitInt;break;case l.Uint64:n=e.visitUint64||e.visitInt;break;case l.Float:n=e.visitFloat;break;case l.Float16:n=e.visitFloat16||e.visitFloat;break;case l.Float32:n=e.visitFloat32||e.visitFloat;break;case l.Float64:n=e.visitFloat64||e.visitFloat;break;case l.Utf8:n=e.visitUtf8;break;case l.Binary:n=e.visitBinary;break;case l.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case l.Date:n=e.visitDate;break;case l.DateDay:n=e.visitDateDay||e.visitDate;break;case l.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case l.Timestamp:n=e.visitTimestamp;break;case l.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case l.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case l.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case l.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case l.Time:n=e.visitTime;break;case l.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case l.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case l.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case l.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case l.Decimal:n=e.visitDecimal;break;case l.List:n=e.visitList;break;case l.Struct:n=e.visitStruct;break;case l.Union:n=e.visitUnion;break;case l.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case l.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case l.Dictionary:n=e.visitDictionary;break;case l.Interval:n=e.visitInterval;break;case l.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case l.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case l.FixedSizeList:n=e.visitFixedSizeList;break;case l.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${l[s]}'`)}function Fn(e){switch(e.typeId){case l.Null:return l.Null;case l.Int:const{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?l.Int8:l.Uint8;case 16:return r?l.Int16:l.Uint16;case 32:return r?l.Int32:l.Uint32;case 64:return r?l.Int64:l.Uint64}return l.Int;case l.Float:switch(e.precision){case St.HALF:return l.Float16;case St.SINGLE:return l.Float32;case St.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(e.unit){case Y.SECOND:return l.TimeSecond;case Y.MILLISECOND:return l.TimeMillisecond;case Y.MICROSECOND:return l.TimeMicrosecond;case Y.NANOSECOND:return l.TimeNanosecond}return l.Time;case l.Timestamp:switch(e.unit){case Y.SECOND:return l.TimestampSecond;case Y.MILLISECOND:return l.TimestampMillisecond;case Y.MICROSECOND:return l.TimestampMicrosecond;case Y.NANOSECOND:return l.TimestampNanosecond}return l.Timestamp;case l.Date:switch(e.unit){case Ct.DAY:return l.DateDay;case Ct.MILLISECOND:return l.DateMillisecond}return l.Date;case l.Interval:switch(e.unit){case xe.DAY_TIME:return l.IntervalDayTime;case xe.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(e.mode){case Jt.Dense:return l.DenseUnion;case Jt.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[e.typeId]}'`)}E.prototype.visitInt8=null;E.prototype.visitInt16=null;E.prototype.visitInt32=null;E.prototype.visitInt64=null;E.prototype.visitUint8=null;E.prototype.visitUint16=null;E.prototype.visitUint32=null;E.prototype.visitUint64=null;E.prototype.visitFloat16=null;E.prototype.visitFloat32=null;E.prototype.visitFloat64=null;E.prototype.visitDateDay=null;E.prototype.visitDateMillisecond=null;E.prototype.visitTimestampSecond=null;E.prototype.visitTimestampMillisecond=null;E.prototype.visitTimestampMicrosecond=null;E.prototype.visitTimestampNanosecond=null;E.prototype.visitTimeSecond=null;E.prototype.visitTimeMillisecond=null;E.prototype.visitTimeMicrosecond=null;E.prototype.visitTimeNanosecond=null;E.prototype.visitDenseUnion=null;E.prototype.visitSparseUnion=null;E.prototype.visitIntervalDayTime=null;E.prototype.visitIntervalYearMonth=null;class I extends E{compareSchemas(t,r){return t===r||r instanceof t.constructor&&_t.compareFields(t.fields,r.fields)}compareFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,s)=>_t.compareField(n,r[s]))}compareField(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&_t.visit(t.type,r.type)}}function pt(e,t){return t instanceof e.constructor}function ar(e,t){return e===t||pt(e,t)}function Zt(e,t){return e===t||pt(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function rn(e,t){return e===t||pt(e,t)&&e.precision===t.precision}function wc(e,t){return e===t||pt(e,t)&&e.byteWidth===t.byteWidth}function ri(e,t){return e===t||pt(e,t)&&e.unit===t.unit}function or(e,t){return e===t||pt(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function cr(e,t){return e===t||pt(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function vc(e,t){return e===t||pt(e,t)&&e.children.length===t.children.length&&_t.compareFields(e.children,t.children)}function Ic(e,t){return e===t||pt(e,t)&&e.children.length===t.children.length&&_t.compareFields(e.children,t.children)}function ni(e,t){return e===t||pt(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&_t.compareFields(e.children,t.children)}function Sc(e,t){return e===t||pt(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&_t.visit(e.indices,t.indices)&&_t.visit(e.dictionary,t.dictionary)}function ii(e,t){return e===t||pt(e,t)&&e.unit===t.unit}function Bc(e,t){return e===t||pt(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&_t.compareFields(e.children,t.children)}function Ac(e,t){return e===t||pt(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&_t.compareFields(e.children,t.children)}I.prototype.visitNull=ar;I.prototype.visitBool=ar;I.prototype.visitInt=Zt;I.prototype.visitInt8=Zt;I.prototype.visitInt16=Zt;I.prototype.visitInt32=Zt;I.prototype.visitInt64=Zt;I.prototype.visitUint8=Zt;I.prototype.visitUint16=Zt;I.prototype.visitUint32=Zt;I.prototype.visitUint64=Zt;I.prototype.visitFloat=rn;I.prototype.visitFloat16=rn;I.prototype.visitFloat32=rn;I.prototype.visitFloat64=rn;I.prototype.visitUtf8=ar;I.prototype.visitBinary=ar;I.prototype.visitFixedSizeBinary=wc;I.prototype.visitDate=ri;I.prototype.visitDateDay=ri;I.prototype.visitDateMillisecond=ri;I.prototype.visitTimestamp=or;I.prototype.visitTimestampSecond=or;I.prototype.visitTimestampMillisecond=or;I.prototype.visitTimestampMicrosecond=or;I.prototype.visitTimestampNanosecond=or;I.prototype.visitTime=cr;I.prototype.visitTimeSecond=cr;I.prototype.visitTimeMillisecond=cr;I.prototype.visitTimeMicrosecond=cr;I.prototype.visitTimeNanosecond=cr;I.prototype.visitDecimal=ar;I.prototype.visitList=vc;I.prototype.visitStruct=Ic;I.prototype.visitUnion=ni;I.prototype.visitDenseUnion=ni;I.prototype.visitSparseUnion=ni;I.prototype.visitDictionary=Sc;I.prototype.visitInterval=ii;I.prototype.visitIntervalDayTime=ii;I.prototype.visitIntervalYearMonth=ii;I.prototype.visitFixedSizeList=Bc;I.prototype.visitMap=Ac;const _t=new I;class L{static isNull(t){return t&&t.typeId===l.Null}static isInt(t){return t&&t.typeId===l.Int}static isFloat(t){return t&&t.typeId===l.Float}static isBinary(t){return t&&t.typeId===l.Binary}static isUtf8(t){return t&&t.typeId===l.Utf8}static isBool(t){return t&&t.typeId===l.Bool}static isDecimal(t){return t&&t.typeId===l.Decimal}static isDate(t){return t&&t.typeId===l.Date}static isTime(t){return t&&t.typeId===l.Time}static isTimestamp(t){return t&&t.typeId===l.Timestamp}static isInterval(t){return t&&t.typeId===l.Interval}static isList(t){return t&&t.typeId===l.List}static isStruct(t){return t&&t.typeId===l.Struct}static isUnion(t){return t&&t.typeId===l.Union}static isFixedSizeBinary(t){return t&&t.typeId===l.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===l.FixedSizeList}static isMap(t){return t&&t.typeId===l.Map}static isDictionary(t){return t&&t.typeId===l.Dictionary}get typeId(){return l.NONE}compareTo(t){return _t.visit(this,t)}}L[Symbol.toStringTag]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(L.prototype);let Le=class extends L{toString(){return"Null"}get typeId(){return l.Null}};Le[Symbol.toStringTag]=(e=>e[Symbol.toStringTag]="Null")(Le.prototype);class dt extends L{constructor(t,r){super(),this.isSigned=t,this.bitWidth=r}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?Int32Array:Uint32Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}dt[Symbol.toStringTag]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(dt.prototype);class si extends dt{constructor(){super(!0,8)}}class ai extends dt{constructor(){super(!0,16)}}class he extends dt{constructor(){super(!0,32)}}let Me=class extends dt{constructor(){super(!0,64)}};class oi extends dt{constructor(){super(!1,8)}}class ci extends dt{constructor(){super(!1,16)}}class ui extends dt{constructor(){super(!1,32)}}let Ee=class extends dt{constructor(){super(!1,64)}};Object.defineProperty(si.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ai.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(he.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Me.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(oi.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ci.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ui.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ee.prototype,"ArrayType",{value:Uint32Array});class fe extends L{constructor(t){super(),this.precision=t}get typeId(){return l.Float}get ArrayType(){switch(this.precision){case St.HALF:return Uint16Array;case St.SINGLE:return Float32Array;case St.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}fe[Symbol.toStringTag]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(fe.prototype);class nn extends fe{constructor(){super(St.HALF)}}class li extends fe{constructor(){super(St.SINGLE)}}class hi extends fe{constructor(){super(St.DOUBLE)}}Object.defineProperty(nn.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(li.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(hi.prototype,"ArrayType",{value:Float64Array});let Ge=class extends L{constructor(){super()}get typeId(){return l.Binary}toString(){return"Binary"}};Ge[Symbol.toStringTag]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Ge.prototype);let Ue=class extends L{constructor(){super()}get typeId(){return l.Utf8}toString(){return"Utf8"}};Ue[Symbol.toStringTag]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ue.prototype);let Ze=class extends L{constructor(){super()}get typeId(){return l.Bool}toString(){return"Bool"}};Ze[Symbol.toStringTag]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Ze.prototype);let kr=class extends L{constructor(t,r){super(),this.scale=t,this.precision=r}get typeId(){return l.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};kr[Symbol.toStringTag]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(kr.prototype);class Ne extends L{constructor(t){super(),this.unit=t}get typeId(){return l.Date}toString(){return`Date${(this.unit+1)*32}<${Ct[this.unit]}>`}}Ne[Symbol.toStringTag]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ne.prototype);class Tc extends Ne{constructor(){super(Ct.DAY)}}class as extends Ne{constructor(){super(Ct.MILLISECOND)}}class jr extends L{constructor(t,r){super(),this.unit=t,this.bitWidth=r}get typeId(){return l.Time}toString(){return`Time${this.bitWidth}<${Y[this.unit]}>`}}jr[Symbol.toStringTag]=(e=>(e.unit=null,e.bitWidth=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Time"))(jr.prototype);class Pr extends L{constructor(t,r){super(),this.unit=t,this.timezone=r}get typeId(){return l.Timestamp}toString(){return`Timestamp<${Y[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Pr[Symbol.toStringTag]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Pr.prototype);class zr extends L{constructor(t){super(),this.unit=t}get typeId(){return l.Interval}toString(){return`Interval<${xe[this.unit]}>`}}zr[Symbol.toStringTag]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(zr.prototype);let Ve=class extends L{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}};Ve[Symbol.toStringTag]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ve.prototype);let Lt=class extends L{constructor(t){super(),this.children=t}get typeId(){return l.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Lt[Symbol.toStringTag]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Lt.prototype);class Qe extends L{constructor(t,r,n){super(),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,a,i)=>(s[a]=i)&&s||s,Object.create(null))}get typeId(){return l.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Qe[Symbol.toStringTag]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Qe.prototype);let $r=class extends L{constructor(t){super(),this.byteWidth=t}get typeId(){return l.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};$r[Symbol.toStringTag]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))($r.prototype);let Xe=class extends L{constructor(t,r){super(),this.listSize=t,this.children=[r]}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}>`}};Xe[Symbol.toStringTag]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Xe.prototype);let tr=class extends L{constructor(t,r=!1){super(),this.children=[t],this.keysSorted=r}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}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};tr[Symbol.toStringTag]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(tr.prototype);const Fc=(e=>()=>++e)(-1);class ie extends L{constructor(t,r,n,s){super(),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?Fc():typeof n=="number"?n:n.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}>`}}ie[Symbol.toStringTag]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(ie.prototype);function Hs(e){let t=e;switch(e.typeId){case l.Decimal:return 4;case l.Timestamp:return 2;case l.Date:return 1+t.unit;case l.Interval:return 1+t.unit;case l.Int:return 1+ +(t.bitWidth>32);case l.Time:return 1+ +(t.bitWidth>32);case l.FixedSizeList:return t.listSize;case l.FixedSizeBinary:return t.byteWidth;default:return 1}}const Oc=-1;class m{constructor(t,r,n,s,a,i,o){this.type=t,this.dictionary=o,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1)),this.childData=(i||[]).map(u=>u instanceof m?u:u.data);let c;a instanceof m?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=Hs(t),a&&((c=a[0])&&(this.valueOffsets=c),(c=a[1])&&(this.values=c),(c=a[2])&&(this.nullBitmap=c),(c=a[3])&&(this.typeIds=c)))}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,{valueOffsets:r,values:n,nullBitmap:s,typeIds:a}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),a&&(t+=a.byteLength),this.childData.reduce((i,o)=>i+o.byteLength,t)}get nullCount(){let t=this._nullCount,r;return t<=Oc&&(r=this.nullBitmap)&&(this._nullCount=t=this.length-$n(r,this.offset,this.offset+this.length)),t}clone(t,r=this.offset,n=this.length,s=this._nullCount,a=this,i=this.childData){return new m(t,r,n,s,a,i,this.dictionary)}slice(t,r){const{stride:n,typeId:s,childData:a}=this,i=+(this._nullCount===0)-1,o=s===16?n:1,c=this._sliceBuffers(t,r,n,s);return this.clone(this.type,this.offset+t,r,i,c,!a.length||this.valueOffsets?a:this._sliceChildren(a,o*t,o*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===l.Null)return this.clone(this.type,0,t,0);const{length:r,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<<r-(r&-8))-1,n>0&&s.set(ei(this.offset,r,this.nullBitmap),0);const a=this.buffers;return a[w.VALIDITY]=s,this.clone(this.type,0,t,n+(t-r),a)}_sliceBuffers(t,r,n,s){let a,{buffers:i}=this;return(a=i[w.TYPE])&&(i[w.TYPE]=a.subarray(t,t+r)),(a=i[w.OFFSET])&&(i[w.OFFSET]=a.subarray(t,t+r+1))||(a=i[w.DATA])&&(i[w.DATA]=s===6?a:a.subarray(n*t,n*(t+r))),i}_sliceChildren(t,r,n){return t.map(s=>s.slice(r,n))}static new(t,r,n,s,a,i,o){switch(a instanceof m?a=a.buffers:a||(a=[]),t.typeId){case l.Null:return m.Null(t,r,n);case l.Int:return m.Int(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Dictionary:return m.Dictionary(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[],o);case l.Float:return m.Float(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Bool:return m.Bool(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Decimal:return m.Decimal(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Date:return m.Date(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Time:return m.Time(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Timestamp:return m.Timestamp(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Interval:return m.Interval(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.FixedSizeBinary:return m.FixedSizeBinary(t,r,n,s||0,a[w.VALIDITY],a[w.DATA]||[]);case l.Binary:return m.Binary(t,r,n,s||0,a[w.VALIDITY],a[w.OFFSET]||[],a[w.DATA]||[]);case l.Utf8:return m.Utf8(t,r,n,s||0,a[w.VALIDITY],a[w.OFFSET]||[],a[w.DATA]||[]);case l.List:return m.List(t,r,n,s||0,a[w.VALIDITY],a[w.OFFSET]||[],(i||[])[0]);case l.FixedSizeList:return m.FixedSizeList(t,r,n,s||0,a[w.VALIDITY],(i||[])[0]);case l.Struct:return m.Struct(t,r,n,s||0,a[w.VALIDITY],i||[]);case l.Map:return m.Map(t,r,n,s||0,a[w.VALIDITY],a[w.OFFSET]||[],(i||[])[0]);case l.Union:return m.Union(t,r,n,s||0,a[w.VALIDITY],a[w.TYPE]||[],a[w.OFFSET]||i,i)}throw new Error(`Unrecognized typeId ${t.typeId}`)}static Null(t,r,n){return new m(t,r,n,0)}static Int(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Dictionary(t,r,n,s,a,i,o){return new m(t,r,n,s,[void 0,z(t.indices.ArrayType,i),U(a)],[],o)}static Float(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Bool(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Decimal(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Date(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Time(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Timestamp(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Interval(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static FixedSizeBinary(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,z(t.ArrayType,i),U(a)])}static Binary(t,r,n,s,a,i,o){return new m(t,r,n,s,[ze(i),U(o),U(a)])}static Utf8(t,r,n,s,a,i,o){return new m(t,r,n,s,[ze(i),U(o),U(a)])}static List(t,r,n,s,a,i,o){return new m(t,r,n,s,[ze(i),void 0,U(a)],[o])}static FixedSizeList(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,void 0,U(a)],[i])}static Struct(t,r,n,s,a,i){return new m(t,r,n,s,[void 0,void 0,U(a)],i)}static Map(t,r,n,s,a,i,o){return new m(t,r,n,s,[ze(i),void 0,U(a)],[o])}static Union(t,r,n,s,a,i,o,c){const u=[void 0,void 0,U(a),z(t.ArrayType,i)];return t.mode===Jt.Sparse?new m(t,r,n,s,u,o):(u[w.OFFSET]=ze(o),new m(t,r,n,s,u,c))}}m.prototype.childData=Object.freeze([]);const Dc=void 0;function He(e){if(e===null)return"null";if(e===Dc)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e)}function xc(e){if(!e||e.length<=0)return function(s){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
    switch (x) {${r.map(n=>`
        case ${Lc(n)}:`).join("")}
            return false;
    }`),e.length!==r.length&&(t=`if (x !== x) return false;
${t}`),new Function("x",`${t}
return true;`)}function Lc(e){return typeof e!="bigint"?He(e):tn?`${He(e)}n`:`"${He(e)}"`}const On=(e,t)=>(e*t+63&-64||64)/t,Mc=(e,t=0)=>e.length>=t?e.subarray(0,t):Rr(new e.constructor(t),e,0);class ur{constructor(t,r=1){this.buffer=t,this.stride=r,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=t.length/r|0)}get byteLength(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;const r=this.stride,n=this.length*r,s=this.buffer.length;n>=s&&this._resize(s===0?On(n*1,this.BYTES_PER_ELEMENT):On(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=On(t*this.stride,this.BYTES_PER_ELEMENT);const r=Mc(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Rr(new this.ArrayType(t),this.buffer)}}ur.prototype.offset=0;class lr extends ur{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}}class qs extends lr{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){const{buffer:n}=this.reserve(t-this.length+1),s=t>>3,a=t%8,i=n[s]>>a&1;return r?i===0&&(n[s]|=1<<a,++this.numValid):i===1&&(n[s]&=~(1<<a),--this.numValid),this}clear(){return this.numValid=0,super.clear()}}class Ks extends lr{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,r){const n=this.length-1,s=this.reserve(t-n+1).buffer;return n<t++&&s.fill(s[n],n,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}}class Js extends ur{get ArrayType64(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?ke:sr)}set(t,r){switch(this.reserve(t-this.length+1),typeof r){case"bigint":this.buffer64[t]=r;break;case"number":this.buffer[t*this.stride]=r;break;default:this.buffer.set(r,t*this.stride)}return this}_resize(t){const r=super._resize(t),n=r.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return tn&&(this.buffer64=new this.ArrayType64(r.buffer,r.byteOffset,n)),r}}let Q=class{constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Hs(t),this._nulls=new qs,r&&r.length>0&&(this._isValid=xc(r))}static new(t){}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}static throughIterable(t){return Ec(t)}static throughAsyncIterable(t){return Uc(t)}toVector(){return N.new(this.flush())}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),this._typeIds&&(t+=this._typeIds.byteLength),this.children.reduce((r,n)=>r+n.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){const t=[],r=this._values,n=this._offsets,s=this._typeIds,{length:a,nullCount:i}=this;s?(t[w.TYPE]=s.flush(a),n&&(t[w.OFFSET]=n.flush(a))):n?(r&&(t[w.DATA]=r.flush(n.last())),t[w.OFFSET]=n.flush(a)):r&&(t[w.DATA]=r.flush(a)),i>0&&(t[w.VALIDITY]=this._nulls.flush(a));const o=m.new(this.type,0,a,i,t,this.children.map(c=>c.flush()));return this.clear(),o}finish(){return this.finished=!0,this.children.forEach(t=>t.finish()),this}clear(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach(t=>t.clear()),this}};Q.prototype.length=1;Q.prototype.stride=1;Q.prototype.children=null;Q.prototype.finished=!1;Q.prototype.nullValues=null;Q.prototype._isValid=()=>!0;class ae extends Q{constructor(t){super(t),this._values=new lr(new this.ArrayType(0),this.stride)}setValue(t,r){const n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}}class sn extends Q{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ks}setValue(t,r){const n=this._pending||(this._pending=new Map),s=n.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}}function Ec(e){const{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?1e3:2**14}=e,n=t!=="bytes"?"length":"byteLength";return function*(s){let a=0,i=Q.new(e);for(const o of s)i.append(o)[n]>=r&&++a&&(yield i.toVector());(i.finish().length>0||a===0)&&(yield i.toVector())}}function Uc(e){const{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?1e3:2**14}=e,n=t!=="bytes"?"length":"byteLength";return async function*(s){let a=0,i=Q.new(e);for await(const o of s)i.append(o)[n]>=r&&++a&&(yield i.toVector());(i.finish().length>0||a===0)&&(yield i.toVector())}}class Nc extends Q{constructor(t){super(t),this._values=new qs}setValue(t,r){this._values.set(t,+r)}}class Vc extends Q{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}}class fi extends ae{}class Rc extends fi{}class Cc extends fi{}class kc extends ae{}class jc extends Q{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new ie(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Q.new({type:this.type.indices,nullValues:r}),this.dictionary=Q.new({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){const n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,s=this.valueToKey(r),a=n[s];return a===void 0&&(n[s]=a=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,a)}flush(){const t=this.type,r=this._dictionary,n=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}class Pc extends ae{}const Gs=new Float64Array(1),_e=new Uint32Array(Gs.buffer);function zc(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=(-1)**((e&32768)>>15);switch(t){case 31:return n*(r?NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*2**(t-15)*(1+r)}function Zs(e){if(e!==e)return 32256;Gs[0]=e;let t=(_e[1]&2147483648)>>16&65535,r=_e[1]&2146435072,n=0;return r>=1089470464?_e[0]>0?r=31744:(r=(r&2080374784)>>16,n=(_e[1]&1048575)>>10):r<=1056964608?(n=1048576+(_e[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(_e[1]&1048575)+512>>10),t|r|n&65535}class an extends ae{}class $c extends an{setValue(t,r){this._values.set(t,Zs(r))}}class Wc extends an{setValue(t,r){this._values.set(t,r)}}class Yc extends an{setValue(t,r){this._values.set(t,r)}}const Hc=Symbol.for("isArrowBigNum");function Mt(e,...t){return t.length===0?Object.setPrototypeOf(z(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Mt.prototype[Hc]=!0;Mt.prototype.toJSON=function(){return`"${le(this)}"`};Mt.prototype.valueOf=function(){return Qs(this)};Mt.prototype.toString=function(){return le(this)};Mt.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Qs(this);case"string":return le(this);case"default":return Wr(this)}return le(this)};function Se(...e){return Mt.apply(this,e)}function Be(...e){return Mt.apply(this,e)}function er(...e){return Mt.apply(this,e)}Object.setPrototypeOf(Se.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Be.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(er.prototype,Object.create(Uint32Array.prototype));Object.assign(Se.prototype,Mt.prototype,{constructor:Se,signed:!0,TypedArray:Int32Array,BigIntArray:ke});Object.assign(Be.prototype,Mt.prototype,{constructor:Be,signed:!1,TypedArray:Uint32Array,BigIntArray:sr});Object.assign(er.prototype,Mt.prototype,{constructor:er,signed:!0,TypedArray:Uint32Array,BigIntArray:sr});function Qs(e){let{buffer:t,byteOffset:r,length:n,signed:s}=e,a=new Int32Array(t,r,n),i=0,o=0,c=a.length,u,d;for(;o<c;)d=a[o++],u=a[o++],s||(u=u>>>0),i+=(d>>>0)+u*o**32;return i}let le,Wr;tn?(Wr=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Dn(e),le=e=>e.byteLength===8?`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`:Dn(e)):(le=Dn,Wr=le);function Dn(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),a=-1,i=n.length-1;do{for(r[0]=n[a=0];a<i;)n[a++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[a];n[a]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t||"0"}class je{constructor(t,r){return je.new(t,r)}static new(t,r){switch(r){case!0:return new Se(t);case!1:return new Be(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case ke:return new Se(t)}return t.byteLength===16?new er(t):new Be(t)}static signed(t){return new Se(t)}static unsigned(t){return new Be(t)}static decimal(t){return new er(t)}}class Qt extends ae{setValue(t,r){this._values.set(t,r)}}class qc extends Qt{}class Kc extends Qt{}class Jc extends Qt{}class Gc extends Qt{constructor(t){t.nullValues&&(t.nullValues=t.nullValues.map(Yr)),super(t),this._values=new Js(new Int32Array(0),2)}get values64(){return this._values.buffer64}isValid(t){return super.isValid(Yr(t))}}class Zc extends Qt{}class Qc extends Qt{}class Xc extends Qt{}class tu extends Qt{constructor(t){t.nullValues&&(t.nullValues=t.nullValues.map(Yr)),super(t),this._values=new Js(new Uint32Array(0),2)}get values64(){return this._values.buffer64}isValid(t){return super.isValid(Yr(t))}}const Yr=(e=>t=>(ArrayBuffer.isView(t)&&(e.buffer=t.buffer,e.byteOffset=t.byteOffset,e.byteLength=t.byteLength,t=Wr(e),e.buffer=null),t))({BigIntArray:ke});class hr extends ae{}class eu extends hr{}class ru extends hr{}class nu extends hr{}class iu extends hr{}class fr extends ae{}class su extends fr{}class au extends fr{}class ou extends fr{}class cu extends fr{}class di extends ae{}class uu extends di{}class lu extends di{}class Xs extends sn{constructor(t){super(t),this._values=new ur(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,U(r))}_flushPending(t,r){const n=this._offsets,s=this._values.reserve(r).buffer;let a=0,i=0,o=0,c;for([a,c]of t)c===void 0?n.set(a,0):(i=c.length,s.set(c,o),n.set(a,i),o+=i)}}class pi extends sn{constructor(t){super(t),this._values=new ur(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Xr(r))}_flushPending(t,r){}}pi.prototype._flushPending=Xs.prototype._flushPending;class ta{get length(){return this._values.length}get(t){return this._values[t]}clear(){return this._values=null,this}bind(t){return t instanceof N?t:(this._values=t,this)}}const it=Symbol.for("parent"),Ae=Symbol.for("rowIndex"),mt=Symbol.for("keyToIdx"),bt=Symbol.for("idxToVal"),Wn=Symbol.for("nodejs.util.inspect.custom");class Kt{constructor(t,r){this[it]=t,this.size=r}entries(){return this[Symbol.iterator]()}has(t){return this.get(t)!==void 0}get(t){let r;if(t!=null){const n=this[mt]||(this[mt]=new Map);let s=n.get(t);if(s!==void 0){const a=this[bt]||(this[bt]=new Array(this.size));(r=a[s])!==void 0||(a[s]=r=this.getValue(s))}else if((s=this.getIndex(t))>-1){n.set(t,s);const a=this[bt]||(this[bt]=new Array(this.size));(r=a[s])!==void 0||(a[s]=r=this.getValue(s))}}return r}set(t,r){if(t!=null){const n=this[mt]||(this[mt]=new Map);let s=n.get(t);if(s===void 0&&n.set(t,s=this.getIndex(t)),s>-1){const a=this[bt]||(this[bt]=new Array(this.size));a[s]=this.setValue(s,r)}}return this}clear(){throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`)}delete(t){throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`)}*[Symbol.iterator](){const t=this.keys(),r=this.values(),n=this[mt]||(this[mt]=new Map),s=this[bt]||(this[bt]=new Array(this.size));for(let a,i,o=0,c,u;!((c=t.next()).done||(u=r.next()).done);++o)a=c.value,i=u.value,s[o]=i,n.has(a)||n.set(a,o),yield[a,i]}forEach(t,r){const n=this.keys(),s=this.values(),a=r===void 0?t:(c,u,d)=>t.call(r,c,u,d),i=this[mt]||(this[mt]=new Map),o=this[bt]||(this[bt]=new Array(this.size));for(let c,u,d=0,b,_;!((b=n.next()).done||(_=s.next()).done);++d)c=b.value,u=_.value,o[d]=u,i.has(c)||i.set(c,d),a(u,c,this)}toArray(){return[...this.values()]}toJSON(){const t={};return this.forEach((r,n)=>t[n]=r),t}inspect(){return this.toString()}[Wn](){return this.toString()}toString(){const t=[];return this.forEach((r,n)=>{n=He(n),r=He(r),t.push(`${n}: ${r}`)}),`{ ${t.join(", ")} }`}}Kt[Symbol.toStringTag]=(e=>(Object.defineProperties(e,{size:{writable:!0,enumerable:!1,configurable:!1,value:0},[it]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ae]:{writable:!0,enumerable:!1,configurable:!1,value:-1}}),e[Symbol.toStringTag]="Row"))(Kt.prototype);class ea extends Kt{constructor(t){return super(t,t.length),hu(this)}keys(){return this[it].getChildAt(0)[Symbol.iterator]()}values(){return this[it].getChildAt(1)[Symbol.iterator]()}getKey(t){return this[it].getChildAt(0).get(t)}getIndex(t){return this[it].getChildAt(0).indexOf(t)}getValue(t){return this[it].getChildAt(1).get(t)}setValue(t,r){this[it].getChildAt(1).set(t,r)}}class ra extends Kt{constructor(t){return super(t,t.type.children.length),na(this)}*keys(){for(const t of this[it].type.children)yield t.name}*values(){for(const t of this[it].type.children)yield this[t.name]}getKey(t){return this[it].type.children[t].name}getIndex(t){return this[it].type.children.findIndex(r=>r.name===t)}getValue(t){return this[it].getChildAt(t).get(this[Ae])}setValue(t,r){return this[it].getChildAt(t).set(this[Ae],r)}}Object.setPrototypeOf(Kt.prototype,Map.prototype);const na=(()=>{const e={enumerable:!0,configurable:!1,get:null,set:null};return t=>{let r=-1,n=t[mt]||(t[mt]=new Map);const s=i=>function(){return this.get(i)},a=i=>function(o){return this.set(i,o)};for(const i of t.keys())n.set(i,++r),e.get=s(i),e.set=a(i),t.hasOwnProperty(i)||(e.enumerable=!0,Object.defineProperty(t,i,e)),t.hasOwnProperty(r)||(e.enumerable=!1,Object.defineProperty(t,r,e));return e.get=e.set=null,t}})(),hu=(()=>{if(typeof Proxy>"u")return na;const e=Kt.prototype.has,t=Kt.prototype.get,r=Kt.prototype.set,n=Kt.prototype.getKey,s={isExtensible(){return!1},deleteProperty(){return!1},preventExtensions(){return!0},ownKeys(a){return[...a.keys()].map(i=>`${i}`)},has(a,i){switch(i){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case it:case Ae:case bt:case mt:case Wn:return!0}return typeof i=="number"&&!a.has(i)&&(i=a.getKey(i)),a.has(i)},get(a,i,o){switch(i){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case it:case Ae:case bt:case mt:case Wn:return Reflect.get(a,i,o)}return typeof i=="number"&&!e.call(o,i)&&(i=n.call(o,i)),t.call(o,i)},set(a,i,o,c){switch(i){case it:case Ae:case bt:case mt:return Reflect.set(a,i,o,c);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return typeof i=="number"&&!e.call(c,i)&&(i=n.call(c,i)),e.call(c,i)?!!r.call(c,i,o):!1}};return a=>new Proxy(a,s)})();let os;function ia(e,t,r,n){let{length:s=0}=e,a=typeof t!="number"?0:t,i=typeof r!="number"?s:r;return a<0&&(a=(a%s+s)%s),i<0&&(i=(i%s+s)%s),i<a&&(os=a,a=i,i=os),i>s&&(i=s),n?n(e,a,i):[a,i]}const fu=tn?Xo(0):0,cs=e=>e!==e;function Pe(e){let t=typeof e;if(t!=="object"||e===null)return cs(e)?cs:t!=="bigint"?r=>r===e:r=>fu+r===e;if(e instanceof Date){const r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?lc(e,r):!1:e instanceof Map?pu(e):Array.isArray(e)?du(e):e instanceof N?yu(e):bu(e)}function du(e){const t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Pe(e[r]);return on(t)}function pu(e){let t=-1;const r=[];return e.forEach(n=>r[++t]=Pe(n)),on(r)}function yu(e){const t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Pe(e.get(r));return on(t)}function bu(e){const t=Object.keys(e);if(t.length===0)return()=>!1;const r=[];for(let n=-1,s=t.length;++n<s;)r[n]=Pe(e[t[n]]);return on(r,t)}function on(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return mu(e,r);case Map:case ea:case ra:return us(e,r,r.keys());case Object:case void 0:return us(e,r,t||Object.keys(r))}return r instanceof N?gu(e,r):!1}}function mu(e,t){const r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function gu(e,t){const r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function us(e,t,r){const n=r[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let i=0,o=e.length,c=a.next(),u=n.next(),d=s.next();for(;i<o&&!u.done&&!d.done&&!c.done&&!(u.value!==d.value||!e[i](c.value));++i,u=n.next(),d=s.next(),c=a.next());return i===o&&u.done&&d.done&&c.done?!0:(n.return&&n.return(),s.return&&s.return(),a.return&&a.return(),!1)}class st extends N{constructor(t,r=[],n=_u(r)){super(),this._nullCount=-1,this._type=t,this._chunks=r,this._chunkOffsets=n,this._length=n[n.length-1],this._numChildren=(this._type.children||[]).length}static flatten(...t){return Su(N,t)}static concat(...t){const r=st.flatten(...t);return new st(r[0].type,r)}get type(){return this._type}get length(){return this._length}get chunks(){return this._chunks}get typeId(){return this._type.typeId}get VectorName(){return`Chunked<${this._type}>`}get data(){return this._chunks[0]?this._chunks[0].data:null}get ArrayType(){return this._type.ArrayType}get numChildren(){return this._numChildren}get stride(){return this._chunks[0]?this._chunks[0].stride:1}get byteLength(){return this._chunks.reduce((t,r)=>t+r.byteLength,0)}get nullCount(){let t=this._nullCount;return t<0&&(this._nullCount=t=this._chunks.reduce((r,{nullCount:n})=>r+n,0)),t}get indices(){if(L.isDictionary(this._type)){if(!this._indices){const t=this._chunks;this._indices=t.length===1?t[0].indices:st.concat(...t.map(r=>r.indices))}return this._indices}return null}get dictionary(){return L.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}*[Symbol.iterator](){for(const t of this._chunks)yield*t}clone(t=this._chunks){return new st(this._type,t)}concat(...t){return this.clone(st.flatten(this,...t))}slice(t,r){return ia(this,t,r,this._sliceInternal)}getChildAt(t){if(t<0||t>=this._numChildren)return null;let r=this._children||(this._children=[]),n,s,a;return(n=r[t])?n:(s=(this._type.children||[])[t])&&(a=this._chunks.map(i=>i.getChildAt(t)).filter(i=>i!=null),a.length>0)?r[t]=new st(s.type,a):null}search(t,r){let n=t,s=this._chunkOffsets,a=s.length-1;if(n<0||n>=s[a])return null;if(a<=1)return r?r(this,0,n):[0,n];let i=0,o=0,c=0;do{if(i+1===a)return r?r(this,i,n-o):[i,n-o];c=i+(a-i)/2|0,n>=s[c]?i=c:a=c}while(n<s[a]&&n>=(o=s[i]));return null}isValid(t){return!!this.search(t,this.isValidInternal)}get(t){return this.search(t,this.getInternal)}set(t,r){this.search(t,({chunks:n},s,a)=>n[s].set(a,r))}indexOf(t,r){return r&&typeof r=="number"?this.search(r,(n,s,a)=>this.indexOfInternal(n,s,a,t)):this.indexOfInternal(this,0,Math.max(0,r||0),t)}toArray(){const{chunks:t}=this,r=t.length;let n=this._type.ArrayType;if(r<=0)return new n(0);if(r<=1)return t[0].toArray();let s=0,a=new Array(r);for(let c=-1;++c<r;)s+=(a[c]=t[c].toArray()).length;n!==a[0].constructor&&(n=a[0].constructor);let i=new n(s),o=n===Array?vu:wu;for(let c=-1,u=0;++c<r;)u=o(a[c],i,u);return i}getInternal({_chunks:t},r,n){return t[r].get(n)}isValidInternal({_chunks:t},r,n){return t[r].isValid(n)}indexOfInternal({_chunks:t},r,n,s){let a=r-1,i=t.length,o=n,c=0,u=-1;for(;++a<i;){if(~(u=t[a].indexOf(s,o)))return c+u;o=0,c+=t[a].length}return-1}_sliceInternal(t,r,n){const s=[],{chunks:a,_chunkOffsets:i}=t;for(let o=-1,c=a.length;++o<c;){const u=a[o],d=u.length,b=i[o];if(b>=n)break;if(r>=b+d)continue;if(b>=r&&b+d<=n){s.push(u);continue}const _=Math.max(0,r-b),v=Math.min(n-b,d);s.push(u.slice(_,v))}return t.clone(s)}}function _u(e){let t=new Uint32Array((e||[]).length+1),r=t[0]=0,n=t.length;for(let s=0;++s<n;)t[s]=r+=e[s-1].length;return t}const wu=(e,t,r)=>(t.set(e,r),r+e.length),vu=(e,t,r)=>{let n=r;for(let s=-1,a=e.length;++s<a;)t[n++]=e[s];return n};class Ft extends st{constructor(t,r=[],n){if(r=st.flatten(...r),super(t.type,r,n),this._field=t,r.length===1&&!(this instanceof ls))return new ls(t,r[0],this._chunkOffsets)}static new(t,r,...n){const s=st.flatten(Array.isArray(r)?[...r,...n]:r instanceof N?[r,...n]:[N.new(r,...n)]);if(typeof t=="string"){const a=s[0].data.type;t=new V(t,a,!0)}else!t.nullable&&s.some(({nullCount:a})=>a>0)&&(t=t.clone({nullable:!0}));return new Ft(t,s)}get field(){return this._field}get name(){return this._field.name}get nullable(){return this._field.nullable}get metadata(){return this._field.metadata}clone(t=this._chunks){return new Ft(this._field,t)}getChildAt(t){if(t<0||t>=this.numChildren)return null;let r=this._children||(this._children=[]),n,s,a;return(n=r[t])?n:(s=(this.type.children||[])[t])&&(a=this._chunks.map(i=>i.getChildAt(t)).filter(i=>i!=null),a.length>0)?r[t]=new Ft(s,a):null}}class ls extends Ft{constructor(t,r,n){super(t,[r],n),this._chunk=r}search(t,r){return r?r(this,0,t):[0,t]}isValid(t){return this._chunk.isValid(t)}get(t){return this._chunk.get(t)}set(t,r){this._chunk.set(t,r)}indexOf(t,r){return this._chunk.indexOf(t,r)}}const ue=Array.isArray,sa=(e,t)=>yi(e,t,[],0),Iu=e=>{const[t,r]=bi(e,[[],[]]);return r.map((n,s)=>n instanceof Ft?Ft.new(n.field.clone(t[s]),n):n instanceof N?Ft.new(t[s],n):Ft.new(t[s],[]))},aa=e=>bi(e,[[],[]]),Su=(e,t)=>Yn(e,t,[],0),Bu=(e,t)=>oa(e,t,[],0);function yi(e,t,r,n){let s,a=n,i=-1,o=t.length;for(;++i<o;)ue(s=t[i])?a=yi(e,s,r,a).length:s instanceof e&&(r[a++]=s);return r}function Yn(e,t,r,n){let s,a=n,i=-1,o=t.length;for(;++i<o;)ue(s=t[i])?a=Yn(e,s,r,a).length:s instanceof st?a=Yn(e,s.chunks,r,a).length:s instanceof e&&(r[a++]=s);return r}function oa(e,t,r,n){let s,a=n,i=-1,o=t.length;for(;++i<o;)ue(s=t[i])?a=oa(e,s,r,a).length:s instanceof e?a=yi(N,s.schema.fields.map((c,u)=>s.getChildAt(u)),r,a).length:s instanceof N&&(r[a++]=s);return r}const Au=(e,[t,r],n)=>(e[0][n]=t,e[1][n]=r,e);function bi(e,t){let r,n;switch(n=e.length){case 0:return t;case 1:if(r=t[0],!e[0])return t;if(ue(e[0]))return bi(e[0],t);e[0]instanceof m||e[0]instanceof N||e[0]instanceof L||([r,e]=Object.entries(e[0]).reduce(Au,t));break;default:ue(r=e[n-1])?e=ue(e[0])?e[0]:e.slice(0,n-1):(e=ue(e[0])?e[0]:e,r=[])}let s=-1,a=-1,i=-1,o=e.length,c,u,[d,b]=t;for(;++i<o;)u=e[i],u instanceof Ft&&(b[++a]=u)?d[++s]=u.field.clone(r[i],u.type,!0):({[i]:c=i}=r,u instanceof L&&(b[++a]=u)?d[++s]=V.new(c,u,!0):u&&u.type&&(b[++a]=u)&&(u instanceof m&&(b[a]=u=N.new(u)),d[++s]=V.new(c,u.type,!0)));return t}class H{constructor(t=[],r,n){this.fields=t||[],this.metadata=r||new Map,n||(n=Hn(t)),this.dictionaries=n}static from(...t){return H.new(t[0],t[1])}static new(...t){return new H(aa(t)[0])}get[Symbol.toStringTag](){return"Schema"}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}compareTo(t){return _t.compareSchemas(this,t)}select(...t){const r=t.reduce((n,s)=>(n[s]=!0)&&n,Object.create(null));return new H(this.fields.filter(n=>r[n.name]),this.metadata)}selectAt(...t){return new H(t.map(r=>this.fields[r]).filter(Boolean),this.metadata)}assign(...t){const r=t[0]instanceof H?t[0]:new H(sa(V,t)),n=[...this.fields],s=wr(wr(new Map,this.metadata),r.metadata),a=r.fields.filter(o=>{const c=n.findIndex(u=>u.name===o.name);return~c?(n[c]=o.clone({metadata:wr(wr(new Map,n[c].metadata),o.metadata)}))&&!1:!0}),i=Hn(a,new Map);return new H([...n,...a],s,new Map([...this.dictionaries,...i]))}}class V{constructor(t,r,n=!1,s){this.name=t,this.type=r,this.nullable=n,this.metadata=s||new Map}static new(...t){let[r,n,s,a]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),a===void 0&&(a=t[0].metadata)),new V(`${r}`,n,s,a)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}compareTo(t){return _t.compareField(this,t)}clone(...t){let[r,n,s,a]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,s=this.nullable,a=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:s=this.nullable,metadata:a=this.metadata}=t[0],V.new(r,n,s,a)}}function wr(e,t){return new Map([...e||new Map,...t||new Map])}function Hn(e,t=new Map){for(let r=-1,n=e.length;++r<n;){const a=e[r].type;if(L.isDictionary(a)){if(!t.has(a.id))t.set(a.id,a.dictionary);else if(t.get(a.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}a.children&&a.children.length>0&&Hn(a.children,t)}return t}H.prototype.fields=null;H.prototype.metadata=null;H.prototype.dictionaries=null;V.prototype.type=null;V.prototype.name=null;V.prototype.nullable=null;V.prototype.metadata=null;class Tu extends sn{constructor(t){super(t),this._run=new ta,this._offsets=new Ks}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ve(new V(r,t.type,!0)),this.numChildren-1}clear(){return this._run.clear(),super.clear()}_flushPending(t){const r=this._run,n=this._offsets,s=this._setValue;let a=0,i;for([a,i]of t)i===void 0?n.set(a,0):(n.set(a,i.length),s(this,a,r.bind(i)))}}class Fu extends Q{constructor(){super(...arguments),this._run=new ta}setValue(t,r){super.setValue(t,this._run.bind(r))}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");const n=this.children.push(t);return this.type=new Xe(this.type.listSize,new V(r,t.type,!0)),n}clear(){return this._run.clear(),super.clear()}}class Ou extends sn{set(t,r){return super.set(t,r)}setValue(t,r){r=r instanceof Map?r:new Map(Object.entries(r));const n=this._pending||(this._pending=new Map),s=n.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=r.size,n.set(t,r)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new tr(new V(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){const r=this._offsets,n=this._setValue;t.forEach((s,a)=>{s===void 0?r.set(a,0):(r.set(a,s.size),n(this,a,s))})}}class Du extends Q{addChild(t,r=`${this.numChildren}`){const n=this.children.push(t);return this.type=new Lt([...this.type.children,new V(r,t.type,!0)]),n}}class mi extends Q{constructor(t){super(t),this._typeIds=new lr(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValid(t,this.isValid(r))&&this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n),super.setValue(t,r)}addChild(t,r=`${this.children.length}`){const n=this.children.push(t),{type:{children:s,mode:a,typeIds:i}}=this,o=[...s,new V(r,t.type)];return this.type=new Qe(a,[...i,n],o),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class xu extends mi{}class Lu extends mi{constructor(t){super(t),this._offsets=new lr(new Int32Array(0))}setValue(t,r,n){const s=this.type.typeIdToChildIndex[n];return this._offsets.set(t,this.getChildAt(s).length),super.setValue(t,r,n)}}class F extends E{}const Mu=(e,t,r)=>{e[t]=r/864e5|0},gi=(e,t,r)=>{e[t]=r%4294967296|0,e[t+1]=r/4294967296|0},Eu=(e,t,r)=>{e[t]=r*1e3%4294967296|0,e[t+1]=r*1e3/4294967296|0},Uu=(e,t,r)=>{e[t]=r*1e6%4294967296|0,e[t+1]=r*1e6/4294967296|0},ca=(e,t,r,n)=>{const{[r]:s,[r+1]:a}=t;s!=null&&a!=null&&e.set(n.subarray(0,a-s),s)},Nu=({offset:e,values:t},r,n)=>{const s=e+r;n?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},ua=({values:e},t,r)=>{Mu(e,t,r.valueOf())},la=({values:e},t,r)=>{gi(e,t*2,r.valueOf())},jt=({stride:e,values:t},r,n)=>{t[e*r]=n},ha=({stride:e,values:t},r,n)=>{t[e*r]=Zs(n)},_i=(e,t,r)=>{switch(typeof r){case"bigint":e.values64[t]=r;break;case"number":e.values[t*e.stride]=r;break;default:const n=r,{stride:s,ArrayType:a}=e,i=z(a,n);e.values.set(i.subarray(0,s),s*t)}},Vu=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},Ru=({values:e,valueOffsets:t},r,n)=>ca(e,t,r,n),Cu=({values:e,valueOffsets:t},r,n)=>{ca(e,t,r,Xr(n))},ku=(e,t,r)=>{e.type.bitWidth<64?jt(e,t,r):_i(e,t,r)},ju=(e,t,r)=>{e.type.precision!==St.HALF?jt(e,t,r):ha(e,t,r)},Pu=(e,t,r)=>{e.type.unit===Ct.DAY?ua(e,t,r):la(e,t,r)},fa=({values:e},t,r)=>gi(e,t*2,r/1e3),da=({values:e},t,r)=>gi(e,t*2,r),pa=({values:e},t,r)=>Eu(e,t*2,r),ya=({values:e},t,r)=>Uu(e,t*2,r),zu=(e,t,r)=>{switch(e.type.unit){case Y.SECOND:return fa(e,t,r);case Y.MILLISECOND:return da(e,t,r);case Y.MICROSECOND:return pa(e,t,r);case Y.NANOSECOND:return ya(e,t,r)}},ba=({values:e,stride:t},r,n)=>{e[t*r]=n},ma=({values:e,stride:t},r,n)=>{e[t*r]=n},ga=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},_a=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},$u=(e,t,r)=>{switch(e.type.unit){case Y.SECOND:return ba(e,t,r);case Y.MILLISECOND:return ma(e,t,r);case Y.MICROSECOND:return ga(e,t,r);case Y.NANOSECOND:return _a(e,t,r)}},Wu=({values:e},t,r)=>{e.set(r.subarray(0,4),4*t)},Yu=(e,t,r)=>{const n=e.getChildAt(0),s=e.valueOffsets;for(let a=-1,i=s[t],o=s[t+1];i<o;)n.set(i++,r.get(++a))},Hu=(e,t,r)=>{const n=e.getChildAt(0),s=e.valueOffsets,a=r instanceof Map?[...r]:Object.entries(r);for(let i=-1,o=s[t],c=s[t+1];o<c;)n.set(o++,a[++i])},qu=(e,t)=>(r,n,s)=>r&&r.set(e,t[s]),Ku=(e,t)=>(r,n,s)=>r&&r.set(e,t.get(s)),Ju=(e,t)=>(r,n,s)=>r&&r.set(e,t.get(n.name)),Gu=(e,t)=>(r,n,s)=>r&&r.set(e,t[n.name]),Zu=(e,t,r)=>{const n=r instanceof Map?Ju(t,r):r instanceof N?Ku(t,r):Array.isArray(r)?qu(t,r):Gu(t,r);e.type.children.forEach((s,a)=>n(e.getChildAt(a),s,a))},Qu=(e,t,r)=>{e.type.mode===Jt.Dense?wa(e,t,r):va(e,t,r)},wa=(e,t,r)=>{const n=e.typeIdToChildIndex[e.typeIds[t]],s=e.getChildAt(n);s&&s.set(e.valueOffsets[t],r)},va=(e,t,r)=>{const n=e.typeIdToChildIndex[e.typeIds[t]],s=e.getChildAt(n);s&&s.set(t,r)},Xu=(e,t,r)=>{const n=e.getKey(t);n!==null&&e.setValue(n,r)},tl=(e,t,r)=>{e.type.unit===xe.DAY_TIME?Ia(e,t,r):Sa(e,t,r)},Ia=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},Sa=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},el=(e,t,r)=>{const n=e.getChildAt(0),{stride:s}=e;for(let a=-1,i=t*s;++a<s;)n.set(i+a,r.get(a))};F.prototype.visitBool=Nu;F.prototype.visitInt=ku;F.prototype.visitInt8=jt;F.prototype.visitInt16=jt;F.prototype.visitInt32=jt;F.prototype.visitInt64=_i;F.prototype.visitUint8=jt;F.prototype.visitUint16=jt;F.prototype.visitUint32=jt;F.prototype.visitUint64=_i;F.prototype.visitFloat=ju;F.prototype.visitFloat16=ha;F.prototype.visitFloat32=jt;F.prototype.visitFloat64=jt;F.prototype.visitUtf8=Cu;F.prototype.visitBinary=Ru;F.prototype.visitFixedSizeBinary=Vu;F.prototype.visitDate=Pu;F.prototype.visitDateDay=ua;F.prototype.visitDateMillisecond=la;F.prototype.visitTimestamp=zu;F.prototype.visitTimestampSecond=fa;F.prototype.visitTimestampMillisecond=da;F.prototype.visitTimestampMicrosecond=pa;F.prototype.visitTimestampNanosecond=ya;F.prototype.visitTime=$u;F.prototype.visitTimeSecond=ba;F.prototype.visitTimeMillisecond=ma;F.prototype.visitTimeMicrosecond=ga;F.prototype.visitTimeNanosecond=_a;F.prototype.visitDecimal=Wu;F.prototype.visitList=Yu;F.prototype.visitStruct=Zu;F.prototype.visitUnion=Qu;F.prototype.visitDenseUnion=wa;F.prototype.visitSparseUnion=va;F.prototype.visitDictionary=Xu;F.prototype.visitInterval=tl;F.prototype.visitIntervalDayTime=Ia;F.prototype.visitIntervalYearMonth=Sa;F.prototype.visitFixedSizeList=el;F.prototype.visitMap=Hu;const cn=new F;class rl extends E{visitNull(){return Vc}visitBool(){return Nc}visitInt(){return Qt}visitInt8(){return qc}visitInt16(){return Kc}visitInt32(){return Jc}visitInt64(){return Gc}visitUint8(){return Zc}visitUint16(){return Qc}visitUint32(){return Xc}visitUint64(){return tu}visitFloat(){return an}visitFloat16(){return $c}visitFloat32(){return Wc}visitFloat64(){return Yc}visitUtf8(){return pi}visitBinary(){return Xs}visitFixedSizeBinary(){return Pc}visitDate(){return fi}visitDateDay(){return Rc}visitDateMillisecond(){return Cc}visitTimestamp(){return fr}visitTimestampSecond(){return su}visitTimestampMillisecond(){return au}visitTimestampMicrosecond(){return ou}visitTimestampNanosecond(){return cu}visitTime(){return hr}visitTimeSecond(){return eu}visitTimeMillisecond(){return ru}visitTimeMicrosecond(){return nu}visitTimeNanosecond(){return iu}visitDecimal(){return kc}visitList(){return Tu}visitStruct(){return Du}visitUnion(){return mi}visitDenseUnion(){return Lu}visitSparseUnion(){return xu}visitDictionary(){return jc}visitInterval(){return di}visitIntervalDayTime(){return uu}visitIntervalYearMonth(){return lu}visitFixedSizeList(){return Fu}visitMap(){return Ou}}const Ba=new rl;Q.new=Aa;function Aa(e){const t=e.type,r=new(Ba.getVisitFn(t)())(e);if(t.children&&t.children.length>0){const n=e.children||[],s={nullValues:e.nullValues},a=Array.isArray(n)?(i,o)=>n[o]||s:({name:i})=>n[i]||s;t.children.forEach((i,o)=>{const{type:c}=i,u=a(i,o);r.children.push(Aa({...u,type:c}))})}return r}Object.keys(l).map(e=>l[e]).filter(e=>typeof e=="number"&&e!==l.NONE).forEach(e=>{const t=Ba.visit(e);t.prototype._setValue=cn.getVisitFn(e)});pi.prototype._setValue=cn.visitBinary;var Re;(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,this}static getRootAsFooter(i,o){return(o||new s).__init(i.readInt32(i.position())+i.position(),i)}version(){let i=this.bb.__offset(this.bb_pos,4);return i?this.bb.readInt16(this.bb_pos+i):p.apache.arrow.flatbuf.MetadataVersion.V1}schema(i){let o=this.bb.__offset(this.bb_pos,6);return o?(i||new p.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos+o),this.bb):null}dictionaries(i,o){let c=this.bb.__offset(this.bb_pos,8);return c?(o||new e.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+c)+i*24,this.bb):null}dictionariesLength(){let i=this.bb.__offset(this.bb_pos,8);return i?this.bb.__vector_len(this.bb_pos+i):0}recordBatches(i,o){let c=this.bb.__offset(this.bb_pos,10);return c?(o||new e.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+c)+i*24,this.bb):null}recordBatchesLength(){let i=this.bb.__offset(this.bb_pos,10);return i?this.bb.__vector_len(this.bb_pos+i):0}static startFooter(i){i.startObject(4)}static addVersion(i,o){i.addFieldInt16(0,o,p.apache.arrow.flatbuf.MetadataVersion.V1)}static addSchema(i,o){i.addFieldOffset(1,o,0)}static addDictionaries(i,o){i.addFieldOffset(2,o,0)}static startDictionariesVector(i,o){i.startVector(24,o,8)}static addRecordBatches(i,o){i.addFieldOffset(3,o,0)}static startRecordBatchesVector(i,o){i.startVector(24,o,8)}static endFooter(i){return i.endObject()}static finishFooterBuffer(i,o){i.finish(o)}static createFooter(i,o,c,u,d){return s.startFooter(i),s.addVersion(i,o),s.addSchema(i,c),s.addDictionaries(i,u),s.addRecordBatches(i,d),s.endFooter(i)}}n.Footer=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(Re||(Re={}));(function(e){(function(t){(function(r){(function(n){class s{constructor(){this.bb=null,this.bb_pos=0}__init(i,o){return this.bb_pos=i,this.bb=o,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 createBlock(i,o,c,u){return i.prep(8,24),i.writeInt64(u),i.pad(4),i.writeInt32(c),i.writeInt64(o),i.offset()}}n.Block=s})(r.flatbuf||(r.flatbuf={}))})(t.arrow||(t.arrow={}))})(e.apache||(e.apache={}))})(Re||(Re={}));var hs=f.Long,nl=f.Builder,il=f.ByteBuffer,sl=Re.apache.arrow.flatbuf.Block,Ut=Re.apache.arrow.flatbuf.Footer;class rr{constructor(t,r=Tt.V4,n,s){this.schema=t,this.version=r,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}static decode(t){t=new il(U(t));const r=Ut.getRootAsFooter(t),n=H.decode(r.schema());return new al(n,r)}static encode(t){const r=new nl,n=H.encode(r,t.schema);Ut.startRecordBatchesVector(r,t.numRecordBatches),[...t.recordBatches()].slice().reverse().forEach(i=>se.encode(r,i));const s=r.endVector();Ut.startDictionariesVector(r,t.numDictionaries),[...t.dictionaryBatches()].slice().reverse().forEach(i=>se.encode(r,i));const a=r.endVector();return Ut.startFooter(r),Ut.addSchema(r,n),Ut.addVersion(r,Tt.V4),Ut.addRecordBatches(r,s),Ut.addDictionaries(r,a),Ut.finishFooterBuffer(r,Ut.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(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 al extends rr{constructor(t,r){super(t,r.version()),this._footer=r}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const r=this._footer.recordBatches(t);if(r)return se.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const r=this._footer.dictionaries(t);if(r)return se.decode(r)}return null}}class se{static decode(t){return new se(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){const{metaDataLength:n}=r,s=new hs(r.offset,0),a=new hs(r.bodyLength,0);return sl.createBlock(t,s,n,a)}constructor(t,r,n){this.metaDataLength=t,this.offset=typeof n=="number"?n:n.low,this.bodyLength=typeof r=="number"?r:r.low}}class qe extends Qo{write(t){if((t=U(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?jn(this.toUint8Array(!0)):this.toUint8Array(!1).then(jn)}toUint8Array(t=!1){return t?Rt(this._values)[0]:(async()=>{let r=[],n=0;for await(const s of this)r.push(s),n+=s.byteLength;return Rt(r,n)[0]})()}}class Hr{constructor(t){t&&(this.source=new ol(gt.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 de{constructor(t){t instanceof de?this.source=t.source:t instanceof qe?this.source=new ce(gt.fromAsyncIterable(t)):zs(t)?this.source=new ce(gt.fromNodeStream(t)):Qn(t)?this.source=new ce(gt.fromDOMStream(t)):Ps(t)?this.source=new ce(gt.fromDOMStream(t.body)):xt(t)?this.source=new ce(gt.fromIterable(t)):ne(t)?this.source=new ce(gt.fromAsyncIterable(t)):Gt(t)&&(this.source=new ce(gt.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 ol{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,r="read"){return this.source.next({cmd:r,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 ce{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}async cancel(t){await this.return(t)}get closed(){return this._closedPromise}async read(t){return(await this.next(t,"read")).value}async peek(t){return(await this.next(t,"peek")).value}async next(t,r="read"){return await this.source.next({cmd:r,size:t})}async throw(t){const r=this.source.throw&&await this.source.throw(t)||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)}async return(t){const r=this.source.return&&await this.source.return(t)||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)}}class fs extends Hr{constructor(t,r){super(),this.position=0,this.buffer=U(t),this.size=typeof r>"u"?this.buffer.byteLength:r}readInt32(t){const{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:r,size:n,position:s}=this;return r&&s<n?(typeof t!="number"&&(t=1/0),this.position=Math.min(n,s+Math.min(n-s,t)),r.subarray(s,this.position)):null}readAt(t,r){const n=this.buffer,s=Math.min(this.size,t+r);return n?n.subarray(t,s):new Uint8Array(r)}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 qr extends de{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=(async()=>{this.size=(await t.stat()).size,delete this._pending})()}async readInt32(t){const{buffer:r,byteOffset:n}=await this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}async seek(t){return this._pending&&await this._pending,this.position=Math.min(t,this.size),t<this.size}async read(t){this._pending&&await this._pending;const{_handle:r,size:n,position:s}=this;if(r&&s<n){typeof t!="number"&&(t=1/0);let a=s,i=0,o=0,c=Math.min(n,a+Math.min(n-a,t)),u=new Uint8Array(Math.max(0,(this.position=c)-a));for(;(a+=o)<c&&(i+=o)<u.byteLength;)({bytesRead:o}=await r.read(u,i,u.byteLength-i,a));return u}return null}async readAt(t,r){this._pending&&await this._pending;const{_handle:n,size:s}=this;if(n&&t+r<s){const a=Math.min(s,t+r),i=new Uint8Array(a-t);return(await n.read(i,0,r,t)).buffer}return new Uint8Array(r)}async close(){const t=this._handle;this._handle=null,t&&await t.close()}async throw(t){return await this.close(),{done:!0,value:t}}async return(t){return await this.close(),{done:!0,value:t}}}const cl=65536;function Ie(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const Ce=8,wi=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Ta{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let s=r[3]*n[3];this.buffer[0]=s&65535;let a=s>>>16;return s=r[2]*n[3],a+=s,s=r[3]*n[2]>>>0,a+=s,this.buffer[0]+=a<<16,this.buffer[1]=a>>>0<s?cl:0,this.buffer[1]+=a>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){const r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}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 W extends Ta{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return W.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return W.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){const n=t.length;let s=new W(r);for(let a=0;a<n;){const i=Ce<n-a?Ce:n-a,o=new W(new Uint32Array([parseInt(t.substr(a,i),10),0])),c=new W(new Uint32Array([wi[i],0]));s.times(c),s.plus(o),a+=i}return s}static convertArray(t){const r=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)W.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new W(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new W(new Uint32Array(t.buffer)).plus(r)}}class ht extends Ta{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 r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return ht.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return ht.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){const n=t.startsWith("-"),s=t.length;let a=new ht(r);for(let i=n?1:0;i<s;){const o=Ce<s-i?Ce:s-i,c=new ht(new Uint32Array([parseInt(t.substr(i,o),10),0])),u=new ht(new Uint32Array([wi[o],0]));a.times(u),a.plus(c),i+=o}return n?a.negate():a}static convertArray(t){const r=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)ht.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new ht(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new ht(new Uint32Array(t.buffer)).plus(r)}}class Nt{constructor(t){this.buffer=t}high(){return new ht(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ht(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 r=new W(new Uint32Array([this.buffer[3],0])),n=new W(new Uint32Array([this.buffer[2],0])),s=new W(new Uint32Array([this.buffer[1],0])),a=new W(new Uint32Array([this.buffer[0],0])),i=new W(new Uint32Array([t.buffer[3],0])),o=new W(new Uint32Array([t.buffer[2],0])),c=new W(new Uint32Array([t.buffer[1],0])),u=new W(new Uint32Array([t.buffer[0],0]));let d=W.multiply(a,u);this.buffer[0]=d.low();let b=new W(new Uint32Array([d.high(),0]));return d=W.multiply(s,u),b.plus(d),d=W.multiply(a,c),b.plus(d),this.buffer[1]=b.low(),this.buffer[3]=b.lessThan(d)?1:0,this.buffer[2]=b.high(),new W(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(W.multiply(n,u)).plus(W.multiply(s,c)).plus(W.multiply(a,o)),this.buffer[3]+=W.multiply(r,u).plus(W.multiply(n,c)).plus(W.multiply(s,o)).plus(W.multiply(a,i)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Ie(this.buffer[3])} ${Ie(this.buffer[2])} ${Ie(this.buffer[1])} ${Ie(this.buffer[0])}`}static multiply(t,r){return new Nt(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new Nt(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return Nt.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return Nt.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){const n=t.startsWith("-"),s=t.length;let a=new Nt(r);for(let i=n?1:0;i<s;){const o=Ce<s-i?Ce:s-i,c=new Nt(new Uint32Array([parseInt(t.substr(i,o),10),0,0,0])),u=new Nt(new Uint32Array([wi[o],0,0,0]));a.times(u),a.plus(c),i+=o}return n?a.negate():a}static convertArray(t){const r=new Uint32Array(t.length*4);for(let n=-1,s=t.length;++n<s;)Nt.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}}class Fa extends E{constructor(t,r,n,s){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=s}visit(t){return super.visit(t instanceof V?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return m.Null(t,0,r)}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Bool(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Int(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Float(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Utf8(t,0,r,n,this.readNullBitmap(t,n),this.readOffsets(t),this.readData(t))}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Binary(t,0,r,n,this.readNullBitmap(t,n),this.readOffsets(t),this.readData(t))}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.FixedSizeBinary(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Date(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Timestamp(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Time(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Decimal(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.List(t,0,r,n,this.readNullBitmap(t,n),this.readOffsets(t),this.visit(t.children[0]))}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Struct(t,0,r,n,this.readNullBitmap(t,n),this.visitMany(t.children))}visitUnion(t){return t.mode===Jt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Union(t,0,r,n,this.readNullBitmap(t,n),this.readTypeIds(t),this.readOffsets(t),this.visitMany(t.children))}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Union(t,0,r,n,this.readNullBitmap(t,n),this.readTypeIds(t),this.visitMany(t.children))}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Dictionary(t,0,r,n,this.readNullBitmap(t,n),this.readData(t.indices),this.readDictionary(t))}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Interval(t,0,r,n,this.readNullBitmap(t,n),this.readData(t))}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.FixedSizeList(t,0,r,n,this.readNullBitmap(t,n),this.visit(t.children[0]))}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return m.Map(t,0,r,n,this.readNullBitmap(t,n),this.readOffsets(t),this.visit(t.children[0]))}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}}class ul extends Fa{constructor(t,r,n,s){super(new Uint8Array(0),r,n,s),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Cr(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return z(Uint8Array,z(Int32Array,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return z(Uint8Array,z(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){const{sources:n}=this;return L.isTimestamp(t)||(L.isInt(t)||L.isTime(t))&&t.bitWidth===64||L.isDate(t)&&t.unit===Ct.MILLISECOND?z(Uint8Array,ht.convertArray(n[r])):L.isDecimal(t)?z(Uint8Array,Nt.convertArray(n[r])):L.isBinary(t)||L.isFixedSizeBinary(t)?ll(n[r]):L.isBool(t)?Cr(n[r]):L.isUtf8(t)?Xr(n[r].join("")):z(Uint8Array,z(t.ArrayType,n[r].map(s=>+s)))}}function ll(e){const t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=parseInt(t.substr(n,2),16);return r}var hl=f.Long,ds=p.apache.arrow.flatbuf.Null,vr=p.apache.arrow.flatbuf.Int,xn=p.apache.arrow.flatbuf.FloatingPoint,ps=p.apache.arrow.flatbuf.Binary,ys=p.apache.arrow.flatbuf.Bool,bs=p.apache.arrow.flatbuf.Utf8,Ir=p.apache.arrow.flatbuf.Decimal,Ln=p.apache.arrow.flatbuf.Date,Sr=p.apache.arrow.flatbuf.Time,Br=p.apache.arrow.flatbuf.Timestamp,Mn=p.apache.arrow.flatbuf.Interval,ms=p.apache.arrow.flatbuf.List,gs=p.apache.arrow.flatbuf.Struct_,we=p.apache.arrow.flatbuf.Union,$e=p.apache.arrow.flatbuf.DictionaryEncoding,En=p.apache.arrow.flatbuf.FixedSizeBinary,Un=p.apache.arrow.flatbuf.FixedSizeList,Nn=p.apache.arrow.flatbuf.Map;class fl extends E{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return ds.startNull(r),ds.endNull(r)}visitInt(t,r){return vr.startInt(r),vr.addBitWidth(r,t.bitWidth),vr.addIsSigned(r,t.isSigned),vr.endInt(r)}visitFloat(t,r){return xn.startFloatingPoint(r),xn.addPrecision(r,t.precision),xn.endFloatingPoint(r)}visitBinary(t,r){return ps.startBinary(r),ps.endBinary(r)}visitBool(t,r){return ys.startBool(r),ys.endBool(r)}visitUtf8(t,r){return bs.startUtf8(r),bs.endUtf8(r)}visitDecimal(t,r){return Ir.startDecimal(r),Ir.addScale(r,t.scale),Ir.addPrecision(r,t.precision),Ir.endDecimal(r)}visitDate(t,r){return Ln.startDate(r),Ln.addUnit(r,t.unit),Ln.endDate(r)}visitTime(t,r){return Sr.startTime(r),Sr.addUnit(r,t.unit),Sr.addBitWidth(r,t.bitWidth),Sr.endTime(r)}visitTimestamp(t,r){const n=t.timezone&&r.createString(t.timezone)||void 0;return Br.startTimestamp(r),Br.addUnit(r,t.unit),n!==void 0&&Br.addTimezone(r,n),Br.endTimestamp(r)}visitInterval(t,r){return Mn.startInterval(r),Mn.addUnit(r,t.unit),Mn.endInterval(r)}visitList(t,r){return ms.startList(r),ms.endList(r)}visitStruct(t,r){return gs.startStruct_(r),gs.endStruct_(r)}visitUnion(t,r){we.startTypeIdsVector(r,t.typeIds.length);const n=we.createTypeIdsVector(r,t.typeIds);return we.startUnion(r),we.addMode(r,t.mode),we.addTypeIds(r,n),we.endUnion(r)}visitDictionary(t,r){const n=this.visit(t.indices,r);return $e.startDictionaryEncoding(r),$e.addId(r,new hl(t.id,0)),$e.addIsOrdered(r,t.isOrdered),n!==void 0&&$e.addIndexType(r,n),$e.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return En.startFixedSizeBinary(r),En.addByteWidth(r,t.byteWidth),En.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return Un.startFixedSizeList(r),Un.addListSize(r,t.listSize),Un.endFixedSizeList(r)}visitMap(t,r){return Nn.startMap(r),Nn.addKeysSorted(r,t.keysSorted),Nn.endMap(r)}}const Vn=new fl;function dl(e,t=new Map){return new H(yl(e,t),Fr(e.customMetadata),t)}function Oa(e){return new vt(e.count,Da(e.columns),xa(e.columns))}function pl(e){return new kt(Oa(e.data),e.id,e.isDelta)}function yl(e,t){return(e.fields||[]).filter(Boolean).map(r=>V.fromJSON(r,t))}function _s(e,t){return(e.children||[]).filter(Boolean).map(r=>V.fromJSON(r,t))}function Da(e){return(e||[]).reduce((t,r)=>[...t,new ge(r.count,bl(r.VALIDITY)),...Da(r.children)],[])}function xa(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){const s=e[r];s.VALIDITY&&t.push(new Vt(t.length,s.VALIDITY.length)),s.TYPE&&t.push(new Vt(t.length,s.TYPE.length)),s.OFFSET&&t.push(new Vt(t.length,s.OFFSET.length)),s.DATA&&t.push(new Vt(t.length,s.DATA.length)),t=xa(s.children,t)}return t}function bl(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function ml(e,t){let r,n,s,a,i,o;return!t||!(a=e.dictionary)?(i=vs(e,_s(e,t)),s=new V(e.name,i,e.nullable,Fr(e.customMetadata))):t.has(r=a.id)?(n=(n=a.indexType)?ws(n):new he,o=new ie(t.get(r),n,r,a.isOrdered),s=new V(e.name,o,e.nullable,Fr(e.customMetadata))):(n=(n=a.indexType)?ws(n):new he,t.set(r,i=vs(e,_s(e,t))),o=new ie(i,n,r,a.isOrdered),s=new V(e.name,o,e.nullable,Fr(e.customMetadata))),s||null}function Fr(e){return new Map(Object.entries(e||{}))}function ws(e){return new dt(e.isSigned,e.bitWidth)}function vs(e,t){const r=e.type.name;switch(r){case"NONE":return new Le;case"null":return new Le;case"binary":return new Ge;case"utf8":return new Ue;case"bool":return new Ze;case"list":return new Ve((t||[])[0]);case"struct":return new Lt(t||[]);case"struct_":return new Lt(t||[])}switch(r){case"int":{const n=e.type;return new dt(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=e.type;return new fe(St[n.precision])}case"decimal":{const n=e.type;return new kr(n.scale,n.precision)}case"date":{const n=e.type;return new Ne(Ct[n.unit])}case"time":{const n=e.type;return new jr(Y[n.unit],n.bitWidth)}case"timestamp":{const n=e.type;return new Pr(Y[n.unit],n.timezone)}case"interval":{const n=e.type;return new zr(xe[n.unit])}case"union":{const n=e.type;return new Qe(Jt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=e.type;return new $r(n.byteWidth)}case"fixedsizelist":{const n=e.type;return new Xe(n.listSize,(t||[])[0])}case"map":{const n=e.type;return new tr((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var pe=f.Long,gl=f.Builder,_l=f.ByteBuffer,nt=p.apache.arrow.flatbuf.Type,At=p.apache.arrow.flatbuf.Field,Ht=p.apache.arrow.flatbuf.Schema,wl=p.apache.arrow.flatbuf.Buffer,Xt=at.apache.arrow.flatbuf.Message,ee=p.apache.arrow.flatbuf.KeyValue,vl=at.apache.arrow.flatbuf.FieldNode,Is=p.apache.arrow.flatbuf.Endianness,te=at.apache.arrow.flatbuf.RecordBatch,ve=at.apache.arrow.flatbuf.DictionaryBatch;class ct{constructor(t,r,n,s){this._version=r,this._headerType=n,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=typeof t=="number"?t:t.low}static fromJSON(t,r){const n=new ct(0,Tt.V4,r);return n._createHeader=Il(t,r),n}static decode(t){t=new _l(U(t));const r=Xt.getRootAsMessage(t),n=r.bodyLength(),s=r.version(),a=r.headerType(),i=new ct(n,s,a);return i._createHeader=Sl(r,a),i}static encode(t){let r=new gl,n=-1;return t.isSchema()?n=H.encode(r,t.header()):t.isRecordBatch()?n=vt.encode(r,t.header()):t.isDictionaryBatch()&&(n=kt.encode(r,t.header())),Xt.startMessage(r),Xt.addVersion(r,Tt.V4),Xt.addHeader(r,n),Xt.addHeaderType(r,t.headerType),Xt.addBodyLength(r,new pe(t.bodyLength,0)),Xt.finishMessageBuffer(r,Xt.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof H)return new ct(0,Tt.V4,q.Schema,t);if(t instanceof vt)return new ct(r,Tt.V4,q.RecordBatch,t);if(t instanceof kt)return new ct(r,Tt.V4,q.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===q.Schema}isRecordBatch(){return this.headerType===q.RecordBatch}isDictionaryBatch(){return this.headerType===q.DictionaryBatch}}let vt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=typeof t=="number"?t:t.low}};class kt{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=typeof r=="number"?r:r.low}}class Vt{constructor(t,r){this.offset=typeof t=="number"?t:t.low,this.length=typeof r=="number"?r:r.low}}class ge{constructor(t,r){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof r=="number"?r:r.low}}function Il(e,t){return()=>{switch(t){case q.Schema:return H.fromJSON(e);case q.RecordBatch:return vt.fromJSON(e);case q.DictionaryBatch:return kt.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${q[t]}, type: ${t} }`)}}function Sl(e,t){return()=>{switch(t){case q.Schema:return H.decode(e.header(new Ht));case q.RecordBatch:return vt.decode(e.header(new te),e.version());case q.DictionaryBatch:return kt.decode(e.header(new ve),e.version())}throw new Error(`Unrecognized Message type: { name: ${q[t]}, type: ${t} }`)}}V.encode=Ul;V.decode=Ml;V.fromJSON=ml;H.encode=El;H.decode=Bl;H.fromJSON=dl;vt.encode=Nl;vt.decode=Al;vt.fromJSON=Oa;kt.encode=Vl;kt.decode=Tl;kt.fromJSON=pl;ge.encode=Rl;ge.decode=Ol;Vt.encode=Cl;Vt.decode=Fl;function Bl(e,t=new Map){const r=Ll(e,t);return new H(r,Or(e),t)}function Al(e,t=Tt.V4){return new vt(e.length(),Dl(e),xl(e,t))}function Tl(e,t=Tt.V4){return new kt(vt.decode(e.data(),t),e.id(),e.isDelta())}function Fl(e){return new Vt(e.offset(),e.length())}function Ol(e){return new ge(e.length(),e.nullCount())}function Dl(e){const t=[];for(let r,n=-1,s=-1,a=e.nodesLength();++n<a;)(r=e.nodes(n))&&(t[++s]=ge.decode(r));return t}function xl(e,t){const r=[];for(let n,s=-1,a=-1,i=e.buffersLength();++s<i;)(n=e.buffers(s))&&(t<Tt.V4&&(n.bb_pos+=8*(s+1)),r[++a]=Vt.decode(n));return r}function Ll(e,t){const r=[];for(let n,s=-1,a=-1,i=e.fieldsLength();++s<i;)(n=e.fields(s))&&(r[++a]=V.decode(n,t));return r}function Ss(e,t){const r=[];for(let n,s=-1,a=-1,i=e.childrenLength();++s<i;)(n=e.children(s))&&(r[++a]=V.decode(n,t));return r}function Ml(e,t){let r,n,s,a,i,o;return!t||!(o=e.dictionary())?(s=As(e,Ss(e,t)),n=new V(e.name(),s,e.nullable(),Or(e))):t.has(r=o.id().low)?(a=(a=o.indexType())?Bs(a):new he,i=new ie(t.get(r),a,r,o.isOrdered()),n=new V(e.name(),i,e.nullable(),Or(e))):(a=(a=o.indexType())?Bs(a):new he,t.set(r,s=As(e,Ss(e,t))),i=new ie(s,a,r,o.isOrdered()),n=new V(e.name(),i,e.nullable(),Or(e))),n||null}function Or(e){const t=new Map;if(e)for(let r,n,s=-1,a=e.customMetadataLength()|0;++s<a;)(r=e.customMetadata(s))&&(n=r.key())!=null&&t.set(n,r.value());return t}function Bs(e){return new dt(e.isSigned(),e.bitWidth())}function As(e,t){const r=e.typeType();switch(r){case nt.NONE:return new Le;case nt.Null:return new Le;case nt.Binary:return new Ge;case nt.Utf8:return new Ue;case nt.Bool:return new Ze;case nt.List:return new Ve((t||[])[0]);case nt.Struct_:return new Lt(t||[])}switch(r){case nt.Int:{const n=e.type(new p.apache.arrow.flatbuf.Int);return new dt(n.isSigned(),n.bitWidth())}case nt.FloatingPoint:{const n=e.type(new p.apache.arrow.flatbuf.FloatingPoint);return new fe(n.precision())}case nt.Decimal:{const n=e.type(new p.apache.arrow.flatbuf.Decimal);return new kr(n.scale(),n.precision())}case nt.Date:{const n=e.type(new p.apache.arrow.flatbuf.Date);return new Ne(n.unit())}case nt.Time:{const n=e.type(new p.apache.arrow.flatbuf.Time);return new jr(n.unit(),n.bitWidth())}case nt.Timestamp:{const n=e.type(new p.apache.arrow.flatbuf.Timestamp);return new Pr(n.unit(),n.timezone())}case nt.Interval:{const n=e.type(new p.apache.arrow.flatbuf.Interval);return new zr(n.unit())}case nt.Union:{const n=e.type(new p.apache.arrow.flatbuf.Union);return new Qe(n.mode(),n.typeIdsArray()||[],t||[])}case nt.FixedSizeBinary:{const n=e.type(new p.apache.arrow.flatbuf.FixedSizeBinary);return new $r(n.byteWidth())}case nt.FixedSizeList:{const n=e.type(new p.apache.arrow.flatbuf.FixedSizeList);return new Xe(n.listSize(),(t||[])[0])}case nt.Map:{const n=e.type(new p.apache.arrow.flatbuf.Map);return new tr((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${nt[r]}" (${r})`)}function El(e,t){const r=t.fields.map(a=>V.encode(e,a));Ht.startFieldsVector(e,r.length);const n=Ht.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?Ht.createCustomMetadataVector(e,[...t.metadata].map(([a,i])=>{const o=e.createString(`${a}`),c=e.createString(`${i}`);return ee.startKeyValue(e),ee.addKey(e,o),ee.addValue(e,c),ee.endKeyValue(e)})):-1;return Ht.startSchema(e),Ht.addFields(e,n),Ht.addEndianness(e,kl?Is.Little:Is.Big),s!==-1&&Ht.addCustomMetadata(e,s),Ht.endSchema(e)}function Ul(e,t){let r=-1,n=-1,s=-1,a=t.type,i=t.typeId;L.isDictionary(a)?(i=a.dictionary.typeId,s=Vn.visit(a,e),n=Vn.visit(a.dictionary,e)):n=Vn.visit(a,e);const o=(a.children||[]).map(d=>V.encode(e,d)),c=At.createChildrenVector(e,o),u=t.metadata&&t.metadata.size>0?At.createCustomMetadataVector(e,[...t.metadata].map(([d,b])=>{const _=e.createString(`${d}`),v=e.createString(`${b}`);return ee.startKeyValue(e),ee.addKey(e,_),ee.addValue(e,v),ee.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),At.startField(e),At.addType(e,n),At.addTypeType(e,i),At.addChildren(e,c),At.addNullable(e,!!t.nullable),r!==-1&&At.addName(e,r),s!==-1&&At.addDictionary(e,s),u!==-1&&At.addCustomMetadata(e,u),At.endField(e)}function Nl(e,t){const r=t.nodes||[],n=t.buffers||[];te.startNodesVector(e,r.length),r.slice().reverse().forEach(i=>ge.encode(e,i));const s=e.endVector();te.startBuffersVector(e,n.length),n.slice().reverse().forEach(i=>Vt.encode(e,i));const a=e.endVector();return te.startRecordBatch(e),te.addLength(e,new pe(t.length,0)),te.addNodes(e,s),te.addBuffers(e,a),te.endRecordBatch(e)}function Vl(e,t){const r=vt.encode(e,t.data);return ve.startDictionaryBatch(e),ve.addId(e,new pe(t.id,0)),ve.addIsDelta(e,t.isDelta),ve.addData(e,r),ve.endDictionaryBatch(e)}function Rl(e,t){return vl.createFieldNode(e,new pe(t.length,0),new pe(t.nullCount,0))}function Cl(e,t){return wl.createBuffer(e,new pe(t.offset,0),new pe(t.length,0))}const kl=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256}();var La=f.ByteBuffer;const vi=e=>`Expected ${q[e]} Message in stream, but was null or length 0.`,Ii=e=>`Header pointer of flatbuffer-encoded ${q[e]} Message is null or length 0.`,Ma=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Ea=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;class Ua{constructor(t){this.source=t instanceof Hr?t:new Hr(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 r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(vi(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const r=U(this.source.read(t));if(r.byteLength<t)throw new Error(Ea(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){const r=q.Schema,n=this.readMessage(r),s=n&&n.header();if(t&&!s)throw new Error(Ii(r));return s}readMetadataLength(){const t=this.source.read(un),r=t&&new La(t),n=r&&r.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){const r=this.source.read(t);if(!r)return Z;if(r.byteLength<t)throw new Error(Ma(t,r.byteLength));return{done:!1,value:ct.decode(r)}}}class jl{constructor(t,r){this.source=t instanceof de?t:js(t)?new qr(t,r):new de(t)}[Symbol.asyncIterator](){return this}async next(){let t;return(t=await this.readMetadataLength()).done||t.value===-1&&(t=await this.readMetadataLength()).done||(t=await this.readMetadata(t.value)).done?Z:t}async throw(t){return await this.source.throw(t)}async return(t){return await this.source.return(t)}async readMessage(t){let r;if((r=await this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(vi(t));return r.value}async readMessageBody(t){if(t<=0)return new Uint8Array(0);const r=U(await this.source.read(t));if(r.byteLength<t)throw new Error(Ea(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}async readSchema(t=!1){const r=q.Schema,n=await this.readMessage(r),s=n&&n.header();if(t&&!s)throw new Error(Ii(r));return s}async readMetadataLength(){const t=await this.source.read(un),r=t&&new La(t),n=r&&r.readInt32(0)||0;return{done:n===0,value:n}}async readMetadata(t){const r=await this.source.read(t);if(!r)return Z;if(r.byteLength<t)throw new Error(Ma(t,r.byteLength));return{done:!1,value:ct.decode(r)}}}class Pl extends Ua{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ss?t:new ss(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ct.fromJSON(t.schema,q.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:ct.fromJSON(r,q.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:ct.fromJSON(r,q.RecordBatch)}}return this._body=[],Z}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((s,a)=>[...s,...a.VALIDITY&&[a.VALIDITY]||[],...a.TYPE&&[a.TYPE]||[],...a.OFFSET&&[a.OFFSET]||[],...a.DATA&&[a.DATA]||[],...r(a.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(vi(t));return r.value}readSchema(){const t=q.Schema,r=this.readMessage(t),n=r&&r.header();if(!r||!n)throw new Error(Ii(t));return n}}const un=4,qn="ARROW1",nr=new Uint8Array(qn.length);for(let e=0;e<qn.length;e+=1)nr[e]=qn.charCodeAt(e);function Si(e,t=0){for(let r=-1,n=nr.length;++r<n;)if(nr[r]!==e[t+r])return!1;return!0}const dr=nr.length,Na=dr+un,zl=dr*2+un;class tt extends E{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){const r=new tt,n=Bu(ft,t),[s=r]=r.visitMany(n);return s}visit(t){if(!L.isDictionary(t.type)){const{data:r,length:n,nullCount:s}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");L.isNull(t.type)||Ot.call(this,s<=0?new Uint8Array(0):ei(r.offset,n,r.nullBitmap)),this.nodes.push(new ge(n,s))}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.indices)}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function Ot(e){const t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Vt(this._byteLength,t)),this._byteLength+=t,this}function $l(e){const{type:t,length:r,typeIds:n,valueOffsets:s}=e;if(Ot.call(this,n),t.mode===Jt.Sparse)return Kn.call(this,e);if(t.mode===Jt.Dense){if(e.offset<=0)return Ot.call(this,s),Kn.call(this,e);{const a=n.reduce((d,b)=>Math.max(d,b),n[0]),i=new Int32Array(a+1),o=new Int32Array(a+1).fill(-1),c=new Int32Array(r),u=ti(-s[0],r,s);for(let d,b,_=-1;++_<r;)(b=o[d=n[_]])===-1&&(b=o[d]=u[d]),c[_]=u[_]-b,++i[d];Ot.call(this,c);for(let d,b=-1,_=t.children.length;++b<_;)if(d=e.getChildAt(b)){const v=t.typeIds[b],C=Math.min(r,i[v]);this.visit(d.slice(o[v],C))}}}return this}function Wl(e){let t;return e.nullCount>=e.length?Ot.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ot.call(this,ei(e.offset,e.length,t)):Ot.call(this,Cr(e))}function oe(e){return Ot.call(this,e.values.subarray(0,e.length*e.stride))}function Va(e){const{length:t,values:r,valueOffsets:n}=e,s=n[0],a=n[t],i=Math.min(a-s,r.byteLength-s);return Ot.call(this,ti(-n[0],t,n)),Ot.call(this,r.subarray(s,s+i)),this}function Bi(e){const{length:t,valueOffsets:r}=e;return r&&Ot.call(this,ti(r[0],t,r)),this.visit(e.getChildAt(0))}function Kn(e){return this.visitMany(e.type.children.map((t,r)=>e.getChildAt(r)).filter(Boolean))[0]}tt.prototype.visitBool=Wl;tt.prototype.visitInt=oe;tt.prototype.visitFloat=oe;tt.prototype.visitUtf8=Va;tt.prototype.visitBinary=Va;tt.prototype.visitFixedSizeBinary=oe;tt.prototype.visitDate=oe;tt.prototype.visitTimestamp=oe;tt.prototype.visitTime=oe;tt.prototype.visitDecimal=oe;tt.prototype.visitList=Bi;tt.prototype.visitStruct=Kn;tt.prototype.visitUnion=$l;tt.prototype.visitInterval=oe;tt.prototype.visitFixedSizeList=Bi;tt.prototype.visitMap=Bi;class Ai extends me{constructor(t){super(),this._position=0,this._started=!1,this._sink=new qe,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,wt(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,r){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 ne(t)?t.then(r=>this.writeAll(r)):Gt(t)?Di(this,t):Oi(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,r=null){return t===this._sink||t instanceof qe?this._sink=t:(this._sink=new qe,t&&ec(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&rc(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,(!r||!r.compareTo(this._schema))&&(r===null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof k&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof ft&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!r.compareTo(this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof ft?t instanceof dn||this._writeRecordBatch(t):t instanceof k?this.writeAll(t.chunks):xt(t)&&this.writeAll(t)}_writeMessage(t,r=8){const n=r-1,s=ct.encode(t),a=s.byteLength,i=this._writeLegacyIpcFormat?4:8,o=a+i+n&~n,c=o-a-i;return t.headerType===q.RecordBatch?this._recordBatchBlocks.push(new se(o,t.bodyLength,this._position)):t.headerType===q.DictionaryBatch&&this._dictionaryBlocks.push(new se(o,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-i)),a>0&&this._write(s),this._writePadding(c)}_write(t){if(this._started){const r=U(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(ct.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(nr)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:r,nodes:n,bufferRegions:s,buffers:a}=tt.assemble(t),i=new vt(t.length,n,s),o=ct.from(i,r);return this._writeDictionaries(t)._writeMessage(o)._writeBodyBuffers(a)}_writeDictionaryBatch(t,r,n=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));const{byteLength:s,nodes:a,bufferRegions:i,buffers:o}=tt.assemble(t),c=new vt(t.length,a,i),u=new kt(c,r,n),d=ct.from(u,s);return this._writeMessage(d)._writeBodyBuffers(o)}_writeBodyBuffers(t){let r,n,s;for(let a=-1,i=t.length;++a<i;)(r=t[a])&&(n=r.byteLength)>0&&(this._write(r),(s=(n+7&-8)-n)>0&&this._writePadding(s));return this}_writeDictionaries(t){for(let[r,n]of t.dictionaries){let s=this._dictionaryDeltaOffsets.get(r)||0;if(s===0||(n=n.slice(s)).length>0){const a="chunks"in n?n.chunks:[n];for(const i of a)this._writeDictionaryBatch(i,r,s>0),s+=i.length}}return this}}class Ti extends Ai{static writeAll(t,r){const n=new Ti(r);return ne(t)?t.then(s=>n.writeAll(s)):Gt(t)?Di(n,t):Oi(n,t)}}class Fi extends Ai{constructor(){super(),this._autoDestroy=!0}static writeAll(t){const r=new Fi;return ne(t)?t.then(n=>r.writeAll(n)):Gt(t)?Di(r,t):Oi(r,t)}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const r=rr.encode(new rr(t,Tt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}}function Oi(e,t){let r=t;t instanceof k&&(r=t.chunks,e.reset(void 0,t.schema));for(const n of r)e.write(n);return e.finish()}async function Di(e,t){for await(const r of t)e.write(r);return e.finish()}const Rn=new Uint8Array(0),Ra=e=>[Rn,Rn,new Uint8Array(e),Rn];function Yl(e,t,r=t.reduce((n,s)=>Math.max(n,s.length),0)){let n,s,a=-1,i=t.length;const o=[...e.fields],c=[],u=(r+63&-64)>>3;for(;++a<i;)(n=t[a])&&n.length===r?c[a]=n:((s=o[a]).nullable||(o[a]=o[a].clone({nullable:!0})),c[a]=n?n._changeLengthAndBackfillNullBitmap(r):m.new(s.type,0,r,r,Ra(u)));return[new H(o),r,c]}function Hl(e){return Ca(new H(e.map(({field:t})=>t)),e)}function Ca(e,t){return ql(e,t.map(r=>r instanceof st?r.chunks.map(n=>n.data):[r.data]))}function ql(e,t){const r=[...e.fields],n=[],s={numBatches:t.reduce((b,_)=>Math.max(b,_.length),0)};let a=0,i=0,o=-1,c=t.length,u,d=[];for(;s.numBatches-- >0;){for(i=Number.POSITIVE_INFINITY,o=-1;++o<c;)d[o]=u=t[o].shift(),i=Math.min(i,u?u.length:i);isFinite(i)&&(d=Kl(r,i,d,t,s),i>0&&(n[a++]=[i,d.slice()]))}return[e=new H(r,e.metadata),n.map(b=>new ft(e,...b))]}function Kl(e,t,r,n,s){let a,i,o=0,c=-1,u=n.length;const d=(t+63&-64)>>3;for(;++c<u;)(a=r[c])&&(o=a.length)>=t?o===t?r[c]=a:(r[c]=a.slice(0,t),a=a.slice(t,o-t),s.numBatches=Math.max(s.numBatches,n[c].unshift(a))):((i=e[c]).nullable||(e[c]=i.clone({nullable:!0})),r[c]=a?a._changeLengthAndBackfillNullBitmap(t):m.new(i.type,0,t,t,Ra(d)));return r}class K extends N{constructor(t,r){super(),this._children=r,this.numChildren=t.childData.length,this._bindDataAccessors(this.data=t)}get type(){return this.data.type}get typeId(){return this.data.typeId}get length(){return this.data.length}get offset(){return this.data.offset}get stride(){return this.data.stride}get nullCount(){return this.data.nullCount}get byteLength(){return this.data.byteLength}get VectorName(){return`${l[this.typeId]}Vector`}get ArrayType(){return this.type.ArrayType}get values(){return this.data.values}get typeIds(){return this.data.typeIds}get nullBitmap(){return this.data.nullBitmap}get valueOffsets(){return this.data.valueOffsets}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}clone(t,r=this._children){return N.new(t,r)}concat(...t){return st.concat(this,...t)}slice(t,r){return ia(this,t,r,this._sliceInternal)}isValid(t){if(this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}getChildAt(t){return t<0||t>=this.numChildren?null:(this._children||(this._children=[]))[t]||(this._children[t]=N.new(this.data.childData[t]))}toJSON(){return[...this]}_sliceInternal(t,r,n){return t.clone(t.data.slice(r,n-r),null)}_bindDataAccessors(t){}}K.prototype[Symbol.isConcatSpreadable]=!0;class Jl extends K{asUtf8(){return N.new(this.data.clone(new Ue))}}class Gl extends K{static from(t){return ye(()=>new Ze,t)}}class xi extends K{static from(...t){return t.length===2?ye(()=>t[1]===Ct.DAY?new Tc:new as,t[0]):ye(()=>new as,t[0])}}class Zl extends xi{}class Ql extends xi{}class Xl extends K{}class Li extends K{constructor(t){super(t),this.indices=N.new(t.clone(this.type.indices))}static from(...t){if(t.length===3){const[r,n,s]=t,a=new ie(r.type,n,null,null);return N.new(m.Dictionary(a,0,s.length,0,null,s,r))}return ye(()=>t[0].type,t[0])}get dictionary(){return this.data.dictionary}reverseLookup(t){return this.dictionary.indexOf(t)}getKey(t){return this.indices.get(t)}getValue(t){return this.dictionary.get(t)}setKey(t,r){return this.indices.set(t,r)}setValue(t,r){return this.dictionary.set(t,r)}}Li.prototype.indices=null;class th extends K{}class eh extends K{}class ln extends K{static from(t){let r=ih(this);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){let n=nh(t.constructor)||r;if(r===null&&(r=n),r&&r===n){let s=new r,a=t.byteLength/s.ArrayType.BYTES_PER_ELEMENT;if(!rh(r,t.constructor))return N.new(m.Float(s,0,a,0,null,t))}}if(r)return ye(()=>new r,t);throw t instanceof DataView||t instanceof ArrayBuffer?new TypeError(`Cannot infer float type from instance of ${t.constructor.name}`):new TypeError("Unrecognized FloatVector input")}}class ka extends ln{toFloat32Array(){return new Float32Array(this)}toFloat64Array(){return new Float64Array(this)}}class ja extends ln{}class Pa extends ln{}const rh=(e,t)=>e===nn&&t!==Uint16Array,nh=e=>{switch(e){case Uint16Array:return nn;case Float32Array:return li;case Float64Array:return hi;default:return null}},ih=e=>{switch(e){case ka:return nn;case ja:return li;case Pa:return hi;default:return null}};class Mi extends K{}class sh extends Mi{}class ah extends Mi{}class Et extends K{static from(...t){let[r,n=!1]=t,s=uh(this,n);if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)){let a=ch(r.constructor,n)||s;if(s===null&&(s=a),s&&s===a){let i=new s,o=r.byteLength/i.ArrayType.BYTES_PER_ELEMENT;return oh(s,r.constructor)&&(o*=.5),N.new(m.Int(i,0,o,0,null,r))}}if(s)return ye(()=>new s,r);throw r instanceof DataView||r instanceof ArrayBuffer?new TypeError(`Cannot infer integer type from instance of ${r.constructor.name}`):new TypeError("Unrecognized IntVector input")}}class za extends Et{}class $a extends Et{}class Wa extends Et{}class Ya extends Et{toBigInt64Array(){return sc(this.values)}get values64(){return this._values64||(this._values64=this.toBigInt64Array())}}class Ha extends Et{}class qa extends Et{}class Ka extends Et{}class Ja extends Et{toBigUint64Array(){return ac(this.values)}get values64(){return this._values64||(this._values64=this.toBigUint64Array())}}const oh=(e,t)=>(e===Me||e===Ee)&&(t===Int32Array||t===Uint32Array),ch=(e,t)=>{switch(e){case Int8Array:return si;case Int16Array:return ai;case Int32Array:return t?Me:he;case ke:return Me;case Uint8Array:return oi;case Uint16Array:return ci;case Uint32Array:return t?Ee:ui;case sr:return Ee;default:return null}},uh=(e,t)=>{switch(e){case za:return si;case $a:return ai;case Wa:return t?Me:he;case Ya:return Me;case Ha:return oi;case qa:return ci;case Ka:return t?Ee:ui;case Ja:return Ee;default:return null}};class lh extends K{}class hh extends K{asList(){const t=this.type.children[0];return N.new(this.data.clone(new Ve(t)))}bind(t){const r=this.getChildAt(0),{[t]:n,[t+1]:s}=this.valueOffsets;return new ea(r.slice(n,s))}}class fh extends K{}const dh=Symbol.for("rowIndex");class hn extends K{bind(t){const r=this._row||(this._row=new ra(this)),n=Object.create(r);return n[dh]=t,n}}class pr extends K{}class ph extends pr{}class yh extends pr{}class bh extends pr{}class mh extends pr{}class yr extends K{}class gh extends yr{}class _h extends yr{}class wh extends yr{}class vh extends yr{}class Ei extends K{get typeIdToChildIndex(){return this.data.type.typeIdToChildIndex}}class Ih extends Ei{get valueOffsets(){return this.data.valueOffsets}}class Sh extends Ei{}class Bh extends K{static from(t){return ye(()=>new Ue,t)}asBinary(){return N.new(this.data.clone(new Ge))}}function Ts(e){return function(){return e(this)}}function Ah(e){return function(t){return e(this,t)}}function Fs(e){return function(t,r){return e(this,t,r)}}class S extends E{}const Th=(e,t)=>864e5*e[t],Ui=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Fh=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Oh=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,Ga=e=>new Date(e),Dh=(e,t)=>Ga(Th(e,t)),xh=(e,t)=>Ga(Ui(e,t)),Lh=(e,t)=>null,Za=(e,t,r)=>{const{[r]:n,[r+1]:s}=t;return n!=null&&s!=null?e.subarray(n,s):null},Mh=({offset:e,values:t},r)=>{const n=e+r;return(t[n>>3]&1<<n%8)!==0},Qa=({values:e},t)=>Dh(e,t),Xa=({values:e},t)=>xh(e,t*2),Pt=({stride:e,values:t},r)=>t[e*r],to=({stride:e,values:t},r)=>zc(t[e*r]),Ni=({stride:e,values:t,type:r},n)=>je.new(t.subarray(e*n,e*(n+1)),r.isSigned),Eh=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),Uh=({values:e,valueOffsets:t},r)=>Za(e,t,r),Nh=({values:e,valueOffsets:t},r)=>{const n=Za(e,t,r);return n!==null?jn(n):null},Vh=(e,t)=>e.type.bitWidth<64?Pt(e,t):Ni(e,t),Rh=(e,t)=>e.type.precision!==St.HALF?Pt(e,t):to(e,t),Ch=(e,t)=>e.type.unit===Ct.DAY?Qa(e,t):Xa(e,t),eo=({values:e},t)=>1e3*Ui(e,t*2),ro=({values:e},t)=>Ui(e,t*2),no=({values:e},t)=>Fh(e,t*2),io=({values:e},t)=>Oh(e,t*2),kh=(e,t)=>{switch(e.type.unit){case Y.SECOND:return eo(e,t);case Y.MILLISECOND:return ro(e,t);case Y.MICROSECOND:return no(e,t);case Y.NANOSECOND:return io(e,t)}},so=({values:e,stride:t},r)=>e[t*r],ao=({values:e,stride:t},r)=>e[t*r],oo=({values:e},t)=>je.signed(e.subarray(2*t,2*(t+1))),co=({values:e},t)=>je.signed(e.subarray(2*t,2*(t+1))),jh=(e,t)=>{switch(e.type.unit){case Y.SECOND:return so(e,t);case Y.MILLISECOND:return ao(e,t);case Y.MICROSECOND:return oo(e,t);case Y.NANOSECOND:return co(e,t)}},Ph=({values:e},t)=>je.decimal(e.subarray(4*t,4*(t+1))),zh=(e,t)=>{const r=e.getChildAt(0),{valueOffsets:n,stride:s}=e;return r.slice(n[t*s],n[t*s+1])},$h=(e,t)=>e.bind(t),Wh=(e,t)=>e.bind(t),Yh=(e,t)=>e.type.mode===Jt.Dense?uo(e,t):lo(e,t),uo=(e,t)=>{const r=e.typeIdToChildIndex[e.typeIds[t]],n=e.getChildAt(r);return n?n.get(e.valueOffsets[t]):null},lo=(e,t)=>{const r=e.typeIdToChildIndex[e.typeIds[t]],n=e.getChildAt(r);return n?n.get(t):null},Hh=(e,t)=>e.getValue(e.getKey(t)),qh=(e,t)=>e.type.unit===xe.DAY_TIME?ho(e,t):fo(e,t),ho=({values:e},t)=>e.subarray(2*t,2*(t+1)),fo=({values:e},t)=>{const r=e[t],n=new Int32Array(2);return n[0]=r/12|0,n[1]=r%12|0,n},Kh=(e,t)=>{const r=e.getChildAt(0),{stride:n}=e;return r.slice(t*n,(t+1)*n)};S.prototype.visitNull=Lh;S.prototype.visitBool=Mh;S.prototype.visitInt=Vh;S.prototype.visitInt8=Pt;S.prototype.visitInt16=Pt;S.prototype.visitInt32=Pt;S.prototype.visitInt64=Ni;S.prototype.visitUint8=Pt;S.prototype.visitUint16=Pt;S.prototype.visitUint32=Pt;S.prototype.visitUint64=Ni;S.prototype.visitFloat=Rh;S.prototype.visitFloat16=to;S.prototype.visitFloat32=Pt;S.prototype.visitFloat64=Pt;S.prototype.visitUtf8=Nh;S.prototype.visitBinary=Uh;S.prototype.visitFixedSizeBinary=Eh;S.prototype.visitDate=Ch;S.prototype.visitDateDay=Qa;S.prototype.visitDateMillisecond=Xa;S.prototype.visitTimestamp=kh;S.prototype.visitTimestampSecond=eo;S.prototype.visitTimestampMillisecond=ro;S.prototype.visitTimestampMicrosecond=no;S.prototype.visitTimestampNanosecond=io;S.prototype.visitTime=jh;S.prototype.visitTimeSecond=so;S.prototype.visitTimeMillisecond=ao;S.prototype.visitTimeMicrosecond=oo;S.prototype.visitTimeNanosecond=co;S.prototype.visitDecimal=Ph;S.prototype.visitList=zh;S.prototype.visitStruct=Wh;S.prototype.visitUnion=Yh;S.prototype.visitDenseUnion=uo;S.prototype.visitSparseUnion=lo;S.prototype.visitDictionary=Hh;S.prototype.visitInterval=qh;S.prototype.visitIntervalDayTime=ho;S.prototype.visitIntervalYearMonth=fo;S.prototype.visitFixedSizeList=Kh;S.prototype.visitMap=$h;const fn=new S;class B extends E{}function Jh(e,t){return t===null&&e.length>0?0:-1}function Gh(e,t){const{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(const s of en(r,e.data.offset+(t||0),e.length,r,Ys)){if(!s)return n;++n}return-1}function M(e,t,r){if(t===void 0)return-1;if(t===null)return Gh(e,r);const n=Pe(t);for(let s=(r||0)-1,a=e.length;++s<a;)if(n(e.get(s)))return s;return-1}function po(e,t,r){const n=Pe(t);for(let s=(r||0)-1,a=e.length;++s<a;)if(n(e.get(s)))return s;return-1}B.prototype.visitNull=Jh;B.prototype.visitBool=M;B.prototype.visitInt=M;B.prototype.visitInt8=M;B.prototype.visitInt16=M;B.prototype.visitInt32=M;B.prototype.visitInt64=M;B.prototype.visitUint8=M;B.prototype.visitUint16=M;B.prototype.visitUint32=M;B.prototype.visitUint64=M;B.prototype.visitFloat=M;B.prototype.visitFloat16=M;B.prototype.visitFloat32=M;B.prototype.visitFloat64=M;B.prototype.visitUtf8=M;B.prototype.visitBinary=M;B.prototype.visitFixedSizeBinary=M;B.prototype.visitDate=M;B.prototype.visitDateDay=M;B.prototype.visitDateMillisecond=M;B.prototype.visitTimestamp=M;B.prototype.visitTimestampSecond=M;B.prototype.visitTimestampMillisecond=M;B.prototype.visitTimestampMicrosecond=M;B.prototype.visitTimestampNanosecond=M;B.prototype.visitTime=M;B.prototype.visitTimeSecond=M;B.prototype.visitTimeMillisecond=M;B.prototype.visitTimeMicrosecond=M;B.prototype.visitTimeNanosecond=M;B.prototype.visitDecimal=M;B.prototype.visitList=M;B.prototype.visitStruct=M;B.prototype.visitUnion=M;B.prototype.visitDenseUnion=po;B.prototype.visitSparseUnion=po;B.prototype.visitDictionary=M;B.prototype.visitInterval=M;B.prototype.visitIntervalDayTime=M;B.prototype.visitIntervalYearMonth=M;B.prototype.visitFixedSizeList=M;B.prototype.visitMap=M;const yo=new B;class A extends E{}function Zh(e){const t=fn.getVisitFn(e);return en(e.nullBitmap,e.offset,e.length,e,(r,n,s,a)=>(s&1<<a)!==0?t(r,n):null)}function O(e){if(e.nullCount>0)return Zh(e);const{type:t,typeId:r,length:n}=e;return e.stride===1&&(r===l.Timestamp||r===l.Int&&t.bitWidth!==64||r===l.Time&&t.bitWidth!==64||r===l.Float&&t.precision>0)?e.values.subarray(0,n)[Symbol.iterator]():function*(s){for(let a=-1;++a<n;)yield s(e,a)}(fn.getVisitFn(e))}A.prototype.visitNull=O;A.prototype.visitBool=O;A.prototype.visitInt=O;A.prototype.visitInt8=O;A.prototype.visitInt16=O;A.prototype.visitInt32=O;A.prototype.visitInt64=O;A.prototype.visitUint8=O;A.prototype.visitUint16=O;A.prototype.visitUint32=O;A.prototype.visitUint64=O;A.prototype.visitFloat=O;A.prototype.visitFloat16=O;A.prototype.visitFloat32=O;A.prototype.visitFloat64=O;A.prototype.visitUtf8=O;A.prototype.visitBinary=O;A.prototype.visitFixedSizeBinary=O;A.prototype.visitDate=O;A.prototype.visitDateDay=O;A.prototype.visitDateMillisecond=O;A.prototype.visitTimestamp=O;A.prototype.visitTimestampSecond=O;A.prototype.visitTimestampMillisecond=O;A.prototype.visitTimestampMicrosecond=O;A.prototype.visitTimestampNanosecond=O;A.prototype.visitTime=O;A.prototype.visitTimeSecond=O;A.prototype.visitTimeMillisecond=O;A.prototype.visitTimeMicrosecond=O;A.prototype.visitTimeNanosecond=O;A.prototype.visitDecimal=O;A.prototype.visitList=O;A.prototype.visitStruct=O;A.prototype.visitUnion=O;A.prototype.visitDenseUnion=O;A.prototype.visitSparseUnion=O;A.prototype.visitDictionary=O;A.prototype.visitInterval=O;A.prototype.visitIntervalDayTime=O;A.prototype.visitIntervalYearMonth=O;A.prototype.visitFixedSizeList=O;A.prototype.visitMap=O;const Vi=new A;class T extends E{}function D(e){const{type:t,length:r,stride:n}=e;switch(t.typeId){case l.Int:case l.Float:case l.Decimal:case l.Time:case l.Timestamp:return e.values.subarray(0,r*n)}return[...Vi.visit(e)]}T.prototype.visitNull=D;T.prototype.visitBool=D;T.prototype.visitInt=D;T.prototype.visitInt8=D;T.prototype.visitInt16=D;T.prototype.visitInt32=D;T.prototype.visitInt64=D;T.prototype.visitUint8=D;T.prototype.visitUint16=D;T.prototype.visitUint32=D;T.prototype.visitUint64=D;T.prototype.visitFloat=D;T.prototype.visitFloat16=D;T.prototype.visitFloat32=D;T.prototype.visitFloat64=D;T.prototype.visitUtf8=D;T.prototype.visitBinary=D;T.prototype.visitFixedSizeBinary=D;T.prototype.visitDate=D;T.prototype.visitDateDay=D;T.prototype.visitDateMillisecond=D;T.prototype.visitTimestamp=D;T.prototype.visitTimestampSecond=D;T.prototype.visitTimestampMillisecond=D;T.prototype.visitTimestampMicrosecond=D;T.prototype.visitTimestampNanosecond=D;T.prototype.visitTime=D;T.prototype.visitTimeSecond=D;T.prototype.visitTimeMillisecond=D;T.prototype.visitTimeMicrosecond=D;T.prototype.visitTimeNanosecond=D;T.prototype.visitDecimal=D;T.prototype.visitList=D;T.prototype.visitStruct=D;T.prototype.visitUnion=D;T.prototype.visitDenseUnion=D;T.prototype.visitSparseUnion=D;T.prototype.visitDictionary=D;T.prototype.visitInterval=D;T.prototype.visitIntervalDayTime=D;T.prototype.visitIntervalYearMonth=D;T.prototype.visitFixedSizeList=D;T.prototype.visitMap=D;const bo=new T,We=(e,t)=>e+t,Cn=e=>`Cannot compute the byte width of variable-width column ${e}`;class Qh extends E{visitNull(t){return 0}visitInt(t){return t.bitWidth/8}visitFloat(t){return t.ArrayType.BYTES_PER_ELEMENT}visitBinary(t){throw new Error(Cn(t))}visitUtf8(t){throw new Error(Cn(t))}visitBool(t){return 1/8}visitDecimal(t){return 16}visitDate(t){return(t.unit+1)*4}visitTime(t){return t.bitWidth/8}visitTimestamp(t){return t.unit===Y.SECOND?4:8}visitInterval(t){return(t.unit+1)*4}visitList(t){throw new Error(Cn(t))}visitStruct(t){return this.visitFields(t.children).reduce(We,0)}visitUnion(t){return this.visitFields(t.children).reduce(We,0)}visitFixedSizeBinary(t){return t.byteWidth}visitFixedSizeList(t){return t.listSize*this.visitFields(t.children).reduce(We,0)}visitMap(t){return this.visitFields(t.children).reduce(We,0)}visitDictionary(t){return this.visit(t.indices)}visitFields(t){return(t||[]).map(r=>this.visit(r.type))}visitSchema(t){return this.visitFields(t.fields).reduce(We,0)}}const mo=new Qh;class Xh extends E{visitNull(){return fh}visitBool(){return Gl}visitInt(){return Et}visitInt8(){return za}visitInt16(){return $a}visitInt32(){return Wa}visitInt64(){return Ya}visitUint8(){return Ha}visitUint16(){return qa}visitUint32(){return Ka}visitUint64(){return Ja}visitFloat(){return ln}visitFloat16(){return ka}visitFloat32(){return ja}visitFloat64(){return Pa}visitUtf8(){return Bh}visitBinary(){return Jl}visitFixedSizeBinary(){return th}visitDate(){return xi}visitDateDay(){return Zl}visitDateMillisecond(){return Ql}visitTimestamp(){return pr}visitTimestampSecond(){return ph}visitTimestampMillisecond(){return yh}visitTimestampMicrosecond(){return bh}visitTimestampNanosecond(){return mh}visitTime(){return yr}visitTimeSecond(){return gh}visitTimeMillisecond(){return _h}visitTimeMicrosecond(){return wh}visitTimeNanosecond(){return vh}visitDecimal(){return Xl}visitList(){return lh}visitStruct(){return hn}visitUnion(){return Ei}visitDenseUnion(){return Ih}visitSparseUnion(){return Sh}visitDictionary(){return Li}visitInterval(){return Mi}visitIntervalDayTime(){return sh}visitIntervalYearMonth(){return ah}visitFixedSizeList(){return eh}visitMap(){return hh}}const go=new Xh;N.new=tf;N.from=ef;function tf(e,...t){return new(go.getVisitFn(e)())(e,...t)}function ye(e,t){if(xt(t))return N.from({nullValues:[null,void 0],type:e(),values:t});if(Gt(t))return N.from({nullValues:[null,void 0],type:e(),values:t});const{values:r=[],type:n=e(),nullValues:s=[null,void 0]}={...t};return xt(r)?N.from({nullValues:s,...t,type:n}):N.from({nullValues:s,...t,type:n})}function ef(e){const{values:t=[],...r}={nullValues:[null,void 0],...e};if(xt(t)){const n=[...Q.throughIterable(r)(t)];return n.length===1?n[0]:st.concat(n)}return(async n=>{const s=Q.throughAsyncIterable(r);for await(const a of s(t))n.push(a);return n.length===1?n[0]:st.concat(n)})([])}K.prototype.get=function(t){return fn.visit(this,t)};K.prototype.set=function(t,r){return cn.visit(this,t,r)};K.prototype.indexOf=function(t,r){return yo.visit(this,t,r)};K.prototype.toArray=function(){return bo.visit(this)};K.prototype.getByteWidth=function(){return mo.visit(this.type)};K.prototype[Symbol.iterator]=function(){return Vi.visit(this)};K.prototype._bindDataAccessors=af;Object.keys(l).map(e=>l[e]).filter(e=>typeof e=="number").filter(e=>e!==l.NONE).forEach(e=>{const t=go.visit(e);t.prototype.get=Ah(fn.getVisitFn(e)),t.prototype.set=Fs(cn.getVisitFn(e)),t.prototype.indexOf=Fs(yo.getVisitFn(e)),t.prototype.toArray=Ts(bo.getVisitFn(e)),t.prototype.getByteWidth=rf(mo.getVisitFn(e)),t.prototype[Symbol.iterator]=Ts(Vi.getVisitFn(e))});function rf(e){return function(){return e(this.type)}}function nf(e){return function(t){return this.isValid(t)?e.call(this,t):null}}function sf(e){return function(t,r){mc(this.nullBitmap,this.offset+t,r!=null)&&e.call(this,t,r)}}function af(){const e=this.nullBitmap;e&&e.byteLength>0&&(this.get=nf(this.get),this.set=sf(this.set))}class k extends st{constructor(...t){let r=null;t[0]instanceof H&&(r=t.shift());let n=sa(ft,t);if(!r&&!(r=n[0]&&n[0].schema))throw new TypeError("Table must be initialized with a Schema or at least one RecordBatch");n[0]||(n[0]=new dn(r)),super(new Lt(r.fields),n),this._schema=r,this._chunks=n}static empty(t=new H([])){return new k(t,[])}static from(t){if(!t)return k.empty();if(typeof t=="object"){let n=xt(t.values)?of(t):Gt(t.values)?cf(t):null;if(n!==null)return n}let r=Dt.from(t);return ne(r)?(async()=>await k.from(await r))():r.isSync()&&(r=r.open())?r.schema?new k(r.schema,[...r]):k.empty():(async n=>{const s=await n,a=s.schema,i=[];if(a){for await(let o of s)i.push(o);return new k(a,i)}return k.empty()})(r.open())}static async fromAsync(t){return await k.from(t)}static fromStruct(t){return k.new(t.data.childData,t.type.children)}static new(...t){return new k(...Hl(Iu(t)))}get schema(){return this._schema}get length(){return this._length}get chunks(){return this._chunks}get numCols(){return this._numChildren}clone(t=this._chunks){return new k(this._schema,t)}getColumn(t){return this.getColumnAt(this.getColumnIndex(t))}getColumnAt(t){return this.getChildAt(t)}getColumnIndex(t){return this._schema.fields.findIndex(r=>r.name===t)}getChildAt(t){if(t<0||t>=this.numChildren)return null;let r,n;const s=this._schema.fields,a=this._children||(this._children=[]);if(n=a[t])return n;if(r=s[t]){const i=this._chunks.map(o=>o.getChildAt(t)).filter(o=>o!=null);if(i.length>0)return a[t]=new Ft(r,i)}return null}serialize(t="binary",r=!0){return(r?Ti:Fi).writeAll(this).toUint8Array(!0)}count(){return this._length}select(...t){const r=this._schema.fields.reduce((n,s,a)=>n.set(s.name,a),new Map);return this.selectAt(...t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(...t){const r=this._schema.selectAt(...t);return new k(r,this._chunks.map(({length:n,data:{childData:s}})=>new ft(r,n,t.map(a=>s[a]).filter(Boolean))))}assign(t){const r=this._schema.fields,[n,s]=t.schema.fields.reduce((o,c,u)=>{const[d,b]=o,_=r.findIndex(v=>v.name===c.name);return~_?b[_]=u:d.push(u),o},[[],[]]),a=this._schema.assign(t.schema),i=[...r.map((o,c,u,d=s[c])=>d===void 0?this.getColumnAt(c):t.getColumnAt(d)),...n.map(o=>t.getColumnAt(o))].filter(Boolean);return new k(...Ca(a,i))}}function of(e){const{type:t}=e;return t instanceof Lt?k.fromStruct(hn.from(e)):null}function cf(e){const{type:t}=e;return t instanceof Lt?hn.from(e).then(r=>k.fromStruct(r)):null}class ft extends hn{constructor(...t){let r,n=t[0],s;if(t[1]instanceof m)[,r,s]=t;else{const a=n.fields,[,i,o]=t;r=m.Struct(new Lt(a),0,i,0,null,o)}super(r,s),this._schema=n}static from(t){return xt(t.values),k.from(t)}static new(...t){const[r,n]=aa(t),s=n.filter(a=>a instanceof N);return new ft(...Yl(new H(r),s.map(a=>a.data)))}clone(t,r=this._children){return new ft(this._schema,t,r)}concat(...t){const r=this._schema,n=st.flatten(this,...t);return new k(r,n.map(({data:s})=>new ft(r,s)))}get schema(){return this._schema}get numCols(){return this._schema.fields.length}get dictionaries(){return this._dictionaries||(this._dictionaries=Ri.collect(this))}select(...t){const r=this._schema.fields.reduce((n,s,a)=>n.set(s.name,a),new Map);return this.selectAt(...t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(...t){const r=this._schema.selectAt(...t),n=t.map(s=>this.data.childData[s]).filter(Boolean);return new ft(r,this.length,n)}}class dn extends ft{constructor(t){super(t,0,t.fields.map(r=>m.new(r.type,0,0,0)))}}class Ri extends E{constructor(){super(...arguments),this.dictionaries=new Map}static collect(t){return new Ri().visit(t.data,new Lt(t.schema.fields)).dictionaries}visit(t,r){return L.isDictionary(r)?this.visitDictionary(t,r):(t.childData.forEach((n,s)=>this.visit(n,r.children[s].type)),this)}visitDictionary(t,r){const n=t.dictionary;return n&&n.length>0&&this.dictionaries.set(r.id,n),this}}class Dt extends me{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 r=this._impl.open(t);return ne(r)?r.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 gt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return gt.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,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Dt?t:Pn(t)?ff(t):js(t)?yf(t):ne(t)?(async()=>await Dt.from(await t))():Ps(t)||Qn(t)||zs(t)||Gt(t)?pf(new de(t)):df(new Hr(t))}static readAll(t){return t instanceof Dt?t.isSync()?Os(t):Ds(t):Pn(t)||ArrayBuffer.isView(t)||xt(t)||ks(t)?Os(t):Ds(t)}}class Kr extends Dt{constructor(t){super(t),this._impl=t}[Symbol.iterator](){return this._impl[Symbol.iterator]()}async*[Symbol.asyncIterator](){yield*this[Symbol.iterator]()}}class Jr extends Dt{constructor(t){super(t),this._impl=t}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class _o extends Kr{constructor(t){super(t),this._impl=t}}class uf extends Jr{constructor(t){super(t),this._impl=t}}class wo{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,r){return new ft(this.schema,t.length,this._loadVectors(t,r,this.schema.fields))}_loadDictionaryBatch(t,r){const{id:n,isDelta:s,data:a}=t,{dictionaries:i,schema:o}=this,c=i.get(n);if(s||!c){const u=o.dictionaries.get(n);return c&&s?c.concat(N.new(this._loadVectors(a,r,[u])[0])):N.new(this._loadVectors(a,r,[u])[0])}return c}_loadVectors(t,r,n){return new Fa(r,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}class Gr extends wo{constructor(t,r){super(r),this._reader=Pn(t)?new Pl(this._handle=t):new Ua(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=Io(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Z}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Z}next(){if(this.closed)return Z;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=r.readMessageBody(t.bodyLength),a=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,a)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new dn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Zr extends wo{constructor(t,r){super(r),this._reader=new jl(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}async cancel(){!this.closed&&(this.closed=!0)&&(await this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}async open(t){return this.closed||(this.autoDestroy=Io(this,t),this.schema||(this.schema=await this._reader.readSchema())||await this.cancel()),this}async throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.throw(t):Z}async return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.return(t):Z}async next(){if(this.closed)return Z;let t,{_reader:r}=this;for(;t=await this._readNextMessageAndValidate();)if(t.isSchema())await this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=await r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=await r.readMessageBody(t.bodyLength),a=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,a)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new dn(this.schema)}):await this.return()}async _readNextMessageAndValidate(t){return await this._reader.readMessage(t)}}class vo extends Gr{constructor(t,r){super(t instanceof fs?t:new fs(t),r)}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 r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){if(this.closed)return null;this._footer||this.open();const r=this._footer&&this._footer.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){const n=this._reader.readMessage(q.RecordBatch);if(n&&n.isRecordBatch()){const s=n.header(),a=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,a)}}return null}_readDictionaryBatch(t){const r=this._footer&&this._footer.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){const n=this._reader.readMessage(q.DictionaryBatch);if(n&&n.isDictionaryBatch()){const s=n.header(),a=this._reader.readMessageBody(n.bodyLength),i=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,i)}}}_readFooter(){const{_handle:t}=this,r=t.size-Na,n=t.readInt32(r),s=t.readAt(r-n,n);return rr.decode(s)}_readNextMessageAndValidate(t){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const r=this._footer&&this._footer.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}}class lf extends Zr{constructor(t,...r){const n=typeof r[0]!="number"?r.shift():void 0,s=r[0]instanceof Map?r.shift():void 0;super(t instanceof qr?t:new qr(t,n),s)}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}async open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=await this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&await this._readDictionaryBatch(this._dictionaryIndex++)}return await super.open(t)}async readRecordBatch(t){if(this.closed)return null;this._footer||await this.open();const r=this._footer&&this._footer.getRecordBatch(t);if(r&&await this._handle.seek(r.offset)){const n=await this._reader.readMessage(q.RecordBatch);if(n&&n.isRecordBatch()){const s=n.header(),a=await this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,a)}}return null}async _readDictionaryBatch(t){const r=this._footer&&this._footer.getDictionaryBatch(t);if(r&&await this._handle.seek(r.offset)){const n=await this._reader.readMessage(q.DictionaryBatch);if(n&&n.isDictionaryBatch()){const s=n.header(),a=await this._reader.readMessageBody(n.bodyLength),i=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,i)}}}async _readFooter(){const{_handle:t}=this;t._pending&&await t._pending;const r=t.size-Na,n=await t.readInt32(r),s=await t.readAt(r-n,n);return rr.decode(s)}async _readNextMessageAndValidate(t){if(this._footer||await this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&await this._handle.seek(r.offset))return await this._reader.readMessage(t)}return null}}class hf extends Gr{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new ul(r,t.nodes,t.buffers,this.dictionaries).visitMany(n)}}function Io(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*Os(e){const t=Dt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}async function*Ds(e){const t=await Dt.from(e);try{if(!(await t.open({autoDestroy:!1})).closed)do yield t;while(!(await t.reset().open()).closed)}finally{await t.cancel()}}function ff(e){return new Kr(new hf(e))}function df(e){const t=e.peek(dr+7&-8);return t&&t.byteLength>=4?Si(t)?new _o(new vo(e.read())):new Kr(new Gr(e)):new Kr(new Gr(function*(){}()))}async function pf(e){const t=await e.peek(dr+7&-8);return t&&t.byteLength>=4?Si(t)?new _o(new vo(await e.read())):new Jr(new Zr(e)):new Jr(new Zr(async function*(){}()))}async function yf(e){const{size:t}=await e.stat(),r=new qr(e,t);return t>=zl&&Si(await r.readAt(0,dr+7&-8))?new uf(new lf(r)):new Jr(new Zr(r))}function bf(e,t){if(Gt(e))return gf(e,t);if(xt(e))return mf(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function mf(e,t){let r=null;const n=t&&t.type==="bytes"||!1,s=t&&t.highWaterMark||2**24;return new ReadableStream({...t,start(i){a(i,r||(r=e[Symbol.iterator]()))},pull(i){r?a(i,r):i.close()},cancel(){(r&&r.return&&r.return()||!0)&&(r=null)}},{highWaterMark:n?s:void 0,...t});function a(i,o){let c,u=null,d=i.desiredSize||null;for(;!(u=o.next(n?d:null)).done;)if(ArrayBuffer.isView(u.value)&&(c=U(u.value))&&(d!=null&&n&&(d=d-c.byteLength+1),u.value=c),i.enqueue(u.value),d!=null&&--d<=0)return;i.close()}}function gf(e,t){let r=null;const n=t&&t.type==="bytes"||!1,s=t&&t.highWaterMark||2**24;return new ReadableStream({...t,async start(i){await a(i,r||(r=e[Symbol.asyncIterator]()))},async pull(i){r?await a(i,r):i.close()},async cancel(){(r&&r.return&&await r.return()||!0)&&(r=null)}},{highWaterMark:n?s:void 0,...t});async function a(i,o){let c,u=null,d=i.desiredSize||null;for(;!(u=await o.next(n?d:null)).done;)if(ArrayBuffer.isView(u.value)&&(c=U(u.value))&&(d!=null&&n&&(d=d-c.byteLength+1),u.value=c),i.enqueue(u.value),d!=null&&--d<=0)return;i.close()}}function _f(e){return new wf(e)}class wf{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:s="count",...a}=t;this._controller=null,this._builder=Q.new(a),this._getSize=s!=="bytes"?xs:Ls;const{["highWaterMark"]:i=s==="bytes"?2**14:1e3}={...r},{["highWaterMark"]:o=s==="bytes"?2**14:1e3}={...n};this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:i,size:s!=="bytes"?xs:Ls}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:o,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){const r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!==null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r===null?t.close():t.enqueue(r)}}const xs=e=>e.length,Ls=e=>e.byteLength;function vf(e,t){const r=new qe;let n=null;const s=new ReadableStream({async cancel(){await r.close()},async start(o){await i(o,n||(n=await a()))},async pull(o){n?await i(o,n):o.close()}});return{writable:new WritableStream(r,{highWaterMark:2**14,...e}),readable:s};async function a(){return await(await Dt.from(r)).open(t)}async function i(o,c){let u=o.desiredSize,d=null;for(;!(d=await c.next()).done;)if(o.enqueue(d.value),u!=null&&--u<=0)return;o.close()}}function If(e,t){const r=new this(e),n=new de(r),s=new ReadableStream({type:"bytes",async cancel(){await n.cancel()},async pull(i){await a(i)},async start(i){await a(i)}},{highWaterMark:2**14,...t});return{writable:new WritableStream(r,e),readable:s};async function a(i){let o=null,c=i.desiredSize;for(;o=await n.read(c||null);)if(i.enqueue(o),c!=null&&(c-=o.byteLength)<=0)return;i.close()}}class Te{eq(t){return t instanceof Te||(t=new Fe(t)),new Sf(this,t)}le(t){return t instanceof Te||(t=new Fe(t)),new Bf(this,t)}ge(t){return t instanceof Te||(t=new Fe(t)),new Af(this,t)}lt(t){return new Dr(this.ge(t))}gt(t){return new Dr(this.le(t))}ne(t){return new Dr(this.eq(t))}}class Fe extends Te{constructor(t){super(),this.v=t}}class So extends Te{constructor(t){super(),this.name=t}bind(t){if(!this.colidx){this.colidx=-1;const n=t.schema.fields;for(let s=-1;++s<n.length;)if(n[s].name===this.name){this.colidx=s;break}if(this.colidx<0)throw new Error(`Failed to bind Col "${this.name}"`)}const r=this.vector=t.getChildAt(this.colidx);return n=>r.get(n)}}class Ci{and(...t){return new Pi(this,...t)}or(...t){return new zi(this,...t)}not(){return new Dr(this)}}class ki extends Ci{constructor(t,r){super(),this.left=t,this.right=r}bind(t){return this.left instanceof Fe?this.right instanceof Fe?this._bindLitLit(t,this.left,this.right):this._bindLitCol(t,this.left,this.right):this.right instanceof Fe?this._bindColLit(t,this.left,this.right):this._bindColCol(t,this.left,this.right)}}class ji extends Ci{constructor(...t){super(),this.children=t}}ji.prototype.children=Object.freeze([]);class Pi extends ji{constructor(...t){t=t.reduce((r,n)=>r.concat(n instanceof Pi?n.children:n),[]),super(...t)}bind(t){const r=this.children.map(n=>n.bind(t));return(n,s)=>r.every(a=>a(n,s))}}class zi extends ji{constructor(...t){t=t.reduce((r,n)=>r.concat(n instanceof zi?n.children:n),[]),super(...t)}bind(t){const r=this.children.map(n=>n.bind(t));return(n,s)=>r.some(a=>a(n,s))}}class Sf extends ki{_bindLitLit(t,r,n){const s=r.v==n.v;return()=>s}_bindColCol(t,r,n){const s=r.bind(t),a=n.bind(t);return(i,o)=>s(i,o)==a(i,o)}_bindColLit(t,r,n){const s=r.bind(t);if(r.vector instanceof Li){let a;const i=r.vector;return i.dictionary!==this.lastDictionary?(a=i.reverseLookup(n.v),this.lastDictionary=i.dictionary,this.lastKey=a):a=this.lastKey,a===-1?()=>!1:o=>i.getKey(o)===a}else return(a,i)=>s(a,i)==n.v}_bindLitCol(t,r,n){return this._bindColLit(t,n,r)}}class Bf extends ki{_bindLitLit(t,r,n){const s=r.v<=n.v;return()=>s}_bindColCol(t,r,n){const s=r.bind(t),a=n.bind(t);return(i,o)=>s(i,o)<=a(i,o)}_bindColLit(t,r,n){const s=r.bind(t);return(a,i)=>s(a,i)<=n.v}_bindLitCol(t,r,n){const s=n.bind(t);return(a,i)=>r.v<=s(a,i)}}class Af extends ki{_bindLitLit(t,r,n){const s=r.v>=n.v;return()=>s}_bindColCol(t,r,n){const s=r.bind(t),a=n.bind(t);return(i,o)=>s(i,o)>=a(i,o)}_bindColLit(t,r,n){const s=r.bind(t);return(a,i)=>s(a,i)>=n.v}_bindLitCol(t,r,n){const s=n.bind(t);return(a,i)=>r.v>=s(a,i)}}class Dr extends Ci{constructor(t){super(),this.child=t}bind(t){const r=this.child.bind(t);return(n,s)=>!r(n,s)}}k.prototype.countBy=function(e){return new br(this.chunks).countBy(e)};k.prototype.scan=function(e,t){return new br(this.chunks).scan(e,t)};k.prototype.scanReverse=function(e,t){return new br(this.chunks).scanReverse(e,t)};k.prototype.filter=function(e){return new br(this.chunks).filter(e)};class br extends k{filter(t){return new $i(this.chunks,t)}scan(t,r){const n=this.chunks,s=n.length;for(let a=-1;++a<s;){const i=n[a];r&&r(i);for(let o=-1,c=i.length;++o<c;)t(o,i)}}scanReverse(t,r){const n=this.chunks,s=n.length;for(let a=s;--a>=0;){const i=n[a];r&&r(i);for(let o=i.length;--o>=0;)t(o,i)}}countBy(t){const r=this.chunks,n=r.length,s=typeof t=="string"?new So(t):t;s.bind(r[n-1]);const a=s.vector;if(!L.isDictionary(a.type))throw new Error("countBy currently only supports dictionary-encoded columns");const i=Math.ceil(Math.log(a.length)/Math.log(256)),o=i==4?Uint32Array:i>=2?Uint16Array:Uint8Array,c=new o(a.dictionary.length);for(let u=-1;++u<n;){const d=r[u];s.bind(d);const b=s.vector.indices;for(let _=-1,v=d.length;++_<v;){let C=b.get(_);C!==null&&c[C]++}}return new Bo(a.dictionary,Et.from(c))}}class Bo extends k{constructor(t,r){const n=new H([new V("values",t.type),new V("counts",r.type)]);super(new ft(n,r.length,[t,r]))}toJSON(){const t=this.getColumnAt(0),r=this.getColumnAt(1),n={};for(let s=-1;++s<this.length;)n[t.get(s)]=r.get(s);return n}}class $i extends br{constructor(t,r){super(t),this._predicate=r}scan(t,r){const n=this._chunks,s=n.length;for(let a=-1;++a<s;){const i=n[a],o=this._predicate.bind(i);let c=!1;for(let u=-1,d=i.length;++u<d;)o(u,i)&&(r&&!c&&(r(i),c=!0),t(u,i))}}scanReverse(t,r){const n=this._chunks,s=n.length;for(let a=s;--a>=0;){const i=n[a],o=this._predicate.bind(i);let c=!1;for(let u=i.length;--u>=0;)o(u,i)&&(r&&!c&&(r(i),c=!0),t(u,i))}}count(){let t=0;const r=this._chunks,n=r.length;for(let s=-1;++s<n;){const a=r[s],i=this._predicate.bind(a);for(let o=-1,c=a.length;++o<c;)i(o,a)&&++t}return t}*[Symbol.iterator](){const t=this._chunks,r=t.length;for(let n=-1;++n<r;){const s=t[n],a=this._predicate.bind(s);for(let i=-1,o=s.length;++i<o;)a(i,s)&&(yield s.get(i))}}filter(t){return new $i(this._chunks,this._predicate.and(t))}countBy(t){const r=this._chunks,n=r.length,s=typeof t=="string"?new So(t):t;s.bind(r[n-1]);const a=s.vector;if(!L.isDictionary(a.type))throw new Error("countBy currently only supports dictionary-encoded columns");const i=Math.ceil(Math.log(a.length)/Math.log(256)),o=i==4?Uint32Array:i>=2?Uint16Array:Uint8Array,c=new o(a.dictionary.length);for(let u=-1;++u<n;){const d=r[u],b=this._predicate.bind(d);s.bind(d);const _=s.vector.indices;for(let v=-1,C=d.length;++v<C;){let et=_.get(v);et!==null&&b(v,d)&&c[et]++}}return new Bo(a.dictionary,Et.from(c))}}gt.toDOMStream=bf;Q.throughDOM=_f;Dt.throughDOM=vf;Ai.throughDOM=If;/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Ms=function(){function e(t,r,n,s){var a=this;this.getCell=function(i,o){var c=i<a.headerRows&&o<a.headerColumns,u=i>=a.headerRows&&o<a.headerColumns,d=i<a.headerRows&&o>=a.headerColumns;if(c){var b=["blank"];return o>0&&b.push("level"+i),{type:"blank",classNames:b.join(" "),content:""}}else if(d){var _=o-a.headerColumns,b=["col_heading","level"+i,"col"+_];return{type:"columns",classNames:b.join(" "),content:a.getContent(a.columnsTable,_,i)}}else if(u){var v=i-a.headerRows,b=["row_heading","level"+o,"row"+v];return{type:"index",id:"T_"+a.uuid+"level"+o+"_row"+v,classNames:b.join(" "),content:a.getContent(a.indexTable,v,o)}}else{var v=i-a.headerRows,_=o-a.headerColumns,b=["data","row"+v,"col"+_],C=a.styler?a.getContent(a.styler.displayValuesTable,v,_):a.getContent(a.dataTable,v,_);return{type:"data",id:"T_"+a.uuid+"row"+v+"_col"+_,classNames:b.join(" "),content:C}}},this.getContent=function(i,o,c){var u=i.getColumnAt(c);if(u===null)return"";var d=a.getColumnTypeId(i,c);switch(d){case l.Timestamp:return a.nanosToDate(u.get(o));default:return u.get(o)}},this.dataTable=k.from(t),this.indexTable=k.from(r),this.columnsTable=k.from(n),this.styler=s?{caption:s.caption,displayValuesTable:k.from(s.displayValues),styles:s.styles,uuid:s.uuid}:void 0}return Object.defineProperty(e.prototype,"rows",{get:function(){return this.indexTable.length+this.columnsTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this.indexTable.numCols+this.columnsTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerRows",{get:function(){return this.rows-this.dataRows},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerColumns",{get:function(){return this.columns-this.dataColumns},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataRows",{get:function(){return this.dataTable.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataColumns",{get:function(){return this.dataTable.numCols},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uuid",{get:function(){return this.styler&&this.styler.uuid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){return this.styler&&this.styler.caption},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"styles",{get:function(){return this.styler&&this.styler.styles},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"table",{get:function(){return this.dataTable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.indexTable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnTable",{get:function(){return this.columnsTable},enumerable:!0,configurable:!0}),e.prototype.serialize=function(){return{data:this.dataTable.serialize(),index:this.indexTable.serialize(),columns:this.columnsTable.serialize()}},e.prototype.getColumnTypeId=function(t,r){return t.schema.fields[r].type.typeId},e.prototype.nanosToDate=function(t){return new Date(t/1e6)},e}();/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Ke=function(){return Ke=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Ke.apply(this,arguments)},Je;(function(e){e.COMPONENT_READY="streamlit:componentReady",e.SET_COMPONENT_VALUE="streamlit:setComponentValue",e.SET_FRAME_HEIGHT="streamlit:setFrameHeight"})(Je||(Je={}));var be=function(){function e(){}return e.API_VERSION=1,e.RENDER_EVENT="streamlit:render",e.events=new re,e.registeredMessageListener=!1,e.setComponentReady=function(){e.registeredMessageListener||(window.addEventListener("message",e.onMessageEvent),e.registeredMessageListener=!0),e.sendBackMsg(Je.COMPONENT_READY,{apiVersion:e.API_VERSION})},e.setFrameHeight=function(t){t===void 0&&(t=document.body.scrollHeight),t!==e.lastFrameHeight&&(e.lastFrameHeight=t,e.sendBackMsg(Je.SET_FRAME_HEIGHT,{height:t}))},e.setComponentValue=function(t){var r;t instanceof Ms?(r="dataframe",t=t.serialize()):Ff(t)?(r="bytes",t=new Uint8Array(t.buffer)):t instanceof ArrayBuffer?(r="bytes",t=new Uint8Array(t)):r="json",e.sendBackMsg(Je.SET_COMPONENT_VALUE,{value:t,dataType:r})},e.onMessageEvent=function(t){var r=t.data.type;switch(r){case e.RENDER_EVENT:e.onRenderMessage(t.data);break}},e.onRenderMessage=function(t){var r=t.args;r==null&&(console.error("Got null args in onRenderMessage. This should never happen"),r={});var n=t.dfs&&t.dfs.length>0?e.argsDataframeToObject(t.dfs):{};r=Ke(Ke({},r),n);var s=!!t.disabled,a=t.theme;a&&Tf(a);var i={disabled:s,args:r,theme:a},o=new CustomEvent(e.RENDER_EVENT,{detail:i});e.events.dispatchEvent(o)},e.argsDataframeToObject=function(t){var r=t.map(function(n){var s=n.key,a=n.value;return[s,e.toArrowTable(a)]});return Object.fromEntries(r)},e.toArrowTable=function(t){var r=t.data,n=r.data,s=r.index,a=r.columns,i=r.styler;return new Ms(n,s,a,i)},e.sendBackMsg=function(t,r){window.parent.postMessage(Ke({isStreamlitMessage:!0,type:t},r),"*")},e}(),Tf=function(e){var t=document.createElement("style");document.head.appendChild(t),t.innerHTML=`
    :root {
      --primary-color: `+e.primaryColor+`;
      --background-color: `+e.backgroundColor+`;
      --secondary-background-color: `+e.secondaryBackgroundColor+`;
      --text-color: `+e.textColor+`;
      --font: `+e.font+`;
    }

    body {
      background-color: var(--background-color);
      color: var(--text-color);
    }
  `};function Ff(e){var t=!1;try{t=e instanceof BigInt64Array||e instanceof BigUint64Array}catch{}return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array||t}/**
 * @license
 * Copyright 2018-2021 Streamlit Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Of=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)s.hasOwnProperty(a)&&(n[a]=s[a])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();(function(e){Of(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){be.setFrameHeight()},t.prototype.componentDidUpdate=function(){be.setFrameHeight()},t})(ko.PureComponent);const Df=document.body.appendChild(document.createElement("div")),ir=Df.appendChild(document.createElement("button")),xr=ir.appendChild(document.createElement("span")),Ao=ir.appendChild(document.createElement("span"));xr.className="icon";Ao.textContent="AUTHORIZE";ir.onclick=async()=>{var e=screen.width/2-Gn/2,t=screen.height/2-Jn/2;const r=window.open(Lr,"oauthWidget",`toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, copyhistory=no,width=${Gn},height=${Jn},top=${t},left=${e}`);r.focus();let n=await new Promise((s,a)=>{let i=null;new URLSearchParams(Lr).get("redirect_uri")||(i=setTimeout(()=>{r.closed||r.close(),clearInterval(c),s({cancelled:!0,reason:"timeout"})},3e5));const c=setInterval(()=>{try{if(r.closed)return clearInterval(c),i&&clearTimeout(i),s({cancelled:!0,reason:"user_closed"});let u=new URLSearchParams(Lr).get("redirect_uri"),d=new URL(r.location.href).toString(),b=new URLSearchParams(r.location.search),_=!1,v=!1;if(u?_=d.startsWith(u):b.has("token")&&b.has("PayerID")?_=!0:b.has("token")&&!b.has("PayerID")&&(v=!0),v)return r.close(),clearInterval(c),i&&clearTimeout(i),s({cancelled:!0,reason:"user_cancelled",token:b.get("token")});if(!_)return;r.close(),clearInterval(c),i&&clearTimeout(i);let C={};for(let et of b.entries())C[et[0]]=et[1];return s(C)}catch(u){return u.name==="SecurityError"?void 0:a(u)}},1e3)});be.setComponentValue(n)};let Lr,Jn,Gn;function xf(e){const t=e.detail;Lr=t.args.authorization_url,Jn=t.args.popup_height,Gn=t.args.popup_width,Ao.textContent=t.args.name,t.args.icon?xr.style.backgroundImage=`url("${t.args.icon}")`:(xr.style.width="0px",xr.style.height="0px"),t.args.use_container_width&&(ir.style.width="100%"),t.args.auto_click&&!window.opener&&!window.clicked&&(ir.click(),window.clicked=!0),be.setFrameHeight()}be.events.addEventListener(be.RENDER_EVENT,xf);be.setComponentReady();
