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

    body {
      background-color: var(--background-color);
      color: var(--text-color);
    }
  `)};function Nh(n){var t=!1;try{t=n instanceof BigInt64Array||n instanceof BigUint64Array}catch{}return n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array||t}var Eh=function(){var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},n(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");n(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();(function(n){Eh(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t.prototype.componentDidMount=function(){te.setFrameHeight()},t.prototype.componentDidUpdate=function(){te.setFrameHeight()},t})(Hu.PureComponent);var Lh=function(n,t,e,r){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function c(m){try{y(r.next(m))}catch(I){o(I)}}function h(m){try{y(r.throw(m))}catch(I){o(I)}}function y(m){m.done?s(m.value):i(m.value).then(c,h)}y((r=r.apply(n,t||[])).next())})};class Xn{constructor(t,e,r){this.services=t,this.cache=e,this.options=r}static getInstance(t,e){const r=JSON.stringify(e),i=`${t}-${r}`;return this.instances[i]||(this.instances[i]=new Xn({},{},e)),this.instances[i]}registerService(t,e){return new Xn(Object.assign(Object.assign({},this.services),{[t]:e}),Object.assign(Object.assign({},this.cache),{[t]:void 0}),this.options)}getService(t){return Lh(this,void 0,void 0,function*(){const e=this.services[t];if(!e)throw new Error(`Service ${String(t)} not found`);return(!this.cache[t]||!this.options.cache)&&(this.cache[t]=yield e(this)),this.cache[t]})}}Xn.instances={};var Wc={exports:{}},Vc={exports:{}};(function(n,t){(function(e,r){n.exports=r()})(typeof self<"u"?self:mu,function(){return function(e){var r={};function i(s){if(r[s])return r[s].exports;var o=r[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=r,i.d=function(s,o,c){i.o(s,o)||Object.defineProperty(s,o,{enumerable:!0,get:c})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,o){if(1&o&&(s=i(s)),8&o||4&o&&typeof s=="object"&&s&&s.__esModule)return s;var c=Object.create(null);if(i.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:s}),2&o&&typeof s!="string")for(var h in s)i.d(c,h,(function(y){return s[y]}).bind(null,h));return c},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return{}.hasOwnProperty.call(s,o)},i.p="",i(i.s=0)}([function(e,r,i){i.r(r),i.d(r,"Promise",function(){return it}),i.d(r,"TYPES",function(){return pu}),i.d(r,"ProxyWindow",function(){return Pt}),i.d(r,"setup",function(){return ho}),i.d(r,"destroy",function(){return fu}),i.d(r,"serializeMessage",function(){return uu}),i.d(r,"deserializeMessage",function(){return lu}),i.d(r,"createProxyWindow",function(){return du}),i.d(r,"toProxyWindow",function(){return hu}),i.d(r,"on",function(){return Ne}),i.d(r,"once",function(){return cu}),i.d(r,"send",function(){return Ee}),i.d(r,"markWindowKnown",function(){return Xs}),i.d(r,"cleanUpWindow",function(){return yu}),i.d(r,"bridge",function(){});function s(a){return{}.toString.call(a)==="[object RegExp]"}var o=`Call was rejected by callee.\r
`;function c(a){return a===void 0&&(a=window),a.location.protocol}function h(a){if(a===void 0&&(a=window),a.mockDomain){var l=a.mockDomain.split("//")[0];if(l)return l}return c(a)}function y(a){return a===void 0&&(a=window),h(a)==="about:"}function m(a){if(a===void 0&&(a=window),a)try{if(a.parent&&a.parent!==a)return a.parent}catch{}}function I(a){if(a===void 0&&(a=window),a&&!m(a))try{return a.opener}catch{}}function F(a){try{return!0}catch{}return!1}function Y(a){a===void 0&&(a=window);var l=a.location;if(!l)throw new Error("Can not read window location");var u=c(a);if(!u)throw new Error("Can not read window protocol");if(u==="file:")return"file://";if(u==="about:"){var d=m(a);return d&&F()?Y(d):"about://"}var f=l.host;if(!f)throw new Error("Can not read window host");return u+"//"+f}function K(a){a===void 0&&(a=window);var l=Y(a);return l&&a.mockDomain&&a.mockDomain.indexOf("mock:")===0?a.mockDomain:l}function Qt(a){if(!function(l){try{if(l===window)return!0}catch{}try{var u=Object.getOwnPropertyDescriptor(l,"location");if(u&&u.enumerable===!1)return!1}catch{}try{if(y(l)&&F())return!0}catch{}try{if(function(d){return d===void 0&&(d=window),h(d)==="mock:"}(l)&&F())return!0}catch{}try{if(Y(l)===Y(window))return!0}catch{}return!1}(a))return!1;try{if(a===window||y(a)&&F()||K(window)===K(a))return!0}catch{}return!1}function an(a){if(!Qt(a))throw new Error("Expected window to be same domain");return a}function ve(a,l){if(!a||!l)return!1;var u=m(l);return u?u===a:function(d){var f=[];try{for(;d.parent!==d;)f.push(d.parent),d=d.parent}catch{}return f}(l).indexOf(a)!==-1}function ur(a){var l=[],u;try{u=a.frames}catch{u=a}var d;try{d=u.length}catch{}if(d===0)return l;if(d){for(var f=0;f<d;f++){var g=void 0;try{g=u[f]}catch{continue}l.push(g)}return l}for(var b=0;b<100;b++){var _=void 0;try{_=u[b]}catch{return l}if(!_)return l;l.push(_)}return l}var Jc=[],Gc=[];function Yt(a,l){l===void 0&&(l=!0);try{if(a===window)return!1}catch{return!0}try{if(!a)return!0}catch{return!0}try{if(a.closed)return!0}catch(f){return!f||f.message!==o}if(l&&Qt(a))try{if(a.mockclosed)return!0}catch{}try{if(!a.parent||!a.top)return!0}catch{}var u=function(f,g){for(var b=0;b<f.length;b++)try{if(f[b]===g)return b}catch{}return-1}(Jc,a);if(u!==-1){var d=Gc[u];if(d&&function(f){if(!f.contentWindow||!f.parentNode)return!0;var g=f.ownerDocument;if(g&&g.documentElement&&!g.documentElement.contains(f)){for(var b=f;b.parentNode&&b.parentNode!==b;)b=b.parentNode;if(!b.host||!g.documentElement.contains(b.host))return!0}return!1}(d))return!0}return!1}function Us(a){return a===void 0&&(a=window),I(a=a||window)||m(a)||void 0}function cn(a,l){if(typeof a=="string"){if(typeof l=="string")return a==="*"||l===a;if(s(l)||Array.isArray(l))return!1}return s(a)?s(l)?a.toString()===l.toString():!Array.isArray(l)&&!!l.match(a):!!Array.isArray(a)&&(Array.isArray(l)?JSON.stringify(a)===JSON.stringify(l):!s(l)&&a.some(function(u){return cn(u,l)}))}function lr(a){try{if(a===window)return!0}catch(l){if(l&&l.message===o)return!0}try{if({}.toString.call(a)==="[object Window]")return!0}catch(l){if(l&&l.message===o)return!0}try{if(window.Window&&a instanceof window.Window)return!0}catch(l){if(l&&l.message===o)return!0}try{if(a&&a.self===a)return!0}catch(l){if(l&&l.message===o)return!0}try{if(a&&a.parent===a)return!0}catch(l){if(l&&l.message===o)return!0}try{if(a&&a.top===a)return!0}catch(l){if(l&&l.message===o)return!0}try{if(a&&a.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in a&&"self"in a&&"location"in a)return!0}catch{}return!1}function Ps(a){if(Qt(a))return an(a).frameElement;for(var l=0,u=document.querySelectorAll("iframe");l<u.length;l++){var d=u[l];if(d&&d.contentWindow&&d.contentWindow===a)return d}}function Kc(a){if(function(u){return u===void 0&&(u=window),!!m(u)}(a)){var l=Ps(a);if(l&&l.parentElement){l.parentElement.removeChild(l);return}}try{a.close()}catch{}}function He(a){try{if(!a)return!1;if(typeof Promise<"u"&&a instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&a instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&a instanceof window.constructor)return!1;var l={}.toString;if(l){var u=l.call(a);if(u==="[object Window]"||u==="[object global]"||u==="[object DOMWindow]")return!1}if(typeof a.then=="function")return!0}catch{return!1}return!1}var ks=[],Mn=[],mi=0,xn;function js(){if(!mi&&xn){var a=xn;xn=null,a.resolve()}}function gi(){mi+=1}function Nn(){mi-=1,js()}var it=function(){function a(u){var d=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],u){var f,g,b=!1,_=!1,w=!1;gi();try{u(function(v){w?d.resolve(v):(b=!0,f=v)},function(v){w?d.reject(v):(_=!0,g=v)})}catch(v){Nn(),this.reject(v);return}Nn(),w=!0,b?this.resolve(f):_&&this.reject(g)}}var l=a.prototype;return l.resolve=function(u){if(this.resolved||this.rejected)return this;if(He(u))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=u,this.dispatch(),this},l.reject=function(u){var d=this;if(this.resolved||this.rejected)return this;if(He(u))throw new Error("Can not reject promise with another promise");if(!u){var f=u&&typeof u.toString=="function"?u.toString():{}.toString.call(u);u=new Error("Expected reject to be called with Error, got "+f)}return this.rejected=!0,this.error=u,this.errorHandled||setTimeout(function(){d.errorHandled||function(g,b){if(ks.indexOf(g)===-1){ks.push(g),setTimeout(function(){throw g},1);for(var _=0;_<Mn.length;_++)Mn[_](g,b)}}(u,d)},1),this.dispatch(),this},l.asyncReject=function(u){return this.errorHandled=!0,this.reject(u),this},l.dispatch=function(){var u=this.resolved,d=this.rejected,f=this.handlers;if(!this.dispatching&&(u||d)){this.dispatching=!0,gi();for(var g=function(O,V){return O.then(function(j){V.resolve(j)},function(j){V.reject(j)})},b=0;b<f.length;b++){var _=f[b],w=_.onSuccess,v=_.onError,B=_.promise,S=void 0;if(u)try{S=w?w(this.value):this.value}catch(O){B.reject(O);continue}else if(d){if(!v){B.reject(this.error);continue}try{S=v(this.error)}catch(O){B.reject(O);continue}}if(S instanceof a&&(S.resolved||S.rejected)){var A=S;A.resolved?B.resolve(A.value):B.reject(A.error),A.errorHandled=!0}else He(S)?S instanceof a&&(S.resolved||S.rejected)?S.resolved?B.resolve(S.value):B.reject(S.error):g(S,B):B.resolve(S)}f.length=0,this.dispatching=!1,Nn()}},l.then=function(u,d){if(u&&typeof u!="function"&&!u.call)throw new Error("Promise.then expected a function for success handler");if(d&&typeof d!="function"&&!d.call)throw new Error("Promise.then expected a function for error handler");var f=new a;return this.handlers.push({promise:f,onSuccess:u,onError:d}),this.errorHandled=!0,this.dispatch(),f},l.catch=function(u){return this.then(void 0,u)},l.finally=function(u){if(u&&typeof u!="function"&&!u.call)throw new Error("Promise.finally expected a function");return this.then(function(d){return a.try(u).then(function(){return d})},function(d){return a.try(u).then(function(){throw d})})},l.timeout=function(u,d){var f=this;if(this.resolved||this.rejected)return this;var g=setTimeout(function(){f.resolved||f.rejected||f.reject(d||new Error("Promise timed out after "+u+"ms"))},u);return this.then(function(b){return clearTimeout(g),b})},l.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},l.lazy=function(){return this.errorHandled=!0,this},a.resolve=function(u){return u instanceof a?u:He(u)?new a(function(d,f){return u.then(d,f)}):new a().resolve(u)},a.reject=function(u){return new a().reject(u)},a.asyncReject=function(u){return new a().asyncReject(u)},a.all=function(u){var d=new a,f=u.length,g=[].slice();if(!f)return d.resolve(g),d;for(var b=function(v,B,S){return B.then(function(A){g[v]=A,(f-=1)==0&&d.resolve(g)},function(A){S.reject(A)})},_=0;_<u.length;_++){var w=u[_];if(w instanceof a){if(w.resolved){g[_]=w.value,f-=1;continue}}else if(!He(w)){g[_]=w,f-=1;continue}b(_,a.resolve(w),d)}return f===0&&d.resolve(g),d},a.hash=function(u){var d={},f=[],g=function(_){if(u.hasOwnProperty(_)){var w=u[_];He(w)?f.push(w.then(function(v){d[_]=v})):d[_]=w}};for(var b in u)g(b);return a.all(f).then(function(){return d})},a.map=function(u,d){return a.all(u.map(d))},a.onPossiblyUnhandledException=function(u){return function(d){return Mn.push(d),{cancel:function(){Mn.splice(Mn.indexOf(d),1)}}}(u)},a.try=function(u,d,f){if(u&&typeof u!="function"&&!u.call)throw new Error("Promise.try expected a function");var g;gi();try{g=u.apply(d,f||[])}catch(b){return Nn(),a.reject(b)}return Nn(),a.resolve(g)},a.delay=function(u){return new a(function(d){setTimeout(d,u)})},a.isPromise=function(u){return!!(u&&u instanceof a)||He(u)},a.flush=function(){return function(u){var d=xn=xn||new u;return js(),d}(a)},a}();function dr(a,l){for(var u=0;u<a.length;u++)try{if(a[u]===l)return u}catch{}return-1}var bi=function(){function a(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var u=new WeakMap,d={};return Object.freeze(d),u.set(d,"__testvalue__"),u.get(d)==="__testvalue__"}catch{return!1}}())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var l=a.prototype;return l._cleanupClosedWindows=function(){for(var u=this.weakmap,d=this.keys,f=0;f<d.length;f++){var g=d[f];if(lr(g)&&Yt(g)){if(u)try{u.delete(g)}catch{}d.splice(f,1),this.values.splice(f,1),f-=1}}},l.isSafeToReadWrite=function(u){return!lr(u)},l.set=function(u,d){if(!u)throw new Error("WeakMap expected key");var f=this.weakmap;if(f)try{f.set(u,d)}catch{delete this.weakmap}if(this.isSafeToReadWrite(u))try{var g=this.name,b=u[g];b&&b[0]===u?b[1]=d:Object.defineProperty(u,g,{value:[u,d],writable:!0});return}catch{}this._cleanupClosedWindows();var _=this.keys,w=this.values,v=dr(_,u);v===-1?(_.push(u),w.push(d)):w[v]=d},l.get=function(u){if(!u)throw new Error("WeakMap expected key");var d=this.weakmap;if(d)try{if(d.has(u))return d.get(u)}catch{delete this.weakmap}if(this.isSafeToReadWrite(u))try{var f=u[this.name];return f&&f[0]===u?f[1]:void 0}catch{}this._cleanupClosedWindows();var g=dr(this.keys,u);if(g!==-1)return this.values[g]},l.delete=function(u){if(!u)throw new Error("WeakMap expected key");var d=this.weakmap;if(d)try{d.delete(u)}catch{delete this.weakmap}if(this.isSafeToReadWrite(u))try{var f=u[this.name];f&&f[0]===u&&(f[0]=f[1]=void 0)}catch{}this._cleanupClosedWindows();var g=this.keys,b=dr(g,u);b!==-1&&(g.splice(b,1),this.values.splice(b,1))},l.has=function(u){if(!u)throw new Error("WeakMap expected key");var d=this.weakmap;if(d)try{if(d.has(u))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(u))try{var f=u[this.name];return!(!f||f[0]!==u)}catch{}return this._cleanupClosedWindows(),dr(this.keys,u)!==-1},l.getOrSet=function(u,d){if(this.has(u))return this.get(u);var f=d();return this.set(u,f),f},a}();function zs(a){return a.name||a.__name__||a.displayName||"anonymous"}function Ws(a,l){try{delete a.name,a.name=l}catch{}return a.__name__=a.displayName=l,a}function ie(){var a="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return a.charAt(Math.floor(Math.random()*a.length))})+"_"+function(l){if(typeof btoa=="function")return btoa(encodeURIComponent(l).replace(/%([0-9A-F]{2})/g,function(u,d){return String.fromCharCode(parseInt(d,16))})).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(l,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var hr;function Vs(a){try{return JSON.stringify([].slice.call(a),function(l,u){return typeof u=="function"?"memoize["+function(d){if(hr=hr||new bi,d==null||typeof d!="object"&&typeof d!="function")throw new Error("Invalid object");var f=hr.get(d);return f||(f=typeof d+":"+ie(),hr.set(d,f)),f}(u)+"]":typeof window<"u"&&u instanceof window.Element||u!==null&&typeof u=="object"&&u.nodeType===1&&typeof u.style=="object"&&typeof u.ownerDocument=="object"?{}:u})}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function qc(){return{}}var En=0,$s=0;function Ln(a,l){l===void 0&&(l={});var u=l.thisNamespace,d=u!==void 0&&u,f=l.time,g,b,_=En;En+=1;var w=function(){for(var v=arguments.length,B=new Array(v),S=0;S<v;S++)B[S]=arguments[S];_<$s&&(g=null,b=null,_=En,En+=1);var A;A=d?(b=b||new bi).getOrSet(this,qc):g=g||{};var O;try{O=Vs(B)}catch{return a.apply(this,arguments)}var V=A[O];if(V&&f&&Date.now()-V.time<f&&(delete A[O],V=null),V)return V.value;var j=Date.now(),z=a.apply(this,arguments);return A[O]={time:j,value:z},z};return w.reset=function(){g=null,b=null},Ws(w,(l.name||zs(a))+"::memoized")}Ln.clear=function(){$s=En};function Zc(a){var l={};function u(){for(var d=arguments,f=this,g=arguments.length,b=new Array(g),_=0;_<g;_++)b[_]=arguments[_];var w=Vs(b);return l.hasOwnProperty(w)||(l[w]=it.try(function(){return a.apply(f,d)}).finally(function(){delete l[w]})),l[w]}return u.reset=function(){l={}},Ws(u,zs(a)+"::promiseMemoized")}function Je(){}function Rn(a,l){if(l===void 0&&(l=1),l>=3)return"stringifyError stack overflow";try{if(!a)return"<unknown error: "+{}.toString.call(a)+">";if(typeof a=="string")return a;if(a instanceof Error){var u=a&&a.stack,d=a&&a.message;if(u&&d)return u.indexOf(d)!==-1?u:d+`
`+u;if(u)return u;if(d)return d}return a&&a.toString&&typeof a.toString=="function"?a.toString():{}.toString.call(a)}catch(f){return"Error while stringifying error: "+Rn(f,l+1)}}function Ys(a){return typeof a=="string"?a:a&&a.toString&&typeof a.toString=="function"?a.toString():{}.toString.call(a)}Ln(function(a){if(Object.values)return Object.values(a);var l=[];for(var u in a)a.hasOwnProperty(u)&&l.push(a[u]);return l});function vi(a){return{}.toString.call(a)==="[object RegExp]"}function Cn(a,l,u){if(a.hasOwnProperty(l))return a[l];var d=u();return a[l]=d,d}function Hs(){var a=document.body;if(!a)throw new Error("Body element not found");return a}function Js(){return!!document.body&&document.readyState==="complete"}function Gs(){return!!document.body&&document.readyState==="interactive"}Ln(function(){return new it(function(a){if(Js()||Gs())return a();var l=setInterval(function(){if(Js()||Gs())return clearInterval(l),a()},10)})});var fr=typeof document<"u"?document.currentScript:null,Qc=Ln(function(){if(fr||(fr=function(){try{var a=function(){try{throw new Error("_")}catch(b){return b.stack||""}}(),l=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(a),u=l&&l[1];if(!u)return;for(var d=0,f=[].slice.call(document.getElementsByTagName("script")).reverse();d<f.length;d++){var g=f[d];if(g.src&&g.src===u)return g}}catch{}}()))return fr;throw new Error("Can not determine current script")}),Xc=ie();Ln(function(){var a;try{a=Qc()}catch{return Xc}var l=a.getAttribute("data-uid");if(l&&typeof l=="string"||(l=a.getAttribute("data-uid-auto"))&&typeof l=="string")return l;if(a.src){var u=function(d){for(var f="",g=0;g<d.length;g++){var b=d[g].charCodeAt(0)*g;d[g+1]&&(b+=d[g+1].charCodeAt(0)*(g-1)),f+=String.fromCharCode(97+Math.abs(b)%26)}return f}(JSON.stringify({src:a.src,dataset:a.dataset}));l="uid_"+u.slice(u.length-30)}else l=ie();return a.setAttribute("data-uid-auto",l),l});function Un(a){a===void 0&&(a=window);var l="__post_robot_10_0_46__";return a!==window?a[l]:a[l]=a[l]||{}}var Ks=function(){return{}};function wt(a,l){return a===void 0&&(a="store"),l===void 0&&(l=Ks),Cn(Un(),a,function(){var u=l();return{has:function(d){return u.hasOwnProperty(d)},get:function(d,f){return u.hasOwnProperty(d)?u[d]:f},set:function(d,f){return u[d]=f,f},del:function(d){delete u[d]},getOrSet:function(d,f){return Cn(u,d,f)},reset:function(){u=l()},keys:function(){return Object.keys(u)}}})}var tu=function(){};function pr(){var a=Un();return a.WINDOW_WILDCARD=a.WINDOW_WILDCARD||new tu,a.WINDOW_WILDCARD}function Ft(a,l){return a===void 0&&(a="store"),l===void 0&&(l=Ks),wt("windowStore").getOrSet(a,function(){var u=new bi,d=function(f){return u.getOrSet(f,l)};return{has:function(f){return d(f).hasOwnProperty(a)},get:function(f,g){var b=d(f);return b.hasOwnProperty(a)?b[a]:g},set:function(f,g){return d(f)[a]=g,g},del:function(f){delete d(f)[a]},getOrSet:function(f,g){return Cn(d(f),a,g)}}})}function qs(){return wt("instance").getOrSet("instanceID",ie)}function Zs(a,l){var u=l.domain,d=Ft("helloPromises"),f=d.get(a);f&&f.resolve({domain:u});var g=it.resolve({domain:u});return d.set(a,g),g}function wi(a,l){return(0,l.send)(a,"postrobot_hello",{instanceID:qs()},{domain:"*",timeout:-1}).then(function(u){var d=u.origin,f=u.data.instanceID;return Zs(a,{domain:d}),{win:a,domain:d,instanceID:f}})}function Qs(a,l){var u=l.send;return Ft("windowInstanceIDPromises").getOrSet(a,function(){return wi(a,{send:u}).then(function(d){return d.instanceID})})}function Xs(a){Ft("knownWindows").set(a,!0)}function _i(a){return typeof a=="object"&&a!==null&&typeof a.__type__=="string"}function to(a){return a===void 0?"undefined":a===null?"null":Array.isArray(a)?"array":typeof a=="function"?"function":typeof a=="object"?a instanceof Error?"error":typeof a.then=="function"?"promise":{}.toString.call(a)==="[object RegExp]"?"regex":{}.toString.call(a)==="[object Date]"?"date":"object":typeof a=="string"?"string":typeof a=="number"?"number":typeof a=="boolean"?"boolean":void 0}function Ge(a,l){return{__type__:a,__val__:l}}var Ct,eu=((Ct={}).function=function(){},Ct.error=function(a){return Ge("error",{message:a.message,stack:a.stack,code:a.code,data:a.data})},Ct.promise=function(){},Ct.regex=function(a){return Ge("regex",a.source)},Ct.date=function(a){return Ge("date",a.toJSON())},Ct.array=function(a){return a},Ct.object=function(a){return a},Ct.string=function(a){return a},Ct.number=function(a){return a},Ct.boolean=function(a){return a},Ct.null=function(a){return a},Ct[void 0]=function(a){return Ge("undefined",a)},Ct),nu={},Ut,ru=((Ut={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},Ut.error=function(a){var l=a.stack,u=a.code,d=a.data,f=new Error(a.message);return f.code=u,d&&(f.data=d),f.stack=l+`

`+f.stack,f},Ut.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},Ut.regex=function(a){return new RegExp(a)},Ut.date=function(a){return new Date(a)},Ut.array=function(a){return a},Ut.object=function(a){return a},Ut.string=function(a){return a},Ut.number=function(a){return a},Ut.boolean=function(a){return a},Ut.null=function(a){return a},Ut[void 0]=function(){},Ut),iu={};new it(function(a){if(window.document&&window.document.body)return a(window.document.body);var l=setInterval(function(){if(window.document&&window.document.body)return clearInterval(l),a(window.document.body)},10)});function Si(){for(var a=wt("idToProxyWindow"),l=0,u=a.keys();l<u.length;l++){var d=u[l];a.get(d).shouldClean()&&a.del(d)}}function eo(a,l){var u=l.send,d=l.id,f=d===void 0?ie():d,g=a.then(function(w){if(Qt(w))return an(w).name}),b=a.then(function(w){if(Yt(w))throw new Error("Window is closed, can not determine type");return I(w)?"popup":"iframe"});g.catch(Je),b.catch(Je);var _=function(){return a.then(function(w){if(!Yt(w))return Qt(w)?an(w).name:g})};return{id:f,getType:function(){return b},getInstanceID:Zc(function(){return a.then(function(w){return Qs(w,{send:u})})}),close:function(){return a.then(Kc)},getName:_,focus:function(){return a.then(function(w){w.focus()})},isClosed:function(){return a.then(function(w){return Yt(w)})},setLocation:function(w,v){return v===void 0&&(v={}),a.then(function(B){var S=window.location.protocol+"//"+window.location.host,A=v.method,O=A===void 0?"get":A,V=v.body;if(w.indexOf("/")===0)w=""+S+w;else if(!w.match(/^https?:\/\//)&&w.indexOf(S)!==0)throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(w));if(O==="post")return _().then(function(j){if(!j)throw new Error("Can not post to window without target name");(function(z){var at=z.url,gt=z.target,lt=z.body,ct=z.method,_t=ct===void 0?"post":ct,G=document.createElement("form");if(G.setAttribute("target",gt),G.setAttribute("method",_t),G.setAttribute("action",at),G.style.display="none",lt)for(var dt=0,Ht=Object.keys(lt);dt<Ht.length;dt++){var yt,Pn=Ht[dt],Oi=document.createElement("input");Oi.setAttribute("name",Pn),Oi.setAttribute("value",(yt=lt[Pn])==null?void 0:yt.toString()),G.appendChild(Oi)}Hs().appendChild(G),G.submit(),Hs().removeChild(G)})({url:w,target:j,method:O,body:V})});if(O!=="get")throw new Error("Unsupported method: "+O);if(Qt(B))try{if(B.location&&typeof B.location.replace=="function"){B.location.replace(w);return}}catch{}B.location=w})},setName:function(w){return a.then(function(v){var B=Qt(v),S=Ps(v);if(!B)throw new Error("Can not set name for cross-domain window: "+w);an(v).name=w,S&&S.setAttribute("name",w),g=it.resolve(w)})}}}var Pt=function(){function a(u){var d=u.send,f=u.win,g=u.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new it,this.serializedWindow=g||eo(this.actualWindowPromise,{send:d}),wt("idToProxyWindow").set(this.getID(),this),f&&this.setWindow(f,{send:d})}var l=a.prototype;return l.getID=function(){return this.serializedWindow.id},l.getType=function(){return this.serializedWindow.getType()},l.isPopup=function(){return this.getType().then(function(u){return u==="popup"})},l.setLocation=function(u,d){var f=this;return this.serializedWindow.setLocation(u,d).then(function(){return f})},l.getName=function(){return this.serializedWindow.getName()},l.setName=function(u){var d=this;return this.serializedWindow.setName(u).then(function(){return d})},l.close=function(){var u=this;return this.serializedWindow.close().then(function(){return u})},l.focus=function(){var u=this,d=this.isPopup(),f=this.getName(),g=it.hash({isPopup:d,name:f}).then(function(_){var w=_.name;_.isPopup&&w&&window.open("",w,"noopener")}),b=this.serializedWindow.focus();return it.all([g,b]).then(function(){return u})},l.isClosed=function(){return this.serializedWindow.isClosed()},l.getWindow=function(){return this.actualWindow},l.setWindow=function(u,d){var f=d.send;this.actualWindow=u,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=eo(this.actualWindowPromise,{send:f,id:this.getID()}),Ft("winToProxyWindow").set(u,this)},l.awaitWindow=function(){return this.actualWindowPromise},l.matchWindow=function(u,d){var f=this,g=d.send;return it.try(function(){return f.actualWindow?u===f.actualWindow:it.hash({proxyInstanceID:f.getInstanceID(),knownWindowInstanceID:Qs(u,{send:g})}).then(function(b){var _=b.proxyInstanceID===b.knownWindowInstanceID;return _&&f.setWindow(u,{send:g}),_})})},l.unwrap=function(){return this.actualWindow||this},l.getInstanceID=function(){return this.serializedWindow.getInstanceID()},l.shouldClean=function(){return!!(this.actualWindow&&Yt(this.actualWindow))},l.serialize=function(){return this.serializedWindow},a.unwrap=function(u){return a.isProxyWindow(u)?u.unwrap():u},a.serialize=function(u,d){var f=d.send;return Si(),a.toProxyWindow(u,{send:f}).serialize()},a.deserialize=function(u,d){var f=d.send;return Si(),wt("idToProxyWindow").get(u.id)||new a({serializedWindow:u,send:f})},a.isProxyWindow=function(u){return!!(u&&!lr(u)&&u.isProxyWindow)},a.toProxyWindow=function(u,d){var f=d.send;if(Si(),a.isProxyWindow(u))return u;var g=u;return Ft("winToProxyWindow").get(g)||new a({win:g,send:f})},a}();function Ii(a,l,u,d,f){var g=Ft("methodStore"),b=wt("proxyWindowMethods");Pt.isProxyWindow(d)?b.set(a,{val:l,name:u,domain:f,source:d}):(b.del(a),g.getOrSet(d,function(){return{}})[a]={domain:f,name:u,val:l,source:d})}function no(a,l){var u=Ft("methodStore"),d=wt("proxyWindowMethods");return u.getOrSet(a,function(){return{}})[l]||d.get(l)}function ro(a,l,u,d,f){b=(g={on:f.on,send:f.send}).on,_=g.send,wt("builtinListeners").getOrSet("functionCalls",function(){return b("postrobot_method",{domain:"*"},function(B){var S=B.source,A=B.origin,O=B.data,V=O.id,j=O.name,z=no(S,V);if(!z)throw new Error("Could not find method '"+j+"' with id: "+O.id+" in "+K(window));var at=z.source,gt=z.domain,lt=z.val;return it.try(function(){if(!cn(gt,A))throw new Error("Method '"+O.name+"' domain "+JSON.stringify(vi(z.domain)?z.domain.source:z.domain)+" does not match origin "+A+" in "+K(window));if(Pt.isProxyWindow(at))return at.matchWindow(S,{send:_}).then(function(ct){if(!ct)throw new Error("Method call '"+O.name+"' failed - proxy window does not match source in "+K(window))})}).then(function(){return lt.apply({source:S,origin:A},O.args)},function(ct){return it.try(function(){if(lt.onError)return lt.onError(ct)}).then(function(){throw ct.stack&&(ct.stack="Remote call to "+j+"("+function(_t){return _t===void 0&&(_t=[]),(G=_t,[].slice.call(G)).map(function(dt){return typeof dt=="string"?"'"+dt+"'":dt===void 0?"undefined":dt===null?"null":typeof dt=="boolean"?dt.toString():Array.isArray(dt)?"[ ... ]":typeof dt=="object"?"{ ... }":typeof dt=="function"?"() => { ... }":"<"+typeof dt+">"}).join(", ");var G}(O.args)+`) failed

`+ct.stack),ct})}).then(function(ct){return{result:ct,id:V,name:j}})})});var g,b,_,w=u.__id__||ie();a=Pt.unwrap(a);var v=u.__name__||u.name||d;return typeof v=="string"&&typeof v.indexOf=="function"&&v.indexOf("anonymous::")===0&&(v=v.replace("anonymous::",d+"::")),Pt.isProxyWindow(a)?(Ii(w,u,v,a,l),a.awaitWindow().then(function(B){Ii(w,u,v,B,l)})):Ii(w,u,v,a,l),Ge("cross_domain_function",{id:w,name:v})}function io(a,l,u,d){var f,g=d.on,b=d.send;return function(_,w){w===void 0&&(w=nu);var v=JSON.stringify(_,function(B){var S=this[B];if(_i(this))return S;var A=to(S);if(!A)return S;var O=w[A]||eu[A];return O?O(S,B):S});return v===void 0?"undefined":v}(u,((f={}).promise=function(_,w){return function(v,B,S,A,O){return Ge("cross_domain_zalgo_promise",{then:ro(v,B,function(V,j){return S.then(V,j)},A,{on:O.on,send:O.send})})}(a,l,_,w,{on:g,send:b})},f.function=function(_,w){return ro(a,l,_,w,{on:g,send:b})},f.object=function(_){return lr(_)||Pt.isProxyWindow(_)?Ge("cross_domain_window",Pt.serialize(_,{send:b})):_},f))}function so(a,l,u,d){var f,g=d.send;return function(b,_){if(_===void 0&&(_=iu),b!=="undefined")return JSON.parse(b,function(w,v){if(_i(this))return v;var B,S;if(_i(v)?(B=v.__type__,S=v.__val__):(B=to(v),S=v),!B)return S;var A=_[B]||ru[B];return A?A(S,w):S})}(u,((f={}).cross_domain_zalgo_promise=function(b){return function(_,w,v){return new it(v.then)}(0,0,b)},f.cross_domain_function=function(b){return function(_,w,v,B){var S=v.id,A=v.name,O=B.send,V=function(z){z===void 0&&(z={});function at(){var gt=arguments;return Pt.toProxyWindow(_,{send:O}).awaitWindow().then(function(lt){var ct=no(lt,S);if(ct&&ct.val!==at)return ct.val.apply({source:window,origin:K()},gt);var _t=[].slice.call(gt);return z.fireAndForget?O(lt,"postrobot_method",{id:S,name:A,args:_t},{domain:w,fireAndForget:!0}):O(lt,"postrobot_method",{id:S,name:A,args:_t},{domain:w,fireAndForget:!1}).then(function(G){return G.data.result})}).catch(function(lt){throw lt})}return at.__name__=A,at.__origin__=w,at.__source__=_,at.__id__=S,at.origin=w,at},j=V();return j.fireAndForget=V({fireAndForget:!0}),j}(a,l,b,{send:g})},f.cross_domain_window=function(b){return Pt.deserialize(b,{send:g})},f))}var Ai={};Ai.postrobot_post_message=function(a,l,u){u.indexOf("file:")===0&&(u="*"),a.postMessage(l,u)};function Bi(a,l,u,d){var f=d.on,g=d.send;return it.try(function(){var b=Ft().getOrSet(a,function(){return{}});return b.buffer=b.buffer||[],b.buffer.push(u),b.flush=b.flush||it.flush().then(function(){if(Yt(a))throw new Error("Window is closed");var _=io(a,l,((w={}).__post_robot_10_0_46__=b.buffer||[],w),{on:f,send:g}),w;delete b.buffer;for(var v=Object.keys(Ai),B=[],S=0;S<v.length;S++){var A=v[S];try{Ai[A](a,_,l)}catch(O){B.push(O)}}if(B.length===v.length)throw new Error(`All post-robot messaging strategies failed:

`+B.map(function(O,V){return V+". "+Rn(O)}).join(`

`))}),b.flush.then(function(){delete b.flush})}).then(Je)}function oo(a){return wt("responseListeners").get(a)}function ao(a){wt("responseListeners").del(a)}function co(a){return wt("erroredResponseListeners").has(a)}function uo(a){var l=a.name,u=a.win,d=a.domain,f=Ft("requestListeners");if(u==="*"&&(u=null),d==="*"&&(d=null),!l)throw new Error("Name required to get request listener");for(var g=0,b=[u,pr()];g<b.length;g++){var _=b[g];if(_){var w=f.get(_);if(w){var v=w[l];if(v){if(d&&typeof d=="string"){if(v[d])return v[d];if(v.__domain_regex__)for(var B=0,S=v.__domain_regex__;B<S.length;B++){var A=S[B],O=A.listener;if(cn(A.regex,d))return O}}if(v["*"])return v["*"]}}}}}function su(a,l,u,d){var f=d.on,g=d.send,b=uo({name:u.name,win:a,domain:l}),_=u.name==="postrobot_method"&&u.data&&typeof u.data.name=="string"?u.data.name+"()":u.name;function w(v,B,S){return it.flush().then(function(){if(!u.fireAndForget&&!Yt(a))try{return Bi(a,l,{id:ie(),origin:K(window),type:"postrobot_message_response",hash:u.hash,name:u.name,ack:v,data:B,error:S},{on:f,send:g})}catch(A){throw new Error("Send response message failed for "+_+" in "+K()+`

`+Rn(A))}})}return it.all([it.flush().then(function(){if(!u.fireAndForget&&!Yt(a))try{return Bi(a,l,{id:ie(),origin:K(window),type:"postrobot_message_ack",hash:u.hash,name:u.name},{on:f,send:g})}catch(v){throw new Error("Send ack message failed for "+_+" in "+K()+`

`+Rn(v))}}),it.try(function(){if(!b)throw new Error("No handler found for post message: "+u.name+" from "+l+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return b.handler({source:a,origin:l,data:u.data})}).then(function(v){return w("success",v)},function(v){return w("error",null,v)})]).then(Je).catch(function(v){if(b&&b.handleError)return b.handleError(v);throw v})}function ou(a,l,u){if(!co(u.hash)){var d=oo(u.hash);if(!d)throw new Error("No handler found for post message ack for message: "+u.name+" from "+l+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!cn(d.domain,l))throw new Error("Ack origin "+l+" does not match domain "+d.domain.toString());if(a!==d.win)throw new Error("Ack source does not match registered window")}catch(f){d.promise.reject(f)}d.ack=!0}}function au(a,l,u){if(!co(u.hash)){var d=oo(u.hash);if(!d)throw new Error("No handler found for post message response for message: "+u.name+" from "+l+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!cn(d.domain,l))throw new Error("Response origin "+l+" does not match domain "+(f=d.domain,Array.isArray(f)?"("+f.join(" | ")+")":s(f)?"RegExp("+f.toString()+")":f.toString()));var f;if(a!==d.win)throw new Error("Response source does not match registered window");ao(u.hash),u.ack==="error"?d.promise.reject(u.error):u.ack==="success"&&d.promise.resolve({source:a,origin:l,data:u.data})}}function lo(a,l){var u=l.on,d=l.send,f=wt("receivedMessages");try{if(!window||window.closed||!a.source)return}catch{return}var g=a.source,b=a.origin,_=function(B,S,A,O){var V=O.on,j=O.send,z;try{z=so(S,A,B,{on:V,send:j})}catch{return}if(z&&typeof z=="object"&&z!==null){var at=z.__post_robot_10_0_46__;if(Array.isArray(at))return at}}(a.data,g,b,{on:u,send:d});if(_){Xs(g);for(var w=0;w<_.length;w++){var v=_[w];if(f.has(v.id)||(f.set(v.id,!0),Yt(g)&&!v.fireAndForget))return;v.origin.indexOf("file:")===0&&(b="file://");try{v.type==="postrobot_message_request"?su(g,b,v,{on:u,send:d}):v.type==="postrobot_message_response"?au(g,b,v):v.type==="postrobot_message_ack"&&ou(g,b,v)}catch(B){setTimeout(function(){throw B},0)}}}}function Ne(a,l,u){if(!a)throw new Error("Expected name");if(typeof(l=l||{})=="function"&&(u=l,l={}),!u)throw new Error("Expected handler");var d=function f(g,b){var _=g.name,w=g.win,v=g.domain,B=Ft("requestListeners");if(!_||typeof _!="string")throw new Error("Name required to add request listener");if(w&&w!=="*"&&Pt.isProxyWindow(w)){var S=w.awaitWindow().then(function(yt){return f({name:_,win:yt,domain:v},b)});return{cancel:function(){S.then(function(yt){return yt.cancel()},Je)}}}var A=w;if(Array.isArray(A)){for(var O=[],V=0,j=A;V<j.length;V++)O.push(f({name:_,domain:v,win:j[V]},b));return{cancel:function(){for(var yt=0;yt<O.length;yt++)O[yt].cancel()}}}if(Array.isArray(v)){for(var z=[],at=0,gt=v;at<gt.length;at++)z.push(f({name:_,win:A,domain:gt[at]},b));return{cancel:function(){for(var yt=0;yt<z.length;yt++)z[yt].cancel()}}}var lt=uo({name:_,win:A,domain:v});A&&A!=="*"||(A=pr());var ct=(v=v||"*").toString();if(lt)throw A&&v?new Error("Request listener already exists for "+_+" on domain "+v.toString()+" for "+(A===pr()?"wildcard":"specified")+" window"):A?new Error("Request listener already exists for "+_+" for "+(A===pr()?"wildcard":"specified")+" window"):v?new Error("Request listener already exists for "+_+" on domain "+v.toString()):new Error("Request listener already exists for "+_);var _t=B.getOrSet(A,function(){return{}}),G=Cn(_t,_,function(){return{}}),dt,Ht;return vi(v)?(dt=Cn(G,"__domain_regex__",function(){return[]})).push(Ht={regex:v,listener:b}):G[ct]=b,{cancel:function(){delete G[ct],Ht&&(dt.splice(dt.indexOf(Ht,1)),dt.length||delete G.__domain_regex__),Object.keys(G).length||delete _t[_],A&&!Object.keys(_t).length&&B.del(A)}}}({name:a,win:l.window,domain:l.domain||"*"},{handler:u||l.handler,handleError:l.errorHandler||function(f){throw f}});return{cancel:function(){d.cancel()}}}function cu(a,l,u){typeof(l=l||{})=="function"&&(u=l,l={});var d=new it,f;return l.errorHandler=function(g){f.cancel(),d.reject(g)},f=Ne(a,l,function(g){if(f.cancel(),d.resolve(g),u)return u(g)}),d.cancel=f.cancel,d}var Ee=function a(l,u,d,f){var g=(f=f||{}).domain||"*",b=f.timeout||-1,_=f.timeout||5e3,w=f.fireAndForget||!1;return Pt.toProxyWindow(l,{send:a}).awaitWindow().then(function(v){return it.try(function(){if(function(B,S,A){if(!B)throw new Error("Expected name");if(A&&typeof A!="string"&&!Array.isArray(A)&&!vi(A))throw new TypeError("Can not send "+B+". Expected domain "+JSON.stringify(A)+" to be a string, array, or regex");if(Yt(S))throw new Error("Can not send "+B+". Target window is closed")}(u,v,g),function(B,S){var A=Us(S);if(A)return A===B;if(S===B||function(j){j===void 0&&(j=window);try{if(j.top)return j.top}catch{}if(m(j)===j)return j;try{if(ve(window,j)&&window.top)return window.top}catch{}try{if(ve(j,window)&&window.top)return window.top}catch{}for(var z=0,at=function lt(ct){for(var _t=[],G=0,dt=ur(ct);G<dt.length;G++){var Ht=dt[G];_t.push(Ht);for(var yt=0,Pn=lt(Ht);yt<Pn.length;yt++)_t.push(Pn[yt])}return _t}(j);z<at.length;z++){var gt=at[z];try{if(gt.top)return gt.top}catch{}if(m(gt)===gt)return gt}}(S)===S)return!1;for(var O=0,V=ur(B);O<V.length;O++)if(V[O]===S)return!0;return!1}(window,v))return function(B,S,A){S===void 0&&(S=5e3),A===void 0&&(A="Window");var O=function(V){return Ft("helloPromises").getOrSet(V,function(){return new it})}(B);return S!==-1&&(O=O.timeout(S,new Error(A+" did not load after "+S+"ms"))),O}(v,_)}).then(function(B){return function(S,A,O,V){var j=V.send;return it.try(function(){return typeof A=="string"?A:it.try(function(){return O||wi(S,{send:j}).then(function(z){return z.domain})}).then(function(z){if(!cn(A,A))throw new Error("Domain "+Ys(A)+" does not match "+Ys(A));return z})})}(v,g,(B===void 0?{}:B).domain,{send:a})}).then(function(B){var S=B,A=u==="postrobot_method"&&d&&typeof d.name=="string"?d.name+"()":u,O=new it,V=u+"_"+ie();if(!w){var j={name:u,win:v,domain:S,promise:O};(function(G,dt){wt("responseListeners").set(G,dt)})(V,j);var z=Ft("requestPromises").getOrSet(v,function(){return[]});z.push(O),O.catch(function(){(function(G){wt("erroredResponseListeners").set(G,!0)})(V),ao(V)});var at=function(G){return Ft("knownWindows").get(G,!1)}(v)?1e4:2e3,gt=b,lt=at,ct=gt,_t=function(G,dt){var Ht;return function yt(){Ht=setTimeout(function(){(function(){if(Yt(v))return O.reject(new Error("Window closed for "+u+" before "+(j.ack?"response":"ack")));if(j.cancelled)return O.reject(new Error("Response listener was cancelled for "+u));lt=Math.max(lt-500,0),ct!==-1&&(ct=Math.max(ct-500,0)),j.ack||lt!==0?ct===0&&O.reject(new Error("No response for postMessage "+A+" in "+K()+" in "+gt+"ms")):O.reject(new Error("No ack for postMessage "+A+" in "+K()+" in "+at+"ms"))})(),yt()},500)}(),{cancel:function(){clearTimeout(Ht)}}}();O.finally(function(){_t.cancel(),z.splice(z.indexOf(O,1))}).catch(Je)}return Bi(v,S,{id:ie(),origin:K(window),type:"postrobot_message_request",hash:V,name:u,data:d,fireAndForget:w},{on:Ne,send:a}).then(function(){return w?O.resolve():O},function(G){throw new Error("Send request message failed for "+A+" in "+K()+`

`+Rn(G))})})})};function uu(a,l,u){return io(a,l,u,{on:Ne,send:Ee})}function lu(a,l,u){return so(a,l,u,{on:Ne,send:Ee})}function du(a){return new Pt({send:Ee,win:a})}function hu(a){return Pt.toProxyWindow(a,{send:Ee})}function ho(){Un().initialized||(Un().initialized=!0,l=(a={on:Ne,send:Ee}).on,u=a.send,(d=Un()).receiveMessage=d.receiveMessage||function(f){return lo(f,{on:l,send:u})},function(f){var g=f.on,b=f.send;wt().getOrSet("postMessageListener",function(){return function(_,w,v){return _.addEventListener("message",v),{cancel:function(){_.removeEventListener("message",v)}}}(window,0,function(_){(function(w,v){var B=v.on,S=v.send;it.try(function(){var A=w.source||w.sourceElement,O=w.origin||w.originalEvent&&w.originalEvent.origin,V=w.data;if(O==="null"&&(O="file://"),A){if(!O)throw new Error("Post message did not have origin domain");lo({source:A,origin:O,data:V},{on:B,send:S})}})})(_,{on:g,send:b})})})}({on:Ne,send:Ee}),function(f){var g=f.on,b=f.send;wt("builtinListeners").getOrSet("helloListener",function(){var _=g("postrobot_hello",{domain:"*"},function(v){return Zs(v.source,{domain:v.origin}),{instanceID:qs()}}),w=Us();return w&&wi(w,{send:b}).catch(function(v){}),_})}({on:Ne,send:Ee}));var a,l,u,d}function fu(){(function(){for(var l=wt("responseListeners"),u=0,d=l.keys();u<d.length;u++){var f=d[u],g=l.get(f);g&&(g.cancelled=!0),l.del(f)}})(),(a=wt().get("postMessageListener"))&&a.cancel();var a;delete window.__post_robot_10_0_46__}var pu=!0;function yu(a){for(var l=0,u=Ft("requestPromises").get(a,[]);l<u.length;l++)u[l].reject(new Error("Window "+(Yt(a)?"closed":"cleaned up")+" before response")).catch(Je)}ho()}])})})(Vc);var Rh=Vc.exports;(function(n){n.exports=Rh,n.exports.default=n.exports})(Wc);var Ch=Wc.exports;const Uh=Uo(Ch);var Ph=function(n,t,e,r){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function c(m){try{y(r.next(m))}catch(I){o(I)}}function h(m){try{y(r.throw(m))}catch(I){o(I)}}function y(m){m.done?s(m.value):i(m.value).then(c,h)}y((r=r.apply(n,t||[])).next())})};const kh=(n,t)=>Ph(void 0,void 0,void 0,function*(){var e,r;let i=0;const s=(e=t==null?void 0:t.maxAttempts)!==null&&e!==void 0?e:3,o=(r=t==null?void 0:t.retryInterval)!==null&&r!==void 0?r:1e3;for(;;){i+=1;try{return yield n()}catch(c){throw i<s&&(yield new Promise(h=>setTimeout(h,o))),c}}}),$c=(n,t)=>{const e={};return t.forEach(r=>{e[r]=`${n}:${r}`}),e},jh=$c("octostar:post-messages",["get_api"]),Ri=$c("octostar:api-names",["desktop","ontology","context"]);var zh=function(n,t,e,r){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function c(m){try{y(r.next(m))}catch(I){o(I)}}function h(m){try{y(r.throw(m))}catch(I){o(I)}}function y(m){m.done?s(m.value):i(m.value).then(c,h)}y((r=r.apply(n,t||[])).next())})};const Wh=n=>n.parent!==n,Vh=n=>{let t=n;for(;Wh(t);)t=t.parent;return t},$h=n=>{if(n.data.error)throw new Error(n.data.error.message);return n.data.data},Yh=(n,t)=>new Proxy(n,{get:(e,r)=>typeof e[r]=="function"?new Proxy(e[r],{apply:(i,s,o)=>{const c=i(...o),h=c instanceof Promise,y=typeof(c==null?void 0:c.then)=="function"&&typeof(c==null?void 0:c.catch)=="function";return h||y?c.catch(m=>{const I=`${t.name}.${r}()`,F=new Error(`Error calling ${I}: ${m.message}`);throw F.stack=`at ${I}: ${m.stack}`,F.originalError=m,F}):c}}):e[r]}),Ci=n=>zh(void 0,void 0,void 0,function*(){const t=Vh(window),e=yield kh(()=>Uh.send(t,jh.get_api,n),{maxAttempts:5,retryInterval:2e3}),r=$h(e);return Yh(r,{name:n.name})}),Yc=n=>new Proxy({},{get:(t,e)=>new Proxy(()=>{},{apply:(r,i,s)=>n.then(o=>o[e](...s))})}),Hc=Xn.getInstance("platform-api",{cache:!1}).registerService("desktop",()=>Ci({name:Ri.desktop})).registerService("ontology",()=>Ci({name:Ri.ontology})).registerService("context",()=>Ci({name:Ri.context})),T=()=>Yc(Hc.getService("desktop")),It=()=>Yc(Hc.getService("ontology")),jn=n=>typeof n=="object"&&n!==null&&"id"in n&&Object.keys(n).length===1,Br=n=>n===null,D=n=>n??void 0,Hh={refresh:()=>T().refresh(),openWorkspace:n=>T().openWorkspace(jn(n)?n.id:n),getActiveWorkspace:n=>T().getActiveWorkspace(n.prompt),setActiveWorkspace:n=>T().setActiveWorkspace(n.id),closeWorkspace:n=>T().closeWorkspace(jn(n)?n.id:n),copy:n=>T().copy(n.source,n.target),listAllWorkspaces:()=>T().listAllWorkspaces(),getOpenWorkspaces:()=>T().getOpenWorkspaces(),getAttachment:n=>T().getAttachment(n.entity,D(n.options)),getStylerOptions:()=>T().getStylerOptions(),getStyler:n=>T().getStyler(n.name,n.context),getWorkspace:n=>T().getWorkspace(jn(n)?n.id:n),getWorkspaceItems:n=>T().getWorkspaceItems(n.os_item_name),applyTag:n=>T().applyTag(n.os_workspace,n.tag,n.entity),removeTag:n=>T().removeTag(n.os_workspace,n.tag,n.entity),updateTag:n=>T().updateTag(n.tag),getItem:n=>T().getItem(jn(n)?n.id:n),getItems:n=>T().getItems(n.map(t=>jn(t)?t.id:t)),getTags:n=>T().getTags(n),getAvailableTags:n=>T().getAvailableTags(n.entity,D(n.workspace)),getTemplates:()=>T().getTemplates(),getTemplate:n=>T().getTemplate(n.name,D(n.defaultTemplate)),getSchemaItems:n=>T().getSchemaItems(n.os_item_content_type),createWorkspace:n=>T().createWorkspace(n.name),connect:n=>T().connect(n.relationship,n.from_entity,n.to_entity,D(n.os_workspace)),save:n=>T().save(n.item,D(n.options)),saveFile:n=>T().saveFile(n.item,n.file,D(n.options)),import:n=>T().import(n.items),importZip:n=>T().importZip(n.file,D(n.options)),export:n=>T().export(n.item,D(n.options)),getFilesTree:n=>T().getFilesTree(n.workspace_or_folder,D(n.options)),open:n=>T().open(n.records,D(n.options)),delete:n=>T().delete(n.item,D(n.recurse)),searchXperience:n=>T().searchXperience({taskID:D(n.taskID),title:D(n.title),defaultConcept:D(n.defaultConcept),disableConceptSelector:D(n.disableConceptSelector),defaultSearchFields:Br(n.defaultSearchFields)?void 0:{entity_label:D(n.defaultSearchFields.entity_label),os_textsearchfield:D(n.defaultSearchFields.os_textsearchfield)}}),showTab:n=>T().showTab({app:n.app,item:D(n.item),options:D(n.options)}),closeTab:n=>T().closeTab({app:n.app,item:D(n.item),options:D(n.options)}),callAppService:n=>T().callAppService({service:n.service,context:n.context,options:D(n.options)}),showContextMenu:n=>n&&typeof n=="object"&&"clearContextMenu"in n?T().showContextMenu({clearContextMenu:n.clearContextMenu}):T().showContextMenu({concept:D(n.concept),graph:D(n.graph),item:D(n.item),items:D(n.items),workspace:Br(n.workspace)?void 0:{workspace:n.workspace.workspace,items:n.workspace.items,workspace_records:D(n.workspace.workspace_records),tags:D(n.workspace.tags),permission:D(n.workspace.permission),isActive:D(n.workspace.isActive)},dataTransfer:D(n.dataTransfer),eventTopicPrefix:D(n.eentTopicPrefix),then:D(n.then),x:n.x,y:n.y,openContextMenu:D(n.openContextMenu),onCloseEmit:D(n.onCloseEmit),options:Br(n.options)?void 0:{mode:D(n.options.mode),groups:D(n.options.groups),labels:D(n.options.labels),extras:D(n.options.extras)}}),showToast:n=>T().showToast({message:n.message,id:D(n.id),description:D(n.description),level:D(n.level),placement:D(n.placement)}),clearToast:n=>T().clearToast(n.id),showProgress:n=>T().showProgress({key:n.key,label:D(n.label),job_type:D(n.job_type),status:D(n.status)}),showConfirm:n=>T().showConfirm({title:n.title,icon:D(n.icon),content:D(n.content),okText:D(n.okText),okButtonProps:D(n.okButtonProps),cancelText:D(n.cancelText),taskID:D(n.taskID)}),showFileUpload:n=>T().showFileUpload(n),showCreateEntityForm:n=>T().showCreateEntityForm({os_workspace:n.os_workspace,concept:D(n.concept)}),addComment:n=>T().addComment(n.about,{os_workspace:n.comment.os_workspace,contents:n.comment.contents,os_parent_uid:D(n.comment.os_parent_uid),slug:D(n.comment.slug)}),removeComment:n=>T().removeComment(n.os_workspace,n.comment_id),addWatchIntent:n=>T().addWatchIntent(n.entity,n.watcher),removeWatchIntent:n=>T().removeWatchIntent(n.os_workspace,n.intent_id),getWorkspacePermission:n=>T().getWorkspacePermission(n.os_workspace),getUser:()=>T().getUser(),deployApp:n=>T().deployApp(n.app),undeployApp:n=>T().undeployApp(n.app),whoami:()=>T().whoami()},Jh=n=>{const t=Hh[n.method];if(!t)throw new Error(`Unknown method: ${n.method}`);return t(n.params)},Gh={cancelQueries:function(n){return It().cancelQueries(n.context)},getAvailableOntologies:function(){return It().getAvailableOntologies()},getWorkspaceRelationshipRecords:function(n){return It().getWorkspaceRelationshipRecords(n.entity,n.relationship)},clearRelationshipCache:function(n){return It().clearRelationshipCache(n.entity,n.relationship)},getConnectedEntities:function(n){return It().getConnectedEntities(n.entity,n.relationship,D(n.force_refresh))},getConceptByName:function(n){return It().getConceptByName(n.concept_name)},getConcepts:function(){return It().getConcepts()},getEntity:function(n){return It().getEntity(n.entity,D(n.refresh),D(n.skip_side_effects))},getOntologyName:function(){return It().getOntologyName()},getRelationshipCount:function(n){return It().getRelationshipCount(n.entity,n.relationship,D(n.force_refresh))},getConceptForEntity:function(n){return It().getConceptForEntity(n.entity)},getRelationshipsForEntity:function(n){return It().getRelationshipsForEntity(n.entity)},sendQuery:function(n){return It().sendQuery(n.query,Br(n.options)?void 0:{context:D(n.options.context),lowPriority:D(n.options.low_priority)})},getSysInheritance:function(){return It().getSysInheritance()},subscribe:function(){throw new Error("Function not implemented.")},consistentUUID:function(n){return It().consistentUUID(n.name,D(n.namespace))}},Kh=n=>{const t=Gh[n.method];if(!t)throw new Error(`Method ${n.method} not found`);return t(n.params)};function qh(n){const t=n.detail;if(console.log(t.args),!t.args)throw new Error("No call definition passed to the component!");const e=t.args.service;switch(e){case"desktop":Promise.resolve(Jh(t.args)).then(r=>{te.setComponentValue(r),te.setFrameHeight()});break;case"ontology":Promise.resolve(Kh(t.args)).then(r=>{te.setComponentValue(r),te.setFrameHeight()});break;default:throw new Error(`Call to an unknown service: ${e}`)}te.setFrameHeight()}te.events.addEventListener(te.RENDER_EVENT,qh);te.setComponentReady();te.setFrameHeight();
