precision-dashwidgets 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/precision-dashwidgets.es.js +2275 -4835
- package/dist/precision-dashwidgets.umd.js +24 -28
- package/package.json +1 -1
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
|
|
3
|
-
* (
|
|
4
|
-
|
|
5
|
-
**/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const ks=()=>{},Ph=Object.prototype.hasOwnProperty,Wa=(e,t)=>Ph.call(e,t),kh=Array.isArray,ei=e=>typeof e=="function",Vh=e=>typeof e=="string",Vs=e=>e!==null&&typeof e=="object";var zh=typeof global=="object"&&global&&global.Object===Object&&global,jh=typeof self=="object"&&self&&self.Object===Object&&self,zs=zh||jh||Function("return this")(),We=zs.Symbol,Ga=Object.prototype,Yh=Ga.hasOwnProperty,qh=Ga.toString,cr=We?We.toStringTag:void 0;function Wh(e){var t=Yh.call(e,cr),n=e[cr];try{e[cr]=void 0;var r=!0}catch{}var i=qh.call(e);return r&&(t?e[cr]=n:delete e[cr]),i}var Gh=Object.prototype,Hh=Gh.toString;function Kh(e){return Hh.call(e)}var Qh="[object Null]",Jh="[object Undefined]",Ha=We?We.toStringTag:void 0;function js(e){return e==null?e===void 0?Jh:Qh:Ha&&Ha in Object(e)?Wh(e):Kh(e)}function Ys(e){return e!=null&&typeof e=="object"}var Xh="[object Symbol]";function qs(e){return typeof e=="symbol"||Ys(e)&&js(e)==Xh}function Zh(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var ur=Array.isArray,Ka=We?We.prototype:void 0,Qa=Ka?Ka.toString:void 0;function Ja(e){if(typeof e=="string")return e;if(ur(e))return Zh(e,Ja)+"";if(qs(e))return Qa?Qa.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function ni(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function tp(e){return e}var ep="[object AsyncFunction]",np="[object Function]",rp="[object GeneratorFunction]",ip="[object Proxy]";function sp(e){if(!ni(e))return!1;var t=js(e);return t==np||t==rp||t==ep||t==ip}var Ws=zs["__core-js_shared__"],Xa=(function(){var e=/[^.]+$/.exec(Ws&&Ws.keys&&Ws.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function op(e){return!!Xa&&Xa in e}var ap=Function.prototype,lp=ap.toString;function cp(e){if(e!=null){try{return lp.call(e)}catch{}try{return e+""}catch{}}return""}var up=/[\\^$.*+?()[\]{}|]/g,dp=/^\[object .+?Constructor\]$/,fp=Function.prototype,hp=Object.prototype,pp=fp.toString,yp=hp.hasOwnProperty,mp=RegExp("^"+pp.call(yp).replace(up,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gp(e){if(!ni(e)||op(e))return!1;var t=sp(e)?mp:dp;return t.test(cp(e))}function bp(e,t){return e?.[t]}function Gs(e,t){var n=bp(e,t);return gp(n)?n:void 0}function _p(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var vp=800,wp=16,Ip=Date.now;function Ep(e){var t=0,n=0;return function(){var r=Ip(),i=wp-(r-n);if(n=r,i>0){if(++t>=vp)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Sp(e){return function(){return e}}var ri=(function(){try{var e=Gs(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Tp=ri?function(e,t){return ri(e,"toString",{configurable:!0,enumerable:!1,value:Sp(t),writable:!0})}:tp,Ap=Ep(Tp),Op=9007199254740991,Rp=/^(?:0|[1-9]\d*)$/;function Za(e,t){var n=typeof e;return t=t??Op,!!t&&(n=="number"||n!="symbol"&&Rp.test(e))&&e>-1&&e%1==0&&e<t}function Np(e,t,n){t=="__proto__"&&ri?ri(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function tl(e,t){return e===t||e!==e&&t!==t}var Bp=Object.prototype,Dp=Bp.hasOwnProperty;function Fp(e,t,n){var r=e[t];(!(Dp.call(e,t)&&tl(r,n))||n===void 0&&!(t in e))&&Np(e,t,n)}var el=Math.max;function $p(e,t,n){return t=el(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=el(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),_p(e,this,a)}}var Lp=9007199254740991;function Cp(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Lp}var Mp="[object Arguments]";function nl(e){return Ys(e)&&js(e)==Mp}var rl=Object.prototype,xp=rl.hasOwnProperty,Up=rl.propertyIsEnumerable,il=nl((function(){return arguments})())?nl:function(e){return Ys(e)&&xp.call(e,"callee")&&!Up.call(e,"callee")},Pp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kp=/^\w*$/;function Vp(e,t){if(ur(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||qs(e)?!0:kp.test(e)||!Pp.test(e)||t!=null&&e in Object(t)}var dr=Gs(Object,"create");function zp(){this.__data__=dr?dr(null):{},this.size=0}function jp(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Yp="__lodash_hash_undefined__",qp=Object.prototype,Wp=qp.hasOwnProperty;function Gp(e){var t=this.__data__;if(dr){var n=t[e];return n===Yp?void 0:n}return Wp.call(t,e)?t[e]:void 0}var Hp=Object.prototype,Kp=Hp.hasOwnProperty;function Qp(e){var t=this.__data__;return dr?t[e]!==void 0:Kp.call(t,e)}var Jp="__lodash_hash_undefined__";function Xp(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=dr&&t===void 0?Jp:t,this}function ln(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ln.prototype.clear=zp,ln.prototype.delete=jp,ln.prototype.get=Gp,ln.prototype.has=Qp,ln.prototype.set=Xp;function Zp(){this.__data__=[],this.size=0}function ii(e,t){for(var n=e.length;n--;)if(tl(e[n][0],t))return n;return-1}var ty=Array.prototype,ey=ty.splice;function ny(e){var t=this.__data__,n=ii(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():ey.call(t,n,1),--this.size,!0}function ry(e){var t=this.__data__,n=ii(t,e);return n<0?void 0:t[n][1]}function iy(e){return ii(this.__data__,e)>-1}function sy(e,t){var n=this.__data__,r=ii(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Nn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Nn.prototype.clear=Zp,Nn.prototype.delete=ny,Nn.prototype.get=ry,Nn.prototype.has=iy,Nn.prototype.set=sy;var oy=Gs(zs,"Map");function ay(){this.size=0,this.__data__={hash:new ln,map:new(oy||Nn),string:new ln}}function ly(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function si(e,t){var n=e.__data__;return ly(t)?n[typeof t=="string"?"string":"hash"]:n.map}function cy(e){var t=si(this,e).delete(e);return this.size-=t?1:0,t}function uy(e){return si(this,e).get(e)}function dy(e){return si(this,e).has(e)}function fy(e,t){var n=si(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function cn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}cn.prototype.clear=ay,cn.prototype.delete=cy,cn.prototype.get=uy,cn.prototype.has=dy,cn.prototype.set=fy;var hy="Expected a function";function Hs(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(hy);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=e.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(Hs.Cache||cn),n}Hs.Cache=cn;var py=500;function yy(e){var t=Hs(e,function(r){return n.size===py&&n.clear(),r}),n=t.cache;return t}var my=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gy=/\\(\\)?/g,by=yy(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(my,function(n,r,i,s){t.push(i?s.replace(gy,"$1"):r||n)}),t});function _y(e){return e==null?"":Ja(e)}function oi(e,t){return ur(e)?e:Vp(e,t)?[e]:by(_y(e))}function Ks(e){if(typeof e=="string"||qs(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function vy(e,t){t=oi(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ks(t[n++])];return n&&n==r?e:void 0}function wy(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var sl=We?We.isConcatSpreadable:void 0;function Iy(e){return ur(e)||il(e)||!!(sl&&e&&e[sl])}function Ey(e,t,n,r,i){var s=-1,o=e.length;for(n||(n=Iy),i||(i=[]);++s<o;){var a=e[s];n(a)?wy(i,a):i[i.length]=a}return i}function Sy(e){var t=e==null?0:e.length;return t?Ey(e):[]}function Ty(e){return Ap($p(e,void 0,Sy),e+"")}function Ay(e,t){return e!=null&&t in Object(e)}function Oy(e,t,n){t=oi(t,e);for(var r=-1,i=t.length,s=!1;++r<i;){var o=Ks(t[r]);if(!(s=e!=null&&n(e,o)))break;e=e[o]}return s||++r!=i?s:(i=e==null?0:e.length,!!i&&Cp(i)&&Za(o,i)&&(ur(e)||il(e)))}function Ry(e,t){return e!=null&&Oy(e,t,Ay)}function Qs(e){for(var t=-1,n=e==null?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r}function Js(e){return e==null}function Ny(e){return e===void 0}function By(e,t,n,r){if(!ni(e))return e;t=oi(t,e);for(var i=-1,s=t.length,o=s-1,a=e;a!=null&&++i<s;){var l=Ks(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=o){var d=a[l];c=void 0,c===void 0&&(c=ni(d)?d:Za(t[i+1])?[]:{})}Fp(a,l,c),a=a[l]}return e}function Dy(e,t,n){for(var r=-1,i=t.length,s={};++r<i;){var o=t[r],a=vy(e,o);n(a,o)&&By(s,oi(o,e),a)}return s}function Fy(e,t){return Dy(e,t,function(n,r){return Ry(e,r)})}var $y=Ty(function(e,t){return e==null?{}:Fy(e,t)});const ol=e=>typeof e=="boolean",ai=e=>typeof e=="number",un=e=>typeof Element>"u"?!1:e instanceof Element;var Ly=Object.defineProperty,Cy=Object.defineProperties,My=Object.getOwnPropertyDescriptors,al=Object.getOwnPropertySymbols,xy=Object.prototype.hasOwnProperty,Uy=Object.prototype.propertyIsEnumerable,ll=(e,t,n)=>t in e?Ly(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Py=(e,t)=>{for(var n in t||(t={}))xy.call(t,n)&&ll(e,n,t[n]);if(al)for(var n of al(t))Uy.call(t,n)&&ll(e,n,t[n]);return e},ky=(e,t)=>Cy(e,My(t));function cl(e,t){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=e()},ky(Py({},t),{flush:(n=void 0)!=null?n:"sync"})),u.readonly(r)}var ul;const fe=typeof window<"u",Vy=e=>typeof e=="string",dl=()=>{},zy=fe&&((ul=window?.navigator)==null?void 0:ul.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function fl(e){return typeof e=="function"?e():u.unref(e)}function jy(e){return e}function hl(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}function dn(e){var t;const n=fl(e);return(t=n?.$el)!=null?t:n}const pl=fe?window:void 0;function Xs(...e){let t,n,r,i;if(Vy(e[0])||Array.isArray(e[0])?([n,r,i]=e,t=pl):[t,n,r,i]=e,!t)return dl;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const s=[],o=()=>{s.forEach(d=>d()),s.length=0},a=(d,f,h,y)=>(d.addEventListener(f,h,y),()=>d.removeEventListener(f,h,y)),l=u.watch(()=>[dn(t),fl(i)],([d,f])=>{o(),d&&s.push(...n.flatMap(h=>r.map(y=>a(d,h,y,f))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return hl(c),c}let yl=!1;function Yy(e,t,n={}){const{window:r=pl,ignore:i=[],capture:s=!0,detectIframe:o=!1}=n;if(!r)return;zy&&!yl&&(yl=!0,Array.from(r.document.body.children).forEach(h=>h.addEventListener("click",dl)));let a=!0;const l=h=>i.some(y=>{if(typeof y=="string")return Array.from(r.document.querySelectorAll(y)).some(m=>m===h.target||h.composedPath().includes(m));{const m=dn(y);return m&&(h.target===m||h.composedPath().includes(m))}}),d=[Xs(r,"click",h=>{const y=dn(e);if(!(!y||y===h.target||h.composedPath().includes(y))){if(h.detail===0&&(a=!l(h)),!a){a=!0;return}t(h)}},{passive:!0,capture:s}),Xs(r,"pointerdown",h=>{const y=dn(e);y&&(a=!h.composedPath().includes(y)&&!l(h))},{passive:!0}),o&&Xs(r,"blur",h=>{var y;const m=dn(e);((y=r.document.activeElement)==null?void 0:y.tagName)==="IFRAME"&&!m?.contains(r.document.activeElement)&&t(h)})].filter(Boolean);return()=>d.forEach(h=>h())}const ml=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},gl="__vueuse_ssr_handlers__";ml[gl]=ml[gl]||{};var bl;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(bl||(bl={}));var qy=Object.defineProperty,_l=Object.getOwnPropertySymbols,Wy=Object.prototype.hasOwnProperty,Gy=Object.prototype.propertyIsEnumerable,vl=(e,t,n)=>t in e?qy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hy=(e,t)=>{for(var n in t||(t={}))Wy.call(t,n)&&vl(e,n,t[n]);if(_l)for(var n of _l(t))Gy.call(t,n)&&vl(e,n,t[n]);return e};Hy({linear:jy},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});const wl={current:0},Il=u.ref(0),Ky=2e3,El=Symbol("elZIndexContextKey"),Qy=Symbol("zIndexContextKey"),Jy=e=>{const t=u.getCurrentInstance()?u.inject(El,wl):wl,n=u.getCurrentInstance()?u.inject(Qy,void 0):void 0,r=u.computed(()=>{const o=u.unref(n);return ai(o)?o:Ky}),i=u.computed(()=>r.value+Il.value),s=()=>(t.current++,Il.value=t.current,i.value);return!fe&&u.inject(El),{initialZIndex:r,currentZIndex:i,nextZIndex:s}},Sl="__epPropKey",vt=e=>e,Xy=e=>Vs(e)&&!!e[Sl],Zs=(e,t)=>{if(!Vs(e)||Xy(e))return e;const{values:n,required:r,default:i,type:s,validator:o}=e,l={type:s,required:!!r,validator:n||o?c=>{let d=!1,f=[];if(n&&(f=Array.from(n),Wa(e,"default")&&f.push(i),d||(d=f.includes(c))),o&&(d||(d=o(c))),!d&&f.length>0){const h=[...new Set(f)].map(y=>JSON.stringify(y)).join(", ");u.warn(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${h}], got value ${JSON.stringify(c)}.`)}return d}:void 0,[Sl]:!0};return Wa(e,"default")&&(l.default=i),l},ie=e=>Qs(Object.entries(e).map(([t,n])=>[t,Zs(n,t)]));var Ne=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n};const to=(e,t)=>(e.install=n=>{for(const r of[e,...Object.values({})])n.component(r.name,r)},e);function Tl(){let e;const t=(r,i)=>{n(),e=window.setTimeout(r,i)},n=()=>window.clearTimeout(e);return hl(()=>n()),{registerTimeout:t,cancelTimeout:n}}const Zy=ie({showAfter:{type:Number,default:0},hideAfter:{type:Number,default:200},autoClose:{type:Number,default:0}}),tm=({showAfter:e,hideAfter:t,autoClose:n,open:r,close:i})=>{const{registerTimeout:s}=Tl(),{registerTimeout:o,cancelTimeout:a}=Tl();return{onOpen:d=>{s(()=>{r(d);const f=u.unref(n);ai(f)&&f>0&&o(()=>{i(d)},f)},u.unref(e))},onClose:d=>{a(),s(()=>{i(d)},u.unref(t))}}};/*! Element Plus Icons Vue v2.3.2 */var em=u.defineComponent({name:"InfoFilled",__name:"info-filled",setup(e){return(t,n)=>(u.openBlock(),u.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[u.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),Al=em;const nm=ie({ariaLabel:String,ariaOrientation:{type:String,values:["horizontal","vertical","undefined"]},ariaControls:String}),Ol=e=>$y(nm,e),Rl={prefix:Math.floor(Math.random()*1e4),current:0},rm=Symbol("elIdInjection"),Nl=()=>u.getCurrentInstance()?u.inject(rm,Rl):Rl,im=e=>{const t=Nl(),n=Ps();return cl(()=>u.unref(e)||`${n.value}-id-${t.prefix}-${t.current++}`)},Bl=Symbol("formItemContextKey"),eo=e=>{if(e.tabIndex>0||e.tabIndex===0&&e.getAttribute("tabIndex")!==null)return!0;if(e.tabIndex<0||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true")return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return!(e.type==="hidden"||e.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}},no=Symbol("popper"),Dl=Symbol("popperContent"),Fl=ie({role:{type:String,values:["dialog","grid","group","listbox","menu","navigation","tooltip","tree"],default:"tooltip"}}),sm=u.defineComponent({name:"ElPopper",inheritAttrs:!1}),om=u.defineComponent({...sm,props:Fl,setup(e,{expose:t}){const n=e,r=u.ref(),i=u.ref(),s=u.ref(),o=u.ref(),a=u.computed(()=>n.role),l={triggerRef:r,popperInstanceRef:i,contentRef:s,referenceRef:o,role:a};return t(l),u.provide(no,l),(c,d)=>u.renderSlot(c.$slots,"default")}});var am=Ne(om,[["__file","popper.vue"]]);const lm=u.defineComponent({name:"ElPopperArrow",inheritAttrs:!1}),cm=u.defineComponent({...lm,setup(e,{expose:t}){const n=Rn("popper"),{arrowRef:r,arrowStyle:i}=u.inject(Dl,void 0);return u.onBeforeUnmount(()=>{r.value=void 0}),t({arrowRef:r}),(s,o)=>(u.openBlock(),u.createElementBlock("span",{ref_key:"arrowRef",ref:r,class:u.normalizeClass(u.unref(n).e("arrow")),style:u.normalizeStyle(u.unref(i)),"data-popper-arrow":""},null,6))}});var um=Ne(cm,[["__file","arrow.vue"]]);const $l=ie({virtualRef:{type:vt(Object)},virtualTriggering:Boolean,onMouseenter:{type:vt(Function)},onMouseleave:{type:vt(Function)},onClick:{type:vt(Function)},onKeydown:{type:vt(Function)},onFocus:{type:vt(Function)},onBlur:{type:vt(Function)},onContextmenu:{type:vt(Function)},id:String,open:Boolean}),Ll=Symbol("elForwardRef"),dm=e=>{const t=n=>{e.value=n};u.provide(Ll,{setForwardRef:t})},fm=e=>({mounted(t){e(t)},updated(t){e(t)},unmounted(){e(null)}}),hm=u.defineComponent({name:"ElOnlyChild",setup(e,{slots:t,attrs:n}){var r;const i=u.inject(Ll),s=fm((r=i?.setForwardRef)!=null?r:ks);return()=>{var o;const a=(o=t.default)==null?void 0:o.call(t,n);if(!a||a.length>1)return null;const l=Cl(a);return l?u.withDirectives(u.cloneVNode(l,n),[[s]]):null}}});function Cl(e){if(!e)return null;const t=e;for(const n of t){if(Vs(n))switch(n.type){case u.Comment:continue;case u.Text:case"svg":return Ml(n);case u.Fragment:return Cl(n.children);default:return n}return Ml(n)}return null}function Ml(e){const t=Rn("only-child");return u.createVNode("span",{class:t.e("content")},[e])}const pm=u.defineComponent({name:"ElPopperTrigger",inheritAttrs:!1}),ym=u.defineComponent({...pm,props:$l,setup(e,{expose:t}){const n=e,{role:r,triggerRef:i}=u.inject(no,void 0);dm(i);const s=u.computed(()=>a.value?n.id:void 0),o=u.computed(()=>{if(r&&r.value==="tooltip")return n.open&&n.id?n.id:void 0}),a=u.computed(()=>{if(r&&r.value!=="tooltip")return r.value}),l=u.computed(()=>a.value?`${n.open}`:void 0);let c;const d=["onMouseenter","onMouseleave","onClick","onKeydown","onFocus","onBlur","onContextmenu"];return u.onMounted(()=>{u.watch(()=>n.virtualRef,f=>{f&&(i.value=dn(f))},{immediate:!0}),u.watch(i,(f,h)=>{c?.(),c=void 0,un(f)&&(d.forEach(y=>{var m;const b=n[y];b&&(f.addEventListener(y.slice(2).toLowerCase(),b),(m=h?.removeEventListener)==null||m.call(h,y.slice(2).toLowerCase(),b))}),eo(f)&&(c=u.watch([s,o,a,l],y=>{["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach((m,b)=>{Js(y[b])?f.removeAttribute(m):f.setAttribute(m,y[b])})},{immediate:!0}))),un(h)&&eo(h)&&["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach(y=>h.removeAttribute(y))},{immediate:!0})}),u.onBeforeUnmount(()=>{if(c?.(),c=void 0,i.value&&un(i.value)){const f=i.value;d.forEach(h=>{const y=n[h];y&&f.removeEventListener(h.slice(2).toLowerCase(),y)}),i.value=void 0}}),t({triggerRef:i}),(f,h)=>f.virtualTriggering?u.createCommentVNode("v-if",!0):(u.openBlock(),u.createBlock(u.unref(hm),u.mergeProps({key:0},f.$attrs,{"aria-controls":u.unref(s),"aria-describedby":u.unref(o),"aria-expanded":u.unref(l),"aria-haspopup":u.unref(a)}),{default:u.withCtx(()=>[u.renderSlot(f.$slots,"default")]),_:3},16,["aria-controls","aria-describedby","aria-expanded","aria-haspopup"]))}});var mm=Ne(ym,[["__file","trigger.vue"]]);const ro="focus-trap.focus-after-trapped",io="focus-trap.focus-after-released",gm="focus-trap.focusout-prevented",xl={cancelable:!0,bubbles:!1},bm={cancelable:!0,bubbles:!1},Ul="focusAfterTrapped",Pl="focusAfterReleased",_m=Symbol("elFocusTrap"),so=u.ref(),li=u.ref(0),oo=u.ref(0);let ci=0;const kl=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0||r===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t},Vl=(e,t)=>{for(const n of e)if(!vm(n,t))return n},vm=(e,t)=>{if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1},wm=e=>{const t=kl(e),n=Vl(t,e),r=Vl(t.reverse(),e);return[n,r]},Im=e=>e instanceof HTMLInputElement&&"select"in e,Be=(e,t)=>{if(e&&e.focus){const n=document.activeElement;let r=!1;un(e)&&!eo(e)&&!e.getAttribute("tabindex")&&(e.setAttribute("tabindex","-1"),r=!0),e.focus({preventScroll:!0}),oo.value=window.performance.now(),e!==n&&Im(e)&&t&&e.select(),un(e)&&r&&e.removeAttribute("tabindex")}};function zl(e,t){const n=[...e],r=e.indexOf(t);return r!==-1&&n.splice(r,1),n}const Em=()=>{let e=[];return{push:r=>{const i=e[0];i&&r!==i&&i.pause(),e=zl(e,r),e.unshift(r)},remove:r=>{var i,s;e=zl(e,r),(s=(i=e[0])==null?void 0:i.resume)==null||s.call(i)}}},Sm=(e,t=!1)=>{const n=document.activeElement;for(const r of e)if(Be(r,t),document.activeElement!==n)return},jl=Em(),Tm=()=>li.value>oo.value,ui=()=>{so.value="pointer",li.value=window.performance.now()},Yl=()=>{so.value="keyboard",li.value=window.performance.now()},Am=()=>(u.onMounted(()=>{ci===0&&(document.addEventListener("mousedown",ui),document.addEventListener("touchstart",ui),document.addEventListener("keydown",Yl)),ci++}),u.onBeforeUnmount(()=>{ci--,ci<=0&&(document.removeEventListener("mousedown",ui),document.removeEventListener("touchstart",ui),document.removeEventListener("keydown",Yl))}),{focusReason:so,lastUserFocusTimestamp:li,lastAutomatedFocusTimestamp:oo}),di=e=>new CustomEvent(gm,{...bm,detail:e}),fr={tab:"Tab",enter:"Enter",space:"Space",esc:"Escape",numpadEnter:"NumpadEnter"};let Bn=[];const ql=e=>{e.code===fr.esc&&Bn.forEach(t=>t(e))},Om=e=>{u.onMounted(()=>{Bn.length===0&&document.addEventListener("keydown",ql),fe&&Bn.push(e)}),u.onBeforeUnmount(()=>{Bn=Bn.filter(t=>t!==e),Bn.length===0&&fe&&document.removeEventListener("keydown",ql)})},Rm=u.defineComponent({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[Ul,Pl,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=u.ref();let r,i;const{focusReason:s}=Am();Om(m=>{e.trapped&&!o.paused&&t("release-requested",m)});const o={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},a=m=>{if(!e.loop&&!e.trapped||o.paused)return;const{code:b,altKey:w,ctrlKey:v,metaKey:B,currentTarget:O,shiftKey:D}=m,{loop:T}=e,A=b===fr.tab&&!w&&!v&&!B,R=document.activeElement;if(A&&R){const $=O,[L,tt]=wm($);if(L&&tt){if(!D&&R===tt){const X=di({focusReason:s.value});t("focusout-prevented",X),X.defaultPrevented||(m.preventDefault(),T&&Be(L,!0))}else if(D&&[L,$].includes(R)){const X=di({focusReason:s.value});t("focusout-prevented",X),X.defaultPrevented||(m.preventDefault(),T&&Be(tt,!0))}}else if(R===$){const X=di({focusReason:s.value});t("focusout-prevented",X),X.defaultPrevented||m.preventDefault()}}};u.provide(_m,{focusTrapRef:n,onKeydown:a}),u.watch(()=>e.focusTrapEl,m=>{m&&(n.value=m)},{immediate:!0}),u.watch([n],([m],[b])=>{m&&(m.addEventListener("keydown",a),m.addEventListener("focusin",d),m.addEventListener("focusout",f)),b&&(b.removeEventListener("keydown",a),b.removeEventListener("focusin",d),b.removeEventListener("focusout",f))});const l=m=>{t(Ul,m)},c=m=>t(Pl,m),d=m=>{const b=u.unref(n);if(!b)return;const w=m.target,v=m.relatedTarget,B=w&&b.contains(w);e.trapped||v&&b.contains(v)||(r=v),B&&t("focusin",m),!o.paused&&e.trapped&&(B?i=w:Be(i,!0))},f=m=>{const b=u.unref(n);if(!(o.paused||!b))if(e.trapped){const w=m.relatedTarget;!Js(w)&&!b.contains(w)&&setTimeout(()=>{if(!o.paused&&e.trapped){const v=di({focusReason:s.value});t("focusout-prevented",v),v.defaultPrevented||Be(i,!0)}},0)}else{const w=m.target;w&&b.contains(w)||t("focusout",m)}};async function h(){await u.nextTick();const m=u.unref(n);if(m){jl.push(o);const b=m.contains(document.activeElement)?r:document.activeElement;if(r=b,!m.contains(b)){const v=new Event(ro,xl);m.addEventListener(ro,l),m.dispatchEvent(v),v.defaultPrevented||u.nextTick(()=>{let B=e.focusStartEl;Vh(B)||(Be(B),document.activeElement!==B&&(B="first")),B==="first"&&Sm(kl(m),!0),(document.activeElement===b||B==="container")&&Be(m)})}}}function y(){const m=u.unref(n);if(m){m.removeEventListener(ro,l);const b=new CustomEvent(io,{...xl,detail:{focusReason:s.value}});m.addEventListener(io,c),m.dispatchEvent(b),!b.defaultPrevented&&(s.value=="keyboard"||!Tm()||m.contains(document.activeElement))&&Be(r??document.body),m.removeEventListener(io,c),jl.remove(o)}}return u.onMounted(()=>{e.trapped&&h(),u.watch(()=>e.trapped,m=>{m?h():y()})}),u.onBeforeUnmount(()=>{e.trapped&&y(),n.value&&(n.value.removeEventListener("keydown",a),n.value.removeEventListener("focusin",d),n.value.removeEventListener("focusout",f),n.value=void 0)}),{onKeydown:a}}});function Nm(e,t,n,r,i,s){return u.renderSlot(e.$slots,"default",{handleKeydown:e.onKeydown})}var Bm=Ne(Rm,[["render",Nm],["__file","focus-trap.vue"]]),Ct="top",Gt="bottom",Ht="right",Mt="left",ao="auto",hr=[Ct,Gt,Ht,Mt],Dn="start",pr="end",Dm="clippingParents",Wl="viewport",yr="popper",Fm="reference",Gl=hr.reduce(function(e,t){return e.concat([t+"-"+Dn,t+"-"+pr])},[]),lo=[].concat(hr,[ao]).reduce(function(e,t){return e.concat([t,t+"-"+Dn,t+"-"+pr])},[]),$m="beforeRead",Lm="read",Cm="afterRead",Mm="beforeMain",xm="main",Um="afterMain",Pm="beforeWrite",km="write",Vm="afterWrite",zm=[$m,Lm,Cm,Mm,xm,Um,Pm,km,Vm];function he(e){return e?(e.nodeName||"").toLowerCase():null}function se(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Fn(e){var t=se(e).Element;return e instanceof t||e instanceof Element}function Kt(e){var t=se(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function co(e){if(typeof ShadowRoot>"u")return!1;var t=se(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function jm(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},s=t.elements[n];!Kt(s)||!he(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function Ym(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],s=t.attributes[r]||{},o=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Kt(i)||!he(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}var Hl={name:"applyStyles",enabled:!0,phase:"write",fn:jm,effect:Ym,requires:["computeStyles"]};function pe(e){return e.split("-")[0]}var fn=Math.max,fi=Math.min,$n=Math.round;function Ln(e,t){t===void 0&&(t=!1);var n=e.getBoundingClientRect(),r=1,i=1;if(Kt(e)&&t){var s=e.offsetHeight,o=e.offsetWidth;o>0&&(r=$n(n.width)/o||1),s>0&&(i=$n(n.height)/s||1)}return{width:n.width/r,height:n.height/i,top:n.top/i,right:n.right/r,bottom:n.bottom/i,left:n.left/r,x:n.left/r,y:n.top/i}}function uo(e){var t=Ln(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Kl(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&co(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function De(e){return se(e).getComputedStyle(e)}function qm(e){return["table","td","th"].indexOf(he(e))>=0}function Ge(e){return((Fn(e)?e.ownerDocument:e.document)||window.document).documentElement}function hi(e){return he(e)==="html"?e:e.assignedSlot||e.parentNode||(co(e)?e.host:null)||Ge(e)}function Ql(e){return!Kt(e)||De(e).position==="fixed"?null:e.offsetParent}function Wm(e){var t=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,n=navigator.userAgent.indexOf("Trident")!==-1;if(n&&Kt(e)){var r=De(e);if(r.position==="fixed")return null}var i=hi(e);for(co(i)&&(i=i.host);Kt(i)&&["html","body"].indexOf(he(i))<0;){var s=De(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function mr(e){for(var t=se(e),n=Ql(e);n&&qm(n)&&De(n).position==="static";)n=Ql(n);return n&&(he(n)==="html"||he(n)==="body"&&De(n).position==="static")?t:n||Wm(e)||t}function fo(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function gr(e,t,n){return fn(e,fi(t,n))}function Gm(e,t,n){var r=gr(e,t,n);return r>n?n:r}function Jl(){return{top:0,right:0,bottom:0,left:0}}function Xl(e){return Object.assign({},Jl(),e)}function Zl(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var Hm=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Xl(typeof e!="number"?e:Zl(e,hr))};function Km(e){var t,n=e.state,r=e.name,i=e.options,s=n.elements.arrow,o=n.modifiersData.popperOffsets,a=pe(n.placement),l=fo(a),c=[Mt,Ht].indexOf(a)>=0,d=c?"height":"width";if(!(!s||!o)){var f=Hm(i.padding,n),h=uo(s),y=l==="y"?Ct:Mt,m=l==="y"?Gt:Ht,b=n.rects.reference[d]+n.rects.reference[l]-o[l]-n.rects.popper[d],w=o[l]-n.rects.reference[l],v=mr(s),B=v?l==="y"?v.clientHeight||0:v.clientWidth||0:0,O=b/2-w/2,D=f[y],T=B-h[d]-f[m],A=B/2-h[d]/2+O,R=gr(D,A,T),$=l;n.modifiersData[r]=(t={},t[$]=R,t.centerOffset=R-A,t)}}function Qm(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||!Kl(t.elements.popper,i)||(t.elements.arrow=i))}var Jm={name:"arrow",enabled:!0,phase:"main",fn:Km,effect:Qm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Cn(e){return e.split("-")[1]}var Xm={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Zm(e){var t=e.x,n=e.y,r=window,i=r.devicePixelRatio||1;return{x:$n(t*i)/i||0,y:$n(n*i)/i||0}}function tc(e){var t,n=e.popper,r=e.popperRect,i=e.placement,s=e.variation,o=e.offsets,a=e.position,l=e.gpuAcceleration,c=e.adaptive,d=e.roundOffsets,f=e.isFixed,h=o.x,y=h===void 0?0:h,m=o.y,b=m===void 0?0:m,w=typeof d=="function"?d({x:y,y:b}):{x:y,y:b};y=w.x,b=w.y;var v=o.hasOwnProperty("x"),B=o.hasOwnProperty("y"),O=Mt,D=Ct,T=window;if(c){var A=mr(n),R="clientHeight",$="clientWidth";if(A===se(n)&&(A=Ge(n),De(A).position!=="static"&&a==="absolute"&&(R="scrollHeight",$="scrollWidth")),A=A,i===Ct||(i===Mt||i===Ht)&&s===pr){D=Gt;var L=f&&A===T&&T.visualViewport?T.visualViewport.height:A[R];b-=L-r.height,b*=l?1:-1}if(i===Mt||(i===Ct||i===Gt)&&s===pr){O=Ht;var tt=f&&A===T&&T.visualViewport?T.visualViewport.width:A[$];y-=tt-r.width,y*=l?1:-1}}var Q=Object.assign({position:a},c&&Xm),X=d===!0?Zm({x:y,y:b}):{x:y,y:b};if(y=X.x,b=X.y,l){var ot;return Object.assign({},Q,(ot={},ot[D]=B?"0":"",ot[O]=v?"0":"",ot.transform=(T.devicePixelRatio||1)<=1?"translate("+y+"px, "+b+"px)":"translate3d("+y+"px, "+b+"px, 0)",ot))}return Object.assign({},Q,(t={},t[D]=B?b+"px":"",t[O]=v?y+"px":"",t.transform="",t))}function tg(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,o=s===void 0?!0:s,a=n.roundOffsets,l=a===void 0?!0:a,c={placement:pe(t.placement),variation:Cn(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,tc(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,tc(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var ec={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:tg,data:{}},pi={passive:!0};function eg(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,s=i===void 0?!0:i,o=r.resize,a=o===void 0?!0:o,l=se(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(d){d.addEventListener("scroll",n.update,pi)}),a&&l.addEventListener("resize",n.update,pi),function(){s&&c.forEach(function(d){d.removeEventListener("scroll",n.update,pi)}),a&&l.removeEventListener("resize",n.update,pi)}}var nc={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:eg,data:{}},ng={left:"right",right:"left",bottom:"top",top:"bottom"};function yi(e){return e.replace(/left|right|bottom|top/g,function(t){return ng[t]})}var rg={start:"end",end:"start"};function rc(e){return e.replace(/start|end/g,function(t){return rg[t]})}function ho(e){var t=se(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function po(e){return Ln(Ge(e)).left+ho(e).scrollLeft}function ig(e){var t=se(e),n=Ge(e),r=t.visualViewport,i=n.clientWidth,s=n.clientHeight,o=0,a=0;return r&&(i=r.width,s=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(o=r.offsetLeft,a=r.offsetTop)),{width:i,height:s,x:o+po(e),y:a}}function sg(e){var t,n=Ge(e),r=ho(e),i=(t=e.ownerDocument)==null?void 0:t.body,s=fn(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=fn(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+po(e),l=-r.scrollTop;return De(i||n).direction==="rtl"&&(a+=fn(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function yo(e){var t=De(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function ic(e){return["html","body","#document"].indexOf(he(e))>=0?e.ownerDocument.body:Kt(e)&&yo(e)?e:ic(hi(e))}function br(e,t){var n;t===void 0&&(t=[]);var r=ic(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),s=se(r),o=i?[s].concat(s.visualViewport||[],yo(r)?r:[]):r,a=t.concat(o);return i?a:a.concat(br(hi(o)))}function mo(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function og(e){var t=Ln(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}function sc(e,t){return t===Wl?mo(ig(e)):Fn(t)?og(t):mo(sg(Ge(e)))}function ag(e){var t=br(hi(e)),n=["absolute","fixed"].indexOf(De(e).position)>=0,r=n&&Kt(e)?mr(e):e;return Fn(r)?t.filter(function(i){return Fn(i)&&Kl(i,r)&&he(i)!=="body"}):[]}function lg(e,t,n){var r=t==="clippingParents"?ag(e):[].concat(t),i=[].concat(r,[n]),s=i[0],o=i.reduce(function(a,l){var c=sc(e,l);return a.top=fn(c.top,a.top),a.right=fi(c.right,a.right),a.bottom=fi(c.bottom,a.bottom),a.left=fn(c.left,a.left),a},sc(e,s));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function oc(e){var t=e.reference,n=e.element,r=e.placement,i=r?pe(r):null,s=r?Cn(r):null,o=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(i){case Ct:l={x:o,y:t.y-n.height};break;case Gt:l={x:o,y:t.y+t.height};break;case Ht:l={x:t.x+t.width,y:a};break;case Mt:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var c=i?fo(i):null;if(c!=null){var d=c==="y"?"height":"width";switch(s){case Dn:l[c]=l[c]-(t[d]/2-n[d]/2);break;case pr:l[c]=l[c]+(t[d]/2-n[d]/2);break}}return l}function _r(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,s=n.boundary,o=s===void 0?Dm:s,a=n.rootBoundary,l=a===void 0?Wl:a,c=n.elementContext,d=c===void 0?yr:c,f=n.altBoundary,h=f===void 0?!1:f,y=n.padding,m=y===void 0?0:y,b=Xl(typeof m!="number"?m:Zl(m,hr)),w=d===yr?Fm:yr,v=e.rects.popper,B=e.elements[h?w:d],O=lg(Fn(B)?B:B.contextElement||Ge(e.elements.popper),o,l),D=Ln(e.elements.reference),T=oc({reference:D,element:v,placement:i}),A=mo(Object.assign({},v,T)),R=d===yr?A:D,$={top:O.top-R.top+b.top,bottom:R.bottom-O.bottom+b.bottom,left:O.left-R.left+b.left,right:R.right-O.right+b.right},L=e.modifiersData.offset;if(d===yr&&L){var tt=L[i];Object.keys($).forEach(function(Q){var X=[Ht,Gt].indexOf(Q)>=0?1:-1,ot=[Ct,Gt].indexOf(Q)>=0?"y":"x";$[Q]+=tt[ot]*X})}return $}function cg(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,s=n.rootBoundary,o=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=l===void 0?lo:l,d=Cn(r),f=d?a?Gl:Gl.filter(function(m){return Cn(m)===d}):hr,h=f.filter(function(m){return c.indexOf(m)>=0});h.length===0&&(h=f);var y=h.reduce(function(m,b){return m[b]=_r(e,{placement:b,boundary:i,rootBoundary:s,padding:o})[pe(b)],m},{});return Object.keys(y).sort(function(m,b){return y[m]-y[b]})}function ug(e){if(pe(e)===ao)return[];var t=yi(e);return[rc(e),t,rc(t)]}function dg(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!0:o,l=n.fallbackPlacements,c=n.padding,d=n.boundary,f=n.rootBoundary,h=n.altBoundary,y=n.flipVariations,m=y===void 0?!0:y,b=n.allowedAutoPlacements,w=t.options.placement,v=pe(w),B=v===w,O=l||(B||!m?[yi(w)]:ug(w)),D=[w].concat(O).reduce(function(K,rt){return K.concat(pe(rt)===ao?cg(t,{placement:rt,boundary:d,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:b}):rt)},[]),T=t.rects.reference,A=t.rects.popper,R=new Map,$=!0,L=D[0],tt=0;tt<D.length;tt++){var Q=D[tt],X=pe(Q),ot=Cn(Q)===Dn,I=[Ct,Gt].indexOf(X)>=0,p=I?"width":"height",_=_r(t,{placement:Q,boundary:d,rootBoundary:f,altBoundary:h,padding:c}),S=I?ot?Ht:Mt:ot?Gt:Ct;T[p]>A[p]&&(S=yi(S));var E=yi(S),N=[];if(s&&N.push(_[X]<=0),a&&N.push(_[S]<=0,_[E]<=0),N.every(function(K){return K})){L=Q,$=!1;break}R.set(Q,N)}if($)for(var F=m?3:1,C=function(K){var rt=D.find(function(J){var ct=R.get(J);if(ct)return ct.slice(0,K).every(function(ht){return ht})});if(rt)return L=rt,"break"},V=F;V>0;V--){var at=C(V);if(at==="break")break}t.placement!==L&&(t.modifiersData[r]._skip=!0,t.placement=L,t.reset=!0)}}var fg={name:"flip",enabled:!0,phase:"main",fn:dg,requiresIfExists:["offset"],data:{_skip:!1}};function ac(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function lc(e){return[Ct,Ht,Gt,Mt].some(function(t){return e[t]>=0})}function hg(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,s=t.modifiersData.preventOverflow,o=_r(t,{elementContext:"reference"}),a=_r(t,{altBoundary:!0}),l=ac(o,r),c=ac(a,i,s),d=lc(l),f=lc(c);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}var pg={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hg};function yg(e,t,n){var r=pe(e),i=[Mt,Ct].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[Mt,Ht].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function mg(e){var t=e.state,n=e.options,r=e.name,i=n.offset,s=i===void 0?[0,0]:i,o=lo.reduce(function(d,f){return d[f]=yg(f,t.rects,s),d},{}),a=o[t.placement],l=a.x,c=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[r]=o}var gg={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:mg};function bg(e){var t=e.state,n=e.name;t.modifiersData[n]=oc({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}var cc={name:"popperOffsets",enabled:!0,phase:"read",fn:bg,data:{}};function _g(e){return e==="x"?"y":"x"}function vg(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,s=i===void 0?!0:i,o=n.altAxis,a=o===void 0?!1:o,l=n.boundary,c=n.rootBoundary,d=n.altBoundary,f=n.padding,h=n.tether,y=h===void 0?!0:h,m=n.tetherOffset,b=m===void 0?0:m,w=_r(t,{boundary:l,rootBoundary:c,padding:f,altBoundary:d}),v=pe(t.placement),B=Cn(t.placement),O=!B,D=fo(v),T=_g(D),A=t.modifiersData.popperOffsets,R=t.rects.reference,$=t.rects.popper,L=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,tt=typeof L=="number"?{mainAxis:L,altAxis:L}:Object.assign({mainAxis:0,altAxis:0},L),Q=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(A){if(s){var ot,I=D==="y"?Ct:Mt,p=D==="y"?Gt:Ht,_=D==="y"?"height":"width",S=A[D],E=S+w[I],N=S-w[p],F=y?-$[_]/2:0,C=B===Dn?R[_]:$[_],V=B===Dn?-$[_]:-R[_],at=t.elements.arrow,K=y&&at?uo(at):{width:0,height:0},rt=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Jl(),J=rt[I],ct=rt[p],ht=gr(0,R[_],K[_]),Wt=O?R[_]/2-F-ht-J-tt.mainAxis:C-ht-J-tt.mainAxis,Bt=O?-R[_]/2+F+ht+ct+tt.mainAxis:V+ht+ct+tt.mainAxis,Oe=t.elements.arrow&&mr(t.elements.arrow),An=Oe?D==="y"?Oe.clientTop||0:Oe.clientLeft||0:0,Cs=(ot=Q?.[D])!=null?ot:0,za=S+Wt-Cs-An,Ms=S+Bt-Cs,qr=gr(y?fi(E,za):E,S,y?fn(N,Ms):N);A[D]=qr,X[D]=qr-S}if(a){var Wr,LS=D==="x"?Ct:Mt,CS=D==="x"?Gt:Ht,On=A[T],xs=T==="y"?"height":"width",Rh=On+w[LS],Nh=On-w[CS],ja=[Ct,Mt].indexOf(v)!==-1,Bh=(Wr=Q?.[T])!=null?Wr:0,Dh=ja?Rh:On-R[xs]-$[xs]-Bh+tt.altAxis,Fh=ja?On+R[xs]+$[xs]-Bh-tt.altAxis:Nh,$h=y&&ja?Gm(Dh,On,Fh):gr(y?Dh:Rh,On,y?Fh:Nh);A[T]=$h,X[T]=$h-On}t.modifiersData[r]=X}}var wg={name:"preventOverflow",enabled:!0,phase:"main",fn:vg,requiresIfExists:["offset"]};function Ig(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Eg(e){return e===se(e)||!Kt(e)?ho(e):Ig(e)}function Sg(e){var t=e.getBoundingClientRect(),n=$n(t.width)/e.offsetWidth||1,r=$n(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Tg(e,t,n){n===void 0&&(n=!1);var r=Kt(t),i=Kt(t)&&Sg(t),s=Ge(t),o=Ln(e,i),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((he(t)!=="body"||yo(s))&&(a=Eg(t)),Kt(t)?(l=Ln(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=po(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ag(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function i(s){n.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&i(l)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||i(s)}),r}function Og(e){var t=Ag(e);return zm.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function Rg(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Ng(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var uc={placement:"bottom",modifiers:[],strategy:"absolute"};function dc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function go(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,s=i===void 0?uc:i;return function(o,a,l){l===void 0&&(l=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},uc,s),modifiersData:{},elements:{reference:o,popper:a},attributes:{},styles:{}},d=[],f=!1,h={state:c,setOptions:function(b){var w=typeof b=="function"?b(c.options):b;m(),c.options=Object.assign({},s,c.options,w),c.scrollParents={reference:Fn(o)?br(o):o.contextElement?br(o.contextElement):[],popper:br(a)};var v=Og(Ng([].concat(r,c.options.modifiers)));return c.orderedModifiers=v.filter(function(B){return B.enabled}),y(),h.update()},forceUpdate:function(){if(!f){var b=c.elements,w=b.reference,v=b.popper;if(dc(w,v)){c.rects={reference:Tg(w,mr(v),c.options.strategy==="fixed"),popper:uo(v)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function($){return c.modifiersData[$.name]=Object.assign({},$.data)});for(var B=0;B<c.orderedModifiers.length;B++){if(c.reset===!0){c.reset=!1,B=-1;continue}var O=c.orderedModifiers[B],D=O.fn,T=O.options,A=T===void 0?{}:T,R=O.name;typeof D=="function"&&(c=D({state:c,options:A,name:R,instance:h})||c)}}}},update:Rg(function(){return new Promise(function(b){h.forceUpdate(),b(c)})}),destroy:function(){m(),f=!0}};if(!dc(o,a))return h;h.setOptions(l).then(function(b){!f&&l.onFirstUpdate&&l.onFirstUpdate(b)});function y(){c.orderedModifiers.forEach(function(b){var w=b.name,v=b.options,B=v===void 0?{}:v,O=b.effect;if(typeof O=="function"){var D=O({state:c,name:w,instance:h,options:B}),T=function(){};d.push(D||T)}})}function m(){d.forEach(function(b){return b()}),d=[]}return h}}go();var Bg=[nc,cc,ec,Hl];go({defaultModifiers:Bg});var Dg=[nc,cc,ec,Hl,gg,fg,wg,Jm,pg],Fg=go({defaultModifiers:Dg});const fc=ie({arrowOffset:{type:Number,default:5}}),$g=["fixed","absolute"],Lg=ie({boundariesPadding:{type:Number,default:0},fallbackPlacements:{type:vt(Array),default:void 0},gpuAcceleration:{type:Boolean,default:!0},offset:{type:Number,default:12},placement:{type:String,values:lo,default:"bottom"},popperOptions:{type:vt(Object),default:()=>({})},strategy:{type:String,values:$g,default:"absolute"}}),hc=ie({...Lg,...fc,id:String,style:{type:vt([String,Array,Object])},className:{type:vt([String,Array,Object])},effect:{type:vt(String),default:"dark"},visible:Boolean,enterable:{type:Boolean,default:!0},pure:Boolean,focusOnShow:Boolean,trapping:Boolean,popperClass:{type:vt([String,Array,Object])},popperStyle:{type:vt([String,Array,Object])},referenceEl:{type:vt(Object)},triggerTargetEl:{type:vt(Object)},stopPopperMouseEvent:{type:Boolean,default:!0},virtualTriggering:Boolean,zIndex:Number,...Ol(["ariaLabel"])}),Cg={mouseenter:e=>e instanceof MouseEvent,mouseleave:e=>e instanceof MouseEvent,focus:()=>!0,blur:()=>!0,close:()=>!0},Mg=(e,t)=>{const n=u.ref(!1),r=u.ref();return{focusStartRef:r,trapped:n,onFocusAfterReleased:c=>{var d;((d=c.detail)==null?void 0:d.focusReason)!=="pointer"&&(r.value="first",t("blur"))},onFocusAfterTrapped:()=>{t("focus")},onFocusInTrap:c=>{e.visible&&!n.value&&(c.target&&(r.value=c.target),n.value=!0)},onFocusoutPrevented:c=>{e.trapping||(c.detail.focusReason==="pointer"&&c.preventDefault(),n.value=!1)},onReleaseRequested:()=>{n.value=!1,t("close")}}},xg=(e,t=[])=>{const{placement:n,strategy:r,popperOptions:i}=e,s={placement:n,strategy:r,...i,modifiers:[...Pg(e),...t]};return kg(s,i?.modifiers),s},Ug=e=>{if(fe)return dn(e)};function Pg(e){const{offset:t,gpuAcceleration:n,fallbackPlacements:r}=e;return[{name:"offset",options:{offset:[0,t??12]}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5,fallbackPlacements:r}},{name:"computeStyles",options:{gpuAcceleration:n}}]}function kg(e,t){t&&(e.modifiers=[...e.modifiers,...t??[]])}const Vg=(e,t,n={})=>{const r={name:"updateState",enabled:!0,phase:"write",fn:({state:l})=>{const c=zg(l);Object.assign(o.value,c)},requires:["computeStyles"]},i=u.computed(()=>{const{onFirstUpdate:l,placement:c,strategy:d,modifiers:f}=u.unref(n);return{onFirstUpdate:l,placement:c||"bottom",strategy:d||"absolute",modifiers:[...f||[],r,{name:"applyStyles",enabled:!1}]}}),s=u.shallowRef(),o=u.ref({styles:{popper:{position:u.unref(i).strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=()=>{s.value&&(s.value.destroy(),s.value=void 0)};return u.watch(i,l=>{const c=u.unref(s);c&&c.setOptions(l)},{deep:!0}),u.watch([e,t],([l,c])=>{a(),!(!l||!c)&&(s.value=Fg(l,c,u.unref(i)))}),u.onBeforeUnmount(()=>{a()}),{state:u.computed(()=>{var l;return{...((l=u.unref(s))==null?void 0:l.state)||{}}}),styles:u.computed(()=>u.unref(o).styles),attributes:u.computed(()=>u.unref(o).attributes),update:()=>{var l;return(l=u.unref(s))==null?void 0:l.update()},forceUpdate:()=>{var l;return(l=u.unref(s))==null?void 0:l.forceUpdate()},instanceRef:u.computed(()=>u.unref(s))}};function zg(e){const t=Object.keys(e.elements),n=Qs(t.map(i=>[i,e.styles[i]||{}])),r=Qs(t.map(i=>[i,e.attributes[i]]));return{styles:n,attributes:r}}const jg=0,Yg=e=>{const{popperInstanceRef:t,contentRef:n,triggerRef:r,role:i}=u.inject(no,void 0),s=u.ref(),o=u.computed(()=>e.arrowOffset),a=u.computed(()=>({name:"eventListeners",enabled:!!e.visible})),l=u.computed(()=>{var v;const B=u.unref(s),O=(v=u.unref(o))!=null?v:jg;return{name:"arrow",enabled:!Ny(B),options:{element:B,padding:O}}}),c=u.computed(()=>({onFirstUpdate:()=>{m()},...xg(e,[u.unref(l),u.unref(a)])})),d=u.computed(()=>Ug(e.referenceEl)||u.unref(r)),{attributes:f,state:h,styles:y,update:m,forceUpdate:b,instanceRef:w}=Vg(d,n,c);return u.watch(w,v=>t.value=v,{flush:"sync"}),u.onMounted(()=>{u.watch(()=>{var v;return(v=u.unref(d))==null?void 0:v.getBoundingClientRect()},()=>{m()})}),{attributes:f,arrowRef:s,contentRef:n,instanceRef:w,state:h,styles:y,role:i,forceUpdate:b,update:m}},qg=(e,{attributes:t,styles:n,role:r})=>{const{nextZIndex:i}=Jy(),s=Rn("popper"),o=u.computed(()=>u.unref(t).popper),a=u.ref(ai(e.zIndex)?e.zIndex:i()),l=u.computed(()=>[s.b(),s.is("pure",e.pure),s.is(e.effect),e.popperClass]),c=u.computed(()=>[{zIndex:u.unref(a)},u.unref(n).popper,e.popperStyle||{}]),d=u.computed(()=>r.value==="dialog"?"false":void 0),f=u.computed(()=>u.unref(n).arrow||{});return{ariaModal:d,arrowStyle:f,contentAttrs:o,contentClass:l,contentStyle:c,contentZIndex:a,updateZIndex:()=>{a.value=ai(e.zIndex)?e.zIndex:i()}}},Wg=u.defineComponent({name:"ElPopperContent"}),Gg=u.defineComponent({...Wg,props:hc,emits:Cg,setup(e,{expose:t,emit:n}){const r=e,{focusStartRef:i,trapped:s,onFocusAfterReleased:o,onFocusAfterTrapped:a,onFocusInTrap:l,onFocusoutPrevented:c,onReleaseRequested:d}=Mg(r,n),{attributes:f,arrowRef:h,contentRef:y,styles:m,instanceRef:b,role:w,update:v}=Yg(r),{ariaModal:B,arrowStyle:O,contentAttrs:D,contentClass:T,contentStyle:A,updateZIndex:R}=qg(r,{styles:m,attributes:f,role:w}),$=u.inject(Bl,void 0);u.provide(Dl,{arrowStyle:O,arrowRef:h}),$&&u.provide(Bl,{...$,addInputId:ks,removeInputId:ks});let L;const tt=(X=!0)=>{v(),X&&R()},Q=()=>{tt(!1),r.visible&&r.focusOnShow?s.value=!0:r.visible===!1&&(s.value=!1)};return u.onMounted(()=>{u.watch(()=>r.triggerTargetEl,(X,ot)=>{L?.(),L=void 0;const I=u.unref(X||y.value),p=u.unref(ot||y.value);un(I)&&(L=u.watch([w,()=>r.ariaLabel,B,()=>r.id],_=>{["role","aria-label","aria-modal","id"].forEach((S,E)=>{Js(_[E])?I.removeAttribute(S):I.setAttribute(S,_[E])})},{immediate:!0})),p!==I&&un(p)&&["role","aria-label","aria-modal","id"].forEach(_=>{p.removeAttribute(_)})},{immediate:!0}),u.watch(()=>r.visible,Q,{immediate:!0})}),u.onBeforeUnmount(()=>{L?.(),L=void 0}),t({popperContentRef:y,popperInstanceRef:b,updatePopper:tt,contentStyle:A}),(X,ot)=>(u.openBlock(),u.createElementBlock("div",u.mergeProps({ref_key:"contentRef",ref:y},u.unref(D),{style:u.unref(A),class:u.unref(T),tabindex:"-1",onMouseenter:I=>X.$emit("mouseenter",I),onMouseleave:I=>X.$emit("mouseleave",I)}),[u.createVNode(u.unref(Bm),{trapped:u.unref(s),"trap-on-focus-in":!0,"focus-trap-el":u.unref(y),"focus-start-el":u.unref(i),onFocusAfterTrapped:u.unref(a),onFocusAfterReleased:u.unref(o),onFocusin:u.unref(l),onFocusoutPrevented:u.unref(c),onReleaseRequested:u.unref(d)},{default:u.withCtx(()=>[u.renderSlot(X.$slots,"default")]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusin","onFocusoutPrevented","onReleaseRequested"])],16,["onMouseenter","onMouseleave"]))}});var Hg=Ne(Gg,[["__file","content.vue"]]);const Kg=to(am),bo=Symbol("elTooltip"),pc=ie({to:{type:vt([String,Object]),required:!0},disabled:Boolean}),yc=ie({...Zy,...hc,appendTo:{type:pc.to.type},content:{type:String,default:""},rawContent:Boolean,persistent:Boolean,visible:{type:vt(Boolean),default:null},transition:String,teleported:{type:Boolean,default:!0},disabled:Boolean,...Ol(["ariaLabel"])}),mc=ie({...$l,disabled:Boolean,trigger:{type:vt([String,Array]),default:"hover"},triggerKeys:{type:vt(Array),default:()=>[fr.enter,fr.numpadEnter,fr.space]}}),Qg=Zs({type:vt(Boolean),default:null}),Jg=Zs({type:vt(Function)}),Xg=e=>{const t=`update:${e}`,n=`onUpdate:${e}`,r=[t],i={[e]:Qg,[n]:Jg};return{useModelToggle:({indicator:o,toggleReason:a,shouldHideWhenRouteChanges:l,shouldProceed:c,onShow:d,onHide:f})=>{const h=u.getCurrentInstance(),{emit:y}=h,m=h.props,b=u.computed(()=>ei(m[n])),w=u.computed(()=>m[e]===null),v=R=>{o.value!==!0&&(o.value=!0,a&&(a.value=R),ei(d)&&d(R))},B=R=>{o.value!==!1&&(o.value=!1,a&&(a.value=R),ei(f)&&f(R))},O=R=>{if(m.disabled===!0||ei(c)&&!c())return;const $=b.value&&fe;$&&y(t,!0),(w.value||!$)&&v(R)},D=R=>{if(m.disabled===!0||!fe)return;const $=b.value&&fe;$&&y(t,!1),(w.value||!$)&&B(R)},T=R=>{ol(R)&&(m.disabled&&R?b.value&&y(t,!1):o.value!==R&&(R?v():B()))},A=()=>{o.value?D():O()};return u.watch(()=>m[e],T),l&&h.appContext.config.globalProperties.$route!==void 0&&u.watch(()=>({...h.proxy.$route}),()=>{l.value&&o.value&&D()}),u.onMounted(()=>{T(m[e])}),{hide:D,show:O,toggle:A,hasUpdateHandler:b}},useModelToggleProps:i,useModelToggleEmits:r}},{useModelToggleProps:Zg,useModelToggleEmits:tb,useModelToggle:eb}=Xg("visible"),nb=ie({...Fl,...Zg,...yc,...mc,...fc,showArrow:{type:Boolean,default:!0}}),rb=[...tb,"before-show","before-hide","show","hide","open","close"],ib=(e,t)=>kh(e)?e.includes(t):e===t,Mn=(e,t,n)=>r=>{ib(u.unref(e),t)&&n(r)},Fe=(e,t,{checkForDefaultPrevented:n=!0}={})=>i=>{const s=e?.(i);if(n===!1||!s)return t?.(i)},sb=u.defineComponent({name:"ElTooltipTrigger"}),ob=u.defineComponent({...sb,props:mc,setup(e,{expose:t}){const n=e,r=Rn("tooltip"),{controlled:i,id:s,open:o,onOpen:a,onClose:l,onToggle:c}=u.inject(bo,void 0),d=u.ref(null),f=()=>{if(u.unref(i)||n.disabled)return!0},h=u.toRef(n,"trigger"),y=Fe(f,Mn(h,"hover",a)),m=Fe(f,Mn(h,"hover",l)),b=Fe(f,Mn(h,"click",D=>{D.button===0&&c(D)})),w=Fe(f,Mn(h,"focus",a)),v=Fe(f,Mn(h,"focus",l)),B=Fe(f,Mn(h,"contextmenu",D=>{D.preventDefault(),c(D)})),O=Fe(f,D=>{const{code:T}=D;n.triggerKeys.includes(T)&&(D.preventDefault(),c(D))});return t({triggerRef:d}),(D,T)=>(u.openBlock(),u.createBlock(u.unref(mm),{id:u.unref(s),"virtual-ref":D.virtualRef,open:u.unref(o),"virtual-triggering":D.virtualTriggering,class:u.normalizeClass(u.unref(r).e("trigger")),onBlur:u.unref(v),onClick:u.unref(b),onContextmenu:u.unref(B),onFocus:u.unref(w),onMouseenter:u.unref(y),onMouseleave:u.unref(m),onKeydown:u.unref(O)},{default:u.withCtx(()=>[u.renderSlot(D.$slots,"default")]),_:3},8,["id","virtual-ref","open","virtual-triggering","class","onBlur","onClick","onContextmenu","onFocus","onMouseenter","onMouseleave","onKeydown"]))}});var ab=Ne(ob,[["__file","trigger.vue"]]),lb=Ne(u.defineComponent({__name:"teleport",props:pc,setup(e){return(t,n)=>t.disabled?u.renderSlot(t.$slots,"default",{key:0}):(u.openBlock(),u.createBlock(u.Teleport,{key:1,to:t.to},[u.renderSlot(t.$slots,"default")],8,["to"]))}}),[["__file","teleport.vue"]]);const cb=to(lb),gc=()=>{const e=Ps(),t=Nl(),n=u.computed(()=>`${e.value}-popper-container-${t.prefix}`),r=u.computed(()=>`#${n.value}`);return{id:n,selector:r}},ub=e=>{const t=document.createElement("div");return t.id=e,document.body.appendChild(t),t},db=()=>{const{id:e,selector:t}=gc();return u.onBeforeMount(()=>{fe&&(document.body.querySelector(t.value)||ub(e.value))}),{id:e,selector:t}},fb=u.defineComponent({name:"ElTooltipContent",inheritAttrs:!1}),hb=u.defineComponent({...fb,props:yc,setup(e,{expose:t}){const n=e,{selector:r}=gc(),i=Rn("tooltip"),s=u.ref(),o=cl(()=>{var E;return(E=s.value)==null?void 0:E.popperContentRef});let a;const{controlled:l,id:c,open:d,trigger:f,onClose:h,onOpen:y,onShow:m,onHide:b,onBeforeShow:w,onBeforeHide:v}=u.inject(bo,void 0),B=u.computed(()=>n.transition||`${i.namespace.value}-fade-in-linear`),O=u.computed(()=>n.persistent);u.onBeforeUnmount(()=>{a?.()});const D=u.computed(()=>u.unref(O)?!0:u.unref(d)),T=u.computed(()=>n.disabled?!1:u.unref(d)),A=u.computed(()=>n.appendTo||r.value),R=u.computed(()=>{var E;return(E=n.style)!=null?E:{}}),$=u.ref(!0),L=()=>{b(),S()&&Be(document.body),$.value=!0},tt=()=>{if(u.unref(l))return!0},Q=Fe(tt,()=>{n.enterable&&u.unref(f)==="hover"&&y()}),X=Fe(tt,()=>{u.unref(f)==="hover"&&h()}),ot=()=>{var E,N;(N=(E=s.value)==null?void 0:E.updatePopper)==null||N.call(E),w?.()},I=()=>{v?.()},p=()=>{m()},_=()=>{n.virtualTriggering||h()},S=E=>{var N;const F=(N=s.value)==null?void 0:N.popperContentRef,C=E?.relatedTarget||document.activeElement;return F?.contains(C)};return u.watch(()=>u.unref(d),E=>{E?($.value=!1,a=Yy(o,()=>{if(u.unref(l))return;u.unref(f)!=="hover"&&h()})):a?.()},{flush:"post"}),u.watch(()=>n.content,()=>{var E,N;(N=(E=s.value)==null?void 0:E.updatePopper)==null||N.call(E)}),t({contentRef:s,isFocusInsideContent:S}),(E,N)=>(u.openBlock(),u.createBlock(u.unref(cb),{disabled:!E.teleported,to:u.unref(A)},{default:u.withCtx(()=>[u.unref(D)||!$.value?(u.openBlock(),u.createBlock(u.Transition,{key:0,name:u.unref(B),appear:!u.unref(O),onAfterLeave:L,onBeforeEnter:ot,onAfterEnter:p,onBeforeLeave:I,persisted:""},{default:u.withCtx(()=>[u.withDirectives(u.createVNode(u.unref(Hg),u.mergeProps({id:u.unref(c),ref_key:"contentRef",ref:s},E.$attrs,{"aria-label":E.ariaLabel,"aria-hidden":$.value,"boundaries-padding":E.boundariesPadding,"fallback-placements":E.fallbackPlacements,"gpu-acceleration":E.gpuAcceleration,offset:E.offset,placement:E.placement,"popper-options":E.popperOptions,"arrow-offset":E.arrowOffset,strategy:E.strategy,effect:E.effect,enterable:E.enterable,pure:E.pure,"popper-class":E.popperClass,"popper-style":[E.popperStyle,u.unref(R)],"reference-el":E.referenceEl,"trigger-target-el":E.triggerTargetEl,visible:u.unref(T),"z-index":E.zIndex,onMouseenter:u.unref(Q),onMouseleave:u.unref(X),onBlur:_,onClose:u.unref(h)}),{default:u.withCtx(()=>[u.renderSlot(E.$slots,"default")]),_:3},16,["id","aria-label","aria-hidden","boundaries-padding","fallback-placements","gpu-acceleration","offset","placement","popper-options","arrow-offset","strategy","effect","enterable","pure","popper-class","popper-style","reference-el","trigger-target-el","visible","z-index","onMouseenter","onMouseleave","onClose"]),[[u.vShow,u.unref(T)]])]),_:3},8,["name","appear"])):u.createCommentVNode("v-if",!0)]),_:3},8,["disabled","to"]))}});var pb=Ne(hb,[["__file","content.vue"]]);const yb=u.defineComponent({name:"ElTooltip"}),mb=u.defineComponent({...yb,props:nb,emits:rb,setup(e,{expose:t,emit:n}){const r=e;db();const i=Rn("tooltip"),s=im(),o=u.ref(),a=u.ref(),l=()=>{var O;const D=u.unref(o);D&&((O=D.popperInstanceRef)==null||O.update())},c=u.ref(!1),d=u.ref(),{show:f,hide:h,hasUpdateHandler:y}=eb({indicator:c,toggleReason:d}),{onOpen:m,onClose:b}=tm({showAfter:u.toRef(r,"showAfter"),hideAfter:u.toRef(r,"hideAfter"),autoClose:u.toRef(r,"autoClose"),open:f,close:h}),w=u.computed(()=>ol(r.visible)&&!y.value),v=u.computed(()=>[i.b(),r.popperClass]);u.provide(bo,{controlled:w,id:s,open:u.readonly(c),trigger:u.toRef(r,"trigger"),onOpen:m,onClose:b,onToggle:O=>{u.unref(c)?b(O):m(O)},onShow:()=>{n("show",d.value)},onHide:()=>{n("hide",d.value)},onBeforeShow:()=>{n("before-show",d.value)},onBeforeHide:()=>{n("before-hide",d.value)},updatePopper:l}),u.watch(()=>r.disabled,O=>{O&&c.value&&(c.value=!1)});const B=O=>{var D;return(D=a.value)==null?void 0:D.isFocusInsideContent(O)};return u.onDeactivated(()=>c.value&&h()),t({popperRef:o,contentRef:a,isFocusInsideContent:B,updatePopper:l,onOpen:m,onClose:b,hide:h}),(O,D)=>(u.openBlock(),u.createBlock(u.unref(Kg),{ref_key:"popperRef",ref:o,role:O.role},{default:u.withCtx(()=>[u.createVNode(ab,{disabled:O.disabled,trigger:O.trigger,"trigger-keys":O.triggerKeys,"virtual-ref":O.virtualRef,"virtual-triggering":O.virtualTriggering},{default:u.withCtx(()=>[O.$slots.default?u.renderSlot(O.$slots,"default",{key:0}):u.createCommentVNode("v-if",!0)]),_:3},8,["disabled","trigger","trigger-keys","virtual-ref","virtual-triggering"]),u.createVNode(pb,{ref_key:"contentRef",ref:a,"aria-label":O.ariaLabel,"boundaries-padding":O.boundariesPadding,content:O.content,disabled:O.disabled,effect:O.effect,enterable:O.enterable,"fallback-placements":O.fallbackPlacements,"hide-after":O.hideAfter,"gpu-acceleration":O.gpuAcceleration,offset:O.offset,persistent:O.persistent,"popper-class":u.unref(v),"popper-style":O.popperStyle,placement:O.placement,"popper-options":O.popperOptions,"arrow-offset":O.arrowOffset,pure:O.pure,"raw-content":O.rawContent,"reference-el":O.referenceEl,"trigger-target-el":O.triggerTargetEl,"show-after":O.showAfter,strategy:O.strategy,teleported:O.teleported,transition:O.transition,"virtual-triggering":O.virtualTriggering,"z-index":O.zIndex,"append-to":O.appendTo},{default:u.withCtx(()=>[u.renderSlot(O.$slots,"content",{},()=>[O.rawContent?(u.openBlock(),u.createElementBlock("span",{key:0,innerHTML:O.content},null,8,["innerHTML"])):(u.openBlock(),u.createElementBlock("span",{key:1},u.toDisplayString(O.content),1))]),O.showArrow?(u.openBlock(),u.createBlock(u.unref(um),{key:0})):u.createCommentVNode("v-if",!0)]),_:3},8,["aria-label","boundaries-padding","content","disabled","effect","enterable","fallback-placements","hide-after","gpu-acceleration","offset","persistent","popper-class","popper-style","placement","popper-options","arrow-offset","pure","raw-content","reference-el","trigger-target-el","show-after","strategy","teleported","transition","virtual-triggering","z-index","append-to"])]),_:3},8,["role"]))}});var gb=Ne(mb,[["__file","tooltip.vue"]]);const bc=to(gb),bb=Mh.defineStore("duckdb",()=>{const e=u.ref(null),t=u.ref(!1),n=u.ref(!1),r=u.ref(""),i=u.ref(new Map),s=u.ref(new Map),o=u.ref(new Map),a=u.computed(()=>t.value&&!r.value),l=u.computed(()=>T=>i.value.get(T)),c=u.computed(()=>T=>{const A=i.value.get(T);return A&&!A.isLoading&&!A.error}),d=u.computed(()=>s.value.size),f=u.computed(()=>s.value.size>0),h=async()=>{if(t.value||n.value)return e.value;n.value=!0,r.value="";try{const T=await Promise.resolve().then(()=>$S),A={mvp:{mainModule:"/static/duckdb/duckdb-mvp.wasm",mainWorker:"/static/duckdb/duckdb-browser-mvp.worker.js"},eh:{mainModule:"/static/duckdb/duckdb-eh.wasm",mainWorker:"/static/duckdb/duckdb-browser-eh.worker.js"}},R=await T.selectBundle(A),$=new Worker(R.mainWorker),L=new T.ConsoleLogger(T.LogLevel.WARNING);return e.value=new T.AsyncDuckDB(L,$),await e.value.instantiate(R.mainModule),t.value=!0,console.log("DuckDB initialized successfully in store"),e.value}catch(T){throw console.error("Failed to initialize DuckDB:",T),r.value=`Failed to initialize DuckDB: ${T.message}`,T}finally{n.value=!1}},y=async(T=null)=>{a.value||await h();const A=await e.value.connect(),R=T||`conn_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return s.value.set(R,{connection:A,viewerId:R,createdAt:new Date}),console.log(`Created connection for viewer: ${R}`),{connection:A,connectionId:R}},m=async T=>{const A=s.value.get(T);A&&(await A.connection.close(),s.value.delete(T),console.log(`Closed connection for viewer: ${T}`),b(T),s.value.size===0&&console.log("No active connections remaining. Keeping DuckDB instance for potential reuse."))},b=T=>{for(const[A,R]of o.value)R.delete(T),R.size===0&&console.log(`File ${A} is no longer used by any viewers`)},w=(T,A)=>{o.value.has(T)||o.value.set(T,new Set),o.value.get(T).add(A),console.log(`Tracking file usage: ${T} by viewer ${A}`)},v=async T=>{const A=i.value.get(T);if(A&&A.tableName)try{const R=await e.value.connect();await R.query(`DROP TABLE IF EXISTS ${A.tableName};`),await R.close(),console.log(`Dropped table: ${A.tableName}`)}catch(R){console.warn(`Failed to drop table ${A.tableName}:`,R)}i.value.delete(T),o.value.delete(T),console.log(`Unloaded file: ${T}`)},B=async(T,A,R="my_data",$={},L=null,tt=null)=>{const Q=tt||T,X=i.value.get(Q);if(X&&!X.isLoading&&!X.error)return console.log(`File already loaded using stable key ${Q}, reusing table: ${X.tableName}`),L&&w(Q,L),X.tableName;a.value||await h(),i.value.set(Q,{tableName:R,fileType:A,fileUrl:T,isLoading:!0,error:null});try{console.log(`Loading ${A} file from: ${T} with stable key: ${Q}`);const ot=await fetch(T);if(!ot.ok)throw new Error(`Failed to fetch file: ${ot.status} ${ot.statusText}`);let I;if(A==="csv"){const S=await ot.text(),E=await new Blob([S],{type:"text/csv"}).arrayBuffer();I=new Uint8Array(E)}else{const S=await ot.arrayBuffer();I=new Uint8Array(S)}const p=`${tt||R}.${A}`;await e.value.registerFileBuffer(p,I);const _=await e.value.connect();try{let S;if(A==="csv"){const N={header:!0,delimiter:",",...$};S=`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`}else if(A==="parquet")S=`
|
|
9
|
-
CREATE OR REPLACE TABLE ${R} AS
|
|
10
|
-
SELECT * FROM read_parquet('${p}');
|
|
11
|
-
`;else throw new Error(`Unsupported file type: ${A}`);await _.query(S);const E=(await _.query(`SELECT COUNT(*) as count FROM ${R};`)).toArray()[0].count;return i.value.set(Q,{tableName:R,fileType:A,fileUrl:T,isLoading:!1,error:null,rowCount:E,loadedAt:new Date}),L&&w(Q,L),console.log(`Successfully loaded ${E} rows from ${A} file into table: ${R} (stable key: ${Q})`),R}finally{await _.close()}}catch(ot){throw console.error(`Failed to load ${A} file:`,ot),i.value.set(Q,{tableName:R,fileType:A,fileUrl:T,isLoading:!1,error:ot.message}),ot}},O=async(T,A)=>{const R=s.value.get(A);if(!R)throw new Error(`Connection not found: ${A}`);return(await R.connection.query(T)).toArray().map($=>{const L={};for(const[tt,Q]of Object.entries($))L[tt]=Q;return L})},D=async()=>{console.log("Performing global DuckDB cleanup...");for(const[T,A]of s.value)try{await A.connection.close(),console.log(`Closed connection: ${T}`)}catch(R){console.warn(`Error closing connection ${T}:`,R)}if(s.value.clear(),e.value){try{await e.value.terminate(),console.log("DuckDB instance terminated")}catch(T){console.warn("Error terminating DuckDB:",T)}e.value=null}t.value=!1,i.value.clear(),o.value.clear(),r.value=""};return{db:e,isInitialized:t,isInitializing:n,initError:r,loadedFiles:i,connections:s,fileUsage:o,isReady:a,getLoadedFile:l,isFileLoaded:c,activeConnectionCount:d,hasActiveConnections:f,initDuckDB:h,createConnection:y,closeConnection:m,cleanupViewerFileUsage:b,trackFileUsage:w,unloadFile:v,loadFile:B,executeQuery:O,cleanup:async(T=!1)=>{T||s.value.size===0?await D():console.log(`Skipping global cleanup. ${s.value.size} active connections remaining.`)},performGlobalCleanup:D,getConnectionInfo:()=>{const T=[];for(const[A,R]of s.value)T.push({connectionId:A,viewerId:R.viewerId,createdAt:R.createdAt});return T},getFileUsageInfo:()=>{const T=[];for(const[A,R]of o.value){const $=i.value.get(A);T.push({fileId:A,tableName:$?.tableName,fileType:$?.fileType,fileUrl:$?.fileUrl,rowCount:$?.rowCount,loadedAt:$?.loadedAt,usedByViewers:Array.from(R)})}return T}}}),mi=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},_b={class:"dashboard-container"},vb={class:"dashboard-header"},wb={class:"dashboard-content"},Ib={key:0,class:"query-panel"},Eb={class:"query-examples"},Sb=["onClick"],Tb={key:1,class:"results-panel"},Ab={class:"results-controls"},Ob={class:"left-controls"},Rb={class:"right-controls"},Nb={key:0,class:"table-container"},Bb={class:"results-table"},Db={key:0,class:"bottom-pagination"},Fb={key:1,class:"json-container"},$b={key:2,class:"error-panel"},Lb={__name:"DataExplorer",props:{url:{type:String,default:""},fileType:{type:String,default:"parquet",validator:e=>["parquet","csv"].includes(e)},viewerId:{type:String,default:()=>`viewer_${Date.now()}_${Math.random().toString(36).substr(2,9)}`},fileId:{type:String,default:null}},setup(e){const t=e,n=bb(),r=u.ref({header:!0,dynamicTyping:!0,delimiter:","}),i=u.ref(!1),s=u.ref(!1),o=u.ref(t.url),a=u.ref("my_data"),l=u.ref(""),c=u.ref(null),d=u.ref(""),f=u.ref("table"),h=u.ref(1),y=u.ref(50),m=u.ref(null);u.watch(()=>t.url,p=>{o.value=p,p&&(A(),$())});const b=u.computed(()=>n.isReady&&m.value&&!i.value),w=u.computed(()=>i.value?"Loading...":n.isInitializing?"Initializing...":n.isReady?b.value?"Connected":"Not Connected":"Not Ready"),v=u.computed(()=>!c.value||!Array.isArray(c.value)||c.value.length===0?[]:Object.keys(c.value[0]||{})),B=u.computed(()=>!c.value||!Array.isArray(c.value)?0:Math.ceil(c.value.length/y.value)),O=u.computed(()=>{if(!c.value||!Array.isArray(c.value))return[];const p=(h.value-1)*y.value,_=p+y.value;return c.value.slice(p,_)}),D=u.computed(()=>[{name:"Show All",query:"SELECT * FROM data LIMIT 100;"},{name:"Count Rows",query:"SELECT COUNT(*) as row_count FROM data;"},{name:"Group By",query:`SELECT
|
|
1
|
+
(function(Qt,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue"),require("element-plus"),require("pinia"),require("@aws-amplify/auth")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus","pinia","@aws-amplify/auth"],f):(Qt=typeof globalThis<"u"?globalThis:Qt||self,f(Qt["precision-dashwidgets"]={},Qt.Vue,Qt.ElementPlus,Qt.Pinia,Qt.aws_amplify_auth))})(this,(function(Qt,f,to,mu,gu){"use strict";/*! Element Plus Icons Vue v2.3.2 */var bu=f.defineComponent({name:"InfoFilled",__name:"info-filled",setup(e){return(t,n)=>(f.openBlock(),f.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[f.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}}),eo=bu;const _u=mu.defineStore("duckdb",()=>{const e=f.ref(null),t=f.ref(!1),n=f.ref(!1),r=f.ref(""),i=f.ref(new Map),s=f.ref(new Map),o=f.ref(new Map),a=f.computed(()=>t.value&&!r.value),l=f.computed(()=>S=>i.value.get(S)),c=f.computed(()=>S=>{const T=i.value.get(S);return T&&!T.isLoading&&!T.error}),u=f.computed(()=>s.value.size),h=f.computed(()=>s.value.size>0),y=async()=>{if(t.value||n.value)return e.value;n.value=!0,r.value="";try{const S=await Promise.resolve().then(()=>Ub),T={mvp:{mainModule:"/static/duckdb/duckdb-mvp.wasm",mainWorker:"/static/duckdb/duckdb-browser-mvp.worker.js"},eh:{mainModule:"/static/duckdb/duckdb-eh.wasm",mainWorker:"/static/duckdb/duckdb-browser-eh.worker.js"}},B=await S.selectBundle(T),W=new Worker(B.mainWorker),Q=new S.ConsoleLogger(S.LogLevel.WARNING);return e.value=new S.AsyncDuckDB(Q,W),await e.value.instantiate(B.mainModule),t.value=!0,console.log("DuckDB initialized successfully in store"),e.value}catch(S){throw console.error("Failed to initialize DuckDB:",S),r.value=`Failed to initialize DuckDB: ${S.message}`,S}finally{n.value=!1}},g=async(S=null)=>{a.value||await y();const T=await e.value.connect(),B=S||`conn_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return s.value.set(B,{connection:T,viewerId:B,createdAt:new Date}),console.log(`Created connection for viewer: ${B}`),{connection:T,connectionId:B}},w=async S=>{const T=s.value.get(S);T&&(await T.connection.close(),s.value.delete(S),console.log(`Closed connection for viewer: ${S}`),N(S),s.value.size===0&&console.log("No active connections remaining. Keeping DuckDB instance for potential reuse."))},N=S=>{for(const[T,B]of o.value)B.delete(S),B.size===0&&console.log(`File ${T} is no longer used by any viewers`)},E=(S,T)=>{o.value.has(S)||o.value.set(S,new Set),o.value.get(S).add(T),console.log(`Tracking file usage: ${S} by viewer ${T}`)},v=async S=>{const T=i.value.get(S);if(T&&T.tableName)try{const B=await e.value.connect();await B.query(`DROP TABLE IF EXISTS ${T.tableName};`),await B.close(),console.log(`Dropped table: ${T.tableName}`)}catch(B){console.warn(`Failed to drop table ${T.tableName}:`,B)}i.value.delete(S),o.value.delete(S),console.log(`Unloaded file: ${S}`)},j=async(S,T,B="my_data",W={},Q=null,At=null)=>{const bt=At||S,ne=i.value.get(bt);if(ne&&!ne.isLoading&&!ne.error)return console.log(`File already loaded using stable key ${bt}, reusing table: ${ne.tableName}`),Q&&E(bt,Q),ne.tableName;a.value||await y(),i.value.set(bt,{tableName:B,fileType:T,fileUrl:S,isLoading:!0,error:null});try{console.log(`Loading ${T} file from: ${S} with stable key: ${bt}`);const Nt=await fetch(S);if(!Nt.ok)throw new Error(`Failed to fetch file: ${Nt.status} ${Nt.statusText}`);let b;if(T==="csv"){const _=await Nt.text(),I=await new Blob([_],{type:"text/csv"}).arrayBuffer();b=new Uint8Array(I)}else{const _=await Nt.arrayBuffer();b=new Uint8Array(_)}const d=`${At||B}.${T}`;await e.value.registerFileBuffer(d,b);const m=await e.value.connect();try{let _;if(T==="csv"){const A={header:!0,delimiter:",",...W};_=`
|
|
2
|
+
CREATE OR REPLACE TABLE ${B} AS
|
|
3
|
+
SELECT * FROM read_csv('${d}', header=${A.header}, delim='${A.delimiter}');
|
|
4
|
+
`}else if(T==="parquet")_=`
|
|
5
|
+
CREATE OR REPLACE TABLE ${B} AS
|
|
6
|
+
SELECT * FROM read_parquet('${d}');
|
|
7
|
+
`;else throw new Error(`Unsupported file type: ${T}`);await m.query(_);const I=(await m.query(`SELECT COUNT(*) as count FROM ${B};`)).toArray()[0].count;return i.value.set(bt,{tableName:B,fileType:T,fileUrl:S,isLoading:!1,error:null,rowCount:I,loadedAt:new Date}),Q&&E(bt,Q),console.log(`Successfully loaded ${I} rows from ${T} file into table: ${B} (stable key: ${bt})`),B}finally{await m.close()}}catch(Nt){throw console.error(`Failed to load ${T} file:`,Nt),i.value.set(bt,{tableName:B,fileType:T,fileUrl:S,isLoading:!1,error:Nt.message}),Nt}},tt=async(S,T)=>{const B=s.value.get(T);if(!B)throw new Error(`Connection not found: ${T}`);return(await B.connection.query(S)).toArray().map(W=>{const Q={};for(const[At,bt]of Object.entries(W))Q[At]=bt;return Q})},It=async()=>{console.log("Performing global DuckDB cleanup...");for(const[S,T]of s.value)try{await T.connection.close(),console.log(`Closed connection: ${S}`)}catch(B){console.warn(`Error closing connection ${S}:`,B)}if(s.value.clear(),e.value){try{await e.value.terminate(),console.log("DuckDB instance terminated")}catch(S){console.warn("Error terminating DuckDB:",S)}e.value=null}t.value=!1,i.value.clear(),o.value.clear(),r.value=""};return{db:e,isInitialized:t,isInitializing:n,initError:r,loadedFiles:i,connections:s,fileUsage:o,isReady:a,getLoadedFile:l,isFileLoaded:c,activeConnectionCount:u,hasActiveConnections:h,initDuckDB:y,createConnection:g,closeConnection:w,cleanupViewerFileUsage:N,trackFileUsage:E,unloadFile:v,loadFile:j,executeQuery:tt,cleanup:async(S=!1)=>{S||s.value.size===0?await It():console.log(`Skipping global cleanup. ${s.value.size} active connections remaining.`)},performGlobalCleanup:It,getConnectionInfo:()=>{const S=[];for(const[T,B]of s.value)S.push({connectionId:T,viewerId:B.viewerId,createdAt:B.createdAt});return S},getFileUsageInfo:()=>{const S=[];for(const[T,B]of o.value){const W=i.value.get(T);S.push({fileId:T,tableName:W?.tableName,fileType:W?.fileType,fileUrl:W?.fileUrl,rowCount:W?.rowCount,loadedAt:W?.loadedAt,usedByViewers:Array.from(B)})}return S}}}),cr=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},vu={class:"dashboard-container"},wu={class:"dashboard-header"},Iu={class:"dashboard-content"},Su={key:0,class:"query-panel"},Eu={class:"query-examples"},Tu=["onClick"],Au={key:1,class:"results-panel"},Nu={class:"results-controls"},Ru={class:"left-controls"},Bu={class:"right-controls"},Ou={key:0,class:"table-container"},Du={class:"results-table"},Lu={key:0,class:"bottom-pagination"},Fu={key:1,class:"json-container"},Mu={key:2,class:"error-panel"},Uu={__name:"DataExplorer",props:{url:{type:String,default:""},fileType:{type:String,default:"parquet",validator:e=>["parquet","csv"].includes(e)},viewerId:{type:String,default:()=>`viewer_${Date.now()}_${Math.random().toString(36).substr(2,9)}`},fileId:{type:String,default:null}},setup(e){const t=e,n=_u(),r=f.ref({header:!0,dynamicTyping:!0,delimiter:","}),i=f.ref(!1),s=f.ref(!1),o=f.ref(t.url),a=f.ref("my_data"),l=f.ref(""),c=f.ref(null),u=f.ref(""),h=f.ref("table"),y=f.ref(1),g=f.ref(50),w=f.ref(null);f.watch(()=>t.url,d=>{o.value=d,d&&(T(),W())});const N=f.computed(()=>n.isReady&&w.value&&!i.value),E=f.computed(()=>i.value?"Loading...":n.isInitializing?"Initializing...":n.isReady?N.value?"Connected":"Not Connected":"Not Ready"),v=f.computed(()=>!c.value||!Array.isArray(c.value)||c.value.length===0?[]:Object.keys(c.value[0]||{})),j=f.computed(()=>!c.value||!Array.isArray(c.value)?0:Math.ceil(c.value.length/g.value)),tt=f.computed(()=>{if(!c.value||!Array.isArray(c.value))return[];const d=(y.value-1)*g.value,m=d+g.value;return c.value.slice(d,m)}),It=f.computed(()=>[{name:"Show All",query:"SELECT * FROM data LIMIT 100;"},{name:"Count Rows",query:"SELECT COUNT(*) as row_count FROM data;"},{name:"Group By",query:`SELECT
|
|
12
8
|
column1, column2,
|
|
13
9
|
COUNT(*) as count
|
|
14
10
|
FROM data
|
|
15
11
|
GROUP BY column1, column2
|
|
16
12
|
ORDER BY column1, column2
|
|
17
|
-
LIMIT 20;`},{name:"Describe",query:"DESCRIBE data;"},{name:"Sample",query:"SELECT * FROM data USING SAMPLE 10;"},{name:"Columns",query:"PRAGMA table_info(data);"}]);
|
|
18
|
-
`),S=new Blob([_],{type:"text/csv"}),E=URL.createObjectURL(S),N=document.createElement("a");N.href=E,N.download="query-results.csv",N.click(),URL.revokeObjectURL(E)},I=()=>{d.value=""};return u.onMounted(async()=>{await T()}),u.onUnmounted(async()=>{if(m.value){console.log(`Cleaning up viewer ${t.viewerId}...`);const p={activeConnections:n.activeConnectionCount,loadedFiles:n.loadedFiles.size};await n.closeConnection(m.value);const _={activeConnections:n.activeConnectionCount,loadedFiles:n.loadedFiles.size};console.log(`Viewer ${t.viewerId} cleanup complete:`,{beforeCleanup:p,afterCleanup:_,hasActiveConnections:n.hasActiveConnections})}}),(p,_)=>{const S=u.resolveComponent("bf-button"),E=u.resolveComponent("el-pagination");return u.openBlock(),u.createElementBlock("div",_b,[u.createElementVNode("header",vb,[_[3]||(_[3]=u.createElementVNode("h1",null,"Data Explorer",-1)),u.createElementVNode("div",{class:u.normalizeClass(["status-indicator",{connected:b.value,loading:i.value}])},u.toDisplayString(w.value),3)]),u.createElementVNode("div",wb,[b.value?(u.openBlock(),u.createElementBlock("div",Ib,[_[5]||(_[5]=u.createElementVNode("h3",null,"SQL Query",-1)),u.createElementVNode("div",Eb,[_[4]||(_[4]=u.createElementVNode("span",null,"Quick queries:",-1)),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(D.value,N=>(u.openBlock(),u.createElementBlock("button",{key:N.name,onClick:F=>Q(N.query),class:"example-btn"},u.toDisplayString(N.name),9,Sb))),128))]),u.withDirectives(u.createElementVNode("textarea",{"onUpdate:modelValue":_[0]||(_[0]=N=>l.value=N),placeholder:"SELECT * FROM data LIMIT 10;",class:"query-textarea",rows:"4"},null,512),[[u.vModelText,l.value]]),u.createVNode(S,{onClick:$,disabled:s.value||!l.value},{default:u.withCtx(()=>[u.createTextVNode(u.toDisplayString(s.value?"Running...":"Execute Query"),1)]),_:1},8,["disabled"])])):u.createCommentVNode("",!0),c.value?(u.openBlock(),u.createElementBlock("div",Tb,[u.createElementVNode("h3",null,"Results ("+u.toDisplayString(c.value.length)+" rows)",1),u.createElementVNode("div",Ab,[u.createElementVNode("div",Ob,[u.createVNode(S,{class:"secondary",onClick:ot},{default:u.withCtx(()=>_[6]||(_[6]=[u.createTextVNode("Export to CSV",-1)])),_:1,__:[6]})]),u.createElementVNode("div",Rb,[f.value==="table"&&B.value>1?(u.openBlock(),u.createBlock(E,{key:0,"current-page":h.value,"onUpdate:currentPage":_[1]||(_[1]=N=>h.value=N),"page-size":y.value,total:c.value.length,layout:"prev, pager, next",onCurrentChange:L,class:"results-pagination"},null,8,["current-page","page-size","total"])):u.createCommentVNode("",!0)])]),_[7]||(_[7]=u.createElementVNode("div",{class:"pagination-wrapper"},null,-1)),f.value==="table"?(u.openBlock(),u.createElementBlock("div",Nb,[u.createElementVNode("table",Bb,[u.createElementVNode("thead",null,[u.createElementVNode("tr",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(v.value,N=>(u.openBlock(),u.createElementBlock("th",{key:N},u.toDisplayString(N),1))),128))])]),u.createElementVNode("tbody",null,[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(O.value,(N,F)=>(u.openBlock(),u.createElementBlock("tr",{key:F},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(v.value,C=>(u.openBlock(),u.createElementBlock("td",{key:C},u.toDisplayString(X(N[C])),1))),128))]))),128))])]),B.value>1?(u.openBlock(),u.createElementBlock("div",Db,[u.createVNode(E,{"current-page":h.value,"onUpdate:currentPage":_[2]||(_[2]=N=>h.value=N),"page-size":y.value,total:c.value.length,layout:" prev, pager, next","page-sizes":[25,50,100,200,500],onCurrentChange:L,onSizeChange:tt},null,8,["current-page","page-size","total"])])):u.createCommentVNode("",!0)])):(u.openBlock(),u.createElementBlock("div",Fb,[u.createElementVNode("pre",null,u.toDisplayString(JSON.stringify(c.value.slice(0,100),null,2)),1)]))])):u.createCommentVNode("",!0),d.value?(u.openBlock(),u.createElementBlock("div",$b,[_[8]||(_[8]=u.createElementVNode("h3",null,"Error",-1)),u.createElementVNode("p",null,u.toDisplayString(d.value),1),u.createElementVNode("button",{onClick:I,class:"clear-error-btn"},"Clear")])):u.createCommentVNode("",!0)])])}}},Cb=mi(Lb,[["__scopeId","data-v-40d81bb5"]]);var Mb={value:()=>{}};function _o(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new gi(n)}function gi(e){this._=e}function xb(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gi.prototype=_o.prototype={constructor:gi,on:function(e,t){var n=this._,r=xb(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(e=r[s]).type)&&(i=Ub(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(e=r[s]).type)n[i]=_c(n[i],e.name,t);else if(t==null)for(i in n)n[i]=_c(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gi(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function Ub(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function _c(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Mb,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var vo="http://www.w3.org/1999/xhtml";const vc={svg:"http://www.w3.org/2000/svg",xhtml:vo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bi(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),vc.hasOwnProperty(t)?{space:vc[t],local:e}:e}function Pb(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===vo&&t.documentElement.namespaceURI===vo?t.createElement(e):t.createElementNS(n,e)}}function kb(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wc(e){var t=bi(e);return(t.local?kb:Pb)(t)}function Vb(){}function wo(e){return e==null?Vb:function(){return this.querySelector(e)}}function zb(e){typeof e!="function"&&(e=wo(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,a=r[i]=new Array(o),l,c,d=0;d<o;++d)(l=s[d])&&(c=e.call(l,l.__data__,d,s))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new zt(r,this._parents)}function jb(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Yb(){return[]}function Ic(e){return e==null?Yb:function(){return this.querySelectorAll(e)}}function qb(e){return function(){return jb(e.apply(this,arguments))}}function Wb(e){typeof e=="function"?e=qb(e):e=Ic(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var o=t[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(r.push(e.call(l,l.__data__,c,o)),i.push(l));return new zt(r,i)}function Ec(e){return function(){return this.matches(e)}}function Sc(e){return function(t){return t.matches(e)}}var Gb=Array.prototype.find;function Hb(e){return function(){return Gb.call(this.children,e)}}function Kb(){return this.firstElementChild}function Qb(e){return this.select(e==null?Kb:Hb(typeof e=="function"?e:Sc(e)))}var Jb=Array.prototype.filter;function Xb(){return Array.from(this.children)}function Zb(e){return function(){return Jb.call(this.children,e)}}function t_(e){return this.selectAll(e==null?Xb:Zb(typeof e=="function"?e:Sc(e)))}function e_(e){typeof e!="function"&&(e=Ec(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new zt(r,this._parents)}function Tc(e){return new Array(e.length)}function n_(){return new zt(this._enter||this._groups.map(Tc),this._parents)}function _i(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}_i.prototype={constructor:_i,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function r_(e){return function(){return e}}function i_(e,t,n,r,i,s){for(var o=0,a,l=t.length,c=s.length;o<c;++o)(a=t[o])?(a.__data__=s[o],r[o]=a):n[o]=new _i(e,s[o]);for(;o<l;++o)(a=t[o])&&(i[o]=a)}function s_(e,t,n,r,i,s,o){var a,l,c=new Map,d=t.length,f=s.length,h=new Array(d),y;for(a=0;a<d;++a)(l=t[a])&&(h[a]=y=o.call(l,l.__data__,a,t)+"",c.has(y)?i[a]=l:c.set(y,l));for(a=0;a<f;++a)y=o.call(e,s[a],a,s)+"",(l=c.get(y))?(r[a]=l,l.__data__=s[a],c.delete(y)):n[a]=new _i(e,s[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(h[a])===l&&(i[a]=l)}function o_(e){return e.__data__}function a_(e,t){if(!arguments.length)return Array.from(this,o_);var n=t?s_:i_,r=this._parents,i=this._groups;typeof e!="function"&&(e=r_(e));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var d=r[c],f=i[c],h=f.length,y=l_(e.call(d,d&&d.__data__,c,r)),m=y.length,b=a[c]=new Array(m),w=o[c]=new Array(m),v=l[c]=new Array(h);n(d,f,b,w,v,y,t);for(var B=0,O=0,D,T;B<m;++B)if(D=b[B]){for(B>=O&&(O=B+1);!(T=w[O])&&++O<m;);D._next=T||null}}return o=new zt(o,r),o._enter=a,o._exit=l,o}function l_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function c_(){return new zt(this._exit||this._groups.map(Tc),this._parents)}function u_(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function d_(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c=n[l],d=r[l],f=c.length,h=a[l]=new Array(f),y,m=0;m<f;++m)(y=c[m]||d[m])&&(h[m]=y);for(;l<i;++l)a[l]=n[l];return new zt(a,this._parents)}function f_(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function h_(e){e||(e=p_);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],a=o.length,l=i[s]=new Array(a),c,d=0;d<a;++d)(c=o[d])&&(l[d]=c);l.sort(t)}return new zt(i,this._parents).order()}function p_(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function y_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function m_(){return Array.from(this)}function g_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function b_(){let e=0;for(const t of this)++e;return e}function __(){return!this.node()}function v_(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,o=i.length,a;s<o;++s)(a=i[s])&&e.call(a,a.__data__,s,i);return this}function w_(e){return function(){this.removeAttribute(e)}}function I_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function E_(e,t){return function(){this.setAttribute(e,t)}}function S_(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function T_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function A_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function O_(e,t){var n=bi(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?I_:w_:typeof t=="function"?n.local?A_:T_:n.local?S_:E_)(n,t))}function Ac(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function R_(e){return function(){this.style.removeProperty(e)}}function N_(e,t,n){return function(){this.style.setProperty(e,t,n)}}function B_(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function D_(e,t,n){return arguments.length>1?this.each((t==null?R_:typeof t=="function"?B_:N_)(e,t,n??"")):xn(this.node(),e)}function xn(e,t){return e.style.getPropertyValue(t)||Ac(e).getComputedStyle(e,null).getPropertyValue(t)}function F_(e){return function(){delete this[e]}}function $_(e,t){return function(){this[e]=t}}function L_(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function C_(e,t){return arguments.length>1?this.each((t==null?F_:typeof t=="function"?L_:$_)(e,t)):this.node()[e]}function Oc(e){return e.trim().split(/^|\s+/)}function Io(e){return e.classList||new Rc(e)}function Rc(e){this._node=e,this._names=Oc(e.getAttribute("class")||"")}Rc.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Nc(e,t){for(var n=Io(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Bc(e,t){for(var n=Io(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function M_(e){return function(){Nc(this,e)}}function x_(e){return function(){Bc(this,e)}}function U_(e,t){return function(){(t.apply(this,arguments)?Nc:Bc)(this,e)}}function P_(e,t){var n=Oc(e+"");if(arguments.length<2){for(var r=Io(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?U_:t?M_:x_)(n,t))}function k_(){this.textContent=""}function V_(e){return function(){this.textContent=e}}function z_(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function j_(e){return arguments.length?this.each(e==null?k_:(typeof e=="function"?z_:V_)(e)):this.node().textContent}function Y_(){this.innerHTML=""}function q_(e){return function(){this.innerHTML=e}}function W_(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function G_(e){return arguments.length?this.each(e==null?Y_:(typeof e=="function"?W_:q_)(e)):this.node().innerHTML}function H_(){this.nextSibling&&this.parentNode.appendChild(this)}function K_(){return this.each(H_)}function Q_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function J_(){return this.each(Q_)}function X_(e){var t=typeof e=="function"?e:wc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Z_(){return null}function tv(e,t){var n=typeof e=="function"?e:wc(e),r=t==null?Z_:typeof t=="function"?t:wo(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function ev(){var e=this.parentNode;e&&e.removeChild(this)}function nv(){return this.each(ev)}function rv(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function iv(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sv(e){return this.select(e?iv:rv)}function ov(e){return arguments.length?this.property("__data__",e):this.node().__data__}function av(e){return function(t){e.call(this,t,this.__data__)}}function lv(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function cv(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function uv(e,t,n){return function(){var r=this.__on,i,s=av(t);if(r){for(var o=0,a=r.length;o<a;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function dv(e,t,n){var r=lv(e+""),i,s=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(i=0,d=a[l];i<s;++i)if((o=r[i]).type===d.type&&o.name===d.name)return d.value}return}for(a=t?uv:cv,i=0;i<s;++i)this.each(a(r[i],t,n));return this}function Dc(e,t,n){var r=Ac(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function fv(e,t){return function(){return Dc(this,e,t)}}function hv(e,t){return function(){return Dc(this,e,t.apply(this,arguments))}}function pv(e,t){return this.each((typeof t=="function"?hv:fv)(e,t))}function*yv(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var Fc=[null];function zt(e,t){this._groups=e,this._parents=t}function vr(){return new zt([[document.documentElement]],Fc)}function mv(){return this}zt.prototype=vr.prototype={constructor:zt,select:zb,selectAll:Wb,selectChild:Qb,selectChildren:t_,filter:e_,data:a_,enter:n_,exit:c_,join:u_,merge:d_,selection:mv,order:f_,sort:h_,call:y_,nodes:m_,node:g_,size:b_,empty:__,each:v_,attr:O_,style:D_,property:C_,classed:P_,text:j_,html:G_,raise:K_,lower:J_,append:X_,insert:tv,remove:nv,clone:sv,datum:ov,on:dv,dispatch:pv,[Symbol.iterator]:yv};function $e(e){return typeof e=="string"?new zt([[document.querySelector(e)]],[document.documentElement]):new zt([[e]],Fc)}function gv(e){let t;for(;t=e.sourceEvent;)e=t;return e}function He(e,t){if(e=gv(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const Eo={capture:!0,passive:!1};function So(e){e.preventDefault(),e.stopImmediatePropagation()}function bv(e){var t=e.document.documentElement,n=$e(e).on("dragstart.drag",So,Eo);"onselectstart"in t?n.on("selectstart.drag",So,Eo):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function _v(e,t){var n=e.document.documentElement,r=$e(e).on("dragstart.drag",null);t&&(r.on("click.drag",So,Eo),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function To(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $c(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function wr(){}var Ir=.7,vi=1/Ir,Un="\\s*([+-]?\\d+)\\s*",Er="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vv=/^#([0-9a-f]{3,8})$/,wv=new RegExp(`^rgb\\(${Un},${Un},${Un}\\)$`),Iv=new RegExp(`^rgb\\(${ye},${ye},${ye}\\)$`),Ev=new RegExp(`^rgba\\(${Un},${Un},${Un},${Er}\\)$`),Sv=new RegExp(`^rgba\\(${ye},${ye},${ye},${Er}\\)$`),Tv=new RegExp(`^hsl\\(${Er},${ye},${ye}\\)$`),Av=new RegExp(`^hsla\\(${Er},${ye},${ye},${Er}\\)$`),Lc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};To(wr,Sr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Cc,formatHex:Cc,formatHex8:Ov,formatHsl:Rv,formatRgb:Mc,toString:Mc});function Cc(){return this.rgb().formatHex()}function Ov(){return this.rgb().formatHex8()}function Rv(){return Vc(this).formatHsl()}function Mc(){return this.rgb().formatRgb()}function Sr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=vv.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xc(t):n===3?new xt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?wi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=wv.exec(e))?new xt(t[1],t[2],t[3],1):(t=Iv.exec(e))?new xt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ev.exec(e))?wi(t[1],t[2],t[3],t[4]):(t=Sv.exec(e))?wi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Tv.exec(e))?kc(t[1],t[2]/100,t[3]/100,1):(t=Av.exec(e))?kc(t[1],t[2]/100,t[3]/100,t[4]):Lc.hasOwnProperty(e)?xc(Lc[e]):e==="transparent"?new xt(NaN,NaN,NaN,0):null}function xc(e){return new xt(e>>16&255,e>>8&255,e&255,1)}function wi(e,t,n,r){return r<=0&&(e=t=n=NaN),new xt(e,t,n,r)}function Nv(e){return e instanceof wr||(e=Sr(e)),e?(e=e.rgb(),new xt(e.r,e.g,e.b,e.opacity)):new xt}function Ao(e,t,n,r){return arguments.length===1?Nv(e):new xt(e,t,n,r??1)}function xt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}To(xt,Ao,$c(wr,{brighter(e){return e=e==null?vi:Math.pow(vi,e),new xt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ir:Math.pow(Ir,e),new xt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xt(hn(this.r),hn(this.g),hn(this.b),Ii(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Uc,formatHex:Uc,formatHex8:Bv,formatRgb:Pc,toString:Pc}));function Uc(){return`#${pn(this.r)}${pn(this.g)}${pn(this.b)}`}function Bv(){return`#${pn(this.r)}${pn(this.g)}${pn(this.b)}${pn((isNaN(this.opacity)?1:this.opacity)*255)}`}function Pc(){const e=Ii(this.opacity);return`${e===1?"rgb(":"rgba("}${hn(this.r)}, ${hn(this.g)}, ${hn(this.b)}${e===1?")":`, ${e})`}`}function Ii(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function hn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function pn(e){return e=hn(e),(e<16?"0":"")+e.toString(16)}function kc(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new oe(e,t,n,r)}function Vc(e){if(e instanceof oe)return new oe(e.h,e.s,e.l,e.opacity);if(e instanceof wr||(e=Sr(e)),!e)return new oe;if(e instanceof oe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-t)/a+2:o=(t-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new oe(o,a,l,e.opacity)}function Dv(e,t,n,r){return arguments.length===1?Vc(e):new oe(e,t,n,r??1)}function oe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}To(oe,Dv,$c(wr,{brighter(e){return e=e==null?vi:Math.pow(vi,e),new oe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ir:Math.pow(Ir,e),new oe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new xt(Oo(e>=240?e-240:e+120,i,r),Oo(e,i,r),Oo(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new oe(zc(this.h),Ei(this.s),Ei(this.l),Ii(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ii(this.opacity);return`${e===1?"hsl(":"hsla("}${zc(this.h)}, ${Ei(this.s)*100}%, ${Ei(this.l)*100}%${e===1?")":`, ${e})`}`}}));function zc(e){return e=(e||0)%360,e<0?e+360:e}function Ei(e){return Math.max(0,Math.min(1,e||0))}function Oo(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const jc=e=>()=>e;function Fv(e,t){return function(n){return e+n*t}}function $v(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Lv(e){return(e=+e)==1?Yc:function(t,n){return n-t?$v(t,n,e):jc(isNaN(t)?n:t)}}function Yc(e,t){var n=t-e;return n?Fv(e,n):jc(isNaN(e)?t:e)}const qc=(function e(t){var n=Lv(t);function r(i,s){var o=n((i=Ao(i)).r,(s=Ao(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=Yc(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=e,r})(1);function Ke(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ro=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,No=new RegExp(Ro.source,"g");function Cv(e){return function(){return e}}function Mv(e){return function(t){return e(t)+""}}function xv(e,t){var n=Ro.lastIndex=No.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(e=e+"",t=t+"";(r=Ro.exec(e))&&(i=No.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Ke(r,i)})),n=No.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?Mv(l[0].x):Cv(t):(t=l.length,function(c){for(var d=0,f;d<t;++d)a[(f=l[d]).i]=f.x(c);return a.join("")})}var Wc=180/Math.PI,Gc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Hc(e,t,n,r,i,s){var o,a,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Wc,skewX:Math.atan(l)*Wc,scaleX:o,scaleY:a}}var Si;function Uv(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gc:Hc(t.a,t.b,t.c,t.d,t.e,t.f)}function Pv(e){return e==null||(Si||(Si=document.createElementNS("http://www.w3.org/2000/svg","g")),Si.setAttribute("transform",e),!(e=Si.transform.baseVal.consolidate()))?Gc:(e=e.matrix,Hc(e.a,e.b,e.c,e.d,e.e,e.f))}function Kc(e,t,n,r){function i(c){return c.length?c.pop()+" ":""}function s(c,d,f,h,y,m){if(c!==f||d!==h){var b=y.push("translate(",null,t,null,n);m.push({i:b-4,x:Ke(c,f)},{i:b-2,x:Ke(d,h)})}else(f||h)&&y.push("translate("+f+t+h+n)}function o(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ke(c,d)})):d&&f.push(i(f)+"rotate("+d+r)}function a(c,d,f,h){c!==d?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ke(c,d)}):d&&f.push(i(f)+"skewX("+d+r)}function l(c,d,f,h,y,m){if(c!==f||d!==h){var b=y.push(i(y)+"scale(",null,",",null,")");m.push({i:b-4,x:Ke(c,f)},{i:b-2,x:Ke(d,h)})}else(f!==1||h!==1)&&y.push(i(y)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=e(c),d=e(d),s(c.translateX,c.translateY,d.translateX,d.translateY,f,h),o(c.rotate,d.rotate,f,h),a(c.skewX,d.skewX,f,h),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(y){for(var m=-1,b=h.length,w;++m<b;)f[(w=h[m]).i]=w.x(y);return f.join("")}}}var kv=Kc(Uv,"px, ","px)","deg)"),Vv=Kc(Pv,", ",")",")"),zv=1e-12;function Qc(e){return((e=Math.exp(e))+1/e)/2}function jv(e){return((e=Math.exp(e))-1/e)/2}function Yv(e){return((e=Math.exp(2*e))-1)/(e+1)}const qv=(function e(t,n,r){function i(s,o){var a=s[0],l=s[1],c=s[2],d=o[0],f=o[1],h=o[2],y=d-a,m=f-l,b=y*y+m*m,w,v;if(b<zv)v=Math.log(h/c)/t,w=function(R){return[a+R*y,l+R*m,c*Math.exp(t*R*v)]};else{var B=Math.sqrt(b),O=(h*h-c*c+r*b)/(2*c*n*B),D=(h*h-c*c-r*b)/(2*h*n*B),T=Math.log(Math.sqrt(O*O+1)-O),A=Math.log(Math.sqrt(D*D+1)-D);v=(A-T)/t,w=function(R){var $=R*v,L=Qc(T),tt=c/(n*B)*(L*Yv(t*$+T)-jv(T));return[a+tt*y,l+tt*m,c*L/Qc(t*$+T)]}}return w.duration=v*1e3*t/Math.SQRT2,w}return i.rho=function(s){var o=Math.max(.001,+s),a=o*o,l=a*a;return e(o,a,l)},i})(Math.SQRT2,2,4);var Pn=0,Tr=0,Ar=0,Jc=1e3,Ti,Or,Ai=0,yn=0,Oi=0,Rr=typeof performance=="object"&&performance.now?performance:Date,Xc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bo(){return yn||(Xc(Wv),yn=Rr.now()+Oi)}function Wv(){yn=0}function Ri(){this._call=this._time=this._next=null}Ri.prototype=Zc.prototype={constructor:Ri,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bo():+n)+(t==null?0:+t),!this._next&&Or!==this&&(Or?Or._next=this:Ti=this,Or=this),this._call=e,this._time=n,Do()},stop:function(){this._call&&(this._call=null,this._time=1/0,Do())}};function Zc(e,t,n){var r=new Ri;return r.restart(e,t,n),r}function Gv(){Bo(),++Pn;for(var e=Ti,t;e;)(t=yn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Pn}function tu(){yn=(Ai=Rr.now())+Oi,Pn=Tr=0;try{Gv()}finally{Pn=0,Kv(),yn=0}}function Hv(){var e=Rr.now(),t=e-Ai;t>Jc&&(Oi-=t,Ai=e)}function Kv(){for(var e,t=Ti,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ti=n);Or=e,Do(r)}function Do(e){if(!Pn){Tr&&(Tr=clearTimeout(Tr));var t=e-yn;t>24?(e<1/0&&(Tr=setTimeout(tu,e-Rr.now()-Oi)),Ar&&(Ar=clearInterval(Ar))):(Ar||(Ai=Rr.now(),Ar=setInterval(Hv,Jc)),Pn=1,Xc(tu))}}function eu(e,t,n){var r=new Ri;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Qv=_o("start","end","cancel","interrupt"),Jv=[],nu=0,ru=1,Fo=2,Ni=3,iu=4,$o=5,Bi=6;function Di(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Xv(e,n,{name:t,index:r,group:i,on:Qv,tween:Jv,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:nu})}function Lo(e,t){var n=ae(e,t);if(n.state>nu)throw new Error("too late; already scheduled");return n}function me(e,t){var n=ae(e,t);if(n.state>Ni)throw new Error("too late; already running");return n}function ae(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Xv(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Zc(s,0,n.time);function s(c){n.state=ru,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var d,f,h,y;if(n.state!==ru)return l();for(d in r)if(y=r[d],y.name===n.name){if(y.state===Ni)return eu(o);y.state===iu?(y.state=Bi,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[d]):+d<t&&(y.state=Bi,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[d])}if(eu(function(){n.state===Ni&&(n.state=iu,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Fo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Fo){for(n.state=Ni,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(y=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=y);i.length=f+1}}function a(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=$o,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);n.state===$o&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Bi,n.timer.stop(),delete r[t];for(var c in r)return;delete e.__transition}}function Fi(e,t){var n=e.__transition,r,i,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){s=!1;continue}i=r.state>Fo&&r.state<$o,r.state=Bi,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}s&&delete e.__transition}}function Zv(e){return this.each(function(){Fi(this,e)})}function t0(e,t){var n,r;return function(){var i=me(this,e),s=i.tween;if(s!==n){r=n=s;for(var o=0,a=r.length;o<a;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function e0(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=me(this,e),o=s.tween;if(o!==r){i=(r=o).slice();for(var a={name:t,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===t){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function n0(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ae(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?t0:e0)(n,e,t))}function Co(e,t,n){var r=e._id;return e.each(function(){var i=me(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ae(i,r).value[t]}}function su(e,t){var n;return(typeof t=="number"?Ke:t instanceof Sr?qc:(n=Sr(t))?(t=n,qc):xv)(e,t)}function r0(e){return function(){this.removeAttribute(e)}}function i0(e){return function(){this.removeAttributeNS(e.space,e.local)}}function s0(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttribute(e);return o===i?null:o===r?s:s=t(r=o,n)}}function o0(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?s:s=t(r=o,n)}}function a0(e,t,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,a)))}}function l0(e,t,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,a)))}}function c0(e,t){var n=bi(e),r=n==="transform"?Vv:su;return this.attrTween(e,typeof t=="function"?(n.local?l0:a0)(n,r,Co(this,"attr."+e,t)):t==null?(n.local?i0:r0)(n):(n.local?o0:s0)(n,r,t))}function u0(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function d0(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function f0(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&d0(e,s)),n}return i._value=t,i}function h0(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&u0(e,s)),n}return i._value=t,i}function p0(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=bi(e);return this.tween(n,(r.local?f0:h0)(r,t))}function y0(e,t){return function(){Lo(this,e).delay=+t.apply(this,arguments)}}function m0(e,t){return t=+t,function(){Lo(this,e).delay=t}}function g0(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?y0:m0)(t,e)):ae(this.node(),t).delay}function b0(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function _0(e,t){return t=+t,function(){me(this,e).duration=t}}function v0(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?b0:_0)(t,e)):ae(this.node(),t).duration}function w0(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function I0(e){var t=this._id;return arguments.length?this.each(w0(t,e)):ae(this.node(),t).ease}function E0(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function S0(e){if(typeof e!="function")throw new Error;return this.each(E0(this._id,e))}function T0(e){typeof e!="function"&&(e=Ec(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new Le(r,this._parents,this._name,this._id)}function A0(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),o=new Array(r),a=0;a<s;++a)for(var l=t[a],c=n[a],d=l.length,f=o[a]=new Array(d),h,y=0;y<d;++y)(h=l[y]||c[y])&&(f[y]=h);for(;a<r;++a)o[a]=t[a];return new Le(o,this._parents,this._name,this._id)}function O0(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function R0(e,t,n){var r,i,s=O0(t)?Lo:me;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function N0(e,t){var n=this._id;return arguments.length<2?ae(this.node(),n).on.on(e):this.each(R0(n,e,t))}function B0(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function D0(){return this.on("end.remove",B0(this._id))}function F0(e){var t=this._name,n=this._id;typeof e!="function"&&(e=wo(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var a=r[o],l=a.length,c=s[o]=new Array(l),d,f,h=0;h<l;++h)(d=a[h])&&(f=e.call(d,d.__data__,h,a))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,Di(c[h],t,n,h,c,ae(d,n)));return new Le(s,this._parents,t,n)}function $0(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ic(e));for(var r=this._groups,i=r.length,s=[],o=[],a=0;a<i;++a)for(var l=r[a],c=l.length,d,f=0;f<c;++f)if(d=l[f]){for(var h=e.call(d,d.__data__,f,l),y,m=ae(d,n),b=0,w=h.length;b<w;++b)(y=h[b])&&Di(y,t,n,b,h,m);s.push(h),o.push(d)}return new Le(s,o,t,n)}var L0=vr.prototype.constructor;function C0(){return new L0(this._groups,this._parents)}function M0(e,t){var n,r,i;return function(){var s=xn(this,e),o=(this.style.removeProperty(e),xn(this,e));return s===o?null:s===n&&o===r?i:i=t(n=s,r=o)}}function ou(e){return function(){this.style.removeProperty(e)}}function x0(e,t,n){var r,i=n+"",s;return function(){var o=xn(this,e);return o===i?null:o===r?s:s=t(r=o,n)}}function U0(e,t,n){var r,i,s;return function(){var o=xn(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),xn(this,e))),o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,a))}}function P0(e,t){var n,r,i,s="style."+t,o="end."+s,a;return function(){var l=me(this,e),c=l.on,d=l.value[s]==null?a||(a=ou(t)):void 0;(c!==n||i!==d)&&(r=(n=c).copy()).on(o,i=d),l.on=r}}function k0(e,t,n){var r=(e+="")=="transform"?kv:su;return t==null?this.styleTween(e,M0(e,r)).on("end.style."+e,ou(e)):typeof t=="function"?this.styleTween(e,U0(e,r,Co(this,"style."+e,t))).each(P0(this._id,e)):this.styleTween(e,x0(e,r,t),n).on("end.style."+e,null)}function V0(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function z0(e,t,n){var r,i;function s(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&V0(e,o,n)),r}return s._value=t,s}function j0(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,z0(e,t,n??""))}function Y0(e){return function(){this.textContent=e}}function q0(e){return function(){var t=e(this);this.textContent=t??""}}function W0(e){return this.tween("text",typeof e=="function"?q0(Co(this,"text",e)):Y0(e==null?"":e+""))}function G0(e){return function(t){this.textContent=e.call(this,t)}}function H0(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&G0(i)),t}return r._value=e,r}function K0(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,H0(e))}function Q0(){for(var e=this._name,t=this._id,n=au(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var d=ae(l,t);Di(l,e,n,c,o,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Le(r,this._parents,e,n)}function J0(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};n.each(function(){var c=me(this,r),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),i===0&&s()})}var X0=0;function Le(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function au(){return++X0}var Ce=vr.prototype;Le.prototype={constructor:Le,select:F0,selectAll:$0,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:T0,merge:A0,selection:C0,transition:Q0,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:N0,attr:c0,attrTween:p0,style:k0,styleTween:j0,text:W0,textTween:K0,remove:D0,tween:n0,delay:g0,duration:v0,ease:I0,easeVarying:S0,end:J0,[Symbol.iterator]:Ce[Symbol.iterator]};function Z0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tw={time:null,delay:0,duration:250,ease:Z0};function ew(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function nw(e){var t,n;e instanceof Le?(t=e._id,e=e._name):(t=au(),(n=tw).time=Bo(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&Di(l,e,t,c,o,n||ew(l,t));return new Le(r,this._parents,e,t)}vr.prototype.interrupt=Zv,vr.prototype.transition=nw;const $i=e=>()=>e;function rw(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Me(e,t,n){this.k=e,this.x=t,this.y=n}Me.prototype={constructor:Me,scale:function(e){return e===1?this:new Me(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Me(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Li=new Me(1,0,0);Me.prototype;function Mo(e){e.stopImmediatePropagation()}function Nr(e){e.preventDefault(),e.stopImmediatePropagation()}function iw(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function sw(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function lu(){return this.__zoom||Li}function ow(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function aw(){return navigator.maxTouchPoints||"ontouchstart"in this}function lw(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function cw(){var e=iw,t=sw,n=lw,r=ow,i=aw,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=qv,c=_o("start","zoom","end"),d,f,h,y=500,m=150,b=0,w=10;function v(I){I.property("__zoom",lu).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",tt).filter(i).on("touchstart.zoom",Q).on("touchmove.zoom",X).on("touchend.zoom touchcancel.zoom",ot).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(I,p,_,S){var E=I.selection?I.selection():I;E.property("__zoom",lu),I!==E?T(I,p,_,S):E.interrupt().each(function(){A(this,arguments).event(S).start().zoom(null,typeof p=="function"?p.apply(this,arguments):p).end()})},v.scaleBy=function(I,p,_,S){v.scaleTo(I,function(){var E=this.__zoom.k,N=typeof p=="function"?p.apply(this,arguments):p;return E*N},_,S)},v.scaleTo=function(I,p,_,S){v.transform(I,function(){var E=t.apply(this,arguments),N=this.__zoom,F=_==null?D(E):typeof _=="function"?_.apply(this,arguments):_,C=N.invert(F),V=typeof p=="function"?p.apply(this,arguments):p;return n(O(B(N,V),F,C),E,o)},_,S)},v.translateBy=function(I,p,_,S){v.transform(I,function(){return n(this.__zoom.translate(typeof p=="function"?p.apply(this,arguments):p,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),o)},null,S)},v.translateTo=function(I,p,_,S,E){v.transform(I,function(){var N=t.apply(this,arguments),F=this.__zoom,C=S==null?D(N):typeof S=="function"?S.apply(this,arguments):S;return n(Li.translate(C[0],C[1]).scale(F.k).translate(typeof p=="function"?-p.apply(this,arguments):-p,typeof _=="function"?-_.apply(this,arguments):-_),N,o)},S,E)};function B(I,p){return p=Math.max(s[0],Math.min(s[1],p)),p===I.k?I:new Me(p,I.x,I.y)}function O(I,p,_){var S=p[0]-_[0]*I.k,E=p[1]-_[1]*I.k;return S===I.x&&E===I.y?I:new Me(I.k,S,E)}function D(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function T(I,p,_,S){I.on("start.zoom",function(){A(this,arguments).event(S).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(S).end()}).tween("zoom",function(){var E=this,N=arguments,F=A(E,N).event(S),C=t.apply(E,N),V=_==null?D(C):typeof _=="function"?_.apply(E,N):_,at=Math.max(C[1][0]-C[0][0],C[1][1]-C[0][1]),K=E.__zoom,rt=typeof p=="function"?p.apply(E,N):p,J=l(K.invert(V).concat(at/K.k),rt.invert(V).concat(at/rt.k));return function(ct){if(ct===1)ct=rt;else{var ht=J(ct),Wt=at/ht[2];ct=new Me(Wt,V[0]-ht[0]*Wt,V[1]-ht[1]*Wt)}F.zoom(null,ct)}})}function A(I,p,_){return!_&&I.__zooming||new R(I,p)}function R(I,p){this.that=I,this.args=p,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,p),this.taps=0}R.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,p){return this.mouse&&I!=="mouse"&&(this.mouse[1]=p.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=p.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=p.invert(this.touch1[0])),this.that.__zoom=p,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var p=$e(this.that).datum();c.call(I,this.that,new rw(I,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:c}),p)}};function $(I,...p){if(!e.apply(this,arguments))return;var _=A(this,p).event(I),S=this.__zoom,E=Math.max(s[0],Math.min(s[1],S.k*Math.pow(2,r.apply(this,arguments)))),N=He(I);if(_.wheel)(_.mouse[0][0]!==N[0]||_.mouse[0][1]!==N[1])&&(_.mouse[1]=S.invert(_.mouse[0]=N)),clearTimeout(_.wheel);else{if(S.k===E)return;_.mouse=[N,S.invert(N)],Fi(this),_.start()}Nr(I),_.wheel=setTimeout(F,m),_.zoom("mouse",n(O(B(S,E),_.mouse[0],_.mouse[1]),_.extent,o));function F(){_.wheel=null,_.end()}}function L(I,...p){if(h||!e.apply(this,arguments))return;var _=I.currentTarget,S=A(this,p,!0).event(I),E=$e(I.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",at,!0),N=He(I,_),F=I.clientX,C=I.clientY;bv(I.view),Mo(I),S.mouse=[N,this.__zoom.invert(N)],Fi(this),S.start();function V(K){if(Nr(K),!S.moved){var rt=K.clientX-F,J=K.clientY-C;S.moved=rt*rt+J*J>b}S.event(K).zoom("mouse",n(O(S.that.__zoom,S.mouse[0]=He(K,_),S.mouse[1]),S.extent,o))}function at(K){E.on("mousemove.zoom mouseup.zoom",null),_v(K.view,S.moved),Nr(K),S.event(K).end()}}function tt(I,...p){if(e.apply(this,arguments)){var _=this.__zoom,S=He(I.changedTouches?I.changedTouches[0]:I,this),E=_.invert(S),N=_.k*(I.shiftKey?.5:2),F=n(O(B(_,N),S,E),t.apply(this,p),o);Nr(I),a>0?$e(this).transition().duration(a).call(T,F,S,I):$e(this).call(v.transform,F,S,I)}}function Q(I,...p){if(e.apply(this,arguments)){var _=I.touches,S=_.length,E=A(this,p,I.changedTouches.length===S).event(I),N,F,C,V;for(Mo(I),F=0;F<S;++F)C=_[F],V=He(C,this),V=[V,this.__zoom.invert(V),C.identifier],E.touch0?!E.touch1&&E.touch0[2]!==V[2]&&(E.touch1=V,E.taps=0):(E.touch0=V,N=!0,E.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(E.taps<2&&(f=V[0],d=setTimeout(function(){d=null},y)),Fi(this),E.start())}}function X(I,...p){if(this.__zooming){var _=A(this,p).event(I),S=I.changedTouches,E=S.length,N,F,C,V;for(Nr(I),N=0;N<E;++N)F=S[N],C=He(F,this),_.touch0&&_.touch0[2]===F.identifier?_.touch0[0]=C:_.touch1&&_.touch1[2]===F.identifier&&(_.touch1[0]=C);if(F=_.that.__zoom,_.touch1){var at=_.touch0[0],K=_.touch0[1],rt=_.touch1[0],J=_.touch1[1],ct=(ct=rt[0]-at[0])*ct+(ct=rt[1]-at[1])*ct,ht=(ht=J[0]-K[0])*ht+(ht=J[1]-K[1])*ht;F=B(F,Math.sqrt(ct/ht)),C=[(at[0]+rt[0])/2,(at[1]+rt[1])/2],V=[(K[0]+J[0])/2,(K[1]+J[1])/2]}else if(_.touch0)C=_.touch0[0],V=_.touch0[1];else return;_.zoom("touch",n(O(F,C,V),_.extent,o))}}function ot(I,...p){if(this.__zooming){var _=A(this,p).event(I),S=I.changedTouches,E=S.length,N,F;for(Mo(I),h&&clearTimeout(h),h=setTimeout(function(){h=null},y),N=0;N<E;++N)F=S[N],_.touch0&&_.touch0[2]===F.identifier?delete _.touch0:_.touch1&&_.touch1[2]===F.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(F=He(F,this),Math.hypot(f[0]-F[0],f[1]-F[1])<w)){var C=$e(this).on("dblclick.zoom");C&&C.apply(this,arguments)}}}return v.wheelDelta=function(I){return arguments.length?(r=typeof I=="function"?I:$i(+I),v):r},v.filter=function(I){return arguments.length?(e=typeof I=="function"?I:$i(!!I),v):e},v.touchable=function(I){return arguments.length?(i=typeof I=="function"?I:$i(!!I),v):i},v.extent=function(I){return arguments.length?(t=typeof I=="function"?I:$i([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),v):t},v.scaleExtent=function(I){return arguments.length?(s[0]=+I[0],s[1]=+I[1],v):[s[0],s[1]]},v.translateExtent=function(I){return arguments.length?(o[0][0]=+I[0][0],o[1][0]=+I[1][0],o[0][1]=+I[0][1],o[1][1]=+I[1][1],v):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},v.constrain=function(I){return arguments.length?(n=I,v):n},v.duration=function(I){return arguments.length?(a=+I,v):a},v.interpolate=function(I){return arguments.length?(l=I,v):l},v.on=function(){var I=c.on.apply(c,arguments);return I===c?v:I},v.clickDistance=function(I){return arguments.length?(b=(I=+I)*I,v):Math.sqrt(b)},v.tapDistance=function(I){return arguments.length?(w=+I,v):w},v}const uw=u.defineComponent({__name:"scatterplot",props:{pointCount:{type:Number,default:5e3},colorMode:{type:String,default:"random",validator:e=>["random","gradient","single","species","sex"].includes(e)},startColor:{type:String,default:"#ff0000"},endColor:{type:String,default:"#0000ff"},singleColor:{type:String,default:"#4285f4"},forceRegenerate:{type:Boolean,default:!1},data:{type:Array,default:[]},metaData:{type:Object,default:{}},colorMap:{type:Map,default:new Map}},emits:["updateColorMap"],setup(e,{emit:t}){const n=e;function r(){if(!i.value||!s.value||!l)return;const p=i.value.clientWidth,_=i.value.clientHeight;s.value.width=p,s.value.height=_,l.viewport(0,0,p,_),L(l,f,h,2,m)}u.watch(()=>n.forceRegenerate,()=>{l&&c&&(d=T(n.pointCount,n.colorMode,n.startColor,n.endColor,n.singleColor),f&&(l.deleteBuffer(f.positionBuffer),l.deleteBuffer(f.colorBuffer)),f=$(l,c,d),h=Li,s.value&&y&&$e(s.value).call(y.transform,h),L(l,f,h,2,null))}),u.watch(()=>n.data,()=>{console.log("Seeing data changed"),Q()}),u.onMounted(()=>{console.log("Component mounted"),window.addEventListener("resize",r)}),u.onBeforeUnmount(()=>{s.value&&(s.value.removeEventListener("mousemove",ot),s.value.removeEventListener("mouseleave",I)),window.removeEventListener("resize",r),l&&f&&(l.deleteBuffer(f.positionBuffer),l.deleteBuffer(f.colorBuffer),c&&l.deleteProgram(c))});const i=u.ref(null),s=u.ref(null),o=u.ref(null),a=u.ref(null);let l=null,c=null,d=[],f=null,h=null,y=null,m=null,b=0,w=0;function v(p){try{if(!p||p.length<7)return console.warn(`Invalid hex color: ${p}, using fallback`),[1,0,0];const _=parseInt(p.slice(1,3),16)/255,S=parseInt(p.slice(3,5),16)/255,E=parseInt(p.slice(5,7),16)/255;return isNaN(_)||isNaN(S)||isNaN(E)?(console.warn(`Invalid hex color components in: ${p}, using fallback`),[1,0,0]):[_,S,E]}catch(_){return console.error("Error converting hex to RGB:",_),[1,0,0]}}function B(p,_,S){return p+(_-p)*S}function O(p,_,S,E,N){if(!S)return{x:0,y:0};const F=p/E*2,C=-(_/N*2),V=n.metaData.row_groups[0].columns[0].meta_data.statistics,at=2/(V.max_value-V.min_value),K=S.x/E*2-1,rt=-S.y/N*2+1,J=S.k*at,ct=(F-K-1)/J,ht=(C-rt+1)/J;return{x:ct,y:ht}}function D(p,_,S,E,N,F){if(!p.length||!E)return null;const C=a.value,V=O(_,S,E,N,F);C&&(C.innerHTML=`
|
|
19
|
-
Mouse: (${
|
|
20
|
-
Data: (${
|
|
21
|
-
Scale: ${
|
|
22
|
-
`);let
|
|
13
|
+
LIMIT 20;`},{name:"Describe",query:"DESCRIBE data;"},{name:"Sample",query:"SELECT * FROM data USING SAMPLE 10;"},{name:"Columns",query:"PRAGMA table_info(data);"}]);f.computed(()=>({viewerId:t.viewerId,fileId:t.fileId,connectionId:w.value,tableName:a.value,isConnected:N.value,activeConnections:n.activeConnectionCount,hasActiveConnections:n.hasActiveConnections}));const S=async()=>{try{const{connection:d,connectionId:m}=await n.createConnection(t.viewerId);w.value=m,console.log(`Viewer ${t.viewerId} connected with connection ID: ${m}`),o.value&&(await T(),W())}catch(d){console.error("Failed to initialize viewer:",d),u.value=`Failed to initialize: ${d.message}`}},T=async()=>{if(!o.value){u.value="Please provide a valid S3 URL";return}console.log("Loading file:",o.value),console.log("Using stable file ID:",t.fileId);const d=t.fileId||o.value,m=n.getLoadedFile(d);if(m&&!m.isLoading&&!m.error){a.value=m.tableName,console.log(`File already loaded using stable key, reusing table: ${a.value}`),bt("SELECT * FROM data LIMIT 10;");return}i.value=!0,u.value="";try{const _=t.fileId?`file_${t.fileId}`:`data_${Date.now()}`,I=await n.loadFile(o.value,t.fileType,_,r.value,t.viewerId,t.fileId);a.value=I,console.log(`File loaded as table: ${a.value}`),bt("SELECT * FROM data LIMIT 10;")}catch(_){console.error("Failed to load file:",_),u.value=`Failed to load ${t.fileType} file: ${_.message}`}finally{i.value=!1}},B=d=>{if(!a.value||!d)return d;console.log("Original query:",d);const m=d.replace(/\bFROM\s+data\b/gi,`FROM ${a.value}`).replace(/\bJOIN\s+data\b/gi,`JOIN ${a.value}`).replace(/\bUPDATE\s+data\b/gi,`UPDATE ${a.value}`).replace(/\bINSERT\s+INTO\s+data\b/gi,`INSERT INTO ${a.value}`).replace(/\bINTO\s+data\b/gi,`INTO ${a.value}`).replace(/\btable_info\(\s*data\s*\)/gi,`table_info(${a.value})`).replace(/\bDESCRIBE\s+data\b/gi,`DESCRIBE ${a.value}`).replace(/\bPRAGMA\s+table_info\(\s*data\s*\)/gi,`PRAGMA table_info(${a.value})`);return m!==d&&(console.log("Intercepted query:",m),console.log(`Replaced "data" references with "${a.value}"`)),m},W=async()=>{if(!l.value||!w.value){u.value="Please provide a valid SQL query";return}if(!a.value){u.value="No data table loaded";return}s.value=!0,u.value="",y.value=1;try{const d=B(l.value.trim());console.log("Executing transformed query:",d),c.value=await n.executeQuery(d,w.value),console.log(`Query executed successfully, returned ${c.value.length} rows`)}catch(d){console.error("Query execution failed:",d),u.value=`Query execution failed: ${d.message}`,c.value=null}finally{s.value=!1}},Q=d=>{console.log("Page changed to:",d),y.value=d},At=d=>{console.log("Page size changed to:",d),g.value=d,y.value=1},bt=d=>{l.value=d},ne=d=>d==null?"NULL":typeof d=="number"?Number.isInteger(d)?d.toString():d.toFixed(4):typeof d=="string"&&d.length>100?d.substring(0,100)+"...":d.toString(),Nt=()=>{if(!c.value||c.value.length===0)return;const d=Object.keys(c.value[0]),m=[d.join(","),...c.value.map(R=>d.map(D=>{const Y=R[D],st=Y==null?"":Y.toString();return st.includes(",")?`"${st}"`:st}).join(","))].join(`
|
|
14
|
+
`),_=new Blob([m],{type:"text/csv"}),I=URL.createObjectURL(_),A=document.createElement("a");A.href=I,A.download="query-results.csv",A.click(),URL.revokeObjectURL(I)},b=()=>{u.value=""};return f.onMounted(async()=>{await S()}),f.onUnmounted(async()=>{if(w.value){console.log(`Cleaning up viewer ${t.viewerId}...`);const d={activeConnections:n.activeConnectionCount,loadedFiles:n.loadedFiles.size};await n.closeConnection(w.value);const m={activeConnections:n.activeConnectionCount,loadedFiles:n.loadedFiles.size};console.log(`Viewer ${t.viewerId} cleanup complete:`,{beforeCleanup:d,afterCleanup:m,hasActiveConnections:n.hasActiveConnections})}}),(d,m)=>{const _=f.resolveComponent("bf-button"),I=f.resolveComponent("el-pagination");return f.openBlock(),f.createElementBlock("div",vu,[f.createElementVNode("header",wu,[m[3]||(m[3]=f.createElementVNode("h1",null,"Data Explorer",-1)),f.createElementVNode("div",{class:f.normalizeClass(["status-indicator",{connected:N.value,loading:i.value}])},f.toDisplayString(E.value),3)]),f.createElementVNode("div",Iu,[N.value?(f.openBlock(),f.createElementBlock("div",Su,[m[5]||(m[5]=f.createElementVNode("h3",null,"SQL Query",-1)),f.createElementVNode("div",Eu,[m[4]||(m[4]=f.createElementVNode("span",null,"Quick queries:",-1)),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(It.value,A=>(f.openBlock(),f.createElementBlock("button",{key:A.name,onClick:R=>bt(A.query),class:"example-btn"},f.toDisplayString(A.name),9,Tu))),128))]),f.withDirectives(f.createElementVNode("textarea",{"onUpdate:modelValue":m[0]||(m[0]=A=>l.value=A),placeholder:"SELECT * FROM data LIMIT 10;",class:"query-textarea",rows:"4"},null,512),[[f.vModelText,l.value]]),f.createVNode(_,{onClick:W,disabled:s.value||!l.value},{default:f.withCtx(()=>[f.createTextVNode(f.toDisplayString(s.value?"Running...":"Execute Query"),1)]),_:1},8,["disabled"])])):f.createCommentVNode("",!0),c.value?(f.openBlock(),f.createElementBlock("div",Au,[f.createElementVNode("h3",null,"Results ("+f.toDisplayString(c.value.length)+" rows)",1),f.createElementVNode("div",Nu,[f.createElementVNode("div",Ru,[f.createVNode(_,{class:"secondary",onClick:Nt},{default:f.withCtx(()=>m[6]||(m[6]=[f.createTextVNode("Export to CSV",-1)])),_:1,__:[6]})]),f.createElementVNode("div",Bu,[h.value==="table"&&j.value>1?(f.openBlock(),f.createBlock(I,{key:0,"current-page":y.value,"onUpdate:currentPage":m[1]||(m[1]=A=>y.value=A),"page-size":g.value,total:c.value.length,layout:"prev, pager, next",onCurrentChange:Q,class:"results-pagination"},null,8,["current-page","page-size","total"])):f.createCommentVNode("",!0)])]),m[7]||(m[7]=f.createElementVNode("div",{class:"pagination-wrapper"},null,-1)),h.value==="table"?(f.openBlock(),f.createElementBlock("div",Ou,[f.createElementVNode("table",Du,[f.createElementVNode("thead",null,[f.createElementVNode("tr",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(v.value,A=>(f.openBlock(),f.createElementBlock("th",{key:A},f.toDisplayString(A),1))),128))])]),f.createElementVNode("tbody",null,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(tt.value,(A,R)=>(f.openBlock(),f.createElementBlock("tr",{key:R},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(v.value,D=>(f.openBlock(),f.createElementBlock("td",{key:D},f.toDisplayString(ne(A[D])),1))),128))]))),128))])]),j.value>1?(f.openBlock(),f.createElementBlock("div",Lu,[f.createVNode(I,{"current-page":y.value,"onUpdate:currentPage":m[2]||(m[2]=A=>y.value=A),"page-size":g.value,total:c.value.length,layout:" prev, pager, next","page-sizes":[25,50,100,200,500],onCurrentChange:Q,onSizeChange:At},null,8,["current-page","page-size","total"])])):f.createCommentVNode("",!0)])):(f.openBlock(),f.createElementBlock("div",Fu,[f.createElementVNode("pre",null,f.toDisplayString(JSON.stringify(c.value.slice(0,100),null,2)),1)]))])):f.createCommentVNode("",!0),u.value?(f.openBlock(),f.createElementBlock("div",Mu,[m[8]||(m[8]=f.createElementVNode("h3",null,"Error",-1)),f.createElementVNode("p",null,f.toDisplayString(u.value),1),f.createElementVNode("button",{onClick:b,class:"clear-error-btn"},"Clear")])):f.createCommentVNode("",!0)])])}}},xu=cr(Uu,[["__scopeId","data-v-40d81bb5"]]);var Cu={value:()=>{}};function Bi(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new ur(n)}function ur(e){this._=e}function $u(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}ur.prototype=Bi.prototype={constructor:ur,on:function(e,t){var n=this._,r=$u(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(e=r[s]).type)&&(i=ku(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(e=r[s]).type)n[i]=no(n[i],e.name,t);else if(t==null)for(i in n)n[i]=no(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ur(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function ku(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function no(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Cu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Oi="http://www.w3.org/1999/xhtml";const ro={svg:"http://www.w3.org/2000/svg",xhtml:Oi,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hr(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ro.hasOwnProperty(t)?{space:ro[t],local:e}:e}function Pu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Oi&&t.documentElement.namespaceURI===Oi?t.createElement(e):t.createElementNS(n,e)}}function Vu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function io(e){var t=hr(e);return(t.local?Vu:Pu)(t)}function zu(){}function Di(e){return e==null?zu:function(){return this.querySelector(e)}}function Yu(e){typeof e!="function"&&(e=Di(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,a=r[i]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new $t(r,this._parents)}function ju(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qu(){return[]}function so(e){return e==null?qu:function(){return this.querySelectorAll(e)}}function Gu(e){return function(){return ju(e.apply(this,arguments))}}function Wu(e){typeof e=="function"?e=Gu(e):e=so(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var o=t[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(r.push(e.call(l,l.__data__,c,o)),i.push(l));return new $t(r,i)}function oo(e){return function(){return this.matches(e)}}function ao(e){return function(t){return t.matches(e)}}var Hu=Array.prototype.find;function Ku(e){return function(){return Hu.call(this.children,e)}}function Qu(){return this.firstElementChild}function Xu(e){return this.select(e==null?Qu:Ku(typeof e=="function"?e:ao(e)))}var Ju=Array.prototype.filter;function Zu(){return Array.from(this.children)}function th(e){return function(){return Ju.call(this.children,e)}}function eh(e){return this.selectAll(e==null?Zu:th(typeof e=="function"?e:ao(e)))}function nh(e){typeof e!="function"&&(e=oo(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new $t(r,this._parents)}function lo(e){return new Array(e.length)}function rh(){return new $t(this._enter||this._groups.map(lo),this._parents)}function dr(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}dr.prototype={constructor:dr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ih(e){return function(){return e}}function sh(e,t,n,r,i,s){for(var o=0,a,l=t.length,c=s.length;o<c;++o)(a=t[o])?(a.__data__=s[o],r[o]=a):n[o]=new dr(e,s[o]);for(;o<l;++o)(a=t[o])&&(i[o]=a)}function oh(e,t,n,r,i,s,o){var a,l,c=new Map,u=t.length,h=s.length,y=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(y[a]=g=o.call(l,l.__data__,a,t)+"",c.has(g)?i[a]=l:c.set(g,l));for(a=0;a<h;++a)g=o.call(e,s[a],a,s)+"",(l=c.get(g))?(r[a]=l,l.__data__=s[a],c.delete(g)):n[a]=new dr(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(y[a])===l&&(i[a]=l)}function ah(e){return e.__data__}function lh(e,t){if(!arguments.length)return Array.from(this,ah);var n=t?oh:sh,r=this._parents,i=this._groups;typeof e!="function"&&(e=ih(e));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=r[c],h=i[c],y=h.length,g=ch(e.call(u,u&&u.__data__,c,r)),w=g.length,N=a[c]=new Array(w),E=o[c]=new Array(w),v=l[c]=new Array(y);n(u,h,N,E,v,g,t);for(var j=0,tt=0,It,S;j<w;++j)if(It=N[j]){for(j>=tt&&(tt=j+1);!(S=E[tt])&&++tt<w;);It._next=S||null}}return o=new $t(o,r),o._enter=a,o._exit=l,o}function ch(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function uh(){return new $t(this._exit||this._groups.map(lo),this._parents)}function hh(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function dh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c=n[l],u=r[l],h=c.length,y=a[l]=new Array(h),g,w=0;w<h;++w)(g=c[w]||u[w])&&(y[w]=g);for(;l<i;++l)a[l]=n[l];return new $t(a,this._parents)}function fh(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function ph(e){e||(e=yh);function t(h,y){return h&&y?e(h.__data__,y.__data__):!h-!y}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],a=o.length,l=i[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(t)}return new $t(i,this._parents).order()}function yh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function mh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gh(){return Array.from(this)}function bh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function _h(){let e=0;for(const t of this)++e;return e}function vh(){return!this.node()}function wh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,o=i.length,a;s<o;++s)(a=i[s])&&e.call(a,a.__data__,s,i);return this}function Ih(e){return function(){this.removeAttribute(e)}}function Sh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Eh(e,t){return function(){this.setAttribute(e,t)}}function Th(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ah(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Rh(e,t){var n=hr(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Sh:Ih:typeof t=="function"?n.local?Nh:Ah:n.local?Th:Eh)(n,t))}function co(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Bh(e){return function(){this.style.removeProperty(e)}}function Oh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Dh(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Lh(e,t,n){return arguments.length>1?this.each((t==null?Bh:typeof t=="function"?Dh:Oh)(e,t,n??"")):en(this.node(),e)}function en(e,t){return e.style.getPropertyValue(t)||co(e).getComputedStyle(e,null).getPropertyValue(t)}function Fh(e){return function(){delete this[e]}}function Mh(e,t){return function(){this[e]=t}}function Uh(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xh(e,t){return arguments.length>1?this.each((t==null?Fh:typeof t=="function"?Uh:Mh)(e,t)):this.node()[e]}function uo(e){return e.trim().split(/^|\s+/)}function Li(e){return e.classList||new ho(e)}function ho(e){this._node=e,this._names=uo(e.getAttribute("class")||"")}ho.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function fo(e,t){for(var n=Li(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function po(e,t){for(var n=Li(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Ch(e){return function(){fo(this,e)}}function $h(e){return function(){po(this,e)}}function kh(e,t){return function(){(t.apply(this,arguments)?fo:po)(this,e)}}function Ph(e,t){var n=uo(e+"");if(arguments.length<2){for(var r=Li(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?kh:t?Ch:$h)(n,t))}function Vh(){this.textContent=""}function zh(e){return function(){this.textContent=e}}function Yh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jh(e){return arguments.length?this.each(e==null?Vh:(typeof e=="function"?Yh:zh)(e)):this.node().textContent}function qh(){this.innerHTML=""}function Gh(e){return function(){this.innerHTML=e}}function Wh(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Hh(e){return arguments.length?this.each(e==null?qh:(typeof e=="function"?Wh:Gh)(e)):this.node().innerHTML}function Kh(){this.nextSibling&&this.parentNode.appendChild(this)}function Qh(){return this.each(Kh)}function Xh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Jh(){return this.each(Xh)}function Zh(e){var t=typeof e=="function"?e:io(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function td(){return null}function ed(e,t){var n=typeof e=="function"?e:io(e),r=t==null?td:typeof t=="function"?t:Di(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function nd(){var e=this.parentNode;e&&e.removeChild(this)}function rd(){return this.each(nd)}function id(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sd(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function od(e){return this.select(e?sd:id)}function ad(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ld(e){return function(t){e.call(this,t,this.__data__)}}function cd(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ud(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function hd(e,t,n){return function(){var r=this.__on,i,s=ld(t);if(r){for(var o=0,a=r.length;o<a;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function dd(e,t,n){var r=cd(e+""),i,s=r.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(i=0,u=a[l];i<s;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(a=t?hd:ud,i=0;i<s;++i)this.each(a(r[i],t,n));return this}function yo(e,t,n){var r=co(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function fd(e,t){return function(){return yo(this,e,t)}}function pd(e,t){return function(){return yo(this,e,t.apply(this,arguments))}}function yd(e,t){return this.each((typeof t=="function"?pd:fd)(e,t))}function*md(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var mo=[null];function $t(e,t){this._groups=e,this._parents=t}function Bn(){return new $t([[document.documentElement]],mo)}function gd(){return this}$t.prototype=Bn.prototype={constructor:$t,select:Yu,selectAll:Wu,selectChild:Xu,selectChildren:eh,filter:nh,data:lh,enter:rh,exit:uh,join:hh,merge:dh,selection:gd,order:fh,sort:ph,call:mh,nodes:gh,node:bh,size:_h,empty:vh,each:wh,attr:Rh,style:Lh,property:xh,classed:Ph,text:jh,html:Hh,raise:Qh,lower:Jh,append:Zh,insert:ed,remove:rd,clone:od,datum:ad,on:dd,dispatch:yd,[Symbol.iterator]:md};function ge(e){return typeof e=="string"?new $t([[document.querySelector(e)]],[document.documentElement]):new $t([[e]],mo)}function bd(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Oe(e,t){if(e=bd(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const Fi={capture:!0,passive:!1};function Mi(e){e.preventDefault(),e.stopImmediatePropagation()}function _d(e){var t=e.document.documentElement,n=ge(e).on("dragstart.drag",Mi,Fi);"onselectstart"in t?n.on("selectstart.drag",Mi,Fi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function vd(e,t){var n=e.document.documentElement,r=ge(e).on("dragstart.drag",null);t&&(r.on("click.drag",Mi,Fi),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Ui(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function go(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function On(){}var Dn=.7,fr=1/Dn,nn="\\s*([+-]?\\d+)\\s*",Ln="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ie="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",wd=/^#([0-9a-f]{3,8})$/,Id=new RegExp(`^rgb\\(${nn},${nn},${nn}\\)$`),Sd=new RegExp(`^rgb\\(${ie},${ie},${ie}\\)$`),Ed=new RegExp(`^rgba\\(${nn},${nn},${nn},${Ln}\\)$`),Td=new RegExp(`^rgba\\(${ie},${ie},${ie},${Ln}\\)$`),Ad=new RegExp(`^hsl\\(${Ln},${ie},${ie}\\)$`),Nd=new RegExp(`^hsla\\(${Ln},${ie},${ie},${Ln}\\)$`),bo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ui(On,Fn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:_o,formatHex:_o,formatHex8:Rd,formatHsl:Bd,formatRgb:vo,toString:vo});function _o(){return this.rgb().formatHex()}function Rd(){return this.rgb().formatHex8()}function Bd(){return To(this).formatHsl()}function vo(){return this.rgb().formatRgb()}function Fn(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=wd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wo(t):n===3?new Lt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Id.exec(e))?new Lt(t[1],t[2],t[3],1):(t=Sd.exec(e))?new Lt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ed.exec(e))?pr(t[1],t[2],t[3],t[4]):(t=Td.exec(e))?pr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ad.exec(e))?Eo(t[1],t[2]/100,t[3]/100,1):(t=Nd.exec(e))?Eo(t[1],t[2]/100,t[3]/100,t[4]):bo.hasOwnProperty(e)?wo(bo[e]):e==="transparent"?new Lt(NaN,NaN,NaN,0):null}function wo(e){return new Lt(e>>16&255,e>>8&255,e&255,1)}function pr(e,t,n,r){return r<=0&&(e=t=n=NaN),new Lt(e,t,n,r)}function Od(e){return e instanceof On||(e=Fn(e)),e?(e=e.rgb(),new Lt(e.r,e.g,e.b,e.opacity)):new Lt}function xi(e,t,n,r){return arguments.length===1?Od(e):new Lt(e,t,n,r??1)}function Lt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ui(Lt,xi,go(On,{brighter(e){return e=e==null?fr:Math.pow(fr,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dn:Math.pow(Dn,e),new Lt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Lt(ze(this.r),ze(this.g),ze(this.b),yr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Io,formatHex:Io,formatHex8:Dd,formatRgb:So,toString:So}));function Io(){return`#${Ye(this.r)}${Ye(this.g)}${Ye(this.b)}`}function Dd(){return`#${Ye(this.r)}${Ye(this.g)}${Ye(this.b)}${Ye((isNaN(this.opacity)?1:this.opacity)*255)}`}function So(){const e=yr(this.opacity);return`${e===1?"rgb(":"rgba("}${ze(this.r)}, ${ze(this.g)}, ${ze(this.b)}${e===1?")":`, ${e})`}`}function yr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ze(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ye(e){return e=ze(e),(e<16?"0":"")+e.toString(16)}function Eo(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Xt(e,t,n,r)}function To(e){if(e instanceof Xt)return new Xt(e.h,e.s,e.l,e.opacity);if(e instanceof On||(e=Fn(e)),!e)return new Xt;if(e instanceof Xt)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n<r)*6:n===s?o=(r-t)/a+2:o=(t-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new Xt(o,a,l,e.opacity)}function Ld(e,t,n,r){return arguments.length===1?To(e):new Xt(e,t,n,r??1)}function Xt(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ui(Xt,Ld,go(On,{brighter(e){return e=e==null?fr:Math.pow(fr,e),new Xt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dn:Math.pow(Dn,e),new Xt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Lt(Ci(e>=240?e-240:e+120,i,r),Ci(e,i,r),Ci(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Xt(Ao(this.h),mr(this.s),mr(this.l),yr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=yr(this.opacity);return`${e===1?"hsl(":"hsla("}${Ao(this.h)}, ${mr(this.s)*100}%, ${mr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ao(e){return e=(e||0)%360,e<0?e+360:e}function mr(e){return Math.max(0,Math.min(1,e||0))}function Ci(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const No=e=>()=>e;function Fd(e,t){return function(n){return e+n*t}}function Md(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Ud(e){return(e=+e)==1?Ro:function(t,n){return n-t?Md(t,n,e):No(isNaN(t)?n:t)}}function Ro(e,t){var n=t-e;return n?Fd(e,n):No(isNaN(e)?t:e)}const Bo=(function e(t){var n=Ud(t);function r(i,s){var o=n((i=xi(i)).r,(s=xi(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=Ro(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=e,r})(1);function De(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var $i=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ki=new RegExp($i.source,"g");function xd(e){return function(){return e}}function Cd(e){return function(t){return e(t)+""}}function $d(e,t){var n=$i.lastIndex=ki.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(e=e+"",t=t+"";(r=$i.exec(e))&&(i=ki.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:De(r,i)})),n=ki.lastIndex;return n<t.length&&(s=t.slice(n),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?Cd(l[0].x):xd(t):(t=l.length,function(c){for(var u=0,h;u<t;++u)a[(h=l[u]).i]=h.x(c);return a.join("")})}var Oo=180/Math.PI,Do={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Lo(e,t,n,r,i,s){var o,a,l;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),e*r<t*n&&(e=-e,t=-t,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Oo,skewX:Math.atan(l)*Oo,scaleX:o,scaleY:a}}var gr;function kd(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Do:Lo(t.a,t.b,t.c,t.d,t.e,t.f)}function Pd(e){return e==null||(gr||(gr=document.createElementNS("http://www.w3.org/2000/svg","g")),gr.setAttribute("transform",e),!(e=gr.transform.baseVal.consolidate()))?Do:(e=e.matrix,Lo(e.a,e.b,e.c,e.d,e.e,e.f))}function Fo(e,t,n,r){function i(c){return c.length?c.pop()+" ":""}function s(c,u,h,y,g,w){if(c!==h||u!==y){var N=g.push("translate(",null,t,null,n);w.push({i:N-4,x:De(c,h)},{i:N-2,x:De(u,y)})}else(h||y)&&g.push("translate("+h+t+y+n)}function o(c,u,h,y){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),y.push({i:h.push(i(h)+"rotate(",null,r)-2,x:De(c,u)})):u&&h.push(i(h)+"rotate("+u+r)}function a(c,u,h,y){c!==u?y.push({i:h.push(i(h)+"skewX(",null,r)-2,x:De(c,u)}):u&&h.push(i(h)+"skewX("+u+r)}function l(c,u,h,y,g,w){if(c!==h||u!==y){var N=g.push(i(g)+"scale(",null,",",null,")");w.push({i:N-4,x:De(c,h)},{i:N-2,x:De(u,y)})}else(h!==1||y!==1)&&g.push(i(g)+"scale("+h+","+y+")")}return function(c,u){var h=[],y=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,h,y),o(c.rotate,u.rotate,h,y),a(c.skewX,u.skewX,h,y),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,y),c=u=null,function(g){for(var w=-1,N=y.length,E;++w<N;)h[(E=y[w]).i]=E.x(g);return h.join("")}}}var Vd=Fo(kd,"px, ","px)","deg)"),zd=Fo(Pd,", ",")",")"),Yd=1e-12;function Mo(e){return((e=Math.exp(e))+1/e)/2}function jd(e){return((e=Math.exp(e))-1/e)/2}function qd(e){return((e=Math.exp(2*e))-1)/(e+1)}const Gd=(function e(t,n,r){function i(s,o){var a=s[0],l=s[1],c=s[2],u=o[0],h=o[1],y=o[2],g=u-a,w=h-l,N=g*g+w*w,E,v;if(N<Yd)v=Math.log(y/c)/t,E=function(B){return[a+B*g,l+B*w,c*Math.exp(t*B*v)]};else{var j=Math.sqrt(N),tt=(y*y-c*c+r*N)/(2*c*n*j),It=(y*y-c*c-r*N)/(2*y*n*j),S=Math.log(Math.sqrt(tt*tt+1)-tt),T=Math.log(Math.sqrt(It*It+1)-It);v=(T-S)/t,E=function(B){var W=B*v,Q=Mo(S),At=c/(n*j)*(Q*qd(t*W+S)-jd(S));return[a+At*g,l+At*w,c*Q/Mo(t*W+S)]}}return E.duration=v*1e3*t/Math.SQRT2,E}return i.rho=function(s){var o=Math.max(.001,+s),a=o*o,l=a*a;return e(o,a,l)},i})(Math.SQRT2,2,4);var rn=0,Mn=0,Un=0,Uo=1e3,br,xn,_r=0,je=0,vr=0,Cn=typeof performance=="object"&&performance.now?performance:Date,xo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Pi(){return je||(xo(Wd),je=Cn.now()+vr)}function Wd(){je=0}function wr(){this._call=this._time=this._next=null}wr.prototype=Co.prototype={constructor:wr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Pi():+n)+(t==null?0:+t),!this._next&&xn!==this&&(xn?xn._next=this:br=this,xn=this),this._call=e,this._time=n,Vi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vi())}};function Co(e,t,n){var r=new wr;return r.restart(e,t,n),r}function Hd(){Pi(),++rn;for(var e=br,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--rn}function $o(){je=(_r=Cn.now())+vr,rn=Mn=0;try{Hd()}finally{rn=0,Qd(),je=0}}function Kd(){var e=Cn.now(),t=e-_r;t>Uo&&(vr-=t,_r=e)}function Qd(){for(var e,t=br,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:br=n);xn=e,Vi(r)}function Vi(e){if(!rn){Mn&&(Mn=clearTimeout(Mn));var t=e-je;t>24?(e<1/0&&(Mn=setTimeout($o,e-Cn.now()-vr)),Un&&(Un=clearInterval(Un))):(Un||(_r=Cn.now(),Un=setInterval(Kd,Uo)),rn=1,xo($o))}}function ko(e,t,n){var r=new wr;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Xd=Bi("start","end","cancel","interrupt"),Jd=[],Po=0,Vo=1,zi=2,Ir=3,zo=4,Yi=5,Sr=6;function Er(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Zd(e,n,{name:t,index:r,group:i,on:Xd,tween:Jd,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Po})}function ji(e,t){var n=Jt(e,t);if(n.state>Po)throw new Error("too late; already scheduled");return n}function se(e,t){var n=Jt(e,t);if(n.state>Ir)throw new Error("too late; already running");return n}function Jt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Zd(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Co(s,0,n.time);function s(c){n.state=Vo,n.timer.restart(o,n.delay,n.time),n.delay<=c&&o(c-n.delay)}function o(c){var u,h,y,g;if(n.state!==Vo)return l();for(u in r)if(g=r[u],g.name===n.name){if(g.state===Ir)return ko(o);g.state===zo?(g.state=Sr,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[u]):+u<t&&(g.state=Sr,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete r[u])}if(ko(function(){n.state===Ir&&(n.state=zo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=zi,n.on.call("start",e,e.__data__,n.index,n.group),n.state===zi){for(n.state=Ir,i=new Array(y=n.tween.length),u=0,h=-1;u<y;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++h]=g);i.length=h+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Yi,1),h=-1,y=i.length;++h<y;)i[h].call(e,u);n.state===Yi&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Sr,n.timer.stop(),delete r[t];for(var c in r)return;delete e.__transition}}function Tr(e,t){var n=e.__transition,r,i,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){s=!1;continue}i=r.state>zi&&r.state<Yi,r.state=Sr,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}s&&delete e.__transition}}function tf(e){return this.each(function(){Tr(this,e)})}function ef(e,t){var n,r;return function(){var i=se(this,e),s=i.tween;if(s!==n){r=n=s;for(var o=0,a=r.length;o<a;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function nf(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=se(this,e),o=s.tween;if(o!==r){i=(r=o).slice();for(var a={name:t,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===t){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function rf(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Jt(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?ef:nf)(n,e,t))}function qi(e,t,n){var r=e._id;return e.each(function(){var i=se(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Jt(i,r).value[t]}}function Yo(e,t){var n;return(typeof t=="number"?De:t instanceof Fn?Bo:(n=Fn(t))?(t=n,Bo):$d)(e,t)}function sf(e){return function(){this.removeAttribute(e)}}function of(e){return function(){this.removeAttributeNS(e.space,e.local)}}function af(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttribute(e);return o===i?null:o===r?s:s=t(r=o,n)}}function lf(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?s:s=t(r=o,n)}}function cf(e,t,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttribute(e):(o=this.getAttribute(e),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,a)))}}function uf(e,t,n){var r,i,s;return function(){var o,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),l=a+"",o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,a)))}}function hf(e,t){var n=hr(e),r=n==="transform"?zd:Yo;return this.attrTween(e,typeof t=="function"?(n.local?uf:cf)(n,r,qi(this,"attr."+e,t)):t==null?(n.local?of:sf)(n):(n.local?lf:af)(n,r,t))}function df(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ff(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function pf(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&ff(e,s)),n}return i._value=t,i}function yf(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&df(e,s)),n}return i._value=t,i}function mf(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=hr(e);return this.tween(n,(r.local?pf:yf)(r,t))}function gf(e,t){return function(){ji(this,e).delay=+t.apply(this,arguments)}}function bf(e,t){return t=+t,function(){ji(this,e).delay=t}}function _f(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gf:bf)(t,e)):Jt(this.node(),t).delay}function vf(e,t){return function(){se(this,e).duration=+t.apply(this,arguments)}}function wf(e,t){return t=+t,function(){se(this,e).duration=t}}function If(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vf:wf)(t,e)):Jt(this.node(),t).duration}function Sf(e,t){if(typeof t!="function")throw new Error;return function(){se(this,e).ease=t}}function Ef(e){var t=this._id;return arguments.length?this.each(Sf(t,e)):Jt(this.node(),t).ease}function Tf(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;se(this,e).ease=n}}function Af(e){if(typeof e!="function")throw new Error;return this.each(Tf(this._id,e))}function Nf(e){typeof e!="function"&&(e=oo(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,a=r[i]=[],l,c=0;c<o;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new be(r,this._parents,this._name,this._id)}function Rf(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),o=new Array(r),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,h=o[a]=new Array(u),y,g=0;g<u;++g)(y=l[g]||c[g])&&(h[g]=y);for(;a<r;++a)o[a]=t[a];return new be(o,this._parents,this._name,this._id)}function Bf(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Of(e,t,n){var r,i,s=Bf(t)?ji:se;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function Df(e,t){var n=this._id;return arguments.length<2?Jt(this.node(),n).on.on(e):this.each(Of(n,e,t))}function Lf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ff(){return this.on("end.remove",Lf(this._id))}function Mf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Di(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var a=r[o],l=a.length,c=s[o]=new Array(l),u,h,y=0;y<l;++y)(u=a[y])&&(h=e.call(u,u.__data__,y,a))&&("__data__"in u&&(h.__data__=u.__data__),c[y]=h,Er(c[y],t,n,y,c,Jt(u,n)));return new be(s,this._parents,t,n)}function Uf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=so(e));for(var r=this._groups,i=r.length,s=[],o=[],a=0;a<i;++a)for(var l=r[a],c=l.length,u,h=0;h<c;++h)if(u=l[h]){for(var y=e.call(u,u.__data__,h,l),g,w=Jt(u,n),N=0,E=y.length;N<E;++N)(g=y[N])&&Er(g,t,n,N,y,w);s.push(y),o.push(u)}return new be(s,o,t,n)}var xf=Bn.prototype.constructor;function Cf(){return new xf(this._groups,this._parents)}function $f(e,t){var n,r,i;return function(){var s=en(this,e),o=(this.style.removeProperty(e),en(this,e));return s===o?null:s===n&&o===r?i:i=t(n=s,r=o)}}function jo(e){return function(){this.style.removeProperty(e)}}function kf(e,t,n){var r,i=n+"",s;return function(){var o=en(this,e);return o===i?null:o===r?s:s=t(r=o,n)}}function Pf(e,t,n){var r,i,s;return function(){var o=en(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),en(this,e))),o===l?null:o===r&&l===i?s:(i=l,s=t(r=o,a))}}function Vf(e,t){var n,r,i,s="style."+t,o="end."+s,a;return function(){var l=se(this,e),c=l.on,u=l.value[s]==null?a||(a=jo(t)):void 0;(c!==n||i!==u)&&(r=(n=c).copy()).on(o,i=u),l.on=r}}function zf(e,t,n){var r=(e+="")=="transform"?Vd:Yo;return t==null?this.styleTween(e,$f(e,r)).on("end.style."+e,jo(e)):typeof t=="function"?this.styleTween(e,Pf(e,r,qi(this,"style."+e,t))).each(Vf(this._id,e)):this.styleTween(e,kf(e,r,t),n).on("end.style."+e,null)}function Yf(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function jf(e,t,n){var r,i;function s(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&Yf(e,o,n)),r}return s._value=t,s}function qf(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,jf(e,t,n??""))}function Gf(e){return function(){this.textContent=e}}function Wf(e){return function(){var t=e(this);this.textContent=t??""}}function Hf(e){return this.tween("text",typeof e=="function"?Wf(qi(this,"text",e)):Gf(e==null?"":e+""))}function Kf(e){return function(t){this.textContent=e.call(this,t)}}function Qf(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Kf(i)),t}return r._value=e,r}function Xf(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Qf(e))}function Jf(){for(var e=this._name,t=this._id,n=qo(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)if(l=o[c]){var u=Jt(l,t);Er(l,e,n,c,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new be(r,this._parents,e,n)}function Zf(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var a={value:o},l={value:function(){--i===0&&s()}};n.each(function(){var c=se(this,r),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),i===0&&s()})}var tp=0;function be(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function qo(){return++tp}var _e=Bn.prototype;be.prototype={constructor:be,select:Mf,selectAll:Uf,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:Nf,merge:Rf,selection:Cf,transition:Jf,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:Df,attr:hf,attrTween:mf,style:zf,styleTween:qf,text:Hf,textTween:Xf,remove:Ff,tween:rf,delay:_f,duration:If,ease:Ef,easeVarying:Af,end:Zf,[Symbol.iterator]:_e[Symbol.iterator]};function ep(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var np={time:null,delay:0,duration:250,ease:ep};function rp(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ip(e){var t,n;e instanceof be?(t=e._id,e=e._name):(t=qo(),(n=np).time=Pi(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&Er(l,e,t,c,o,n||rp(l,t));return new be(r,this._parents,e,t)}Bn.prototype.interrupt=tf,Bn.prototype.transition=ip;const Ar=e=>()=>e;function sp(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ve(e,t,n){this.k=e,this.x=t,this.y=n}ve.prototype={constructor:ve,scale:function(e){return e===1?this:new ve(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ve(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nr=new ve(1,0,0);ve.prototype;function Gi(e){e.stopImmediatePropagation()}function $n(e){e.preventDefault(),e.stopImmediatePropagation()}function op(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ap(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Go(){return this.__zoom||Nr}function lp(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cp(){return navigator.maxTouchPoints||"ontouchstart"in this}function up(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function hp(){var e=op,t=ap,n=up,r=lp,i=cp,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Gd,c=Bi("start","zoom","end"),u,h,y,g=500,w=150,N=0,E=10;function v(b){b.property("__zoom",Go).on("wheel.zoom",W,{passive:!1}).on("mousedown.zoom",Q).on("dblclick.zoom",At).filter(i).on("touchstart.zoom",bt).on("touchmove.zoom",ne).on("touchend.zoom touchcancel.zoom",Nt).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(b,d,m,_){var I=b.selection?b.selection():b;I.property("__zoom",Go),b!==I?S(b,d,m,_):I.interrupt().each(function(){T(this,arguments).event(_).start().zoom(null,typeof d=="function"?d.apply(this,arguments):d).end()})},v.scaleBy=function(b,d,m,_){v.scaleTo(b,function(){var I=this.__zoom.k,A=typeof d=="function"?d.apply(this,arguments):d;return I*A},m,_)},v.scaleTo=function(b,d,m,_){v.transform(b,function(){var I=t.apply(this,arguments),A=this.__zoom,R=m==null?It(I):typeof m=="function"?m.apply(this,arguments):m,D=A.invert(R),Y=typeof d=="function"?d.apply(this,arguments):d;return n(tt(j(A,Y),R,D),I,o)},m,_)},v.translateBy=function(b,d,m,_){v.transform(b,function(){return n(this.__zoom.translate(typeof d=="function"?d.apply(this,arguments):d,typeof m=="function"?m.apply(this,arguments):m),t.apply(this,arguments),o)},null,_)},v.translateTo=function(b,d,m,_,I){v.transform(b,function(){var A=t.apply(this,arguments),R=this.__zoom,D=_==null?It(A):typeof _=="function"?_.apply(this,arguments):_;return n(Nr.translate(D[0],D[1]).scale(R.k).translate(typeof d=="function"?-d.apply(this,arguments):-d,typeof m=="function"?-m.apply(this,arguments):-m),A,o)},_,I)};function j(b,d){return d=Math.max(s[0],Math.min(s[1],d)),d===b.k?b:new ve(d,b.x,b.y)}function tt(b,d,m){var _=d[0]-m[0]*b.k,I=d[1]-m[1]*b.k;return _===b.x&&I===b.y?b:new ve(b.k,_,I)}function It(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function S(b,d,m,_){b.on("start.zoom",function(){T(this,arguments).event(_).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(_).end()}).tween("zoom",function(){var I=this,A=arguments,R=T(I,A).event(_),D=t.apply(I,A),Y=m==null?It(D):typeof m=="function"?m.apply(I,A):m,st=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),X=I.__zoom,lt=typeof d=="function"?d.apply(I,A):d,H=l(X.invert(Y).concat(st/X.k),lt.invert(Y).concat(st/lt.k));return function(dt){if(dt===1)dt=lt;else{var mt=H(dt),re=st/mt[2];dt=new ve(re,Y[0]-mt[0]*re,Y[1]-mt[1]*re)}R.zoom(null,dt)}})}function T(b,d,m){return!m&&b.__zooming||new B(b,d)}function B(b,d){this.that=b,this.args=d,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,d),this.taps=0}B.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,d){return this.mouse&&b!=="mouse"&&(this.mouse[1]=d.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=d.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=d.invert(this.touch1[0])),this.that.__zoom=d,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var d=ge(this.that).datum();c.call(b,this.that,new sp(b,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:c}),d)}};function W(b,...d){if(!e.apply(this,arguments))return;var m=T(this,d).event(b),_=this.__zoom,I=Math.max(s[0],Math.min(s[1],_.k*Math.pow(2,r.apply(this,arguments)))),A=Oe(b);if(m.wheel)(m.mouse[0][0]!==A[0]||m.mouse[0][1]!==A[1])&&(m.mouse[1]=_.invert(m.mouse[0]=A)),clearTimeout(m.wheel);else{if(_.k===I)return;m.mouse=[A,_.invert(A)],Tr(this),m.start()}$n(b),m.wheel=setTimeout(R,w),m.zoom("mouse",n(tt(j(_,I),m.mouse[0],m.mouse[1]),m.extent,o));function R(){m.wheel=null,m.end()}}function Q(b,...d){if(y||!e.apply(this,arguments))return;var m=b.currentTarget,_=T(this,d,!0).event(b),I=ge(b.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",st,!0),A=Oe(b,m),R=b.clientX,D=b.clientY;_d(b.view),Gi(b),_.mouse=[A,this.__zoom.invert(A)],Tr(this),_.start();function Y(X){if($n(X),!_.moved){var lt=X.clientX-R,H=X.clientY-D;_.moved=lt*lt+H*H>N}_.event(X).zoom("mouse",n(tt(_.that.__zoom,_.mouse[0]=Oe(X,m),_.mouse[1]),_.extent,o))}function st(X){I.on("mousemove.zoom mouseup.zoom",null),vd(X.view,_.moved),$n(X),_.event(X).end()}}function At(b,...d){if(e.apply(this,arguments)){var m=this.__zoom,_=Oe(b.changedTouches?b.changedTouches[0]:b,this),I=m.invert(_),A=m.k*(b.shiftKey?.5:2),R=n(tt(j(m,A),_,I),t.apply(this,d),o);$n(b),a>0?ge(this).transition().duration(a).call(S,R,_,b):ge(this).call(v.transform,R,_,b)}}function bt(b,...d){if(e.apply(this,arguments)){var m=b.touches,_=m.length,I=T(this,d,b.changedTouches.length===_).event(b),A,R,D,Y;for(Gi(b),R=0;R<_;++R)D=m[R],Y=Oe(D,this),Y=[Y,this.__zoom.invert(Y),D.identifier],I.touch0?!I.touch1&&I.touch0[2]!==Y[2]&&(I.touch1=Y,I.taps=0):(I.touch0=Y,A=!0,I.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(I.taps<2&&(h=Y[0],u=setTimeout(function(){u=null},g)),Tr(this),I.start())}}function ne(b,...d){if(this.__zooming){var m=T(this,d).event(b),_=b.changedTouches,I=_.length,A,R,D,Y;for($n(b),A=0;A<I;++A)R=_[A],D=Oe(R,this),m.touch0&&m.touch0[2]===R.identifier?m.touch0[0]=D:m.touch1&&m.touch1[2]===R.identifier&&(m.touch1[0]=D);if(R=m.that.__zoom,m.touch1){var st=m.touch0[0],X=m.touch0[1],lt=m.touch1[0],H=m.touch1[1],dt=(dt=lt[0]-st[0])*dt+(dt=lt[1]-st[1])*dt,mt=(mt=H[0]-X[0])*mt+(mt=H[1]-X[1])*mt;R=j(R,Math.sqrt(dt/mt)),D=[(st[0]+lt[0])/2,(st[1]+lt[1])/2],Y=[(X[0]+H[0])/2,(X[1]+H[1])/2]}else if(m.touch0)D=m.touch0[0],Y=m.touch0[1];else return;m.zoom("touch",n(tt(R,D,Y),m.extent,o))}}function Nt(b,...d){if(this.__zooming){var m=T(this,d).event(b),_=b.changedTouches,I=_.length,A,R;for(Gi(b),y&&clearTimeout(y),y=setTimeout(function(){y=null},g),A=0;A<I;++A)R=_[A],m.touch0&&m.touch0[2]===R.identifier?delete m.touch0:m.touch1&&m.touch1[2]===R.identifier&&delete m.touch1;if(m.touch1&&!m.touch0&&(m.touch0=m.touch1,delete m.touch1),m.touch0)m.touch0[1]=this.__zoom.invert(m.touch0[0]);else if(m.end(),m.taps===2&&(R=Oe(R,this),Math.hypot(h[0]-R[0],h[1]-R[1])<E)){var D=ge(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return v.wheelDelta=function(b){return arguments.length?(r=typeof b=="function"?b:Ar(+b),v):r},v.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Ar(!!b),v):e},v.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:Ar(!!b),v):i},v.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Ar([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),v):t},v.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],v):[s[0],s[1]]},v.translateExtent=function(b){return arguments.length?(o[0][0]=+b[0][0],o[1][0]=+b[1][0],o[0][1]=+b[0][1],o[1][1]=+b[1][1],v):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},v.constrain=function(b){return arguments.length?(n=b,v):n},v.duration=function(b){return arguments.length?(a=+b,v):a},v.interpolate=function(b){return arguments.length?(l=b,v):l},v.on=function(){var b=c.on.apply(c,arguments);return b===c?v:b},v.clickDistance=function(b){return arguments.length?(N=(b=+b)*b,v):Math.sqrt(N)},v.tapDistance=function(b){return arguments.length?(E=+b,v):E},v}const dp=f.defineComponent({__name:"scatterplot",props:{pointCount:{type:Number,default:5e3},colorMode:{type:String,default:"random",validator:e=>["random","gradient","single","species","sex"].includes(e)},startColor:{type:String,default:"#ff0000"},endColor:{type:String,default:"#0000ff"},singleColor:{type:String,default:"#4285f4"},forceRegenerate:{type:Boolean,default:!1},data:{type:Array,default:[]},metaData:{type:Object,default:{}},colorMap:{type:Map,default:new Map}},emits:["updateColorMap"],setup(e,{emit:t}){const n=e;function r(){if(!i.value||!s.value||!l)return;const d=i.value.clientWidth,m=i.value.clientHeight;s.value.width=d,s.value.height=m,l.viewport(0,0,d,m),Q(l,h,y,2,w)}f.watch(()=>n.forceRegenerate,()=>{l&&c&&(u=S(n.pointCount,n.colorMode,n.startColor,n.endColor,n.singleColor),h&&(l.deleteBuffer(h.positionBuffer),l.deleteBuffer(h.colorBuffer)),h=W(l,c,u),y=Nr,s.value&&g&&ge(s.value).call(g.transform,y),Q(l,h,y,2,null))}),f.watch(()=>n.data,()=>{console.log("Seeing data changed"),bt()}),f.onMounted(()=>{console.log("Component mounted"),window.addEventListener("resize",r)}),f.onBeforeUnmount(()=>{s.value&&(s.value.removeEventListener("mousemove",Nt),s.value.removeEventListener("mouseleave",b)),window.removeEventListener("resize",r),l&&h&&(l.deleteBuffer(h.positionBuffer),l.deleteBuffer(h.colorBuffer),c&&l.deleteProgram(c))});const i=f.ref(null),s=f.ref(null),o=f.ref(null),a=f.ref(null);let l=null,c=null,u=[],h=null,y=null,g=null,w=null,N=0,E=0;function v(d){try{if(!d||d.length<7)return console.warn(`Invalid hex color: ${d}, using fallback`),[1,0,0];const m=parseInt(d.slice(1,3),16)/255,_=parseInt(d.slice(3,5),16)/255,I=parseInt(d.slice(5,7),16)/255;return isNaN(m)||isNaN(_)||isNaN(I)?(console.warn(`Invalid hex color components in: ${d}, using fallback`),[1,0,0]):[m,_,I]}catch(m){return console.error("Error converting hex to RGB:",m),[1,0,0]}}function j(d,m,_){return d+(m-d)*_}function tt(d,m,_,I,A){if(!_)return{x:0,y:0};const R=d/I*2,D=-(m/A*2),Y=n.metaData.row_groups[0].columns[0].meta_data.statistics,st=2/(Y.max_value-Y.min_value),X=_.x/I*2-1,lt=-_.y/A*2+1,H=_.k*st,dt=(R-X-1)/H,mt=(D-lt+1)/H;return{x:dt,y:mt}}function It(d,m,_,I,A,R){if(!d.length||!I)return null;const D=a.value,Y=tt(m,_,I,A,R);D&&(D.innerHTML=`
|
|
15
|
+
Mouse: (${m.toFixed(1)}, ${_.toFixed(1)})<br>
|
|
16
|
+
Data: (${Y.x.toFixed(2)}, ${Y.y.toFixed(2)})<br>
|
|
17
|
+
Scale: ${I.k.toFixed(2)}
|
|
18
|
+
`);let st=1/0,X=null;for(const lt of d){const H=lt.x-Y.x,dt=lt.y-Y.y,mt=Math.sqrt(H*H+dt*dt),re=3/(I.k/2);mt<st&&mt<re&&(st=mt,X=lt)}return X&&D&&(D.innerHTML+=`<br>Nearest: (${X.x.toFixed(2)}, ${X.y.toFixed(2)})`),X}function S(d,m,_,I,A){console.log(`Generating ${d} data points with color mode: ${m}`);const R=[],D=v(_),Y=v(I),st=v(A),X=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"].map(H=>v(H)),lt=new Map;for(let H=0;H<n.data.length;H++){const dt=n.data[H][0],mt=n.data[H][1],re=Math.round(Math.sqrt(dt*dt+mt*mt)*10)/10;lt.get(n.data[H][5])==null&<.set(n.data[H][5],X[H%X.length]);let Ct;switch(m){case"random":Ct=[Math.random(),Math.random(),Math.random()];break;case"gradient":const Sn=(dt+50)/100;Ct=[j(D[0],Y[0],Sn),j(D[1],Y[1],Sn),j(D[2],Y[2],Sn)];break;case"single":Ct=[...st];break;case"Type":Ct=[...lt.get(n.data[H][5])];break;default:switch(Ct=[Math.random(),Math.random(),Math.random()],m){case"random":Ct=[Math.random(),Math.random(),Math.random()];break;case"gradient":const tr=(dt+50)/100;Ct=[j(D[0],Y[0],tr),j(D[1],Y[1],tr),j(D[2],Y[2],tr)];break;case"single":Ct=[...st];break;case"Type":Ct=[...lt.get(n.data[H][5])];break;default:Ct=[Math.random(),Math.random(),Math.random()]}}R.push({x:dt,y:mt,rawX:dt,rawY:mt,color:Ct,id:H,species:n.data[H][4],value:re,label:`Point ${H+1}: (${dt.toFixed(2)}, ${mt.toFixed(2)})`,category:re<25?"Near":re<50?"Medium":"Far"})}return R}function T(d){if(!d)return console.error("Canvas element not provided to initWebGL"),null;const m={preserveDrawingBuffer:!0,antialias:!0,alpha:!0};let _=null;try{return _=d.getContext("webgl",m)||d.getContext("experimental-webgl",m),_?(_.clearColor(0,0,0,1),_.enable(_.BLEND),_.blendFunc(_.SRC_ALPHA,_.ONE_MINUS_SRC_ALPHA),_.disable(_.DEPTH_TEST),_):(console.error("WebGL not supported in this browser"),null)}catch(I){return console.error("Error initializing WebGL context:",I),null}}function B(d,m,_){if(!d)return null;try{const I=d.createShader(d.VERTEX_SHADER);if(d.shaderSource(I,m),d.compileShader(I),!d.getShaderParameter(I,d.COMPILE_STATUS)){const D=d.getShaderInfoLog(I);return console.error("Could not compile vertex shader:",D),null}const A=d.createShader(d.FRAGMENT_SHADER);if(d.shaderSource(A,_),d.compileShader(A),!d.getShaderParameter(A,d.COMPILE_STATUS)){const D=d.getShaderInfoLog(A);return console.error("Could not compile fragment shader:",D),null}const R=d.createProgram();if(d.attachShader(R,I),d.attachShader(R,A),d.linkProgram(R),!d.getProgramParameter(R,d.LINK_STATUS)){const D=d.getProgramInfoLog(R);return console.error("Could not link shader program:",D),null}return d.validateProgram(R),d.getProgramParameter(R,d.VALIDATE_STATUS)?R:(console.error("Program validation failed:",d.getProgramInfoLog(R)),null)}catch(I){return console.error("Error creating shader program:",I),null}}function W(d,m,_){if(!d||!m||!_.length)return console.error("Missing required parameters for buffer preparation"),null;try{const I=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,I);const A=new Float32Array(_.flatMap(H=>[H.x,H.y]));d.bufferData(d.ARRAY_BUFFER,A,d.STATIC_DRAW);const R=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,R);const D=new Float32Array(_.flatMap(H=>H.color));d.bufferData(d.ARRAY_BUFFER,D,d.STATIC_DRAW);const Y=d.getAttribLocation(m,"a_position"),st=d.getAttribLocation(m,"a_color");if(Y===-1||st===-1)return console.error("Failed to get attribute locations",{positionAttributeLocation:Y,colorAttributeLocation:st}),null;const X=d.getUniformLocation(m,"u_viewMatrix"),lt=d.getUniformLocation(m,"u_pointSize");return!X||!lt?(console.error("Failed to get uniform locations",{viewMatrixLocation:X,pointSizeLocation:lt}),null):{program:m,positionBuffer:I,colorBuffer:R,positionAttributeLocation:Y,colorAttributeLocation:st,viewMatrixLocation:X,pointSizeLocation:lt,count:_.length}}catch(I){return console.error("Error preparing buffers:",I),null}}function Q(d,m,_,I,A=null){if(!d||!m||!_){console.warn("Missing required parameters for drawing",{gl:d,programInfo:m,transform:_});return}try{const{program:R,positionBuffer:D,colorBuffer:Y,positionAttributeLocation:st,colorAttributeLocation:X,viewMatrixLocation:lt,pointSizeLocation:H,count:dt}=m;d.clearColor(0,0,0,1),d.clear(d.COLOR_BUFFER_BIT),d.useProgram(R),d.enableVertexAttribArray(st),d.bindBuffer(d.ARRAY_BUFFER,D),d.vertexAttribPointer(st,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(X),d.bindBuffer(d.ARRAY_BUFFER,Y),d.vertexAttribPointer(X,3,d.FLOAT,!1,0,0);const mt=d.canvas.clientWidth,re=d.canvas.clientHeight,Ct=n.metaData.row_groups[0].columns[0].meta_data.statistics,Sn=2/(Ct.max_value-Ct.min_value),tr=_.x/mt*2-1,xb=-_.y/re*2+1,Cb=new Float32Array([_.k*Sn,0,0,0,0,_.k*Sn,0,0,0,0,1,0,tr,xb,0,1]);if(d.uniformMatrix4fv(lt,!1,Cb),d.uniform1f(H,I*Math.sqrt(_.k)),d.enable(d.BLEND),d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA),d.drawArrays(d.POINTS,0,dt),A!==null){const hu=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,hu),d.bufferData(d.ARRAY_BUFFER,new Float32Array([A.x,A.y]),d.STATIC_DRAW),d.vertexAttribPointer(st,2,d.FLOAT,!1,0,0);const du=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,du),d.bufferData(d.ARRAY_BUFFER,new Float32Array([1,1,.5]),d.STATIC_DRAW),d.vertexAttribPointer(X,3,d.FLOAT,!1,0,0),d.uniform1f(H,I*Math.sqrt(_.k)*2.5),d.drawArrays(d.POINTS,0,1);const fu=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,fu),d.bufferData(d.ARRAY_BUFFER,new Float32Array([1,.8,.2]),d.STATIC_DRAW),d.vertexAttribPointer(X,3,d.FLOAT,!1,0,0),d.uniform1f(H,I*Math.sqrt(_.k)*3),d.drawArrays(d.POINTS,0,1),d.deleteBuffer(hu),d.deleteBuffer(du),d.deleteBuffer(fu)}}catch(R){console.error("Error drawing scatterplot:",R)}}function At(){if(!l||!h||!u.length)return;let d=0;for(let I in n.metaData.schema)n.metaData.schema[I].name===n.colorMode&&(d=I-1);const m=new Float32Array(n.data.flatMap(I=>n.colorMap.get(I[d])));l.deleteBuffer(h.colorBuffer);const _=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,_),l.bufferData(l.ARRAY_BUFFER,m,l.STATIC_DRAW),h.colorBuffer=_,Q(l,h,y,2,w)}function bt(){if(!s.value||!i.value){console.warn("Canvas or container refs not available yet");return}if(N=i.value.clientWidth||800,E=i.value.clientHeight||400,s.value.width=N,s.value.height=E,l=T(s.value),!l){console.error("Failed to initialize WebGL");return}if(c=B(l,`
|
|
23
19
|
attribute vec2 a_position;
|
|
24
20
|
attribute vec3 a_color;
|
|
25
21
|
uniform mat4 u_viewMatrix;
|
|
@@ -54,16 +50,16 @@
|
|
|
54
50
|
// Output final color with computed alpha
|
|
55
51
|
gl_FragColor = vec4(v_color, alpha);
|
|
56
52
|
}
|
|
57
|
-
`),!c){console.error("Failed to create shader program");return}if(l.useProgram(c),
|
|
58
|
-
Scale: ${
|
|
59
|
-
Translation: (${
|
|
60
|
-
Data at cursor: (${
|
|
61
|
-
`}}})
|
|
62
|
-
<strong>${
|
|
63
|
-
Species: ${
|
|
64
|
-
Distance: ${
|
|
65
|
-
Category: ${
|
|
66
|
-
`,m=N,L(l,f,h,2,m)}else o.value&&(o.value.style.opacity=0),m!==null&&(m=null,L(l,f,h,2,null))}function I(){o.value&&(o.value.style.opacity=0,m!==null&&(m=null,L(l,f,h,2,null)))}return u.watch(()=>n.colorMode,(p,_)=>{if(!l||!f){console.warn("WebGL not initialized yet");return}tt()}),u.watch([()=>n.startColor,()=>n.endColor,()=>n.singleColor],()=>{if(n.colorMode!=="species"&&n.colorMode!=="sex"&&(d=T(n.pointCount,n.colorMode,n.startColor,n.endColor,n.singleColor),l&&f)){l.deleteBuffer(f.colorBuffer);const p=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,p);const _=new Float32Array(d.flatMap(S=>S.color));l.bufferData(l.ARRAY_BUFFER,_,l.STATIC_DRAW),f.colorBuffer=p,L(l,f,h,2,m)}}),u.watch(()=>n.pointCount,p=>{Math.abs(p-d.length)>10&&(d=T(p,n.colorMode,n.startColor,n.endColor,n.singleColor),l&&c&&(f&&(l.deleteBuffer(f.positionBuffer),l.deleteBuffer(f.colorBuffer)),f=$(l,c,d),L(l,f,h,2,null)))}),(p,_)=>(u.openBlock(),u.createElementBlock("div",{class:"scatterplot-container",ref_key:"containerRef",ref:i},[u.createElementVNode("canvas",{ref_key:"canvasRef",ref:s},null,512),u.createElementVNode("div",{id:"tooltip",ref_key:"tooltipRef",ref:o},null,512),u.withDirectives(u.createElementVNode("div",{id:"debug",ref_key:"debugRef",ref:a},null,512),[[u.vShow,!1]])],512))}}),dw=mi(uw,[["__scopeId","data-v-c67b8237"]]),fw={class:"control-panel"},hw={class:"color-option"},pw=["value"],yw={class:"color-option"},mw={class:"legend"},gw={class:"legend-label"},bw=u.defineComponent({__name:"control",props:{pointCount:{type:Number,default:5e3},colorMode:{type:String,default:"random"},startColor:{type:String,default:"#ff0000"},endColor:{type:String,default:"#0000ff"},singleColor:{type:String,default:"#4285f4"},options:{type:Array,default:["Type","Species"]},colorScheme:{type:Map,default:new Map},colorMapMap:{type:Map,default:new Map}},emits:["update:pointCount","update:colorMode","update:startColor","update:endColor","update:singleColor","regenerate"],setup(e,{emit:t}){const n=e,r=t,i=u.ref(n.pointCount),s=u.ref(n.colorMode),o=u.ref(n.startColor),a=u.ref(n.endColor),l=u.ref(n.singleColor);function c(f){const h=Math.round(f[0]*255),y=Math.round(f[1]*255),m=Math.round(f[2]*255);return`rgb(${h}, ${y}, ${m})`}function d(){r("updateColorMap",[s.value,n.colorMapMap.get(s.value)]),r("update:colorMode",s.value),r("update:startColor",o.value),r("update:endColor",a.value),r("update:singleColor",l.value)}return u.watch(()=>n.pointCount,f=>{i.value=f}),u.watch(()=>n.colorMode,f=>{s.value=f}),u.watch(()=>n.startColor,f=>{o.value=f}),u.watch(()=>n.endColor,f=>{a.value=f}),u.watch(()=>n.singleColor,f=>{l.value=f}),u.watch(()=>s.value,f=>{d()}),u.watch(i,f=>{r("update:pointCount",f)}),(f,h)=>(u.openBlock(),u.createElementBlock("div",fw,[h[3]||(h[3]=u.createElementVNode("h3",null,"Color Controls",-1)),u.createElementVNode("div",hw,[h[1]||(h[1]=u.createElementVNode("label",{for:"colorMode"},"Color Mode:",-1)),u.withDirectives(u.createElementVNode("select",{id:"colorMode","onUpdate:modelValue":h[0]||(h[0]=y=>s.value=y)},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(n.colorMapMap,([y,m],b)=>(u.openBlock(),u.createElementBlock("option",{key:y,value:y},u.toDisplayString(y),9,pw))),128))],512),[[u.vModelSelect,s.value]])]),u.createElementVNode("div",yw,[u.createElementVNode("div",mw,[h[2]||(h[2]=u.createElementVNode("h4",null," Legend",-1)),(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(e.colorScheme,(y,m)=>(u.openBlock(),u.createElementBlock("div",{class:"legend-item",key:m},[u.createElementVNode("div",{class:"legend-color",style:u.normalizeStyle({backgroundColor:c(y[1])})},null,4),u.createElementVNode("div",gw,u.toDisplayString(y[0]),1)]))),128))])])]))}}),_w=mi(bw,[["__scopeId","data-v-0a5cce16"]]);function wt(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function mn(e){return function t(n){return arguments.length===0||wt(n)?t:e.apply(this,arguments)}}function gn(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return wt(n)?t:mn(function(i){return e(n,i)});default:return wt(n)&&wt(r)?t:wt(n)?mn(function(i){return e(i,r)}):wt(r)?mn(function(i){return e(n,i)}):e(n,r)}}}function vw(e){return function t(n,r,i){switch(arguments.length){case 0:return t;case 1:return wt(n)?t:gn(function(s,o){return e(n,s,o)});case 2:return wt(n)&&wt(r)?t:wt(n)?gn(function(s,o){return e(s,r,o)}):wt(r)?gn(function(s,o){return e(n,s,o)}):mn(function(s){return e(n,r,s)});default:return wt(n)&&wt(r)&&wt(i)?t:wt(n)&&wt(r)?gn(function(s,o){return e(s,o,i)}):wt(n)&&wt(i)?gn(function(s,o){return e(s,r,o)}):wt(r)&&wt(i)?gn(function(s,o){return e(n,s,o)}):wt(n)?mn(function(s){return e(s,r,i)}):wt(r)?mn(function(s){return e(n,s,i)}):wt(i)?mn(function(s){return e(n,r,s)}):e(n,r,i)}}}const ww=Number.isInteger||function(e){return e<<0===e};function Iw(e,t){var n=e<0?t.length+e:e;return t[n]}var Ew=gn(function(e,t){return t==null||t!==t?e:t});function Sw(e,t){for(var n=t,r=0;r<e.length;r+=1){if(n==null)return;var i=e[r];ww(i)?n=Iw(i,n):n=n[i]}return n}var cu=vw(function(e,t,n){return Ew(e,Sw(t,n))});async function uu(){try{return xh.fetchAuthSession().then(e=>e?.tokens?.accessToken.toString())}catch(e){console.error(e)}}const du=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],bn=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],Tw=["REQUIRED","OPTIONAL","REPEATED"],Aw=["UTF8","MAP","MAP_KEY_VALUE","LIST","ENUM","DECIMAL","DATE","TIME_MILLIS","TIME_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UINT_8","UINT_16","UINT_32","UINT_64","INT_8","INT_16","INT_32","INT_64","JSON","BSON","INTERVAL"],Ow=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],fu=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],hu={timestampFromMilliseconds(e){return new Date(Number(e))},timestampFromMicroseconds(e){return new Date(Number(e/1000n))},timestampFromNanoseconds(e){return new Date(Number(e/1000000n))},dateFromDays(e){return new Date(e*864e5)}};function pu(e,t,n,r){if(t&&n.endsWith("_DICTIONARY")){let i=e;e instanceof Uint8Array&&!(t instanceof Uint8Array)&&(i=new t.constructor(e.length));for(let s=0;s<e.length;s++)i[s]=t[e[s]];return i}else return yu(e,r)}function yu(e,t){const{element:n,parsers:r,utf8:i=!0}=t,{type:s,converted_type:o,logical_type:a}=n;if(o==="DECIMAL"){const l=10**-(n.scale||0),c=new Array(e.length);for(let d=0;d<c.length;d++)e[0]instanceof Uint8Array?c[d]=mu(e[d])*l:c[d]=Number(e[d])*l;return c}if(!o&&s==="INT96"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.timestampFromNanoseconds(Rw(e[c]));return l}if(o==="DATE"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.dateFromDays(e[c]);return l}if(o==="TIMESTAMP_MILLIS"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.timestampFromMilliseconds(e[c]);return l}if(o==="TIMESTAMP_MICROS"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.timestampFromMicroseconds(e[c]);return l}if(o==="JSON"){const l=new TextDecoder;return e.map(c=>JSON.parse(l.decode(c)))}if(o==="BSON")throw new Error("parquet bson not supported");if(o==="INTERVAL")throw new Error("parquet interval not supported");if(o==="UTF8"||a?.type==="STRING"||i&&s==="BYTE_ARRAY"){const l=new TextDecoder,c=new Array(e.length);for(let d=0;d<c.length;d++)c[d]=e[d]&&l.decode(e[d]);return c}if(o==="UINT_64"||a?.type==="INTEGER"&&a.bitWidth===64&&!a.isSigned){if(e instanceof BigInt64Array)return new BigUint64Array(e.buffer,e.byteOffset,e.length);const l=new BigUint64Array(e.length);for(let c=0;c<l.length;c++)l[c]=BigInt(e[c]);return l}if(o==="UINT_32"||a?.type==="INTEGER"&&a.bitWidth===32&&!a.isSigned){if(e instanceof Int32Array)return new Uint32Array(e.buffer,e.byteOffset,e.length);const l=new Uint32Array(e.length);for(let c=0;c<l.length;c++)l[c]=e[c];return l}if(a?.type==="FLOAT16")return Array.from(e).map(gu);if(a?.type==="TIMESTAMP"){const{unit:l}=a;let c=r.timestampFromMilliseconds;l==="MICROS"&&(c=r.timestampFromMicroseconds),l==="NANOS"&&(c=r.timestampFromNanoseconds);const d=new Array(e.length);for(let f=0;f<d.length;f++)d[f]=c(e[f]);return d}return e}function mu(e){let t=0;for(const r of e)t=t*256+r;const n=e.length*8;return t>=2**(n-1)&&(t-=2**n),t}function Rw(e){const t=(e>>64n)-2440588n,n=e&0xffffffffffffffffn;return t*86400000000000n+n}function gu(e){if(!e)return;const t=e[1]<<8|e[0],n=t>>15?-1:1,r=t>>10&31,i=t&1023;return r===0?n*2**-14*(i/1024):r===31?i?NaN:n*(1/0):n*2**(r-15)*(1+i/1024)}function bu(e,t,n){const r=e[t],i=[];let s=1;if(r.num_children)for(;i.length<r.num_children;){const o=e[t+s],a=bu(e,t+s,[...n,o.name]);s+=a.count,i.push(a)}return{count:s,element:r,children:i,path:n}}function _u(e,t){let n=bu(e,0,[]);const r=[n];for(const i of t){const s=n.children.find(o=>o.element.name===i);if(!s)throw new Error(`parquet schema element not found: ${t}`);r.push(s),n=s}return r}function vu(e){let t=0;for(const{element:n}of e)n.repetition_type==="REPEATED"&&t++;return t}function xo(e){let t=0;for(const{element:n}of e.slice(1))n.repetition_type!=="REQUIRED"&&t++;return t}function Nw(e){if(!e||e.element.converted_type!=="LIST"||e.children.length>1)return!1;const t=e.children[0];return!(t.children.length>1||t.element.repetition_type!=="REPEATED")}function Bw(e){if(!e||e.element.converted_type!=="MAP"||e.children.length>1)return!1;const t=e.children[0];return!(t.children.length!==2||t.element.repetition_type!=="REPEATED"||t.children.find(n=>n.element.name==="key")?.element.repetition_type==="REPEATED"||t.children.find(n=>n.element.name==="value")?.element.repetition_type==="REPEATED")}function Dw(e){if(e.length!==2)return!1;const[,t]=e;return!(t.element.repetition_type==="REPEATED"||t.children.length)}const Ot={STOP:0,TRUE:1,FALSE:2,BYTE:3,I16:4,I32:5,I64:6,DOUBLE:7,BINARY:8,LIST:9,STRUCT:12};function wu(e){let t=0;const n={};for(;e.offset<e.view.byteLength;){const[r,i,s]=Eu(e,t);if(t=s,r===Ot.STOP)break;n[`field_${i}`]=Ci(e,r)}return n}function Ci(e,t){switch(t){case Ot.TRUE:return!0;case Ot.FALSE:return!1;case Ot.BYTE:return e.view.getInt8(e.offset++);case Ot.I16:case Ot.I32:return $w(e);case Ot.I64:return Uo(e);case Ot.DOUBLE:{const n=e.view.getFloat64(e.offset,!0);return e.offset+=8,n}case Ot.BINARY:{const n=_n(e),r=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,n);return e.offset+=n,r}case Ot.LIST:{const[n,r]=Lw(e),i=n===Ot.TRUE||n===Ot.FALSE,s=new Array(r);for(let o=0;o<r;o++)s[o]=i?Ci(e,Ot.BYTE)===1:Ci(e,n);return s}case Ot.STRUCT:{const n={};let r=0;for(;;){let i,s;if([i,s,r]=Eu(e,r),i===Ot.STOP)break;n[`field_${s}`]=Ci(e,i)}return n}default:throw new Error(`thrift unhandled type: ${t}`)}}function _n(e){let t=0,n=0;for(;;){const r=e.view.getUint8(e.offset++);if(t|=(r&127)<<n,!(r&128))return t;n+=7}}function Fw(e){let t=0n,n=0n;for(;;){const r=e.view.getUint8(e.offset++);if(t|=BigInt(r&127)<<n,!(r&128))return t;n+=7n}}function $w(e){const t=_n(e);return t>>>1^-(t&1)}function Uo(e){const t=Fw(e);return t>>1n^-(t&1n)}function Iu(e){return e&15}function Eu(e,t){const n=e.view.getUint8(e.offset++);if((n&15)===Ot.STOP)return[0,0,t];const r=n>>4;let i;if(r)i=t+r;else throw new Error("non-delta field id not supported");return[Iu(n),i,i]}function Lw(e){const t=e.view.getUint8(e.offset++),n=t>>4,r=Iu(t);if(n===15){const i=_n(e);return[r,i]}return[r,n]}const Cw=1<<19;async function Mw(e,{parsers:t,initialFetchSize:n=Cw}={}){if(!e||!(e.byteLength>=0))throw new Error("parquet expected AsyncBuffer");const r=Math.max(0,e.byteLength-n),i=await e.slice(r,e.byteLength),s=new DataView(i);if(s.getUint32(i.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const o=s.getUint32(i.byteLength-8,!0);if(o>e.byteLength-8)throw new Error(`parquet metadata length ${o} exceeds available buffer ${e.byteLength-8}`);if(o+8>n){const a=e.byteLength-o-8,l=await e.slice(a,r),c=new ArrayBuffer(o+8),d=new Uint8Array(c);return d.set(new Uint8Array(l)),d.set(new Uint8Array(i),r-a),Po(c,{parsers:t})}else return Po(i,{parsers:t})}function Po(e,{parsers:t}={}){if(!(e instanceof ArrayBuffer))throw new Error("parquet expected ArrayBuffer");const n=new DataView(e);if(t={...hu,...t},n.byteLength<8)throw new Error("parquet file is too short");if(n.getUint32(n.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const r=n.byteLength-8,i=n.getUint32(r,!0);if(i>n.byteLength-8)throw new Error(`parquet metadata length ${i} exceeds available buffer ${n.byteLength-8}`);const s=r-i,o=wu({view:n,offset:s}),a=new TextDecoder;function l(w){return w&&a.decode(w)}const c=o.field_1,d=o.field_2.map(w=>({type:du[w.field_1],type_length:w.field_2,repetition_type:Tw[w.field_3],name:l(w.field_4),num_children:w.field_5,converted_type:Aw[w.field_6],scale:w.field_7,precision:w.field_8,field_id:w.field_9,logical_type:Uw(w.field_10)})),f=d.filter(w=>w.type),h=o.field_3,y=o.field_4.map(w=>({columns:w.field_1.map((v,B)=>({file_path:l(v.field_1),file_offset:v.field_2,meta_data:v.field_3&&{type:du[v.field_3.field_1],encodings:v.field_3.field_2?.map(O=>bn[O]),path_in_schema:v.field_3.field_3.map(l),codec:Ow[v.field_3.field_4],num_values:v.field_3.field_5,total_uncompressed_size:v.field_3.field_6,total_compressed_size:v.field_3.field_7,key_value_metadata:v.field_3.field_8,data_page_offset:v.field_3.field_9,index_page_offset:v.field_3.field_10,dictionary_page_offset:v.field_3.field_11,statistics:Pw(v.field_3.field_12,f[B],t),encoding_stats:v.field_3.field_13?.map(O=>({page_type:fu[O.field_1],encoding:bn[O.field_2],count:O.field_3})),bloom_filter_offset:v.field_3.field_14,bloom_filter_length:v.field_3.field_15,size_statistics:v.field_3.field_16&&{unencoded_byte_array_data_bytes:v.field_3.field_16.field_1,repetition_level_histogram:v.field_3.field_16.field_2,definition_level_histogram:v.field_3.field_16.field_3}},offset_index_offset:v.field_4,offset_index_length:v.field_5,column_index_offset:v.field_6,column_index_length:v.field_7,crypto_metadata:v.field_8,encrypted_column_metadata:v.field_9})),total_byte_size:w.field_2,num_rows:w.field_3,sorting_columns:w.field_4?.map(v=>({column_idx:v.field_1,descending:v.field_2,nulls_first:v.field_3})),file_offset:w.field_5,total_compressed_size:w.field_6,ordinal:w.field_7})),m=o.field_5?.map(w=>({key:l(w.field_1),value:l(w.field_2)})),b=l(o.field_6);return{version:c,schema:d,num_rows:h,row_groups:y,key_value_metadata:m,created_by:b,metadata_length:i}}function xw({schema:e}){return _u(e,[])[0]}function Uw(e){return e?.field_1?{type:"STRING"}:e?.field_2?{type:"MAP"}:e?.field_3?{type:"LIST"}:e?.field_4?{type:"ENUM"}:e?.field_5?{type:"DECIMAL",scale:e.field_5.field_1,precision:e.field_5.field_2}:e?.field_6?{type:"DATE"}:e?.field_7?{type:"TIME",isAdjustedToUTC:e.field_7.field_1,unit:Su(e.field_7.field_2)}:e?.field_8?{type:"TIMESTAMP",isAdjustedToUTC:e.field_8.field_1,unit:Su(e.field_8.field_2)}:e?.field_10?{type:"INTEGER",bitWidth:e.field_10.field_1,isSigned:e.field_10.field_2}:e?.field_11?{type:"NULL"}:e?.field_12?{type:"JSON"}:e?.field_13?{type:"BSON"}:e?.field_14?{type:"UUID"}:e?.field_15?{type:"FLOAT16"}:e}function Su(e){if(e.field_1)return"MILLIS";if(e.field_2)return"MICROS";if(e.field_3)return"NANOS";throw new Error("parquet time unit required")}function Pw(e,t,n){return e&&{max:Mi(e.field_1,t,n),min:Mi(e.field_2,t,n),null_count:e.field_3,distinct_count:e.field_4,max_value:Mi(e.field_5,t,n),min_value:Mi(e.field_6,t,n),is_max_value_exact:e.field_7,is_min_value_exact:e.field_8}}function Mi(e,t,n){const{type:r,converted_type:i,logical_type:s}=t;if(e===void 0)return e;if(r==="BOOLEAN")return e[0]===1;if(r==="BYTE_ARRAY")return new TextDecoder().decode(e);const o=new DataView(e.buffer,e.byteOffset,e.byteLength);return r==="FLOAT"&&o.byteLength===4?o.getFloat32(0,!0):r==="DOUBLE"&&o.byteLength===8?o.getFloat64(0,!0):r==="INT32"&&i==="DATE"?n.dateFromDays(o.getInt32(0,!0)):r==="INT64"&&i==="TIMESTAMP_MILLIS"?n.timestampFromMilliseconds(o.getBigInt64(0,!0)):r==="INT64"&&i==="TIMESTAMP_MICROS"?n.timestampFromMicroseconds(o.getBigInt64(0,!0)):r==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="NANOS"?n.timestampFromNanoseconds(o.getBigInt64(0,!0)):r==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="MICROS"?n.timestampFromMicroseconds(o.getBigInt64(0,!0)):r==="INT64"&&s?.type==="TIMESTAMP"?n.timestampFromMilliseconds(o.getBigInt64(0,!0)):r==="INT32"&&o.byteLength===4?o.getInt32(0,!0):r==="INT64"&&o.byteLength===8?o.getBigInt64(0,!0):i==="DECIMAL"?mu(e)*10**-(t.scale||0):s?.type==="FLOAT16"?gu(e):e}function ko(e,t){for(let n=0;n<t.length;n+=1e4)e.push(...t.slice(n,n+1e4))}function Tu(e){if(!e)return[];if(e.length===1)return e[0];const t=[];for(const n of e)ko(t,n);return t}const kw=1<<25;function Vw({metadata:e,rowStart:t=0,rowEnd:n=1/0,columns:r}){if(!e)throw new Error("parquetPlan requires metadata");const i=[],s=[];let o=0;for(const a of e.row_groups){const l=Number(a.num_rows),c=o+l;if(l>0&&c>=t&&o<n){const d=[];for(const{file_path:m,meta_data:b}of a.columns){if(m)throw new Error("parquet file_path not supported");if(!b)throw new Error("parquet column metadata is undefined");(!r||r.includes(b.path_in_schema[0]))&&d.push(Au(b))}const f=Math.max(t-o,0),h=Math.min(n-o,l);i.push({ranges:d,rowGroup:a,groupStart:o,groupRows:l,selectStart:f,selectEnd:h});const y=d[d.length-1]?.endByte-d[0]?.startByte;if(!r&&y<kw)s.push({startByte:d[0].startByte,endByte:d[d.length-1].endByte});else if(d.length)ko(s,d);else if(r?.length)throw new Error(`parquet columns not found: ${r.join(", ")}`)}o=c}return isFinite(n)||(n=o),{metadata:e,rowStart:t,rowEnd:n,columns:r,fetches:s,groups:i}}function Au({dictionary_page_offset:e,data_page_offset:t,total_compressed_size:n}){const r=e||t;return{startByte:Number(r),endByte:Number(r+n)}}function zw(e,{fetches:t}){const n=t.map(({startByte:r,endByte:i})=>e.slice(r,i));return{byteLength:e.byteLength,slice(r,i=e.byteLength){const s=t.findIndex(({startByte:o,endByte:a})=>o<=r&&i<=a);if(s<0)throw new Error(`no prefetch for range [${r}, ${i}]`);if(t[s].startByte!==r||t[s].endByte!==i){const o=r-t[s].startByte,a=i-t[s].startByte;return n[s]instanceof Promise?n[s].then(l=>l.slice(o,a)):n[s].slice(o,a)}else return n[s]}}}function Ou(e,t,n,r,i){const s=t?.length||n.length;if(!s)return r;const o=xo(i),a=i.map(({element:m})=>m.repetition_type);let l=0;const c=[e];let d=e,f=0,h=0,y=0;if(n[0])for(;f<a.length-2&&y<n[0];)f++,a[f]!=="REQUIRED"&&(d=d.at(-1),c.push(d),h++),a[f]==="REPEATED"&&y++;for(let m=0;m<s;m++){const b=t?.length?t[m]:o,w=n[m];for(;f&&(w<y||a[f]!=="REPEATED");)a[f]!=="REQUIRED"&&(c.pop(),h--),a[f]==="REPEATED"&&y--,f--;for(d=c.at(-1);(f<a.length-2||a[f+1]==="REPEATED")&&(h<b||a[f+1]==="REQUIRED");){if(f++,a[f]!=="REQUIRED"){const v=[];d.push(v),d=v,c.push(v),h++}a[f]==="REPEATED"&&y++}b===o?d.push(r[l++]):f===a.length-2?d.push(null):d.push([])}if(!e.length)for(let m=0;m<o;m++){const b=[];d.push(b),d=b}return e}function Br(e,t,n=0){const r=t.path.join("."),i=t.element.repetition_type==="OPTIONAL",s=i?n+1:n;if(Nw(t)){let o=t.children[0],a=s;o.children.length===1&&(o=o.children[0],a++),Br(e,o,a);const l=o.path.join("."),c=e.get(l);if(!c)throw new Error("parquet list column missing values");i&&xi(c,n),e.set(r,c),e.delete(l);return}if(Bw(t)){const o=t.children[0].element.name;Br(e,t.children[0].children[0],s+1),Br(e,t.children[0].children[1],s+1);const a=e.get(`${r}.${o}.key`),l=e.get(`${r}.${o}.value`);if(!a)throw new Error("parquet map column missing keys");if(!l)throw new Error("parquet map column missing values");if(a.length!==l.length)throw new Error("parquet map column key/value length mismatch");const c=Ru(a,l,s);i&&xi(c,n),e.delete(`${r}.${o}.key`),e.delete(`${r}.${o}.value`),e.set(r,c);return}if(t.children.length){const o=t.element.repetition_type==="REQUIRED"?n:n+1,a={};for(const c of t.children){Br(e,c,o);const d=e.get(c.path.join("."));if(!d)throw new Error("parquet struct missing child data");a[c.element.name]=d}for(const c of t.children)e.delete(c.path.join("."));const l=Nu(a,o);i&&xi(l,n),e.set(r,l)}}function xi(e,t){for(let n=0;n<e.length;n++)t?xi(e[n],t-1):e[n]=e[n][0]}function Ru(e,t,n){const r=[];for(let i=0;i<e.length;i++)if(n)r.push(Ru(e[i],t[i],n-1));else if(e[i]){const s={};for(let o=0;o<e[i].length;o++){const a=t[i][o];s[e[i][o]]=a===void 0?null:a}r.push(s)}else r.push(void 0);return r}function Nu(e,t){const n=Object.keys(e),r=e[n[0]]?.length,i=[];for(let s=0;s<r;s++){const o={};for(const a of n){if(e[a].length!==r)throw new Error("parquet struct parsing error");o[a]=e[a][s]}t?i.push(Nu(o,t-1)):i.push(o)}return i}function Dr(e,t,n){const r=n instanceof Int32Array,i=_n(e),s=_n(e);_n(e);let o=Uo(e),a=0;n[a++]=r?Number(o):o;const l=i/s;for(;a<t;){const c=Uo(e),d=new Uint8Array(s);for(let f=0;f<s;f++)d[f]=e.view.getUint8(e.offset++);for(let f=0;f<s&&a<t;f++){const h=BigInt(d[f]);if(h){let y=0n,m=l;const b=(1n<<h)-1n;for(;m&&a<t;){let w=BigInt(e.view.getUint8(e.offset))>>y&b;for(y+=h;y>=8;)y-=8n,e.offset++,y&&(w|=BigInt(e.view.getUint8(e.offset))<<h-y&b);const v=c+w;o+=v,n[a++]=r?Number(o):o,m--}m&&(e.offset+=Math.ceil((m*Number(h)+Number(y))/8))}else for(let y=0;y<l&&a<t;y++)o+=c,n[a++]=r?Number(o):o}}}function Bu(e,t,n){const r=new Int32Array(t);Dr(e,t,r);for(let i=0;i<t;i++)n[i]=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,r[i]),e.offset+=r[i]}function jw(e,t,n){const r=new Int32Array(t);Dr(e,t,r);const i=new Int32Array(t);Dr(e,t,i);for(let s=0;s<t;s++){const o=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,i[s]);r[s]?(n[s]=new Uint8Array(r[s]+i[s]),n[s].set(n[s-1].subarray(0,r[s])),n[s].set(o,r[s])):n[s]=o,e.offset+=i[s]}}function Ui(e){return 32-Math.clz32(e)}function Qe(e,t,n,r){r===void 0&&(r=e.view.getUint32(e.offset,!0),e.offset+=4);const i=e.offset;let s=0;for(;s<n.length;){const o=_n(e);if(o&1)s=qw(e,o,t,n,s);else{const a=o>>>1;Yw(e,a,t,n,s),s+=a}}e.offset=i+r}function Yw(e,t,n,r,i){const s=n+7>>3;let o=0;for(let a=0;a<s;a++)o|=e.view.getUint8(e.offset++)<<(a<<3);for(let a=0;a<t;a++)r[i+a]=o}function qw(e,t,n,r,i){let s=t>>1<<3;const o=(1<<n)-1;let a=0;if(e.offset<e.view.byteLength)a=e.view.getUint8(e.offset++);else if(o)throw new Error(`parquet bitpack offset ${e.offset} out of range`);let l=8,c=0;for(;s;)c>8?(c-=8,l-=8,a>>>=8):l-c<n?(a|=e.view.getUint8(e.offset)<<l,e.offset++,l+=8):(i<r.length&&(r[i++]=a>>c&o),s--,c+=n);return i}function Du(e,t,n,r){const i=Ww(n,r),s=new Uint8Array(t*i);for(let o=0;o<i;o++)for(let a=0;a<t;a++)s[a*i+o]=e.view.getUint8(e.offset++);if(n==="FLOAT")return new Float32Array(s.buffer);if(n==="DOUBLE")return new Float64Array(s.buffer);if(n==="INT32")return new Int32Array(s.buffer);if(n==="INT64")return new BigInt64Array(s.buffer);if(n==="FIXED_LEN_BYTE_ARRAY"){const o=new Array(t);for(let a=0;a<t;a++)o[a]=s.subarray(a*i,(a+1)*i);return o}throw new Error(`parquet byte_stream_split unsupported type: ${n}`)}function Ww(e,t){switch(e){case"INT32":case"FLOAT":return 4;case"INT64":case"DOUBLE":return 8;case"FIXED_LEN_BYTE_ARRAY":if(!t)throw new Error("parquet byteWidth missing type_length");return t;default:throw new Error(`parquet unsupported type: ${e}`)}}function Vo(e,t,n,r){if(n===0)return[];if(t==="BOOLEAN")return Gw(e,n);if(t==="INT32")return Hw(e,n);if(t==="INT64")return Kw(e,n);if(t==="INT96")return Qw(e,n);if(t==="FLOAT")return Jw(e,n);if(t==="DOUBLE")return Xw(e,n);if(t==="BYTE_ARRAY")return Zw(e,n);if(t==="FIXED_LEN_BYTE_ARRAY"){if(!r)throw new Error("parquet missing fixed length");return t1(e,n,r)}else throw new Error(`parquet unhandled type: ${t}`)}function Gw(e,t){const n=new Array(t);for(let r=0;r<t;r++){const i=e.offset+(r/8|0),s=r%8,o=e.view.getUint8(i);n[r]=(o&1<<s)!==0}return e.offset+=Math.ceil(t/8),n}function Hw(e,t){const n=(e.view.byteOffset+e.offset)%4?new Int32Array(Pi(e.view.buffer,e.view.byteOffset+e.offset,t*4)):new Int32Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*4,n}function Kw(e,t){const n=(e.view.byteOffset+e.offset)%8?new BigInt64Array(Pi(e.view.buffer,e.view.byteOffset+e.offset,t*8)):new BigInt64Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*8,n}function Qw(e,t){const n=new Array(t);for(let r=0;r<t;r++){const i=e.view.getBigInt64(e.offset+r*12,!0),s=e.view.getInt32(e.offset+r*12+8,!0);n[r]=BigInt(s)<<64n|i}return e.offset+=t*12,n}function Jw(e,t){const n=(e.view.byteOffset+e.offset)%4?new Float32Array(Pi(e.view.buffer,e.view.byteOffset+e.offset,t*4)):new Float32Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*4,n}function Xw(e,t){const n=(e.view.byteOffset+e.offset)%8?new Float64Array(Pi(e.view.buffer,e.view.byteOffset+e.offset,t*8)):new Float64Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*8,n}function Zw(e,t){const n=new Array(t);for(let r=0;r<t;r++){const i=e.view.getUint32(e.offset,!0);e.offset+=4,n[r]=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,i),e.offset+=i}return n}function t1(e,t,n){const r=new Array(t);for(let i=0;i<t;i++)r[i]=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,n),e.offset+=n;return r}function Pi(e,t,n){const r=new ArrayBuffer(n);return new Uint8Array(r).set(new Uint8Array(e,t,n)),r}const e1=[0,255,65535,16777215,4294967295];function Fu(e,t,n,r,i){for(let s=0;s<i;s++)n[r+s]=e[t+s]}function n1(e,t){const n=e.byteLength,r=t.byteLength;let i=0,s=0;for(;i<n;){const o=e[i];if(i++,o<128)break}if(r&&i>=n)throw new Error("invalid snappy length header");for(;i<n;){const o=e[i];let a=0;if(i++,i>=n)throw new Error("missing eof marker");if((o&3)===0){let l=(o>>>2)+1;if(l>60){if(i+3>=n)throw new Error("snappy error literal pos + 3 >= inputLength");const c=l-60;l=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),l=(l&e1[c])+1,i+=c}if(i+l>n)throw new Error("snappy error literal exceeds input length");Fu(e,i,t,s,l),i+=l,s+=l}else{let l=0;switch(o&3){case 1:a=(o>>>2&7)+4,l=e[i]+(o>>>5<<8),i++;break;case 2:if(n<=i+1)throw new Error("snappy error end of input");a=(o>>>2)+1,l=e[i]+(e[i+1]<<8),i+=2;break;case 3:if(n<=i+3)throw new Error("snappy error end of input");a=(o>>>2)+1,l=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),i+=4;break}if(l===0||isNaN(l))throw new Error(`invalid offset ${l} pos ${i} inputLength ${n}`);if(l>s)throw new Error("cannot copy from before start of buffer");Fu(t,s-l,t,s,a),s+=a}}if(s!==r)throw new Error("premature end of input")}function r1(e,t,{type:n,element:r,schemaPath:i}){const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o={view:s,offset:0};let a;const l=i1(o,t,i),{definitionLevels:c,numNulls:d}=s1(o,t,i),f=t.num_values-d;if(t.encoding==="PLAIN")a=Vo(o,n,f,r.type_length);else if(t.encoding==="PLAIN_DICTIONARY"||t.encoding==="RLE_DICTIONARY"||t.encoding==="RLE"){const h=n==="BOOLEAN"?1:s.getUint8(o.offset++);h?(a=new Array(f),n==="BOOLEAN"?(Qe(o,h,a),a=a.map(y=>!!y)):Qe(o,h,a,s.byteLength-o.offset)):a=new Uint8Array(f)}else if(t.encoding==="BYTE_STREAM_SPLIT")a=Du(o,f,n,r.type_length);else if(t.encoding==="DELTA_BINARY_PACKED")a=n==="INT32"?new Int32Array(f):new BigInt64Array(f),Dr(o,f,a);else if(t.encoding==="DELTA_LENGTH_BYTE_ARRAY")a=new Array(f),Bu(o,f,a);else throw new Error(`parquet unsupported encoding: ${t.encoding}`);return{definitionLevels:c,repetitionLevels:l,dataPage:a}}function i1(e,t,n){if(n.length>1){const r=vu(n);if(r){const i=new Array(t.num_values);return Qe(e,Ui(r),i),i}}return[]}function s1(e,t,n){const r=xo(n);if(!r)return{definitionLevels:[],numNulls:0};const i=new Array(t.num_values);Qe(e,Ui(r),i);let s=t.num_values;for(const o of i)o===r&&s--;return s===0&&(i.length=0),{definitionLevels:i,numNulls:s}}function zo(e,t,n,r){let i;const s=r?.[n];if(n==="UNCOMPRESSED")i=e;else if(s)i=s(e,t);else if(n==="SNAPPY")i=new Uint8Array(t),n1(e,i);else throw new Error(`parquet unsupported compression codec: ${n}`);if(i?.length!==t)throw new Error(`parquet decompressed page length ${i?.length} does not match header ${t}`);return i}function o1(e,t,n){const r={view:new DataView(e.buffer,e.byteOffset,e.byteLength),offset:0},{type:i,element:s,schemaPath:o,codec:a,compressors:l}=n,c=t.data_page_header_v2;if(!c)throw new Error("parquet data page header v2 is undefined");const d=a1(r,c,o);r.offset=c.repetition_levels_byte_length;const f=l1(r,c,o),h=t.uncompressed_page_size-c.definition_levels_byte_length-c.repetition_levels_byte_length;let y=e.subarray(r.offset);c.is_compressed!==!1&&(y=zo(y,h,a,l));const m=new DataView(y.buffer,y.byteOffset,y.byteLength),b={view:m,offset:0};let w;const v=c.num_values-c.num_nulls;if(c.encoding==="PLAIN")w=Vo(b,i,v,s.type_length);else if(c.encoding==="RLE")w=new Array(v),Qe(b,1,w),w=w.map(B=>!!B);else if(c.encoding==="PLAIN_DICTIONARY"||c.encoding==="RLE_DICTIONARY"){const B=m.getUint8(b.offset++);w=new Array(v),Qe(b,B,w,h-1)}else if(c.encoding==="DELTA_BINARY_PACKED")w=i==="INT32"?new Int32Array(v):new BigInt64Array(v),Dr(b,v,w);else if(c.encoding==="DELTA_LENGTH_BYTE_ARRAY")w=new Array(v),Bu(b,v,w);else if(c.encoding==="DELTA_BYTE_ARRAY")w=new Array(v),jw(b,v,w);else if(c.encoding==="BYTE_STREAM_SPLIT")w=Du(r,v,i,s.type_length);else throw new Error(`parquet unsupported encoding: ${c.encoding}`);return{definitionLevels:f,repetitionLevels:d,dataPage:w}}function a1(e,t,n){const r=vu(n);if(!r)return[];const i=new Array(t.num_values);return Qe(e,Ui(r),i,t.repetition_levels_byte_length),i}function l1(e,t,n){const r=xo(n);if(r){const i=new Array(t.num_values);return Qe(e,Ui(r),i,t.definition_levels_byte_length),i}}function c1(e,{groupStart:t,selectStart:n,selectEnd:r},i,s){const{columnName:o}=i,a=[];let l,c,d=0;const f=s&&(()=>{c&&s({columnName:o,columnData:c,rowStart:t+d-c.length,rowEnd:t+d})});for(;d<r&&!(e.offset>=e.view.byteLength-1);){const h=u1(e);if(h.type==="DICTIONARY_PAGE")l=$u(e,h,i,l,void 0,0),l=yu(l,i);else{const y=c?.length||0,m=$u(e,h,i,l,c,n-d);c===m?d+=m.length-y:(f?.(),a.push(m),d+=m.length,c=m)}}return f?.(),d>r&&c&&(a[a.length-1]=c.slice(0,r-(d-c.length))),a}function $u(e,t,n,r,i,s){const{type:o,element:a,schemaPath:l,codec:c,compressors:d}=n,f=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,t.compressed_page_size);if(e.offset+=t.compressed_page_size,t.type==="DATA_PAGE"){const h=t.data_page_header;if(!h)throw new Error("parquet data page header is undefined");if(s>h.num_values&&Dw(l))return new Array(h.num_values);const y=zo(f,Number(t.uncompressed_page_size),c,d),{definitionLevels:m,repetitionLevels:b,dataPage:w}=r1(y,h,n);let v=pu(w,r,h.encoding,n);if(b.length||m?.length){const B=Array.isArray(i)?i:[];return Ou(B,m,b,v,l)}else{for(let B=2;B<l.length;B++)l[B].element.repetition_type!=="REQUIRED"&&(v=Array.from(v,O=>[O]));return v}}else if(t.type==="DATA_PAGE_V2"){const h=t.data_page_header_v2;if(!h)throw new Error("parquet data page header v2 is undefined");if(s>h.num_rows)return new Array(h.num_values);const{definitionLevels:y,repetitionLevels:m,dataPage:b}=o1(f,t,n),w=pu(b,r,h.encoding,n),v=Array.isArray(i)?i:[];return Ou(v,y,m,w,l)}else if(t.type==="DICTIONARY_PAGE"){const h=t.dictionary_page_header;if(!h)throw new Error("parquet dictionary page header is undefined");const y=zo(f,Number(t.uncompressed_page_size),c,d),m={view:new DataView(y.buffer,y.byteOffset,y.byteLength),offset:0};return Vo(m,o,h.num_values,a.type_length)}else throw new Error(`parquet unsupported page type: ${t.type}`)}function u1(e){const t=wu(e),n=fu[t.field_1],r=t.field_2,i=t.field_3,s=t.field_4,o=t.field_5&&{num_values:t.field_5.field_1,encoding:bn[t.field_5.field_2],definition_level_encoding:bn[t.field_5.field_3],repetition_level_encoding:bn[t.field_5.field_4],statistics:t.field_5.field_5&&{max:t.field_5.field_5.field_1,min:t.field_5.field_5.field_2,null_count:t.field_5.field_5.field_3,distinct_count:t.field_5.field_5.field_4,max_value:t.field_5.field_5.field_5,min_value:t.field_5.field_5.field_6}},a=t.field_6,l=t.field_7&&{num_values:t.field_7.field_1,encoding:bn[t.field_7.field_2],is_sorted:t.field_7.field_3},c=t.field_8&&{num_values:t.field_8.field_1,num_nulls:t.field_8.field_2,num_rows:t.field_8.field_3,encoding:bn[t.field_8.field_4],definition_levels_byte_length:t.field_8.field_5,repetition_levels_byte_length:t.field_8.field_6,is_compressed:t.field_8.field_7===void 0?!0:t.field_8.field_7,statistics:t.field_8.field_8};return{type:n,uncompressed_page_size:r,compressed_page_size:i,crc:s,data_page_header:o,index_page_header:a,dictionary_page_header:l,data_page_header_v2:c}}function d1(e,{metadata:t,columns:n},r){const{file:i,compressors:s,utf8:o}=e,a=[],l={...hu,...e.parsers};for(const{file_path:c,meta_data:d}of r.rowGroup.columns){if(c)throw new Error("parquet file_path not supported");if(!d)throw new Error("parquet column metadata is undefined");const f=d.path_in_schema[0];if(n&&!n.includes(f))continue;const{startByte:h,endByte:y}=Au(d),m=y-h;if(m>1<<30){console.warn(`parquet skipping huge column "${d.path_in_schema}" ${m} bytes`);continue}const b=Promise.resolve(i.slice(h,y));a.push({pathInSchema:d.path_in_schema,data:b.then(w=>{const v=_u(t.schema,d.path_in_schema),B={view:new DataView(w),offset:0},O={columnName:d.path_in_schema.join("."),type:d.type,element:v[v.length-1].element,schemaPath:v,codec:d.codec,parsers:l,compressors:s,utf8:o};return c1(B,r,O,e.onPage)})})}return{groupStart:r.groupStart,groupRows:r.groupRows,asyncColumns:a}}async function f1({asyncColumns:e},t,n,r,i){const s=new Array(n),o=await Promise.all(e.map(({data:d})=>d.then(Tu))),a=e.map(d=>d.pathInSchema[0]).filter(d=>!r||r.includes(d)),l=r??a,c=l.map(d=>e.findIndex(f=>f.pathInSchema[0]===d));for(let d=t;d<n;d++)if(i==="object"){const f={};for(let h=0;h<e.length;h++)f[e[h].pathInSchema[0]]=o[h][d];s[d]=f}else{const f=new Array(e.length);for(let h=0;h<l.length;h++)c[h]>=0&&(f[h]=o[c[h]][d]);s[d]=f}return s}function h1(e,t){const{asyncColumns:n}=e,r=[];for(const i of t.children)if(i.children.length){const s=n.filter(l=>l.pathInSchema[0]===i.element.name);if(!s.length)continue;const o=new Map,a=Promise.all(s.map(l=>l.data.then(c=>{o.set(l.pathInSchema.join("."),Tu(c))}))).then(()=>{Br(o,i);const l=o.get(i.path.join("."));if(!l)throw new Error("parquet column data not assembled");return[l]});r.push({pathInSchema:i.path,data:a})}else{const s=n.find(o=>o.pathInSchema[0]===i.element.name);s&&r.push(s)}return{...e,asyncColumns:r}}async function p1(e){e.metadata??=await Mw(e.file);const t=y1(e),{rowStart:n=0,rowEnd:r,columns:i,onChunk:s,onComplete:o,rowFormat:a}=e;if(!o&&!s){for(const{asyncColumns:d}of t)for(const{data:f}of d)await f;return}const l=xw(e.metadata),c=t.map(d=>h1(d,l));if(s)for(const d of c)for(const f of d.asyncColumns)f.data.then(h=>{let y=d.groupStart;for(const m of h)s({columnName:f.pathInSchema[0],columnData:m,rowStart:y,rowEnd:y+m.length}),y+=m.length});if(o){const d=[];for(const f of c){const h=Math.max(n-f.groupStart,0),y=Math.min((r??1/0)-f.groupStart,f.groupRows),m=await f1(f,h,y,i,a);ko(d,m.slice(h,y))}o(d)}else for(const{asyncColumns:d}of c)for(const{data:f}of d)await f}function y1(e){if(!e.metadata)throw new Error("parquet requires metadata");const t=Vw(e);return e.file=zw(e.file,t),t.groups.map(n=>d1(e,t,n))}const m1={class:"app-container"},g1=u.defineComponent({__name:"wrapper",props:{apiUrl:{type:String,default:""},pkg:{type:Object,default:{}}},setup(e){const t=e,n=u.ref(5e3),r=u.ref("random"),i=u.ref("#ff0000"),s=u.ref("#0000ff"),o=u.ref("#4285f4"),a=u.ref(!1),l=u.ref(0),c=u.ref(""),d=u.ref(),f=u.ref(),h=u.ref(),y=u.ref(new Map),m=u.ref(new Map);u.watch(()=>f.value,()=>{O()}),u.onMounted(async()=>{try{await b();let T=await w(d.value[0].content.id);const A=await(await fetch(T)).arrayBuffer();await p1({file:A,onComplete:R=>{h.value=Po(A),r.value=h.value.key_value_metadata[0].key,f.value=R}})}catch(T){console.error(T)}});async function b(){const T=cu("",["content","id"],t.pkg),A=await uu(),R=`${t.apiUrl?t.apiUrl:"https://api.pennsieve.net"}/packages/${T}/view?api_key=${A}`;try{const $=await fetch(R,{method:"GET",headers:{"Content-Type":"application/json"}});if($.ok){d.value=await $.json();return}if(!$.ok)return}catch($){throw console.error($),$}}async function w(T){const A=cu("",["content","id"],t.pkg),R=await uu(),$=`${t.apiUrl?t.apiUrl:"https://api.pennsieve.net"}/packages/${A}/files/${T}?api_key=${R}`;try{const L=await fetch($,{method:"GET",headers:{"Content-Type":"application/json"}});if(L.ok)return(await L.json()).url;if(!L.ok)return}catch(L){throw console.error(L),L}}function v(){a.value=!a.value,l.value++}function B(T){try{if(!T||T.length<7)return console.warn(`Invalid hex color: ${T}, using fallback`),[1,0,0];const A=parseInt(T.slice(1,3),16)/255,R=parseInt(T.slice(3,5),16)/255,$=parseInt(T.slice(5,7),16)/255;return isNaN(A)||isNaN(R)||isNaN($)?(console.warn(`Invalid hex color components in: ${T}, using fallback`),[1,0,0]):[A,R,$]}catch(A){return console.error("Error converting hex to RGB:",A),[1,0,0]}}function O(){const T=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"].map(A=>B(A));for(let A=0;A<h.value.key_value_metadata.length-1;A++){const R=h.value.key_value_metadata[A].key,$=JSON.parse(h.value.key_value_metadata[A].value);let L=new Map,tt=0;for(let Q in $)L.set($[Q],T[tt%T.length]),tt++;m.value.set(R,L),m.value.get(R)==null&&m.value.set(R,new Map)}}function D(T){c.value=T[0],y.value=T[1]}return(T,A)=>(u.openBlock(),u.createElementBlock("div",m1,[(u.openBlock(),u.createBlock(dw,{data:f.value,metaData:h.value,pointCount:n.value,"color-map":y.value,colorMode:r.value,startColor:i.value,endColor:s.value,singleColor:o.value,forceRegenerate:a.value,key:l.value},null,8,["data","metaData","pointCount","color-map","colorMode","startColor","endColor","singleColor","forceRegenerate"])),u.createVNode(_w,{pointCount:n.value,"onUpdate:pointCount":A[0]||(A[0]=R=>n.value=R),colorMode:r.value,"onUpdate:colorMode":A[1]||(A[1]=R=>r.value=R),startColor:i.value,"onUpdate:startColor":A[2]||(A[2]=R=>i.value=R),endColor:s.value,"onUpdate:endColor":A[3]||(A[3]=R=>s.value=R),singleColor:o.value,"onUpdate:singleColor":A[4]||(A[4]=R=>o.value=R),"color-scheme":y.value,"color-map-map":m.value,onRegenerate:v,onUpdateColorMap:D},null,8,["pointCount","colorMode","startColor","endColor","singleColor","color-scheme","color-map-map"])]))}}),b1=mi(g1,[["__scopeId","data-v-653da87f"]]),_1="dashboard:globalVars";function Lu(e=!1){const t=u.inject(_1,null);return!t&&e&&console.warn("[Widget] dashboard:globalVars not provided."),t}const v1={class:"data-explorer-wrap"},w1={class:"data-explorer-info"},I1=u.defineComponent({inheritAttrs:!1,__name:"DataExplorer",setup(e){const t=Lu(),n=u.ref("Data Explorer"),r=u.computed(()=>u.unref(t.apiUrl)),s=u.computed(()=>u.unref(t.filters)).value.currentPackage;return u.watch(()=>u.unref(t.filters).srcPackage,o=>{console.log("new package added "+o)}),(o,a)=>{const l=u.resolveComponent("el-icon");return u.openBlock(),u.createElementBlock(u.Fragment,null,[u.renderSlot(o.$slots,"default",{widgetName:n.value},void 0,!0),u.createElementVNode("div",v1,[u.createElementVNode("div",w1,[u.createVNode(u.unref(bc),{placement:"top-start"},{content:u.withCtx(()=>a[0]||(a[0]=[u.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])),default:u.withCtx(()=>[u.createVNode(l,{color:"#8300BF"},{default:u.withCtx(()=>[u.createVNode(u.unref(Al))]),_:1})]),_:1})]),u.createVNode(u.unref(Cb),{pkg:u.unref(s),apiKey:r.value},null,8,["pkg","apiKey"])])],64)}}}),Cu=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},E1=Cu(I1,[["__scopeId","data-v-827e52a6"]]),S1={class:"umap-wrap"},T1={class:"umap-title"},A1=Cu(Object.assign({inheritAttrs:!1},{__name:"Umap",setup(e){const t=Lu(),n=u.ref("Data Explorer"),r=u.computed(()=>u.unref(t?.apiUrl)||"");return(i,s)=>{const o=u.resolveComponent("el-icon");return u.openBlock(),u.createElementBlock(u.Fragment,null,[u.renderSlot(i.$slots,"default",{widgetName:n.value},void 0,!0),u.createElementVNode("div",S1,[u.createElementVNode("div",T1,[u.createVNode(u.unref(bc),{placement:"top-start"},{content:u.withCtx(()=>s[0]||(s[0]=[u.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])),default:u.withCtx(()=>[u.createVNode(o,{color:"#8300BF"},{default:u.withCtx(()=>[u.createVNode(u.unref(Al))]),_:1})]),_:1})]),u.createVNode(u.unref(b1),{apiKey:r.value},null,8,["apiKey"])])],64)}}}),[["__scopeId","data-v-499b6c7c"]]);function H(e,t,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{c(r.next(d))}catch(f){o(f)}}function l(d){try{c(r.throw(d))}catch(f){o(f)}}function c(d){d.done?s(d.value):i(d.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}function Mu(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Z(e){return this instanceof Z?(this.v=e,this):new Z(e)}function ge(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(y){return function(m){return Promise.resolve(m).then(y,f)}}function a(y,m){r[y]&&(i[y]=function(b){return new Promise(function(w,v){s.push([y,b,w,v])>1||l(y,b)})},m&&(i[y]=m(i[y])))}function l(y,m){try{c(r[y](m))}catch(b){h(s[0][3],b)}}function c(y){y.value instanceof Z?Promise.resolve(y.value.v).then(d,f):h(s[0][2],y)}function d(y){l("next",y)}function f(y){l("throw",y)}function h(y,m){y(m),s.shift(),s.length&&l(s[0][0],s[0][1])}}function ki(e){var t,n;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]=e[i]?function(o){return(n=!n)?{value:Z(e[i](o)),done:!1}:s?s(o):o}:s}}function vn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Mu=="function"?Mu(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(o){return new Promise(function(a,l){o=e[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}const O1=new TextDecoder("utf-8"),jo=e=>O1.decode(e),R1=new TextEncoder,Yo=e=>R1.encode(e),N1=e=>typeof e=="number",xu=e=>typeof e=="boolean",St=e=>typeof e=="function",Ut=e=>e!=null&&Object(e)===e,wn=e=>Ut(e)&&St(e.then),Fr=e=>Ut(e)&&St(e[Symbol.iterator]),kn=e=>Ut(e)&&St(e[Symbol.asyncIterator]),qo=e=>Ut(e)&&Ut(e.schema),Uu=e=>Ut(e)&&"done"in e&&"value"in e,Pu=e=>Ut(e)&&St(e.stat)&&N1(e.fd),ku=e=>Ut(e)&&Wo(e.body),Vi=e=>"_getDOMStream"in e&&"_getNodeStream"in e,B1=e=>Ut(e)&&St(e.abort)&&St(e.getWriter)&&!Vi(e),Wo=e=>Ut(e)&&St(e.cancel)&&St(e.getReader)&&!Vi(e),D1=e=>Ut(e)&&St(e.end)&&St(e.write)&&xu(e.writable)&&!Vi(e),Vu=e=>Ut(e)&&St(e.read)&&St(e.pipe)&&xu(e.readable)&&!Vi(e),F1=e=>Ut(e)&&St(e.clear)&&St(e.bytes)&&St(e.position)&&St(e.setPosition)&&St(e.capacity)&&St(e.getBufferIdentifier)&&St(e.createLong),Go=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function $1(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let o,a,l=0,c=0,d=e.length;++l<d;){if(o=t[c],a=e[l],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++c]=a);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:s}=a,n+i<r||r+s<n){a&&(t[++c]=a);continue}t[c]=new Uint8Array(o.buffer,n,r-n+s)}return t}function zu(e,t,n=0,r=t.byteLength){const i=e.byteLength,s=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return s.set(o,n),e}function be(e,t){const n=$1(e),r=n.reduce((d,f)=>d+f.byteLength,0);let i,s,o,a=0,l=-1;const c=Math.min(t||Number.POSITIVE_INFINITY,r);for(const d=n.length;++l<d;){if(i=n[l],s=i.subarray(0,Math.min(i.length,c-a)),c<=a+s.length){s.length<i.length?n[l]=i.subarray(s.length):s.length===i.length&&l++,o?zu(o,s,a):o=s;break}zu(o||(o=new Uint8Array(c)),s,a),a+=s.length}return[o||new Uint8Array(0),n.slice(l),r-(o?o.byteLength:0)]}function mt(e,t){let n=Uu(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Yo(n)),n instanceof ArrayBuffer?new e(n):n instanceof Go?new e(n):F1(n)?mt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const $r=e=>mt(Int32Array,e),ju=e=>mt(BigInt64Array,e),it=e=>mt(Uint8Array,e),Ho=e=>(e.next(),e);function*L1(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Go?n(t):Fr(t)?t:n(t);return yield*Ho((function*(i){let s=null;do s=i.next(yield mt(e,s));while(!s.done)})(r[Symbol.iterator]())),new e}const C1=e=>L1(Uint8Array,e);function Yu(e,t){return ge(this,arguments,function*(){if(wn(t))return yield Z(yield Z(yield*ki(vn(Yu(e,yield Z(t))))));const n=function(s){return ge(this,arguments,function*(){yield yield Z(yield Z(s))})},r=function(s){return ge(this,arguments,function*(){yield Z(yield*ki(vn(Ho((function*(o){let a=null;do a=o.next(yield a?.value);while(!a.done)})(s[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Go?n(t):Fr(t)?r(t):kn(t)?t:n(t);return yield Z(yield*ki(vn(Ho((function(s){return ge(this,arguments,function*(){let o=null;do o=yield Z(s.next(yield yield Z(mt(e,o))));while(!o.done)})})(i[Symbol.asyncIterator]()))))),yield Z(new e)})}const M1=e=>Yu(Uint8Array,e);function qu(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function x1(e,t){let n=0;const r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}const Qt={fromIterable(e){return zi(U1(e))},fromAsyncIterable(e){return zi(P1(e))},fromDOMStream(e){return zi(k1(e))},fromNodeStream(e){return zi(z1(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},zi=e=>(e.next(),e);function*U1(e){let t,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?be(r,o)[0]:([i,r,a]=be(r,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const c=C1(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?c.next():c.next(o-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o<a);while(!t)}catch(d){(n=!0)&&typeof c.throw=="function"&&c.throw(d)}finally{n===!1&&typeof c.return=="function"&&c.return(null)}return null}function P1(e){return ge(this,arguments,function*(){let t,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?be(r,o)[0]:([i,r,a]=be(r,o),i)}({cmd:s,size:o}=(yield yield Z(null))||{cmd:"read",size:0});const c=M1(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?yield Z(c.next()):yield Z(c.next(o-a)),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield yield Z(l()));while(o<a);while(!t)}catch(d){(n=!0)&&typeof c.throw=="function"&&(yield Z(c.throw(d)))}finally{n===!1&&typeof c.return=="function"&&(yield Z(c.return(new Uint8Array(0))))}return yield Z(null)})}function k1(e){return ge(this,arguments,function*(){let t=!1,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?be(r,o)[0]:([i,r,a]=be(r,o),i)}({cmd:s,size:o}=(yield yield Z(null))||{cmd:"read",size:0});const c=new V1(e);try{do if({done:t,value:i}=Number.isNaN(o-a)?yield Z(c.read()):yield Z(c.read(o-a)),!t&&i.byteLength>0&&(r.push(it(i)),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield yield Z(l()));while(o<a);while(!t)}catch(d){(n=!0)&&(yield Z(c.cancel(d)))}finally{n===!1?yield Z(c.cancel()):e.locked&&c.releaseLock()}return yield Z(null)})}class V1{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 H(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return H(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=it(n)),n})}}const Ko=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function z1(e){return ge(this,arguments,function*(){const t=[];let n="error",r=!1,i=null,s,o,a=0,l=[],c;function d(){return s==="peek"?be(l,o)[0]:([c,l,a]=be(l,o),c)}if({cmd:s,size:o}=(yield yield Z(null))||{cmd:"read",size:0},e.isTTY)return yield yield Z(new Uint8Array(0)),yield Z(null);try{t[0]=Ko(e,"end"),t[1]=Ko(e,"error");do{if(t[2]=Ko(e,"readable"),[n,i]=yield Z(Promise.race(t.map(h=>h[2]))),n==="error")break;if((r=n==="end")||(Number.isFinite(o-a)?(c=it(e.read(o-a)),c.byteLength<o-a&&(c=it(e.read()))):c=it(e.read()),c.byteLength>0&&(l.push(c),a+=c.byteLength)),r||o<=a)do({cmd:s,size:o}=yield yield Z(d()));while(o<a)}while(!r)}finally{yield Z(f(t,n==="error"?i:null))}return yield Z(null);function f(h,y){return c=l=null,new Promise((m,b)=>{for(const[w,v]of h)e.off(w,v);try{const w=e.destroy;w&&w.call(e,y),y=void 0}catch(w){y=w||y}finally{y!=null?b(y):m()}})}})}var Et;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Et||(Et={}));var Rt;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Rt||(Rt={}));var Nt;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Nt||(Nt={}));var Jt;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Jt||(Jt={}));var z;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(z||(z={}));var _e;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(_e||(_e={}));const Qo=2,ve=4,xe=4,ut=4,Je=new Int32Array(2),Wu=new Float32Array(Je.buffer),Gu=new Float64Array(Je.buffer),ji=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Jo;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Jo||(Jo={}));let Vn=class Lh{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Lh(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Je[0]=this.readInt32(t),Wu[0]}readFloat64(t){return Je[ji?0:1]=this.readInt32(t),Je[ji?1:0]=this.readInt32(t+4),Gu[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){Wu[0]=n,this.writeInt32(t,Je[0])}writeFloat64(t,n){Gu[0]=n,this.writeInt32(t,Je[ji?0:1]),this.writeInt32(t+4,Je[ji?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+ve+xe)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<xe;n++)t+=String.fromCharCode(this.readInt8(this.position_+ve+n));return t}__offset(t,n){const r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);const r=this.readInt32(t);t+=ve;const i=this.bytes_.subarray(t,t+r);return n===Jo.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+ve}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=xe)throw new Error("FlatBuffers: file identifier must be length "+xe);for(let n=0;n<xe;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+ve+n))return!1;return!0}createScalarList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s)}return r}createObjList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s.unpack())}return r}},Hu=class Ch{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Vn.allocate(n),this.space=n}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,n){t>this.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){const i=this.bb.capacity();this.bb=Ch.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)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,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const r=n<<1,i=Vn.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(ve,0),this.writeInt32(this.offset()-t+ve)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=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 n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);const r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*Qo;this.addInt16(s);let o=0;const a=this.space;t:for(n=0;n<this.vtables.length;n++){const l=this.bb.capacity()-this.vtables[n];if(s==this.bb.readInt16(l)){for(let c=Qo;c<s;c+=Qo)if(this.bb.readInt16(a+c)!=this.bb.readInt16(l+c))continue t;o=this.vtables[n];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,n,r){const i=r?ut:0;if(n){const s=n;if(this.prep(this.minalign,ve+xe+i),s.length!=xe)throw new TypeError("FlatBuffers: file identifier must be length "+xe);for(let o=xe-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,ve+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(ve,t*n),this.prep(r,t*n)}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 n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;return t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length),this.bb.bytes().set(n,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const n=[];for(let r=0;r<t.length;++r){const i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Yi;(function(e){e[e.BUFFER=0]="BUFFER"})(Yi||(Yi={}));var qi;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(qi||(qi={}));class Xe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new Xe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+ut),(n||new Xe).__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):qi.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Yi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,qi.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Yi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return Xe.startBodyCompression(t),Xe.addCodec(t,n),Xe.addMethod(t,r),Xe.endBodyCompression(t)}}class Ku{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}}let Qu=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Ue=class Ya{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new Ya).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+ut),(n||new Ya).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Qu).__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,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Ku).__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 n=this.bb.__offset(this.bb_pos,10);return n?(t||new Xe).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}},zn=class qa{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new qa).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+ut),(n||new qa).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ue).__init(this.bb.__indirect(this.bb_pos+n),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,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var jn;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(jn||(jn={}));var Wi;(function(e){e[e.DenseArray=0]="DenseArray"})(Wi||(Wi={}));class jt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+ut),(n||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,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return jt.startInt(t),jt.addBitWidth(t,n),jt.addIsSigned(t,r),jt.endInt(t)}}class Pe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new Pe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+ut),(n||new Pe).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new jt).__init(this.bb.__indirect(this.bb_pos+n),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):Wi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Wi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class Tt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+ut),(n||new Tt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return Tt.startKeyValue(t),Tt.addKey(t,n),Tt.addValue(t,r),Tt.endKeyValue(t)}}let Ju=class Gr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new Gr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+ut),(n||new Gr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Gr.startBinary(t),Gr.endBinary(t)}},Xu=class Hr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new Hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+ut),(n||new Hr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Hr.startBool(t),Hr.endBool(t)}},Gi=class ir{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new ir).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+ut),(n||new ir).__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):Jt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Jt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return ir.startDate(t),ir.addUnit(t,n),ir.endDate(t)}},Yn=class on{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new on).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+ut),(n||new on).__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,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return on.startDecimal(t),on.addPrecision(t,n),on.addScale(t,r),on.addBitWidth(t,i),on.endDecimal(t)}},Hi=class sr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new sr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+ut),(n||new sr).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,z.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return sr.startDuration(t),sr.addUnit(t,n),sr.endDuration(t)}},Ki=class or{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new or).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+ut),(n||new or).__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,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return or.startFixedSizeBinary(t),or.addByteWidth(t,n),or.endFixedSizeBinary(t)}},Qi=class ar{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new ar).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+ut),(n||new ar).__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,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return ar.startFixedSizeList(t),ar.addListSize(t,n),ar.endFixedSizeList(t)}};class we{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new we).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+ut),(n||new we).__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):Nt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Nt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return we.startFloatingPoint(t),we.addPrecision(t,n),we.endFloatingPoint(t)}}class Ie{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new Ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+ut),(n||new Ie).__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):_e.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,_e.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return Ie.startInterval(t),Ie.addUnit(t,n),Ie.endInterval(t)}}let Zu=class Kr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new Kr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+ut),(n||new Kr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Kr.startLargeBinary(t),Kr.endLargeBinary(t)}},td=class Qr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new Qr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+ut),(n||new Qr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Qr.startLargeUtf8(t),Qr.endLargeUtf8(t)}},ed=class Jr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new Jr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+ut),(n||new Jr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Jr.startList(t),Jr.endList(t)}},Ji=class lr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+ut),(n||new lr).__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,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return lr.startMap(t),lr.addKeysSorted(t,n),lr.endMap(t)}},nd=class Xr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new Xr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+ut),(n||new Xr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Xr.startNull(t),Xr.endNull(t)}};class In{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new In).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+ut),(n||new In).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return In.startStruct_(t),In.endStruct_(t)}}class Xt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new Xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+ut),(n||new Xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.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,n){t.addFieldInt16(0,n,z.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return Xt.startTime(t),Xt.addUnit(t,n),Xt.addBitWidth(t,r),Xt.endTime(t)}}class Zt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+ut),(n||new Zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.SECOND}timezone(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,z.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return Zt.startTimestamp(t),Zt.addUnit(t,n),Zt.addTimezone(t,r),Zt.endTimestamp(t)}}class Pt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+ut),(n||new Pt).__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):Rt.Sparse}typeIds(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+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,n){t.addFieldInt16(0,n,Rt.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return Pt.startUnion(t),Pt.addMode(t,n),Pt.addTypeIds(t,r),Pt.endUnion(t)}}let rd=class Zr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new Zr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+ut),(n||new Zr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Zr.startUtf8(t),Zr.endUtf8(t)}};var bt;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(bt||(bt={}));let te=class Us{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new Us).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+ut),(n||new Us).__init(t.readInt32(t.position())+t.position(),t)}name(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,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):bt.NONE}type(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){const n=this.bb.__offset(this.bb_pos,12);return n?(t||new Pe).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){const r=this.bb.__offset(this.bb_pos,14);return r?(n||new Us).__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,n){const r=this.bb.__offset(this.bb_pos,16);return r?(n||new Tt).__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,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,bt.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}},Ee=class qe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new qe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+ut),(n||new qe).__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):jn.Little}fields(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new te).__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,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Tt).__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 n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,jn.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,s){return qe.startSchema(t),qe.addEndianness(t,n),qe.addFields(t,r),qe.addCustomMetadata(t,i),qe.addFeatures(t,s),qe.endSchema(t)}};var lt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(lt||(lt={}));var g;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(g||(g={}));var ke;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(ke||(ke={}));const j1=void 0;function Lr(e){if(e===null)return"null";if(e===j1)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Lr(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}function gt(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function id(e,t){return gt(e/t)+gt(e%t)/gt(t)}const Y1=Symbol.for("isArrowBigNum");function le(e,...t){return t.length===0?Object.setPrototypeOf(mt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}le.prototype[Y1]=!0,le.prototype.toJSON=function(){return`"${Mr(this)}"`},le.prototype.valueOf=function(e){return sd(this,e)},le.prototype.toString=function(){return Mr(this)},le.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return sd(this);case"string":return Mr(this);case"default":return G1(this)}return Mr(this)};function qn(...e){return le.apply(this,e)}function Wn(...e){return le.apply(this,e)}function Cr(...e){return le.apply(this,e)}Object.setPrototypeOf(qn.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(Wn.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Cr.prototype,Object.create(Uint32Array.prototype)),Object.assign(qn.prototype,le.prototype,{constructor:qn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(Wn.prototype,le.prototype,{constructor:Wn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(Cr.prototype,le.prototype,{constructor:Cr,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const q1=BigInt(4294967296)*BigInt(4294967296),W1=q1-BigInt(1);function sd(e,t){const{buffer:n,byteOffset:r,byteLength:i,signed:s}=e,o=new BigUint64Array(n,r,i/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63);let l=BigInt(0),c=0;if(a){for(const d of o)l|=(d^W1)*(BigInt(1)<<BigInt(64*c++));l*=BigInt(-1),l-=BigInt(1)}else for(const d of o)l|=d*(BigInt(1)<<BigInt(64*c++));if(typeof t=="number"){const d=BigInt(Math.pow(10,t)),f=l/d,h=l%d;return gt(f)+gt(h)/gt(d)}return gt(l)}function Mr(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Xo(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Xo(e);t=t.slice();let n=1;for(let r=0;r<t.length;r++){const i=t[r],s=~i+n;t[r]=s,n&=i===0?1:0}return`-${Xo(t)}`}function G1(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Mr(e)}function Xo(e){let t="";const n=new Uint32Array(2);let r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const o=r.length-1;do{for(n[0]=r[s=0];s<o;)r[s++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[s];r[s]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}class Zo{static new(t,n){switch(n){case!0:return new qn(t);case!1:return new Wn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new qn(t)}return t.byteLength===16?new Cr(t):new Wn(t)}static signed(t){return new qn(t)}static unsigned(t){return new Wn(t)}static decimal(t){return new Cr(t)}constructor(t,n){return Zo.new(t,n)}}var od,ad,ld,cd,ud,dd,fd,hd,pd,yd,md,gd,bd,_d,vd,wd,Id,Ed,Sd,Td,Ad,Od;class M{static isNull(t){return t?.typeId===g.Null}static isInt(t){return t?.typeId===g.Int}static isFloat(t){return t?.typeId===g.Float}static isBinary(t){return t?.typeId===g.Binary}static isLargeBinary(t){return t?.typeId===g.LargeBinary}static isUtf8(t){return t?.typeId===g.Utf8}static isLargeUtf8(t){return t?.typeId===g.LargeUtf8}static isBool(t){return t?.typeId===g.Bool}static isDecimal(t){return t?.typeId===g.Decimal}static isDate(t){return t?.typeId===g.Date}static isTime(t){return t?.typeId===g.Time}static isTimestamp(t){return t?.typeId===g.Timestamp}static isInterval(t){return t?.typeId===g.Interval}static isDuration(t){return t?.typeId===g.Duration}static isList(t){return t?.typeId===g.List}static isStruct(t){return t?.typeId===g.Struct}static isUnion(t){return t?.typeId===g.Union}static isFixedSizeBinary(t){return t?.typeId===g.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===g.FixedSizeList}static isMap(t){return t?.typeId===g.Map}static isDictionary(t){return t?.typeId===g.Dictionary}static isDenseUnion(t){return M.isUnion(t)&&t.mode===Rt.Dense}static isSparseUnion(t){return M.isUnion(t)&&t.mode===Rt.Sparse}constructor(t){this.typeId=t}}od=Symbol.toStringTag,M[od]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(M.prototype);class Ze extends M{constructor(){super(g.Null)}toString(){return"Null"}}ad=Symbol.toStringTag,Ze[ad]=(e=>e[Symbol.toStringTag]="Null")(Ze.prototype);class En extends M{constructor(t,n){super(g.Int),this.isSigned=t,this.bitWidth=n}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}ld=Symbol.toStringTag,En[ld]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(En.prototype);class xr extends En{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(xr.prototype,"ArrayType",{value:Int32Array});class Xi extends M{constructor(t){super(g.Float),this.precision=t}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}`}}cd=Symbol.toStringTag,Xi[cd]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Xi.prototype);class Zi extends M{constructor(){super(g.Binary)}toString(){return"Binary"}}ud=Symbol.toStringTag,Zi[ud]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Zi.prototype);class ts extends M{constructor(){super(g.LargeBinary)}toString(){return"LargeBinary"}}dd=Symbol.toStringTag,ts[dd]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(ts.prototype);class es extends M{constructor(){super(g.Utf8)}toString(){return"Utf8"}}fd=Symbol.toStringTag,es[fd]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(es.prototype);class ns extends M{constructor(){super(g.LargeUtf8)}toString(){return"LargeUtf8"}}hd=Symbol.toStringTag,ns[hd]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(ns.prototype);class rs extends M{constructor(){super(g.Bool)}toString(){return"Bool"}}pd=Symbol.toStringTag,rs[pd]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(rs.prototype);class is extends M{constructor(t,n,r=128){super(g.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}yd=Symbol.toStringTag,is[yd]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(is.prototype);class ss extends M{constructor(t){super(g.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Jt[this.unit]}>`}get ArrayType(){return this.unit===Jt.DAY?Int32Array:BigInt64Array}}md=Symbol.toStringTag,ss[md]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(ss.prototype);class os extends M{constructor(t,n){super(g.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${z[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}gd=Symbol.toStringTag,os[gd]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(os.prototype);class as extends M{constructor(t,n){super(g.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${z[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}bd=Symbol.toStringTag,as[bd]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(as.prototype);class ls extends M{constructor(t){super(g.Interval),this.unit=t}toString(){return`Interval<${_e[this.unit]}>`}}_d=Symbol.toStringTag,ls[_d]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(ls.prototype);class cs extends M{constructor(t){super(g.Duration),this.unit=t}toString(){return`Duration<${z[this.unit]}>`}}vd=Symbol.toStringTag,cs[vd]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(cs.prototype);class us extends M{constructor(t){super(g.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}wd=Symbol.toStringTag,us[wd]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(us.prototype);class Dt extends M{constructor(t){super(g.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Id=Symbol.toStringTag,Dt[Id]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Dt.prototype);class ds extends M{constructor(t,n,r){super(g.Union),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Ed=Symbol.toStringTag,ds[Ed]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(ds.prototype);class fs extends M{constructor(t){super(g.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Sd=Symbol.toStringTag,fs[Sd]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(fs.prototype);class hs extends M{constructor(t,n){super(g.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}}Td=Symbol.toStringTag,hs[Td]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(hs.prototype);class ps extends M{constructor(t,n=!1){var r,i,s;if(super(g.Map),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){const o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t?.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Ad=Symbol.toStringTag,ps[Ad]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(ps.prototype);const H1=(e=>()=>++e)(-1);class Gn extends M{constructor(t,n,r,i){super(g.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?H1():gt(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Od=Symbol.toStringTag,Gn[Od]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Gn.prototype);function Ve(e){const t=e;switch(e.typeId){case g.Decimal:return e.bitWidth/32;case g.Interval:return 1+t.unit;case g.FixedSizeList:return t.listSize;case g.FixedSizeBinary:return t.byteWidth;default:return 1}}class et{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return K1(this,t,n)}getVisitFnByTypeId(t,n=!0){return Hn(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function K1(e,t,n=!0){return typeof t=="number"?Hn(e,t,n):typeof t=="string"&&t in g?Hn(e,g[t],n):t&&t instanceof M?Hn(e,Rd(t),n):t?.type&&t.type instanceof M?Hn(e,Rd(t.type),n):Hn(e,g.NONE,n)}function Hn(e,t,n=!0){let r=null;switch(t){case g.Null:r=e.visitNull;break;case g.Bool:r=e.visitBool;break;case g.Int:r=e.visitInt;break;case g.Int8:r=e.visitInt8||e.visitInt;break;case g.Int16:r=e.visitInt16||e.visitInt;break;case g.Int32:r=e.visitInt32||e.visitInt;break;case g.Int64:r=e.visitInt64||e.visitInt;break;case g.Uint8:r=e.visitUint8||e.visitInt;break;case g.Uint16:r=e.visitUint16||e.visitInt;break;case g.Uint32:r=e.visitUint32||e.visitInt;break;case g.Uint64:r=e.visitUint64||e.visitInt;break;case g.Float:r=e.visitFloat;break;case g.Float16:r=e.visitFloat16||e.visitFloat;break;case g.Float32:r=e.visitFloat32||e.visitFloat;break;case g.Float64:r=e.visitFloat64||e.visitFloat;break;case g.Utf8:r=e.visitUtf8;break;case g.LargeUtf8:r=e.visitLargeUtf8;break;case g.Binary:r=e.visitBinary;break;case g.LargeBinary:r=e.visitLargeBinary;break;case g.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case g.Date:r=e.visitDate;break;case g.DateDay:r=e.visitDateDay||e.visitDate;break;case g.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case g.Timestamp:r=e.visitTimestamp;break;case g.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case g.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case g.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case g.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case g.Time:r=e.visitTime;break;case g.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case g.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case g.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case g.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case g.Decimal:r=e.visitDecimal;break;case g.List:r=e.visitList;break;case g.Struct:r=e.visitStruct;break;case g.Union:r=e.visitUnion;break;case g.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case g.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case g.Dictionary:r=e.visitDictionary;break;case g.Interval:r=e.visitInterval;break;case g.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case g.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case g.Duration:r=e.visitDuration;break;case g.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case g.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case g.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case g.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case g.FixedSizeList:r=e.visitFixedSizeList;break;case g.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${g[t]}'`)}function Rd(e){switch(e.typeId){case g.Null:return g.Null;case g.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?g.Int8:g.Uint8;case 16:return n?g.Int16:g.Uint16;case 32:return n?g.Int32:g.Uint32;case 64:return n?g.Int64:g.Uint64}return g.Int}case g.Float:switch(e.precision){case Nt.HALF:return g.Float16;case Nt.SINGLE:return g.Float32;case Nt.DOUBLE:return g.Float64}return g.Float;case g.Binary:return g.Binary;case g.LargeBinary:return g.LargeBinary;case g.Utf8:return g.Utf8;case g.LargeUtf8:return g.LargeUtf8;case g.Bool:return g.Bool;case g.Decimal:return g.Decimal;case g.Time:switch(e.unit){case z.SECOND:return g.TimeSecond;case z.MILLISECOND:return g.TimeMillisecond;case z.MICROSECOND:return g.TimeMicrosecond;case z.NANOSECOND:return g.TimeNanosecond}return g.Time;case g.Timestamp:switch(e.unit){case z.SECOND:return g.TimestampSecond;case z.MILLISECOND:return g.TimestampMillisecond;case z.MICROSECOND:return g.TimestampMicrosecond;case z.NANOSECOND:return g.TimestampNanosecond}return g.Timestamp;case g.Date:switch(e.unit){case Jt.DAY:return g.DateDay;case Jt.MILLISECOND:return g.DateMillisecond}return g.Date;case g.Interval:switch(e.unit){case _e.DAY_TIME:return g.IntervalDayTime;case _e.YEAR_MONTH:return g.IntervalYearMonth}return g.Interval;case g.Duration:switch(e.unit){case z.SECOND:return g.DurationSecond;case z.MILLISECOND:return g.DurationMillisecond;case z.MICROSECOND:return g.DurationMicrosecond;case z.NANOSECOND:return g.DurationNanosecond}return g.Duration;case g.Map:return g.Map;case g.List:return g.List;case g.Struct:return g.Struct;case g.Union:switch(e.mode){case Rt.Dense:return g.DenseUnion;case Rt.Sparse:return g.SparseUnion}return g.Union;case g.FixedSizeBinary:return g.FixedSizeBinary;case g.FixedSizeList:return g.FixedSizeList;case g.Dictionary:return g.Dictionary}throw new Error(`Unrecognized type '${g[e.typeId]}'`)}et.prototype.visitInt8=null,et.prototype.visitInt16=null,et.prototype.visitInt32=null,et.prototype.visitInt64=null,et.prototype.visitUint8=null,et.prototype.visitUint16=null,et.prototype.visitUint32=null,et.prototype.visitUint64=null,et.prototype.visitFloat16=null,et.prototype.visitFloat32=null,et.prototype.visitFloat64=null,et.prototype.visitDateDay=null,et.prototype.visitDateMillisecond=null,et.prototype.visitTimestampSecond=null,et.prototype.visitTimestampMillisecond=null,et.prototype.visitTimestampMicrosecond=null,et.prototype.visitTimestampNanosecond=null,et.prototype.visitTimeSecond=null,et.prototype.visitTimeMillisecond=null,et.prototype.visitTimeMicrosecond=null,et.prototype.visitTimeNanosecond=null,et.prototype.visitDenseUnion=null,et.prototype.visitSparseUnion=null,et.prototype.visitIntervalDayTime=null,et.prototype.visitIntervalYearMonth=null,et.prototype.visitDuration=null,et.prototype.visitDurationSecond=null,et.prototype.visitDurationMillisecond=null,et.prototype.visitDurationMicrosecond=null,et.prototype.visitDurationNanosecond=null;const Nd=new Float64Array(1),Kn=new Uint32Array(Nd.buffer);function Bd(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Q1(e){if(e!==e)return 32256;Nd[0]=e;const t=(Kn[1]&2147483648)>>16&65535;let n=Kn[1]&2146435072,r=0;return n>=1089470464?Kn[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Kn[1]&1048575)>>10):n<=1056964608?(r=1048576+(Kn[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Kn[1]&1048575)+512>>10),t|n|r&65535}class j extends et{}function W(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const J1=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Dd=(e,t,n,r)=>{if(n+1<t.length){const i=gt(t[n]),s=gt(t[n+1]);e.set(r.subarray(0,s-i),i)}},X1=({offset:e,values:t},n,r)=>{const i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},ze=({values:e},t,n)=>{e[t]=n},ta=({values:e},t,n)=>{e[t]=n},Fd=({values:e},t,n)=>{e[t]=Q1(n)},Z1=(e,t,n)=>{switch(e.type.precision){case Nt.HALF:return Fd(e,t,n);case Nt.SINGLE:case Nt.DOUBLE:return ta(e,t,n)}},$d=({values:e},t,n)=>{J1(e,t,n.valueOf())},Ld=({values:e},t,n)=>{e[t]=BigInt(n)},tI=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Cd=({values:e,valueOffsets:t},n,r)=>Dd(e,t,n,r),Md=({values:e,valueOffsets:t},n,r)=>Dd(e,t,n,Yo(r)),eI=(e,t,n)=>{e.type.unit===Jt.DAY?$d(e,t,n):Ld(e,t,n)},xd=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},Ud=({values:e},t,n)=>{e[t]=BigInt(n)},Pd=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},kd=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},nI=(e,t,n)=>{switch(e.type.unit){case z.SECOND:return xd(e,t,n);case z.MILLISECOND:return Ud(e,t,n);case z.MICROSECOND:return Pd(e,t,n);case z.NANOSECOND:return kd(e,t,n)}},Vd=({values:e},t,n)=>{e[t]=n},zd=({values:e},t,n)=>{e[t]=n},jd=({values:e},t,n)=>{e[t]=n},Yd=({values:e},t,n)=>{e[t]=n},rI=(e,t,n)=>{switch(e.type.unit){case z.SECOND:return Vd(e,t,n);case z.MILLISECOND:return zd(e,t,n);case z.MICROSECOND:return jd(e,t,n);case z.NANOSECOND:return Yd(e,t,n)}},iI=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},sI=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=ee.getVisitFn(r);if(Array.isArray(n))for(let o=-1,a=i[t],l=i[t+1];a<l;)s(r,a++,n[++o]);else for(let o=-1,a=i[t],l=i[t+1];a<l;)s(r,a++,n.get(++o))},oI=(e,t,n)=>{const r=e.children[0],{valueOffsets:i}=e,s=ee.getVisitFn(r);let{[t]:o,[t+1]:a}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const c of l)if(s(r,o,c),++o>=a)break},aI=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),lI=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),cI=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),uI=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),dI=(e,t,n)=>{const r=e.type.children.map(s=>ee.getVisitFn(s.type)),i=n instanceof Map?cI(t,n):n instanceof dt?lI(t,n):Array.isArray(n)?aI(t,n):uI(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},fI=(e,t,n)=>{e.type.mode===Rt.Dense?qd(e,t,n):Wd(e,t,n)},qd=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ee.visit(i,e.valueOffsets[t],n)},Wd=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];ee.visit(i,t,n)},hI=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},pI=(e,t,n)=>{e.type.unit===_e.DAY_TIME?Gd(e,t,n):Hd(e,t,n)},Gd=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Hd=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Kd=({values:e},t,n)=>{e[t]=n},Qd=({values:e},t,n)=>{e[t]=n},Jd=({values:e},t,n)=>{e[t]=n},Xd=({values:e},t,n)=>{e[t]=n},yI=(e,t,n)=>{switch(e.type.unit){case z.SECOND:return Kd(e,t,n);case z.MILLISECOND:return Qd(e,t,n);case z.MICROSECOND:return Jd(e,t,n);case z.NANOSECOND:return Xd(e,t,n)}},mI=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=ee.getVisitFn(i);if(Array.isArray(n))for(let o=-1,a=t*r;++o<r;)s(i,a+o,n[o]);else for(let o=-1,a=t*r;++o<r;)s(i,a+o,n.get(o))};j.prototype.visitBool=W(X1),j.prototype.visitInt=W(ze),j.prototype.visitInt8=W(ze),j.prototype.visitInt16=W(ze),j.prototype.visitInt32=W(ze),j.prototype.visitInt64=W(ze),j.prototype.visitUint8=W(ze),j.prototype.visitUint16=W(ze),j.prototype.visitUint32=W(ze),j.prototype.visitUint64=W(ze),j.prototype.visitFloat=W(Z1),j.prototype.visitFloat16=W(Fd),j.prototype.visitFloat32=W(ta),j.prototype.visitFloat64=W(ta),j.prototype.visitUtf8=W(Md),j.prototype.visitLargeUtf8=W(Md),j.prototype.visitBinary=W(Cd),j.prototype.visitLargeBinary=W(Cd),j.prototype.visitFixedSizeBinary=W(tI),j.prototype.visitDate=W(eI),j.prototype.visitDateDay=W($d),j.prototype.visitDateMillisecond=W(Ld),j.prototype.visitTimestamp=W(nI),j.prototype.visitTimestampSecond=W(xd),j.prototype.visitTimestampMillisecond=W(Ud),j.prototype.visitTimestampMicrosecond=W(Pd),j.prototype.visitTimestampNanosecond=W(kd),j.prototype.visitTime=W(rI),j.prototype.visitTimeSecond=W(Vd),j.prototype.visitTimeMillisecond=W(zd),j.prototype.visitTimeMicrosecond=W(jd),j.prototype.visitTimeNanosecond=W(Yd),j.prototype.visitDecimal=W(iI),j.prototype.visitList=W(sI),j.prototype.visitStruct=W(dI),j.prototype.visitUnion=W(fI),j.prototype.visitDenseUnion=W(qd),j.prototype.visitSparseUnion=W(Wd),j.prototype.visitDictionary=W(hI),j.prototype.visitInterval=W(pI),j.prototype.visitIntervalDayTime=W(Gd),j.prototype.visitIntervalYearMonth=W(Hd),j.prototype.visitDuration=W(yI),j.prototype.visitDurationSecond=W(Kd),j.prototype.visitDurationMillisecond=W(Qd),j.prototype.visitDurationMicrosecond=W(Jd),j.prototype.visitDurationNanosecond=W(Xd),j.prototype.visitFixedSizeList=W(mI),j.prototype.visitMap=W(oI);const ee=new j,ce=Symbol.for("parent"),Qn=Symbol.for("rowIndex");class ea{constructor(t,n){return this[ce]=t,this[Qn]=n,new Proxy(this,new bI)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Qn],n=this[ce],r=n.type.children,i={};for(let s=-1,o=r.length;++s<o;)i[r[s].name]=kt.visit(n.children[s],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Lr(t)}: ${Lr(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new gI(this[ce],this[Qn])}}class gI{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,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,kt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(ea.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ce]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Qn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class bI{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ce].type.children.map(n=>n.name)}has(t,n){return t[ce].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[ce].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[ce].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=kt.visit(t[ce].children[r],t[Qn]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[ce].type.children.findIndex(s=>s.name===n);return i!==-1?(ee.visit(t[ce].children[i],t[Qn],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class x extends et{}function Y(e){return(t,n)=>t.getValid(n)?e(t,n):null}const _I=(e,t)=>864e5*e[t],vI=(e,t)=>null,Zd=(e,t,n)=>{if(n+1>=t.length)return null;const r=gt(t[n]),i=gt(t[n+1]);return e.subarray(r,i)},wI=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<<r%8)!==0},tf=({values:e},t)=>_I(e,t),ef=({values:e},t)=>gt(e[t]),tn=({stride:e,values:t},n)=>t[e*n],II=({stride:e,values:t},n)=>Bd(t[e*n]),nf=({values:e},t)=>e[t],EI=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),rf=({values:e,valueOffsets:t},n)=>Zd(e,t,n),sf=({values:e,valueOffsets:t},n)=>{const r=Zd(e,t,n);return r!==null?jo(r):null},SI=({values:e},t)=>e[t],TI=({type:e,values:t},n)=>e.precision!==Nt.HALF?t[n]:Bd(t[n]),AI=(e,t)=>e.type.unit===Jt.DAY?tf(e,t):ef(e,t),of=({values:e},t)=>1e3*gt(e[t]),af=({values:e},t)=>gt(e[t]),lf=({values:e},t)=>id(e[t],BigInt(1e3)),cf=({values:e},t)=>id(e[t],BigInt(1e6)),OI=(e,t)=>{switch(e.type.unit){case z.SECOND:return of(e,t);case z.MILLISECOND:return af(e,t);case z.MICROSECOND:return lf(e,t);case z.NANOSECOND:return cf(e,t)}},uf=({values:e},t)=>e[t],df=({values:e},t)=>e[t],ff=({values:e},t)=>e[t],hf=({values:e},t)=>e[t],RI=(e,t)=>{switch(e.type.unit){case z.SECOND:return uf(e,t);case z.MILLISECOND:return df(e,t);case z.MICROSECOND:return ff(e,t);case z.NANOSECOND:return hf(e,t)}},NI=({values:e,stride:t},n)=>Zo.decimal(e.subarray(t*n,t*(n+1))),BI=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:o}=n,a=i[0].slice(s,o-s);return new dt([a])},DI=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,o=r[0];return new ra(o.slice(i,s-i))},FI=(e,t)=>new ea(e,t),$I=(e,t)=>e.type.mode===Rt.Dense?pf(e,t):yf(e,t),pf=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return kt.visit(r,e.valueOffsets[t])},yf=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return kt.visit(r,t)},LI=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},CI=(e,t)=>e.type.unit===_e.DAY_TIME?mf(e,t):gf(e,t),mf=({values:e},t)=>e.subarray(2*t,2*(t+1)),gf=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},bf=({values:e},t)=>e[t],_f=({values:e},t)=>e[t],vf=({values:e},t)=>e[t],wf=({values:e},t)=>e[t],MI=(e,t)=>{switch(e.type.unit){case z.SECOND:return bf(e,t);case z.MILLISECOND:return _f(e,t);case z.MICROSECOND:return vf(e,t);case z.NANOSECOND:return wf(e,t)}},xI=(e,t)=>{const{stride:n,children:r}=e,i=r[0].slice(t*n,n);return new dt([i])};x.prototype.visitNull=Y(vI),x.prototype.visitBool=Y(wI),x.prototype.visitInt=Y(SI),x.prototype.visitInt8=Y(tn),x.prototype.visitInt16=Y(tn),x.prototype.visitInt32=Y(tn),x.prototype.visitInt64=Y(nf),x.prototype.visitUint8=Y(tn),x.prototype.visitUint16=Y(tn),x.prototype.visitUint32=Y(tn),x.prototype.visitUint64=Y(nf),x.prototype.visitFloat=Y(TI),x.prototype.visitFloat16=Y(II),x.prototype.visitFloat32=Y(tn),x.prototype.visitFloat64=Y(tn),x.prototype.visitUtf8=Y(sf),x.prototype.visitLargeUtf8=Y(sf),x.prototype.visitBinary=Y(rf),x.prototype.visitLargeBinary=Y(rf),x.prototype.visitFixedSizeBinary=Y(EI),x.prototype.visitDate=Y(AI),x.prototype.visitDateDay=Y(tf),x.prototype.visitDateMillisecond=Y(ef),x.prototype.visitTimestamp=Y(OI),x.prototype.visitTimestampSecond=Y(of),x.prototype.visitTimestampMillisecond=Y(af),x.prototype.visitTimestampMicrosecond=Y(lf),x.prototype.visitTimestampNanosecond=Y(cf),x.prototype.visitTime=Y(RI),x.prototype.visitTimeSecond=Y(uf),x.prototype.visitTimeMillisecond=Y(df),x.prototype.visitTimeMicrosecond=Y(ff),x.prototype.visitTimeNanosecond=Y(hf),x.prototype.visitDecimal=Y(NI),x.prototype.visitList=Y(BI),x.prototype.visitStruct=Y(FI),x.prototype.visitUnion=Y($I),x.prototype.visitDenseUnion=Y(pf),x.prototype.visitSparseUnion=Y(yf),x.prototype.visitDictionary=Y(LI),x.prototype.visitInterval=Y(CI),x.prototype.visitIntervalDayTime=Y(mf),x.prototype.visitIntervalYearMonth=Y(gf),x.prototype.visitDuration=Y(MI),x.prototype.visitDurationSecond=Y(bf),x.prototype.visitDurationMillisecond=Y(_f),x.prototype.visitDurationMicrosecond=Y(vf),x.prototype.visitDurationNanosecond=Y(wf),x.prototype.visitFixedSizeList=Y(xI),x.prototype.visitMap=Y(DI);const kt=new x,Jn=Symbol.for("keys"),Xn=Symbol.for("vals"),Zn=Symbol.for("kKeysAsStrings"),na=Symbol.for("_kKeysAsStrings");class ra{constructor(t){return this[Jn]=new dt([t.children[0]]).memoize(),this[Xn]=t.children[1],new Proxy(this,new PI)}get[Zn](){return this[na]||(this[na]=Array.from(this[Jn].toArray(),String))}[Symbol.iterator](){return new UI(this[Jn],this[Xn])}get size(){return this[Jn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Jn],n=this[Xn],r={};for(let i=-1,s=t.length;++i<s;)r[t.get(i)]=kt.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Lr(t)}: ${Lr(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class UI{constructor(t,n){this.keys=t,this.vals=n,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),kt.visit(this.vals,t)]})}}class PI{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Zn]}has(t,n){return t[Zn].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Zn].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Zn].indexOf(n);if(r!==-1){const i=kt.visit(Reflect.get(t,Xn),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Zn].indexOf(n);return i!==-1?(ee.visit(Reflect.get(t,Xn),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(ra.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Jn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[na]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let If;function Ef(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,o=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(If=s,s=o,o=If),o>i&&(o=i),r?r(e,s,o):[s,o]}const ia=(e,t)=>e<0?t+e:e,Sf=e=>e!==e;function tr(e){if(typeof e!="object"||e===null)return Sf(e)?Sf:t=>t===e;if(e instanceof Date){const t=e.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?x1(e,t):!1:e instanceof Map?VI(e):Array.isArray(e)?kI(e):e instanceof dt?zI(e):jI(e,!0)}function kI(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=tr(e[n]);return ys(t)}function VI(e){let t=-1;const n=[];for(const r of e.values())n[++t]=tr(r);return ys(n)}function zI(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=tr(e.get(n));return ys(t)}function jI(e,t=!1){const n=Object.keys(e);if(!t&&n.length===0)return()=>!1;const r=[];for(let i=-1,s=n.length;++i<s;)r[i]=tr(e[n[i]]);return ys(r,n)}function ys(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return YI(e,n);case Map:return Tf(e,n,n.keys());case ra:case ea:case Object:case void 0:return Tf(e,n,t||Object.keys(n))}return n instanceof dt?qI(e,n):!1}}function YI(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function qI(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Tf(e,t,n){const r=n[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 a=e.length;let l=s.next(),c=r.next(),d=i.next();for(;o<a&&!c.done&&!d.done&&!l.done&&!(c.value!==d.value||!e[o](l.value));++o,c=r.next(),d=i.next(),l=s.next());return o===a&&c.done&&d.done&&l.done?!0:(r.return&&r.return(),i.return&&i.return(),s.return&&s.return(),!1)}function Af(e,t,n,r){return(n&1<<r)!==0}function WI(e,t,n,r){return(n&1<<r)>>r}function ms(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength<r){const i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):gs(new sa(n,e,t,null,Af)).subarray(0,r)),i}return n}function gs(e){const t=[];let n=0,r=0,i=0;for(const o of e)o&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class sa{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>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 oa(e,t,n){if(n-t<=0)return 0;if(n-t<8){let s=0;for(const o of new sa(e,t,n-t,e,WI))s+=o;return s}const r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return oa(e,t,i)+oa(e,r,n)+GI(e,i>>3,r-i>>3)}function GI(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=aa(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=aa(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=aa(s.getUint8(i)),i+=1;return r}function aa(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const HI=-1;class pt{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return M.isSparseUnion(t)?this.children.some(n=>n.nullable):M.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(M.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=HI&&(n=this.nullBitmap)&&(this._nullCount=t=n.length===0?0:this.length-oa(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof pt?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Ve(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:n}=this;if(M.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===Rt.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r;const{type:i}=this;if(M.isUnion(i)){const s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===Rt.Dense?this.valueOffsets[t]:t;r=o.getValid(a),o.setValid(a,n)}else{let{nullBitmap:s}=this;const{offset:o,length:a}=this,l=o+t,c=1<<l%8,d=l>>3;(!s||s.byteLength<=d)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(ms(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const f=s[d];r=(f&c)!==0,s[d]=n?f|c:f&~c}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new pt(t,n,r,i,s,o,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,l=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===g.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(ms(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[ke.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:o}=this;return(s=o[ke.TYPE])&&(o[ke.TYPE]=s.subarray(t,t+n)),(s=o[ke.OFFSET])&&(o[ke.OFFSET]=s.subarray(t,t+n+1))||(s=o[ke.DATA])&&(o[ke.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),o}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}pt.prototype.children=Object.freeze([]);class Ur extends et{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new pt(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.data),s=it(t.nullBitmap),o=$r(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[o,i,s])}visitLargeUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.data),s=it(t.nullBitmap),o=ju(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[o,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.data),s=it(t.nullBitmap),o=$r(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[o,i,s])}visitLargeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.data),s=it(t.nullBitmap),o=ju(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=it(t.nullBitmap),o=$r(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[o,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=it(t.nullBitmap),{length:o=i.reduce((l,{length:c})=>Math.max(l,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=mt(n.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(M.isSparseUnion(n))return new pt(n,r,o,a,[void 0,void 0,void 0,s],i);const l=$r(t.valueOffsets);return new pt(n,r,o,a,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.indices.ArrayType,t.data),{["dictionary"]:o=new dt([new Ur().visit({type:n.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=it(t.nullBitmap),s=mt(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Ur().visit({type:n.valueType})}=t,s=it(t.nullBitmap),{["length"]:o=i.length/Ve(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new pt(n,r,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Ur().visit({type:n.childType})}=t,s=it(t.nullBitmap),o=$r(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new pt(n,r,a,l,[o,void 0,s],[i])}}const KI=new Ur;function nt(e){return KI.visit(e)}class Of{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,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 QI(e){return e.some(t=>t.nullable)}function Rf(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Nf(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Bf(e,t,n,r){const i=[];for(let s=-1,o=e.length;++s<o;){const a=e[s],l=t[s],{length:c}=a;if(l>=r)break;if(n>=l+c)continue;if(l>=n&&l+c<=r){i.push(a);continue}const d=Math.max(0,n-l),f=Math.min(r-l,c);i.push(a.slice(d,f-d))}return i.length===0&&i.push(e[0].slice(0,0)),i}function la(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;s=i+Math.trunc((o-i)*.5),n<t[s]?o=s:i=s}while(i<o)}function ca(e,t){return e.getValid(t)}function bs(e){function t(n,r,i){return e(n[r],i)}return function(n){const r=this.data;return la(r,this._offsets,n,t)}}function Df(e){let t;function n(r,i,s){return e(r[i],s,t)}return function(r,i){const s=this.data;t=i;const o=la(s,this._offsets,r,n);return t=void 0,o}}function Ff(e){let t;function n(r,i,s){let o=s,a=0,l=0;for(let c=i-1,d=r.length;++c<d;){const f=r[c];if(~(a=e(f,t,o)))return l+a;o=0,l+=f.length}return-1}return function(r,i){t=r;const s=this.data,o=typeof i!="number"?n(s,0,0):la(s,this._offsets,i,n);return t=void 0,o}}class U extends et{}function JI(e,t){return t===null&&e.length>0?0:-1}function XI(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new sa(n,e.offset+(t||0),e.length,n,Af)){if(!i)return r;++r}return-1}function G(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case g.Union:break;case g.Dictionary:break;default:return XI(e,n)}const r=kt.getVisitFn(e),i=tr(t);for(let s=(n||0)-1,o=e.length;++s<o;)if(i(r(e,s)))return s;return-1}function $f(e,t,n){const r=kt.getVisitFn(e),i=tr(t);for(let s=(n||0)-1,o=e.length;++s<o;)if(i(r(e,s)))return s;return-1}U.prototype.visitNull=JI,U.prototype.visitBool=G,U.prototype.visitInt=G,U.prototype.visitInt8=G,U.prototype.visitInt16=G,U.prototype.visitInt32=G,U.prototype.visitInt64=G,U.prototype.visitUint8=G,U.prototype.visitUint16=G,U.prototype.visitUint32=G,U.prototype.visitUint64=G,U.prototype.visitFloat=G,U.prototype.visitFloat16=G,U.prototype.visitFloat32=G,U.prototype.visitFloat64=G,U.prototype.visitUtf8=G,U.prototype.visitLargeUtf8=G,U.prototype.visitBinary=G,U.prototype.visitLargeBinary=G,U.prototype.visitFixedSizeBinary=G,U.prototype.visitDate=G,U.prototype.visitDateDay=G,U.prototype.visitDateMillisecond=G,U.prototype.visitTimestamp=G,U.prototype.visitTimestampSecond=G,U.prototype.visitTimestampMillisecond=G,U.prototype.visitTimestampMicrosecond=G,U.prototype.visitTimestampNanosecond=G,U.prototype.visitTime=G,U.prototype.visitTimeSecond=G,U.prototype.visitTimeMillisecond=G,U.prototype.visitTimeMicrosecond=G,U.prototype.visitTimeNanosecond=G,U.prototype.visitDecimal=G,U.prototype.visitList=G,U.prototype.visitStruct=G,U.prototype.visitUnion=G,U.prototype.visitDenseUnion=$f,U.prototype.visitSparseUnion=$f,U.prototype.visitDictionary=G,U.prototype.visitInterval=G,U.prototype.visitIntervalDayTime=G,U.prototype.visitIntervalYearMonth=G,U.prototype.visitDuration=G,U.prototype.visitDurationSecond=G,U.prototype.visitDurationMillisecond=G,U.prototype.visitDurationMicrosecond=G,U.prototype.visitDurationNanosecond=G,U.prototype.visitFixedSizeList=G,U.prototype.visitMap=G;const _s=new U;class P extends et{}function q(e){const{type:t}=e;if(e.nullCount===0&&e.stride===1&&(M.isInt(t)&&t.bitWidth!==64||M.isTime(t)&&t.bitWidth!==64||M.isFloat(t)&&t.precision!==Nt.HALF))return new Of(e.data.length,r=>{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Of(e.data.length,r=>{const i=e.data[r].length,s=e.slice(n,n+i);return n+=i,new ZI(s)})}class ZI{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}}P.prototype.visitNull=q,P.prototype.visitBool=q,P.prototype.visitInt=q,P.prototype.visitInt8=q,P.prototype.visitInt16=q,P.prototype.visitInt32=q,P.prototype.visitInt64=q,P.prototype.visitUint8=q,P.prototype.visitUint16=q,P.prototype.visitUint32=q,P.prototype.visitUint64=q,P.prototype.visitFloat=q,P.prototype.visitFloat16=q,P.prototype.visitFloat32=q,P.prototype.visitFloat64=q,P.prototype.visitUtf8=q,P.prototype.visitLargeUtf8=q,P.prototype.visitBinary=q,P.prototype.visitLargeBinary=q,P.prototype.visitFixedSizeBinary=q,P.prototype.visitDate=q,P.prototype.visitDateDay=q,P.prototype.visitDateMillisecond=q,P.prototype.visitTimestamp=q,P.prototype.visitTimestampSecond=q,P.prototype.visitTimestampMillisecond=q,P.prototype.visitTimestampMicrosecond=q,P.prototype.visitTimestampNanosecond=q,P.prototype.visitTime=q,P.prototype.visitTimeSecond=q,P.prototype.visitTimeMillisecond=q,P.prototype.visitTimeMicrosecond=q,P.prototype.visitTimeNanosecond=q,P.prototype.visitDecimal=q,P.prototype.visitList=q,P.prototype.visitStruct=q,P.prototype.visitUnion=q,P.prototype.visitDenseUnion=q,P.prototype.visitSparseUnion=q,P.prototype.visitDictionary=q,P.prototype.visitInterval=q,P.prototype.visitIntervalDayTime=q,P.prototype.visitIntervalYearMonth=q,P.prototype.visitDuration=q,P.prototype.visitDurationSecond=q,P.prototype.visitDurationMillisecond=q,P.prototype.visitDurationMicrosecond=q,P.prototype.visitDurationNanosecond=q,P.prototype.visitFixedSizeList=q,P.prototype.visitMap=q;const ua=new P;var Lf;const Cf={},Mf={};class dt{constructor(t){var n,r,i;const s=t[0]instanceof dt?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof pt)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:c}=Cf[o.typeId],d=s[0];this.isValid=f=>ca(d,f),this.get=f=>a(d,f),this.set=(f,h)=>l(d,f,h),this.indexOf=f=>c(d,f),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,Mf[o.typeId]),this._offsets=Nf(s);break}this.data=s,this.type=o,this.stride=Ve(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.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullable(){return QI(this.data)}get nullCount(){return Rf(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${g[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(ia(t,this.length))}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}[Symbol.iterator](){return ua.visit(this)}concat(...t){return new dt(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new dt(Ef(this,t,n,({data:r,_offsets:i},s,o)=>Bf(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case g.Int:case g.Float:case g.Decimal:case g.Time:case g.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new dt(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return M.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(M.isDictionary(this.type)){const t=new vs(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new dt(n)}return new vs(this)}unmemoize(){if(M.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new dt(n)}return this}}Lf=Symbol.toStringTag,dt[Lf]=(e=>{e.type=M.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(g).map(n=>g[n]).filter(n=>typeof n=="number"&&n!==g.NONE);for(const n of t){const r=kt.getVisitFnByTypeId(n),i=ee.getVisitFnByTypeId(n),s=_s.getVisitFnByTypeId(n);Cf[n]={get:r,set:i,indexOf:s},Mf[n]=Object.create(e,{isValid:{value:bs(ca)},get:{value:bs(kt.getVisitFnByTypeId(n))},set:{value:Df(ee.getVisitFnByTypeId(n))},indexOf:{value:Ff(_s.getVisitFnByTypeId(n))}})}return"Vector"})(dt.prototype);class vs extends dt{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=n.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new vs(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new dt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class da{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}}class Yt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+ut),(n||new Yt).__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):Et.V1}schema(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ee).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new da).__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,n){const r=this.bb.__offset(this.bb_pos,10);return r?(n||new da).__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,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new Tt).__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,n){t.addFieldInt16(0,n,Et.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}}class ft{constructor(t=[],n,r,i=Et.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=fa(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){const n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new ft(r,this.metadata)}selectAt(t){const n=t.map(r=>this.fields[r]).filter(Boolean);return new ft(n,this.metadata)}assign(...t){const n=t[0]instanceof ft?t[0]:Array.isArray(t[0])?new ft(t[0]):new ft(t),r=[...this.fields],i=ws(ws(new Map,this.metadata),n.metadata),s=n.fields.filter(a=>{const l=r.findIndex(c=>c.name===a.name);return~l?(r[l]=a.clone({metadata:ws(ws(new Map,r[l].metadata),a.metadata)}))&&!1:!0}),o=fa(s,new Map);return new ft([...r,...s],i,new Map([...this.dictionaries,...o]))}}ft.prototype.fields=null,ft.prototype.metadata=null,ft.prototype.dictionaries=null;class _t{static new(...t){let[n,r,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new _t(`${n}`,r,i,s)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,s]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,s=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],_t.new(n,r,i,s)}}_t.prototype.type=null,_t.prototype.name=null,_t.prototype.nullable=null,_t.prototype.metadata=null;function ws(e,t){return new Map([...e||new Map,...t||new Map])}function fa(e,t=new Map){for(let n=-1,r=e.length;++n<r;){const i=e[n].type;if(M.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&fa(i.children,t)}return t}var tE=Hu,eE=Vn;class Pr{static decode(t){t=new eE(it(t));const n=Yt.getRootAsFooter(t),r=ft.decode(n.schema(),new Map,n.version());return new nE(r,n)}static encode(t){const n=new tE,r=ft.encode(n,t.schema);Yt.startRecordBatchesVector(n,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())en.encode(n,o);const i=n.endVector();Yt.startDictionariesVector(n,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())en.encode(n,o);const s=n.endVector();return Yt.startFooter(n),Yt.addSchema(n,r),Yt.addVersion(n,Et.V5),Yt.addRecordBatches(n,i),Yt.addDictionaries(n,s),Yt.finishFooterBuffer(n,Yt.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Et.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(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 nE extends Pr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const n=this._footer.recordBatches(t);if(n)return en.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const n=this._footer.dictionaries(t);if(n)return en.decode(n)}return null}}class en{static decode(t){return new en(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){const{metaDataLength:r}=n,i=BigInt(n.offset),s=BigInt(n.bodyLength);return da.createBlock(t,i,r,s)}constructor(t,n,r){this.metaDataLength=t,this.offset=gt(r),this.bodyLength=gt(n)}}const At=Object.freeze({done:!0,value:void 0});class xf{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class ha{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class rE extends ha{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return H(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(At);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Qt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Qt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return H(this,void 0,void 0,function*(){return yield this.abort(t),At})}return(t){return H(this,void 0,void 0,function*(){return yield this.close(),At})}read(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return H(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((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(At)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Is extends rE{write(t){if((t=it(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?jo(this.toUint8Array(!0)):this.toUint8Array(!1).then(jo)}toUint8Array(t=!1){return t?be(this._values)[0]:H(this,void 0,void 0,function*(){var n,r,i,s;const o=[];let a=0;try{for(var l=!0,c=vn(this),d;d=yield c.next(),n=d.done,!n;l=!0){s=d.value,l=!1;const f=s;o.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return be(o,a)[0]})}}class Es{constructor(t){t&&(this.source=new iE(Qt.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 er{constructor(t){t instanceof er?this.source=t.source:t instanceof Is?this.source=new Sn(Qt.fromAsyncIterable(t)):Vu(t)?this.source=new Sn(Qt.fromNodeStream(t)):Wo(t)?this.source=new Sn(Qt.fromDOMStream(t)):ku(t)?this.source=new Sn(Qt.fromDOMStream(t.body)):Fr(t)?this.source=new Sn(Qt.fromIterable(t)):wn(t)?this.source=new Sn(Qt.fromAsyncIterable(t)):kn(t)&&(this.source=new Sn(Qt.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 iE{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,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||At)}return(t){return Object.create(this.source.return&&this.source.return(t)||At)}}class Sn{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return H(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return H(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return H(this,arguments,void 0,function*(n,r="read"){return yield this.source.next({cmd:r,size:n})})}throw(t){return H(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(t))||At;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return H(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(t))||At;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class Uf extends Es{constructor(t,n){super(),this.position=0,this.buffer=it(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){const{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){const r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}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 Ss extends er{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=H(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return H(this,void 0,void 0,function*(){const{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return H(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 H(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0;const l=Math.min(r,s+Math.min(r-s,t)),c=new Uint8Array(Math.max(0,(this.position=l)-s));for(;(s+=a)<l&&(o+=a)<c.byteLength;)({bytesRead:a}=yield n.read(c,o,c.byteLength-o,s));return c}return null})}readAt(t,n){return H(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:r,size:i}=this;if(r&&t+n<i){const s=Math.min(i,t+n),o=new Uint8Array(s-t);return(yield r.read(o,0,n,t)).buffer}return new Uint8Array(n)})}close(){return H(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return H(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return H(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const sE=65536;function nr(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const rr=8,pa=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Pf{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const n=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=n[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=n[2]*r[3],s+=i,i=n[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?sE:0,this.buffer[1]+=s>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){const n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}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`${nr(this.buffer[1])} ${nr(this.buffer[0])}`}}class yt extends Pf{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return yt.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return yt.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.length,i=new yt(n);for(let s=0;s<r;){const o=rr<r-s?rr:r-s,a=new yt(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),l=new yt(new Uint32Array([pa[o],0]));i.times(l),i.plus(a),s+=o}return i}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)yt.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new yt(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new yt(new Uint32Array(t.buffer)).plus(n)}}class ne extends Pf{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 n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return ne.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return ne.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.startsWith("-"),i=t.length,s=new ne(n);for(let o=r?1:0;o<i;){const a=rr<i-o?rr:i-o,l=new ne(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),c=new ne(new Uint32Array([pa[a],0]));s.times(c),s.plus(l),o+=a}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)ne.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new ne(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new ne(new Uint32Array(t.buffer)).plus(n)}}class Se{constructor(t){this.buffer=t}high(){return new ne(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ne(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 n=new yt(new Uint32Array([this.buffer[3],0])),r=new yt(new Uint32Array([this.buffer[2],0])),i=new yt(new Uint32Array([this.buffer[1],0])),s=new yt(new Uint32Array([this.buffer[0],0])),o=new yt(new Uint32Array([t.buffer[3],0])),a=new yt(new Uint32Array([t.buffer[2],0])),l=new yt(new Uint32Array([t.buffer[1],0])),c=new yt(new Uint32Array([t.buffer[0],0]));let d=yt.multiply(s,c);this.buffer[0]=d.low();const f=new yt(new Uint32Array([d.high(),0]));return d=yt.multiply(i,c),f.plus(d),d=yt.multiply(s,l),f.plus(d),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(d)?1:0,this.buffer[2]=f.high(),new yt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(yt.multiply(r,c)).plus(yt.multiply(i,l)).plus(yt.multiply(s,a)),this.buffer[3]+=yt.multiply(n,c).plus(yt.multiply(r,l)).plus(yt.multiply(i,a)).plus(yt.multiply(s,o)).low(),this}plus(t){const n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${nr(this.buffer[3])} ${nr(this.buffer[2])} ${nr(this.buffer[1])} ${nr(this.buffer[0])}`}static multiply(t,n){return new Se(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new Se(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return Se.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return Se.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,s=new Se(n);for(let o=r?1:0;o<i;){const a=rr<i-o?rr:i-o,l=new Se(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),c=new Se(new Uint32Array([pa[a],0,0,0]));s.times(c),s.plus(l),o+=a}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)Se.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}}class kf extends et{constructor(t,n,r,i,s=Et.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof _t?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return nt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Et.V5&&this.readNullBitmap(t,r),t.mode===Rt.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return nt({type:t,length:n,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,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}}class oE extends kf{constructor(t,n,r,i,s){super(new Uint8Array(0),n,r,i,s),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):gs(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return mt(Uint8Array,mt(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return mt(Uint8Array,mt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return M.isTimestamp(t)||(M.isInt(t)||M.isTime(t))&&t.bitWidth===64||M.isDuration(t)||M.isDate(t)&&t.unit===Jt.MILLISECOND?mt(Uint8Array,ne.convertArray(r[n])):M.isDecimal(t)?mt(Uint8Array,Se.convertArray(r[n])):M.isBinary(t)||M.isLargeBinary(t)||M.isFixedSizeBinary(t)?aE(r[n]):M.isBool(t)?gs(r[n]):M.isUtf8(t)||M.isLargeUtf8(t)?Yo(r[n].join("")):mt(Uint8Array,mt(t.ArrayType,r[n].map(i=>+i)))}}function aE(e){const t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}class k extends et{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}}function Ft(e,t){return t instanceof e.constructor}function Tn(e,t){return e===t||Ft(e,t)}function je(e,t){return e===t||Ft(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Ts(e,t){return e===t||Ft(e,t)&&e.precision===t.precision}function lE(e,t){return e===t||Ft(e,t)&&e.byteWidth===t.byteWidth}function ya(e,t){return e===t||Ft(e,t)&&e.unit===t.unit}function kr(e,t){return e===t||Ft(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Vr(e,t){return e===t||Ft(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function cE(e,t){return e===t||Ft(e,t)&&e.children.length===t.children.length&&nn.compareManyFields(e.children,t.children)}function uE(e,t){return e===t||Ft(e,t)&&e.children.length===t.children.length&&nn.compareManyFields(e.children,t.children)}function ma(e,t){return e===t||Ft(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&nn.compareManyFields(e.children,t.children)}function dE(e,t){return e===t||Ft(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&nn.visit(e.indices,t.indices)&&nn.visit(e.dictionary,t.dictionary)}function ga(e,t){return e===t||Ft(e,t)&&e.unit===t.unit}function zr(e,t){return e===t||Ft(e,t)&&e.unit===t.unit}function fE(e,t){return e===t||Ft(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&nn.compareManyFields(e.children,t.children)}function hE(e,t){return e===t||Ft(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&nn.compareManyFields(e.children,t.children)}k.prototype.visitNull=Tn,k.prototype.visitBool=Tn,k.prototype.visitInt=je,k.prototype.visitInt8=je,k.prototype.visitInt16=je,k.prototype.visitInt32=je,k.prototype.visitInt64=je,k.prototype.visitUint8=je,k.prototype.visitUint16=je,k.prototype.visitUint32=je,k.prototype.visitUint64=je,k.prototype.visitFloat=Ts,k.prototype.visitFloat16=Ts,k.prototype.visitFloat32=Ts,k.prototype.visitFloat64=Ts,k.prototype.visitUtf8=Tn,k.prototype.visitLargeUtf8=Tn,k.prototype.visitBinary=Tn,k.prototype.visitLargeBinary=Tn,k.prototype.visitFixedSizeBinary=lE,k.prototype.visitDate=ya,k.prototype.visitDateDay=ya,k.prototype.visitDateMillisecond=ya,k.prototype.visitTimestamp=kr,k.prototype.visitTimestampSecond=kr,k.prototype.visitTimestampMillisecond=kr,k.prototype.visitTimestampMicrosecond=kr,k.prototype.visitTimestampNanosecond=kr,k.prototype.visitTime=Vr,k.prototype.visitTimeSecond=Vr,k.prototype.visitTimeMillisecond=Vr,k.prototype.visitTimeMicrosecond=Vr,k.prototype.visitTimeNanosecond=Vr,k.prototype.visitDecimal=Tn,k.prototype.visitList=cE,k.prototype.visitStruct=uE,k.prototype.visitUnion=ma,k.prototype.visitDenseUnion=ma,k.prototype.visitSparseUnion=ma,k.prototype.visitDictionary=dE,k.prototype.visitInterval=ga,k.prototype.visitIntervalDayTime=ga,k.prototype.visitIntervalYearMonth=ga,k.prototype.visitDuration=zr,k.prototype.visitDurationSecond=zr,k.prototype.visitDurationMillisecond=zr,k.prototype.visitDurationMicrosecond=zr,k.prototype.visitDurationNanosecond=zr,k.prototype.visitFixedSizeList=fE,k.prototype.visitMap=hE;const nn=new k;function ba(e,t){return nn.compareSchemas(e,t)}function _a(e,t){return pE(e,t.map(n=>n.data.concat()))}function pE(e,t){const n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.length),0)};let s=0,o=0,a=-1;const l=t.length;let c,d=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<l;)d[a]=c=t[a].shift(),o=Math.min(o,c?c.length:o);Number.isFinite(o)&&(d=yE(n,o,d,t,i),o>0&&(r[s++]=nt({type:new Dt(n),length:o,nullCount:0,children:d.slice()})))}return[e=e.assign(n),r.map(f=>new Vt(e,f))]}function yE(e,t,n,r,i){var s;const o=(t+63&-64)>>3;for(let a=-1,l=r.length;++a<l;){const c=n[a],d=c?.length;if(d>=t)d===t?n[a]=c:(n[a]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(c.slice(t,d-t))));else{const f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(s=c?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:nt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return n}var Vf;class $t{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new ft([]),this._offsets=[0],this;let i,s;t[0]instanceof ft&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const o=l=>{if(l){if(l instanceof Vt)return[l];if(l instanceof $t)return l.batches;if(l instanceof pt){if(l.type instanceof Dt)return[new Vt(new ft(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(c=>o(c));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(c=>o(c));if(typeof l=="object"){const c=Object.keys(l),d=c.map(y=>new dt([l[y]])),f=i??new ft(c.map((y,m)=>new _t(String(y),d[m].type,d[m].nullable))),[,h]=_a(f,d);return h.length===0?[new Vt(l)]:h}}}return[]},a=t.flatMap(l=>o(l));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new ft([]),!(i instanceof ft))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof Vt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!ba(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??Nf(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,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Rf(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ia(t,this.numRows))}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?ua.visit(new dt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
53
|
+
`),!c){console.error("Failed to create shader program");return}if(l.useProgram(c),u=S(n.pointCount,n.colorMode,n.startColor,n.endColor,n.singleColor),h=W(l,c,u),!h){console.error("Failed to prepare buffers");return}y=Nr;const d=n.metaData.row_groups[0].columns[0].meta_data.statistics,m=2/(d.max_value-d.min_value);y.k=.8,y.x=(d.max_value-d.min_value)/2/m+N/2;const _=n.metaData.row_groups[0].columns[1].meta_data.statistics;y.y=-((_.max_value-_.min_value)/2)+E/2,g=hp().scaleExtent([.1,100]).on("zoom",I=>{if(y=I.transform,Q(l,h,y,2,w),a.value){const A=Oe(I,s.value);if(A&&A.length===2){const R=tt(A[0],A[1],y,N,E);a.value.innerHTML=`
|
|
54
|
+
Scale: ${y.k.toFixed(2)}<br>
|
|
55
|
+
Translation: (${y.x.toFixed(0)}, ${y.y.toFixed(0)})<br>
|
|
56
|
+
Data at cursor: (${R.x.toFixed(2)}, ${R.y.toFixed(2)})
|
|
57
|
+
`}}}),ge(s.value).call(g),setTimeout(()=>{try{Q(l,h,y,2,null)}catch(I){console.error("Error during initial draw:",I)}},50),ne()}function ne(){!s.value||!o.value||(s.value.addEventListener("mousemove",Nt),s.value.addEventListener("mouseleave",b))}function Nt(d){if(!s.value||!o.value)return;const m=s.value.getBoundingClientRect(),_=d.clientX-m.left,I=d.clientY-m.top,A=It(u,_,I,y,N,E);if(A){const R=o.value;R.style.left=d.clientX+15+"px",R.style.top=d.clientY-15+"px",R.style.opacity=1,R.innerHTML=`
|
|
58
|
+
<strong>${A.label}</strong><br>
|
|
59
|
+
Species: ${A.species}<br>
|
|
60
|
+
Distance: ${A.value.toFixed(2)}<br>
|
|
61
|
+
Category: ${A.category}
|
|
62
|
+
`,w=A,Q(l,h,y,2,w)}else o.value&&(o.value.style.opacity=0),w!==null&&(w=null,Q(l,h,y,2,null))}function b(){o.value&&(o.value.style.opacity=0,w!==null&&(w=null,Q(l,h,y,2,null)))}return f.watch(()=>n.colorMode,(d,m)=>{if(!l||!h){console.warn("WebGL not initialized yet");return}At()}),f.watch([()=>n.startColor,()=>n.endColor,()=>n.singleColor],()=>{if(n.colorMode!=="species"&&n.colorMode!=="sex"&&(u=S(n.pointCount,n.colorMode,n.startColor,n.endColor,n.singleColor),l&&h)){l.deleteBuffer(h.colorBuffer);const d=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,d);const m=new Float32Array(u.flatMap(_=>_.color));l.bufferData(l.ARRAY_BUFFER,m,l.STATIC_DRAW),h.colorBuffer=d,Q(l,h,y,2,w)}}),f.watch(()=>n.pointCount,d=>{Math.abs(d-u.length)>10&&(u=S(d,n.colorMode,n.startColor,n.endColor,n.singleColor),l&&c&&(h&&(l.deleteBuffer(h.positionBuffer),l.deleteBuffer(h.colorBuffer)),h=W(l,c,u),Q(l,h,y,2,null)))}),(d,m)=>(f.openBlock(),f.createElementBlock("div",{class:"scatterplot-container",ref_key:"containerRef",ref:i},[f.createElementVNode("canvas",{ref_key:"canvasRef",ref:s},null,512),f.createElementVNode("div",{id:"tooltip",ref_key:"tooltipRef",ref:o},null,512),f.withDirectives(f.createElementVNode("div",{id:"debug",ref_key:"debugRef",ref:a},null,512),[[f.vShow,!1]])],512))}}),fp=cr(dp,[["__scopeId","data-v-c67b8237"]]),pp={class:"control-panel"},yp={class:"color-option"},mp=["value"],gp={class:"color-option"},bp={class:"legend"},_p={class:"legend-label"},vp=f.defineComponent({__name:"control",props:{pointCount:{type:Number,default:5e3},colorMode:{type:String,default:"random"},startColor:{type:String,default:"#ff0000"},endColor:{type:String,default:"#0000ff"},singleColor:{type:String,default:"#4285f4"},options:{type:Array,default:["Type","Species"]},colorScheme:{type:Map,default:new Map},colorMapMap:{type:Map,default:new Map}},emits:["update:pointCount","update:colorMode","update:startColor","update:endColor","update:singleColor","regenerate"],setup(e,{emit:t}){const n=e,r=t,i=f.ref(n.pointCount),s=f.ref(n.colorMode),o=f.ref(n.startColor),a=f.ref(n.endColor),l=f.ref(n.singleColor);function c(h){const y=Math.round(h[0]*255),g=Math.round(h[1]*255),w=Math.round(h[2]*255);return`rgb(${y}, ${g}, ${w})`}function u(){r("updateColorMap",[s.value,n.colorMapMap.get(s.value)]),r("update:colorMode",s.value),r("update:startColor",o.value),r("update:endColor",a.value),r("update:singleColor",l.value)}return f.watch(()=>n.pointCount,h=>{i.value=h}),f.watch(()=>n.colorMode,h=>{s.value=h}),f.watch(()=>n.startColor,h=>{o.value=h}),f.watch(()=>n.endColor,h=>{a.value=h}),f.watch(()=>n.singleColor,h=>{l.value=h}),f.watch(()=>s.value,h=>{u()}),f.watch(i,h=>{r("update:pointCount",h)}),(h,y)=>(f.openBlock(),f.createElementBlock("div",pp,[y[3]||(y[3]=f.createElementVNode("h3",null,"Color Controls",-1)),f.createElementVNode("div",yp,[y[1]||(y[1]=f.createElementVNode("label",{for:"colorMode"},"Color Mode:",-1)),f.withDirectives(f.createElementVNode("select",{id:"colorMode","onUpdate:modelValue":y[0]||(y[0]=g=>s.value=g)},[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.colorMapMap,([g,w],N)=>(f.openBlock(),f.createElementBlock("option",{key:g,value:g},f.toDisplayString(g),9,mp))),128))],512),[[f.vModelSelect,s.value]])]),f.createElementVNode("div",gp,[f.createElementVNode("div",bp,[y[2]||(y[2]=f.createElementVNode("h4",null," Legend",-1)),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(e.colorScheme,(g,w)=>(f.openBlock(),f.createElementBlock("div",{class:"legend-item",key:w},[f.createElementVNode("div",{class:"legend-color",style:f.normalizeStyle({backgroundColor:c(g[1])})},null,4),f.createElementVNode("div",_p,f.toDisplayString(g[0]),1)]))),128))])])]))}}),wp=cr(vp,[["__scopeId","data-v-0a5cce16"]]);function pt(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function qe(e){return function t(n){return arguments.length===0||pt(n)?t:e.apply(this,arguments)}}function Ge(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return pt(n)?t:qe(function(i){return e(n,i)});default:return pt(n)&&pt(r)?t:pt(n)?qe(function(i){return e(i,r)}):pt(r)?qe(function(i){return e(n,i)}):e(n,r)}}}function Ip(e){return function t(n,r,i){switch(arguments.length){case 0:return t;case 1:return pt(n)?t:Ge(function(s,o){return e(n,s,o)});case 2:return pt(n)&&pt(r)?t:pt(n)?Ge(function(s,o){return e(s,r,o)}):pt(r)?Ge(function(s,o){return e(n,s,o)}):qe(function(s){return e(n,r,s)});default:return pt(n)&&pt(r)&&pt(i)?t:pt(n)&&pt(r)?Ge(function(s,o){return e(s,o,i)}):pt(n)&&pt(i)?Ge(function(s,o){return e(s,r,o)}):pt(r)&&pt(i)?Ge(function(s,o){return e(n,s,o)}):pt(n)?qe(function(s){return e(s,r,i)}):pt(r)?qe(function(s){return e(n,s,i)}):pt(i)?qe(function(s){return e(n,r,s)}):e(n,r,i)}}}const Sp=Number.isInteger||function(e){return e<<0===e};function Ep(e,t){var n=e<0?t.length+e:e;return t[n]}var Tp=Ge(function(e,t){return t==null||t!==t?e:t});function Ap(e,t){for(var n=t,r=0;r<e.length;r+=1){if(n==null)return;var i=e[r];Sp(i)?n=Ep(i,n):n=n[i]}return n}var Wo=Ip(function(e,t,n){return Tp(e,Ap(t,n))});async function Ho(){try{return gu.fetchAuthSession().then(e=>e?.tokens?.accessToken.toString())}catch(e){console.error(e)}}const Ko=["BOOLEAN","INT32","INT64","INT96","FLOAT","DOUBLE","BYTE_ARRAY","FIXED_LEN_BYTE_ARRAY"],We=["PLAIN","GROUP_VAR_INT","PLAIN_DICTIONARY","RLE","BIT_PACKED","DELTA_BINARY_PACKED","DELTA_LENGTH_BYTE_ARRAY","DELTA_BYTE_ARRAY","RLE_DICTIONARY","BYTE_STREAM_SPLIT"],Np=["REQUIRED","OPTIONAL","REPEATED"],Rp=["UTF8","MAP","MAP_KEY_VALUE","LIST","ENUM","DECIMAL","DATE","TIME_MILLIS","TIME_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UINT_8","UINT_16","UINT_32","UINT_64","INT_8","INT_16","INT_32","INT_64","JSON","BSON","INTERVAL"],Bp=["UNCOMPRESSED","SNAPPY","GZIP","LZO","BROTLI","LZ4","ZSTD","LZ4_RAW"],Qo=["DATA_PAGE","INDEX_PAGE","DICTIONARY_PAGE","DATA_PAGE_V2"],Xo={timestampFromMilliseconds(e){return new Date(Number(e))},timestampFromMicroseconds(e){return new Date(Number(e/1000n))},timestampFromNanoseconds(e){return new Date(Number(e/1000000n))},dateFromDays(e){return new Date(e*864e5)}};function Jo(e,t,n,r){if(t&&n.endsWith("_DICTIONARY")){let i=e;e instanceof Uint8Array&&!(t instanceof Uint8Array)&&(i=new t.constructor(e.length));for(let s=0;s<e.length;s++)i[s]=t[e[s]];return i}else return Zo(e,r)}function Zo(e,t){const{element:n,parsers:r,utf8:i=!0}=t,{type:s,converted_type:o,logical_type:a}=n;if(o==="DECIMAL"){const l=10**-(n.scale||0),c=new Array(e.length);for(let u=0;u<c.length;u++)e[0]instanceof Uint8Array?c[u]=ta(e[u])*l:c[u]=Number(e[u])*l;return c}if(!o&&s==="INT96"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.timestampFromNanoseconds(Op(e[c]));return l}if(o==="DATE"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.dateFromDays(e[c]);return l}if(o==="TIMESTAMP_MILLIS"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.timestampFromMilliseconds(e[c]);return l}if(o==="TIMESTAMP_MICROS"){const l=new Array(e.length);for(let c=0;c<l.length;c++)l[c]=r.timestampFromMicroseconds(e[c]);return l}if(o==="JSON"){const l=new TextDecoder;return e.map(c=>JSON.parse(l.decode(c)))}if(o==="BSON")throw new Error("parquet bson not supported");if(o==="INTERVAL")throw new Error("parquet interval not supported");if(o==="UTF8"||a?.type==="STRING"||i&&s==="BYTE_ARRAY"){const l=new TextDecoder,c=new Array(e.length);for(let u=0;u<c.length;u++)c[u]=e[u]&&l.decode(e[u]);return c}if(o==="UINT_64"||a?.type==="INTEGER"&&a.bitWidth===64&&!a.isSigned){if(e instanceof BigInt64Array)return new BigUint64Array(e.buffer,e.byteOffset,e.length);const l=new BigUint64Array(e.length);for(let c=0;c<l.length;c++)l[c]=BigInt(e[c]);return l}if(o==="UINT_32"||a?.type==="INTEGER"&&a.bitWidth===32&&!a.isSigned){if(e instanceof Int32Array)return new Uint32Array(e.buffer,e.byteOffset,e.length);const l=new Uint32Array(e.length);for(let c=0;c<l.length;c++)l[c]=e[c];return l}if(a?.type==="FLOAT16")return Array.from(e).map(ea);if(a?.type==="TIMESTAMP"){const{unit:l}=a;let c=r.timestampFromMilliseconds;l==="MICROS"&&(c=r.timestampFromMicroseconds),l==="NANOS"&&(c=r.timestampFromNanoseconds);const u=new Array(e.length);for(let h=0;h<u.length;h++)u[h]=c(e[h]);return u}return e}function ta(e){let t=0;for(const r of e)t=t*256+r;const n=e.length*8;return t>=2**(n-1)&&(t-=2**n),t}function Op(e){const t=(e>>64n)-2440588n,n=e&0xffffffffffffffffn;return t*86400000000000n+n}function ea(e){if(!e)return;const t=e[1]<<8|e[0],n=t>>15?-1:1,r=t>>10&31,i=t&1023;return r===0?n*2**-14*(i/1024):r===31?i?NaN:n*(1/0):n*2**(r-15)*(1+i/1024)}function na(e,t,n){const r=e[t],i=[];let s=1;if(r.num_children)for(;i.length<r.num_children;){const o=e[t+s],a=na(e,t+s,[...n,o.name]);s+=a.count,i.push(a)}return{count:s,element:r,children:i,path:n}}function ra(e,t){let n=na(e,0,[]);const r=[n];for(const i of t){const s=n.children.find(o=>o.element.name===i);if(!s)throw new Error(`parquet schema element not found: ${t}`);r.push(s),n=s}return r}function ia(e){let t=0;for(const{element:n}of e)n.repetition_type==="REPEATED"&&t++;return t}function Wi(e){let t=0;for(const{element:n}of e.slice(1))n.repetition_type!=="REQUIRED"&&t++;return t}function Dp(e){if(!e||e.element.converted_type!=="LIST"||e.children.length>1)return!1;const t=e.children[0];return!(t.children.length>1||t.element.repetition_type!=="REPEATED")}function Lp(e){if(!e||e.element.converted_type!=="MAP"||e.children.length>1)return!1;const t=e.children[0];return!(t.children.length!==2||t.element.repetition_type!=="REPEATED"||t.children.find(n=>n.element.name==="key")?.element.repetition_type==="REPEATED"||t.children.find(n=>n.element.name==="value")?.element.repetition_type==="REPEATED")}function Fp(e){if(e.length!==2)return!1;const[,t]=e;return!(t.element.repetition_type==="REPEATED"||t.children.length)}const St={STOP:0,TRUE:1,FALSE:2,BYTE:3,I16:4,I32:5,I64:6,DOUBLE:7,BINARY:8,LIST:9,STRUCT:12};function sa(e){let t=0;const n={};for(;e.offset<e.view.byteLength;){const[r,i,s]=aa(e,t);if(t=s,r===St.STOP)break;n[`field_${i}`]=Rr(e,r)}return n}function Rr(e,t){switch(t){case St.TRUE:return!0;case St.FALSE:return!1;case St.BYTE:return e.view.getInt8(e.offset++);case St.I16:case St.I32:return Up(e);case St.I64:return Hi(e);case St.DOUBLE:{const n=e.view.getFloat64(e.offset,!0);return e.offset+=8,n}case St.BINARY:{const n=He(e),r=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,n);return e.offset+=n,r}case St.LIST:{const[n,r]=xp(e),i=n===St.TRUE||n===St.FALSE,s=new Array(r);for(let o=0;o<r;o++)s[o]=i?Rr(e,St.BYTE)===1:Rr(e,n);return s}case St.STRUCT:{const n={};let r=0;for(;;){let i,s;if([i,s,r]=aa(e,r),i===St.STOP)break;n[`field_${s}`]=Rr(e,i)}return n}default:throw new Error(`thrift unhandled type: ${t}`)}}function He(e){let t=0,n=0;for(;;){const r=e.view.getUint8(e.offset++);if(t|=(r&127)<<n,!(r&128))return t;n+=7}}function Mp(e){let t=0n,n=0n;for(;;){const r=e.view.getUint8(e.offset++);if(t|=BigInt(r&127)<<n,!(r&128))return t;n+=7n}}function Up(e){const t=He(e);return t>>>1^-(t&1)}function Hi(e){const t=Mp(e);return t>>1n^-(t&1n)}function oa(e){return e&15}function aa(e,t){const n=e.view.getUint8(e.offset++);if((n&15)===St.STOP)return[0,0,t];const r=n>>4;let i;if(r)i=t+r;else throw new Error("non-delta field id not supported");return[oa(n),i,i]}function xp(e){const t=e.view.getUint8(e.offset++),n=t>>4,r=oa(t);if(n===15){const i=He(e);return[r,i]}return[r,n]}const Cp=1<<19;async function $p(e,{parsers:t,initialFetchSize:n=Cp}={}){if(!e||!(e.byteLength>=0))throw new Error("parquet expected AsyncBuffer");const r=Math.max(0,e.byteLength-n),i=await e.slice(r,e.byteLength),s=new DataView(i);if(s.getUint32(i.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const o=s.getUint32(i.byteLength-8,!0);if(o>e.byteLength-8)throw new Error(`parquet metadata length ${o} exceeds available buffer ${e.byteLength-8}`);if(o+8>n){const a=e.byteLength-o-8,l=await e.slice(a,r),c=new ArrayBuffer(o+8),u=new Uint8Array(c);return u.set(new Uint8Array(l)),u.set(new Uint8Array(i),r-a),Ki(c,{parsers:t})}else return Ki(i,{parsers:t})}function Ki(e,{parsers:t}={}){if(!(e instanceof ArrayBuffer))throw new Error("parquet expected ArrayBuffer");const n=new DataView(e);if(t={...Xo,...t},n.byteLength<8)throw new Error("parquet file is too short");if(n.getUint32(n.byteLength-4,!0)!==827474256)throw new Error("parquet file invalid (footer != PAR1)");const r=n.byteLength-8,i=n.getUint32(r,!0);if(i>n.byteLength-8)throw new Error(`parquet metadata length ${i} exceeds available buffer ${n.byteLength-8}`);const s=r-i,o=sa({view:n,offset:s}),a=new TextDecoder;function l(E){return E&&a.decode(E)}const c=o.field_1,u=o.field_2.map(E=>({type:Ko[E.field_1],type_length:E.field_2,repetition_type:Np[E.field_3],name:l(E.field_4),num_children:E.field_5,converted_type:Rp[E.field_6],scale:E.field_7,precision:E.field_8,field_id:E.field_9,logical_type:Pp(E.field_10)})),h=u.filter(E=>E.type),y=o.field_3,g=o.field_4.map(E=>({columns:E.field_1.map((v,j)=>({file_path:l(v.field_1),file_offset:v.field_2,meta_data:v.field_3&&{type:Ko[v.field_3.field_1],encodings:v.field_3.field_2?.map(tt=>We[tt]),path_in_schema:v.field_3.field_3.map(l),codec:Bp[v.field_3.field_4],num_values:v.field_3.field_5,total_uncompressed_size:v.field_3.field_6,total_compressed_size:v.field_3.field_7,key_value_metadata:v.field_3.field_8,data_page_offset:v.field_3.field_9,index_page_offset:v.field_3.field_10,dictionary_page_offset:v.field_3.field_11,statistics:Vp(v.field_3.field_12,h[j],t),encoding_stats:v.field_3.field_13?.map(tt=>({page_type:Qo[tt.field_1],encoding:We[tt.field_2],count:tt.field_3})),bloom_filter_offset:v.field_3.field_14,bloom_filter_length:v.field_3.field_15,size_statistics:v.field_3.field_16&&{unencoded_byte_array_data_bytes:v.field_3.field_16.field_1,repetition_level_histogram:v.field_3.field_16.field_2,definition_level_histogram:v.field_3.field_16.field_3}},offset_index_offset:v.field_4,offset_index_length:v.field_5,column_index_offset:v.field_6,column_index_length:v.field_7,crypto_metadata:v.field_8,encrypted_column_metadata:v.field_9})),total_byte_size:E.field_2,num_rows:E.field_3,sorting_columns:E.field_4?.map(v=>({column_idx:v.field_1,descending:v.field_2,nulls_first:v.field_3})),file_offset:E.field_5,total_compressed_size:E.field_6,ordinal:E.field_7})),w=o.field_5?.map(E=>({key:l(E.field_1),value:l(E.field_2)})),N=l(o.field_6);return{version:c,schema:u,num_rows:y,row_groups:g,key_value_metadata:w,created_by:N,metadata_length:i}}function kp({schema:e}){return ra(e,[])[0]}function Pp(e){return e?.field_1?{type:"STRING"}:e?.field_2?{type:"MAP"}:e?.field_3?{type:"LIST"}:e?.field_4?{type:"ENUM"}:e?.field_5?{type:"DECIMAL",scale:e.field_5.field_1,precision:e.field_5.field_2}:e?.field_6?{type:"DATE"}:e?.field_7?{type:"TIME",isAdjustedToUTC:e.field_7.field_1,unit:la(e.field_7.field_2)}:e?.field_8?{type:"TIMESTAMP",isAdjustedToUTC:e.field_8.field_1,unit:la(e.field_8.field_2)}:e?.field_10?{type:"INTEGER",bitWidth:e.field_10.field_1,isSigned:e.field_10.field_2}:e?.field_11?{type:"NULL"}:e?.field_12?{type:"JSON"}:e?.field_13?{type:"BSON"}:e?.field_14?{type:"UUID"}:e?.field_15?{type:"FLOAT16"}:e}function la(e){if(e.field_1)return"MILLIS";if(e.field_2)return"MICROS";if(e.field_3)return"NANOS";throw new Error("parquet time unit required")}function Vp(e,t,n){return e&&{max:Br(e.field_1,t,n),min:Br(e.field_2,t,n),null_count:e.field_3,distinct_count:e.field_4,max_value:Br(e.field_5,t,n),min_value:Br(e.field_6,t,n),is_max_value_exact:e.field_7,is_min_value_exact:e.field_8}}function Br(e,t,n){const{type:r,converted_type:i,logical_type:s}=t;if(e===void 0)return e;if(r==="BOOLEAN")return e[0]===1;if(r==="BYTE_ARRAY")return new TextDecoder().decode(e);const o=new DataView(e.buffer,e.byteOffset,e.byteLength);return r==="FLOAT"&&o.byteLength===4?o.getFloat32(0,!0):r==="DOUBLE"&&o.byteLength===8?o.getFloat64(0,!0):r==="INT32"&&i==="DATE"?n.dateFromDays(o.getInt32(0,!0)):r==="INT64"&&i==="TIMESTAMP_MILLIS"?n.timestampFromMilliseconds(o.getBigInt64(0,!0)):r==="INT64"&&i==="TIMESTAMP_MICROS"?n.timestampFromMicroseconds(o.getBigInt64(0,!0)):r==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="NANOS"?n.timestampFromNanoseconds(o.getBigInt64(0,!0)):r==="INT64"&&s?.type==="TIMESTAMP"&&s?.unit==="MICROS"?n.timestampFromMicroseconds(o.getBigInt64(0,!0)):r==="INT64"&&s?.type==="TIMESTAMP"?n.timestampFromMilliseconds(o.getBigInt64(0,!0)):r==="INT32"&&o.byteLength===4?o.getInt32(0,!0):r==="INT64"&&o.byteLength===8?o.getBigInt64(0,!0):i==="DECIMAL"?ta(e)*10**-(t.scale||0):s?.type==="FLOAT16"?ea(e):e}function Qi(e,t){for(let n=0;n<t.length;n+=1e4)e.push(...t.slice(n,n+1e4))}function ca(e){if(!e)return[];if(e.length===1)return e[0];const t=[];for(const n of e)Qi(t,n);return t}const zp=1<<25;function Yp({metadata:e,rowStart:t=0,rowEnd:n=1/0,columns:r}){if(!e)throw new Error("parquetPlan requires metadata");const i=[],s=[];let o=0;for(const a of e.row_groups){const l=Number(a.num_rows),c=o+l;if(l>0&&c>=t&&o<n){const u=[];for(const{file_path:w,meta_data:N}of a.columns){if(w)throw new Error("parquet file_path not supported");if(!N)throw new Error("parquet column metadata is undefined");(!r||r.includes(N.path_in_schema[0]))&&u.push(ua(N))}const h=Math.max(t-o,0),y=Math.min(n-o,l);i.push({ranges:u,rowGroup:a,groupStart:o,groupRows:l,selectStart:h,selectEnd:y});const g=u[u.length-1]?.endByte-u[0]?.startByte;if(!r&&g<zp)s.push({startByte:u[0].startByte,endByte:u[u.length-1].endByte});else if(u.length)Qi(s,u);else if(r?.length)throw new Error(`parquet columns not found: ${r.join(", ")}`)}o=c}return isFinite(n)||(n=o),{metadata:e,rowStart:t,rowEnd:n,columns:r,fetches:s,groups:i}}function ua({dictionary_page_offset:e,data_page_offset:t,total_compressed_size:n}){const r=e||t;return{startByte:Number(r),endByte:Number(r+n)}}function jp(e,{fetches:t}){const n=t.map(({startByte:r,endByte:i})=>e.slice(r,i));return{byteLength:e.byteLength,slice(r,i=e.byteLength){const s=t.findIndex(({startByte:o,endByte:a})=>o<=r&&i<=a);if(s<0)throw new Error(`no prefetch for range [${r}, ${i}]`);if(t[s].startByte!==r||t[s].endByte!==i){const o=r-t[s].startByte,a=i-t[s].startByte;return n[s]instanceof Promise?n[s].then(l=>l.slice(o,a)):n[s].slice(o,a)}else return n[s]}}}function ha(e,t,n,r,i){const s=t?.length||n.length;if(!s)return r;const o=Wi(i),a=i.map(({element:w})=>w.repetition_type);let l=0;const c=[e];let u=e,h=0,y=0,g=0;if(n[0])for(;h<a.length-2&&g<n[0];)h++,a[h]!=="REQUIRED"&&(u=u.at(-1),c.push(u),y++),a[h]==="REPEATED"&&g++;for(let w=0;w<s;w++){const N=t?.length?t[w]:o,E=n[w];for(;h&&(E<g||a[h]!=="REPEATED");)a[h]!=="REQUIRED"&&(c.pop(),y--),a[h]==="REPEATED"&&g--,h--;for(u=c.at(-1);(h<a.length-2||a[h+1]==="REPEATED")&&(y<N||a[h+1]==="REQUIRED");){if(h++,a[h]!=="REQUIRED"){const v=[];u.push(v),u=v,c.push(v),y++}a[h]==="REPEATED"&&g++}N===o?u.push(r[l++]):h===a.length-2?u.push(null):u.push([])}if(!e.length)for(let w=0;w<o;w++){const N=[];u.push(N),u=N}return e}function kn(e,t,n=0){const r=t.path.join("."),i=t.element.repetition_type==="OPTIONAL",s=i?n+1:n;if(Dp(t)){let o=t.children[0],a=s;o.children.length===1&&(o=o.children[0],a++),kn(e,o,a);const l=o.path.join("."),c=e.get(l);if(!c)throw new Error("parquet list column missing values");i&&Or(c,n),e.set(r,c),e.delete(l);return}if(Lp(t)){const o=t.children[0].element.name;kn(e,t.children[0].children[0],s+1),kn(e,t.children[0].children[1],s+1);const a=e.get(`${r}.${o}.key`),l=e.get(`${r}.${o}.value`);if(!a)throw new Error("parquet map column missing keys");if(!l)throw new Error("parquet map column missing values");if(a.length!==l.length)throw new Error("parquet map column key/value length mismatch");const c=da(a,l,s);i&&Or(c,n),e.delete(`${r}.${o}.key`),e.delete(`${r}.${o}.value`),e.set(r,c);return}if(t.children.length){const o=t.element.repetition_type==="REQUIRED"?n:n+1,a={};for(const c of t.children){kn(e,c,o);const u=e.get(c.path.join("."));if(!u)throw new Error("parquet struct missing child data");a[c.element.name]=u}for(const c of t.children)e.delete(c.path.join("."));const l=fa(a,o);i&&Or(l,n),e.set(r,l)}}function Or(e,t){for(let n=0;n<e.length;n++)t?Or(e[n],t-1):e[n]=e[n][0]}function da(e,t,n){const r=[];for(let i=0;i<e.length;i++)if(n)r.push(da(e[i],t[i],n-1));else if(e[i]){const s={};for(let o=0;o<e[i].length;o++){const a=t[i][o];s[e[i][o]]=a===void 0?null:a}r.push(s)}else r.push(void 0);return r}function fa(e,t){const n=Object.keys(e),r=e[n[0]]?.length,i=[];for(let s=0;s<r;s++){const o={};for(const a of n){if(e[a].length!==r)throw new Error("parquet struct parsing error");o[a]=e[a][s]}t?i.push(fa(o,t-1)):i.push(o)}return i}function Pn(e,t,n){const r=n instanceof Int32Array,i=He(e),s=He(e);He(e);let o=Hi(e),a=0;n[a++]=r?Number(o):o;const l=i/s;for(;a<t;){const c=Hi(e),u=new Uint8Array(s);for(let h=0;h<s;h++)u[h]=e.view.getUint8(e.offset++);for(let h=0;h<s&&a<t;h++){const y=BigInt(u[h]);if(y){let g=0n,w=l;const N=(1n<<y)-1n;for(;w&&a<t;){let E=BigInt(e.view.getUint8(e.offset))>>g&N;for(g+=y;g>=8;)g-=8n,e.offset++,g&&(E|=BigInt(e.view.getUint8(e.offset))<<y-g&N);const v=c+E;o+=v,n[a++]=r?Number(o):o,w--}w&&(e.offset+=Math.ceil((w*Number(y)+Number(g))/8))}else for(let g=0;g<l&&a<t;g++)o+=c,n[a++]=r?Number(o):o}}}function pa(e,t,n){const r=new Int32Array(t);Pn(e,t,r);for(let i=0;i<t;i++)n[i]=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,r[i]),e.offset+=r[i]}function qp(e,t,n){const r=new Int32Array(t);Pn(e,t,r);const i=new Int32Array(t);Pn(e,t,i);for(let s=0;s<t;s++){const o=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,i[s]);r[s]?(n[s]=new Uint8Array(r[s]+i[s]),n[s].set(n[s-1].subarray(0,r[s])),n[s].set(o,r[s])):n[s]=o,e.offset+=i[s]}}function Dr(e){return 32-Math.clz32(e)}function Le(e,t,n,r){r===void 0&&(r=e.view.getUint32(e.offset,!0),e.offset+=4);const i=e.offset;let s=0;for(;s<n.length;){const o=He(e);if(o&1)s=Wp(e,o,t,n,s);else{const a=o>>>1;Gp(e,a,t,n,s),s+=a}}e.offset=i+r}function Gp(e,t,n,r,i){const s=n+7>>3;let o=0;for(let a=0;a<s;a++)o|=e.view.getUint8(e.offset++)<<(a<<3);for(let a=0;a<t;a++)r[i+a]=o}function Wp(e,t,n,r,i){let s=t>>1<<3;const o=(1<<n)-1;let a=0;if(e.offset<e.view.byteLength)a=e.view.getUint8(e.offset++);else if(o)throw new Error(`parquet bitpack offset ${e.offset} out of range`);let l=8,c=0;for(;s;)c>8?(c-=8,l-=8,a>>>=8):l-c<n?(a|=e.view.getUint8(e.offset)<<l,e.offset++,l+=8):(i<r.length&&(r[i++]=a>>c&o),s--,c+=n);return i}function ya(e,t,n,r){const i=Hp(n,r),s=new Uint8Array(t*i);for(let o=0;o<i;o++)for(let a=0;a<t;a++)s[a*i+o]=e.view.getUint8(e.offset++);if(n==="FLOAT")return new Float32Array(s.buffer);if(n==="DOUBLE")return new Float64Array(s.buffer);if(n==="INT32")return new Int32Array(s.buffer);if(n==="INT64")return new BigInt64Array(s.buffer);if(n==="FIXED_LEN_BYTE_ARRAY"){const o=new Array(t);for(let a=0;a<t;a++)o[a]=s.subarray(a*i,(a+1)*i);return o}throw new Error(`parquet byte_stream_split unsupported type: ${n}`)}function Hp(e,t){switch(e){case"INT32":case"FLOAT":return 4;case"INT64":case"DOUBLE":return 8;case"FIXED_LEN_BYTE_ARRAY":if(!t)throw new Error("parquet byteWidth missing type_length");return t;default:throw new Error(`parquet unsupported type: ${e}`)}}function Xi(e,t,n,r){if(n===0)return[];if(t==="BOOLEAN")return Kp(e,n);if(t==="INT32")return Qp(e,n);if(t==="INT64")return Xp(e,n);if(t==="INT96")return Jp(e,n);if(t==="FLOAT")return Zp(e,n);if(t==="DOUBLE")return ty(e,n);if(t==="BYTE_ARRAY")return ey(e,n);if(t==="FIXED_LEN_BYTE_ARRAY"){if(!r)throw new Error("parquet missing fixed length");return ny(e,n,r)}else throw new Error(`parquet unhandled type: ${t}`)}function Kp(e,t){const n=new Array(t);for(let r=0;r<t;r++){const i=e.offset+(r/8|0),s=r%8,o=e.view.getUint8(i);n[r]=(o&1<<s)!==0}return e.offset+=Math.ceil(t/8),n}function Qp(e,t){const n=(e.view.byteOffset+e.offset)%4?new Int32Array(Lr(e.view.buffer,e.view.byteOffset+e.offset,t*4)):new Int32Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*4,n}function Xp(e,t){const n=(e.view.byteOffset+e.offset)%8?new BigInt64Array(Lr(e.view.buffer,e.view.byteOffset+e.offset,t*8)):new BigInt64Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*8,n}function Jp(e,t){const n=new Array(t);for(let r=0;r<t;r++){const i=e.view.getBigInt64(e.offset+r*12,!0),s=e.view.getInt32(e.offset+r*12+8,!0);n[r]=BigInt(s)<<64n|i}return e.offset+=t*12,n}function Zp(e,t){const n=(e.view.byteOffset+e.offset)%4?new Float32Array(Lr(e.view.buffer,e.view.byteOffset+e.offset,t*4)):new Float32Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*4,n}function ty(e,t){const n=(e.view.byteOffset+e.offset)%8?new Float64Array(Lr(e.view.buffer,e.view.byteOffset+e.offset,t*8)):new Float64Array(e.view.buffer,e.view.byteOffset+e.offset,t);return e.offset+=t*8,n}function ey(e,t){const n=new Array(t);for(let r=0;r<t;r++){const i=e.view.getUint32(e.offset,!0);e.offset+=4,n[r]=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,i),e.offset+=i}return n}function ny(e,t,n){const r=new Array(t);for(let i=0;i<t;i++)r[i]=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,n),e.offset+=n;return r}function Lr(e,t,n){const r=new ArrayBuffer(n);return new Uint8Array(r).set(new Uint8Array(e,t,n)),r}const ry=[0,255,65535,16777215,4294967295];function ma(e,t,n,r,i){for(let s=0;s<i;s++)n[r+s]=e[t+s]}function iy(e,t){const n=e.byteLength,r=t.byteLength;let i=0,s=0;for(;i<n;){const o=e[i];if(i++,o<128)break}if(r&&i>=n)throw new Error("invalid snappy length header");for(;i<n;){const o=e[i];let a=0;if(i++,i>=n)throw new Error("missing eof marker");if((o&3)===0){let l=(o>>>2)+1;if(l>60){if(i+3>=n)throw new Error("snappy error literal pos + 3 >= inputLength");const c=l-60;l=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),l=(l&ry[c])+1,i+=c}if(i+l>n)throw new Error("snappy error literal exceeds input length");ma(e,i,t,s,l),i+=l,s+=l}else{let l=0;switch(o&3){case 1:a=(o>>>2&7)+4,l=e[i]+(o>>>5<<8),i++;break;case 2:if(n<=i+1)throw new Error("snappy error end of input");a=(o>>>2)+1,l=e[i]+(e[i+1]<<8),i+=2;break;case 3:if(n<=i+3)throw new Error("snappy error end of input");a=(o>>>2)+1,l=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+(e[i+3]<<24),i+=4;break}if(l===0||isNaN(l))throw new Error(`invalid offset ${l} pos ${i} inputLength ${n}`);if(l>s)throw new Error("cannot copy from before start of buffer");ma(t,s-l,t,s,a),s+=a}}if(s!==r)throw new Error("premature end of input")}function sy(e,t,{type:n,element:r,schemaPath:i}){const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o={view:s,offset:0};let a;const l=oy(o,t,i),{definitionLevels:c,numNulls:u}=ay(o,t,i),h=t.num_values-u;if(t.encoding==="PLAIN")a=Xi(o,n,h,r.type_length);else if(t.encoding==="PLAIN_DICTIONARY"||t.encoding==="RLE_DICTIONARY"||t.encoding==="RLE"){const y=n==="BOOLEAN"?1:s.getUint8(o.offset++);y?(a=new Array(h),n==="BOOLEAN"?(Le(o,y,a),a=a.map(g=>!!g)):Le(o,y,a,s.byteLength-o.offset)):a=new Uint8Array(h)}else if(t.encoding==="BYTE_STREAM_SPLIT")a=ya(o,h,n,r.type_length);else if(t.encoding==="DELTA_BINARY_PACKED")a=n==="INT32"?new Int32Array(h):new BigInt64Array(h),Pn(o,h,a);else if(t.encoding==="DELTA_LENGTH_BYTE_ARRAY")a=new Array(h),pa(o,h,a);else throw new Error(`parquet unsupported encoding: ${t.encoding}`);return{definitionLevels:c,repetitionLevels:l,dataPage:a}}function oy(e,t,n){if(n.length>1){const r=ia(n);if(r){const i=new Array(t.num_values);return Le(e,Dr(r),i),i}}return[]}function ay(e,t,n){const r=Wi(n);if(!r)return{definitionLevels:[],numNulls:0};const i=new Array(t.num_values);Le(e,Dr(r),i);let s=t.num_values;for(const o of i)o===r&&s--;return s===0&&(i.length=0),{definitionLevels:i,numNulls:s}}function Ji(e,t,n,r){let i;const s=r?.[n];if(n==="UNCOMPRESSED")i=e;else if(s)i=s(e,t);else if(n==="SNAPPY")i=new Uint8Array(t),iy(e,i);else throw new Error(`parquet unsupported compression codec: ${n}`);if(i?.length!==t)throw new Error(`parquet decompressed page length ${i?.length} does not match header ${t}`);return i}function ly(e,t,n){const r={view:new DataView(e.buffer,e.byteOffset,e.byteLength),offset:0},{type:i,element:s,schemaPath:o,codec:a,compressors:l}=n,c=t.data_page_header_v2;if(!c)throw new Error("parquet data page header v2 is undefined");const u=cy(r,c,o);r.offset=c.repetition_levels_byte_length;const h=uy(r,c,o),y=t.uncompressed_page_size-c.definition_levels_byte_length-c.repetition_levels_byte_length;let g=e.subarray(r.offset);c.is_compressed!==!1&&(g=Ji(g,y,a,l));const w=new DataView(g.buffer,g.byteOffset,g.byteLength),N={view:w,offset:0};let E;const v=c.num_values-c.num_nulls;if(c.encoding==="PLAIN")E=Xi(N,i,v,s.type_length);else if(c.encoding==="RLE")E=new Array(v),Le(N,1,E),E=E.map(j=>!!j);else if(c.encoding==="PLAIN_DICTIONARY"||c.encoding==="RLE_DICTIONARY"){const j=w.getUint8(N.offset++);E=new Array(v),Le(N,j,E,y-1)}else if(c.encoding==="DELTA_BINARY_PACKED")E=i==="INT32"?new Int32Array(v):new BigInt64Array(v),Pn(N,v,E);else if(c.encoding==="DELTA_LENGTH_BYTE_ARRAY")E=new Array(v),pa(N,v,E);else if(c.encoding==="DELTA_BYTE_ARRAY")E=new Array(v),qp(N,v,E);else if(c.encoding==="BYTE_STREAM_SPLIT")E=ya(r,v,i,s.type_length);else throw new Error(`parquet unsupported encoding: ${c.encoding}`);return{definitionLevels:h,repetitionLevels:u,dataPage:E}}function cy(e,t,n){const r=ia(n);if(!r)return[];const i=new Array(t.num_values);return Le(e,Dr(r),i,t.repetition_levels_byte_length),i}function uy(e,t,n){const r=Wi(n);if(r){const i=new Array(t.num_values);return Le(e,Dr(r),i,t.definition_levels_byte_length),i}}function hy(e,{groupStart:t,selectStart:n,selectEnd:r},i,s){const{columnName:o}=i,a=[];let l,c,u=0;const h=s&&(()=>{c&&s({columnName:o,columnData:c,rowStart:t+u-c.length,rowEnd:t+u})});for(;u<r&&!(e.offset>=e.view.byteLength-1);){const y=dy(e);if(y.type==="DICTIONARY_PAGE")l=ga(e,y,i,l,void 0,0),l=Zo(l,i);else{const g=c?.length||0,w=ga(e,y,i,l,c,n-u);c===w?u+=w.length-g:(h?.(),a.push(w),u+=w.length,c=w)}}return h?.(),u>r&&c&&(a[a.length-1]=c.slice(0,r-(u-c.length))),a}function ga(e,t,n,r,i,s){const{type:o,element:a,schemaPath:l,codec:c,compressors:u}=n,h=new Uint8Array(e.view.buffer,e.view.byteOffset+e.offset,t.compressed_page_size);if(e.offset+=t.compressed_page_size,t.type==="DATA_PAGE"){const y=t.data_page_header;if(!y)throw new Error("parquet data page header is undefined");if(s>y.num_values&&Fp(l))return new Array(y.num_values);const g=Ji(h,Number(t.uncompressed_page_size),c,u),{definitionLevels:w,repetitionLevels:N,dataPage:E}=sy(g,y,n);let v=Jo(E,r,y.encoding,n);if(N.length||w?.length){const j=Array.isArray(i)?i:[];return ha(j,w,N,v,l)}else{for(let j=2;j<l.length;j++)l[j].element.repetition_type!=="REQUIRED"&&(v=Array.from(v,tt=>[tt]));return v}}else if(t.type==="DATA_PAGE_V2"){const y=t.data_page_header_v2;if(!y)throw new Error("parquet data page header v2 is undefined");if(s>y.num_rows)return new Array(y.num_values);const{definitionLevels:g,repetitionLevels:w,dataPage:N}=ly(h,t,n),E=Jo(N,r,y.encoding,n),v=Array.isArray(i)?i:[];return ha(v,g,w,E,l)}else if(t.type==="DICTIONARY_PAGE"){const y=t.dictionary_page_header;if(!y)throw new Error("parquet dictionary page header is undefined");const g=Ji(h,Number(t.uncompressed_page_size),c,u),w={view:new DataView(g.buffer,g.byteOffset,g.byteLength),offset:0};return Xi(w,o,y.num_values,a.type_length)}else throw new Error(`parquet unsupported page type: ${t.type}`)}function dy(e){const t=sa(e),n=Qo[t.field_1],r=t.field_2,i=t.field_3,s=t.field_4,o=t.field_5&&{num_values:t.field_5.field_1,encoding:We[t.field_5.field_2],definition_level_encoding:We[t.field_5.field_3],repetition_level_encoding:We[t.field_5.field_4],statistics:t.field_5.field_5&&{max:t.field_5.field_5.field_1,min:t.field_5.field_5.field_2,null_count:t.field_5.field_5.field_3,distinct_count:t.field_5.field_5.field_4,max_value:t.field_5.field_5.field_5,min_value:t.field_5.field_5.field_6}},a=t.field_6,l=t.field_7&&{num_values:t.field_7.field_1,encoding:We[t.field_7.field_2],is_sorted:t.field_7.field_3},c=t.field_8&&{num_values:t.field_8.field_1,num_nulls:t.field_8.field_2,num_rows:t.field_8.field_3,encoding:We[t.field_8.field_4],definition_levels_byte_length:t.field_8.field_5,repetition_levels_byte_length:t.field_8.field_6,is_compressed:t.field_8.field_7===void 0?!0:t.field_8.field_7,statistics:t.field_8.field_8};return{type:n,uncompressed_page_size:r,compressed_page_size:i,crc:s,data_page_header:o,index_page_header:a,dictionary_page_header:l,data_page_header_v2:c}}function fy(e,{metadata:t,columns:n},r){const{file:i,compressors:s,utf8:o}=e,a=[],l={...Xo,...e.parsers};for(const{file_path:c,meta_data:u}of r.rowGroup.columns){if(c)throw new Error("parquet file_path not supported");if(!u)throw new Error("parquet column metadata is undefined");const h=u.path_in_schema[0];if(n&&!n.includes(h))continue;const{startByte:y,endByte:g}=ua(u),w=g-y;if(w>1<<30){console.warn(`parquet skipping huge column "${u.path_in_schema}" ${w} bytes`);continue}const N=Promise.resolve(i.slice(y,g));a.push({pathInSchema:u.path_in_schema,data:N.then(E=>{const v=ra(t.schema,u.path_in_schema),j={view:new DataView(E),offset:0},tt={columnName:u.path_in_schema.join("."),type:u.type,element:v[v.length-1].element,schemaPath:v,codec:u.codec,parsers:l,compressors:s,utf8:o};return hy(j,r,tt,e.onPage)})})}return{groupStart:r.groupStart,groupRows:r.groupRows,asyncColumns:a}}async function py({asyncColumns:e},t,n,r,i){const s=new Array(n),o=await Promise.all(e.map(({data:u})=>u.then(ca))),a=e.map(u=>u.pathInSchema[0]).filter(u=>!r||r.includes(u)),l=r??a,c=l.map(u=>e.findIndex(h=>h.pathInSchema[0]===u));for(let u=t;u<n;u++)if(i==="object"){const h={};for(let y=0;y<e.length;y++)h[e[y].pathInSchema[0]]=o[y][u];s[u]=h}else{const h=new Array(e.length);for(let y=0;y<l.length;y++)c[y]>=0&&(h[y]=o[c[y]][u]);s[u]=h}return s}function yy(e,t){const{asyncColumns:n}=e,r=[];for(const i of t.children)if(i.children.length){const s=n.filter(l=>l.pathInSchema[0]===i.element.name);if(!s.length)continue;const o=new Map,a=Promise.all(s.map(l=>l.data.then(c=>{o.set(l.pathInSchema.join("."),ca(c))}))).then(()=>{kn(o,i);const l=o.get(i.path.join("."));if(!l)throw new Error("parquet column data not assembled");return[l]});r.push({pathInSchema:i.path,data:a})}else{const s=n.find(o=>o.pathInSchema[0]===i.element.name);s&&r.push(s)}return{...e,asyncColumns:r}}async function my(e){e.metadata??=await $p(e.file);const t=gy(e),{rowStart:n=0,rowEnd:r,columns:i,onChunk:s,onComplete:o,rowFormat:a}=e;if(!o&&!s){for(const{asyncColumns:u}of t)for(const{data:h}of u)await h;return}const l=kp(e.metadata),c=t.map(u=>yy(u,l));if(s)for(const u of c)for(const h of u.asyncColumns)h.data.then(y=>{let g=u.groupStart;for(const w of y)s({columnName:h.pathInSchema[0],columnData:w,rowStart:g,rowEnd:g+w.length}),g+=w.length});if(o){const u=[];for(const h of c){const y=Math.max(n-h.groupStart,0),g=Math.min((r??1/0)-h.groupStart,h.groupRows),w=await py(h,y,g,i,a);Qi(u,w.slice(y,g))}o(u)}else for(const{asyncColumns:u}of c)for(const{data:h}of u)await h}function gy(e){if(!e.metadata)throw new Error("parquet requires metadata");const t=Yp(e);return e.file=jp(e.file,t),t.groups.map(n=>fy(e,t,n))}const by={class:"app-container"},_y=f.defineComponent({__name:"wrapper",props:{apiUrl:{type:String,default:""},pkg:{type:Object,default:{}}},setup(e){const t=e,n=f.ref(5e3),r=f.ref("random"),i=f.ref("#ff0000"),s=f.ref("#0000ff"),o=f.ref("#4285f4"),a=f.ref(!1),l=f.ref(0),c=f.ref(""),u=f.ref(),h=f.ref(),y=f.ref(),g=f.ref(new Map),w=f.ref(new Map);f.watch(()=>h.value,()=>{tt()}),f.onMounted(async()=>{try{await N();let S=await E(u.value[0].content.id);const T=await(await fetch(S)).arrayBuffer();await my({file:T,onComplete:B=>{y.value=Ki(T),r.value=y.value.key_value_metadata[0].key,h.value=B}})}catch(S){console.error(S)}});async function N(){const S=Wo("",["content","id"],t.pkg),T=await Ho(),B=`${t.apiUrl?t.apiUrl:"https://api.pennsieve.net"}/packages/${S}/view?api_key=${T}`;try{const W=await fetch(B,{method:"GET",headers:{"Content-Type":"application/json"}});if(W.ok){u.value=await W.json();return}if(!W.ok)return}catch(W){throw console.error(W),W}}async function E(S){const T=Wo("",["content","id"],t.pkg),B=await Ho(),W=`${t.apiUrl?t.apiUrl:"https://api.pennsieve.net"}/packages/${T}/files/${S}?api_key=${B}`;try{const Q=await fetch(W,{method:"GET",headers:{"Content-Type":"application/json"}});if(Q.ok)return(await Q.json()).url;if(!Q.ok)return}catch(Q){throw console.error(Q),Q}}function v(){a.value=!a.value,l.value++}function j(S){try{if(!S||S.length<7)return console.warn(`Invalid hex color: ${S}, using fallback`),[1,0,0];const T=parseInt(S.slice(1,3),16)/255,B=parseInt(S.slice(3,5),16)/255,W=parseInt(S.slice(5,7),16)/255;return isNaN(T)||isNaN(B)||isNaN(W)?(console.warn(`Invalid hex color components in: ${S}, using fallback`),[1,0,0]):[T,B,W]}catch(T){return console.error("Error converting hex to RGB:",T),[1,0,0]}}function tt(){const S=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"].map(T=>j(T));for(let T=0;T<y.value.key_value_metadata.length-1;T++){const B=y.value.key_value_metadata[T].key,W=JSON.parse(y.value.key_value_metadata[T].value);let Q=new Map,At=0;for(let bt in W)Q.set(W[bt],S[At%S.length]),At++;w.value.set(B,Q),w.value.get(B)==null&&w.value.set(B,new Map)}}function It(S){c.value=S[0],g.value=S[1]}return(S,T)=>(f.openBlock(),f.createElementBlock("div",by,[(f.openBlock(),f.createBlock(fp,{data:h.value,metaData:y.value,pointCount:n.value,"color-map":g.value,colorMode:r.value,startColor:i.value,endColor:s.value,singleColor:o.value,forceRegenerate:a.value,key:l.value},null,8,["data","metaData","pointCount","color-map","colorMode","startColor","endColor","singleColor","forceRegenerate"])),f.createVNode(wp,{pointCount:n.value,"onUpdate:pointCount":T[0]||(T[0]=B=>n.value=B),colorMode:r.value,"onUpdate:colorMode":T[1]||(T[1]=B=>r.value=B),startColor:i.value,"onUpdate:startColor":T[2]||(T[2]=B=>i.value=B),endColor:s.value,"onUpdate:endColor":T[3]||(T[3]=B=>s.value=B),singleColor:o.value,"onUpdate:singleColor":T[4]||(T[4]=B=>o.value=B),"color-scheme":g.value,"color-map-map":w.value,onRegenerate:v,onUpdateColorMap:It},null,8,["pointCount","colorMode","startColor","endColor","singleColor","color-scheme","color-map-map"])]))}}),vy=cr(_y,[["__scopeId","data-v-653da87f"]]),wy="dashboard:globalVars";function ba(e=!1){const t=f.inject(wy,null);return!t&&e&&console.warn("[Widget] dashboard:globalVars not provided."),t}const Iy={class:"data-explorer-wrap"},Sy={class:"data-explorer-info"},Ey=f.defineComponent({inheritAttrs:!1,__name:"DataExplorer",setup(e){const t=ba(),n=f.ref("Data Explorer"),r=f.computed(()=>f.unref(t.apiUrl)),s=f.computed(()=>f.unref(t.filters)).value.currentPackage;return f.watch(()=>f.unref(t.filters).srcPackage,o=>{console.log("new package added "+o)}),(o,a)=>{const l=f.resolveComponent("el-icon");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.renderSlot(o.$slots,"default",{widgetName:n.value},void 0,!0),f.createElementVNode("div",Iy,[f.createElementVNode("div",Sy,[f.createVNode(f.unref(to.ElTooltip),{placement:"top-start"},{content:f.withCtx(()=>a[0]||(a[0]=[f.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])),default:f.withCtx(()=>[f.createVNode(l,{color:"#8300BF"},{default:f.withCtx(()=>[f.createVNode(f.unref(eo))]),_:1})]),_:1})]),f.createVNode(f.unref(xu),{pkg:f.unref(s),apiKey:r.value},null,8,["pkg","apiKey"])])],64)}}}),_a=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},Ty=_a(Ey,[["__scopeId","data-v-827e52a6"]]),Ay={class:"umap-wrap"},Ny={class:"umap-title"},Ry=_a(Object.assign({inheritAttrs:!1},{__name:"Umap",setup(e){const t=ba(),n=f.ref("Data Explorer"),r=f.computed(()=>f.unref(t?.apiUrl)||"");return(i,s)=>{const o=f.resolveComponent("el-icon");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.renderSlot(i.$slots,"default",{widgetName:n.value},void 0,!0),f.createElementVNode("div",Ay,[f.createElementVNode("div",Ny,[f.createVNode(f.unref(to.ElTooltip),{placement:"top-start"},{content:f.withCtx(()=>s[0]||(s[0]=[f.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])),default:f.withCtx(()=>[f.createVNode(o,{color:"#8300BF"},{default:f.withCtx(()=>[f.createVNode(f.unref(eo))]),_:1})]),_:1})]),f.createVNode(f.unref(vy),{apiKey:r.value},null,8,["apiKey"])])],64)}}}),[["__scopeId","data-v-499b6c7c"]]);function z(e,t,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}function va(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(e){return this instanceof q?(this.v=e,this):new q(e)}function oe(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(g){return function(w){return Promise.resolve(w).then(g,h)}}function a(g,w){r[g]&&(i[g]=function(N){return new Promise(function(E,v){s.push([g,N,E,v])>1||l(g,N)})},w&&(i[g]=w(i[g])))}function l(g,w){try{c(r[g](w))}catch(N){y(s[0][3],N)}}function c(g){g.value instanceof q?Promise.resolve(g.value.v).then(u,h):y(s[0][2],g)}function u(g){l("next",g)}function h(g){l("throw",g)}function y(g,w){g(w),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Fr(e){var t,n;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]=e[i]?function(o){return(n=!n)?{value:q(e[i](o)),done:!1}:s?s(o):o}:s}}function Ke(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof va=="function"?va(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(o){return new Promise(function(a,l){o=e[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}const By=new TextDecoder("utf-8"),Zi=e=>By.decode(e),Oy=new TextEncoder,ts=e=>Oy.encode(e),Dy=e=>typeof e=="number",wa=e=>typeof e=="boolean",_t=e=>typeof e=="function",Ft=e=>e!=null&&Object(e)===e,Qe=e=>Ft(e)&&_t(e.then),Vn=e=>Ft(e)&&_t(e[Symbol.iterator]),sn=e=>Ft(e)&&_t(e[Symbol.asyncIterator]),es=e=>Ft(e)&&Ft(e.schema),Ia=e=>Ft(e)&&"done"in e&&"value"in e,Sa=e=>Ft(e)&&_t(e.stat)&&Dy(e.fd),Ea=e=>Ft(e)&&ns(e.body),Mr=e=>"_getDOMStream"in e&&"_getNodeStream"in e,Ly=e=>Ft(e)&&_t(e.abort)&&_t(e.getWriter)&&!Mr(e),ns=e=>Ft(e)&&_t(e.cancel)&&_t(e.getReader)&&!Mr(e),Fy=e=>Ft(e)&&_t(e.end)&&_t(e.write)&&wa(e.writable)&&!Mr(e),Ta=e=>Ft(e)&&_t(e.read)&&_t(e.pipe)&&wa(e.readable)&&!Mr(e),My=e=>Ft(e)&&_t(e.clear)&&_t(e.bytes)&&_t(e.position)&&_t(e.setPosition)&&_t(e.capacity)&&_t(e.getBufferIdentifier)&&_t(e.createLong),rs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Uy(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let o,a,l=0,c=0,u=e.length;++l<u;){if(o=t[c],a=e[l],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++c]=a);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:s}=a,n+i<r||r+s<n){a&&(t[++c]=a);continue}t[c]=new Uint8Array(o.buffer,n,r-n+s)}return t}function Aa(e,t,n=0,r=t.byteLength){const i=e.byteLength,s=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return s.set(o,n),e}function ae(e,t){const n=Uy(e),r=n.reduce((u,h)=>u+h.byteLength,0);let i,s,o,a=0,l=-1;const c=Math.min(t||Number.POSITIVE_INFINITY,r);for(const u=n.length;++l<u;){if(i=n[l],s=i.subarray(0,Math.min(i.length,c-a)),c<=a+s.length){s.length<i.length?n[l]=i.subarray(s.length):s.length===i.length&&l++,o?Aa(o,s,a):o=s;break}Aa(o||(o=new Uint8Array(c)),s,a),a+=s.length}return[o||new Uint8Array(0),n.slice(l),r-(o?o.byteLength:0)]}function ct(e,t){let n=Ia(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=ts(n)),n instanceof ArrayBuffer?new e(n):n instanceof rs?new e(n):My(n)?ct(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const zn=e=>ct(Int32Array,e),Na=e=>ct(BigInt64Array,e),J=e=>ct(Uint8Array,e),is=e=>(e.next(),e);function*xy(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof rs?n(t):Vn(t)?t:n(t);return yield*is((function*(i){let s=null;do s=i.next(yield ct(e,s));while(!s.done)})(r[Symbol.iterator]())),new e}const Cy=e=>xy(Uint8Array,e);function Ra(e,t){return oe(this,arguments,function*(){if(Qe(t))return yield q(yield q(yield*Fr(Ke(Ra(e,yield q(t))))));const n=function(s){return oe(this,arguments,function*(){yield yield q(yield q(s))})},r=function(s){return oe(this,arguments,function*(){yield q(yield*Fr(Ke(is((function*(o){let a=null;do a=o.next(yield a?.value);while(!a.done)})(s[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof rs?n(t):Vn(t)?r(t):sn(t)?t:n(t);return yield q(yield*Fr(Ke(is((function(s){return oe(this,arguments,function*(){let o=null;do o=yield q(s.next(yield yield q(ct(e,o))));while(!o.done)})})(i[Symbol.asyncIterator]()))))),yield q(new e)})}const $y=e=>Ra(Uint8Array,e);function Ba(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function ky(e,t){let n=0;const r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}const zt={fromIterable(e){return Ur(Py(e))},fromAsyncIterable(e){return Ur(Vy(e))},fromDOMStream(e){return Ur(zy(e))},fromNodeStream(e){return Ur(jy(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Ur=e=>(e.next(),e);function*Py(e){let t,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?ae(r,o)[0]:([i,r,a]=ae(r,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const c=Cy(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?c.next():c.next(o-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o<a);while(!t)}catch(u){(n=!0)&&typeof c.throw=="function"&&c.throw(u)}finally{n===!1&&typeof c.return=="function"&&c.return(null)}return null}function Vy(e){return oe(this,arguments,function*(){let t,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?ae(r,o)[0]:([i,r,a]=ae(r,o),i)}({cmd:s,size:o}=(yield yield q(null))||{cmd:"read",size:0});const c=$y(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?yield q(c.next()):yield q(c.next(o-a)),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield yield q(l()));while(o<a);while(!t)}catch(u){(n=!0)&&typeof c.throw=="function"&&(yield q(c.throw(u)))}finally{n===!1&&typeof c.return=="function"&&(yield q(c.return(new Uint8Array(0))))}return yield q(null)})}function zy(e){return oe(this,arguments,function*(){let t=!1,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?ae(r,o)[0]:([i,r,a]=ae(r,o),i)}({cmd:s,size:o}=(yield yield q(null))||{cmd:"read",size:0});const c=new Yy(e);try{do if({done:t,value:i}=Number.isNaN(o-a)?yield q(c.read()):yield q(c.read(o-a)),!t&&i.byteLength>0&&(r.push(J(i)),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield yield q(l()));while(o<a);while(!t)}catch(u){(n=!0)&&(yield q(c.cancel(u)))}finally{n===!1?yield q(c.cancel()):e.locked&&c.releaseLock()}return yield q(null)})}class Yy{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 z(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=J(n)),n})}}const ss=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function jy(e){return oe(this,arguments,function*(){const t=[];let n="error",r=!1,i=null,s,o,a=0,l=[],c;function u(){return s==="peek"?ae(l,o)[0]:([c,l,a]=ae(l,o),c)}if({cmd:s,size:o}=(yield yield q(null))||{cmd:"read",size:0},e.isTTY)return yield yield q(new Uint8Array(0)),yield q(null);try{t[0]=ss(e,"end"),t[1]=ss(e,"error");do{if(t[2]=ss(e,"readable"),[n,i]=yield q(Promise.race(t.map(y=>y[2]))),n==="error")break;if((r=n==="end")||(Number.isFinite(o-a)?(c=J(e.read(o-a)),c.byteLength<o-a&&(c=J(e.read()))):c=J(e.read()),c.byteLength>0&&(l.push(c),a+=c.byteLength)),r||o<=a)do({cmd:s,size:o}=yield yield q(u()));while(o<a)}while(!r)}finally{yield q(h(t,n==="error"?i:null))}return yield q(null);function h(y,g){return c=l=null,new Promise((w,N)=>{for(const[E,v]of y)e.off(E,v);try{const E=e.destroy;E&&E.call(e,g),g=void 0}catch(E){g=E||g}finally{g!=null?N(g):w()}})}})}var gt;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(gt||(gt={}));var Et;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Et||(Et={}));var Tt;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Tt||(Tt={}));var Yt;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Yt||(Yt={}));var x;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(x||(x={}));var le;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(le||(le={}));const os=2,ce=4,we=4,nt=4,Fe=new Int32Array(2),Oa=new Float32Array(Fe.buffer),Da=new Float64Array(Fe.buffer),xr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var as;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(as||(as={}));let on=class pu{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new pu(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Fe[0]=this.readInt32(t),Oa[0]}readFloat64(t){return Fe[xr?0:1]=this.readInt32(t),Fe[xr?1:0]=this.readInt32(t+4),Da[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){Oa[0]=n,this.writeInt32(t,Fe[0])}writeFloat64(t,n){Da[0]=n,this.writeInt32(t,Fe[xr?0:1]),this.writeInt32(t+4,Fe[xr?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+ce+we)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<we;n++)t+=String.fromCharCode(this.readInt8(this.position_+ce+n));return t}__offset(t,n){const r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);const r=this.readInt32(t);t+=ce;const i=this.bytes_.subarray(t,t+r);return n===as.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+ce}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=we)throw new Error("FlatBuffers: file identifier must be length "+we);for(let n=0;n<we;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+ce+n))return!1;return!0}createScalarList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s)}return r}createObjList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s.unpack())}return r}},La=class yu{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=on.allocate(n),this.space=n}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,n){t>this.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){const i=this.bb.capacity();this.bb=yu.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)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,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){const n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const r=n<<1,i=on.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(ce,0),this.writeInt32(this.offset()-t+ce)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=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 n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);const r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*os;this.addInt16(s);let o=0;const a=this.space;t:for(n=0;n<this.vtables.length;n++){const l=this.bb.capacity()-this.vtables[n];if(s==this.bb.readInt16(l)){for(let c=os;c<s;c+=os)if(this.bb.readInt16(a+c)!=this.bb.readInt16(l+c))continue t;o=this.vtables[n];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,n,r){const i=r?nt:0;if(n){const s=n;if(this.prep(this.minalign,ce+we+i),s.length!=we)throw new TypeError("FlatBuffers: file identifier must be length "+we);for(let o=we-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,ce+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(ce,t*n),this.prep(r,t*n)}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 n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;return t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length),this.bb.bytes().set(n,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const n=[];for(let r=0;r<t.length;++r){const i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Cr;(function(e){e[e.BUFFER=0]="BUFFER"})(Cr||(Cr={}));var $r;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})($r||($r={}));class Me{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+nt),(n||new Me).__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):$r.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Cr.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,$r.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Cr.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return Me.startBodyCompression(t),Me.addCodec(t,n),Me.addMethod(t,r),Me.endBodyCompression(t)}}class Fa{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}}let Ma=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Ie=class Js{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new Js).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+nt),(n||new Js).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Ma).__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,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Fa).__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 n=this.bb.__offset(this.bb_pos,10);return n?(t||new Me).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}},an=class Zs{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new Zs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+nt),(n||new Zs).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ie).__init(this.bb.__indirect(this.bb_pos+n),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,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var ln;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ln||(ln={}));var kr;(function(e){e[e.DenseArray=0]="DenseArray"})(kr||(kr={}));class kt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+nt),(n||new kt).__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,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return kt.startInt(t),kt.addBitWidth(t,n),kt.addIsSigned(t,r),kt.endInt(t)}}class Se{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new Se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+nt),(n||new Se).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new kt).__init(this.bb.__indirect(this.bb_pos+n),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):kr.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,kr.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class vt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+nt),(n||new vt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return vt.startKeyValue(t),vt.addKey(t,n),vt.addValue(t,r),vt.endKeyValue(t)}}let Ua=class er{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+nt),(n||new er).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return er.startBinary(t),er.endBinary(t)}},xa=class nr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new nr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+nt),(n||new nr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return nr.startBool(t),nr.endBool(t)}},Pr=class En{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new En).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+nt),(n||new En).__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):Yt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Yt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return En.startDate(t),En.addUnit(t,n),En.endDate(t)}},cn=class Ve{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new Ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+nt),(n||new Ve).__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,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return Ve.startDecimal(t),Ve.addPrecision(t,n),Ve.addScale(t,r),Ve.addBitWidth(t,i),Ve.endDecimal(t)}},Vr=class Tn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new Tn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+nt),(n||new Tn).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):x.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,x.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return Tn.startDuration(t),Tn.addUnit(t,n),Tn.endDuration(t)}},zr=class An{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new An).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+nt),(n||new An).__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,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return An.startFixedSizeBinary(t),An.addByteWidth(t,n),An.endFixedSizeBinary(t)}},Yr=class Nn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new Nn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+nt),(n||new Nn).__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,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return Nn.startFixedSizeList(t),Nn.addListSize(t,n),Nn.endFixedSizeList(t)}};class ue{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+nt),(n||new ue).__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):Tt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Tt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return ue.startFloatingPoint(t),ue.addPrecision(t,n),ue.endFloatingPoint(t)}}class he{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+nt),(n||new he).__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):le.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,le.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return he.startInterval(t),he.addUnit(t,n),he.endInterval(t)}}let Ca=class rr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new rr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+nt),(n||new rr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return rr.startLargeBinary(t),rr.endLargeBinary(t)}},$a=class ir{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new ir).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+nt),(n||new ir).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return ir.startLargeUtf8(t),ir.endLargeUtf8(t)}},ka=class sr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new sr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+nt),(n||new sr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return sr.startList(t),sr.endList(t)}},jr=class Rn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new Rn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+nt),(n||new Rn).__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,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return Rn.startMap(t),Rn.addKeysSorted(t,n),Rn.endMap(t)}},Pa=class or{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new or).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+nt),(n||new or).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return or.startNull(t),or.endNull(t)}};class Xe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new Xe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+nt),(n||new Xe).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Xe.startStruct_(t),Xe.endStruct_(t)}}class jt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+nt),(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):x.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,x.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return jt.startTime(t),jt.addUnit(t,n),jt.addBitWidth(t,r),jt.endTime(t)}}class qt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+nt),(n||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):x.SECOND}timezone(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,x.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return qt.startTimestamp(t),qt.addUnit(t,n),qt.addTimezone(t,r),qt.endTimestamp(t)}}class Mt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+nt),(n||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):Et.Sparse}typeIds(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+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,n){t.addFieldInt16(0,n,Et.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return Mt.startUnion(t),Mt.addMode(t,n),Mt.addTypeIds(t,r),Mt.endUnion(t)}}let Va=class ar{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new ar).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+nt),(n||new ar).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return ar.startUtf8(t),ar.endUtf8(t)}};var ht;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ht||(ht={}));let Gt=class Ri{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new Ri).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+nt),(n||new Ri).__init(t.readInt32(t.position())+t.position(),t)}name(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,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):ht.NONE}type(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){const n=this.bb.__offset(this.bb_pos,12);return n?(t||new Se).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){const r=this.bb.__offset(this.bb_pos,14);return r?(n||new Ri).__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,n){const r=this.bb.__offset(this.bb_pos,16);return r?(n||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,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ht.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}},de=class Be{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new Be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+nt),(n||new Be).__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):ln.Little}fields(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Gt).__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,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||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 n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,ln.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,s){return Be.startSchema(t),Be.addEndianness(t,n),Be.addFields(t,r),Be.addCustomMetadata(t,i),Be.addFeatures(t,s),Be.endSchema(t)}};var et;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(et||(et={}));var p;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(p||(p={}));var Ee;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Ee||(Ee={}));const qy=void 0;function Yn(e){if(e===null)return"null";if(e===qy)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Yn(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}function ut(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function za(e,t){return ut(e/t)+ut(e%t)/ut(t)}const Gy=Symbol.for("isArrowBigNum");function Zt(e,...t){return t.length===0?Object.setPrototypeOf(ct(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Zt.prototype[Gy]=!0,Zt.prototype.toJSON=function(){return`"${qn(this)}"`},Zt.prototype.valueOf=function(e){return Ya(this,e)},Zt.prototype.toString=function(){return qn(this)},Zt.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Ya(this);case"string":return qn(this);case"default":return Ky(this)}return qn(this)};function un(...e){return Zt.apply(this,e)}function hn(...e){return Zt.apply(this,e)}function jn(...e){return Zt.apply(this,e)}Object.setPrototypeOf(un.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(hn.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(jn.prototype,Object.create(Uint32Array.prototype)),Object.assign(un.prototype,Zt.prototype,{constructor:un,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(hn.prototype,Zt.prototype,{constructor:hn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(jn.prototype,Zt.prototype,{constructor:jn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Wy=BigInt(4294967296)*BigInt(4294967296),Hy=Wy-BigInt(1);function Ya(e,t){const{buffer:n,byteOffset:r,byteLength:i,signed:s}=e,o=new BigUint64Array(n,r,i/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63);let l=BigInt(0),c=0;if(a){for(const u of o)l|=(u^Hy)*(BigInt(1)<<BigInt(64*c++));l*=BigInt(-1),l-=BigInt(1)}else for(const u of o)l|=u*(BigInt(1)<<BigInt(64*c++));if(typeof t=="number"){const u=BigInt(Math.pow(10,t)),h=l/u,y=l%u;return ut(h)+ut(y)/ut(u)}return ut(l)}function qn(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return ls(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ls(e);t=t.slice();let n=1;for(let r=0;r<t.length;r++){const i=t[r],s=~i+n;t[r]=s,n&=i===0?1:0}return`-${ls(t)}`}function Ky(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:qn(e)}function ls(e){let t="";const n=new Uint32Array(2);let r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const o=r.length-1;do{for(n[0]=r[s=0];s<o;)r[s++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[s];r[s]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}class cs{static new(t,n){switch(n){case!0:return new un(t);case!1:return new hn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new un(t)}return t.byteLength===16?new jn(t):new hn(t)}static signed(t){return new un(t)}static unsigned(t){return new hn(t)}static decimal(t){return new jn(t)}constructor(t,n){return cs.new(t,n)}}var ja,qa,Ga,Wa,Ha,Ka,Qa,Xa,Ja,Za,tl,el,nl,rl,il,sl,ol,al,ll,cl,ul,hl;class O{static isNull(t){return t?.typeId===p.Null}static isInt(t){return t?.typeId===p.Int}static isFloat(t){return t?.typeId===p.Float}static isBinary(t){return t?.typeId===p.Binary}static isLargeBinary(t){return t?.typeId===p.LargeBinary}static isUtf8(t){return t?.typeId===p.Utf8}static isLargeUtf8(t){return t?.typeId===p.LargeUtf8}static isBool(t){return t?.typeId===p.Bool}static isDecimal(t){return t?.typeId===p.Decimal}static isDate(t){return t?.typeId===p.Date}static isTime(t){return t?.typeId===p.Time}static isTimestamp(t){return t?.typeId===p.Timestamp}static isInterval(t){return t?.typeId===p.Interval}static isDuration(t){return t?.typeId===p.Duration}static isList(t){return t?.typeId===p.List}static isStruct(t){return t?.typeId===p.Struct}static isUnion(t){return t?.typeId===p.Union}static isFixedSizeBinary(t){return t?.typeId===p.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===p.FixedSizeList}static isMap(t){return t?.typeId===p.Map}static isDictionary(t){return t?.typeId===p.Dictionary}static isDenseUnion(t){return O.isUnion(t)&&t.mode===Et.Dense}static isSparseUnion(t){return O.isUnion(t)&&t.mode===Et.Sparse}constructor(t){this.typeId=t}}ja=Symbol.toStringTag,O[ja]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(O.prototype);class Ue extends O{constructor(){super(p.Null)}toString(){return"Null"}}qa=Symbol.toStringTag,Ue[qa]=(e=>e[Symbol.toStringTag]="Null")(Ue.prototype);class Je extends O{constructor(t,n){super(p.Int),this.isSigned=t,this.bitWidth=n}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Ga=Symbol.toStringTag,Je[Ga]=(e=>(e.isSigned=null,e.bitWidth=null,e[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 qr extends O{constructor(t){super(p.Float),this.precision=t}get ArrayType(){switch(this.precision){case Tt.HALF:return Uint16Array;case Tt.SINGLE:return Float32Array;case Tt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Wa=Symbol.toStringTag,qr[Wa]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(qr.prototype);class Gr extends O{constructor(){super(p.Binary)}toString(){return"Binary"}}Ha=Symbol.toStringTag,Gr[Ha]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Gr.prototype);class Wr extends O{constructor(){super(p.LargeBinary)}toString(){return"LargeBinary"}}Ka=Symbol.toStringTag,Wr[Ka]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Wr.prototype);class Hr extends O{constructor(){super(p.Utf8)}toString(){return"Utf8"}}Qa=Symbol.toStringTag,Hr[Qa]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Hr.prototype);class Kr extends O{constructor(){super(p.LargeUtf8)}toString(){return"LargeUtf8"}}Xa=Symbol.toStringTag,Kr[Xa]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Kr.prototype);class Qr extends O{constructor(){super(p.Bool)}toString(){return"Bool"}}Ja=Symbol.toStringTag,Qr[Ja]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Qr.prototype);class Xr extends O{constructor(t,n,r=128){super(p.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Za=Symbol.toStringTag,Xr[Za]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Xr.prototype);class Jr extends O{constructor(t){super(p.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Yt[this.unit]}>`}get ArrayType(){return this.unit===Yt.DAY?Int32Array:BigInt64Array}}tl=Symbol.toStringTag,Jr[tl]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(Jr.prototype);class Zr extends O{constructor(t,n){super(p.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${x[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}el=Symbol.toStringTag,Zr[el]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Zr.prototype);class ti extends O{constructor(t,n){super(p.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${x[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}nl=Symbol.toStringTag,ti[nl]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(ti.prototype);class ei extends O{constructor(t){super(p.Interval),this.unit=t}toString(){return`Interval<${le[this.unit]}>`}}rl=Symbol.toStringTag,ei[rl]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(ei.prototype);class ni extends O{constructor(t){super(p.Duration),this.unit=t}toString(){return`Duration<${x[this.unit]}>`}}il=Symbol.toStringTag,ni[il]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(ni.prototype);class ri extends O{constructor(t){super(p.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}sl=Symbol.toStringTag,ri[sl]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(ri.prototype);class Rt extends O{constructor(t){super(p.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}ol=Symbol.toStringTag,Rt[ol]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Rt.prototype);class ii extends O{constructor(t,n,r){super(p.Union),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}al=Symbol.toStringTag,ii[al]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(ii.prototype);class si extends O{constructor(t){super(p.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}ll=Symbol.toStringTag,si[ll]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(si.prototype);class oi extends O{constructor(t,n){super(p.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}}cl=Symbol.toStringTag,oi[cl]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(oi.prototype);class ai extends O{constructor(t,n=!1){var r,i,s;if(super(p.Map),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){const o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t?.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}ul=Symbol.toStringTag,ai[ul]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(ai.prototype);const Qy=(e=>()=>++e)(-1);class dn extends O{constructor(t,n,r,i){super(p.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Qy():ut(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}hl=Symbol.toStringTag,dn[hl]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(dn.prototype);function Te(e){const t=e;switch(e.typeId){case p.Decimal:return e.bitWidth/32;case p.Interval:return 1+t.unit;case p.FixedSizeList:return t.listSize;case p.FixedSizeBinary:return t.byteWidth;default:return 1}}class G{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return Xy(this,t,n)}getVisitFnByTypeId(t,n=!0){return fn(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function Xy(e,t,n=!0){return typeof t=="number"?fn(e,t,n):typeof t=="string"&&t in p?fn(e,p[t],n):t&&t instanceof O?fn(e,dl(t),n):t?.type&&t.type instanceof O?fn(e,dl(t.type),n):fn(e,p.NONE,n)}function fn(e,t,n=!0){let r=null;switch(t){case p.Null:r=e.visitNull;break;case p.Bool:r=e.visitBool;break;case p.Int:r=e.visitInt;break;case p.Int8:r=e.visitInt8||e.visitInt;break;case p.Int16:r=e.visitInt16||e.visitInt;break;case p.Int32:r=e.visitInt32||e.visitInt;break;case p.Int64:r=e.visitInt64||e.visitInt;break;case p.Uint8:r=e.visitUint8||e.visitInt;break;case p.Uint16:r=e.visitUint16||e.visitInt;break;case p.Uint32:r=e.visitUint32||e.visitInt;break;case p.Uint64:r=e.visitUint64||e.visitInt;break;case p.Float:r=e.visitFloat;break;case p.Float16:r=e.visitFloat16||e.visitFloat;break;case p.Float32:r=e.visitFloat32||e.visitFloat;break;case p.Float64:r=e.visitFloat64||e.visitFloat;break;case p.Utf8:r=e.visitUtf8;break;case p.LargeUtf8:r=e.visitLargeUtf8;break;case p.Binary:r=e.visitBinary;break;case p.LargeBinary:r=e.visitLargeBinary;break;case p.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case p.Date:r=e.visitDate;break;case p.DateDay:r=e.visitDateDay||e.visitDate;break;case p.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case p.Timestamp:r=e.visitTimestamp;break;case p.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case p.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case p.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case p.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case p.Time:r=e.visitTime;break;case p.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case p.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case p.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case p.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case p.Decimal:r=e.visitDecimal;break;case p.List:r=e.visitList;break;case p.Struct:r=e.visitStruct;break;case p.Union:r=e.visitUnion;break;case p.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case p.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case p.Dictionary:r=e.visitDictionary;break;case p.Interval:r=e.visitInterval;break;case p.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case p.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case p.Duration:r=e.visitDuration;break;case p.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case p.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case p.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case p.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case p.FixedSizeList:r=e.visitFixedSizeList;break;case p.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${p[t]}'`)}function dl(e){switch(e.typeId){case p.Null:return p.Null;case p.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?p.Int8:p.Uint8;case 16:return n?p.Int16:p.Uint16;case 32:return n?p.Int32:p.Uint32;case 64:return n?p.Int64:p.Uint64}return p.Int}case p.Float:switch(e.precision){case Tt.HALF:return p.Float16;case Tt.SINGLE:return p.Float32;case Tt.DOUBLE:return p.Float64}return p.Float;case p.Binary:return p.Binary;case p.LargeBinary:return p.LargeBinary;case p.Utf8:return p.Utf8;case p.LargeUtf8:return p.LargeUtf8;case p.Bool:return p.Bool;case p.Decimal:return p.Decimal;case p.Time:switch(e.unit){case x.SECOND:return p.TimeSecond;case x.MILLISECOND:return p.TimeMillisecond;case x.MICROSECOND:return p.TimeMicrosecond;case x.NANOSECOND:return p.TimeNanosecond}return p.Time;case p.Timestamp:switch(e.unit){case x.SECOND:return p.TimestampSecond;case x.MILLISECOND:return p.TimestampMillisecond;case x.MICROSECOND:return p.TimestampMicrosecond;case x.NANOSECOND:return p.TimestampNanosecond}return p.Timestamp;case p.Date:switch(e.unit){case Yt.DAY:return p.DateDay;case Yt.MILLISECOND:return p.DateMillisecond}return p.Date;case p.Interval:switch(e.unit){case le.DAY_TIME:return p.IntervalDayTime;case le.YEAR_MONTH:return p.IntervalYearMonth}return p.Interval;case p.Duration:switch(e.unit){case x.SECOND:return p.DurationSecond;case x.MILLISECOND:return p.DurationMillisecond;case x.MICROSECOND:return p.DurationMicrosecond;case x.NANOSECOND:return p.DurationNanosecond}return p.Duration;case p.Map:return p.Map;case p.List:return p.List;case p.Struct:return p.Struct;case p.Union:switch(e.mode){case Et.Dense:return p.DenseUnion;case Et.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[e.typeId]}'`)}G.prototype.visitInt8=null,G.prototype.visitInt16=null,G.prototype.visitInt32=null,G.prototype.visitInt64=null,G.prototype.visitUint8=null,G.prototype.visitUint16=null,G.prototype.visitUint32=null,G.prototype.visitUint64=null,G.prototype.visitFloat16=null,G.prototype.visitFloat32=null,G.prototype.visitFloat64=null,G.prototype.visitDateDay=null,G.prototype.visitDateMillisecond=null,G.prototype.visitTimestampSecond=null,G.prototype.visitTimestampMillisecond=null,G.prototype.visitTimestampMicrosecond=null,G.prototype.visitTimestampNanosecond=null,G.prototype.visitTimeSecond=null,G.prototype.visitTimeMillisecond=null,G.prototype.visitTimeMicrosecond=null,G.prototype.visitTimeNanosecond=null,G.prototype.visitDenseUnion=null,G.prototype.visitSparseUnion=null,G.prototype.visitIntervalDayTime=null,G.prototype.visitIntervalYearMonth=null,G.prototype.visitDuration=null,G.prototype.visitDurationSecond=null,G.prototype.visitDurationMillisecond=null,G.prototype.visitDurationMicrosecond=null,G.prototype.visitDurationNanosecond=null;const fl=new Float64Array(1),pn=new Uint32Array(fl.buffer);function pl(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Jy(e){if(e!==e)return 32256;fl[0]=e;const t=(pn[1]&2147483648)>>16&65535;let n=pn[1]&2146435072,r=0;return n>=1089470464?pn[0]>0?n=31744:(n=(n&2080374784)>>16,r=(pn[1]&1048575)>>10):n<=1056964608?(r=1048576+(pn[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(pn[1]&1048575)+512>>10),t|n|r&65535}class C extends G{}function P(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Zy=(e,t,n)=>{e[t]=Math.floor(n/864e5)},yl=(e,t,n,r)=>{if(n+1<t.length){const i=ut(t[n]),s=ut(t[n+1]);e.set(r.subarray(0,s-i),i)}},tm=({offset:e,values:t},n,r)=>{const i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Ae=({values:e},t,n)=>{e[t]=n},us=({values:e},t,n)=>{e[t]=n},ml=({values:e},t,n)=>{e[t]=Jy(n)},em=(e,t,n)=>{switch(e.type.precision){case Tt.HALF:return ml(e,t,n);case Tt.SINGLE:case Tt.DOUBLE:return us(e,t,n)}},gl=({values:e},t,n)=>{Zy(e,t,n.valueOf())},bl=({values:e},t,n)=>{e[t]=BigInt(n)},nm=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},_l=({values:e,valueOffsets:t},n,r)=>yl(e,t,n,r),vl=({values:e,valueOffsets:t},n,r)=>yl(e,t,n,ts(r)),rm=(e,t,n)=>{e.type.unit===Yt.DAY?gl(e,t,n):bl(e,t,n)},wl=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},Il=({values:e},t,n)=>{e[t]=BigInt(n)},Sl=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},El=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},im=(e,t,n)=>{switch(e.type.unit){case x.SECOND:return wl(e,t,n);case x.MILLISECOND:return Il(e,t,n);case x.MICROSECOND:return Sl(e,t,n);case x.NANOSECOND:return El(e,t,n)}},Tl=({values:e},t,n)=>{e[t]=n},Al=({values:e},t,n)=>{e[t]=n},Nl=({values:e},t,n)=>{e[t]=n},Rl=({values:e},t,n)=>{e[t]=n},sm=(e,t,n)=>{switch(e.type.unit){case x.SECOND:return Tl(e,t,n);case x.MILLISECOND:return Al(e,t,n);case x.MICROSECOND:return Nl(e,t,n);case x.NANOSECOND:return Rl(e,t,n)}},om=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},am=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=Wt.getVisitFn(r);if(Array.isArray(n))for(let o=-1,a=i[t],l=i[t+1];a<l;)s(r,a++,n[++o]);else for(let o=-1,a=i[t],l=i[t+1];a<l;)s(r,a++,n.get(++o))},lm=(e,t,n)=>{const r=e.children[0],{valueOffsets:i}=e,s=Wt.getVisitFn(r);let{[t]:o,[t+1]:a}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const c of l)if(s(r,o,c),++o>=a)break},cm=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),um=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),hm=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),dm=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),fm=(e,t,n)=>{const r=e.type.children.map(s=>Wt.getVisitFn(s.type)),i=n instanceof Map?hm(t,n):n instanceof rt?um(t,n):Array.isArray(n)?cm(t,n):dm(t,n);e.type.children.forEach((s,o)=>i(r[o],e.children[o],s,o))},pm=(e,t,n)=>{e.type.mode===Et.Dense?Bl(e,t,n):Ol(e,t,n)},Bl=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Wt.visit(i,e.valueOffsets[t],n)},Ol=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Wt.visit(i,t,n)},ym=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},mm=(e,t,n)=>{e.type.unit===le.DAY_TIME?Dl(e,t,n):Ll(e,t,n)},Dl=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Ll=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Fl=({values:e},t,n)=>{e[t]=n},Ml=({values:e},t,n)=>{e[t]=n},Ul=({values:e},t,n)=>{e[t]=n},xl=({values:e},t,n)=>{e[t]=n},gm=(e,t,n)=>{switch(e.type.unit){case x.SECOND:return Fl(e,t,n);case x.MILLISECOND:return Ml(e,t,n);case x.MICROSECOND:return Ul(e,t,n);case x.NANOSECOND:return xl(e,t,n)}},bm=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=Wt.getVisitFn(i);if(Array.isArray(n))for(let o=-1,a=t*r;++o<r;)s(i,a+o,n[o]);else for(let o=-1,a=t*r;++o<r;)s(i,a+o,n.get(o))};C.prototype.visitBool=P(tm),C.prototype.visitInt=P(Ae),C.prototype.visitInt8=P(Ae),C.prototype.visitInt16=P(Ae),C.prototype.visitInt32=P(Ae),C.prototype.visitInt64=P(Ae),C.prototype.visitUint8=P(Ae),C.prototype.visitUint16=P(Ae),C.prototype.visitUint32=P(Ae),C.prototype.visitUint64=P(Ae),C.prototype.visitFloat=P(em),C.prototype.visitFloat16=P(ml),C.prototype.visitFloat32=P(us),C.prototype.visitFloat64=P(us),C.prototype.visitUtf8=P(vl),C.prototype.visitLargeUtf8=P(vl),C.prototype.visitBinary=P(_l),C.prototype.visitLargeBinary=P(_l),C.prototype.visitFixedSizeBinary=P(nm),C.prototype.visitDate=P(rm),C.prototype.visitDateDay=P(gl),C.prototype.visitDateMillisecond=P(bl),C.prototype.visitTimestamp=P(im),C.prototype.visitTimestampSecond=P(wl),C.prototype.visitTimestampMillisecond=P(Il),C.prototype.visitTimestampMicrosecond=P(Sl),C.prototype.visitTimestampNanosecond=P(El),C.prototype.visitTime=P(sm),C.prototype.visitTimeSecond=P(Tl),C.prototype.visitTimeMillisecond=P(Al),C.prototype.visitTimeMicrosecond=P(Nl),C.prototype.visitTimeNanosecond=P(Rl),C.prototype.visitDecimal=P(om),C.prototype.visitList=P(am),C.prototype.visitStruct=P(fm),C.prototype.visitUnion=P(pm),C.prototype.visitDenseUnion=P(Bl),C.prototype.visitSparseUnion=P(Ol),C.prototype.visitDictionary=P(ym),C.prototype.visitInterval=P(mm),C.prototype.visitIntervalDayTime=P(Dl),C.prototype.visitIntervalYearMonth=P(Ll),C.prototype.visitDuration=P(gm),C.prototype.visitDurationSecond=P(Fl),C.prototype.visitDurationMillisecond=P(Ml),C.prototype.visitDurationMicrosecond=P(Ul),C.prototype.visitDurationNanosecond=P(xl),C.prototype.visitFixedSizeList=P(bm),C.prototype.visitMap=P(lm);const Wt=new C,te=Symbol.for("parent"),yn=Symbol.for("rowIndex");class hs{constructor(t,n){return this[te]=t,this[yn]=n,new Proxy(this,new vm)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[yn],n=this[te],r=n.type.children,i={};for(let s=-1,o=r.length;++s<o;)i[r[s].name]=Ut.visit(n.children[s],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Yn(t)}: ${Yn(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new _m(this[te],this[yn])}}class _m{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,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,Ut.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(hs.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[te]:{writable:!0,enumerable:!1,configurable:!1,value:null},[yn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class vm{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[te].type.children.map(n=>n.name)}has(t,n){return t[te].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[te].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[te].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=Ut.visit(t[te].children[r],t[yn]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[te].type.children.findIndex(s=>s.name===n);return i!==-1?(Wt.visit(t[te].children[i],t[yn],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class L extends G{}function $(e){return(t,n)=>t.getValid(n)?e(t,n):null}const wm=(e,t)=>864e5*e[t],Im=(e,t)=>null,Cl=(e,t,n)=>{if(n+1>=t.length)return null;const r=ut(t[n]),i=ut(t[n+1]);return e.subarray(r,i)},Sm=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<<r%8)!==0},$l=({values:e},t)=>wm(e,t),kl=({values:e},t)=>ut(e[t]),xe=({stride:e,values:t},n)=>t[e*n],Em=({stride:e,values:t},n)=>pl(t[e*n]),Pl=({values:e},t)=>e[t],Tm=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),Vl=({values:e,valueOffsets:t},n)=>Cl(e,t,n),zl=({values:e,valueOffsets:t},n)=>{const r=Cl(e,t,n);return r!==null?Zi(r):null},Am=({values:e},t)=>e[t],Nm=({type:e,values:t},n)=>e.precision!==Tt.HALF?t[n]:pl(t[n]),Rm=(e,t)=>e.type.unit===Yt.DAY?$l(e,t):kl(e,t),Yl=({values:e},t)=>1e3*ut(e[t]),jl=({values:e},t)=>ut(e[t]),ql=({values:e},t)=>za(e[t],BigInt(1e3)),Gl=({values:e},t)=>za(e[t],BigInt(1e6)),Bm=(e,t)=>{switch(e.type.unit){case x.SECOND:return Yl(e,t);case x.MILLISECOND:return jl(e,t);case x.MICROSECOND:return ql(e,t);case x.NANOSECOND:return Gl(e,t)}},Wl=({values:e},t)=>e[t],Hl=({values:e},t)=>e[t],Kl=({values:e},t)=>e[t],Ql=({values:e},t)=>e[t],Om=(e,t)=>{switch(e.type.unit){case x.SECOND:return Wl(e,t);case x.MILLISECOND:return Hl(e,t);case x.MICROSECOND:return Kl(e,t);case x.NANOSECOND:return Ql(e,t)}},Dm=({values:e,stride:t},n)=>cs.decimal(e.subarray(t*n,t*(n+1))),Lm=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:o}=n,a=i[0].slice(s,o-s);return new rt([a])},Fm=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,o=r[0];return new fs(o.slice(i,s-i))},Mm=(e,t)=>new hs(e,t),Um=(e,t)=>e.type.mode===Et.Dense?Xl(e,t):Jl(e,t),Xl=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ut.visit(r,e.valueOffsets[t])},Jl=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ut.visit(r,t)},xm=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},Cm=(e,t)=>e.type.unit===le.DAY_TIME?Zl(e,t):tc(e,t),Zl=({values:e},t)=>e.subarray(2*t,2*(t+1)),tc=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},ec=({values:e},t)=>e[t],nc=({values:e},t)=>e[t],rc=({values:e},t)=>e[t],ic=({values:e},t)=>e[t],$m=(e,t)=>{switch(e.type.unit){case x.SECOND:return ec(e,t);case x.MILLISECOND:return nc(e,t);case x.MICROSECOND:return rc(e,t);case x.NANOSECOND:return ic(e,t)}},km=(e,t)=>{const{stride:n,children:r}=e,i=r[0].slice(t*n,n);return new rt([i])};L.prototype.visitNull=$(Im),L.prototype.visitBool=$(Sm),L.prototype.visitInt=$(Am),L.prototype.visitInt8=$(xe),L.prototype.visitInt16=$(xe),L.prototype.visitInt32=$(xe),L.prototype.visitInt64=$(Pl),L.prototype.visitUint8=$(xe),L.prototype.visitUint16=$(xe),L.prototype.visitUint32=$(xe),L.prototype.visitUint64=$(Pl),L.prototype.visitFloat=$(Nm),L.prototype.visitFloat16=$(Em),L.prototype.visitFloat32=$(xe),L.prototype.visitFloat64=$(xe),L.prototype.visitUtf8=$(zl),L.prototype.visitLargeUtf8=$(zl),L.prototype.visitBinary=$(Vl),L.prototype.visitLargeBinary=$(Vl),L.prototype.visitFixedSizeBinary=$(Tm),L.prototype.visitDate=$(Rm),L.prototype.visitDateDay=$($l),L.prototype.visitDateMillisecond=$(kl),L.prototype.visitTimestamp=$(Bm),L.prototype.visitTimestampSecond=$(Yl),L.prototype.visitTimestampMillisecond=$(jl),L.prototype.visitTimestampMicrosecond=$(ql),L.prototype.visitTimestampNanosecond=$(Gl),L.prototype.visitTime=$(Om),L.prototype.visitTimeSecond=$(Wl),L.prototype.visitTimeMillisecond=$(Hl),L.prototype.visitTimeMicrosecond=$(Kl),L.prototype.visitTimeNanosecond=$(Ql),L.prototype.visitDecimal=$(Dm),L.prototype.visitList=$(Lm),L.prototype.visitStruct=$(Mm),L.prototype.visitUnion=$(Um),L.prototype.visitDenseUnion=$(Xl),L.prototype.visitSparseUnion=$(Jl),L.prototype.visitDictionary=$(xm),L.prototype.visitInterval=$(Cm),L.prototype.visitIntervalDayTime=$(Zl),L.prototype.visitIntervalYearMonth=$(tc),L.prototype.visitDuration=$($m),L.prototype.visitDurationSecond=$(ec),L.prototype.visitDurationMillisecond=$(nc),L.prototype.visitDurationMicrosecond=$(rc),L.prototype.visitDurationNanosecond=$(ic),L.prototype.visitFixedSizeList=$(km),L.prototype.visitMap=$(Fm);const Ut=new L,mn=Symbol.for("keys"),gn=Symbol.for("vals"),bn=Symbol.for("kKeysAsStrings"),ds=Symbol.for("_kKeysAsStrings");class fs{constructor(t){return this[mn]=new rt([t.children[0]]).memoize(),this[gn]=t.children[1],new Proxy(this,new Vm)}get[bn](){return this[ds]||(this[ds]=Array.from(this[mn].toArray(),String))}[Symbol.iterator](){return new Pm(this[mn],this[gn])}get size(){return this[mn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[mn],n=this[gn],r={};for(let i=-1,s=t.length;++i<s;)r[t.get(i)]=Ut.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Yn(t)}: ${Yn(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Pm{constructor(t,n){this.keys=t,this.vals=n,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),Ut.visit(this.vals,t)]})}}class Vm{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[bn]}has(t,n){return t[bn].includes(n)}getOwnPropertyDescriptor(t,n){if(t[bn].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[bn].indexOf(n);if(r!==-1){const i=Ut.visit(Reflect.get(t,gn),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[bn].indexOf(n);return i!==-1?(Wt.visit(Reflect.get(t,gn),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(fs.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[mn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[gn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ds]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let sc;function oc(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,o=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(sc=s,s=o,o=sc),o>i&&(o=i),r?r(e,s,o):[s,o]}const ps=(e,t)=>e<0?t+e:e,ac=e=>e!==e;function _n(e){if(typeof e!="object"||e===null)return ac(e)?ac:t=>t===e;if(e instanceof Date){const t=e.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?ky(e,t):!1:e instanceof Map?Ym(e):Array.isArray(e)?zm(e):e instanceof rt?jm(e):qm(e,!0)}function zm(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=_n(e[n]);return li(t)}function Ym(e){let t=-1;const n=[];for(const r of e.values())n[++t]=_n(r);return li(n)}function jm(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=_n(e.get(n));return li(t)}function qm(e,t=!1){const n=Object.keys(e);if(!t&&n.length===0)return()=>!1;const r=[];for(let i=-1,s=n.length;++i<s;)r[i]=_n(e[n[i]]);return li(r,n)}function li(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return Gm(e,n);case Map:return lc(e,n,n.keys());case fs:case hs:case Object:case void 0:return lc(e,n,t||Object.keys(n))}return n instanceof rt?Wm(e,n):!1}}function Gm(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Wm(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function lc(e,t,n){const r=n[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 a=e.length;let l=s.next(),c=r.next(),u=i.next();for(;o<a&&!c.done&&!u.done&&!l.done&&!(c.value!==u.value||!e[o](l.value));++o,c=r.next(),u=i.next(),l=s.next());return o===a&&c.done&&u.done&&l.done?!0:(r.return&&r.return(),i.return&&i.return(),s.return&&s.return(),!1)}function cc(e,t,n,r){return(n&1<<r)!==0}function Hm(e,t,n,r){return(n&1<<r)>>r}function ci(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength<r){const i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):ui(new ys(n,e,t,null,cc)).subarray(0,r)),i}return n}function ui(e){const t=[];let n=0,r=0,i=0;for(const o of e)o&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class ys{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>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 ms(e,t,n){if(n-t<=0)return 0;if(n-t<8){let s=0;for(const o of new ys(e,t,n-t,e,Hm))s+=o;return s}const r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return ms(e,t,i)+ms(e,r,n)+Km(e,i>>3,r-i>>3)}function Km(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=gs(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=gs(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=gs(s.getUint8(i)),i+=1;return r}function gs(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Qm=-1;class ot{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return O.isSparseUnion(t)?this.children.some(n=>n.nullable):O.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(O.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=Qm&&(n=this.nullBitmap)&&(this._nullCount=t=n.length===0?0:this.length-ms(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof ot?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Te(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:n}=this;if(O.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===Et.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r;const{type:i}=this;if(O.isUnion(i)){const s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===Et.Dense?this.valueOffsets[t]:t;r=o.getValid(a),o.setValid(a,n)}else{let{nullBitmap:s}=this;const{offset:o,length:a}=this,l=o+t,c=1<<l%8,u=l>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(ci(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const h=s[u];r=(h&c)!==0,s[u]=n?h|c:h&~c}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new ot(t,n,r,i,s,o,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,l=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===p.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(ci(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[Ee.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:o}=this;return(s=o[Ee.TYPE])&&(o[Ee.TYPE]=s.subarray(t,t+n)),(s=o[Ee.OFFSET])&&(o[Ee.OFFSET]=s.subarray(t,t+n+1))||(s=o[Ee.DATA])&&(o[Ee.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),o}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}ot.prototype.children=Object.freeze([]);class Wn extends G{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new ot(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.data),s=J(t.nullBitmap),o=zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[o,i,s])}visitLargeUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.data),s=J(t.nullBitmap),o=Na(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[o,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.data),s=J(t.nullBitmap),o=zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[o,i,s])}visitLargeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.data),s=J(t.nullBitmap),o=Na(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=J(t.nullBitmap),o=zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[o,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=J(t.nullBitmap),{length:o=i.reduce((l,{length:c})=>Math.max(l,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=ct(n.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(O.isSparseUnion(n))return new ot(n,r,o,a,[void 0,void 0,void 0,s],i);const l=zn(t.valueOffsets);return new ot(n,r,o,a,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.indices.ArrayType,t.data),{["dictionary"]:o=new rt([new Wn().visit({type:n.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=J(t.nullBitmap),s=ct(n.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Wn().visit({type:n.valueType})}=t,s=J(t.nullBitmap),{["length"]:o=i.length/Te(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(n,r,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Wn().visit({type:n.childType})}=t,s=J(t.nullBitmap),o=zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(n,r,a,l,[o,void 0,s],[i])}}const Xm=new Wn;function K(e){return Xm.visit(e)}class uc{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,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 Jm(e){return e.some(t=>t.nullable)}function hc(e){return e.reduce((t,n)=>t+n.nullCount,0)}function dc(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function fc(e,t,n,r){const i=[];for(let s=-1,o=e.length;++s<o;){const a=e[s],l=t[s],{length:c}=a;if(l>=r)break;if(n>=l+c)continue;if(l>=n&&l+c<=r){i.push(a);continue}const u=Math.max(0,n-l),h=Math.min(r-l,c);i.push(a.slice(u,h-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function bs(e,t,n,r){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;s=i+Math.trunc((o-i)*.5),n<t[s]?o=s:i=s}while(i<o)}function _s(e,t){return e.getValid(t)}function hi(e){function t(n,r,i){return e(n[r],i)}return function(n){const r=this.data;return bs(r,this._offsets,n,t)}}function pc(e){let t;function n(r,i,s){return e(r[i],s,t)}return function(r,i){const s=this.data;t=i;const o=bs(s,this._offsets,r,n);return t=void 0,o}}function yc(e){let t;function n(r,i,s){let o=s,a=0,l=0;for(let c=i-1,u=r.length;++c<u;){const h=r[c];if(~(a=e(h,t,o)))return l+a;o=0,l+=h.length}return-1}return function(r,i){t=r;const s=this.data,o=typeof i!="number"?n(s,0,0):bs(s,this._offsets,i,n);return t=void 0,o}}class F extends G{}function Zm(e,t){return t===null&&e.length>0?0:-1}function tg(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new ys(n,e.offset+(t||0),e.length,n,cc)){if(!i)return r;++r}return-1}function V(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case p.Union:break;case p.Dictionary:break;default:return tg(e,n)}const r=Ut.getVisitFn(e),i=_n(t);for(let s=(n||0)-1,o=e.length;++s<o;)if(i(r(e,s)))return s;return-1}function mc(e,t,n){const r=Ut.getVisitFn(e),i=_n(t);for(let s=(n||0)-1,o=e.length;++s<o;)if(i(r(e,s)))return s;return-1}F.prototype.visitNull=Zm,F.prototype.visitBool=V,F.prototype.visitInt=V,F.prototype.visitInt8=V,F.prototype.visitInt16=V,F.prototype.visitInt32=V,F.prototype.visitInt64=V,F.prototype.visitUint8=V,F.prototype.visitUint16=V,F.prototype.visitUint32=V,F.prototype.visitUint64=V,F.prototype.visitFloat=V,F.prototype.visitFloat16=V,F.prototype.visitFloat32=V,F.prototype.visitFloat64=V,F.prototype.visitUtf8=V,F.prototype.visitLargeUtf8=V,F.prototype.visitBinary=V,F.prototype.visitLargeBinary=V,F.prototype.visitFixedSizeBinary=V,F.prototype.visitDate=V,F.prototype.visitDateDay=V,F.prototype.visitDateMillisecond=V,F.prototype.visitTimestamp=V,F.prototype.visitTimestampSecond=V,F.prototype.visitTimestampMillisecond=V,F.prototype.visitTimestampMicrosecond=V,F.prototype.visitTimestampNanosecond=V,F.prototype.visitTime=V,F.prototype.visitTimeSecond=V,F.prototype.visitTimeMillisecond=V,F.prototype.visitTimeMicrosecond=V,F.prototype.visitTimeNanosecond=V,F.prototype.visitDecimal=V,F.prototype.visitList=V,F.prototype.visitStruct=V,F.prototype.visitUnion=V,F.prototype.visitDenseUnion=mc,F.prototype.visitSparseUnion=mc,F.prototype.visitDictionary=V,F.prototype.visitInterval=V,F.prototype.visitIntervalDayTime=V,F.prototype.visitIntervalYearMonth=V,F.prototype.visitDuration=V,F.prototype.visitDurationSecond=V,F.prototype.visitDurationMillisecond=V,F.prototype.visitDurationMicrosecond=V,F.prototype.visitDurationNanosecond=V,F.prototype.visitFixedSizeList=V,F.prototype.visitMap=V;const di=new F;class M extends G{}function k(e){const{type:t}=e;if(e.nullCount===0&&e.stride===1&&(O.isInt(t)&&t.bitWidth!==64||O.isTime(t)&&t.bitWidth!==64||O.isFloat(t)&&t.precision!==Tt.HALF))return new uc(e.data.length,r=>{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new uc(e.data.length,r=>{const i=e.data[r].length,s=e.slice(n,n+i);return n+=i,new eg(s)})}class eg{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}}M.prototype.visitNull=k,M.prototype.visitBool=k,M.prototype.visitInt=k,M.prototype.visitInt8=k,M.prototype.visitInt16=k,M.prototype.visitInt32=k,M.prototype.visitInt64=k,M.prototype.visitUint8=k,M.prototype.visitUint16=k,M.prototype.visitUint32=k,M.prototype.visitUint64=k,M.prototype.visitFloat=k,M.prototype.visitFloat16=k,M.prototype.visitFloat32=k,M.prototype.visitFloat64=k,M.prototype.visitUtf8=k,M.prototype.visitLargeUtf8=k,M.prototype.visitBinary=k,M.prototype.visitLargeBinary=k,M.prototype.visitFixedSizeBinary=k,M.prototype.visitDate=k,M.prototype.visitDateDay=k,M.prototype.visitDateMillisecond=k,M.prototype.visitTimestamp=k,M.prototype.visitTimestampSecond=k,M.prototype.visitTimestampMillisecond=k,M.prototype.visitTimestampMicrosecond=k,M.prototype.visitTimestampNanosecond=k,M.prototype.visitTime=k,M.prototype.visitTimeSecond=k,M.prototype.visitTimeMillisecond=k,M.prototype.visitTimeMicrosecond=k,M.prototype.visitTimeNanosecond=k,M.prototype.visitDecimal=k,M.prototype.visitList=k,M.prototype.visitStruct=k,M.prototype.visitUnion=k,M.prototype.visitDenseUnion=k,M.prototype.visitSparseUnion=k,M.prototype.visitDictionary=k,M.prototype.visitInterval=k,M.prototype.visitIntervalDayTime=k,M.prototype.visitIntervalYearMonth=k,M.prototype.visitDuration=k,M.prototype.visitDurationSecond=k,M.prototype.visitDurationMillisecond=k,M.prototype.visitDurationMicrosecond=k,M.prototype.visitDurationNanosecond=k,M.prototype.visitFixedSizeList=k,M.prototype.visitMap=k;const vs=new M;var gc;const bc={},_c={};class rt{constructor(t){var n,r,i;const s=t[0]instanceof rt?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof ot)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:c}=bc[o.typeId],u=s[0];this.isValid=h=>_s(u,h),this.get=h=>a(u,h),this.set=(h,y)=>l(u,h,y),this.indexOf=h=>c(u,h),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,_c[o.typeId]),this._offsets=dc(s);break}this.data=s,this.type=o,this.stride=Te(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.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullable(){return Jm(this.data)}get nullCount(){return hc(this.data)}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}at(t){return this.get(ps(t,this.length))}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}[Symbol.iterator](){return vs.visit(this)}concat(...t){return new rt(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new rt(oc(this,t,n,({data:r,_offsets:i},s,o)=>fc(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,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(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new rt(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return O.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(O.isDictionary(this.type)){const t=new fi(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new rt(n)}return new fi(this)}unmemoize(){if(O.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new rt(n)}return this}}gc=Symbol.toStringTag,rt[gc]=(e=>{e.type=O.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(p).map(n=>p[n]).filter(n=>typeof n=="number"&&n!==p.NONE);for(const n of t){const r=Ut.getVisitFnByTypeId(n),i=Wt.getVisitFnByTypeId(n),s=di.getVisitFnByTypeId(n);bc[n]={get:r,set:i,indexOf:s},_c[n]=Object.create(e,{isValid:{value:hi(_s)},get:{value:hi(Ut.getVisitFnByTypeId(n))},set:{value:pc(Wt.getVisitFnByTypeId(n))},indexOf:{value:yc(di.getVisitFnByTypeId(n))}})}return"Vector"})(rt.prototype);class fi extends rt{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=n.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new fi(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new rt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ws{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}}class Pt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+nt),(n||new Pt).__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):gt.V1}schema(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new de).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new ws).__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,n){const r=this.bb.__offset(this.bb_pos,10);return r?(n||new ws).__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,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||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,n){t.addFieldInt16(0,n,gt.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}}class it{constructor(t=[],n,r,i=gt.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=Is(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){const n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new it(r,this.metadata)}selectAt(t){const n=t.map(r=>this.fields[r]).filter(Boolean);return new it(n,this.metadata)}assign(...t){const n=t[0]instanceof it?t[0]:Array.isArray(t[0])?new it(t[0]):new it(t),r=[...this.fields],i=pi(pi(new Map,this.metadata),n.metadata),s=n.fields.filter(a=>{const l=r.findIndex(c=>c.name===a.name);return~l?(r[l]=a.clone({metadata:pi(pi(new Map,r[l].metadata),a.metadata)}))&&!1:!0}),o=Is(s,new Map);return new it([...r,...s],i,new Map([...this.dictionaries,...o]))}}it.prototype.fields=null,it.prototype.metadata=null,it.prototype.dictionaries=null;class ft{static new(...t){let[n,r,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new ft(`${n}`,r,i,s)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,s]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,s=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],ft.new(n,r,i,s)}}ft.prototype.type=null,ft.prototype.name=null,ft.prototype.nullable=null,ft.prototype.metadata=null;function pi(e,t){return new Map([...e||new Map,...t||new Map])}function Is(e,t=new Map){for(let n=-1,r=e.length;++n<r;){const i=e[n].type;if(O.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&Is(i.children,t)}return t}var ng=La,rg=on;class Hn{static decode(t){t=new rg(J(t));const n=Pt.getRootAsFooter(t),r=it.decode(n.schema(),new Map,n.version());return new ig(r,n)}static encode(t){const n=new ng,r=it.encode(n,t.schema);Pt.startRecordBatchesVector(n,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())Ce.encode(n,o);const i=n.endVector();Pt.startDictionariesVector(n,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())Ce.encode(n,o);const s=n.endVector();return Pt.startFooter(n),Pt.addSchema(n,r),Pt.addVersion(n,gt.V5),Pt.addRecordBatches(n,i),Pt.addDictionaries(n,s),Pt.finishFooterBuffer(n,Pt.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=gt.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(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 ig extends Hn{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const n=this._footer.recordBatches(t);if(n)return Ce.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const n=this._footer.dictionaries(t);if(n)return Ce.decode(n)}return null}}class Ce{static decode(t){return new Ce(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){const{metaDataLength:r}=n,i=BigInt(n.offset),s=BigInt(n.bodyLength);return ws.createBlock(t,i,r,s)}constructor(t,n,r){this.metaDataLength=t,this.offset=ut(r),this.bodyLength=ut(n)}}const wt=Object.freeze({done:!0,value:void 0});class vc{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class Ss{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class sg extends Ss{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return z(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(wt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return zt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return zt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return z(this,void 0,void 0,function*(){return yield this.abort(t),wt})}return(t){return z(this,void 0,void 0,function*(){return yield this.close(),wt})}read(t){return z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return z(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((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(wt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class yi extends sg{write(t){if((t=J(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Zi(this.toUint8Array(!0)):this.toUint8Array(!1).then(Zi)}toUint8Array(t=!1){return t?ae(this._values)[0]:z(this,void 0,void 0,function*(){var n,r,i,s;const o=[];let a=0;try{for(var l=!0,c=Ke(this),u;u=yield c.next(),n=u.done,!n;l=!0){s=u.value,l=!1;const h=s;o.push(h),a+=h.byteLength}}catch(h){r={error:h}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return ae(o,a)[0]})}}class mi{constructor(t){t&&(this.source=new og(zt.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 vn{constructor(t){t instanceof vn?this.source=t.source:t instanceof yi?this.source=new Ze(zt.fromAsyncIterable(t)):Ta(t)?this.source=new Ze(zt.fromNodeStream(t)):ns(t)?this.source=new Ze(zt.fromDOMStream(t)):Ea(t)?this.source=new Ze(zt.fromDOMStream(t.body)):Vn(t)?this.source=new Ze(zt.fromIterable(t)):Qe(t)?this.source=new Ze(zt.fromAsyncIterable(t)):sn(t)&&(this.source=new Ze(zt.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 og{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,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||wt)}return(t){return Object.create(this.source.return&&this.source.return(t)||wt)}}class Ze{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return z(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return z(this,arguments,void 0,function*(n,r="read"){return yield this.source.next({cmd:r,size:n})})}throw(t){return z(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return z(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class wc extends mi{constructor(t,n){super(),this.position=0,this.buffer=J(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){const{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){const r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}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 gi extends vn{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return z(this,void 0,void 0,function*(){const{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return z(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 z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0;const l=Math.min(r,s+Math.min(r-s,t)),c=new Uint8Array(Math.max(0,(this.position=l)-s));for(;(s+=a)<l&&(o+=a)<c.byteLength;)({bytesRead:a}=yield n.read(c,o,c.byteLength-o,s));return c}return null})}readAt(t,n){return z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:r,size:i}=this;if(r&&t+n<i){const s=Math.min(i,t+n),o=new Uint8Array(s-t);return(yield r.read(o,0,n,t)).buffer}return new Uint8Array(n)})}close(){return z(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const ag=65536;function wn(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const In=8,Es=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Ic{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const n=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=n[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=n[2]*r[3],s+=i,i=n[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?ag:0,this.buffer[1]+=s>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){const n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}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`${wn(this.buffer[1])} ${wn(this.buffer[0])}`}}class at extends Ic{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return at.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return at.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.length,i=new at(n);for(let s=0;s<r;){const o=In<r-s?In:r-s,a=new at(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),l=new at(new Uint32Array([Es[o],0]));i.times(l),i.plus(a),s+=o}return i}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)at.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new at(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new at(new Uint32Array(t.buffer)).plus(n)}}class Ht extends Ic{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 n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return Ht.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return Ht.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.startsWith("-"),i=t.length,s=new Ht(n);for(let o=r?1:0;o<i;){const a=In<i-o?In:i-o,l=new Ht(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),c=new Ht(new Uint32Array([Es[a],0]));s.times(c),s.plus(l),o+=a}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)Ht.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new Ht(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new Ht(new Uint32Array(t.buffer)).plus(n)}}class fe{constructor(t){this.buffer=t}high(){return new Ht(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ht(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){const n=new at(new Uint32Array([this.buffer[3],0])),r=new at(new Uint32Array([this.buffer[2],0])),i=new at(new Uint32Array([this.buffer[1],0])),s=new at(new Uint32Array([this.buffer[0],0])),o=new at(new Uint32Array([t.buffer[3],0])),a=new at(new Uint32Array([t.buffer[2],0])),l=new at(new Uint32Array([t.buffer[1],0])),c=new at(new Uint32Array([t.buffer[0],0]));let u=at.multiply(s,c);this.buffer[0]=u.low();const h=new at(new Uint32Array([u.high(),0]));return u=at.multiply(i,c),h.plus(u),u=at.multiply(s,l),h.plus(u),this.buffer[1]=h.low(),this.buffer[3]=h.lessThan(u)?1:0,this.buffer[2]=h.high(),new at(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(at.multiply(r,c)).plus(at.multiply(i,l)).plus(at.multiply(s,a)),this.buffer[3]+=at.multiply(n,c).plus(at.multiply(r,l)).plus(at.multiply(i,a)).plus(at.multiply(s,o)).low(),this}plus(t){const n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${wn(this.buffer[3])} ${wn(this.buffer[2])} ${wn(this.buffer[1])} ${wn(this.buffer[0])}`}static multiply(t,n){return new fe(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new fe(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return fe.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return fe.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,s=new fe(n);for(let o=r?1:0;o<i;){const a=In<i-o?In:i-o,l=new fe(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),c=new fe(new Uint32Array([Es[a],0,0,0]));s.times(c),s.plus(l),o+=a}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)fe.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}}class Sc extends G{constructor(t,n,r,i,s=gt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof ft?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return K({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<gt.V5&&this.readNullBitmap(t,r),t.mode===Et.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return K({type:t,length:n,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,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}}class lg extends Sc{constructor(t,n,r,i,s){super(new Uint8Array(0),n,r,i,s),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):ui(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return ct(Uint8Array,ct(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return ct(Uint8Array,ct(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return O.isTimestamp(t)||(O.isInt(t)||O.isTime(t))&&t.bitWidth===64||O.isDuration(t)||O.isDate(t)&&t.unit===Yt.MILLISECOND?ct(Uint8Array,Ht.convertArray(r[n])):O.isDecimal(t)?ct(Uint8Array,fe.convertArray(r[n])):O.isBinary(t)||O.isLargeBinary(t)||O.isFixedSizeBinary(t)?cg(r[n]):O.isBool(t)?ui(r[n]):O.isUtf8(t)||O.isLargeUtf8(t)?ts(r[n].join("")):ct(Uint8Array,ct(t.ArrayType,r[n].map(i=>+i)))}}function cg(e){const t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}class U extends G{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}}function Bt(e,t){return t instanceof e.constructor}function tn(e,t){return e===t||Bt(e,t)}function Ne(e,t){return e===t||Bt(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function bi(e,t){return e===t||Bt(e,t)&&e.precision===t.precision}function ug(e,t){return e===t||Bt(e,t)&&e.byteWidth===t.byteWidth}function Ts(e,t){return e===t||Bt(e,t)&&e.unit===t.unit}function Kn(e,t){return e===t||Bt(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Qn(e,t){return e===t||Bt(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function hg(e,t){return e===t||Bt(e,t)&&e.children.length===t.children.length&&$e.compareManyFields(e.children,t.children)}function dg(e,t){return e===t||Bt(e,t)&&e.children.length===t.children.length&&$e.compareManyFields(e.children,t.children)}function As(e,t){return e===t||Bt(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&$e.compareManyFields(e.children,t.children)}function fg(e,t){return e===t||Bt(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&$e.visit(e.indices,t.indices)&&$e.visit(e.dictionary,t.dictionary)}function Ns(e,t){return e===t||Bt(e,t)&&e.unit===t.unit}function Xn(e,t){return e===t||Bt(e,t)&&e.unit===t.unit}function pg(e,t){return e===t||Bt(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&$e.compareManyFields(e.children,t.children)}function yg(e,t){return e===t||Bt(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&$e.compareManyFields(e.children,t.children)}U.prototype.visitNull=tn,U.prototype.visitBool=tn,U.prototype.visitInt=Ne,U.prototype.visitInt8=Ne,U.prototype.visitInt16=Ne,U.prototype.visitInt32=Ne,U.prototype.visitInt64=Ne,U.prototype.visitUint8=Ne,U.prototype.visitUint16=Ne,U.prototype.visitUint32=Ne,U.prototype.visitUint64=Ne,U.prototype.visitFloat=bi,U.prototype.visitFloat16=bi,U.prototype.visitFloat32=bi,U.prototype.visitFloat64=bi,U.prototype.visitUtf8=tn,U.prototype.visitLargeUtf8=tn,U.prototype.visitBinary=tn,U.prototype.visitLargeBinary=tn,U.prototype.visitFixedSizeBinary=ug,U.prototype.visitDate=Ts,U.prototype.visitDateDay=Ts,U.prototype.visitDateMillisecond=Ts,U.prototype.visitTimestamp=Kn,U.prototype.visitTimestampSecond=Kn,U.prototype.visitTimestampMillisecond=Kn,U.prototype.visitTimestampMicrosecond=Kn,U.prototype.visitTimestampNanosecond=Kn,U.prototype.visitTime=Qn,U.prototype.visitTimeSecond=Qn,U.prototype.visitTimeMillisecond=Qn,U.prototype.visitTimeMicrosecond=Qn,U.prototype.visitTimeNanosecond=Qn,U.prototype.visitDecimal=tn,U.prototype.visitList=hg,U.prototype.visitStruct=dg,U.prototype.visitUnion=As,U.prototype.visitDenseUnion=As,U.prototype.visitSparseUnion=As,U.prototype.visitDictionary=fg,U.prototype.visitInterval=Ns,U.prototype.visitIntervalDayTime=Ns,U.prototype.visitIntervalYearMonth=Ns,U.prototype.visitDuration=Xn,U.prototype.visitDurationSecond=Xn,U.prototype.visitDurationMillisecond=Xn,U.prototype.visitDurationMicrosecond=Xn,U.prototype.visitDurationNanosecond=Xn,U.prototype.visitFixedSizeList=pg,U.prototype.visitMap=yg;const $e=new U;function Rs(e,t){return $e.compareSchemas(e,t)}function Bs(e,t){return mg(e,t.map(n=>n.data.concat()))}function mg(e,t){const n=[...e.fields],r=[],i={numBatches:t.reduce((h,y)=>Math.max(h,y.length),0)};let s=0,o=0,a=-1;const l=t.length;let c,u=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<l;)u[a]=c=t[a].shift(),o=Math.min(o,c?c.length:o);Number.isFinite(o)&&(u=gg(n,o,u,t,i),o>0&&(r[s++]=K({type:new Rt(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(h=>new xt(e,h))]}function gg(e,t,n,r,i){var s;const o=(t+63&-64)>>3;for(let a=-1,l=r.length;++a<l;){const c=n[a],u=c?.length;if(u>=t)u===t?n[a]=c:(n[a]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(c.slice(t,u-t))));else{const h=e[a];e[a]=h.clone({nullable:!0}),n[a]=(s=c?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:K({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return n}var Ec;class Ot{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new it([]),this._offsets=[0],this;let i,s;t[0]instanceof it&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const o=l=>{if(l){if(l instanceof xt)return[l];if(l instanceof Ot)return l.batches;if(l instanceof ot){if(l.type instanceof Rt)return[new xt(new it(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(c=>o(c));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(c=>o(c));if(typeof l=="object"){const c=Object.keys(l),u=c.map(g=>new rt([l[g]])),h=i??new it(c.map((g,w)=>new ft(String(g),u[w].type,u[w].nullable))),[,y]=Bs(h,u);return y.length===0?[new xt(l)]:y}}}return[]},a=t.flatMap(l=>o(l));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new it([]),!(i instanceof it))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof xt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Rs(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??dc(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,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=hc(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ps(t,this.numRows))}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?vs.visit(new rt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
67
63
|
${this.toArray().join(`,
|
|
68
64
|
`)}
|
|
69
|
-
]`}concat(...t){const n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new $t(n,r.map(i=>new Vt(n,i)))}slice(t,n){const r=this.schema;[t,n]=Ef({length:this.numRows},t,n);const i=Bf(this.data,this._offsets,t,n);return new $t(r,i.map(s=>new Vt(r,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const n=this.data.map(r=>r.children[t]);if(n.length===0){const{type:r}=this.schema.fields[t],i=nt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new dt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new dt([nt({type:new Ze,length:this.numRows})]));const s=r.fields.slice(),o=s[t].clone({type:n.type}),a=this.schema.fields.map((l,c)=>this.getChildAt(c));[s[t],a[t]]=[o,n],[r,i]=_a(r,a)}return new $t(r,i)}select(t){const n=this.schema.fields.reduce((r,i,s)=>r.set(i.name,s),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){const n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new $t(n,r)}assign(t){const n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,l,c)=>{const[d,f]=a,h=n.findIndex(y=>y.name===l.name);return~h?f[h]=c:d.push(c),a},[[],[]]),s=this.schema.assign(t.schema),o=[...n.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new $t(..._a(s,o))}}Vf=Symbol.toStringTag,$t[Vf]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=bs(ca),e.get=bs(kt.getVisitFn(g.Struct)),e.set=Df(ee.getVisitFn(g.Struct)),e.indexOf=Ff(_s.getVisitFn(g.Struct)),"Table"))($t.prototype);var zf;let Vt=class ti{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof ft))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=nt({nullCount:0,type:new Dt(this.schema.fields),children:this.schema.fields.map(n=>nt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof pt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=jf(this.schema,this.data.children);break}case 1:{const[n]=t,{fields:r,children:i,length:s}=Object.keys(n).reduce((l,c,d)=>(l.children[d]=n[c],l.length=Math.max(l.length,n[c].length),l.fields[d]=_t.new({name:c,type:n[c].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new ft(r),a=nt({type:new Dt(r),length:s,children:i,nullCount:0});[this.schema,this.data]=jf(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Yf(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 kt.visit(this.data,t)}at(t){return this.get(ia(t,this.numRows))}set(t,n){return ee.visit(this.data,t,n)}indexOf(t,n){return _s.visit(this.data,t,n)}[Symbol.iterator](){return ua.visit(new dt([this.data]))}toArray(){return[...this]}concat(...t){return new $t(this.schema,[this,...t])}slice(t,n){const[r]=new dt([this.data]).slice(t,n).data;return new ti(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new dt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new dt([nt({type:new Ze,length:this.numRows})]));const s=r.fields.slice(),o=i.children.slice(),a=s[t].clone({type:n.type});[s[t],o[t]]=[a,n.data[0]],r=new ft(s,new Map(this.schema.metadata)),i=nt({type:new Dt(s),children:o})}return new ti(r,i)}select(t){const n=this.schema.select(t),r=new Dt(n.fields),i=[];for(const s of t){const o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new ti(n,nt({type:r,length:this.numRows,children:i}))}selectAt(t){const n=this.schema.selectAt(t),r=t.map(s=>this.data.children[s]).filter(Boolean),i=nt({type:new Dt(n.fields),length:this.numRows,children:r});return new ti(n,i)}};zf=Symbol.toStringTag,Vt[zf]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Vt.prototype);function jf(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...e.fields],s=[...t],o=(n+63&-64)>>3;for(const[a,l]of e.fields.entries()){const c=t[a];(!c||c.length!==n)&&(i[a]=l.clone({nullable:!0}),s[a]=(r=c?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:nt({type:l.type,length:n,nullCount:n,nullBitmap:new Uint8Array(o)}))}return[e.assign(i),nt({type:new Dt(i),length:n,children:s})]}function Yf(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let s=-1,o=e.length;++s<o;){const{type:a}=e[s],l=t[s];for(const c of[l,...((i=l?.dictionary)===null||i===void 0?void 0:i.data)||[]])Yf(a.children,c?.children,n);if(M.isDictionary(a)){const{id:c}=a;if(!n.has(c))l?.dictionary&&n.set(c,l.dictionary);else if(n.get(c)!==l.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}class va extends Vt{constructor(t){const n=t.fields.map(i=>nt({type:i.type})),r=nt({type:new Dt(t.fields),nullCount:0,children:n});super(t,r)}}let rn=class Re{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new Re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+ut),(n||new Re).__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):Et.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}header(t){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new Tt).__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,n){t.addFieldInt16(0,n,Et.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,lt.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,s,o){return Re.startMessage(t),Re.addVersion(t,n),Re.addHeaderType(t,r),Re.addHeader(t,i),Re.addBodyLength(t,s),Re.addCustomMetadata(t,o),Re.endMessage(t)}};class mE extends et{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return nd.startNull(n),nd.endNull(n)}visitInt(t,n){return jt.startInt(n),jt.addBitWidth(n,t.bitWidth),jt.addIsSigned(n,t.isSigned),jt.endInt(n)}visitFloat(t,n){return we.startFloatingPoint(n),we.addPrecision(n,t.precision),we.endFloatingPoint(n)}visitBinary(t,n){return Ju.startBinary(n),Ju.endBinary(n)}visitLargeBinary(t,n){return Zu.startLargeBinary(n),Zu.endLargeBinary(n)}visitBool(t,n){return Xu.startBool(n),Xu.endBool(n)}visitUtf8(t,n){return rd.startUtf8(n),rd.endUtf8(n)}visitLargeUtf8(t,n){return td.startLargeUtf8(n),td.endLargeUtf8(n)}visitDecimal(t,n){return Yn.startDecimal(n),Yn.addScale(n,t.scale),Yn.addPrecision(n,t.precision),Yn.addBitWidth(n,t.bitWidth),Yn.endDecimal(n)}visitDate(t,n){return Gi.startDate(n),Gi.addUnit(n,t.unit),Gi.endDate(n)}visitTime(t,n){return Xt.startTime(n),Xt.addUnit(n,t.unit),Xt.addBitWidth(n,t.bitWidth),Xt.endTime(n)}visitTimestamp(t,n){const r=t.timezone&&n.createString(t.timezone)||void 0;return Zt.startTimestamp(n),Zt.addUnit(n,t.unit),r!==void 0&&Zt.addTimezone(n,r),Zt.endTimestamp(n)}visitInterval(t,n){return Ie.startInterval(n),Ie.addUnit(n,t.unit),Ie.endInterval(n)}visitDuration(t,n){return Hi.startDuration(n),Hi.addUnit(n,t.unit),Hi.endDuration(n)}visitList(t,n){return ed.startList(n),ed.endList(n)}visitStruct(t,n){return In.startStruct_(n),In.endStruct_(n)}visitUnion(t,n){Pt.startTypeIdsVector(n,t.typeIds.length);const r=Pt.createTypeIdsVector(n,t.typeIds);return Pt.startUnion(n),Pt.addMode(n,t.mode),Pt.addTypeIds(n,r),Pt.endUnion(n)}visitDictionary(t,n){const r=this.visit(t.indices,n);return Pe.startDictionaryEncoding(n),Pe.addId(n,BigInt(t.id)),Pe.addIsOrdered(n,t.isOrdered),r!==void 0&&Pe.addIndexType(n,r),Pe.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return Ki.startFixedSizeBinary(n),Ki.addByteWidth(n,t.byteWidth),Ki.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return Qi.startFixedSizeList(n),Qi.addListSize(n,t.listSize),Qi.endFixedSizeList(n)}visitMap(t,n){return Ji.startMap(n),Ji.addKeysSorted(n,t.keysSorted),Ji.endMap(n)}}const wa=new mE;function gE(e,t=new Map){return new ft(_E(e,t),As(e.metadata),t)}function qf(e){return new qt(e.count,Gf(e.columns),Hf(e.columns))}function bE(e){return new Te(qf(e.data),e.id,e.isDelta)}function _E(e,t){return(e.fields||[]).filter(Boolean).map(n=>_t.fromJSON(n,t))}function Wf(e,t){return(e.children||[]).filter(Boolean).map(n=>_t.fromJSON(n,t))}function Gf(e){return(e||[]).reduce((t,n)=>[...t,new sn(n.count,vE(n.VALIDITY)),...Gf(n.children)],[])}function Hf(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){const i=e[n];i.VALIDITY&&t.push(new Ae(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Ae(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Ae(t.length,i.OFFSET.length)),i.DATA&&t.push(new Ae(t.length,i.DATA.length)),t=Hf(i.children,t)}return t}function vE(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function wE(e,t){let n,r,i,s,o,a;return!t||!(s=e.dictionary)?(o=Qf(e,Wf(e,t)),i=new _t(e.name,o,e.nullable,As(e.metadata))):t.has(n=s.id)?(r=(r=s.indexType)?Kf(r):new xr,a=new Gn(t.get(n),r,n,s.isOrdered),i=new _t(e.name,a,e.nullable,As(e.metadata))):(r=(r=s.indexType)?Kf(r):new xr,t.set(n,o=Qf(e,Wf(e,t))),a=new Gn(o,r,n,s.isOrdered),i=new _t(e.name,a,e.nullable,As(e.metadata))),i||null}function As(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function Kf(e){return new En(e.isSigned,e.bitWidth)}function Qf(e,t){const n=e.type.name;switch(n){case"NONE":return new Ze;case"null":return new Ze;case"binary":return new Zi;case"largebinary":return new ts;case"utf8":return new es;case"largeutf8":return new ns;case"bool":return new rs;case"list":return new us((t||[])[0]);case"struct":return new Dt(t||[]);case"struct_":return new Dt(t||[])}switch(n){case"int":{const r=e.type;return new En(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=e.type;return new Xi(Nt[r.precision])}case"decimal":{const r=e.type;return new is(r.scale,r.precision,r.bitWidth)}case"date":{const r=e.type;return new ss(Jt[r.unit])}case"time":{const r=e.type;return new os(z[r.unit],r.bitWidth)}case"timestamp":{const r=e.type;return new as(z[r.unit],r.timezone)}case"interval":{const r=e.type;return new ls(_e[r.unit])}case"duration":{const r=e.type;return new cs(z[r.unit])}case"union":{const r=e.type,[i,...s]=(r.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new ds(Rt[o],r.typeIds||[],t||[])}case"fixedsizebinary":{const r=e.type;return new fs(r.byteWidth)}case"fixedsizelist":{const r=e.type;return new hs(r.listSize,(t||[])[0])}case"map":{const r=e.type;return new ps((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var IE=Hu,EE=Vn;class Lt{static fromJSON(t,n){const r=new Lt(0,Et.V5,n);return r._createHeader=SE(t,n),r}static decode(t){t=new EE(it(t));const n=rn.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),s=n.headerType(),o=new Lt(r,i,s);return o._createHeader=TE(n,s),o}static encode(t){const n=new IE;let r=-1;return t.isSchema()?r=ft.encode(n,t.header()):t.isRecordBatch()?r=qt.encode(n,t.header()):t.isDictionaryBatch()&&(r=Te.encode(n,t.header())),rn.startMessage(n),rn.addVersion(n,Et.V5),rn.addHeader(n,r),rn.addHeaderType(n,t.headerType),rn.addBodyLength(n,BigInt(t.bodyLength)),rn.finishMessageBuffer(n,rn.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof ft)return new Lt(0,Et.V5,lt.Schema,t);if(t instanceof qt)return new Lt(n,Et.V5,lt.RecordBatch,t);if(t instanceof Te)return new Lt(n,Et.V5,lt.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===lt.Schema}isRecordBatch(){return this.headerType===lt.RecordBatch}isDictionaryBatch(){return this.headerType===lt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=gt(t)}}class qt{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=gt(t)}}class Te{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=gt(n)}}class Ae{constructor(t,n){this.offset=gt(t),this.length=gt(n)}}class sn{constructor(t,n){this.length=gt(t),this.nullCount=gt(n)}}function SE(e,t){return(()=>{switch(t){case lt.Schema:return ft.fromJSON(e);case lt.RecordBatch:return qt.fromJSON(e);case lt.DictionaryBatch:return Te.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${lt[t]}, type: ${t} }`)})}function TE(e,t){return(()=>{switch(t){case lt.Schema:return ft.decode(e.header(new Ee),new Map,e.version());case lt.RecordBatch:return qt.decode(e.header(new Ue),e.version());case lt.DictionaryBatch:return Te.decode(e.header(new zn),e.version())}throw new Error(`Unrecognized Message type: { name: ${lt[t]}, type: ${t} }`)})}_t.encode=ME,_t.decode=LE,_t.fromJSON=wE,ft.encode=CE,ft.decode=AE,ft.fromJSON=gE,qt.encode=xE,qt.decode=OE,qt.fromJSON=qf,Te.encode=UE,Te.decode=RE,Te.fromJSON=bE,sn.encode=PE,sn.decode=BE,Ae.encode=kE,Ae.decode=NE;function AE(e,t=new Map,n=Et.V5){const r=$E(e,t);return new ft(r,Os(e),t,n)}function OE(e,t=Et.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new qt(e.length(),DE(e),FE(e,t))}function RE(e,t=Et.V5){return new Te(qt.decode(e.data(),t),e.id(),e.isDelta())}function NE(e){return new Ae(e.offset(),e.length())}function BE(e){return new sn(e.length(),e.nullCount())}function DE(e){const t=[];for(let n,r=-1,i=-1,s=e.nodesLength();++r<s;)(n=e.nodes(r))&&(t[++i]=sn.decode(n));return t}function FE(e,t){const n=[];for(let r,i=-1,s=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<Et.V4&&(r.bb_pos+=8*(i+1)),n[++s]=Ae.decode(r));return n}function $E(e,t){const n=[];for(let r,i=-1,s=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++s]=_t.decode(r,t));return n}function Jf(e,t){const n=[];for(let r,i=-1,s=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++s]=_t.decode(r,t));return n}function LE(e,t){let n,r,i,s,o,a;return!t||!(a=e.dictionary())?(i=Zf(e,Jf(e,t)),r=new _t(e.name(),i,e.nullable(),Os(e))):t.has(n=gt(a.id()))?(s=(s=a.indexType())?Xf(s):new xr,o=new Gn(t.get(n),s,n,a.isOrdered()),r=new _t(e.name(),o,e.nullable(),Os(e))):(s=(s=a.indexType())?Xf(s):new xr,t.set(n,i=Zf(e,Jf(e,t))),o=new Gn(i,s,n,a.isOrdered()),r=new _t(e.name(),o,e.nullable(),Os(e))),r||null}function Os(e){const t=new Map;if(e)for(let n,r,i=-1,s=Math.trunc(e.customMetadataLength());++i<s;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Xf(e){return new En(e.isSigned(),e.bitWidth())}function Zf(e,t){const n=e.typeType();switch(n){case bt.NONE:return new Ze;case bt.Null:return new Ze;case bt.Binary:return new Zi;case bt.LargeBinary:return new ts;case bt.Utf8:return new es;case bt.LargeUtf8:return new ns;case bt.Bool:return new rs;case bt.List:return new us((t||[])[0]);case bt.Struct_:return new Dt(t||[])}switch(n){case bt.Int:{const r=e.type(new jt);return new En(r.isSigned(),r.bitWidth())}case bt.FloatingPoint:{const r=e.type(new we);return new Xi(r.precision())}case bt.Decimal:{const r=e.type(new Yn);return new is(r.scale(),r.precision(),r.bitWidth())}case bt.Date:{const r=e.type(new Gi);return new ss(r.unit())}case bt.Time:{const r=e.type(new Xt);return new os(r.unit(),r.bitWidth())}case bt.Timestamp:{const r=e.type(new Zt);return new as(r.unit(),r.timezone())}case bt.Interval:{const r=e.type(new Ie);return new ls(r.unit())}case bt.Duration:{const r=e.type(new Hi);return new cs(r.unit())}case bt.Union:{const r=e.type(new Pt);return new ds(r.mode(),r.typeIdsArray()||[],t||[])}case bt.FixedSizeBinary:{const r=e.type(new Ki);return new fs(r.byteWidth())}case bt.FixedSizeList:{const r=e.type(new Qi);return new hs(r.listSize(),(t||[])[0])}case bt.Map:{const r=e.type(new Ji);return new ps((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${bt[n]}" (${n})`)}function CE(e,t){const n=t.fields.map(s=>_t.encode(e,s));Ee.startFieldsVector(e,n.length);const r=Ee.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?Ee.createCustomMetadataVector(e,[...t.metadata].map(([s,o])=>{const a=e.createString(`${s}`),l=e.createString(`${o}`);return Tt.startKeyValue(e),Tt.addKey(e,a),Tt.addValue(e,l),Tt.endKeyValue(e)})):-1;return Ee.startSchema(e),Ee.addFields(e,r),Ee.addEndianness(e,VE?jn.Little:jn.Big),i!==-1&&Ee.addCustomMetadata(e,i),Ee.endSchema(e)}function ME(e,t){let n=-1,r=-1,i=-1;const s=t.type;let o=t.typeId;M.isDictionary(s)?(o=s.dictionary.typeId,i=wa.visit(s,e),r=wa.visit(s.dictionary,e)):r=wa.visit(s,e);const a=(s.children||[]).map(d=>_t.encode(e,d)),l=te.createChildrenVector(e,a),c=t.metadata&&t.metadata.size>0?te.createCustomMetadataVector(e,[...t.metadata].map(([d,f])=>{const h=e.createString(`${d}`),y=e.createString(`${f}`);return Tt.startKeyValue(e),Tt.addKey(e,h),Tt.addValue(e,y),Tt.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),te.startField(e),te.addType(e,r),te.addTypeType(e,o),te.addChildren(e,l),te.addNullable(e,!!t.nullable),n!==-1&&te.addName(e,n),i!==-1&&te.addDictionary(e,i),c!==-1&&te.addCustomMetadata(e,c),te.endField(e)}function xE(e,t){const n=t.nodes||[],r=t.buffers||[];Ue.startNodesVector(e,n.length);for(const o of n.slice().reverse())sn.encode(e,o);const i=e.endVector();Ue.startBuffersVector(e,r.length);for(const o of r.slice().reverse())Ae.encode(e,o);const s=e.endVector();return Ue.startRecordBatch(e),Ue.addLength(e,BigInt(t.length)),Ue.addNodes(e,i),Ue.addBuffers(e,s),Ue.endRecordBatch(e)}function UE(e,t){const n=qt.encode(e,t.data);return zn.startDictionaryBatch(e),zn.addId(e,BigInt(t.id)),zn.addIsDelta(e,t.isDelta),zn.addData(e,n),zn.endDictionaryBatch(e)}function PE(e,t){return Qu.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function kE(e,t){return Ku.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const VE=(()=>{const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Ia=e=>`Expected ${lt[e]} Message in stream, but was null or length 0.`,Ea=e=>`Header pointer of flatbuffer-encoded ${lt[e]} Message is null or length 0.`,th=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,eh=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;class nh{constructor(t){this.source=t instanceof Es?t:new Es(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?At:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Ia(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const n=it(this.source.read(t));if(n.byteLength<t)throw new Error(eh(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){const n=lt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Ea(n));return i}readMetadataLength(){const t=this.source.read(Rs),n=t&&new Vn(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){const n=this.source.read(t);if(!n)return At;if(n.byteLength<t)throw new Error(th(t,n.byteLength));return{done:!1,value:Lt.decode(n)}}}class zE{constructor(t,n){this.source=t instanceof er?t:Pu(t)?new Ss(t,n):new er(t)}[Symbol.asyncIterator](){return this}next(){return H(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?At:t})}throw(t){return H(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return H(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return H(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Ia(t));return n.value})}readMessageBody(t){return H(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const n=it(yield this.source.read(t));if(n.byteLength<t)throw new Error(eh(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(){return H(this,arguments,void 0,function*(t=!1){const n=lt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Ea(n));return i})}readMetadataLength(){return H(this,void 0,void 0,function*(){const t=yield this.source.read(Rs),n=t&&new Vn(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return H(this,void 0,void 0,function*(){const n=yield this.source.read(t);if(!n)return At;if(n.byteLength<t)throw new Error(th(t,n.byteLength));return{done:!1,value:Lt.decode(n)}})}}class jE extends nh{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof xf?t:new xf(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Lt.fromJSON(t.schema,lt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:Lt.fromJSON(n,lt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:Lt.fromJSON(n,lt.RecordBatch)}}return this._body=[],At}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...n(s.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Ia(t));return n.value}readSchema(){const t=lt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(Ea(t));return r}}const Rs=4,Sa="ARROW1",jr=new Uint8Array(Sa.length);for(let e=0;e<Sa.length;e+=1)jr[e]=Sa.codePointAt(e);function Ta(e,t=0){for(let n=-1,r=jr.length;++n<r;)if(jr[n]!==e[t+n])return!1;return!0}const Yr=jr.length,rh=Yr+Rs,YE=Yr*2+Rs;class re extends ha{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 n=this._impl.open(t);return wn(n)?n.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 Qt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Qt.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,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof re?t:qo(t)?HE(t):Pu(t)?JE(t):wn(t)?H(this,void 0,void 0,function*(){return yield re.from(yield t)}):ku(t)||Wo(t)||Vu(t)||kn(t)?QE(new er(t)):KE(new Es(t))}static readAll(t){return t instanceof re?t.isSync()?lh(t):ch(t):qo(t)||ArrayBuffer.isView(t)||Fr(t)||Uu(t)?lh(t):ch(t)}}class Ns extends re{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ge(this,arguments,function*(){yield Z(yield*ki(vn(this[Symbol.iterator]())))})}}class Bs extends re{constructor(t){super(t),this._impl=t}readAll(){return H(this,void 0,void 0,function*(){var t,n,r,i;const s=new Array;try{for(var o=!0,a=vn(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;const c=i;s.push(c)}}catch(c){n={error:c}}finally{try{!o&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class ih extends Ns{constructor(t){super(t),this._impl=t}}class qE extends Bs{constructor(t){super(t),this._impl=t}}class sh{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){const r=this._loadVectors(t,n,this.schema.fields),i=nt({type:new Dt(this.schema.fields),length:t.length,children:r});return new Vt(this.schema,i)}_loadDictionaryBatch(t,n){const{id:r,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(r),l=o.dictionaries.get(r),c=this._loadVectors(t.data,n,[l]);return(a&&i?a.concat(new dt(c)):new dt(c)).memoize()}_loadVectors(t,n,r){return new kf(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class Ds extends sh{constructor(t,n){super(n),this._reader=qo(t)?new jE(this._handle=t):new nh(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=ah(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):At}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):At}next(){if(this.closed)return At;let t;const{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=n.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 va(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Fs extends sh{constructor(t,n){super(n),this._reader=new zE(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return H(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 H(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=ah(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return H(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):At})}return(t){return H(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):At})}next(){return H(this,void 0,void 0,function*(){if(this.closed)return At;let t;const{_reader:n}=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 n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=yield n.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 va(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return H(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class oh extends Ds{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof Uf?t:new Uf(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(lt.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(lt.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,n=t.size-rh,r=t.readInt32(n),i=t.readAt(n-r,r);return Pr.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}}class WE extends Fs{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){const r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof Ss?t:new Ss(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){const n=Object.create(null,{open:{get:()=>super.open}});return H(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 n.open.call(this,t)})}readRecordBatch(t){return H(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(lt.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return H(this,void 0,void 0,function*(){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(lt.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return H(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const n=t.size-rh,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Pr.decode(i)})}_readNextMessageAndValidate(t){return H(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}}class GE extends Ds{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new oE(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}function ah(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*lh(e){const t=re.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function ch(e){return ge(this,arguments,function*(){const t=yield Z(re.from(e));try{if(!(yield Z(t.open({autoDestroy:!1}))).closed)do yield yield Z(t);while(!(yield Z(t.reset().open())).closed)}finally{yield Z(t.cancel())}})}function HE(e){return new Ns(new GE(e))}function KE(e){const t=e.peek(Yr+7&-8);return t&&t.byteLength>=4?Ta(t)?new ih(new oh(e.read())):new Ns(new Ds(e)):new Ns(new Ds((function*(){})()))}function QE(e){return H(this,void 0,void 0,function*(){const t=yield e.peek(Yr+7&-8);return t&&t.byteLength>=4?Ta(t)?new ih(new oh(yield e.read())):new Bs(new Fs(e)):new Bs(new Fs((function(){return ge(this,arguments,function*(){})})()))})}function JE(e){return H(this,void 0,void 0,function*(){const{size:t}=yield e.stat(),n=new Ss(e,t);return t>=YE&&Ta(yield n.readAt(0,Yr+7&-8))?new qE(new WE(n)):new Bs(new Fs(n))})}class It extends et{static assemble(...t){const n=i=>i.flatMap(s=>Array.isArray(s)?n(s):s instanceof Vt?s.data.children:s.data),r=new It;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof dt)return this.visitMany(t.data),this;const{type:n}=t;if(!M.isDictionary(n)){const{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(M.isUnion(n))this.nodes.push(new sn(r,0));else{const{nullCount:i}=t;M.isNull(n)||ue.call(this,i<=0?new Uint8Array(0):ms(t.offset,r,t.nullBitmap)),this.nodes.push(new sn(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 ue(e){const t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Ae(this._byteLength,t)),this._byteLength+=t,this}function XE(e){var t;const{type:n,length:r,typeIds:i,valueOffsets:s}=e;if(ue.call(this,i),n.mode===Rt.Sparse)return Oa.call(this,e);if(n.mode===Rt.Dense){if(e.offset<=0)return ue.call(this,s),Oa.call(this,e);{const o=new Int32Array(r),a=Object.create(null),l=Object.create(null);for(let c,d,f=-1;++f<r;)(c=i[f])!==void 0&&((d=a[c])===void 0&&(d=a[c]=s[f]),o[f]=s[f]-d,l[c]=((t=l[c])!==null&&t!==void 0?t:0)+1);ue.call(this,o),this.visitMany(e.children.map((c,d)=>{const f=n.typeIds[d],h=a[f],y=l[f];return c.slice(h,Math.min(r,y))}))}}return this}function ZE(e){let t;return e.nullCount>=e.length?ue.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?ue.call(this,ms(e.offset,e.length,t)):ue.call(this,gs(e.values))}function Ye(e){return ue.call(this,e.values.subarray(0,e.length*e.stride))}function $s(e){const{length:t,values:n,valueOffsets:r}=e,i=gt(r[0]),s=gt(r[t]),o=Math.min(s-i,n.byteLength-i);return ue.call(this,qu(-i,t+1,r)),ue.call(this,n.subarray(i,i+o)),this}function Aa(e){const{length:t,valueOffsets:n}=e;if(n){const{[0]:r,[t]:i}=n;return ue.call(this,qu(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function Oa(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}It.prototype.visitBool=ZE,It.prototype.visitInt=Ye,It.prototype.visitFloat=Ye,It.prototype.visitUtf8=$s,It.prototype.visitLargeUtf8=$s,It.prototype.visitBinary=$s,It.prototype.visitLargeBinary=$s,It.prototype.visitFixedSizeBinary=Ye,It.prototype.visitDate=Ye,It.prototype.visitTimestamp=Ye,It.prototype.visitTime=Ye,It.prototype.visitDecimal=Ye,It.prototype.visitList=Aa,It.prototype.visitStruct=Oa,It.prototype.visitUnion=XE,It.prototype.visitInterval=Ye,It.prototype.visitDuration=Ye,It.prototype.visitFixedSizeList=Aa,It.prototype.visitMap=Aa;class uh extends ha{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Is,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Ut(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return wn(t)?t.then(n=>this.writeAll(n)):kn(t)?Da(this,t):Ba(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,n=null){return t===this._sink||t instanceof Is?this._sink=t:(this._sink=new Is,t&&B1(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&D1(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!n||!ba(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof $t&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Vt&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!ba(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Vt?t instanceof va||this._writeRecordBatch(t):t instanceof $t?this.writeAll(t.batches):Fr(t)&&this.writeAll(t)}_writeMessage(t,n=8){const r=n-1,i=Lt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+r&~r,l=a-s-o;return t.headerType===lt.RecordBatch?this._recordBatchBlocks.push(new en(a,t.bodyLength,this._position)):t.headerType===lt.DictionaryBatch&&this._dictionaryBlocks.push(new en(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const n=it(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(Lt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(jr)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:n,nodes:r,bufferRegions:i,buffers:s}=It.assemble(t),o=new qt(t.numRows,r,i),a=Lt.from(o,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,n,r=!1){const{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=It.assemble(new dt([t])),l=new qt(t.length,s,o),c=new Te(l,n,r),d=Lt.from(c,i);return this._writeMessage(d)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let s=-1,o=t.length;++s<o;)(n=t[s])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){var n,r;for(const[i,s]of t.dictionaries){const o=(n=s?.data)!==null&&n!==void 0?n:[],a=this._seenDictionaries.get(i),l=(r=this._dictionaryDeltaOffsets.get(i))!==null&&r!==void 0?r:0;if(!a||a.data[0]!==o[0])for(const[c,d]of o.entries())this._writeDictionaryBatch(d,i,c>0);else if(l<o.length)for(const c of o.slice(l))this._writeDictionaryBatch(c,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,o.length)}return this}}class Ra extends uh{static writeAll(t,n){const r=new Ra(n);return wn(t)?t.then(i=>r.writeAll(i)):kn(t)?Da(r,t):Ba(r,t)}}class Na extends uh{static writeAll(t){const n=new Na;return wn(t)?t.then(r=>n.writeAll(r)):kn(t)?Da(n,t):Ba(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,n,r=!1){if(!r&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,n,r)}_writeFooter(t){const n=Pr.encode(new Pr(t,Et.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function Ba(e,t){let n=t;t instanceof $t&&(n=t.batches,e.reset(void 0,t.schema));for(const r of n)e.write(r);return e.finish()}function Da(e,t){return H(this,void 0,void 0,function*(){var n,r,i,s,o,a,l;try{for(n=!0,r=vn(t);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const c=l;e.write(c)}}catch(c){o={error:c}}finally{try{!n&&!s&&(a=r.return)&&(yield a.call(r))}finally{if(o)throw o.error}}return e.finish()})}function tS(e,t="stream"){return(t==="stream"?Ra:Na).writeAll(e).toUint8Array(!0)}var eS=Object.create,dh=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,rS=Object.getOwnPropertyNames,iS=Object.getPrototypeOf,sS=Object.prototype.hasOwnProperty,oS=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),aS=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rS(t))!sS.call(e,i)&&i!==n&&dh(e,i,{get:()=>t[i],enumerable:!(r=nS(t,i))||r.enumerable});return e},lS=(e,t,n)=>(n=e!=null?eS(iS(e)):{},aS(!e||!e.__esModule?dh(n,"default",{value:e,enumerable:!0}):n,e)),cS=oS((e,t)=>{t.exports=Worker}),fh=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(fh||{}),hh=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(hh||{}),ph=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(ph||{}),yh=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(yh||{}),mh=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(mh||{}),gh=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(gh||{}),uS=class{log(e){}},dS=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};function fS(e){switch(e){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function hS(e){switch(e){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function pS(e){switch(e){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function yS(e){switch(e){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var bh=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(bh||{}),_h=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=re.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new $t(n)}async send(e,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.startPendingQuery(this._conn,e,t);for(;n==null;)n=await this._bindings.pollPendingQuery(this._conn);let r=new Fa(this._bindings,this._conn,n),i=await re.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new vh(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=tS(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},Fa=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},vh=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=re.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new $t(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new Fa(this.bindings,this.connectionId,t),r=await re.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},wh=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(wh||{}),Ih=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.PROGRESS_UPDATE="PROGRESS_UPDATE",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Ih||{}),st=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function Ls(e){switch(e.typeId){case g.Binary:return{sqlType:"binary"};case g.Bool:return{sqlType:"bool"};case g.Date:return{sqlType:"date"};case g.DateDay:return{sqlType:"date32[d]"};case g.DateMillisecond:return{sqlType:"date64[ms]"};case g.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case g.Float:return{sqlType:"float"};case g.Float16:return{sqlType:"float16"};case g.Float32:return{sqlType:"float32"};case g.Float64:return{sqlType:"float64"};case g.Int:return{sqlType:"int32"};case g.Int16:return{sqlType:"int16"};case g.Int32:return{sqlType:"int32"};case g.Int64:return{sqlType:"int64"};case g.Uint16:return{sqlType:"uint16"};case g.Uint32:return{sqlType:"uint32"};case g.Uint64:return{sqlType:"uint64"};case g.Uint8:return{sqlType:"uint8"};case g.IntervalDayTime:return{sqlType:"interval[dt]"};case g.IntervalYearMonth:return{sqlType:"interval[m]"};case g.List:return{sqlType:"list",valueType:Ls(e.valueType)};case g.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case g.Null:return{sqlType:"null"};case g.Utf8:return{sqlType:"utf8"};case g.Struct:return{sqlType:"struct",fields:e.children.map(t=>$a(t.name,t.type))};case g.Map:{let t=e;return{sqlType:"map",keyType:Ls(t.keyType),valueType:Ls(t.valueType)}}case g.Time:return{sqlType:"time[s]"};case g.TimeMicrosecond:return{sqlType:"time[us]"};case g.TimeMillisecond:return{sqlType:"time[ms]"};case g.TimeNanosecond:return{sqlType:"time[ns]"};case g.TimeSecond:return{sqlType:"time[s]"};case g.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case g.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case g.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case g.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case g.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function $a(e,t){let n=Ls(t);return n.name=e,n}var mS=new TextEncoder,gS=class{constructor(e,t=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"PROGRESS_UPDATE":{for(let i of this._onExecutionProgress)i(n.data);return}case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new st("RESET",null);return await this.postTask(e)}async ping(){let e=new st("PING",null);await this.postTask(e)}async dropFile(e){let t=new st("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new st("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new st("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new st("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new st("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new st("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new st("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new st("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new st("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new _h(this,e)}async disconnect(e){let t=new st("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new st("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t,n=!1){let r=new st("START_PENDING_QUERY",[e,t,n]);return await this.postTask(r)}async pollPendingQuery(e){let t=new st("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new st("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new st("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new st("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new st("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new st("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new st("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new st("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new st("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=mS.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new st("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let n=new st("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new st("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async registerOPFSFileName(e){let t=new st("REGISTER_OPFS_FILE_NAME",[e]);await this.postTask(t,[])}async collectFileStatistics(e,t){let n=new st("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new st("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new st("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new st("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new st("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let o=n.columns[s];i.push($a(s,o))}n.columnsFlat=i,delete n.columns}let r=new st("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let o=n.columns[s];i.push($a(s,o))}n.columnsFlat=i,delete n.columns}let r=new st("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};function bS(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}bS();var Eh=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(Eh||{}),_S=class{constructor(){this._bindings=null,this._nextMessageId=0}log(e){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:e},[])}sendOK(e){this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"OK",data:null},[])}failWith(e,t){let n={name:t.name,message:t.message,stack:t.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"ERROR",data:n},[])}async onMessage(e){switch(e.type){case"PING":this.sendOK(e);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(e,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(e.data[0],e.data[1],t=>{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"INSTANTIATE_PROGRESS",data:t},[])}),this.sendOK(e)}catch(t){console.log(t),this._bindings=null,this.failWith(e,t)}return}if(!this._bindings)return this.failWith(e,new Error("duckdb is not initialized"));try{switch(e.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(e);break;case"OPEN":{let t=e.data.path;t!=null&&t.startsWith("opfs://")&&(await this._bindings.prepareDBFileHandle(t,3),e.data.useDirectIO=!0),this._bindings.open(e.data),this.sendOK(e);break}case"DROP_FILE":this._bindings.dropFile(e.data),this.sendOK(e);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(e);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(e);break;case"CONNECT":{let t=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"CONNECTION_INFO",data:t.useUnsafe((n,r)=>r)},[]);break}case"DISCONNECT":this._bindings.disconnect(e.data),this.sendOK(e);break;case"CREATE_PREPARED":{let t=this._bindings.createPrepared(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"PREPARED_STATEMENT_ID",data:t},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(e.data[0],e.data[1]),this.sendOK(e);break}case"RUN_PREPARED":{let t=this._bindings.runPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"RUN_QUERY":{let t=this._bindings.runQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"SEND_PREPARED":{let t=this._bindings.sendPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER",data:t},[t.buffer]);break}case"START_PENDING_QUERY":{let t=this._bindings.startPendingQuery(e.data[0],e.data[1],e.data[2]),n=[];t&&n.push(t.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:t},n);break}case"POLL_PENDING_QUERY":{let t=this._bindings.pollPendingQuery(e.data),n=[];t&&n.push(t.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:t},n);break}case"CANCEL_PENDING_QUERY":{let t=this._bindings.cancelPendingQuery(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SUCCESS",data:t},[]);break}case"FETCH_QUERY_RESULTS":{let t=this._bindings.fetchQueryResults(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_CHUNK",data:t},[t.buffer]);break}case"GET_TABLE_NAMES":{let t=this._bindings.getTableNames(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"TABLE_NAMES",data:t},[]);break}case"GLOB_FILE_INFOS":{let t=this._bindings.globFiles(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_INFOS",data:t},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_HANDLE":await this._bindings.registerFileHandleAsync(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_BUFFER":{let t=this._bindings.copyFileToBuffer(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_BUFFER",data:t},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_OPFS_FILE_NAME":this._bindings.registerOPFSFileName(e.data[0]),this.sendOK(e);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(e.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"TOKENIZE":{let t=this._bindings.tokenize(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SCRIPT_TOKENS",data:t},[]);break}}}catch(t){return console.log(t),this.failWith(e,t)}}},vS=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),wS=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),IS=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),ES=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),La={name:"@duckdb/duckdb-wasm",version:"1.29.1-dev132.0"},Sh=La.name,Th=La.version,Ca=La.version.split("."),SS=Ca[0],TS=Ca[1],AS=Ca[2],Ma=()=>typeof navigator>"u",Ah=()=>Ma()?"node":navigator.userAgent,OS=()=>Ah().includes("Firefox"),RS=()=>/^((?!chrome|android).)*safari/i.test(Ah());function NS(){let e="https://cdn.jsdelivr.net/npm/".concat(Sh,"@").concat(Th,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var xa=null,Ua=null,Pa=null,ka=null,Va=null;async function Oh(){return xa==null&&(xa=typeof BigInt64Array<"u"),Ua==null&&(Ua=await wS()),Pa==null&&(Pa=await ES()),ka==null&&(ka=await IS()),Va==null&&(Va=await vS()),{bigInt64Array:xa,crossOriginIsolated:Ma()||globalThis.crossOriginIsolated||!1,wasmExceptions:Ua,wasmSIMD:ka,wasmThreads:Pa,wasmBulkMemory:Va}}async function BS(e){let t=await Oh();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var DS=lS(cS());async function FS(e){let t=new Request(e),n=await fetch(t),r=URL.createObjectURL(await n.blob());return new DS.default(r)}const $S=Object.freeze(Object.defineProperty({__proto__:null,AsyncDuckDB:gS,AsyncDuckDBConnection:_h,AsyncDuckDBDispatcher:_S,AsyncPreparedStatement:vh,AsyncResultStreamIterator:Fa,ConsoleLogger:dS,DuckDBAccessMode:fh,DuckDBDataProtocol:Eh,LogEvent:mh,LogLevel:ph,LogOrigin:gh,LogTopic:yh,PACKAGE_NAME:Sh,PACKAGE_VERSION:Th,PACKAGE_VERSION_MAJOR:SS,PACKAGE_VERSION_MINOR:TS,PACKAGE_VERSION_PATCH:AS,StatusCode:bh,TokenType:hh,VoidLogger:uS,WorkerRequestType:wh,WorkerResponseType:Ih,WorkerTask:st,createWorker:FS,getJsDelivrBundles:NS,getLogEventLabel:hS,getLogLevelLabel:fS,getLogOriginLabel:yS,getLogTopicLabel:pS,getPlatformFeatures:Oh,isFirefox:OS,isNode:Ma,isSafari:RS,selectBundle:BS},Symbol.toStringTag,{value:"Module"}));de.DataExplorer=E1,de.UMAP=A1,Object.defineProperty(de,Symbol.toStringTag,{value:"Module"})}));
|
|
65
|
+
]`}concat(...t){const n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new Ot(n,r.map(i=>new xt(n,i)))}slice(t,n){const r=this.schema;[t,n]=oc({length:this.numRows},t,n);const i=fc(this.data,this._offsets,t,n);return new Ot(r,i.map(s=>new xt(r,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const n=this.data.map(r=>r.children[t]);if(n.length===0){const{type:r}=this.schema.fields[t],i=K({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new rt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new rt([K({type:new Ue,length:this.numRows})]));const s=r.fields.slice(),o=s[t].clone({type:n.type}),a=this.schema.fields.map((l,c)=>this.getChildAt(c));[s[t],a[t]]=[o,n],[r,i]=Bs(r,a)}return new Ot(r,i)}select(t){const n=this.schema.fields.reduce((r,i,s)=>r.set(i.name,s),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){const n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new Ot(n,r)}assign(t){const n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,l,c)=>{const[u,h]=a,y=n.findIndex(g=>g.name===l.name);return~y?h[y]=c:u.push(c),a},[[],[]]),s=this.schema.assign(t.schema),o=[...n.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new Ot(...Bs(s,o))}}Ec=Symbol.toStringTag,Ot[Ec]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=hi(_s),e.get=hi(Ut.getVisitFn(p.Struct)),e.set=pc(Wt.getVisitFn(p.Struct)),e.indexOf=yc(di.getVisitFn(p.Struct)),"Table"))(Ot.prototype);var Tc;let xt=class lr{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof it))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=K({nullCount:0,type:new Rt(this.schema.fields),children:this.schema.fields.map(n=>K({type:n.type,nullCount:0}))})]=t,!(this.data instanceof ot))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ac(this.schema,this.data.children);break}case 1:{const[n]=t,{fields:r,children:i,length:s}=Object.keys(n).reduce((l,c,u)=>(l.children[u]=n[c],l.length=Math.max(l.length,n[c].length),l.fields[u]=ft.new({name:c,type:n[c].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new it(r),a=K({type:new Rt(r),length:s,children:i,nullCount:0});[this.schema,this.data]=Ac(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Nc(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 Ut.visit(this.data,t)}at(t){return this.get(ps(t,this.numRows))}set(t,n){return Wt.visit(this.data,t,n)}indexOf(t,n){return di.visit(this.data,t,n)}[Symbol.iterator](){return vs.visit(new rt([this.data]))}toArray(){return[...this]}concat(...t){return new Ot(this.schema,[this,...t])}slice(t,n){const[r]=new rt([this.data]).slice(t,n).data;return new lr(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new rt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new rt([K({type:new Ue,length:this.numRows})]));const s=r.fields.slice(),o=i.children.slice(),a=s[t].clone({type:n.type});[s[t],o[t]]=[a,n.data[0]],r=new it(s,new Map(this.schema.metadata)),i=K({type:new Rt(s),children:o})}return new lr(r,i)}select(t){const n=this.schema.select(t),r=new Rt(n.fields),i=[];for(const s of t){const o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new lr(n,K({type:r,length:this.numRows,children:i}))}selectAt(t){const n=this.schema.selectAt(t),r=t.map(s=>this.data.children[s]).filter(Boolean),i=K({type:new Rt(n.fields),length:this.numRows,children:r});return new lr(n,i)}};Tc=Symbol.toStringTag,xt[Tc]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(xt.prototype);function Ac(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...e.fields],s=[...t],o=(n+63&-64)>>3;for(const[a,l]of e.fields.entries()){const c=t[a];(!c||c.length!==n)&&(i[a]=l.clone({nullable:!0}),s[a]=(r=c?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:K({type:l.type,length:n,nullCount:n,nullBitmap:new Uint8Array(o)}))}return[e.assign(i),K({type:new Rt(i),length:n,children:s})]}function Nc(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let s=-1,o=e.length;++s<o;){const{type:a}=e[s],l=t[s];for(const c of[l,...((i=l?.dictionary)===null||i===void 0?void 0:i.data)||[]])Nc(a.children,c?.children,n);if(O.isDictionary(a)){const{id:c}=a;if(!n.has(c))l?.dictionary&&n.set(c,l.dictionary);else if(n.get(c)!==l.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}class Os extends xt{constructor(t){const n=t.fields.map(i=>K({type:i.type})),r=K({type:new Rt(t.fields),nullCount:0,children:n});super(t,r)}}let ke=class me{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+nt),(n||new me).__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):gt.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):et.NONE}header(t){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||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,n){t.addFieldInt16(0,n,gt.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,et.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,s,o){return me.startMessage(t),me.addVersion(t,n),me.addHeaderType(t,r),me.addHeader(t,i),me.addBodyLength(t,s),me.addCustomMetadata(t,o),me.endMessage(t)}};class bg extends G{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Pa.startNull(n),Pa.endNull(n)}visitInt(t,n){return kt.startInt(n),kt.addBitWidth(n,t.bitWidth),kt.addIsSigned(n,t.isSigned),kt.endInt(n)}visitFloat(t,n){return ue.startFloatingPoint(n),ue.addPrecision(n,t.precision),ue.endFloatingPoint(n)}visitBinary(t,n){return Ua.startBinary(n),Ua.endBinary(n)}visitLargeBinary(t,n){return Ca.startLargeBinary(n),Ca.endLargeBinary(n)}visitBool(t,n){return xa.startBool(n),xa.endBool(n)}visitUtf8(t,n){return Va.startUtf8(n),Va.endUtf8(n)}visitLargeUtf8(t,n){return $a.startLargeUtf8(n),$a.endLargeUtf8(n)}visitDecimal(t,n){return cn.startDecimal(n),cn.addScale(n,t.scale),cn.addPrecision(n,t.precision),cn.addBitWidth(n,t.bitWidth),cn.endDecimal(n)}visitDate(t,n){return Pr.startDate(n),Pr.addUnit(n,t.unit),Pr.endDate(n)}visitTime(t,n){return jt.startTime(n),jt.addUnit(n,t.unit),jt.addBitWidth(n,t.bitWidth),jt.endTime(n)}visitTimestamp(t,n){const r=t.timezone&&n.createString(t.timezone)||void 0;return qt.startTimestamp(n),qt.addUnit(n,t.unit),r!==void 0&&qt.addTimezone(n,r),qt.endTimestamp(n)}visitInterval(t,n){return he.startInterval(n),he.addUnit(n,t.unit),he.endInterval(n)}visitDuration(t,n){return Vr.startDuration(n),Vr.addUnit(n,t.unit),Vr.endDuration(n)}visitList(t,n){return ka.startList(n),ka.endList(n)}visitStruct(t,n){return Xe.startStruct_(n),Xe.endStruct_(n)}visitUnion(t,n){Mt.startTypeIdsVector(n,t.typeIds.length);const r=Mt.createTypeIdsVector(n,t.typeIds);return Mt.startUnion(n),Mt.addMode(n,t.mode),Mt.addTypeIds(n,r),Mt.endUnion(n)}visitDictionary(t,n){const r=this.visit(t.indices,n);return Se.startDictionaryEncoding(n),Se.addId(n,BigInt(t.id)),Se.addIsOrdered(n,t.isOrdered),r!==void 0&&Se.addIndexType(n,r),Se.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return zr.startFixedSizeBinary(n),zr.addByteWidth(n,t.byteWidth),zr.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return Yr.startFixedSizeList(n),Yr.addListSize(n,t.listSize),Yr.endFixedSizeList(n)}visitMap(t,n){return jr.startMap(n),jr.addKeysSorted(n,t.keysSorted),jr.endMap(n)}}const Ds=new bg;function _g(e,t=new Map){return new it(wg(e,t),_i(e.metadata),t)}function Rc(e){return new Vt(e.count,Oc(e.columns),Dc(e.columns))}function vg(e){return new pe(Rc(e.data),e.id,e.isDelta)}function wg(e,t){return(e.fields||[]).filter(Boolean).map(n=>ft.fromJSON(n,t))}function Bc(e,t){return(e.children||[]).filter(Boolean).map(n=>ft.fromJSON(n,t))}function Oc(e){return(e||[]).reduce((t,n)=>[...t,new Pe(n.count,Ig(n.VALIDITY)),...Oc(n.children)],[])}function Dc(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){const i=e[n];i.VALIDITY&&t.push(new ye(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ye(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ye(t.length,i.OFFSET.length)),i.DATA&&t.push(new ye(t.length,i.DATA.length)),t=Dc(i.children,t)}return t}function Ig(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function Sg(e,t){let n,r,i,s,o,a;return!t||!(s=e.dictionary)?(o=Fc(e,Bc(e,t)),i=new ft(e.name,o,e.nullable,_i(e.metadata))):t.has(n=s.id)?(r=(r=s.indexType)?Lc(r):new Gn,a=new dn(t.get(n),r,n,s.isOrdered),i=new ft(e.name,a,e.nullable,_i(e.metadata))):(r=(r=s.indexType)?Lc(r):new Gn,t.set(n,o=Fc(e,Bc(e,t))),a=new dn(o,r,n,s.isOrdered),i=new ft(e.name,a,e.nullable,_i(e.metadata))),i||null}function _i(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function Lc(e){return new Je(e.isSigned,e.bitWidth)}function Fc(e,t){const n=e.type.name;switch(n){case"NONE":return new Ue;case"null":return new Ue;case"binary":return new Gr;case"largebinary":return new Wr;case"utf8":return new Hr;case"largeutf8":return new Kr;case"bool":return new Qr;case"list":return new ri((t||[])[0]);case"struct":return new Rt(t||[]);case"struct_":return new Rt(t||[])}switch(n){case"int":{const r=e.type;return new Je(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=e.type;return new qr(Tt[r.precision])}case"decimal":{const r=e.type;return new Xr(r.scale,r.precision,r.bitWidth)}case"date":{const r=e.type;return new Jr(Yt[r.unit])}case"time":{const r=e.type;return new Zr(x[r.unit],r.bitWidth)}case"timestamp":{const r=e.type;return new ti(x[r.unit],r.timezone)}case"interval":{const r=e.type;return new ei(le[r.unit])}case"duration":{const r=e.type;return new ni(x[r.unit])}case"union":{const r=e.type,[i,...s]=(r.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new ii(Et[o],r.typeIds||[],t||[])}case"fixedsizebinary":{const r=e.type;return new si(r.byteWidth)}case"fixedsizelist":{const r=e.type;return new oi(r.listSize,(t||[])[0])}case"map":{const r=e.type;return new ai((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Eg=La,Tg=on;class Dt{static fromJSON(t,n){const r=new Dt(0,gt.V5,n);return r._createHeader=Ag(t,n),r}static decode(t){t=new Tg(J(t));const n=ke.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),s=n.headerType(),o=new Dt(r,i,s);return o._createHeader=Ng(n,s),o}static encode(t){const n=new Eg;let r=-1;return t.isSchema()?r=it.encode(n,t.header()):t.isRecordBatch()?r=Vt.encode(n,t.header()):t.isDictionaryBatch()&&(r=pe.encode(n,t.header())),ke.startMessage(n),ke.addVersion(n,gt.V5),ke.addHeader(n,r),ke.addHeaderType(n,t.headerType),ke.addBodyLength(n,BigInt(t.bodyLength)),ke.finishMessageBuffer(n,ke.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof it)return new Dt(0,gt.V5,et.Schema,t);if(t instanceof Vt)return new Dt(n,gt.V5,et.RecordBatch,t);if(t instanceof pe)return new Dt(n,gt.V5,et.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===et.Schema}isRecordBatch(){return this.headerType===et.RecordBatch}isDictionaryBatch(){return this.headerType===et.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=ut(t)}}class Vt{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=ut(t)}}class pe{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=ut(n)}}class ye{constructor(t,n){this.offset=ut(t),this.length=ut(n)}}class Pe{constructor(t,n){this.length=ut(t),this.nullCount=ut(n)}}function Ag(e,t){return(()=>{switch(t){case et.Schema:return it.fromJSON(e);case et.RecordBatch:return Vt.fromJSON(e);case et.DictionaryBatch:return pe.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${et[t]}, type: ${t} }`)})}function Ng(e,t){return(()=>{switch(t){case et.Schema:return it.decode(e.header(new de),new Map,e.version());case et.RecordBatch:return Vt.decode(e.header(new Ie),e.version());case et.DictionaryBatch:return pe.decode(e.header(new an),e.version())}throw new Error(`Unrecognized Message type: { name: ${et[t]}, type: ${t} }`)})}ft.encode=$g,ft.decode=xg,ft.fromJSON=Sg,it.encode=Cg,it.decode=Rg,it.fromJSON=_g,Vt.encode=kg,Vt.decode=Bg,Vt.fromJSON=Rc,pe.encode=Pg,pe.decode=Og,pe.fromJSON=vg,Pe.encode=Vg,Pe.decode=Lg,ye.encode=zg,ye.decode=Dg;function Rg(e,t=new Map,n=gt.V5){const r=Ug(e,t);return new it(r,vi(e),t,n)}function Bg(e,t=gt.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Vt(e.length(),Fg(e),Mg(e,t))}function Og(e,t=gt.V5){return new pe(Vt.decode(e.data(),t),e.id(),e.isDelta())}function Dg(e){return new ye(e.offset(),e.length())}function Lg(e){return new Pe(e.length(),e.nullCount())}function Fg(e){const t=[];for(let n,r=-1,i=-1,s=e.nodesLength();++r<s;)(n=e.nodes(r))&&(t[++i]=Pe.decode(n));return t}function Mg(e,t){const n=[];for(let r,i=-1,s=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<gt.V4&&(r.bb_pos+=8*(i+1)),n[++s]=ye.decode(r));return n}function Ug(e,t){const n=[];for(let r,i=-1,s=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++s]=ft.decode(r,t));return n}function Mc(e,t){const n=[];for(let r,i=-1,s=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++s]=ft.decode(r,t));return n}function xg(e,t){let n,r,i,s,o,a;return!t||!(a=e.dictionary())?(i=xc(e,Mc(e,t)),r=new ft(e.name(),i,e.nullable(),vi(e))):t.has(n=ut(a.id()))?(s=(s=a.indexType())?Uc(s):new Gn,o=new dn(t.get(n),s,n,a.isOrdered()),r=new ft(e.name(),o,e.nullable(),vi(e))):(s=(s=a.indexType())?Uc(s):new Gn,t.set(n,i=xc(e,Mc(e,t))),o=new dn(i,s,n,a.isOrdered()),r=new ft(e.name(),o,e.nullable(),vi(e))),r||null}function vi(e){const t=new Map;if(e)for(let n,r,i=-1,s=Math.trunc(e.customMetadataLength());++i<s;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Uc(e){return new Je(e.isSigned(),e.bitWidth())}function xc(e,t){const n=e.typeType();switch(n){case ht.NONE:return new Ue;case ht.Null:return new Ue;case ht.Binary:return new Gr;case ht.LargeBinary:return new Wr;case ht.Utf8:return new Hr;case ht.LargeUtf8:return new Kr;case ht.Bool:return new Qr;case ht.List:return new ri((t||[])[0]);case ht.Struct_:return new Rt(t||[])}switch(n){case ht.Int:{const r=e.type(new kt);return new Je(r.isSigned(),r.bitWidth())}case ht.FloatingPoint:{const r=e.type(new ue);return new qr(r.precision())}case ht.Decimal:{const r=e.type(new cn);return new Xr(r.scale(),r.precision(),r.bitWidth())}case ht.Date:{const r=e.type(new Pr);return new Jr(r.unit())}case ht.Time:{const r=e.type(new jt);return new Zr(r.unit(),r.bitWidth())}case ht.Timestamp:{const r=e.type(new qt);return new ti(r.unit(),r.timezone())}case ht.Interval:{const r=e.type(new he);return new ei(r.unit())}case ht.Duration:{const r=e.type(new Vr);return new ni(r.unit())}case ht.Union:{const r=e.type(new Mt);return new ii(r.mode(),r.typeIdsArray()||[],t||[])}case ht.FixedSizeBinary:{const r=e.type(new zr);return new si(r.byteWidth())}case ht.FixedSizeList:{const r=e.type(new Yr);return new oi(r.listSize(),(t||[])[0])}case ht.Map:{const r=e.type(new jr);return new ai((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ht[n]}" (${n})`)}function Cg(e,t){const n=t.fields.map(s=>ft.encode(e,s));de.startFieldsVector(e,n.length);const r=de.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?de.createCustomMetadataVector(e,[...t.metadata].map(([s,o])=>{const a=e.createString(`${s}`),l=e.createString(`${o}`);return vt.startKeyValue(e),vt.addKey(e,a),vt.addValue(e,l),vt.endKeyValue(e)})):-1;return de.startSchema(e),de.addFields(e,r),de.addEndianness(e,Yg?ln.Little:ln.Big),i!==-1&&de.addCustomMetadata(e,i),de.endSchema(e)}function $g(e,t){let n=-1,r=-1,i=-1;const s=t.type;let o=t.typeId;O.isDictionary(s)?(o=s.dictionary.typeId,i=Ds.visit(s,e),r=Ds.visit(s.dictionary,e)):r=Ds.visit(s,e);const a=(s.children||[]).map(u=>ft.encode(e,u)),l=Gt.createChildrenVector(e,a),c=t.metadata&&t.metadata.size>0?Gt.createCustomMetadataVector(e,[...t.metadata].map(([u,h])=>{const y=e.createString(`${u}`),g=e.createString(`${h}`);return vt.startKeyValue(e),vt.addKey(e,y),vt.addValue(e,g),vt.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Gt.startField(e),Gt.addType(e,r),Gt.addTypeType(e,o),Gt.addChildren(e,l),Gt.addNullable(e,!!t.nullable),n!==-1&&Gt.addName(e,n),i!==-1&&Gt.addDictionary(e,i),c!==-1&&Gt.addCustomMetadata(e,c),Gt.endField(e)}function kg(e,t){const n=t.nodes||[],r=t.buffers||[];Ie.startNodesVector(e,n.length);for(const o of n.slice().reverse())Pe.encode(e,o);const i=e.endVector();Ie.startBuffersVector(e,r.length);for(const o of r.slice().reverse())ye.encode(e,o);const s=e.endVector();return Ie.startRecordBatch(e),Ie.addLength(e,BigInt(t.length)),Ie.addNodes(e,i),Ie.addBuffers(e,s),Ie.endRecordBatch(e)}function Pg(e,t){const n=Vt.encode(e,t.data);return an.startDictionaryBatch(e),an.addId(e,BigInt(t.id)),an.addIsDelta(e,t.isDelta),an.addData(e,n),an.endDictionaryBatch(e)}function Vg(e,t){return Ma.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function zg(e,t){return Fa.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const Yg=(()=>{const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Ls=e=>`Expected ${et[e]} Message in stream, but was null or length 0.`,Fs=e=>`Header pointer of flatbuffer-encoded ${et[e]} Message is null or length 0.`,Cc=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,$c=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;class kc{constructor(t){this.source=t instanceof mi?t:new mi(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?wt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Ls(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const n=J(this.source.read(t));if(n.byteLength<t)throw new Error($c(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){const n=et.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Fs(n));return i}readMetadataLength(){const t=this.source.read(wi),n=t&&new on(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){const n=this.source.read(t);if(!n)return wt;if(n.byteLength<t)throw new Error(Cc(t,n.byteLength));return{done:!1,value:Dt.decode(n)}}}class jg{constructor(t,n){this.source=t instanceof vn?t:Sa(t)?new gi(t,n):new vn(t)}[Symbol.asyncIterator](){return this}next(){return z(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?wt:t})}throw(t){return z(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return z(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return z(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Ls(t));return n.value})}readMessageBody(t){return z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const n=J(yield this.source.read(t));if(n.byteLength<t)throw new Error($c(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(){return z(this,arguments,void 0,function*(t=!1){const n=et.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(Fs(n));return i})}readMetadataLength(){return z(this,void 0,void 0,function*(){const t=yield this.source.read(wi),n=t&&new on(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return z(this,void 0,void 0,function*(){const n=yield this.source.read(t);if(!n)return wt;if(n.byteLength<t)throw new Error(Cc(t,n.byteLength));return{done:!1,value:Dt.decode(n)}})}}class qg extends kc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof vc?t:new vc(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Dt.fromJSON(t.schema,et.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:Dt.fromJSON(n,et.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:Dt.fromJSON(n,et.RecordBatch)}}return this._body=[],wt}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...n(s.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(Ls(t));return n.value}readSchema(){const t=et.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(Fs(t));return r}}const wi=4,Ms="ARROW1",Jn=new Uint8Array(Ms.length);for(let e=0;e<Ms.length;e+=1)Jn[e]=Ms.codePointAt(e);function Us(e,t=0){for(let n=-1,r=Jn.length;++n<r;)if(Jn[n]!==e[t+n])return!1;return!0}const Zn=Jn.length,Pc=Zn+wi,Gg=Zn*2+wi;class Kt extends Ss{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 n=this._impl.open(t);return Qe(n)?n.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 zt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return zt.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,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Kt?t:es(t)?Qg(t):Sa(t)?Zg(t):Qe(t)?z(this,void 0,void 0,function*(){return yield Kt.from(yield t)}):Ea(t)||ns(t)||Ta(t)||sn(t)?Jg(new vn(t)):Xg(new mi(t))}static readAll(t){return t instanceof Kt?t.isSync()?qc(t):Gc(t):es(t)||ArrayBuffer.isView(t)||Vn(t)||Ia(t)?qc(t):Gc(t)}}class Ii extends Kt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oe(this,arguments,function*(){yield q(yield*Fr(Ke(this[Symbol.iterator]())))})}}class Si extends Kt{constructor(t){super(t),this._impl=t}readAll(){return z(this,void 0,void 0,function*(){var t,n,r,i;const s=new Array;try{for(var o=!0,a=Ke(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;const c=i;s.push(c)}}catch(c){n={error:c}}finally{try{!o&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Vc extends Ii{constructor(t){super(t),this._impl=t}}class Wg extends Si{constructor(t){super(t),this._impl=t}}class zc{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){const r=this._loadVectors(t,n,this.schema.fields),i=K({type:new Rt(this.schema.fields),length:t.length,children:r});return new xt(this.schema,i)}_loadDictionaryBatch(t,n){const{id:r,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(r),l=o.dictionaries.get(r),c=this._loadVectors(t.data,n,[l]);return(a&&i?a.concat(new rt(c)):new rt(c)).memoize()}_loadVectors(t,n,r){return new Sc(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class Ei extends zc{constructor(t,n){super(n),this._reader=es(t)?new qg(this._handle=t):new kc(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=jc(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):wt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):wt}next(){if(this.closed)return wt;let t;const{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=n.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 Os(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Ti extends zc{constructor(t,n){super(n),this._reader=new jg(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return z(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 z(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=jc(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):wt})}return(t){return z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):wt})}next(){return z(this,void 0,void 0,function*(){if(this.closed)return wt;let t;const{_reader:n}=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 n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=yield n.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 Os(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Yc extends Ei{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof wc?t:new wc(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(et.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(et.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,n=t.size-Pc,r=t.readInt32(n),i=t.readAt(n-r,r);return Hn.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}}class Hg extends Ti{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){const r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof gi?t:new gi(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){const n=Object.create(null,{open:{get:()=>super.open}});return z(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 n.open.call(this,t)})}readRecordBatch(t){return z(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(et.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return z(this,void 0,void 0,function*(){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(et.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return z(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const n=t.size-Pc,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Hn.decode(i)})}_readNextMessageAndValidate(t){return z(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}}class Kg extends Ei{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new lg(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}function jc(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*qc(e){const t=Kt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Gc(e){return oe(this,arguments,function*(){const t=yield q(Kt.from(e));try{if(!(yield q(t.open({autoDestroy:!1}))).closed)do yield yield q(t);while(!(yield q(t.reset().open())).closed)}finally{yield q(t.cancel())}})}function Qg(e){return new Ii(new Kg(e))}function Xg(e){const t=e.peek(Zn+7&-8);return t&&t.byteLength>=4?Us(t)?new Vc(new Yc(e.read())):new Ii(new Ei(e)):new Ii(new Ei((function*(){})()))}function Jg(e){return z(this,void 0,void 0,function*(){const t=yield e.peek(Zn+7&-8);return t&&t.byteLength>=4?Us(t)?new Vc(new Yc(yield e.read())):new Si(new Ti(e)):new Si(new Ti((function(){return oe(this,arguments,function*(){})})()))})}function Zg(e){return z(this,void 0,void 0,function*(){const{size:t}=yield e.stat(),n=new gi(e,t);return t>=Gg&&Us(yield n.readAt(0,Zn+7&-8))?new Wg(new Hg(n)):new Si(new Ti(n))})}class yt extends G{static assemble(...t){const n=i=>i.flatMap(s=>Array.isArray(s)?n(s):s instanceof xt?s.data.children:s.data),r=new yt;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof rt)return this.visitMany(t.data),this;const{type:n}=t;if(!O.isDictionary(n)){const{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(O.isUnion(n))this.nodes.push(new Pe(r,0));else{const{nullCount:i}=t;O.isNull(n)||ee.call(this,i<=0?new Uint8Array(0):ci(t.offset,r,t.nullBitmap)),this.nodes.push(new Pe(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(e){const t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new ye(this._byteLength,t)),this._byteLength+=t,this}function tb(e){var t;const{type:n,length:r,typeIds:i,valueOffsets:s}=e;if(ee.call(this,i),n.mode===Et.Sparse)return Cs.call(this,e);if(n.mode===Et.Dense){if(e.offset<=0)return ee.call(this,s),Cs.call(this,e);{const o=new Int32Array(r),a=Object.create(null),l=Object.create(null);for(let c,u,h=-1;++h<r;)(c=i[h])!==void 0&&((u=a[c])===void 0&&(u=a[c]=s[h]),o[h]=s[h]-u,l[c]=((t=l[c])!==null&&t!==void 0?t:0)+1);ee.call(this,o),this.visitMany(e.children.map((c,u)=>{const h=n.typeIds[u],y=a[h],g=l[h];return c.slice(y,Math.min(r,g))}))}}return this}function eb(e){let t;return e.nullCount>=e.length?ee.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?ee.call(this,ci(e.offset,e.length,t)):ee.call(this,ui(e.values))}function Re(e){return ee.call(this,e.values.subarray(0,e.length*e.stride))}function Ai(e){const{length:t,values:n,valueOffsets:r}=e,i=ut(r[0]),s=ut(r[t]),o=Math.min(s-i,n.byteLength-i);return ee.call(this,Ba(-i,t+1,r)),ee.call(this,n.subarray(i,i+o)),this}function xs(e){const{length:t,valueOffsets:n}=e;if(n){const{[0]:r,[t]:i}=n;return ee.call(this,Ba(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function Cs(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}yt.prototype.visitBool=eb,yt.prototype.visitInt=Re,yt.prototype.visitFloat=Re,yt.prototype.visitUtf8=Ai,yt.prototype.visitLargeUtf8=Ai,yt.prototype.visitBinary=Ai,yt.prototype.visitLargeBinary=Ai,yt.prototype.visitFixedSizeBinary=Re,yt.prototype.visitDate=Re,yt.prototype.visitTimestamp=Re,yt.prototype.visitTime=Re,yt.prototype.visitDecimal=Re,yt.prototype.visitList=xs,yt.prototype.visitStruct=Cs,yt.prototype.visitUnion=tb,yt.prototype.visitInterval=Re,yt.prototype.visitDuration=Re,yt.prototype.visitFixedSizeList=xs,yt.prototype.visitMap=xs;class Wc extends Ss{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new yi,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Ft(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Qe(t)?t.then(n=>this.writeAll(n)):sn(t)?Vs(this,t):Ps(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,n=null){return t===this._sink||t instanceof yi?this._sink=t:(this._sink=new yi,t&&Ly(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Fy(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!n||!Rs(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Ot&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof xt&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Rs(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof xt?t instanceof Os||this._writeRecordBatch(t):t instanceof Ot?this.writeAll(t.batches):Vn(t)&&this.writeAll(t)}_writeMessage(t,n=8){const r=n-1,i=Dt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+r&~r,l=a-s-o;return t.headerType===et.RecordBatch?this._recordBatchBlocks.push(new Ce(a,t.bodyLength,this._position)):t.headerType===et.DictionaryBatch&&this._dictionaryBlocks.push(new Ce(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const n=J(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(Dt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Jn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:n,nodes:r,bufferRegions:i,buffers:s}=yt.assemble(t),o=new Vt(t.numRows,r,i),a=Dt.from(o,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,n,r=!1){const{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=yt.assemble(new rt([t])),l=new Vt(t.length,s,o),c=new pe(l,n,r),u=Dt.from(c,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let s=-1,o=t.length;++s<o;)(n=t[s])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){var n,r;for(const[i,s]of t.dictionaries){const o=(n=s?.data)!==null&&n!==void 0?n:[],a=this._seenDictionaries.get(i),l=(r=this._dictionaryDeltaOffsets.get(i))!==null&&r!==void 0?r:0;if(!a||a.data[0]!==o[0])for(const[c,u]of o.entries())this._writeDictionaryBatch(u,i,c>0);else if(l<o.length)for(const c of o.slice(l))this._writeDictionaryBatch(c,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,o.length)}return this}}class $s extends Wc{static writeAll(t,n){const r=new $s(n);return Qe(t)?t.then(i=>r.writeAll(i)):sn(t)?Vs(r,t):Ps(r,t)}}class ks extends Wc{static writeAll(t){const n=new ks;return Qe(t)?t.then(r=>n.writeAll(r)):sn(t)?Vs(n,t):Ps(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,n,r=!1){if(!r&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,n,r)}_writeFooter(t){const n=Hn.encode(new Hn(t,gt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function Ps(e,t){let n=t;t instanceof Ot&&(n=t.batches,e.reset(void 0,t.schema));for(const r of n)e.write(r);return e.finish()}function Vs(e,t){return z(this,void 0,void 0,function*(){var n,r,i,s,o,a,l;try{for(n=!0,r=Ke(t);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const c=l;e.write(c)}}catch(c){o={error:c}}finally{try{!n&&!s&&(a=r.return)&&(yield a.call(r))}finally{if(o)throw o.error}}return e.finish()})}function nb(e,t="stream"){return(t==="stream"?$s:ks).writeAll(e).toUint8Array(!0)}var rb=Object.create,Hc=Object.defineProperty,ib=Object.getOwnPropertyDescriptor,sb=Object.getOwnPropertyNames,ob=Object.getPrototypeOf,ab=Object.prototype.hasOwnProperty,lb=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cb=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sb(t))!ab.call(e,i)&&i!==n&&Hc(e,i,{get:()=>t[i],enumerable:!(r=ib(t,i))||r.enumerable});return e},ub=(e,t,n)=>(n=e!=null?rb(ob(e)):{},cb(!e||!e.__esModule?Hc(n,"default",{value:e,enumerable:!0}):n,e)),hb=lb((e,t)=>{t.exports=Worker}),Kc=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(Kc||{}),Qc=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(Qc||{}),Xc=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(Xc||{}),Jc=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(Jc||{}),Zc=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(Zc||{}),tu=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(tu||{}),db=class{log(e){}},fb=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};function pb(e){switch(e){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function yb(e){switch(e){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function mb(e){switch(e){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function gb(e){switch(e){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var eu=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(eu||{}),nu=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=Kt.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new Ot(n)}async send(e,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.startPendingQuery(this._conn,e,t);for(;n==null;)n=await this._bindings.pollPendingQuery(this._conn);let r=new zs(this._bindings,this._conn,n),i=await Kt.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new ru(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=nb(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},zs=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},ru=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=Kt.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new Ot(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new zs(this.bindings,this.connectionId,t),r=await Kt.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},iu=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(iu||{}),su=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.PROGRESS_UPDATE="PROGRESS_UPDATE",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(su||{}),Z=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function Ni(e){switch(e.typeId){case p.Binary:return{sqlType:"binary"};case p.Bool:return{sqlType:"bool"};case p.Date:return{sqlType:"date"};case p.DateDay:return{sqlType:"date32[d]"};case p.DateMillisecond:return{sqlType:"date64[ms]"};case p.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case p.Float:return{sqlType:"float"};case p.Float16:return{sqlType:"float16"};case p.Float32:return{sqlType:"float32"};case p.Float64:return{sqlType:"float64"};case p.Int:return{sqlType:"int32"};case p.Int16:return{sqlType:"int16"};case p.Int32:return{sqlType:"int32"};case p.Int64:return{sqlType:"int64"};case p.Uint16:return{sqlType:"uint16"};case p.Uint32:return{sqlType:"uint32"};case p.Uint64:return{sqlType:"uint64"};case p.Uint8:return{sqlType:"uint8"};case p.IntervalDayTime:return{sqlType:"interval[dt]"};case p.IntervalYearMonth:return{sqlType:"interval[m]"};case p.List:return{sqlType:"list",valueType:Ni(e.valueType)};case p.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case p.Null:return{sqlType:"null"};case p.Utf8:return{sqlType:"utf8"};case p.Struct:return{sqlType:"struct",fields:e.children.map(t=>Ys(t.name,t.type))};case p.Map:{let t=e;return{sqlType:"map",keyType:Ni(t.keyType),valueType:Ni(t.valueType)}}case p.Time:return{sqlType:"time[s]"};case p.TimeMicrosecond:return{sqlType:"time[us]"};case p.TimeMillisecond:return{sqlType:"time[ms]"};case p.TimeNanosecond:return{sqlType:"time[ns]"};case p.TimeSecond:return{sqlType:"time[s]"};case p.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case p.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case p.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case p.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case p.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function Ys(e,t){let n=Ni(t);return n.name=e,n}var bb=new TextEncoder,_b=class{constructor(e,t=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"PROGRESS_UPDATE":{for(let i of this._onExecutionProgress)i(n.data);return}case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new Z("RESET",null);return await this.postTask(e)}async ping(){let e=new Z("PING",null);await this.postTask(e)}async dropFile(e){let t=new Z("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Z("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Z("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Z("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Z("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Z("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Z("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Z("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Z("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new nu(this,e)}async disconnect(e){let t=new Z("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Z("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t,n=!1){let r=new Z("START_PENDING_QUERY",[e,t,n]);return await this.postTask(r)}async pollPendingQuery(e){let t=new Z("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Z("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Z("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Z("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Z("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Z("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Z("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Z("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Z("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=bb.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Z("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let n=new Z("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Z("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async registerOPFSFileName(e){let t=new Z("REGISTER_OPFS_FILE_NAME",[e]);await this.postTask(t,[])}async collectFileStatistics(e,t){let n=new Z("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Z("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Z("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Z("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Z("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let o=n.columns[s];i.push(Ys(s,o))}n.columnsFlat=i,delete n.columns}let r=new Z("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let o=n.columns[s];i.push(Ys(s,o))}n.columnsFlat=i,delete n.columns}let r=new Z("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};function vb(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}vb();var ou=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(ou||{}),wb=class{constructor(){this._bindings=null,this._nextMessageId=0}log(e){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:e},[])}sendOK(e){this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"OK",data:null},[])}failWith(e,t){let n={name:t.name,message:t.message,stack:t.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"ERROR",data:n},[])}async onMessage(e){switch(e.type){case"PING":this.sendOK(e);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(e,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(e.data[0],e.data[1],t=>{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"INSTANTIATE_PROGRESS",data:t},[])}),this.sendOK(e)}catch(t){console.log(t),this._bindings=null,this.failWith(e,t)}return}if(!this._bindings)return this.failWith(e,new Error("duckdb is not initialized"));try{switch(e.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(e);break;case"OPEN":{let t=e.data.path;t!=null&&t.startsWith("opfs://")&&(await this._bindings.prepareDBFileHandle(t,3),e.data.useDirectIO=!0),this._bindings.open(e.data),this.sendOK(e);break}case"DROP_FILE":this._bindings.dropFile(e.data),this.sendOK(e);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(e);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(e);break;case"CONNECT":{let t=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"CONNECTION_INFO",data:t.useUnsafe((n,r)=>r)},[]);break}case"DISCONNECT":this._bindings.disconnect(e.data),this.sendOK(e);break;case"CREATE_PREPARED":{let t=this._bindings.createPrepared(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"PREPARED_STATEMENT_ID",data:t},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(e.data[0],e.data[1]),this.sendOK(e);break}case"RUN_PREPARED":{let t=this._bindings.runPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"RUN_QUERY":{let t=this._bindings.runQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"SEND_PREPARED":{let t=this._bindings.sendPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER",data:t},[t.buffer]);break}case"START_PENDING_QUERY":{let t=this._bindings.startPendingQuery(e.data[0],e.data[1],e.data[2]),n=[];t&&n.push(t.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:t},n);break}case"POLL_PENDING_QUERY":{let t=this._bindings.pollPendingQuery(e.data),n=[];t&&n.push(t.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:t},n);break}case"CANCEL_PENDING_QUERY":{let t=this._bindings.cancelPendingQuery(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SUCCESS",data:t},[]);break}case"FETCH_QUERY_RESULTS":{let t=this._bindings.fetchQueryResults(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_CHUNK",data:t},[t.buffer]);break}case"GET_TABLE_NAMES":{let t=this._bindings.getTableNames(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"TABLE_NAMES",data:t},[]);break}case"GLOB_FILE_INFOS":{let t=this._bindings.globFiles(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_INFOS",data:t},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_HANDLE":await this._bindings.registerFileHandleAsync(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_BUFFER":{let t=this._bindings.copyFileToBuffer(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_BUFFER",data:t},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_OPFS_FILE_NAME":this._bindings.registerOPFSFileName(e.data[0]),this.sendOK(e);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(e.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"TOKENIZE":{let t=this._bindings.tokenize(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SCRIPT_TOKENS",data:t},[]);break}}}catch(t){return console.log(t),this.failWith(e,t)}}},Ib=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Sb=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),Eb=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Tb=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),js={name:"@duckdb/duckdb-wasm",version:"1.29.1-dev132.0"},au=js.name,lu=js.version,qs=js.version.split("."),Ab=qs[0],Nb=qs[1],Rb=qs[2],Gs=()=>typeof navigator>"u",cu=()=>Gs()?"node":navigator.userAgent,Bb=()=>cu().includes("Firefox"),Ob=()=>/^((?!chrome|android).)*safari/i.test(cu());function Db(){let e="https://cdn.jsdelivr.net/npm/".concat(au,"@").concat(lu,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var Ws=null,Hs=null,Ks=null,Qs=null,Xs=null;async function uu(){return Ws==null&&(Ws=typeof BigInt64Array<"u"),Hs==null&&(Hs=await Sb()),Ks==null&&(Ks=await Tb()),Qs==null&&(Qs=await Eb()),Xs==null&&(Xs=await Ib()),{bigInt64Array:Ws,crossOriginIsolated:Gs()||globalThis.crossOriginIsolated||!1,wasmExceptions:Hs,wasmSIMD:Qs,wasmThreads:Ks,wasmBulkMemory:Xs}}async function Lb(e){let t=await uu();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var Fb=ub(hb());async function Mb(e){let t=new Request(e),n=await fetch(t),r=URL.createObjectURL(await n.blob());return new Fb.default(r)}const Ub=Object.freeze(Object.defineProperty({__proto__:null,AsyncDuckDB:_b,AsyncDuckDBConnection:nu,AsyncDuckDBDispatcher:wb,AsyncPreparedStatement:ru,AsyncResultStreamIterator:zs,ConsoleLogger:fb,DuckDBAccessMode:Kc,DuckDBDataProtocol:ou,LogEvent:Zc,LogLevel:Xc,LogOrigin:tu,LogTopic:Jc,PACKAGE_NAME:au,PACKAGE_VERSION:lu,PACKAGE_VERSION_MAJOR:Ab,PACKAGE_VERSION_MINOR:Nb,PACKAGE_VERSION_PATCH:Rb,StatusCode:eu,TokenType:Qc,VoidLogger:db,WorkerRequestType:iu,WorkerResponseType:su,WorkerTask:Z,createWorker:Mb,getJsDelivrBundles:Db,getLogEventLabel:yb,getLogLevelLabel:pb,getLogOriginLabel:gb,getLogTopicLabel:mb,getPlatformFeatures:uu,isFirefox:Bb,isNode:Gs,isSafari:Ob,selectBundle:Lb},Symbol.toStringTag,{value:"Module"}));Qt.DataExplorer=Ty,Qt.UMAP=Ry,Object.defineProperty(Qt,Symbol.toStringTag,{value:"Module"})}));
|