sqlmesh 0.181.2.dev7__py3-none-any.whl → 0.181.2.dev9__py3-none-any.whl

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.
Files changed (52) hide show
  1. sqlmesh/_version.py +2 -2
  2. sqlmesh/lsp/api.py +61 -0
  3. sqlmesh/lsp/main.py +25 -0
  4. {sqlmesh-0.181.2.dev7.dist-info → sqlmesh-0.181.2.dev9.dist-info}/METADATA +1 -1
  5. {sqlmesh-0.181.2.dev7.dist-info → sqlmesh-0.181.2.dev9.dist-info}/RECORD +51 -50
  6. web/client/dist/assets/{Audits-4U9LnWyN.js → Audits-DRkR6sg0.js} +1 -1
  7. web/client/dist/assets/{Banner-DfF4HK9_.js → Banner-BXisqtMu.js} +1 -1
  8. web/client/dist/assets/{ChevronDownIcon-DhkdL7W7.js → ChevronDownIcon-D8CFPQ96.js} +1 -1
  9. web/client/dist/assets/{ChevronRightIcon-CknBR_Ye.js → ChevronRightIcon-BpRv8ZN4.js} +1 -1
  10. web/client/dist/assets/{Content-T59G6CRd.js → Content-KG4KSDDO.js} +1 -1
  11. web/client/dist/assets/{Content-DfnWzoRW.js → Content-pMJLtxGr.js} +1 -1
  12. web/client/dist/assets/{Data-Dvs4EVTS.js → Data-D-rZnh8x.js} +1 -1
  13. web/client/dist/assets/{DataCatalog-CsA-vDbc.js → DataCatalog-BJTDeU-_.js} +1 -1
  14. web/client/dist/assets/{Editor-DsU0OwIl.js → Editor-C8-1rqZ2.js} +1 -1
  15. web/client/dist/assets/{Editor-DgIo0RbF.js → Editor-Cpn7iBcm.js} +1 -1
  16. web/client/dist/assets/{Errors-BOLt2obm.js → Errors-DyDRdQyq.js} +1 -1
  17. web/client/dist/assets/{FileExplorer-CIj2pM9u.js → FileExplorer-CmdsG4yG.js} +3 -3
  18. web/client/dist/assets/{Footer--bTxQCKB.js → Footer-D4ok48Gm.js} +1 -1
  19. web/client/dist/assets/{Header-DmcDkHFL.js → Header-BVwdhMQQ.js} +1 -1
  20. web/client/dist/assets/{Input-CJirBrKe.js → Input-CxOCLTNw.js} +1 -1
  21. web/client/dist/assets/Lineage-ZXdxdqzl.js +1 -0
  22. web/client/dist/assets/{ListboxShow-C0DBUX71.js → ListboxShow-YBO3HIHQ.js} +1 -1
  23. web/client/dist/assets/{ModelLineage-B8hv0xJ-.js → ModelLineage-BFuK5Bgk.js} +1 -1
  24. web/client/dist/assets/{Models-CCm5MLTD.js → Models-Dn2xoUA7.js} +1 -1
  25. web/client/dist/assets/{Page-WrN3RYDT.js → Page-kOwPk8A6.js} +1 -1
  26. web/client/dist/assets/{Plan-CFJZVnkR.js → Plan-BQe3-3RL.js} +1 -1
  27. web/client/dist/assets/{PlusCircleIcon-CcC2lSkc.js → PlusCircleIcon-CXYicjof.js} +1 -1
  28. web/client/dist/assets/{ReportErrors-BK8N5y1z.js → ReportErrors-DaAC3YF4.js} +1 -1
  29. web/client/dist/assets/{Root-DSGcTlxk.js → Root-BIGZcS_U.js} +1 -1
  30. web/client/dist/assets/{SearchList-B9NnvRod.js → SearchList-Lag39srv.js} +1 -1
  31. web/client/dist/assets/{SelectEnvironment-CJsiOTlU.js → SelectEnvironment-0MCV04NI.js} +1 -1
  32. web/client/dist/assets/{SourceList-FVjgH2xJ.js → SourceList-CTL41Fia.js} +1 -1
  33. web/client/dist/assets/{SourceListItem-BDqqo5jo.js → SourceListItem-6mIYlySR.js} +1 -1
  34. web/client/dist/assets/{SplitPane-BSlIdmc8.js → SplitPane-7_khUxNG.js} +1 -1
  35. web/client/dist/assets/{Tests-DAbOEH7t.js → Tests-DSsKelgd.js} +1 -1
  36. web/client/dist/assets/{Welcome-c37SRGFq.js → Welcome-C0F3fb3h.js} +1 -1
  37. web/client/dist/assets/{context-APidk_GA.js → context-B0V9EzWJ.js} +13 -13
  38. web/client/dist/assets/{context-DmjvuTWz.js → context-pytQSsK4.js} +1 -1
  39. web/client/dist/assets/{editor-B2GioI_r.js → editor-CmeEFdEz.js} +1 -1
  40. web/client/dist/assets/{file-C7afm_LM.js → file-DY5SRTK1.js} +1 -1
  41. web/client/dist/assets/{help-C_umCstj.js → help-Bm8ph9oI.js} +1 -1
  42. web/client/dist/assets/{index-CK4fdw8q.js → index-BWibl-Ee.js} +1 -1
  43. web/client/dist/assets/{index-COnjINWU.js → index-C22hdM_h.js} +2 -2
  44. web/client/dist/assets/{plan-BwAtu9hd.js → plan-BUTy2uM-.js} +1 -1
  45. web/client/dist/assets/{project-CWUUCZWT.js → project-CtAE3tsj.js} +1 -1
  46. web/client/dist/assets/{transition-DjPYSO2n.js → transition-CiMBgn_Y.js} +1 -1
  47. web/client/dist/index.html +1 -1
  48. web/client/dist/assets/Lineage-BbLp8RL_.js +0 -1
  49. {sqlmesh-0.181.2.dev7.dist-info → sqlmesh-0.181.2.dev9.dist-info}/WHEEL +0 -0
  50. {sqlmesh-0.181.2.dev7.dist-info → sqlmesh-0.181.2.dev9.dist-info}/entry_points.txt +0 -0
  51. {sqlmesh-0.181.2.dev7.dist-info → sqlmesh-0.181.2.dev9.dist-info}/licenses/LICENSE +0 -0
  52. {sqlmesh-0.181.2.dev7.dist-info → sqlmesh-0.181.2.dev9.dist-info}/top_level.txt +0 -0
@@ -79,7 +79,7 @@ Error generating stack: `+f.message+`
79
79
  */function go(){return go=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=t[s])}return n},go.apply(this,arguments)}function Qg(n,e){if(n==null)return{};var t={},s=Object.keys(n),a,u;for(u=0;u<s.length;u++)a=s[u],!(e.indexOf(a)>=0)&&(t[a]=n[a]);return t}function K1(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Y1(n,e){return n.button===0&&(!e||e==="_self")&&!K1(n)}const G1=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],J1=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],X1="6";try{window.__reactRouterVersion=X1}catch{}function Z1(n,e){return l1({basename:e==null?void 0:e.basename,future:go({},e==null?void 0:e.future,{v7_prependBasename:!0}),history:M_({window:e==null?void 0:e.window}),hydrationData:(e==null?void 0:e.hydrationData)||eb(),routes:n,mapRouteProperties:q1,dataStrategy:e==null?void 0:e.dataStrategy,patchRoutesOnNavigation:e==null?void 0:e.patchRoutesOnNavigation,window:e==null?void 0:e.window}).initialize()}function eb(){var n;let e=(n=window)==null?void 0:n.__staticRouterHydrationData;return e&&e.errors&&(e=go({},e,{errors:tb(e.errors)})),e}function tb(n){if(!n)return null;let e=Object.entries(n),t={};for(let[s,a]of e)if(a&&a.__type==="RouteErrorResponse")t[s]=new Eu(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let u=window[a.__subType];if(typeof u=="function")try{let d=new u(a.message);d.stack="",t[s]=d}catch{}}if(t[s]==null){let u=new Error(a.message);u.stack="",t[s]=u}}else t[s]=a;return t}const Hg=N.createContext({isTransitioning:!1}),nb=N.createContext(new Map),rb="startTransition",by=PS[rb],ib="flushSync",Iy=d_[ib];function sb(n){by?by(n):n()}function Sa(n){Iy?Iy(n):n()}class ob{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=s=>{this.status==="pending"&&(this.status="resolved",e(s))},this.reject=s=>{this.status==="pending"&&(this.status="rejected",t(s))}})}}function ab(n){let{fallbackElement:e,router:t,future:s}=n,[a,u]=N.useState(t.state),[d,h]=N.useState(),[p,y]=N.useState({isTransitioning:!1}),[g,v]=N.useState(),[S,I]=N.useState(),[T,A]=N.useState(),M=N.useRef(new Map),{v7_startTransition:K}=s||{},W=N.useCallback(V=>{K?sb(V):V()},[K]),Y=N.useCallback((V,pe)=>{let{deletedFetchers:ue,flushSync:Ye,viewTransitionOpts:We}=pe;V.fetchers.forEach((dt,Tt)=>{dt.data!==void 0&&M.current.set(Tt,dt.data)}),ue.forEach(dt=>M.current.delete(dt));let Xe=t.window==null||t.window.document==null||typeof t.window.document.startViewTransition!="function";if(!We||Xe){Ye?Sa(()=>u(V)):W(()=>u(V));return}if(Ye){Sa(()=>{S&&(g&&g.resolve(),S.skipTransition()),y({isTransitioning:!0,flushSync:!0,currentLocation:We.currentLocation,nextLocation:We.nextLocation})});let dt=t.window.document.startViewTransition(()=>{Sa(()=>u(V))});dt.finished.finally(()=>{Sa(()=>{v(void 0),I(void 0),h(void 0),y({isTransitioning:!1})})}),Sa(()=>I(dt));return}S?(g&&g.resolve(),S.skipTransition(),A({state:V,currentLocation:We.currentLocation,nextLocation:We.nextLocation})):(h(V),y({isTransitioning:!0,flushSync:!1,currentLocation:We.currentLocation,nextLocation:We.nextLocation}))},[t.window,S,g,M,W]);N.useLayoutEffect(()=>t.subscribe(Y),[t,Y]),N.useEffect(()=>{p.isTransitioning&&!p.flushSync&&v(new ob)},[p]),N.useEffect(()=>{if(g&&d&&t.window){let V=d,pe=g.promise,ue=t.window.document.startViewTransition(async()=>{W(()=>u(V)),await pe});ue.finished.finally(()=>{v(void 0),I(void 0),h(void 0),y({isTransitioning:!1})}),I(ue)}},[W,d,g,t.window]),N.useEffect(()=>{g&&d&&a.location.key===d.location.key&&g.resolve()},[g,S,a.location,d]),N.useEffect(()=>{!p.isTransitioning&&T&&(h(T.state),y({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}),A(void 0))},[p.isTransitioning,T]),N.useEffect(()=>{},[]);let q=N.useMemo(()=>({createHref:t.createHref,encodeLocation:t.encodeLocation,go:V=>t.navigate(V),push:(V,pe,ue)=>t.navigate(V,{state:pe,preventScrollReset:ue==null?void 0:ue.preventScrollReset}),replace:(V,pe,ue)=>t.navigate(V,{replace:!0,state:pe,preventScrollReset:ue==null?void 0:ue.preventScrollReset})}),[t]),ce=t.basename||"/",Z=N.useMemo(()=>({router:t,navigator:q,static:!1,basename:ce}),[t,q,ce]),x=N.useMemo(()=>({v7_relativeSplatPath:t.future.v7_relativeSplatPath}),[t.future.v7_relativeSplatPath]);return N.useEffect(()=>Q1(s,t.future),[s,t.future]),N.createElement(N.Fragment,null,N.createElement(za.Provider,{value:Z},N.createElement($f.Provider,{value:a},N.createElement(nb.Provider,{value:M.current},N.createElement(Hg.Provider,{value:p},N.createElement(H1,{basename:ce,location:a.location,navigationType:a.historyAction,navigator:q,future:x},a.initialized||t.future.v7_partialHydration?N.createElement(lb,{routes:t.routes,future:t.future,state:a}):e))))),null)}const lb=N.memo(ub);function ub(n){let{routes:e,future:t,state:s}=n;return A1(e,void 0,s,t)}const cb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",db=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qg=N.forwardRef(function(e,t){let{onClick:s,relative:a,reloadDocument:u,replace:d,state:h,target:p,to:y,preventScrollReset:g,viewTransition:v}=e,S=Qg(e,G1),{basename:I}=N.useContext(Qi),T,A=!1;if(typeof y=="string"&&db.test(y)&&(T=y,cb))try{let Y=new URL(window.location.href),q=y.startsWith("//")?new URL(Y.protocol+y):new URL(y),ce=ni(q.pathname,I);q.origin===Y.origin&&ce!=null?y=ce+q.search+q.hash:A=!0}catch{}let M=O1(y,{relative:a}),K=hb(y,{replace:d,state:h,target:p,preventScrollReset:g,relative:a,viewTransition:v});function W(Y){s&&s(Y),Y.defaultPrevented||K(Y)}return N.createElement("a",go({},S,{href:T||M,onClick:A||u?s:W,ref:t,target:p}))}),wD=N.forwardRef(function(e,t){let{"aria-current":s="page",caseSensitive:a=!1,className:u="",end:d=!1,style:h,to:p,viewTransition:y,children:g}=e,v=Qg(e,J1),S=ic(p,{relative:v.relative}),I=$a(),T=N.useContext($f),{navigator:A,basename:M}=N.useContext(Qi),K=T!=null&&pb(S)&&y===!0,W=A.encodeLocation?A.encodeLocation(S).pathname:S.pathname,Y=I.pathname,q=T&&T.navigation&&T.navigation.location?T.navigation.location.pathname:null;a||(Y=Y.toLowerCase(),q=q?q.toLowerCase():null,W=W.toLowerCase()),q&&M&&(q=ni(q,M)||q);const ce=W!=="/"&&W.endsWith("/")?W.length-1:W.length;let Z=Y===W||!d&&Y.startsWith(W)&&Y.charAt(ce)==="/",x=q!=null&&(q===W||!d&&q.startsWith(W)&&q.charAt(W.length)==="/"),V={isActive:Z,isPending:x,isTransitioning:K},pe=Z?s:void 0,ue;typeof u=="function"?ue=u(V):ue=[u,Z?"active":null,x?"pending":null,K?"transitioning":null].filter(Boolean).join(" ");let Ye=typeof h=="function"?h(V):h;return N.createElement(qg,go({},v,{"aria-current":pe,className:ue,ref:t,style:Ye,to:p,viewTransition:y}),typeof g=="function"?g(V):g)});var Sf;(function(n){n.UseScrollRestoration="useScrollRestoration",n.UseSubmit="useSubmit",n.UseSubmitFetcher="useSubmitFetcher",n.UseFetcher="useFetcher",n.useViewTransitionState="useViewTransitionState"})(Sf||(Sf={}));var Ey;(function(n){n.UseFetcher="useFetcher",n.UseFetchers="useFetchers",n.UseScrollRestoration="useScrollRestoration"})(Ey||(Ey={}));function fb(n){let e=N.useContext(za);return e||Ne(!1),e}function hb(n,e){let{target:t,replace:s,state:a,preventScrollReset:u,relative:d,viewTransition:h}=e===void 0?{}:e,p=R1(),y=$a(),g=ic(n,{relative:d});return N.useCallback(v=>{if(Y1(v,t)){v.preventDefault();let S=s!==void 0?s:Es(y)===Es(g);p(n,{replace:S,state:a,preventScrollReset:u,relative:d,viewTransition:h})}},[y,p,g,s,a,t,n,u,d,h])}function pb(n,e){e===void 0&&(e={});let t=N.useContext(Hg);t==null&&Ne(!1);let{basename:s}=fb(Sf.useViewTransitionState),a=ic(n,{relative:e.relative});if(!t.isTransitioning)return!1;let u=ni(t.currentLocation.pathname,s)||t.currentLocation.pathname,d=ni(t.nextLocation.pathname,s)||t.nextLocation.pathname;return Iu(a.pathname,d)!=null||Iu(a.pathname,u)!=null}function Kg(n){var e,t,s="";if(typeof n=="string"||typeof n=="number")s+=n;else if(typeof n=="object")if(Array.isArray(n)){var a=n.length;for(e=0;e<a;e++)n[e]&&(t=Kg(n[e]))&&(s&&(s+=" "),s+=t)}else for(t in n)n[t]&&(s&&(s+=" "),s+=t);return s}function Tr(){for(var n,e,t=0,s="",a=arguments.length;t<a;t++)(n=arguments[t])&&(e=Kg(n))&&(s&&(s+=" "),s+=e);return s}const Rt={xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},it={Primary:"primary",Alternative:"alternative",Secondary:"secondary",Success:"success",Danger:"danger",Warning:"warning",Info:"info",Neutral:"neutral"},SD={Left:"left",Right:"right"},xy=new Map([[Rt.sm,""],[Rt.md,"-2"],[Rt.lg,"-4"]]);function Dy({size:n=Rt.sm,orientation:e="horizontal",className:t}){return B.jsx("span",{className:Tr(["block border-divider",e==="horizontal"&&`w-full border-b${xy.get(n)??""}`,e==="vertical"&&`h-full border-r${xy.get(n)??""}`],t)})}const Yg=function({children:e}){return B.jsx(B.Fragment,{children:e})};function mb({children:n,layout:e="vertical"}){return B.jsx("div",{className:Tr("font-sans w-full h-full flex overflow-hidden",e==="horizontal"?"flex-row":"flex-col"),children:n})}Yg.Page=mb;const _D={Circle:"circle"},bD={Ghost:"ghost"},yb=new Map([["primary","border-primary-500 bg-primary-500 hover:bg-primary-400 active:bg-primary-400 text-light"],["alternative","border-neutral-300 bg-neutral-5 hover:bg-neutral-20 active:bg-neutral-200 text-neutral-600"],["secondary","border-secondary-500 bg-secondary-500 hover:bg-secondary-600 active:bg-secondary-400 text-neutral-100"],["success","border-success-500 bg-success-500 hover:bg-success-600 active:bg-success-400 text-neutral-100"],["danger","border-danger-500 bg-danger-500 hover:bg-danger-600 active:bg-danger-400 text-neutral-100"],["warning","border-warning-500 bg-warning-500 hover:bg-warning-600 active:bg-warning-400 text-neutral-100"],["neutral","border-neutral-200 bg-neutral-200 hover:bg-neutral-300 active:bg-neutral-300 text-primary-900"],["info","border-transparent bg-neutral-10 dark:bg-neutral-20 active:bg-neutral-10 text-neutral-700 dark:text-neutral-200"]]),gb=new Map([["rounded","rounded-md"],["square","rounded-none"],["circle","rounded-full"]]),vb=new Map([[Rt.xs,"text-xs leading-2 border"],[Rt.sm,"px-2 py-[0.125rem] text-xs leading-4 border-2"],[Rt.md,"px-3 py-2 text-base leading-6 border-2"],[Rt.lg,"px-4 py-3 text-lg border-4"]]),ID=Gg(Do.forwardRef(Sb)),wb=Gg(Do.forwardRef(_b));function Sb({type:n="button",disabled:e=!1,children:t=[],form:s,autoFocus:a,tabIndex:u,onClick:d,className:h},p){return B.jsx("button",{ref:p,type:n,autoFocus:a,tabIndex:u,form:s,disabled:e,onClick:d,onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),d==null||d(y))},className:h,children:t})}function _b({children:n=[],autoFocus:e,tabIndex:t,className:s},a){return B.jsx("div",{ref:a,autoFocus:e,tabIndex:t,className:s,children:n})}function Gg(n){return Do.forwardRef(function({type:t="button",disabled:s=!1,variant:a="primary",shape:u="rounded",size:d=Rt.md,children:h=[],className:p,form:y,autoFocus:g,tabIndex:v,onClick:S},I){return B.jsx(n,{ref:I,type:t,disabled:s,form:y,autoFocus:g,tabIndex:v,onClick:S,className:Tr("whitespace-nowrap flex m-1 items-center justify-center font-bold","focus:ring-4 focus:outline-none focus:border-secondary-500","ring-secondary-300 ring-opacity-60 ring-offset ring-offset-secondary-100",gb.get(u),vb.get(d),s?"opacity-50 bg-neutral-10 dark:bg-neutral-20 border-transparent text-prose cursor-not-allowed":yb.get(a),p),children:h})})}function pn({description:n,link:e,headline:t="Not Found",message:s="Go Back Home"}){return B.jsx(Yg.Page,{children:B.jsx("div",{className:"flex items-center justify-center w-full h-full",children:B.jsxs("div",{className:"text-center",children:[B.jsx("h1",{className:"text-[4rem] md:text-[6rem] lg:text-[9rem] text-secondary-10 dark:text-primary-10 mb-4",children:t}),sn(n)&&B.jsx("p",{className:"mb-10 py-5 px-4 text-neutral-70 dark:text-primary-70 w-full bg-primary-10 rounded-md",children:n}),sn(e)&&B.jsx("div",{className:"inline-block",children:B.jsx(wb,{variant:it.Alternative,children:B.jsx(qg,{to:e,children:s})})})]})})})}function ms({style:n,className:e,variant:t=it.Info}){return B.jsxs("svg",{style:n,className:Tr("animate-spin bg-transparent rounded-full",e),viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg","aria-label":"Loading",role:"img",children:[B.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 59.7128C31.3054 68.5494 50.8763 63.3054 59.7128 48C68.5494 32.6946 63.3054 13.1237 48 4.28719C32.6946 -4.54937 13.1237 0.694636 4.28719 16C-4.54937 31.3054 0.694637 50.8763 16 59.7128ZM23 47.5885C31.6093 52.559 42.6179 49.6093 47.5885 41C52.559 32.3907 49.6093 21.3821 41 16.4115C32.3907 11.441 21.3821 14.3907 16.4115 23C11.441 31.6093 14.3907 42.6179 23 47.5885Z",className:"fill-theme-lighter"}),B.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.5827 26.5161C49.2259 21.9157 46.1691 17.8082 41.6875 15.2208C37.4263 12.7606 32.6191 12.103 28.1488 13.0114L25.1365 1.76921C32.4854 0.0988895 40.4586 1.08788 47.5 5.15321C54.7617 9.34574 59.6854 16.0326 61.8138 23.5067L50.5827 26.5161Z",className:Tr(t===it.Primary&&"fill-primary-500",t===it.Secondary&&"fill-secondary-500",t===it.Success&&"fill-success-500",t===it.Warning&&"fill-warning-500",t===it.Danger&&"fill-danger-500",t===it.Info&&"fill-neutral-500"),stroke:Tr(t===it.Primary&&"var(--color-primary-500)",t===it.Secondary&&"var(--color-secondary-500)",t===it.Success&&"var(--color-success-500)",t===it.Warning&&"var(--color-warning-500)",t===it.Danger&&"var(--color-danger-500)",t===it.Info&&"var(--color-neutral-500)"),strokeWidth:"4"})]})}function bb({as:n="p",size:e=Rt.sm,variant:t=it.Info,text:s,className:a}){const u=n;return B.jsx(u,{className:Tr("font-bold whitespace-nowrap",t===it.Primary&&"text-primary-600 dark:text-primary-400",t===it.Secondary&&"text-secondary-600 dark:text-secondary-400",t===it.Success&&"text-success-600 dark:text-success-400",t===it.Warning&&"text-warning-600 dark:text-warning-400",t===it.Danger&&"text-danger-600 dark:text-danger-400",t===it.Info&&"text-neutral-600 dark:text-neutral-400",e===Rt.xs&&"text-xs",e===Rt.sm&&"text-md",e===Rt.md&&"text-lg",e===Rt.lg&&"text-2xl",e===Rt.xl&&"text-4xl",a),children:s})}function ro({hasSpinner:n=!1,size:e=Rt.sm,variant:t=it.Info,text:s,children:a,className:u}){return B.jsx("span",{className:Tr(t===it.Primary&&"text-primary-600 dark:text-primary-400",t===it.Secondary&&"text-secondary-600 dark:text-secondary-400",t===it.Success&&"text-success-600 dark:text-success-400",t===it.Warning&&"text-warning-600 dark:text-warning-400",t===it.Danger&&"text-danger-600 dark:text-danger-400",t===it.Info&&"text-neutral-600 dark:text-neutral-400",u),children:B.jsxs("span",{className:"flex items-center w-full",children:[n&&B.jsx(ms,{variant:t,className:Tr(e===Rt.xs&&"w-2 h-2 mr-2",e===Rt.sm&&"w-3 h-3 mr-2",e===Rt.md&&"w-4 h-4 mr-2",e===Rt.lg&&"w-5 h-5 mr-4",e===Rt.xl&&"w-6 h-6 mr-4")}),sn(s)?B.jsx(bb,{size:e,variant:t,text:s}):a]})})}var Cy=function(){return Cy=Object.assign||function(e){for(var t,s=1,a=arguments.length;s<a;s++){t=arguments[s];for(var u in t)Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u])}return e},Cy.apply(this,arguments)};function ED(n,e){var t={};for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.indexOf(s)<0&&(t[s]=n[s]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(n);a<s.length;a++)e.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(n,s[a])&&(t[s[a]]=n[s[a]]);return t}function ve(n,e,t,s){function a(u){return u instanceof t?u:new t(function(d){d(u)})}return new(t||(t=Promise))(function(u,d){function h(g){try{y(s.next(g))}catch(v){d(v)}}function p(g){try{y(s.throw(g))}catch(v){d(v)}}function y(g){g.done?u(g.value):a(g.value).then(h,p)}y((s=s.apply(n,e||[])).next())})}function Oy(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],s=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&s>=n.length&&(n=void 0),{value:n&&n[s++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function xD(n,e,t){if(t||arguments.length===2)for(var s=0,a=e.length,u;s<a;s++)(u||!(s in e))&&(u||(u=Array.prototype.slice.call(e,0,s)),u[s]=e[s]);return n.concat(u||Array.prototype.slice.call(e))}function Te(n){return this instanceof Te?(this.v=n,this):new Te(n)}function Fr(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=t.apply(n,e||[]),a,u=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),h("next"),h("throw"),h("return",d),a[Symbol.asyncIterator]=function(){return this},a;function d(I){return function(T){return Promise.resolve(T).then(I,v)}}function h(I,T){s[I]&&(a[I]=function(A){return new Promise(function(M,K){u.push([I,A,M,K])>1||p(I,A)})},T&&(a[I]=T(a[I])))}function p(I,T){try{y(s[I](T))}catch(A){S(u[0][3],A)}}function y(I){I.value instanceof Te?Promise.resolve(I.value.v).then(g,v):S(u[0][2],I)}function g(I){p("next",I)}function v(I){p("throw",I)}function S(I,T){I(T),u.shift(),u.length&&p(u[0][0],u[0][1])}}function fu(n){var e,t;return e={},s("next"),s("throw",function(a){throw a}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(a,u){e[a]=n[a]?function(d){return(t=!t)?{value:Te(n[a](d)),done:!1}:u?u(d):d}:u}}function uo(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Oy=="function"?Oy(n):n[Symbol.iterator](),t={},s("next"),s("throw"),s("return"),t[Symbol.asyncIterator]=function(){return this},t);function s(u){t[u]=n[u]&&function(d){return new Promise(function(h,p){d=n[u](d),a(h,p,d.done,d.value)})}}function a(u,d,h,p){Promise.resolve(p).then(function(y){u({value:y,done:h})},d)}}const Ib=new TextDecoder("utf-8"),_f=n=>Ib.decode(n),Eb=new TextEncoder,Qf=n=>Eb.encode(n),xb=n=>typeof n=="number",Db=n=>typeof n=="boolean",rn=n=>typeof n=="function",ir=n=>n!=null&&Object(n)===n,Ma=n=>ir(n)&&rn(n.then),sc=n=>ir(n)&&rn(n[Symbol.iterator]),Hf=n=>ir(n)&&rn(n[Symbol.asyncIterator]),bf=n=>ir(n)&&ir(n.schema),Jg=n=>ir(n)&&"done"in n&&"value"in n,Xg=n=>ir(n)&&rn(n.stat)&&xb(n.fd),Zg=n=>ir(n)&&qf(n.body),ev=n=>"_getDOMStream"in n&&"_getNodeStream"in n,qf=n=>ir(n)&&rn(n.cancel)&&rn(n.getReader)&&!ev(n),tv=n=>ir(n)&&rn(n.read)&&rn(n.pipe)&&Db(n.readable)&&!ev(n),Cb=n=>ir(n)&&rn(n.clear)&&rn(n.bytes)&&rn(n.position)&&rn(n.setPosition)&&rn(n.capacity)&&rn(n.getBufferIdentifier)&&rn(n.createLong),Kf=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ob(n){const e=n[0]?[n[0]]:[];let t,s,a,u;for(let d,h,p=0,y=0,g=n.length;++p<g;){if(d=e[y],h=n[p],!d||!h||d.buffer!==h.buffer||h.byteOffset<d.byteOffset){h&&(e[++y]=h);continue}if({byteOffset:t,byteLength:a}=d,{byteOffset:s,byteLength:u}=h,t+a<s||s+u<t){h&&(e[++y]=h);continue}e[y]=new Uint8Array(d.buffer,t,s-t+u)}return e}function Ry(n,e,t=0,s=e.byteLength){const a=n.byteLength,u=new Uint8Array(n.buffer,n.byteOffset,a),d=new Uint8Array(e.buffer,e.byteOffset,Math.min(s,a));return u.set(d,t),n}function Mr(n,e){const t=Ob(n),s=t.reduce((g,v)=>g+v.byteLength,0);let a,u,d,h=0,p=-1;const y=Math.min(e||Number.POSITIVE_INFINITY,s);for(const g=t.length;++p<g;){if(a=t[p],u=a.subarray(0,Math.min(a.length,y-h)),y<=h+u.length){u.length<a.length?t[p]=a.subarray(u.length):u.length===a.length&&p++,d?Ry(d,u,h):d=u;break}Ry(d||(d=new Uint8Array(y)),u,h),h+=u.length}return[d||new Uint8Array(0),t.slice(p),s-(d?d.byteLength:0)]}function ut(n,e){let t=Jg(e)?e.value:e;return t instanceof n?n===Uint8Array?new n(t.buffer,t.byteOffset,t.byteLength):t:t?(typeof t=="string"&&(t=Qf(t)),t instanceof ArrayBuffer?new n(t):t instanceof Kf?new n(t):Cb(t)?ut(n,t.bytes()):ArrayBuffer.isView(t)?t.byteLength<=0?new n(0):new n(t.buffer,t.byteOffset,t.byteLength/n.BYTES_PER_ELEMENT):n.from(t)):new n(0)}const _a=n=>ut(Int32Array,n),Ge=n=>ut(Uint8Array,n),If=n=>(n.next(),n);function*Rb(n,e){const t=function*(a){yield a},s=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Kf?t(e):sc(e)?e:t(e);return yield*If(function*(a){let u=null;do u=a.next(yield ut(n,u));while(!u.done)}(s[Symbol.iterator]())),new n}const Fb=n=>Rb(Uint8Array,n);function nv(n,e){return Fr(this,arguments,function*(){if(Ma(e))return yield Te(yield Te(yield*fu(uo(nv(n,yield Te(e))))));const s=function(d){return Fr(this,arguments,function*(){yield yield Te(yield Te(d))})},a=function(d){return Fr(this,arguments,function*(){yield Te(yield*fu(uo(If(function*(h){let p=null;do p=h.next(yield p==null?void 0:p.value);while(!p.done)}(d[Symbol.iterator]())))))})},u=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Kf?s(e):sc(e)?a(e):Hf(e)?e:s(e);return yield Te(yield*fu(uo(If(function(d){return Fr(this,arguments,function*(){let h=null;do h=yield Te(d.next(yield yield Te(ut(n,h))));while(!h.done)})}(u[Symbol.asyncIterator]()))))),yield Te(new n)})}const Tb=n=>nv(Uint8Array,n);function Mb(n,e){let t=0;const s=n.length;if(s!==e.length)return!1;if(s>0)do if(n[t]!==e[t])return!1;while(++t<s);return!0}const kn={fromIterable(n){return au(Ab(n))},fromAsyncIterable(n){return au(Pb(n))},fromDOMStream(n){return au(Nb(n))},fromNodeStream(n){return au(Bb(n))},toDOMStream(n,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(n,e){throw new Error('"toNodeStream" not available in this environment')}},au=n=>(n.next(),n);function*Ab(n){let e,t=!1,s=[],a,u,d,h=0;function p(){return u==="peek"?Mr(s,d)[0]:([a,s,h]=Mr(s,d),a)}({cmd:u,size:d}=yield null);const y=Fb(n)[Symbol.iterator]();try{do if({done:e,value:a}=Number.isNaN(d-h)?y.next():y.next(d-h),!e&&a.byteLength>0&&(s.push(a),h+=a.byteLength),e||d<=h)do({cmd:u,size:d}=yield p());while(d<h);while(!e)}catch(g){(t=!0)&&typeof y.throw=="function"&&y.throw(g)}finally{t===!1&&typeof y.return=="function"&&y.return(null)}return null}function Pb(n){return Fr(this,arguments,function*(){let t,s=!1,a=[],u,d,h,p=0;function y(){return d==="peek"?Mr(a,h)[0]:([u,a,p]=Mr(a,h),u)}({cmd:d,size:h}=yield yield Te(null));const g=Tb(n)[Symbol.asyncIterator]();try{do if({done:t,value:u}=Number.isNaN(h-p)?yield Te(g.next()):yield Te(g.next(h-p)),!t&&u.byteLength>0&&(a.push(u),p+=u.byteLength),t||h<=p)do({cmd:d,size:h}=yield yield Te(y()));while(h<p);while(!t)}catch(v){(s=!0)&&typeof g.throw=="function"&&(yield Te(g.throw(v)))}finally{s===!1&&typeof g.return=="function"&&(yield Te(g.return(new Uint8Array(0))))}return yield Te(null)})}function Nb(n){return Fr(this,arguments,function*(){let t=!1,s=!1,a=[],u,d,h,p=0;function y(){return d==="peek"?Mr(a,h)[0]:([u,a,p]=Mr(a,h),u)}({cmd:d,size:h}=yield yield Te(null));const g=new Lb(n);try{do if({done:t,value:u}=Number.isNaN(h-p)?yield Te(g.read()):yield Te(g.read(h-p)),!t&&u.byteLength>0&&(a.push(Ge(u)),p+=u.byteLength),t||h<=p)do({cmd:d,size:h}=yield yield Te(y()));while(h<p);while(!t)}catch(v){(s=!0)&&(yield Te(g.cancel(v)))}finally{s===!1?yield Te(g.cancel()):n.locked&&g.releaseLock()}return yield Te(null)})}class Lb{constructor(e){this.source=e,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(e){return ve(this,void 0,void 0,function*(){const{reader:t,source:s}=this;t&&(yield t.cancel(e).catch(()=>{})),s&&s.locked&&this.releaseLock()})}read(e){return ve(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const t=yield this.reader.read();return!t.done&&(t.value=Ge(t)),t})}}const nf=(n,e)=>{const t=a=>s([e,a]);let s;return[e,t,new Promise(a=>(s=a)&&n.once(e,t))]};function Bb(n){return Fr(this,arguments,function*(){const t=[];let s="error",a=!1,u=null,d,h,p=0,y=[],g;function v(){return d==="peek"?Mr(y,h)[0]:([g,y,p]=Mr(y,h),g)}if({cmd:d,size:h}=yield yield Te(null),n.isTTY)return yield yield Te(new Uint8Array(0)),yield Te(null);try{t[0]=nf(n,"end"),t[1]=nf(n,"error");do{if(t[2]=nf(n,"readable"),[s,u]=yield Te(Promise.race(t.map(I=>I[2]))),s==="error")break;if((a=s==="end")||(Number.isFinite(h-p)?(g=Ge(n.read(h-p)),g.byteLength<h-p&&(g=Ge(n.read()))):g=Ge(n.read()),g.byteLength>0&&(y.push(g),p+=g.byteLength)),a||h<=p)do({cmd:d,size:h}=yield yield Te(v()));while(h<p)}while(!a)}finally{yield Te(S(t,s==="error"?u:null))}return yield Te(null);function S(I,T){return g=y=null,new Promise((A,M)=>{for(const[K,W]of I)n.off(K,W);try{const K=n.destroy;K&&K.call(n,T),T=void 0}catch(K){T=K||T}finally{T!=null?M(T):A()}})}})}var Vn;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(Vn||(Vn={}));var sr;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(sr||(sr={}));var wn;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(wn||(wn={}));var ri;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(ri||(ri={}));var Ke;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(Ke||(Ke={}));var ji;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(ji||(ji={}));var st;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(st||(st={}));var O;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.Float=3]="Float",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct=13]="Struct",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Dictionary=-1]="Dictionary",n[n.Int8=-2]="Int8",n[n.Int16=-3]="Int16",n[n.Int32=-4]="Int32",n[n.Int64=-5]="Int64",n[n.Uint8=-6]="Uint8",n[n.Uint16=-7]="Uint16",n[n.Uint32=-8]="Uint32",n[n.Uint64=-9]="Uint64",n[n.Float16=-10]="Float16",n[n.Float32=-11]="Float32",n[n.Float64=-12]="Float64",n[n.DateDay=-13]="DateDay",n[n.DateMillisecond=-14]="DateMillisecond",n[n.TimestampSecond=-15]="TimestampSecond",n[n.TimestampMillisecond=-16]="TimestampMillisecond",n[n.TimestampMicrosecond=-17]="TimestampMicrosecond",n[n.TimestampNanosecond=-18]="TimestampNanosecond",n[n.TimeSecond=-19]="TimeSecond",n[n.TimeMillisecond=-20]="TimeMillisecond",n[n.TimeMicrosecond=-21]="TimeMicrosecond",n[n.TimeNanosecond=-22]="TimeNanosecond",n[n.DenseUnion=-23]="DenseUnion",n[n.SparseUnion=-24]="SparseUnion",n[n.IntervalDayTime=-25]="IntervalDayTime",n[n.IntervalYearMonth=-26]="IntervalYearMonth"})(O||(O={}));var qr;(function(n){n[n.OFFSET=0]="OFFSET",n[n.DATA=1]="DATA",n[n.VALIDITY=2]="VALIDITY",n[n.TYPE=3]="TYPE"})(qr||(qr={}));const kb=void 0;function Aa(n){if(n===null)return"null";if(n===kb)return"undefined";switch(typeof n){case"number":return`${n}`;case"bigint":return`${n}`;case"string":return`"${n}"`}return typeof n[Symbol.toPrimitive]=="function"?n[Symbol.toPrimitive]("string"):ArrayBuffer.isView(n)?n instanceof BigInt64Array||n instanceof BigUint64Array?`[${[...n].map(e=>Aa(e))}]`:`[${n}]`:ArrayBuffer.isView(n)?`[${n}]`:JSON.stringify(n,(e,t)=>typeof t=="bigint"?`${t}`:t)}const Ub=Symbol.for("isArrowBigNum");function lr(n,...e){return e.length===0?Object.setPrototypeOf(ut(this.TypedArray,n),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(n,...e),this.constructor.prototype)}lr.prototype[Ub]=!0;lr.prototype.toJSON=function(){return`"${Na(this)}"`};lr.prototype.valueOf=function(){return rv(this)};lr.prototype.toString=function(){return Na(this)};lr.prototype[Symbol.toPrimitive]=function(n="default"){switch(n){case"number":return rv(this);case"string":return Na(this);case"default":return jb(this)}return Na(this)};function co(...n){return lr.apply(this,n)}function fo(...n){return lr.apply(this,n)}function Pa(...n){return lr.apply(this,n)}Object.setPrototypeOf(co.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(fo.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Pa.prototype,Object.create(Uint32Array.prototype));Object.assign(co.prototype,lr.prototype,{constructor:co,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(fo.prototype,lr.prototype,{constructor:fo,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Pa.prototype,lr.prototype,{constructor:Pa,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function rv(n){const{buffer:e,byteOffset:t,length:s,signed:a}=n,u=new BigUint64Array(e,t,s),d=a&&u.at(-1)&BigInt(1)<<BigInt(63);let h=BigInt(d?1:0),p=BigInt(0);if(d){for(const y of u)h+=~y*(BigInt(1)<<BigInt(32)*p++);h*=BigInt(-1)}else for(const y of u)h+=y*(BigInt(1)<<BigInt(32)*p++);return h}const Na=n=>{if(n.byteLength===8)return`${new n.BigIntArray(n.buffer,n.byteOffset,1)[0]}`;if(!n.signed)return rf(n);let e=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);if(new Int16Array([e.at(-1)])[0]>=0)return rf(n);e=e.slice();let s=1;for(let u=0;u<e.length;u++){const d=e[u],h=~d+s;e[u]=h,s&=d===0?1:0}return`-${rf(e)}`},jb=n=>n.byteLength===8?new n.BigIntArray(n.buffer,n.byteOffset,1)[0]:Na(n);function rf(n){let e="";const t=new Uint32Array(2);let s=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2);const a=new Uint32Array((s=new Uint16Array(s).reverse()).buffer);let u=-1;const d=s.length-1;do{for(t[0]=s[u=0];u<d;)s[u++]=t[1]=t[0]/10,t[0]=(t[0]-t[1]*10<<16)+s[u];s[u]=t[1]=t[0]/10,t[0]=t[0]-t[1]*10,e=`${t[0]}${e}`}while(a[0]||a[1]||a[2]||a[3]);return e??"0"}class Yf{static new(e,t){switch(t){case!0:return new co(e);case!1:return new fo(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new co(e)}return e.byteLength===16?new Pa(e):new fo(e)}static signed(e){return new co(e)}static unsigned(e){return new fo(e)}static decimal(e){return new Pa(e)}constructor(e,t){return Yf.new(e,t)}}function or(n){if(typeof n=="bigint"&&(n<Number.MIN_SAFE_INTEGER||n>Number.MAX_SAFE_INTEGER))throw new TypeError(`${n} is not safe to convert to a number.`);return Number(n)}var iv,sv,ov,av,lv,uv,cv,dv,fv,hv,pv,mv,yv,gv,vv,wv,Sv,_v,bv;class Re{static isNull(e){return(e==null?void 0:e.typeId)===O.Null}static isInt(e){return(e==null?void 0:e.typeId)===O.Int}static isFloat(e){return(e==null?void 0:e.typeId)===O.Float}static isBinary(e){return(e==null?void 0:e.typeId)===O.Binary}static isUtf8(e){return(e==null?void 0:e.typeId)===O.Utf8}static isBool(e){return(e==null?void 0:e.typeId)===O.Bool}static isDecimal(e){return(e==null?void 0:e.typeId)===O.Decimal}static isDate(e){return(e==null?void 0:e.typeId)===O.Date}static isTime(e){return(e==null?void 0:e.typeId)===O.Time}static isTimestamp(e){return(e==null?void 0:e.typeId)===O.Timestamp}static isInterval(e){return(e==null?void 0:e.typeId)===O.Interval}static isList(e){return(e==null?void 0:e.typeId)===O.List}static isStruct(e){return(e==null?void 0:e.typeId)===O.Struct}static isUnion(e){return(e==null?void 0:e.typeId)===O.Union}static isFixedSizeBinary(e){return(e==null?void 0:e.typeId)===O.FixedSizeBinary}static isFixedSizeList(e){return(e==null?void 0:e.typeId)===O.FixedSizeList}static isMap(e){return(e==null?void 0:e.typeId)===O.Map}static isDictionary(e){return(e==null?void 0:e.typeId)===O.Dictionary}static isDenseUnion(e){return Re.isUnion(e)&&e.mode===sr.Dense}static isSparseUnion(e){return Re.isUnion(e)&&e.mode===sr.Sparse}get typeId(){return O.NONE}}iv=Symbol.toStringTag;Re[iv]=(n=>(n.children=null,n.ArrayType=Array,n[Symbol.toStringTag]="DataType"))(Re.prototype);let zi=class extends Re{toString(){return"Null"}get typeId(){return O.Null}};sv=Symbol.toStringTag;zi[sv]=(n=>n[Symbol.toStringTag]="Null")(zi.prototype);class Vi extends Re{constructor(e,t){super(),this.isSigned=e,this.bitWidth=t}get typeId(){return O.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}ov=Symbol.toStringTag;Vi[ov]=(n=>(n.isSigned=null,n.bitWidth=null,n[Symbol.toStringTag]="Int"))(Vi.prototype);class La extends Vi{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(La.prototype,"ArrayType",{value:Int32Array});class Ba extends Re{constructor(e){super(),this.precision=e}get typeId(){return O.Float}get ArrayType(){switch(this.precision){case wn.HALF:return Uint16Array;case wn.SINGLE:return Float32Array;case wn.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}av=Symbol.toStringTag;Ba[av]=(n=>(n.precision=null,n[Symbol.toStringTag]="Float"))(Ba.prototype);let Du=class extends Re{constructor(){super()}get typeId(){return O.Binary}toString(){return"Binary"}};lv=Symbol.toStringTag;Du[lv]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Binary"))(Du.prototype);let Cu=class extends Re{constructor(){super()}get typeId(){return O.Utf8}toString(){return"Utf8"}};uv=Symbol.toStringTag;Cu[uv]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Utf8"))(Cu.prototype);let Ou=class extends Re{constructor(){super()}get typeId(){return O.Bool}toString(){return"Bool"}};cv=Symbol.toStringTag;Ou[cv]=(n=>(n.ArrayType=Uint8Array,n[Symbol.toStringTag]="Bool"))(Ou.prototype);let Ru=class extends Re{constructor(e,t,s=128){super(),this.scale=e,this.precision=t,this.bitWidth=s}get typeId(){return O.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};dv=Symbol.toStringTag;Ru[dv]=(n=>(n.scale=null,n.precision=null,n.ArrayType=Uint32Array,n[Symbol.toStringTag]="Decimal"))(Ru.prototype);class Fu extends Re{constructor(e){super(),this.unit=e}get typeId(){return O.Date}toString(){return`Date${(this.unit+1)*32}<${ri[this.unit]}>`}}fv=Symbol.toStringTag;Fu[fv]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Date"))(Fu.prototype);class ka extends Re{constructor(e,t){super(),this.unit=e,this.bitWidth=t}get typeId(){return O.Time}toString(){return`Time${this.bitWidth}<${Ke[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}hv=Symbol.toStringTag;ka[hv]=(n=>(n.unit=null,n.bitWidth=null,n[Symbol.toStringTag]="Time"))(ka.prototype);class Tu extends Re{constructor(e,t){super(),this.unit=e,this.timezone=t}get typeId(){return O.Timestamp}toString(){return`Timestamp<${Ke[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}pv=Symbol.toStringTag;Tu[pv]=(n=>(n.unit=null,n.timezone=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Timestamp"))(Tu.prototype);class Mu extends Re{constructor(e){super(),this.unit=e}get typeId(){return O.Interval}toString(){return`Interval<${ji[this.unit]}>`}}mv=Symbol.toStringTag;Mu[mv]=(n=>(n.unit=null,n.ArrayType=Int32Array,n[Symbol.toStringTag]="Interval"))(Mu.prototype);let Au=class extends Re{constructor(e){super(),this.children=[e]}get typeId(){return O.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};yv=Symbol.toStringTag;Au[yv]=(n=>(n.children=null,n[Symbol.toStringTag]="List"))(Au.prototype);class on extends Re{constructor(e){super(),this.children=e}get typeId(){return O.Struct}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}gv=Symbol.toStringTag;on[gv]=(n=>(n.children=null,n[Symbol.toStringTag]="Struct"))(on.prototype);class Pu extends Re{constructor(e,t,s){super(),this.mode=e,this.children=s,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((a,u,d)=>(a[u]=d)&&a||a,Object.create(null))}get typeId(){return O.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}vv=Symbol.toStringTag;Pu[vv]=(n=>(n.mode=null,n.typeIds=null,n.children=null,n.typeIdToChildIndex=null,n.ArrayType=Int8Array,n[Symbol.toStringTag]="Union"))(Pu.prototype);let Nu=class extends Re{constructor(e){super(),this.byteWidth=e}get typeId(){return O.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};wv=Symbol.toStringTag;Nu[wv]=(n=>(n.byteWidth=null,n.ArrayType=Uint8Array,n[Symbol.toStringTag]="FixedSizeBinary"))(Nu.prototype);let Lu=class extends Re{constructor(e,t){super(),this.listSize=e,this.children=[t]}get typeId(){return O.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Sv=Symbol.toStringTag;Lu[Sv]=(n=>(n.children=null,n.listSize=null,n[Symbol.toStringTag]="FixedSizeList"))(Lu.prototype);class Bu extends Re{constructor(e,t=!1){super(),this.children=[e],this.keysSorted=t}get typeId(){return O.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}_v=Symbol.toStringTag;Bu[_v]=(n=>(n.children=null,n.keysSorted=null,n[Symbol.toStringTag]="Map_"))(Bu.prototype);const zb=(n=>()=>++n)(-1);class vo extends Re{constructor(e,t,s,a){super(),this.indices=t,this.dictionary=e,this.isOrdered=a||!1,this.id=s==null?zb():or(s)}get typeId(){return O.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}bv=Symbol.toStringTag;vo[bv]=(n=>(n.id=null,n.indices=null,n.isOrdered=null,n.dictionary=null,n[Symbol.toStringTag]="Dictionary"))(vo.prototype);function Kr(n){const e=n;switch(n.typeId){case O.Decimal:return n.bitWidth/32;case O.Timestamp:return 2;case O.Date:return 1+e.unit;case O.Interval:return 1+e.unit;case O.FixedSizeList:return e.listSize;case O.FixedSizeBinary:return e.byteWidth;default:return 1}}class Ve{visitMany(e,...t){return e.map((s,a)=>this.visit(s,...t.map(u=>u[a])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return Vb(this,e,t)}getVisitFnByTypeId(e,t=!0){return io(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitBinary(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}}function Vb(n,e,t=!0){return typeof e=="number"?io(n,e,t):typeof e=="string"&&e in O?io(n,O[e],t):e&&e instanceof Re?io(n,Fy(e),t):e!=null&&e.type&&e.type instanceof Re?io(n,Fy(e.type),t):io(n,O.NONE,t)}function io(n,e,t=!0){let s=null;switch(e){case O.Null:s=n.visitNull;break;case O.Bool:s=n.visitBool;break;case O.Int:s=n.visitInt;break;case O.Int8:s=n.visitInt8||n.visitInt;break;case O.Int16:s=n.visitInt16||n.visitInt;break;case O.Int32:s=n.visitInt32||n.visitInt;break;case O.Int64:s=n.visitInt64||n.visitInt;break;case O.Uint8:s=n.visitUint8||n.visitInt;break;case O.Uint16:s=n.visitUint16||n.visitInt;break;case O.Uint32:s=n.visitUint32||n.visitInt;break;case O.Uint64:s=n.visitUint64||n.visitInt;break;case O.Float:s=n.visitFloat;break;case O.Float16:s=n.visitFloat16||n.visitFloat;break;case O.Float32:s=n.visitFloat32||n.visitFloat;break;case O.Float64:s=n.visitFloat64||n.visitFloat;break;case O.Utf8:s=n.visitUtf8;break;case O.Binary:s=n.visitBinary;break;case O.FixedSizeBinary:s=n.visitFixedSizeBinary;break;case O.Date:s=n.visitDate;break;case O.DateDay:s=n.visitDateDay||n.visitDate;break;case O.DateMillisecond:s=n.visitDateMillisecond||n.visitDate;break;case O.Timestamp:s=n.visitTimestamp;break;case O.TimestampSecond:s=n.visitTimestampSecond||n.visitTimestamp;break;case O.TimestampMillisecond:s=n.visitTimestampMillisecond||n.visitTimestamp;break;case O.TimestampMicrosecond:s=n.visitTimestampMicrosecond||n.visitTimestamp;break;case O.TimestampNanosecond:s=n.visitTimestampNanosecond||n.visitTimestamp;break;case O.Time:s=n.visitTime;break;case O.TimeSecond:s=n.visitTimeSecond||n.visitTime;break;case O.TimeMillisecond:s=n.visitTimeMillisecond||n.visitTime;break;case O.TimeMicrosecond:s=n.visitTimeMicrosecond||n.visitTime;break;case O.TimeNanosecond:s=n.visitTimeNanosecond||n.visitTime;break;case O.Decimal:s=n.visitDecimal;break;case O.List:s=n.visitList;break;case O.Struct:s=n.visitStruct;break;case O.Union:s=n.visitUnion;break;case O.DenseUnion:s=n.visitDenseUnion||n.visitUnion;break;case O.SparseUnion:s=n.visitSparseUnion||n.visitUnion;break;case O.Dictionary:s=n.visitDictionary;break;case O.Interval:s=n.visitInterval;break;case O.IntervalDayTime:s=n.visitIntervalDayTime||n.visitInterval;break;case O.IntervalYearMonth:s=n.visitIntervalYearMonth||n.visitInterval;break;case O.FixedSizeList:s=n.visitFixedSizeList;break;case O.Map:s=n.visitMap;break}if(typeof s=="function")return s;if(!t)return()=>null;throw new Error(`Unrecognized type '${O[e]}'`)}function Fy(n){switch(n.typeId){case O.Null:return O.Null;case O.Int:{const{bitWidth:e,isSigned:t}=n;switch(e){case 8:return t?O.Int8:O.Uint8;case 16:return t?O.Int16:O.Uint16;case 32:return t?O.Int32:O.Uint32;case 64:return t?O.Int64:O.Uint64}return O.Int}case O.Float:switch(n.precision){case wn.HALF:return O.Float16;case wn.SINGLE:return O.Float32;case wn.DOUBLE:return O.Float64}return O.Float;case O.Binary:return O.Binary;case O.Utf8:return O.Utf8;case O.Bool:return O.Bool;case O.Decimal:return O.Decimal;case O.Time:switch(n.unit){case Ke.SECOND:return O.TimeSecond;case Ke.MILLISECOND:return O.TimeMillisecond;case Ke.MICROSECOND:return O.TimeMicrosecond;case Ke.NANOSECOND:return O.TimeNanosecond}return O.Time;case O.Timestamp:switch(n.unit){case Ke.SECOND:return O.TimestampSecond;case Ke.MILLISECOND:return O.TimestampMillisecond;case Ke.MICROSECOND:return O.TimestampMicrosecond;case Ke.NANOSECOND:return O.TimestampNanosecond}return O.Timestamp;case O.Date:switch(n.unit){case ri.DAY:return O.DateDay;case ri.MILLISECOND:return O.DateMillisecond}return O.Date;case O.Interval:switch(n.unit){case ji.DAY_TIME:return O.IntervalDayTime;case ji.YEAR_MONTH:return O.IntervalYearMonth}return O.Interval;case O.Map:return O.Map;case O.List:return O.List;case O.Struct:return O.Struct;case O.Union:switch(n.mode){case sr.Dense:return O.DenseUnion;case sr.Sparse:return O.SparseUnion}return O.Union;case O.FixedSizeBinary:return O.FixedSizeBinary;case O.FixedSizeList:return O.FixedSizeList;case O.Dictionary:return O.Dictionary}throw new Error(`Unrecognized type '${O[n.typeId]}'`)}Ve.prototype.visitInt8=null;Ve.prototype.visitInt16=null;Ve.prototype.visitInt32=null;Ve.prototype.visitInt64=null;Ve.prototype.visitUint8=null;Ve.prototype.visitUint16=null;Ve.prototype.visitUint32=null;Ve.prototype.visitUint64=null;Ve.prototype.visitFloat16=null;Ve.prototype.visitFloat32=null;Ve.prototype.visitFloat64=null;Ve.prototype.visitDateDay=null;Ve.prototype.visitDateMillisecond=null;Ve.prototype.visitTimestampSecond=null;Ve.prototype.visitTimestampMillisecond=null;Ve.prototype.visitTimestampMicrosecond=null;Ve.prototype.visitTimestampNanosecond=null;Ve.prototype.visitTimeSecond=null;Ve.prototype.visitTimeMillisecond=null;Ve.prototype.visitTimeMicrosecond=null;Ve.prototype.visitTimeNanosecond=null;Ve.prototype.visitDenseUnion=null;Ve.prototype.visitSparseUnion=null;Ve.prototype.visitIntervalDayTime=null;Ve.prototype.visitIntervalYearMonth=null;const Iv=new Float64Array(1),to=new Uint32Array(Iv.buffer);function Ev(n){const e=(n&31744)>>10,t=(n&1023)/1024,s=Math.pow(-1,(n&32768)>>15);switch(e){case 31:return s*(t?Number.NaN:1/0);case 0:return s*(t?6103515625e-14*t:0)}return s*Math.pow(2,e-15)*(1+t)}function $b(n){if(n!==n)return 32256;Iv[0]=n;const e=(to[1]&2147483648)>>16&65535;let t=to[1]&2146435072,s=0;return t>=1089470464?to[0]>0?t=31744:(t=(t&2080374784)>>16,s=(to[1]&1048575)>>10):t<=1056964608?(s=1048576+(to[1]&1048575),s=1048576+(s<<(t>>20)-998)>>21,t=0):(t=t-1056964608>>10,s=(to[1]&1048575)+512>>10),e|t|s&65535}class De extends Ve{}function Fe(n){return(e,t,s)=>{if(e.setValid(t,s!=null))return n(e,t,s)}}const Wb=(n,e,t)=>{n[e]=Math.trunc(t/864e5)},Gf=(n,e,t)=>{n[e]=Math.trunc(t%4294967296),n[e+1]=Math.trunc(t/4294967296)},Qb=(n,e,t)=>{n[e]=Math.trunc(t*1e3%4294967296),n[e+1]=Math.trunc(t*1e3/4294967296)},Hb=(n,e,t)=>{n[e]=Math.trunc(t*1e6%4294967296),n[e+1]=Math.trunc(t*1e6/4294967296)},xv=(n,e,t,s)=>{if(t+1<e.length){const{[t]:a,[t+1]:u}=e;n.set(s.subarray(0,u-a),a)}},qb=({offset:n,values:e},t,s)=>{const a=n+t;s?e[a>>3]|=1<<a%8:e[a>>3]&=~(1<<a%8)},oi=({values:n},e,t)=>{n[e]=t},Jf=({values:n},e,t)=>{n[e]=t},Dv=({values:n},e,t)=>{n[e]=$b(t)},Kb=(n,e,t)=>{switch(n.type.precision){case wn.HALF:return Dv(n,e,t);case wn.SINGLE:case wn.DOUBLE:return Jf(n,e,t)}},Cv=({values:n},e,t)=>{Wb(n,e,t.valueOf())},Ov=({values:n},e,t)=>{Gf(n,e*2,t.valueOf())},Yb=({stride:n,values:e},t,s)=>{e.set(s.subarray(0,n),n*t)},Gb=({values:n,valueOffsets:e},t,s)=>xv(n,e,t,s),Jb=({values:n,valueOffsets:e},t,s)=>{xv(n,e,t,Qf(s))},Xb=(n,e,t)=>{n.type.unit===ri.DAY?Cv(n,e,t):Ov(n,e,t)},Rv=({values:n},e,t)=>Gf(n,e*2,t/1e3),Fv=({values:n},e,t)=>Gf(n,e*2,t),Tv=({values:n},e,t)=>Qb(n,e*2,t),Mv=({values:n},e,t)=>Hb(n,e*2,t),Zb=(n,e,t)=>{switch(n.type.unit){case Ke.SECOND:return Rv(n,e,t);case Ke.MILLISECOND:return Fv(n,e,t);case Ke.MICROSECOND:return Tv(n,e,t);case Ke.NANOSECOND:return Mv(n,e,t)}},Av=({values:n},e,t)=>{n[e]=t},Pv=({values:n},e,t)=>{n[e]=t},Nv=({values:n},e,t)=>{n[e]=t},Lv=({values:n},e,t)=>{n[e]=t},eI=(n,e,t)=>{switch(n.type.unit){case Ke.SECOND:return Av(n,e,t);case Ke.MILLISECOND:return Pv(n,e,t);case Ke.MICROSECOND:return Nv(n,e,t);case Ke.NANOSECOND:return Lv(n,e,t)}},tI=({values:n,stride:e},t,s)=>{n.set(s.subarray(0,e),e*t)},nI=(n,e,t)=>{const s=n.children[0],a=n.valueOffsets,u=$n.getVisitFn(s);if(Array.isArray(t))for(let d=-1,h=a[e],p=a[e+1];h<p;)u(s,h++,t[++d]);else for(let d=-1,h=a[e],p=a[e+1];h<p;)u(s,h++,t.get(++d))},rI=(n,e,t)=>{const s=n.children[0],{valueOffsets:a}=n,u=$n.getVisitFn(s);let{[e]:d,[e+1]:h}=a;const p=t instanceof Map?t.entries():Object.entries(t);for(const y of p)if(u(s,d,y),++d>=h)break},iI=(n,e)=>(t,s,a,u)=>s&&t(s,n,e[u]),sI=(n,e)=>(t,s,a,u)=>s&&t(s,n,e.get(u)),oI=(n,e)=>(t,s,a,u)=>s&&t(s,n,e.get(a.name)),aI=(n,e)=>(t,s,a,u)=>s&&t(s,n,e[a.name]),lI=(n,e,t)=>{const s=n.type.children.map(u=>$n.getVisitFn(u.type)),a=t instanceof Map?oI(e,t):t instanceof ot?sI(e,t):Array.isArray(t)?iI(e,t):aI(e,t);n.type.children.forEach((u,d)=>a(s[d],n.children[d],u,d))},uI=(n,e,t)=>{n.type.mode===sr.Dense?Bv(n,e,t):kv(n,e,t)},Bv=(n,e,t)=>{const s=n.type.typeIdToChildIndex[n.typeIds[e]],a=n.children[s];$n.visit(a,n.valueOffsets[e],t)},kv=(n,e,t)=>{const s=n.type.typeIdToChildIndex[n.typeIds[e]],a=n.children[s];$n.visit(a,e,t)},cI=(n,e,t)=>{var s;(s=n.dictionary)===null||s===void 0||s.set(n.values[e],t)},dI=(n,e,t)=>{n.type.unit===ji.DAY_TIME?Uv(n,e,t):jv(n,e,t)},Uv=({values:n},e,t)=>{n.set(t.subarray(0,2),2*e)},jv=({values:n},e,t)=>{n[e]=t[0]*12+t[1]%12},fI=(n,e,t)=>{const{stride:s}=n,a=n.children[0],u=$n.getVisitFn(a);if(Array.isArray(t))for(let d=-1,h=e*s;++d<s;)u(a,h+d,t[d]);else for(let d=-1,h=e*s;++d<s;)u(a,h+d,t.get(d))};De.prototype.visitBool=Fe(qb);De.prototype.visitInt=Fe(oi);De.prototype.visitInt8=Fe(oi);De.prototype.visitInt16=Fe(oi);De.prototype.visitInt32=Fe(oi);De.prototype.visitInt64=Fe(oi);De.prototype.visitUint8=Fe(oi);De.prototype.visitUint16=Fe(oi);De.prototype.visitUint32=Fe(oi);De.prototype.visitUint64=Fe(oi);De.prototype.visitFloat=Fe(Kb);De.prototype.visitFloat16=Fe(Dv);De.prototype.visitFloat32=Fe(Jf);De.prototype.visitFloat64=Fe(Jf);De.prototype.visitUtf8=Fe(Jb);De.prototype.visitBinary=Fe(Gb);De.prototype.visitFixedSizeBinary=Fe(Yb);De.prototype.visitDate=Fe(Xb);De.prototype.visitDateDay=Fe(Cv);De.prototype.visitDateMillisecond=Fe(Ov);De.prototype.visitTimestamp=Fe(Zb);De.prototype.visitTimestampSecond=Fe(Rv);De.prototype.visitTimestampMillisecond=Fe(Fv);De.prototype.visitTimestampMicrosecond=Fe(Tv);De.prototype.visitTimestampNanosecond=Fe(Mv);De.prototype.visitTime=Fe(eI);De.prototype.visitTimeSecond=Fe(Av);De.prototype.visitTimeMillisecond=Fe(Pv);De.prototype.visitTimeMicrosecond=Fe(Nv);De.prototype.visitTimeNanosecond=Fe(Lv);De.prototype.visitDecimal=Fe(tI);De.prototype.visitList=Fe(nI);De.prototype.visitStruct=Fe(lI);De.prototype.visitUnion=Fe(uI);De.prototype.visitDenseUnion=Fe(Bv);De.prototype.visitSparseUnion=Fe(kv);De.prototype.visitDictionary=Fe(cI);De.prototype.visitInterval=Fe(dI);De.prototype.visitIntervalDayTime=Fe(Uv);De.prototype.visitIntervalYearMonth=Fe(jv);De.prototype.visitFixedSizeList=Fe(fI);De.prototype.visitMap=Fe(rI);const $n=new De,tr=Symbol.for("parent"),ho=Symbol.for("rowIndex");class Xf{constructor(e,t){return this[tr]=e,this[ho]=t,new Proxy(this,new pI)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[ho],t=this[tr],s=t.type.children,a={};for(let u=-1,d=s.length;++u<d;)a[s[u].name]=Sn.visit(t.children[u],e);return a}toString(){return`{${[...this].map(([e,t])=>`${Aa(e)}: ${Aa(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new hI(this[tr],this[ho])}}class hI{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,Sn.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Xf.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[tr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ho]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class pI{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[tr].type.children.map(t=>t.name)}has(e,t){return e[tr].type.children.findIndex(s=>s.name===t)!==-1}getOwnPropertyDescriptor(e,t){if(e[tr].type.children.findIndex(s=>s.name===t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];const s=e[tr].type.children.findIndex(a=>a.name===t);if(s!==-1){const a=Sn.visit(e[tr].children[s],e[ho]);return Reflect.set(e,t,a),a}}set(e,t,s){const a=e[tr].type.children.findIndex(u=>u.name===t);return a!==-1?($n.visit(e[tr].children[a],e[ho],s),Reflect.set(e,t,s)):Reflect.has(e,t)||typeof t=="symbol"?Reflect.set(e,t,s):!1}}class _e extends Ve{}function Ce(n){return(e,t)=>e.getValid(t)?n(e,t):null}const mI=(n,e)=>864e5*n[e],Zf=(n,e)=>4294967296*n[e+1]+(n[e]>>>0),yI=(n,e)=>4294967296*(n[e+1]/1e3)+(n[e]>>>0)/1e3,gI=(n,e)=>4294967296*(n[e+1]/1e6)+(n[e]>>>0)/1e6,zv=n=>new Date(n),vI=(n,e)=>zv(mI(n,e)),wI=(n,e)=>zv(Zf(n,e)),SI=(n,e)=>null,Vv=(n,e,t)=>{if(t+1>=e.length)return null;const s=e[t],a=e[t+1];return n.subarray(s,a)},_I=({offset:n,values:e},t)=>{const s=n+t;return(e[s>>3]&1<<s%8)!==0},$v=({values:n},e)=>vI(n,e),Wv=({values:n},e)=>wI(n,e*2),Hi=({stride:n,values:e},t)=>e[n*t],bI=({stride:n,values:e},t)=>Ev(e[n*t]),Qv=({values:n},e)=>n[e],II=({stride:n,values:e},t)=>e.subarray(n*t,n*(t+1)),EI=({values:n,valueOffsets:e},t)=>Vv(n,e,t),xI=({values:n,valueOffsets:e},t)=>{const s=Vv(n,e,t);return s!==null?_f(s):null},DI=({values:n},e)=>n[e],CI=({type:n,values:e},t)=>n.precision!==wn.HALF?e[t]:Ev(e[t]),OI=(n,e)=>n.type.unit===ri.DAY?$v(n,e):Wv(n,e),Hv=({values:n},e)=>1e3*Zf(n,e*2),qv=({values:n},e)=>Zf(n,e*2),Kv=({values:n},e)=>yI(n,e*2),Yv=({values:n},e)=>gI(n,e*2),RI=(n,e)=>{switch(n.type.unit){case Ke.SECOND:return Hv(n,e);case Ke.MILLISECOND:return qv(n,e);case Ke.MICROSECOND:return Kv(n,e);case Ke.NANOSECOND:return Yv(n,e)}},Gv=({values:n},e)=>n[e],Jv=({values:n},e)=>n[e],Xv=({values:n},e)=>n[e],Zv=({values:n},e)=>n[e],FI=(n,e)=>{switch(n.type.unit){case Ke.SECOND:return Gv(n,e);case Ke.MILLISECOND:return Jv(n,e);case Ke.MICROSECOND:return Xv(n,e);case Ke.NANOSECOND:return Zv(n,e)}},TI=({values:n,stride:e},t)=>Yf.decimal(n.subarray(e*t,e*(t+1))),MI=(n,e)=>{const{valueOffsets:t,stride:s,children:a}=n,{[e*s]:u,[e*s+1]:d}=t,p=a[0].slice(u,d-u);return new ot([p])},AI=(n,e)=>{const{valueOffsets:t,children:s}=n,{[e]:a,[e+1]:u}=t,d=s[0];return new eh(d.slice(a,u-a))},PI=(n,e)=>new Xf(n,e),NI=(n,e)=>n.type.mode===sr.Dense?e0(n,e):t0(n,e),e0=(n,e)=>{const t=n.type.typeIdToChildIndex[n.typeIds[e]],s=n.children[t];return Sn.visit(s,n.valueOffsets[e])},t0=(n,e)=>{const t=n.type.typeIdToChildIndex[n.typeIds[e]],s=n.children[t];return Sn.visit(s,e)},LI=(n,e)=>{var t;return(t=n.dictionary)===null||t===void 0?void 0:t.get(n.values[e])},BI=(n,e)=>n.type.unit===ji.DAY_TIME?n0(n,e):r0(n,e),n0=({values:n},e)=>n.subarray(2*e,2*(e+1)),r0=({values:n},e)=>{const t=n[e],s=new Int32Array(2);return s[0]=Math.trunc(t/12),s[1]=Math.trunc(t%12),s},kI=(n,e)=>{const{stride:t,children:s}=n,u=s[0].slice(e*t,t);return new ot([u])};_e.prototype.visitNull=Ce(SI);_e.prototype.visitBool=Ce(_I);_e.prototype.visitInt=Ce(DI);_e.prototype.visitInt8=Ce(Hi);_e.prototype.visitInt16=Ce(Hi);_e.prototype.visitInt32=Ce(Hi);_e.prototype.visitInt64=Ce(Qv);_e.prototype.visitUint8=Ce(Hi);_e.prototype.visitUint16=Ce(Hi);_e.prototype.visitUint32=Ce(Hi);_e.prototype.visitUint64=Ce(Qv);_e.prototype.visitFloat=Ce(CI);_e.prototype.visitFloat16=Ce(bI);_e.prototype.visitFloat32=Ce(Hi);_e.prototype.visitFloat64=Ce(Hi);_e.prototype.visitUtf8=Ce(xI);_e.prototype.visitBinary=Ce(EI);_e.prototype.visitFixedSizeBinary=Ce(II);_e.prototype.visitDate=Ce(OI);_e.prototype.visitDateDay=Ce($v);_e.prototype.visitDateMillisecond=Ce(Wv);_e.prototype.visitTimestamp=Ce(RI);_e.prototype.visitTimestampSecond=Ce(Hv);_e.prototype.visitTimestampMillisecond=Ce(qv);_e.prototype.visitTimestampMicrosecond=Ce(Kv);_e.prototype.visitTimestampNanosecond=Ce(Yv);_e.prototype.visitTime=Ce(FI);_e.prototype.visitTimeSecond=Ce(Gv);_e.prototype.visitTimeMillisecond=Ce(Jv);_e.prototype.visitTimeMicrosecond=Ce(Xv);_e.prototype.visitTimeNanosecond=Ce(Zv);_e.prototype.visitDecimal=Ce(TI);_e.prototype.visitList=Ce(MI);_e.prototype.visitStruct=Ce(PI);_e.prototype.visitUnion=Ce(NI);_e.prototype.visitDenseUnion=Ce(e0);_e.prototype.visitSparseUnion=Ce(t0);_e.prototype.visitDictionary=Ce(LI);_e.prototype.visitInterval=Ce(BI);_e.prototype.visitIntervalDayTime=Ce(n0);_e.prototype.visitIntervalYearMonth=Ce(r0);_e.prototype.visitFixedSizeList=Ce(kI);_e.prototype.visitMap=Ce(AI);const Sn=new _e,Er=Symbol.for("keys"),po=Symbol.for("vals");class eh{constructor(e){return this[Er]=new ot([e.children[0]]).memoize(),this[po]=e.children[1],new Proxy(this,new jI)}[Symbol.iterator](){return new UI(this[Er],this[po])}get size(){return this[Er].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[Er],t=this[po],s={};for(let a=-1,u=e.length;++a<u;)s[e.get(a)]=Sn.visit(t,a);return s}toString(){return`{${[...this].map(([e,t])=>`${Aa(e)}: ${Aa(t)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class UI{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),Sn.visit(this.vals,e)]})}}class jI{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Er].toArray().map(String)}has(e,t){return e[Er].includes(t)}getOwnPropertyDescriptor(e,t){if(e[Er].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];const s=e[Er].indexOf(t);if(s!==-1){const a=Sn.visit(Reflect.get(e,po),s);return Reflect.set(e,t,a),a}}set(e,t,s){const a=e[Er].indexOf(t);return a!==-1?($n.visit(Reflect.get(e,po),a,s),Reflect.set(e,t,s)):Reflect.has(e,t)?Reflect.set(e,t,s):!1}}Object.defineProperties(eh.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Er]:{writable:!0,enumerable:!1,configurable:!1,value:null},[po]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Ty;function i0(n,e,t,s){const{length:a=0}=n;let u=typeof e!="number"?0:e,d=typeof t!="number"?a:t;return u<0&&(u=(u%a+a)%a),d<0&&(d=(d%a+a)%a),d<u&&(Ty=u,u=d,d=Ty),d>a&&(d=a),s?s(n,u,d):[u,d]}const My=n=>n!==n;function Oo(n){if(typeof n!=="object"||n===null)return My(n)?My:t=>t===n;if(n instanceof Date){const t=n.valueOf();return s=>s instanceof Date?s.valueOf()===t:!1}return ArrayBuffer.isView(n)?t=>t?Mb(n,t):!1:n instanceof Map?VI(n):Array.isArray(n)?zI(n):n instanceof ot?$I(n):WI(n,!0)}function zI(n){const e=[];for(let t=-1,s=n.length;++t<s;)e[t]=Oo(n[t]);return oc(e)}function VI(n){let e=-1;const t=[];for(const s of n.values())t[++e]=Oo(s);return oc(t)}function $I(n){const e=[];for(let t=-1,s=n.length;++t<s;)e[t]=Oo(n.get(t));return oc(e)}function WI(n,e=!1){const t=Object.keys(n);if(!e&&t.length===0)return()=>!1;const s=[];for(let a=-1,u=t.length;++a<u;)s[a]=Oo(n[t[a]]);return oc(s,t)}function oc(n,e){return t=>{if(!t||typeof t!="object")return!1;switch(t.constructor){case Array:return QI(n,t);case Map:return Ay(n,t,t.keys());case eh:case Xf:case Object:case void 0:return Ay(n,t,e||Object.keys(t))}return t instanceof ot?HI(n,t):!1}}function QI(n,e){const t=n.length;if(e.length!==t)return!1;for(let s=-1;++s<t;)if(!n[s](e[s]))return!1;return!0}function HI(n,e){const t=n.length;if(e.length!==t)return!1;for(let s=-1;++s<t;)if(!n[s](e.get(s)))return!1;return!0}function Ay(n,e,t){const s=t[Symbol.iterator](),a=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),u=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let d=0;const h=n.length;let p=u.next(),y=s.next(),g=a.next();for(;d<h&&!y.done&&!g.done&&!p.done&&!(y.value!==g.value||!n[d](p.value));++d,y=s.next(),g=a.next(),p=u.next());return d===h&&y.done&&g.done&&p.done?!0:(s.return&&s.return(),a.return&&a.return(),u.return&&u.return(),!1)}function s0(n,e,t,s){return(t&1<<s)!==0}function qI(n,e,t,s){return(t&1<<s)>>s}function KI(n,e,t){const s=t.byteLength+7&-8;if(n>0||t.byteLength<s){const a=new Uint8Array(s);return a.set(n%8===0?t.subarray(n>>3):Ef(new th(t,n,e,null,s0)).subarray(0,s)),a}return t}function Ef(n){const e=[];let t=0,s=0,a=0;for(const d of n)d&&(a|=1<<s),++s===8&&(e[t++]=a,a=s=0);(t===0||s>0)&&(e[t++]=a);const u=new Uint8Array(e.length+7&-8);return u.set(e),u}class th{constructor(e,t,s,a,u){this.bytes=e,this.length=s,this.context=a,this.get=u,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[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 xf(n,e,t){if(t-e<=0)return 0;if(t-e<8){let u=0;for(const d of new th(n,e,t-e,n,qI))u+=d;return u}const s=t>>3<<3,a=e+(e%8===0?0:8-e%8);return xf(n,e,a)+xf(n,s,t)+YI(n,a>>3,s-a>>3)}function YI(n,e,t){let s=0,a=Math.trunc(e);const u=new DataView(n.buffer,n.byteOffset,n.byteLength),d=t===void 0?n.byteLength:a+t;for(;d-a>=4;)s+=sf(u.getUint32(a)),a+=4;for(;d-a>=2;)s+=sf(u.getUint16(a)),a+=2;for(;d-a>=1;)s+=sf(u.getUint8(a)),a+=1;return s}function sf(n){let e=Math.trunc(n);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const GI=-1;let It=class Df{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let e=0;const{valueOffsets:t,values:s,nullBitmap:a,typeIds:u}=this;return t&&(e+=t.byteLength),s&&(e+=s.byteLength),a&&(e+=a.byteLength),u&&(e+=u.byteLength),this.children.reduce((d,h)=>d+h.byteLength,e)}get nullCount(){let e=this._nullCount,t;return e<=GI&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-xf(t,this.offset,this.offset+this.length)),e}constructor(e,t,s,a,u,d=[],h){this.type=e,this.children=d,this.dictionary=h,this.offset=Math.floor(Math.max(t||0,0)),this.length=Math.floor(Math.max(s||0,0)),this._nullCount=Math.floor(Math.max(a||0,-1));let p;u instanceof Df?(this.stride=u.stride,this.values=u.values,this.typeIds=u.typeIds,this.nullBitmap=u.nullBitmap,this.valueOffsets=u.valueOffsets):(this.stride=Kr(e),u&&((p=u[0])&&(this.valueOffsets=p),(p=u[1])&&(this.values=p),(p=u[2])&&(this.nullBitmap=p),(p=u[3])&&(this.typeIds=p))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}getValid(e){if(this.nullable&&this.nullCount>0){const t=this.offset+e;return(this.nullBitmap[t>>3]&1<<t%8)!==0}return!0}setValid(e,t){if(!this.nullable)return t;if(!this.nullBitmap||this.nullBitmap.byteLength<=e>>3){const{nullBitmap:p}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:p,_nullCount:0})}const{nullBitmap:s,offset:a}=this,u=a+e>>3,d=(a+e)%8,h=s[u]>>d&1;return t?h===0&&(s[u]|=1<<d,this._nullCount=this.nullCount+1):h===1&&(s[u]&=~(1<<d),this._nullCount=this.nullCount-1),t}clone(e=this.type,t=this.offset,s=this.length,a=this._nullCount,u=this,d=this.children){return new Df(e,t,s,a,u,d,this.dictionary)}slice(e,t){const{stride:s,typeId:a,children:u}=this,d=+(this._nullCount===0)-1,h=a===16?s:1,p=this._sliceBuffers(e,t,s,a);return this.clone(this.type,this.offset+e,t,d,p,u.length===0||this.valueOffsets?u:this._sliceChildren(u,h*e,h*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===O.Null)return this.clone(this.type,0,e,0);const{length:t,nullCount:s}=this,a=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);a[t>>3]=(1<<t-(t&-8))-1,s>0&&a.set(KI(this.offset,t,this.nullBitmap),0);const u=this.buffers;return u[qr.VALIDITY]=a,this.clone(this.type,0,e,s+(e-t),u)}_sliceBuffers(e,t,s,a){let u;const{buffers:d}=this;return(u=d[qr.TYPE])&&(d[qr.TYPE]=u.subarray(e,e+t)),(u=d[qr.OFFSET])&&(d[qr.OFFSET]=u.subarray(e,e+t+1))||(u=d[qr.DATA])&&(d[qr.DATA]=a===6?u:u.subarray(s*e,s*(e+t))),d}_sliceChildren(e,t,s){return e.map(a=>a.slice(t,s))}};It.prototype.children=Object.freeze([]);class Oa extends Ve{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:t,["offset"]:s=0,["length"]:a=0}=e;return new It(t,s,a,0)}visitBool(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length>>3,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitInt(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitFloat(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length,["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitUtf8(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.data),u=Ge(e.nullBitmap),d=_a(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new It(t,s,h,p,[d,a,u])}visitBinary(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.data),u=Ge(e.nullBitmap),d=_a(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new It(t,s,h,p,[d,a,u])}visitFixedSizeBinary(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitDate(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitTimestamp(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitTime(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitDecimal(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitList(e){const{["type"]:t,["offset"]:s=0,["child"]:a}=e,u=Ge(e.nullBitmap),d=_a(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new It(t,s,h,p,[d,void 0,u],[a])}visitStruct(e){const{["type"]:t,["offset"]:s=0,["children"]:a=[]}=e,u=Ge(e.nullBitmap),{length:d=a.reduce((p,{length:y})=>Math.max(p,y),0),nullCount:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,void 0,u],a)}visitUnion(e){const{["type"]:t,["offset"]:s=0,["children"]:a=[]}=e,u=Ge(e.nullBitmap),d=ut(t.ArrayType,e.typeIds),{["length"]:h=d.length,["nullCount"]:p=e.nullBitmap?-1:0}=e;if(Re.isSparseUnion(t))return new It(t,s,h,p,[void 0,void 0,u,d],a);const y=_a(e.valueOffsets);return new It(t,s,h,p,[y,void 0,u,d],a)}visitDictionary(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.indices.ArrayType,e.data),{["dictionary"]:d=new ot([new Oa().visit({type:t.dictionary})])}=e,{["length"]:h=u.length,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new It(t,s,h,p,[void 0,u,a],[],d)}visitInterval(e){const{["type"]:t,["offset"]:s=0}=e,a=Ge(e.nullBitmap),u=ut(t.ArrayType,e.data),{["length"]:d=u.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,u,a])}visitFixedSizeList(e){const{["type"]:t,["offset"]:s=0,["child"]:a=new Oa().visit({type:t.valueType})}=e,u=Ge(e.nullBitmap),{["length"]:d=a.length/Kr(t),["nullCount"]:h=e.nullBitmap?-1:0}=e;return new It(t,s,d,h,[void 0,void 0,u],[a])}visitMap(e){const{["type"]:t,["offset"]:s=0,["child"]:a=new Oa().visit({type:t.childType})}=e,u=Ge(e.nullBitmap),d=_a(e.valueOffsets),{["length"]:h=d.length-1,["nullCount"]:p=e.nullBitmap?-1:0}=e;return new It(t,s,h,p,[d,void 0,u],[a])}}function ke(n){return new Oa().visit(n)}class Py{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function o0(n){return n.reduce((e,t)=>e+t.nullCount,0)}function a0(n){return n.reduce((e,t,s)=>(e[s+1]=e[s]+t.length,e),new Uint32Array(n.length+1))}function l0(n,e,t,s){const a=[];for(let u=-1,d=n.length;++u<d;){const h=n[u],p=e[u],{length:y}=h;if(p>=s)break;if(t>=p+y)continue;if(p>=t&&p+y<=s){a.push(h);continue}const g=Math.max(0,t-p),v=Math.min(s-p,y);a.push(h.slice(g,v-g))}return a.length===0&&a.push(n[0].slice(0,0)),a}function nh(n,e,t,s){let a=0,u=0,d=e.length-1;do{if(a>=d-1)return t<e[d]?s(n,a,t-e[a]):null;u=a+Math.trunc((d-a)*.5),t<e[u]?d=u:a=u}while(a<d)}function rh(n,e){return n.getValid(e)}function mo(n){function e(t,s,a){return n(t[s],a)}return function(t){const s=this.data;return nh(s,this._offsets,t,e)}}function u0(n){let e;function t(s,a,u){return n(s[a],u,e)}return function(s,a){const u=this.data;e=a;const d=nh(u,this._offsets,s,t);return e=void 0,d}}function c0(n){let e;function t(s,a,u){let d=u,h=0,p=0;for(let y=a-1,g=s.length;++y<g;){const v=s[y];if(~(h=n(v,e,d)))return p+h;d=0,p+=v.length}return-1}return function(s,a){e=s;const u=this.data,d=typeof a!="number"?t(u,0,0):nh(u,this._offsets,a,t);return e=void 0,d}}class be extends Ve{}function JI(n,e){return e===null&&n.length>0?0:-1}function XI(n,e){const{nullBitmap:t}=n;if(!t||n.nullCount<=0)return-1;let s=0;for(const a of new th(t,n.offset+(e||0),n.length,t,s0)){if(!a)return s;++s}return-1}function Ae(n,e,t){if(e===void 0)return-1;if(e===null)return XI(n,t);const s=Sn.getVisitFn(n),a=Oo(e);for(let u=(t||0)-1,d=n.length;++u<d;)if(a(s(n,u)))return u;return-1}function d0(n,e,t){const s=Sn.getVisitFn(n),a=Oo(e);for(let u=(t||0)-1,d=n.length;++u<d;)if(a(s(n,u)))return u;return-1}be.prototype.visitNull=JI;be.prototype.visitBool=Ae;be.prototype.visitInt=Ae;be.prototype.visitInt8=Ae;be.prototype.visitInt16=Ae;be.prototype.visitInt32=Ae;be.prototype.visitInt64=Ae;be.prototype.visitUint8=Ae;be.prototype.visitUint16=Ae;be.prototype.visitUint32=Ae;be.prototype.visitUint64=Ae;be.prototype.visitFloat=Ae;be.prototype.visitFloat16=Ae;be.prototype.visitFloat32=Ae;be.prototype.visitFloat64=Ae;be.prototype.visitUtf8=Ae;be.prototype.visitBinary=Ae;be.prototype.visitFixedSizeBinary=Ae;be.prototype.visitDate=Ae;be.prototype.visitDateDay=Ae;be.prototype.visitDateMillisecond=Ae;be.prototype.visitTimestamp=Ae;be.prototype.visitTimestampSecond=Ae;be.prototype.visitTimestampMillisecond=Ae;be.prototype.visitTimestampMicrosecond=Ae;be.prototype.visitTimestampNanosecond=Ae;be.prototype.visitTime=Ae;be.prototype.visitTimeSecond=Ae;be.prototype.visitTimeMillisecond=Ae;be.prototype.visitTimeMicrosecond=Ae;be.prototype.visitTimeNanosecond=Ae;be.prototype.visitDecimal=Ae;be.prototype.visitList=Ae;be.prototype.visitStruct=Ae;be.prototype.visitUnion=Ae;be.prototype.visitDenseUnion=d0;be.prototype.visitSparseUnion=d0;be.prototype.visitDictionary=Ae;be.prototype.visitInterval=Ae;be.prototype.visitIntervalDayTime=Ae;be.prototype.visitIntervalYearMonth=Ae;be.prototype.visitFixedSizeList=Ae;be.prototype.visitMap=Ae;const ku=new be;class Ie extends Ve{}function Oe(n){const{type:e}=n;if(n.nullCount===0&&n.stride===1&&(e.typeId===O.Timestamp||e instanceof Vi&&e.bitWidth!==64||e instanceof ka&&e.bitWidth!==64||e instanceof Ba&&e.precision!==wn.HALF))return new Py(n.data.length,s=>{const a=n.data[s];return a.values.subarray(0,a.length)[Symbol.iterator]()});let t=0;return new Py(n.data.length,s=>{const u=n.data[s].length,d=n.slice(t,t+u);return t+=u,new ZI(d)})}class ZI{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}Ie.prototype.visitNull=Oe;Ie.prototype.visitBool=Oe;Ie.prototype.visitInt=Oe;Ie.prototype.visitInt8=Oe;Ie.prototype.visitInt16=Oe;Ie.prototype.visitInt32=Oe;Ie.prototype.visitInt64=Oe;Ie.prototype.visitUint8=Oe;Ie.prototype.visitUint16=Oe;Ie.prototype.visitUint32=Oe;Ie.prototype.visitUint64=Oe;Ie.prototype.visitFloat=Oe;Ie.prototype.visitFloat16=Oe;Ie.prototype.visitFloat32=Oe;Ie.prototype.visitFloat64=Oe;Ie.prototype.visitUtf8=Oe;Ie.prototype.visitBinary=Oe;Ie.prototype.visitFixedSizeBinary=Oe;Ie.prototype.visitDate=Oe;Ie.prototype.visitDateDay=Oe;Ie.prototype.visitDateMillisecond=Oe;Ie.prototype.visitTimestamp=Oe;Ie.prototype.visitTimestampSecond=Oe;Ie.prototype.visitTimestampMillisecond=Oe;Ie.prototype.visitTimestampMicrosecond=Oe;Ie.prototype.visitTimestampNanosecond=Oe;Ie.prototype.visitTime=Oe;Ie.prototype.visitTimeSecond=Oe;Ie.prototype.visitTimeMillisecond=Oe;Ie.prototype.visitTimeMicrosecond=Oe;Ie.prototype.visitTimeNanosecond=Oe;Ie.prototype.visitDecimal=Oe;Ie.prototype.visitList=Oe;Ie.prototype.visitStruct=Oe;Ie.prototype.visitUnion=Oe;Ie.prototype.visitDenseUnion=Oe;Ie.prototype.visitSparseUnion=Oe;Ie.prototype.visitDictionary=Oe;Ie.prototype.visitInterval=Oe;Ie.prototype.visitIntervalDayTime=Oe;Ie.prototype.visitIntervalYearMonth=Oe;Ie.prototype.visitFixedSizeList=Oe;Ie.prototype.visitMap=Oe;const ih=new Ie,eE=(n,e)=>n+e;class qi extends Ve{visitNull(e,t){return 0}visitInt(e,t){return e.type.bitWidth/8}visitFloat(e,t){return e.type.ArrayType.BYTES_PER_ELEMENT}visitBool(e,t){return 1/8}visitDecimal(e,t){return e.type.bitWidth/8}visitDate(e,t){return(e.type.unit+1)*4}visitTime(e,t){return e.type.bitWidth/8}visitTimestamp(e,t){return e.type.unit===Ke.SECOND?4:8}visitInterval(e,t){return(e.type.unit+1)*4}visitStruct(e,t){return e.children.reduce((s,a)=>s+Ar.visit(a,t),0)}visitFixedSizeBinary(e,t){return e.type.byteWidth}visitMap(e,t){return 8+e.children.reduce((s,a)=>s+Ar.visit(a,t),0)}visitDictionary(e,t){var s;return e.type.indices.bitWidth/8+(((s=e.dictionary)===null||s===void 0?void 0:s.getByteLength(e.values[t]))||0)}}const tE=({valueOffsets:n},e)=>8+(n[e+1]-n[e]),nE=({valueOffsets:n},e)=>8+(n[e+1]-n[e]),rE=({valueOffsets:n,stride:e,children:t},s)=>{const a=t[0],{[s*e]:u}=n,{[s*e+1]:d}=n,h=Ar.getVisitFn(a.type),p=a.slice(u,d-u);let y=8;for(let g=-1,v=d-u;++g<v;)y+=h(p,g);return y},iE=({stride:n,children:e},t)=>{const s=e[0],a=s.slice(t*n,n),u=Ar.getVisitFn(s.type);let d=0;for(let h=-1,p=a.length;++h<p;)d+=u(a,h);return d},sE=(n,e)=>n.type.mode===sr.Dense?f0(n,e):h0(n,e),f0=({type:n,children:e,typeIds:t,valueOffsets:s},a)=>{const u=n.typeIdToChildIndex[t[a]];return 8+Ar.visit(e[u],s[a])},h0=({children:n},e)=>4+Ar.visitMany(n,n.map(()=>e)).reduce(eE,0);qi.prototype.visitUtf8=tE;qi.prototype.visitBinary=nE;qi.prototype.visitList=rE;qi.prototype.visitFixedSizeList=iE;qi.prototype.visitUnion=sE;qi.prototype.visitDenseUnion=f0;qi.prototype.visitSparseUnion=h0;const Ar=new qi;var p0;const m0={},y0={};class ot{constructor(e){var t,s,a;const u=e[0]instanceof ot?e.flatMap(h=>h.data):e;if(u.length===0||u.some(h=>!(h instanceof It)))throw new TypeError("Vector constructor expects an Array of Data instances.");const d=(t=u[0])===null||t===void 0?void 0:t.type;switch(u.length){case 0:this._offsets=[0];break;case 1:{const{get:h,set:p,indexOf:y,byteLength:g}=m0[d.typeId],v=u[0];this.isValid=S=>rh(v,S),this.get=S=>h(v,S),this.set=(S,I)=>p(v,S,I),this.indexOf=S=>y(v,S),this.getByteLength=S=>g(v,S),this._offsets=[0,v.length];break}default:Object.setPrototypeOf(this,y0[d.typeId]),this._offsets=a0(u);break}this.data=u,this.type=d,this.stride=Kr(d),this.numChildren=(a=(s=d.children)===null||s===void 0?void 0:s.length)!==null&&a!==void 0?a:0,this.length=this._offsets.at(-1)}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((e,t)=>e+t.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=o0(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${O[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>0}getByteLength(e){return 0}[Symbol.iterator](){return ih.visit(this)}concat(...e){return new ot(this.data.concat(e.flatMap(t=>t.data).flat(Number.POSITIVE_INFINITY)))}slice(e,t){return new ot(i0(this,e,t,({data:s,_offsets:a},u,d)=>l0(s,a,u,d)))}toJSON(){return[...this]}toArray(){const{type:e,data:t,length:s,stride:a,ArrayType:u}=this;switch(e.typeId){case O.Int:case O.Float:case O.Decimal:case O.Time:case O.Timestamp:switch(t.length){case 0:return new u;case 1:return t[0].values.subarray(0,s*a);default:return t.reduce((d,{values:h,length:p})=>(d.array.set(h.subarray(0,p*a),d.offset),d.offset+=p*a,d),{array:new u(s*a),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)===null||t===void 0?void 0:t.findIndex(s=>s.name===e))}getChildAt(e){return e>-1&&e<this.numChildren?new ot(this.data.map(({children:t})=>t[e])):null}get isMemoized(){return Re.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Re.isDictionary(this.type)){const e=new Uu(this.data[0].dictionary),t=this.data.map(s=>{const a=s.clone();return a.dictionary=e,a});return new ot(t)}return new Uu(this)}unmemoize(){if(Re.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),t=this.data.map(s=>{const a=s.clone();return a.dictionary=e,a});return new ot(t)}return this}}p0=Symbol.toStringTag;ot[p0]=(n=>{n.type=Re.prototype,n.data=[],n.length=0,n.stride=1,n.numChildren=0,n._nullCount=-1,n._byteLength=-1,n._offsets=new Uint32Array([0]),n[Symbol.isConcatSpreadable]=!0;const e=Object.keys(O).map(t=>O[t]).filter(t=>typeof t=="number"&&t!==O.NONE);for(const t of e){const s=Sn.getVisitFnByTypeId(t),a=$n.getVisitFnByTypeId(t),u=ku.getVisitFnByTypeId(t),d=Ar.getVisitFnByTypeId(t);m0[t]={get:s,set:a,indexOf:u,byteLength:d},y0[t]=Object.create(n,{isValid:{value:mo(rh)},get:{value:mo(Sn.getVisitFnByTypeId(t))},set:{value:u0($n.getVisitFnByTypeId(t))},indexOf:{value:c0(ku.getVisitFnByTypeId(t))},getByteLength:{value:mo(Ar.getVisitFnByTypeId(t))}})}return"Vector"})(ot.prototype);class Uu extends ot{constructor(e){super(e.data);const t=this.get,s=this.set,a=this.slice,u=new Array(this.length);Object.defineProperty(this,"get",{value(d){const h=u[d];if(h!==void 0)return h;const p=t.call(this,d);return u[d]=p,p}}),Object.defineProperty(this,"set",{value(d,h){s.call(this,d,h),u[d]=h}}),Object.defineProperty(this,"slice",{value:(d,h)=>new Uu(a.call(this,d,h))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new ot(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Cf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,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(e,t,s,a){return e.prep(8,24),e.writeInt64(BigInt(a??0)),e.pad(4),e.writeInt32(s),e.writeInt64(BigInt(t??0)),e.offset()}}const of=2,xr=4,Gr=4,ct=4,Li=new Int32Array(2),Ny=new Float32Array(Li.buffer),Ly=new Float64Array(Li.buffer),lu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Of;(function(n){n[n.UTF8_BYTES=1]="UTF8_BYTES",n[n.UTF16_STRING=2]="UTF16_STRING"})(Of||(Of={}));let wo=class g0{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new g0(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return Li[0]=this.readInt32(e),Ny[0]}readFloat64(e){return Li[lu?0:1]=this.readInt32(e),Li[lu?1:0]=this.readInt32(e+4),Ly[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){Ny[0]=t,this.writeInt32(e,Li[0])}writeFloat64(e,t){Ly[0]=t,this.writeInt32(e,Li[lu?0:1]),this.writeInt32(e+4,Li[lu?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+xr+Gr)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let e="";for(let t=0;t<Gr;t++)e+=String.fromCharCode(this.readInt8(this.position_+xr+t));return e}__offset(e,t){const s=e-this.readInt32(e);return t<this.readInt16(s)?this.readInt16(s+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);const s=this.readInt32(e);e+=xr;const a=this.bytes_.subarray(e,e+s);return t===Of.UTF8_BYTES?a:this.text_decoder_.decode(a)}__union_with_string(e,t){return typeof e=="string"?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+xr}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=Gr)throw new Error("FlatBuffers: file identifier must be length "+Gr);for(let t=0;t<Gr;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+xr+t))return!1;return!0}createScalarList(e,t){const s=[];for(let a=0;a<t;++a){const u=e(a);u!==null&&s.push(u)}return s}createObjList(e,t){const s=[];for(let a=0;a<t;++a){const u=e(a);u!==null&&s.push(u.unpack())}return s}},v0=class w0{constructor(e){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 t;e?t=e:t=1024,this.bb=wo.allocate(t),this.space=t}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(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(e,t){e>this.minalign&&(this.minalign=e);const s=~(this.bb.capacity()-this.space+t)+1&e-1;for(;this.space<s+e+t;){const a=this.bb.capacity();this.bb=w0.growByteBuffer(this.bb),this.space+=this.bb.capacity()-a}this.pad(s)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(this.space-=1,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,s){(this.force_defaults||t!=s)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,s){(this.force_defaults||t!=s)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,s){(this.force_defaults||t!=s)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,s){(this.force_defaults||t!==s)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,s){(this.force_defaults||t!=s)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,s){(this.force_defaults||t!=s)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,s){(this.force_defaults||t!=s)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,s){t!=s&&(this.nested(t),this.slot(e))}nested(e){if(e!=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(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){const t=e.capacity();if(t&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const s=t<<1,a=wo.allocate(s);return a.setPosition(s-t),a.bytes().set(e.bytes(),s-t),a}addOffset(e){this.prep(xr,0),this.writeInt32(this.offset()-e+xr)}startObject(e){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=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 e=this.offset();let t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);const s=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]!=0?e-this.vtable[t]:0);const a=2;this.addInt16(e-this.object_start);const u=(s+a)*of;this.addInt16(u);let d=0;const h=this.space;e:for(t=0;t<this.vtables.length;t++){const p=this.bb.capacity()-this.vtables[t];if(u==this.bb.readInt16(p)){for(let y=of;y<u;y+=of)if(this.bb.readInt16(h+y)!=this.bb.readInt16(p+y))continue e;d=this.vtables[t];break}}return d?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,d-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,s){const a=s?ct:0;if(t){const u=t;if(this.prep(this.minalign,xr+Gr+a),u.length!=Gr)throw new TypeError("FlatBuffers: file identifier must be length "+Gr);for(let d=Gr-1;d>=0;d--)this.writeInt8(u.charCodeAt(d))}this.prep(this.minalign,xr+a),this.addOffset(e),a&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){const s=this.bb.capacity()-e,a=s-this.bb.readInt32(s);if(!(t<this.bb.readInt16(a)&&this.bb.readInt16(a+t)!=0))throw new TypeError("FlatBuffers: field "+t+" must be set")}startVector(e,t,s){this.notNested(),this.vector_num_elems=t,this.prep(xr,e*t),this.prep(s,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(e))return this.string_maps.get(e);const t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;e instanceof Uint8Array?t=e:t=this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length);for(let s=0,a=this.space,u=this.bb.bytes();s<t.length;s++)u[a++]=t[s];return this.endVector()}createObjectOffset(e){return e===null?0:typeof e=="string"?this.createString(e):e.pack(this)}createObjectOffsetList(e){const t=[];for(let s=0;s<e.length;++s){const a=e[s];if(a!==null)t.push(this.createObjectOffset(a));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}};class kt{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(e,t){return(t||new kt).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsKeyValue(e,t){return e.setPosition(e.position()+ct),(t||new kt).__init(e.readInt32(e.position())+e.position(),e)}key(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(e,t,s){return kt.startKeyValue(e),kt.addKey(e,t),kt.addValue(e,s),kt.endKeyValue(e)}}var So;(function(n){n[n.V1=0]="V1",n[n.V2=1]="V2",n[n.V3=2]="V3",n[n.V4=3]="V4",n[n.V5=4]="V5"})(So||(So={}));var _o;(function(n){n[n.Little=0]="Little",n[n.Big=1]="Big"})(_o||(_o={}));var ju;(function(n){n[n.DenseArray=0]="DenseArray"})(ju||(ju={}));class On{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(e,t){return(t||new On).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInt(e,t){return e.setPosition(e.position()+ct),(t||new On).__init(e.readInt32(e.position())+e.position(),e)}bitWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(e,t,s){return On.startInt(e),On.addBitWidth(e,t),On.addIsSigned(e,s),On.endInt(e)}}class Jr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(e,t){return(t||new Jr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryEncoding(e,t){return e.setPosition(e.position()+ct),(t||new Jr).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}indexType(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new On).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):ju.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,ju.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}}class vs{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(e,t){return(t||new vs).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBinary(e,t){return e.setPosition(e.position()+ct),(t||new vs).__init(e.readInt32(e.position())+e.position(),e)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(e){return vs.startBinary(e),vs.endBinary(e)}}class ws{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(e,t){return(t||new ws).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBool(e,t){return e.setPosition(e.position()+ct),(t||new ws).__init(e.readInt32(e.position())+e.position(),e)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(e){return ws.startBool(e),ws.endBool(e)}}var zu;(function(n){n[n.DAY=0]="DAY",n[n.MILLISECOND=1]="MILLISECOND"})(zu||(zu={}));let hu=class so{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(e,t){return(t||new so).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDate(e,t){return e.setPosition(e.position()+ct),(t||new so).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):zu.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,zu.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(e,t){return so.startDate(e),so.addUnit(e,t),so.endDate(e)}};class gn{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(e,t){return(t||new gn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDecimal(e,t){return e.setPosition(e.position()+ct),(t||new gn).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(e,t,s,a){return gn.startDecimal(e),gn.addPrecision(e,t),gn.addScale(e,s),gn.addBitWidth(e,a),gn.endDecimal(e)}}var bo;(function(n){n[n.SECOND=0]="SECOND",n[n.MILLISECOND=1]="MILLISECOND",n[n.MICROSECOND=2]="MICROSECOND",n[n.NANOSECOND=3]="NANOSECOND"})(bo||(bo={}));class Dr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(e,t){return(t||new Dr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeBinary(e,t){return e.setPosition(e.position()+ct),(t||new Dr).__init(e.readInt32(e.position())+e.position(),e)}byteWidth(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(e,t){return Dr.startFixedSizeBinary(e),Dr.addByteWidth(e,t),Dr.endFixedSizeBinary(e)}}class Cr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(e,t){return(t||new Cr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFixedSizeList(e,t){return e.setPosition(e.position()+ct),(t||new Cr).__init(e.readInt32(e.position())+e.position(),e)}listSize(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(e,t){return Cr.startFixedSizeList(e),Cr.addListSize(e,t),Cr.endFixedSizeList(e)}}var Vu;(function(n){n[n.HALF=0]="HALF",n[n.SINGLE=1]="SINGLE",n[n.DOUBLE=2]="DOUBLE"})(Vu||(Vu={}));class Or{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(e,t){return(t||new Or).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFloatingPoint(e,t){return e.setPosition(e.position()+ct),(t||new Or).__init(e.readInt32(e.position())+e.position(),e)}precision(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Vu.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,Vu.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(e,t){return Or.startFloatingPoint(e),Or.addPrecision(e,t),Or.endFloatingPoint(e)}}var $u;(function(n){n[n.YEAR_MONTH=0]="YEAR_MONTH",n[n.DAY_TIME=1]="DAY_TIME",n[n.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})($u||($u={}));class Rr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(e,t){return(t||new Rr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsInterval(e,t){return e.setPosition(e.position()+ct),(t||new Rr).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):$u.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,$u.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(e,t){return Rr.startInterval(e),Rr.addUnit(e,t),Rr.endInterval(e)}}class Ss{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(e,t){return(t||new Ss).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsList(e,t){return e.setPosition(e.position()+ct),(t||new Ss).__init(e.readInt32(e.position())+e.position(),e)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(e){return Ss.startList(e),Ss.endList(e)}}let pu=class oo{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(e,t){return(t||new oo).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMap(e,t){return e.setPosition(e.position()+ct),(t||new oo).__init(e.readInt32(e.position())+e.position(),e)}keysSorted(){const e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(e,t){return oo.startMap(e),oo.addKeysSorted(e,t),oo.endMap(e)}};class _s{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(e,t){return(t||new _s).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsNull(e,t){return e.setPosition(e.position()+ct),(t||new _s).__init(e.readInt32(e.position())+e.position(),e)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(e){return _s.startNull(e),_s.endNull(e)}}class bs{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(e,t){return(t||new bs).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsStruct_(e,t){return e.setPosition(e.position()+ct),(t||new bs).__init(e.readInt32(e.position())+e.position(),e)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(e){return bs.startStruct_(e),bs.endStruct_(e)}}class Un{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(e,t){return(t||new Un).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTime(e,t){return e.setPosition(e.position()+ct),(t||new Un).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):bo.MILLISECOND}bitWidth(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,bo.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(e,t,s){return Un.startTime(e),Un.addUnit(e,t),Un.addBitWidth(e,s),Un.endTime(e)}}class jn{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(e,t){return(t||new jn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsTimestamp(e,t){return e.setPosition(e.position()+ct),(t||new jn).__init(e.readInt32(e.position())+e.position(),e)}unit(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):bo.SECOND}timezone(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,bo.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(e,t,s){return jn.startTimestamp(e),jn.addUnit(e,t),jn.addTimezone(e,s),jn.endTimestamp(e)}}var Wu;(function(n){n[n.Sparse=0]="Sparse",n[n.Dense=1]="Dense"})(Wu||(Wu={}));class vn{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(e,t){return(t||new vn).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUnion(e,t){return e.setPosition(e.position()+ct),(t||new vn).__init(e.readInt32(e.position())+e.position(),e)}mode(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Wu.Sparse}typeIds(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){const e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,Wu.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addInt32(t[s]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(e,t,s){return vn.startUnion(e),vn.addMode(e,t),vn.addTypeIds(e,s),vn.endUnion(e)}}class Is{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(e,t){return(t||new Is).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,t){return e.setPosition(e.position()+ct),(t||new Is).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return Is.startUtf8(e),Is.endUtf8(e)}}var Et;(function(n){n[n.NONE=0]="NONE",n[n.Null=1]="Null",n[n.Int=2]="Int",n[n.FloatingPoint=3]="FloatingPoint",n[n.Binary=4]="Binary",n[n.Utf8=5]="Utf8",n[n.Bool=6]="Bool",n[n.Decimal=7]="Decimal",n[n.Date=8]="Date",n[n.Time=9]="Time",n[n.Timestamp=10]="Timestamp",n[n.Interval=11]="Interval",n[n.List=12]="List",n[n.Struct_=13]="Struct_",n[n.Union=14]="Union",n[n.FixedSizeBinary=15]="FixedSizeBinary",n[n.FixedSizeList=16]="FixedSizeList",n[n.Map=17]="Map",n[n.Duration=18]="Duration",n[n.LargeBinary=19]="LargeBinary",n[n.LargeUtf8=20]="LargeUtf8",n[n.LargeList=21]="LargeList",n[n.RunEndEncoded=22]="RunEndEncoded"})(Et||(Et={}));let Ln=class mu{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(e,t){return(t||new mu).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,t){return e.setPosition(e.position()+ct),(t||new mu).__init(e.readInt32(e.position())+e.position(),e)}name(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Et.NONE}type(e){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){const t=this.bb.__offset(this.bb_pos,12);return t?(e||new Jr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(e,t){const s=this.bb.__offset(this.bb_pos,14);return s?(t||new mu).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,16);return s?(t||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,Et.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}},br=class Hr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(e,t){return(t||new Hr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,t){return e.setPosition(e.position()+ct),(t||new Hr).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_o.Little}fields(e,t){const s=this.bb.__offset(this.bb_pos,6);return s?(t||new Ln).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,_o.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let s=t.length-1;s>=0;s--)e.addInt64(t[s]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,t){e.finish(t)}static finishSizePrefixedSchemaBuffer(e,t){e.finish(t,void 0,!0)}static createSchema(e,t,s,a,u){return Hr.startSchema(e),Hr.addEndianness(e,t),Hr.addFields(e,s),Hr.addCustomMetadata(e,a),Hr.addFeatures(e,u),Hr.endSchema(e)}},wr=class Rf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(e,t){return(t||new Rf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,t){return e.setPosition(e.position()+ct),(t||new Rf).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):So.V1}schema(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new br).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new Cf).__init(this.bb.__vector(this.bb_pos+s)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){const s=this.bb.__offset(this.bb_pos,10);return s?(t||new Cf).__init(this.bb.__vector(this.bb_pos+s)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,12);return s?(t||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,So.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}};class Je{constructor(e=[],t,s){this.fields=e||[],this.metadata=t||new Map,s||(s=Ff(e)),this.dictionaries=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(", ")} }>`}select(e){const t=new Set(e),s=this.fields.filter(a=>t.has(a.name));return new Je(s,this.metadata)}selectAt(e){const t=e.map(s=>this.fields[s]).filter(Boolean);return new Je(t,this.metadata)}assign(...e){const t=e[0]instanceof Je?e[0]:Array.isArray(e[0])?new Je(e[0]):new Je(e),s=[...this.fields],a=uu(uu(new Map,this.metadata),t.metadata),u=t.fields.filter(h=>{const p=s.findIndex(y=>y.name===h.name);return~p?(s[p]=h.clone({metadata:uu(uu(new Map,s[p].metadata),h.metadata)}))&&!1:!0}),d=Ff(u,new Map);return new Je([...s,...u],a,new Map([...this.dictionaries,...d]))}}Je.prototype.fields=null;Je.prototype.metadata=null;Je.prototype.dictionaries=null;class gt{static new(...e){let[t,s,a,u]=e;return e[0]&&typeof e[0]=="object"&&({name:t}=e[0],s===void 0&&(s=e[0].type),a===void 0&&(a=e[0].nullable),u===void 0&&(u=e[0].metadata)),new gt(`${t}`,s,a,u)}constructor(e,t,s=!1,a){this.name=e,this.type=t,this.nullable=s,this.metadata=a||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[t,s,a,u]=e;return!e[0]||typeof e[0]!="object"?[t=this.name,s=this.type,a=this.nullable,u=this.metadata]=e:{name:t=this.name,type:s=this.type,nullable:a=this.nullable,metadata:u=this.metadata}=e[0],gt.new(t,s,a,u)}}gt.prototype.type=null;gt.prototype.name=null;gt.prototype.nullable=null;gt.prototype.metadata=null;function uu(n,e){return new Map([...n||new Map,...e||new Map])}function Ff(n,e=new Map){for(let t=-1,s=n.length;++t<s;){const u=n[t].type;if(Re.isDictionary(u)){if(!e.has(u.id))e.set(u.id,u.dictionary);else if(e.get(u.id)!==u.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}u.children&&u.children.length>0&&Ff(u.children,e)}return e}var oE=v0,aE=wo;class sh{static decode(e){e=new aE(Ge(e));const t=wr.getRootAsFooter(e),s=Je.decode(t.schema());return new lE(s,t)}static encode(e){const t=new oE,s=Je.encode(t,e.schema);wr.startRecordBatchesVector(t,e.numRecordBatches);for(const d of[...e.recordBatches()].slice().reverse())Io.encode(t,d);const a=t.endVector();wr.startDictionariesVector(t,e.numDictionaries);for(const d of[...e.dictionaryBatches()].slice().reverse())Io.encode(t,d);const u=t.endVector();return wr.startFooter(t),wr.addSchema(t,s),wr.addVersion(t,Vn.V4),wr.addRecordBatches(t,a),wr.addDictionaries(t,u),wr.finishFooterBuffer(t,wr.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=Vn.V4,s,a){this.schema=e,this.version=t,s&&(this._recordBatches=s),a&&(this._dictionaryBatches=a)}*recordBatches(){for(let e,t=-1,s=this.numRecordBatches;++t<s;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,s=this.numDictionaries;++t<s;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}}class lE extends sh{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){const t=this._footer.recordBatches(e);if(t)return Io.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){const t=this._footer.dictionaries(e);if(t)return Io.decode(t)}return null}}class Io{static decode(e){return new Io(e.metaDataLength(),e.bodyLength(),e.offset())}static encode(e,t){const{metaDataLength:s}=t,a=BigInt(t.offset),u=BigInt(t.bodyLength);return Cf.createBlock(e,a,s,u)}constructor(e,t,s){this.metaDataLength=e,this.offset=or(s),this.bodyLength=or(t)}}const xt=Object.freeze({done:!0,value:void 0});class By{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class S0{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class uE extends S0{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return ve(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(xt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return kn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return kn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return ve(this,void 0,void 0,function*(){return yield this.abort(e),xt})}return(e){return ve(this,void 0,void 0,function*(){return yield this.close(),xt})}read(e){return ve(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return ve(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){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((t,s)=>{this.resolvers.push({resolve:t,reject:s})}):Promise.resolve(xt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class cE extends uE{write(e){if((e=Ge(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?_f(this.toUint8Array(!0)):this.toUint8Array(!1).then(_f)}toUint8Array(e=!1){return e?Mr(this._values)[0]:ve(this,void 0,void 0,function*(){var t,s,a,u;const d=[];let h=0;try{for(var p=!0,y=uo(this),g;g=yield y.next(),t=g.done,!t;p=!0){u=g.value,p=!1;const v=u;d.push(v),h+=v.byteLength}}catch(v){s={error:v}}finally{try{!p&&!t&&(a=y.return)&&(yield a.call(y))}finally{if(s)throw s.error}}return Mr(d,h)[0]})}}class Qu{constructor(e){e&&(this.source=new dE(kn.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Eo{constructor(e){e instanceof Eo?this.source=e.source:e instanceof cE?this.source=new fs(kn.fromAsyncIterable(e)):tv(e)?this.source=new fs(kn.fromNodeStream(e)):qf(e)?this.source=new fs(kn.fromDOMStream(e)):Zg(e)?this.source=new fs(kn.fromDOMStream(e.body)):sc(e)?this.source=new fs(kn.fromIterable(e)):Ma(e)?this.source=new fs(kn.fromAsyncIterable(e)):Hf(e)&&(this.source=new fs(kn.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class dE{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,t="read"){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||xt)}return(e){return Object.create(this.source.return&&this.source.return(e)||xt)}}class fs{constructor(e){this.source=e,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}cancel(e){return ve(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return ve(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return ve(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e,t="read"){return ve(this,void 0,void 0,function*(){return yield this.source.next({cmd:t,size:e})})}throw(e){return ve(this,void 0,void 0,function*(){const t=this.source.throw&&(yield this.source.throw(e))||xt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return ve(this,void 0,void 0,function*(){const t=this.source.return&&(yield this.source.return(e))||xt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}}class ky extends Qu{constructor(e,t){super(),this.position=0,this.buffer=Ge(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){const{buffer:t,byteOffset:s}=this.readAt(e,4);return new DataView(t,s).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){const{buffer:t,size:s,position:a}=this;return t&&a<s?(typeof e!="number"&&(e=Number.POSITIVE_INFINITY),this.position=Math.min(s,a+Math.min(s-a,e)),t.subarray(a,this.position)):null}readAt(e,t){const s=this.buffer,a=Math.min(this.size,e+t);return s?s.subarray(e,a):new Uint8Array(t)}close(){this.buffer&&(this.buffer=null)}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}}class Hu extends Eo{constructor(e,t){super(),this.position=0,this._handle=e,typeof t=="number"?this.size=t:this._pending=ve(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return ve(this,void 0,void 0,function*(){const{buffer:t,byteOffset:s}=yield this.readAt(e,4);return new DataView(t,s).getInt32(0,!0)})}seek(e){return ve(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return ve(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:t,size:s,position:a}=this;if(t&&a<s){typeof e!="number"&&(e=Number.POSITIVE_INFINITY);let u=a,d=0,h=0;const p=Math.min(s,u+Math.min(s-u,e)),y=new Uint8Array(Math.max(0,(this.position=p)-u));for(;(u+=h)<p&&(d+=h)<y.byteLength;)({bytesRead:h}=yield t.read(y,d,y.byteLength-d,u));return y}return null})}readAt(e,t){return ve(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:s,size:a}=this;if(s&&e+t<a){const u=Math.min(a,e+t),d=new Uint8Array(u-e);return(yield s.read(d,0,t,e)).buffer}return new Uint8Array(t)})}close(){return ve(this,void 0,void 0,function*(){const e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return ve(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return ve(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}}const fE=65536;function lo(n){return n<0&&(n=4294967295+n+1),`0x${n.toString(16)}`}const xo=8,oh=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class _0{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){const t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),s=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let a=t[3]*s[3];this.buffer[0]=a&65535;let u=a>>>16;return a=t[2]*s[3],u+=a,a=t[3]*s[2]>>>0,u+=a,this.buffer[0]+=u<<16,this.buffer[1]=u>>>0<a?fE:0,this.buffer[1]+=u>>>16,this.buffer[1]+=t[1]*s[3]+t[2]*s[2]+t[3]*s[1],this.buffer[1]+=t[0]*s[3]+t[1]*s[2]+t[2]*s[1]+t[3]*s[0]<<16,this}_plus(e){const t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${lo(this.buffer[1])} ${lo(this.buffer[0])}`}}class tt extends _0{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(e,t=new Uint32Array(2)){return tt.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return tt.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){const s=e.length,a=new tt(t);for(let u=0;u<s;){const d=xo<s-u?xo:s-u,h=new tt(new Uint32Array([Number.parseInt(e.slice(u,u+d),10),0])),p=new tt(new Uint32Array([oh[d],0]));a.times(p),a.plus(h),u+=d}return a}static convertArray(e){const t=new Uint32Array(e.length*2);for(let s=-1,a=e.length;++s<a;)tt.from(e[s],new Uint32Array(t.buffer,t.byteOffset+2*s*4,2));return t}static multiply(e,t){return new tt(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new tt(new Uint32Array(e.buffer)).plus(t)}}class yn extends _0{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){const t=this.buffer[1]<<0,s=e.buffer[1]<<0;return t<s||t===s&&this.buffer[0]<e.buffer[0]}static from(e,t=new Uint32Array(2)){return yn.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(2)){return yn.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(2)){const s=e.startsWith("-"),a=e.length,u=new yn(t);for(let d=s?1:0;d<a;){const h=xo<a-d?xo:a-d,p=new yn(new Uint32Array([Number.parseInt(e.slice(d,d+h),10),0])),y=new yn(new Uint32Array([oh[h],0]));u.times(y),u.plus(p),d+=h}return s?u.negate():u}static convertArray(e){const t=new Uint32Array(e.length*2);for(let s=-1,a=e.length;++s<a;)yn.from(e[s],new Uint32Array(t.buffer,t.byteOffset+2*s*4,2));return t}static multiply(e,t){return new yn(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new yn(new Uint32Array(e.buffer)).plus(t)}}class Ir{constructor(e){this.buffer=e}high(){return new yn(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new yn(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(e){const t=new tt(new Uint32Array([this.buffer[3],0])),s=new tt(new Uint32Array([this.buffer[2],0])),a=new tt(new Uint32Array([this.buffer[1],0])),u=new tt(new Uint32Array([this.buffer[0],0])),d=new tt(new Uint32Array([e.buffer[3],0])),h=new tt(new Uint32Array([e.buffer[2],0])),p=new tt(new Uint32Array([e.buffer[1],0])),y=new tt(new Uint32Array([e.buffer[0],0]));let g=tt.multiply(u,y);this.buffer[0]=g.low();const v=new tt(new Uint32Array([g.high(),0]));return g=tt.multiply(a,y),v.plus(g),g=tt.multiply(u,p),v.plus(g),this.buffer[1]=v.low(),this.buffer[3]=v.lessThan(g)?1:0,this.buffer[2]=v.high(),new tt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(tt.multiply(s,y)).plus(tt.multiply(a,p)).plus(tt.multiply(u,h)),this.buffer[3]+=tt.multiply(t,y).plus(tt.multiply(s,p)).plus(tt.multiply(a,h)).plus(tt.multiply(u,d)).low(),this}plus(e){const t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${lo(this.buffer[3])} ${lo(this.buffer[2])} ${lo(this.buffer[1])} ${lo(this.buffer[0])}`}static multiply(e,t){return new Ir(new Uint32Array(e.buffer)).times(t)}static add(e,t){return new Ir(new Uint32Array(e.buffer)).plus(t)}static from(e,t=new Uint32Array(4)){return Ir.fromString(typeof e=="string"?e:e.toString(),t)}static fromNumber(e,t=new Uint32Array(4)){return Ir.fromString(e.toString(),t)}static fromString(e,t=new Uint32Array(4)){const s=e.startsWith("-"),a=e.length,u=new Ir(t);for(let d=s?1:0;d<a;){const h=xo<a-d?xo:a-d,p=new Ir(new Uint32Array([Number.parseInt(e.slice(d,d+h),10),0,0,0])),y=new Ir(new Uint32Array([oh[h],0,0,0]));u.times(y),u.plus(p),d+=h}return s?u.negate():u}static convertArray(e){const t=new Uint32Array(e.length*4);for(let s=-1,a=e.length;++s<a;)Ir.from(e[s],new Uint32Array(t.buffer,t.byteOffset+4*4*s,4));return t}}class b0 extends Ve{constructor(e,t,s,a){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=e,this.nodes=t,this.buffers=s,this.dictionaries=a}visit(e){return super.visit(e instanceof gt?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return ke({type:e,length:t})}visitBool(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitInt(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinary(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitFixedSizeBinary(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitDate(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitTime(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitList(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),children:this.visitMany(e.children)})}visitUnion(e){return e.mode===sr.Sparse?this.visitSparseUnion(e):this.visitDenseUnion(e)}visitDenseUnion(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:s}=this.nextFieldNode()){return ke({type:e,length:t,nullCount:s,nullBitmap:this.readNullBitmap(e,s),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,s=this.nextBufferRange()){return t>0&&this.readData(e,s)||new Uint8Array(0)}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:s}=this.nextBufferRange()){return this.bytes.subarray(s,s+t)}readDictionary(e){return this.dictionaries.get(e.id)}}class hE extends b0{constructor(e,t,s,a){super(new Uint8Array(0),t,s,a),this.sources=e}readNullBitmap(e,t,{offset:s}=this.nextBufferRange()){return t<=0?new Uint8Array(0):Ef(this.sources[s])}readOffsets(e,{offset:t}=this.nextBufferRange()){return ut(Uint8Array,ut(Int32Array,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return ut(Uint8Array,ut(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){const{sources:s}=this;return Re.isTimestamp(e)||(Re.isInt(e)||Re.isTime(e))&&e.bitWidth===64||Re.isDate(e)&&e.unit===ri.MILLISECOND?ut(Uint8Array,yn.convertArray(s[t])):Re.isDecimal(e)?ut(Uint8Array,Ir.convertArray(s[t])):Re.isBinary(e)||Re.isFixedSizeBinary(e)?pE(s[t]):Re.isBool(e)?Ef(s[t]):Re.isUtf8(e)?Qf(s[t].join("")):ut(Uint8Array,ut(e.ArrayType,s[t].map(a=>+a)))}}function pE(n){const e=n.join(""),t=new Uint8Array(e.length/2);for(let s=0;s<e.length;s+=2)t[s>>1]=Number.parseInt(e.slice(s,s+2),16);return t}class Ee extends Ve{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((s,a)=>this.compareFields(s,t[a]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}}function _n(n,e){return e instanceof n.constructor}function Wa(n,e){return n===e||_n(n,e)}function ai(n,e){return n===e||_n(n,e)&&n.bitWidth===e.bitWidth&&n.isSigned===e.isSigned}function ac(n,e){return n===e||_n(n,e)&&n.precision===e.precision}function mE(n,e){return n===e||_n(n,e)&&n.byteWidth===e.byteWidth}function ah(n,e){return n===e||_n(n,e)&&n.unit===e.unit}function Qa(n,e){return n===e||_n(n,e)&&n.unit===e.unit&&n.timezone===e.timezone}function Ha(n,e){return n===e||_n(n,e)&&n.unit===e.unit&&n.bitWidth===e.bitWidth}function yE(n,e){return n===e||_n(n,e)&&n.children.length===e.children.length&&$i.compareManyFields(n.children,e.children)}function gE(n,e){return n===e||_n(n,e)&&n.children.length===e.children.length&&$i.compareManyFields(n.children,e.children)}function lh(n,e){return n===e||_n(n,e)&&n.mode===e.mode&&n.typeIds.every((t,s)=>t===e.typeIds[s])&&$i.compareManyFields(n.children,e.children)}function vE(n,e){return n===e||_n(n,e)&&n.id===e.id&&n.isOrdered===e.isOrdered&&$i.visit(n.indices,e.indices)&&$i.visit(n.dictionary,e.dictionary)}function uh(n,e){return n===e||_n(n,e)&&n.unit===e.unit}function wE(n,e){return n===e||_n(n,e)&&n.listSize===e.listSize&&n.children.length===e.children.length&&$i.compareManyFields(n.children,e.children)}function SE(n,e){return n===e||_n(n,e)&&n.keysSorted===e.keysSorted&&n.children.length===e.children.length&&$i.compareManyFields(n.children,e.children)}Ee.prototype.visitNull=Wa;Ee.prototype.visitBool=Wa;Ee.prototype.visitInt=ai;Ee.prototype.visitInt8=ai;Ee.prototype.visitInt16=ai;Ee.prototype.visitInt32=ai;Ee.prototype.visitInt64=ai;Ee.prototype.visitUint8=ai;Ee.prototype.visitUint16=ai;Ee.prototype.visitUint32=ai;Ee.prototype.visitUint64=ai;Ee.prototype.visitFloat=ac;Ee.prototype.visitFloat16=ac;Ee.prototype.visitFloat32=ac;Ee.prototype.visitFloat64=ac;Ee.prototype.visitUtf8=Wa;Ee.prototype.visitBinary=Wa;Ee.prototype.visitFixedSizeBinary=mE;Ee.prototype.visitDate=ah;Ee.prototype.visitDateDay=ah;Ee.prototype.visitDateMillisecond=ah;Ee.prototype.visitTimestamp=Qa;Ee.prototype.visitTimestampSecond=Qa;Ee.prototype.visitTimestampMillisecond=Qa;Ee.prototype.visitTimestampMicrosecond=Qa;Ee.prototype.visitTimestampNanosecond=Qa;Ee.prototype.visitTime=Ha;Ee.prototype.visitTimeSecond=Ha;Ee.prototype.visitTimeMillisecond=Ha;Ee.prototype.visitTimeMicrosecond=Ha;Ee.prototype.visitTimeNanosecond=Ha;Ee.prototype.visitDecimal=Wa;Ee.prototype.visitList=yE;Ee.prototype.visitStruct=gE;Ee.prototype.visitUnion=lh;Ee.prototype.visitDenseUnion=lh;Ee.prototype.visitSparseUnion=lh;Ee.prototype.visitDictionary=vE;Ee.prototype.visitInterval=uh;Ee.prototype.visitIntervalDayTime=uh;Ee.prototype.visitIntervalYearMonth=uh;Ee.prototype.visitFixedSizeList=wE;Ee.prototype.visitMap=SE;const $i=new Ee;function _E(n,e){return $i.compareSchemas(n,e)}function af(n,e){return bE(n,e.map(t=>t.data.concat()))}function bE(n,e){const t=[...n.fields],s=[],a={numBatches:e.reduce((v,S)=>Math.max(v,S.length),0)};let u=0,d=0,h=-1;const p=e.length;let y,g=[];for(;a.numBatches-- >0;){for(d=Number.POSITIVE_INFINITY,h=-1;++h<p;)g[h]=y=e[h].shift(),d=Math.min(d,y?y.length:d);Number.isFinite(d)&&(g=IE(t,d,g,e,a),d>0&&(s[u++]=ke({type:new on(t),length:d,nullCount:0,children:g.slice()})))}return[n=n.assign(t),s.map(v=>new nr(n,v))]}function IE(n,e,t,s,a){var u;const d=(e+63&-64)>>3;for(let h=-1,p=s.length;++h<p;){const y=t[h],g=y==null?void 0:y.length;if(g>=e)g===e?t[h]=y:(t[h]=y.slice(0,e),a.numBatches=Math.max(a.numBatches,s[h].unshift(y.slice(e,g-e))));else{const v=n[h];n[h]=v.clone({nullable:!0}),t[h]=(u=y==null?void 0:y._changeLengthAndBackfillNullBitmap(e))!==null&&u!==void 0?u:ke({type:v.type,length:e,nullCount:e,nullBitmap:new Uint8Array(d)})}}return t}var I0;class zn{constructor(...e){var t,s;if(e.length===0)return this.batches=[],this.schema=new Je([]),this._offsets=[0],this;let a,u;e[0]instanceof Je&&(a=e.shift()),e.at(-1)instanceof Uint32Array&&(u=e.pop());const d=p=>{if(p){if(p instanceof nr)return[p];if(p instanceof zn)return p.batches;if(p instanceof It){if(p.type instanceof on)return[new nr(new Je(p.type.children),p)]}else{if(Array.isArray(p))return p.flatMap(y=>d(y));if(typeof p[Symbol.iterator]=="function")return[...p].flatMap(y=>d(y));if(typeof p=="object"){const y=Object.keys(p),g=y.map(I=>new ot([p[I]])),v=new Je(y.map((I,T)=>new gt(String(I),g[T].type))),[,S]=af(v,g);return S.length===0?[new nr(p)]:S}}}return[]},h=e.flatMap(p=>d(p));if(a=(s=a??((t=h[0])===null||t===void 0?void 0:t.schema))!==null&&s!==void 0?s:new Je([]),!(a instanceof Je))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const p of h){if(!(p instanceof nr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!_E(a,p.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=a,this.batches=h,this._offsets=u??a0(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=o0(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}set(e,t){}indexOf(e,t){return-1}getByteLength(e){return 0}[Symbol.iterator](){return this.batches.length>0?ih.visit(new ot(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
80
80
  ${this.toArray().join(`,
81
81
  `)}
82
- ]`}concat(...e){const t=this.schema,s=this.data.concat(e.flatMap(({data:a})=>a));return new zn(t,s.map(a=>new nr(t,a)))}slice(e,t){const s=this.schema;[e,t]=i0({length:this.numRows},e,t);const a=l0(this.data,this._offsets,e,t);return new zn(s,a.map(u=>new nr(s,u)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){const t=this.data.map(s=>s.children[e]);if(t.length===0){const{type:s}=this.schema.fields[e],a=ke({type:s,length:0,nullCount:0});t.push(a._changeLengthAndBackfillNullBitmap(this.numRows))}return new ot(t)}return null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=[...this.batches];if(e>-1&&e<this.numCols){t||(t=new ot([ke({type:new zi,length:this.numRows})]));const u=s.fields.slice(),d=u[e].clone({type:t.type}),h=this.schema.fields.map((p,y)=>this.getChildAt(y));[u[e],h[e]]=[d,t],[s,a]=af(s,h)}return new zn(s,a)}select(e){const t=this.schema.fields.reduce((s,a,u)=>s.set(a.name,u),new Map);return this.selectAt(e.map(s=>t.get(s)).filter(s=>s>-1))}selectAt(e){const t=this.schema.selectAt(e),s=this.batches.map(a=>a.selectAt(e));return new zn(t,s)}assign(e){const t=this.schema.fields,[s,a]=e.schema.fields.reduce((h,p,y)=>{const[g,v]=h,S=t.findIndex(I=>I.name===p.name);return~S?v[S]=y:g.push(y),h},[[],[]]),u=this.schema.assign(e.schema),d=[...t.map((h,p)=>[p,a[p]]).map(([h,p])=>p===void 0?this.getChildAt(h):e.getChildAt(p)),...s.map(h=>e.getChildAt(h))].filter(Boolean);return new zn(...af(u,d))}}I0=Symbol.toStringTag;zn[I0]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=mo(rh),n.get=mo(Sn.getVisitFn(O.Struct)),n.set=u0($n.getVisitFn(O.Struct)),n.indexOf=c0(ku.getVisitFn(O.Struct)),n.getByteLength=mo(Ar.getVisitFn(O.Struct)),"Table"))(zn.prototype);var E0;let nr=class xa{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Je))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=ke({nullCount:0,type:new on(this.schema.fields),children:this.schema.fields.map(t=>ke({type:t.type,nullCount:0}))})]=e,!(this.data instanceof It))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Uy(this.schema,this.data.children);break}case 1:{const[t]=e,{fields:s,children:a,length:u}=Object.keys(t).reduce((p,y,g)=>(p.children[g]=t[y],p.length=Math.max(p.length,t[y].length),p.fields[g]=gt.new({name:y,type:t[y].type,nullable:!0}),p),{length:0,fields:new Array,children:new Array}),d=new Je(s),h=ke({type:new on(s),length:u,children:a,nullCount:0});[this.schema,this.data]=Uy(d,h.children,u);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=x0(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(e){return this.data.getValid(e)}get(e){return Sn.visit(this.data,e)}set(e,t){return $n.visit(this.data,e,t)}indexOf(e,t){return ku.visit(this.data,e,t)}getByteLength(e){return Ar.visit(this.data,e)}[Symbol.iterator](){return ih.visit(new ot([this.data]))}toArray(){return[...this]}concat(...e){return new zn(this.schema,[this,...e])}slice(e,t){const[s]=new ot([this.data]).slice(e,t).data;return new xa(this.schema,s)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)===null||t===void 0?void 0:t.findIndex(s=>s.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new ot([this.data.children[e]]):null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=this.data;if(e>-1&&e<this.numCols){t||(t=new ot([ke({type:new zi,length:this.numRows})]));const u=s.fields.slice(),d=a.children.slice(),h=u[e].clone({type:t.type});[u[e],d[e]]=[h,t.data[0]],s=new Je(u,new Map(this.schema.metadata)),a=ke({type:new on(u),children:d})}return new xa(s,a)}select(e){const t=this.schema.select(e),s=new on(t.fields),a=[];for(const u of e){const d=this.schema.fields.findIndex(h=>h.name===u);~d&&(a[d]=this.data.children[d])}return new xa(t,ke({type:s,length:this.numRows,children:a}))}selectAt(e){const t=this.schema.selectAt(e),s=e.map(u=>this.data.children[u]).filter(Boolean),a=ke({type:new on(t.fields),length:this.numRows,children:s});return new xa(t,a)}};E0=Symbol.toStringTag;nr[E0]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(nr.prototype);function Uy(n,e,t=e.reduce((s,a)=>Math.max(s,a.length),0)){var s;const a=[...n.fields],u=[...e],d=(t+63&-64)>>3;for(const[h,p]of n.fields.entries()){const y=e[h];(!y||y.length!==t)&&(a[h]=p.clone({nullable:!0}),u[h]=(s=y==null?void 0:y._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:ke({type:p.type,length:t,nullCount:t,nullBitmap:new Uint8Array(d)}))}return[n.assign(a),ke({type:new on(a),length:t,children:u})]}function x0(n,e,t=new Map){for(let s=-1,a=n.length;++s<a;){const d=n[s].type,h=e[s];if(Re.isDictionary(d)){if(!t.has(d.id))h.dictionary&&t.set(d.id,h.dictionary);else if(t.get(d.id)!==h.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}d.children&&d.children.length>0&&x0(d.children,h.children,t)}return t}class D0 extends nr{constructor(e){const t=e.fields.map(a=>ke({type:a.type})),s=ke({type:new on(e.fields),nullCount:0,children:t});super(e,s)}}var qu;(function(n){n[n.BUFFER=0]="BUFFER"})(qu||(qu={}));var Ku;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(Ku||(Ku={}));class Bi{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(e,t){return(t||new Bi).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,t){return e.setPosition(e.position()+ct),(t||new Bi).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Ku.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):qu.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Ku.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,qu.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,t,s){return Bi.startBodyCompression(e),Bi.addCodec(e,t),Bi.addMethod(e,s),Bi.endBodyCompression(e)}}class C0{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,s){return e.prep(8,16),e.writeInt64(BigInt(s??0)),e.writeInt64(BigInt(t??0)),e.offset()}}let O0=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,s){return e.prep(8,16),e.writeInt64(BigInt(s??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Yr=class Tf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(e,t){return(t||new Tf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,t){return e.setPosition(e.position()+ct),(t||new Tf).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,t){const s=this.bb.__offset(this.bb_pos,6);return s?(t||new O0).__init(this.bb.__vector(this.bb_pos+s)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new C0).__init(this.bb.__vector(this.bb_pos+s)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const t=this.bb.__offset(this.bb_pos,10);return t?(e||new Bi).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static endRecordBatch(e){return e.endObject()}},ao=class Mf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(e,t){return(t||new Mf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,t){return e.setPosition(e.position()+ct),(t||new Mf).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new Yr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}};var Yu;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(Yu||(Yu={}));let Ai=class Sr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+ct),(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):So.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Yu.NONE}header(e){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,12);return s?(t||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,So.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,Yu.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt("0"))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(e,t,s,a,u,d){return Sr.startMessage(e),Sr.addVersion(e,t),Sr.addHeaderType(e,s),Sr.addHeader(e,a),Sr.addBodyLength(e,u),Sr.addCustomMetadata(e,d),Sr.endMessage(e)}};class EE extends Ve{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return _s.startNull(t),_s.endNull(t)}visitInt(e,t){return On.startInt(t),On.addBitWidth(t,e.bitWidth),On.addIsSigned(t,e.isSigned),On.endInt(t)}visitFloat(e,t){return Or.startFloatingPoint(t),Or.addPrecision(t,e.precision),Or.endFloatingPoint(t)}visitBinary(e,t){return vs.startBinary(t),vs.endBinary(t)}visitBool(e,t){return ws.startBool(t),ws.endBool(t)}visitUtf8(e,t){return Is.startUtf8(t),Is.endUtf8(t)}visitDecimal(e,t){return gn.startDecimal(t),gn.addScale(t,e.scale),gn.addPrecision(t,e.precision),gn.addBitWidth(t,e.bitWidth),gn.endDecimal(t)}visitDate(e,t){return hu.startDate(t),hu.addUnit(t,e.unit),hu.endDate(t)}visitTime(e,t){return Un.startTime(t),Un.addUnit(t,e.unit),Un.addBitWidth(t,e.bitWidth),Un.endTime(t)}visitTimestamp(e,t){const s=e.timezone&&t.createString(e.timezone)||void 0;return jn.startTimestamp(t),jn.addUnit(t,e.unit),s!==void 0&&jn.addTimezone(t,s),jn.endTimestamp(t)}visitInterval(e,t){return Rr.startInterval(t),Rr.addUnit(t,e.unit),Rr.endInterval(t)}visitList(e,t){return Ss.startList(t),Ss.endList(t)}visitStruct(e,t){return bs.startStruct_(t),bs.endStruct_(t)}visitUnion(e,t){vn.startTypeIdsVector(t,e.typeIds.length);const s=vn.createTypeIdsVector(t,e.typeIds);return vn.startUnion(t),vn.addMode(t,e.mode),vn.addTypeIds(t,s),vn.endUnion(t)}visitDictionary(e,t){const s=this.visit(e.indices,t);return Jr.startDictionaryEncoding(t),Jr.addId(t,BigInt(e.id)),Jr.addIsOrdered(t,e.isOrdered),s!==void 0&&Jr.addIndexType(t,s),Jr.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return Dr.startFixedSizeBinary(t),Dr.addByteWidth(t,e.byteWidth),Dr.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return Cr.startFixedSizeList(t),Cr.addListSize(t,e.listSize),Cr.endFixedSizeList(t)}visitMap(e,t){return pu.startMap(t),pu.addKeysSorted(t,e.keysSorted),pu.endMap(t)}}const lf=new EE;function xE(n,e=new Map){return new Je(CE(n,e),yu(n.customMetadata),e)}function R0(n){return new ar(n.count,F0(n.columns),T0(n.columns))}function DE(n){return new ii(R0(n.data),n.id,n.isDelta)}function CE(n,e){return(n.fields||[]).filter(Boolean).map(t=>gt.fromJSON(t,e))}function jy(n,e){return(n.children||[]).filter(Boolean).map(t=>gt.fromJSON(t,e))}function F0(n){return(n||[]).reduce((e,t)=>[...e,new Ro(t.count,OE(t.VALIDITY)),...F0(t.children)],[])}function T0(n,e=[]){for(let t=-1,s=(n||[]).length;++t<s;){const a=n[t];a.VALIDITY&&e.push(new Zr(e.length,a.VALIDITY.length)),a.TYPE&&e.push(new Zr(e.length,a.TYPE.length)),a.OFFSET&&e.push(new Zr(e.length,a.OFFSET.length)),a.DATA&&e.push(new Zr(e.length,a.DATA.length)),e=T0(a.children,e)}return e}function OE(n){return(n||[]).reduce((e,t)=>e+ +(t===0),0)}function RE(n,e){let t,s,a,u,d,h;return!e||!(u=n.dictionary)?(d=Vy(n,jy(n,e)),a=new gt(n.name,d,n.nullable,yu(n.customMetadata))):e.has(t=u.id)?(s=(s=u.indexType)?zy(s):new La,h=new vo(e.get(t),s,t,u.isOrdered),a=new gt(n.name,h,n.nullable,yu(n.customMetadata))):(s=(s=u.indexType)?zy(s):new La,e.set(t,d=Vy(n,jy(n,e))),h=new vo(d,s,t,u.isOrdered),a=new gt(n.name,h,n.nullable,yu(n.customMetadata))),a||null}function yu(n){return new Map(Object.entries(n||{}))}function zy(n){return new Vi(n.isSigned,n.bitWidth)}function Vy(n,e){const t=n.type.name;switch(t){case"NONE":return new zi;case"null":return new zi;case"binary":return new Du;case"utf8":return new Cu;case"bool":return new Ou;case"list":return new Au((e||[])[0]);case"struct":return new on(e||[]);case"struct_":return new on(e||[])}switch(t){case"int":{const s=n.type;return new Vi(s.isSigned,s.bitWidth)}case"floatingpoint":{const s=n.type;return new Ba(wn[s.precision])}case"decimal":{const s=n.type;return new Ru(s.scale,s.precision,s.bitWidth)}case"date":{const s=n.type;return new Fu(ri[s.unit])}case"time":{const s=n.type;return new ka(Ke[s.unit],s.bitWidth)}case"timestamp":{const s=n.type;return new Tu(Ke[s.unit],s.timezone)}case"interval":{const s=n.type;return new Mu(ji[s.unit])}case"union":{const s=n.type;return new Pu(sr[s.mode],s.typeIds||[],e||[])}case"fixedsizebinary":{const s=n.type;return new Nu(s.byteWidth)}case"fixedsizelist":{const s=n.type;return new Lu(s.listSize,(e||[])[0])}case"map":{const s=n.type;return new Bu((e||[])[0],s.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var FE=v0,TE=wo;class rr{static fromJSON(e,t){const s=new rr(0,Vn.V4,t);return s._createHeader=ME(e,t),s}static decode(e){e=new TE(Ge(e));const t=Ai.getRootAsMessage(e),s=t.bodyLength(),a=t.version(),u=t.headerType(),d=new rr(s,a,u);return d._createHeader=AE(t,u),d}static encode(e){const t=new FE;let s=-1;return e.isSchema()?s=Je.encode(t,e.header()):e.isRecordBatch()?s=ar.encode(t,e.header()):e.isDictionaryBatch()&&(s=ii.encode(t,e.header())),Ai.startMessage(t),Ai.addVersion(t,Vn.V4),Ai.addHeader(t,s),Ai.addHeaderType(t,e.headerType),Ai.addBodyLength(t,BigInt(e.bodyLength)),Ai.finishMessageBuffer(t,Ai.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Je)return new rr(0,Vn.V4,st.Schema,e);if(e instanceof ar)return new rr(t,Vn.V4,st.RecordBatch,e);if(e instanceof ii)return new rr(t,Vn.V4,st.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}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===st.Schema}isRecordBatch(){return this.headerType===st.RecordBatch}isDictionaryBatch(){return this.headerType===st.DictionaryBatch}constructor(e,t,s,a){this._version=t,this._headerType=s,this.body=new Uint8Array(0),a&&(this._createHeader=()=>a),this._bodyLength=or(e)}}class ar{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,s){this._nodes=t,this._buffers=s,this._length=or(e)}}class ii{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(e,t,s=!1){this._data=e,this._isDelta=s,this._id=or(t)}}class Zr{constructor(e,t){this.offset=or(e),this.length=or(t)}}class Ro{constructor(e,t){this.length=or(e),this.nullCount=or(t)}}function ME(n,e){return()=>{switch(e){case st.Schema:return Je.fromJSON(n);case st.RecordBatch:return ar.fromJSON(n);case st.DictionaryBatch:return ii.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${st[e]}, type: ${e} }`)}}function AE(n,e){return()=>{switch(e){case st.Schema:return Je.decode(n.header(new br));case st.RecordBatch:return ar.decode(n.header(new Yr),n.version());case st.DictionaryBatch:return ii.decode(n.header(new ao),n.version())}throw new Error(`Unrecognized Message type: { name: ${st[e]}, type: ${e} }`)}}gt.encode=WE;gt.decode=VE;gt.fromJSON=RE;Je.encode=$E;Je.decode=PE;Je.fromJSON=xE;ar.encode=QE;ar.decode=NE;ar.fromJSON=R0;ii.encode=HE;ii.decode=LE;ii.fromJSON=DE;Ro.encode=qE;Ro.decode=kE;Zr.encode=KE;Zr.decode=BE;function PE(n,e=new Map){const t=zE(n,e);return new Je(t,gu(n),e)}function NE(n,e=Vn.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new ar(n.length(),UE(n),jE(n,e))}function LE(n,e=Vn.V4){return new ii(ar.decode(n.data(),e),n.id(),n.isDelta())}function BE(n){return new Zr(n.offset(),n.length())}function kE(n){return new Ro(n.length(),n.nullCount())}function UE(n){const e=[];for(let t,s=-1,a=-1,u=n.nodesLength();++s<u;)(t=n.nodes(s))&&(e[++a]=Ro.decode(t));return e}function jE(n,e){const t=[];for(let s,a=-1,u=-1,d=n.buffersLength();++a<d;)(s=n.buffers(a))&&(e<Vn.V4&&(s.bb_pos+=8*(a+1)),t[++u]=Zr.decode(s));return t}function zE(n,e){const t=[];for(let s,a=-1,u=-1,d=n.fieldsLength();++a<d;)(s=n.fields(a))&&(t[++u]=gt.decode(s,e));return t}function $y(n,e){const t=[];for(let s,a=-1,u=-1,d=n.childrenLength();++a<d;)(s=n.children(a))&&(t[++u]=gt.decode(s,e));return t}function VE(n,e){let t,s,a,u,d,h;return!e||!(h=n.dictionary())?(a=Qy(n,$y(n,e)),s=new gt(n.name(),a,n.nullable(),gu(n))):e.has(t=or(h.id()))?(u=(u=h.indexType())?Wy(u):new La,d=new vo(e.get(t),u,t,h.isOrdered()),s=new gt(n.name(),d,n.nullable(),gu(n))):(u=(u=h.indexType())?Wy(u):new La,e.set(t,a=Qy(n,$y(n,e))),d=new vo(a,u,t,h.isOrdered()),s=new gt(n.name(),d,n.nullable(),gu(n))),s||null}function gu(n){const e=new Map;if(n)for(let t,s,a=-1,u=Math.trunc(n.customMetadataLength());++a<u;)(t=n.customMetadata(a))&&(s=t.key())!=null&&e.set(s,t.value());return e}function Wy(n){return new Vi(n.isSigned(),n.bitWidth())}function Qy(n,e){const t=n.typeType();switch(t){case Et.NONE:return new zi;case Et.Null:return new zi;case Et.Binary:return new Du;case Et.Utf8:return new Cu;case Et.Bool:return new Ou;case Et.List:return new Au((e||[])[0]);case Et.Struct_:return new on(e||[])}switch(t){case Et.Int:{const s=n.type(new On);return new Vi(s.isSigned(),s.bitWidth())}case Et.FloatingPoint:{const s=n.type(new Or);return new Ba(s.precision())}case Et.Decimal:{const s=n.type(new gn);return new Ru(s.scale(),s.precision(),s.bitWidth())}case Et.Date:{const s=n.type(new hu);return new Fu(s.unit())}case Et.Time:{const s=n.type(new Un);return new ka(s.unit(),s.bitWidth())}case Et.Timestamp:{const s=n.type(new jn);return new Tu(s.unit(),s.timezone())}case Et.Interval:{const s=n.type(new Rr);return new Mu(s.unit())}case Et.Union:{const s=n.type(new vn);return new Pu(s.mode(),s.typeIdsArray()||[],e||[])}case Et.FixedSizeBinary:{const s=n.type(new Dr);return new Nu(s.byteWidth())}case Et.FixedSizeList:{const s=n.type(new Cr);return new Lu(s.listSize(),(e||[])[0])}case Et.Map:{const s=n.type(new pu);return new Bu((e||[])[0],s.keysSorted())}}throw new Error(`Unrecognized type: "${Et[t]}" (${t})`)}function $E(n,e){const t=e.fields.map(u=>gt.encode(n,u));br.startFieldsVector(n,t.length);const s=br.createFieldsVector(n,t),a=e.metadata&&e.metadata.size>0?br.createCustomMetadataVector(n,[...e.metadata].map(([u,d])=>{const h=n.createString(`${u}`),p=n.createString(`${d}`);return kt.startKeyValue(n),kt.addKey(n,h),kt.addValue(n,p),kt.endKeyValue(n)})):-1;return br.startSchema(n),br.addFields(n,s),br.addEndianness(n,YE?_o.Little:_o.Big),a!==-1&&br.addCustomMetadata(n,a),br.endSchema(n)}function WE(n,e){let t=-1,s=-1,a=-1;const u=e.type;let d=e.typeId;Re.isDictionary(u)?(d=u.dictionary.typeId,a=lf.visit(u,n),s=lf.visit(u.dictionary,n)):s=lf.visit(u,n);const h=(u.children||[]).map(g=>gt.encode(n,g)),p=Ln.createChildrenVector(n,h),y=e.metadata&&e.metadata.size>0?Ln.createCustomMetadataVector(n,[...e.metadata].map(([g,v])=>{const S=n.createString(`${g}`),I=n.createString(`${v}`);return kt.startKeyValue(n),kt.addKey(n,S),kt.addValue(n,I),kt.endKeyValue(n)})):-1;return e.name&&(t=n.createString(e.name)),Ln.startField(n),Ln.addType(n,s),Ln.addTypeType(n,d),Ln.addChildren(n,p),Ln.addNullable(n,!!e.nullable),t!==-1&&Ln.addName(n,t),a!==-1&&Ln.addDictionary(n,a),y!==-1&&Ln.addCustomMetadata(n,y),Ln.endField(n)}function QE(n,e){const t=e.nodes||[],s=e.buffers||[];Yr.startNodesVector(n,t.length);for(const d of t.slice().reverse())Ro.encode(n,d);const a=n.endVector();Yr.startBuffersVector(n,s.length);for(const d of s.slice().reverse())Zr.encode(n,d);const u=n.endVector();return Yr.startRecordBatch(n),Yr.addLength(n,BigInt(e.length)),Yr.addNodes(n,a),Yr.addBuffers(n,u),Yr.endRecordBatch(n)}function HE(n,e){const t=ar.encode(n,e.data);return ao.startDictionaryBatch(n),ao.addId(n,BigInt(e.id)),ao.addIsDelta(n,e.isDelta),ao.addData(n,t),ao.endDictionaryBatch(n)}function qE(n,e){return O0.createFieldNode(n,BigInt(e.length),BigInt(e.nullCount))}function KE(n,e){return C0.createBuffer(n,BigInt(e.offset),BigInt(e.length))}const YE=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),ch=n=>`Expected ${st[n]} Message in stream, but was null or length 0.`,dh=n=>`Header pointer of flatbuffer-encoded ${st[n]} Message is null or length 0.`,M0=(n,e)=>`Expected to read ${n} metadata bytes, but only read ${e}.`,A0=(n,e)=>`Expected to read ${n} bytes for message body, but only read ${e}.`;class P0{constructor(e){this.source=e instanceof Qu?e:new Qu(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?xt:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(ch(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const t=Ge(this.source.read(e));if(t.byteLength<e)throw new Error(A0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){const t=st.Schema,s=this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(dh(t));return a}readMetadataLength(){const e=this.source.read(lc),t=e&&new wo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}}readMetadata(e){const t=this.source.read(e);if(!t)return xt;if(t.byteLength<e)throw new Error(M0(e,t.byteLength));return{done:!1,value:rr.decode(t)}}}class GE{constructor(e,t){this.source=e instanceof Eo?e:Xg(e)?new Hu(e,t):new Eo(e)}[Symbol.asyncIterator](){return this}next(){return ve(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?xt:e})}throw(e){return ve(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return ve(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return ve(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(ch(e));return t.value})}readMessageBody(e){return ve(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);const t=Ge(yield this.source.read(e));if(t.byteLength<e)throw new Error(A0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(e=!1){return ve(this,void 0,void 0,function*(){const t=st.Schema,s=yield this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(dh(t));return a})}readMetadataLength(){return ve(this,void 0,void 0,function*(){const e=yield this.source.read(lc),t=e&&new wo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}})}readMetadata(e){return ve(this,void 0,void 0,function*(){const t=yield this.source.read(e);if(!t)return xt;if(t.byteLength<e)throw new Error(M0(e,t.byteLength));return{done:!1,value:rr.decode(t)}})}}class JE extends P0{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof By?e:new By(e)}next(){const{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:rr.fromJSON(e.schema,st.Schema)};if(this._dictionaryIndex<e.dictionaries.length){const t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:rr.fromJSON(t,st.DictionaryBatch)}}if(this._batchIndex<e.batches.length){const t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:rr.fromJSON(t,st.RecordBatch)}}return this._body=[],xt}readMessageBody(e){return t(this._body);function t(s){return(s||[]).reduce((a,u)=>[...a,...u.VALIDITY&&[u.VALIDITY]||[],...u.TYPE&&[u.TYPE]||[],...u.OFFSET&&[u.OFFSET]||[],...u.DATA&&[u.DATA]||[],...t(u.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(ch(e));return t.value}readSchema(){const e=st.Schema,t=this.readMessage(e),s=t==null?void 0:t.header();if(!t||!s)throw new Error(dh(e));return s}}const lc=4,Af="ARROW1",Gu=new Uint8Array(Af.length);for(let n=0;n<Af.length;n+=1)Gu[n]=Af.codePointAt(n);function fh(n,e=0){for(let t=-1,s=Gu.length;++t<s;)if(Gu[t]!==n[e+t])return!1;return!0}const qa=Gu.length,N0=qa+lc,XE=qa*2+lc;class ti extends S0{constructor(e){super(),this._impl=e}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(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){const t=this._impl.open(e);return Ma(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return kn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return kn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof ti?e:bf(e)?nx(e):Xg(e)?sx(e):Ma(e)?ve(this,void 0,void 0,function*(){return yield ti.from(yield e)}):Zg(e)||qf(e)||tv(e)||Hf(e)?ix(new Eo(e)):rx(new Qu(e))}static readAll(e){return e instanceof ti?e.isSync()?Hy(e):qy(e):bf(e)||ArrayBuffer.isView(e)||sc(e)||Jg(e)?Hy(e):qy(e)}}class Ju extends ti{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Fr(this,arguments,function*(){yield Te(yield*fu(uo(this[Symbol.iterator]())))})}}class Xu extends ti{constructor(e){super(e),this._impl=e}readAll(){var e,t,s,a;return ve(this,void 0,void 0,function*(){const u=new Array;try{for(var d=!0,h=uo(this),p;p=yield h.next(),e=p.done,!e;d=!0){a=p.value,d=!1;const y=a;u.push(y)}}catch(y){t={error:y}}finally{try{!d&&!e&&(s=h.return)&&(yield s.call(h))}finally{if(t)throw t.error}}return u})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class L0 extends Ju{constructor(e){super(e),this._impl=e}}class ZE extends Xu{constructor(e){super(e),this._impl=e}}class B0{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t){const s=this._loadVectors(e,t,this.schema.fields),a=ke({type:new on(this.schema.fields),length:e.length,children:s});return new nr(this.schema,a)}_loadDictionaryBatch(e,t){const{id:s,isDelta:a}=e,{dictionaries:u,schema:d}=this,h=u.get(s);if(a||!h){const p=d.dictionaries.get(s),y=this._loadVectors(e.data,t,[p]);return(h&&a?h.concat(new ot(y)):new ot(y)).memoize()}return h.memoize()}_loadVectors(e,t,s){return new b0(t,e.nodes,e.buffers,this.dictionaries).visitMany(s)}}class Zu extends B0{constructor(e,t){super(t),this._reader=bf(e)?new JE(this._handle=e):new P0(this._handle=e)}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(e){return this.closed||(this.autoDestroy=U0(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):xt}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):xt}next(){if(this.closed)return xt;let e;const{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new D0(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class ec extends B0{constructor(e,t){super(t),this._reader=new GE(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ve(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return ve(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=U0(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return ve(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):xt})}return(e){return ve(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):xt})}next(){return ve(this,void 0,void 0,function*(){if(this.closed)return xt;let e;const{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new D0(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return ve(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class k0 extends Zu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof ky?e:new ky(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(st.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null}_readDictionaryBatch(e){var t;const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(st.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}}_readFooter(){const{_handle:e}=this,t=e.size-N0,s=e.readInt32(t),a=e.readAt(t-s,s);return sh.decode(a)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(this._recordBatchIndex);if(s&&this._handle.seek(s.offset))return this._reader.readMessage(e)}return null}}class ex extends ec{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){const s=typeof t[0]!="number"?t.shift():void 0,a=t[0]instanceof Map?t.shift():void 0;super(e instanceof Hu?e:new Hu(e,s),a)}isFile(){return!0}isAsync(){return!0}open(e){const t=Object.create(null,{open:{get:()=>super.open}});return ve(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const s of this._footer.dictionaryBatches())s&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){var t;return ve(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(st.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null})}_readDictionaryBatch(e){var t;return ve(this,void 0,void 0,function*(){const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(st.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}})}_readFooter(){return ve(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const t=e.size-N0,s=yield e.readInt32(t),a=yield e.readAt(t-s,s);return sh.decode(a)})}_readNextMessageAndValidate(e){return ve(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}}class tx extends Zu{constructor(e,t){super(e,t)}_loadVectors(e,t,s){return new hE(t,e.nodes,e.buffers,this.dictionaries).visitMany(s)}}function U0(n,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:n.autoDestroy}function*Hy(n){const e=ti.from(n);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function qy(n){return Fr(this,arguments,function*(){const t=yield Te(ti.from(n));try{if(!(yield Te(t.open({autoDestroy:!1}))).closed)do yield yield Te(t);while(!(yield Te(t.reset().open())).closed)}finally{yield Te(t.cancel())}})}function nx(n){return new Ju(new tx(n))}function rx(n){const e=n.peek(qa+7&-8);return e&&e.byteLength>=4?fh(e)?new L0(new k0(n.read())):new Ju(new Zu(n)):new Ju(new Zu(function*(){}()))}function ix(n){return ve(this,void 0,void 0,function*(){const e=yield n.peek(qa+7&-8);return e&&e.byteLength>=4?fh(e)?new L0(new k0(yield n.read())):new Xu(new ec(n)):new Xu(new ec(function(){return Fr(this,arguments,function*(){})}()))})}function sx(n){return ve(this,void 0,void 0,function*(){const{size:e}=yield n.stat(),t=new Hu(n,e);return e>=XE&&fh(yield t.readAt(0,qa+7&-8))?new ZE(new ex(t)):new Xu(new ec(t))})}function j0(n){const e=ti.from(n);return Ma(e)?e.then(t=>j0(t)):e.isAsync()?e.readAll().then(t=>new zn(t)):new zn(e.readAll())}async function Ft(n,e){const{url:t,method:s,params:a,data:u,headers:d,credentials:h,mode:p,cache:y}=n,g=Object.keys({...a}).length>0,v=t.replace(/([^:]\/)\/+/g,"$1"),S=new URL(z0(v),window.location.origin);if(g){const I=Object.entries({...a}).reduce((T,[A,M])=>(M!=null&&(T[A]=String(M)),T),{});S.search=new URLSearchParams(I).toString()}return await new Promise((I,T)=>{fetch(S,{method:s,credentials:h,mode:p,cache:y,headers:ox(d),body:ax(u),signal:e==null?void 0:e.signal}).then(async A=>{if(A.status===204)return{ok:!0};const M=A.headers.get("Content-Type");if(qt(M))return{ok:!1,message:"Empty response"};if(A.status>=400)try{const q=await A.json();throw q.status=q.status??A.status,q}catch(q){throw{message:A.statusText,...q}}const K=M.includes("text/event-stream"),W=M.includes("application/json"),Y=M.includes("application/vnd.apache.arrow.stream");if(W)return await A.json();if(Y)return await j0(A);if(K){const ce=(await A.text()).trim().replace("data: ","").trim();return JSON.parse(ce)}}).then(I).catch(T)})}function ox(n){return{"Content-Type":"application/json",...n??{}}}function ax(n){try{return JSON.stringify(n)}catch{return""}}function z0(n="/"){let e=`${Da(window.__BASE_URL__)?"/":window.__BASE_URL__}/${n}`;for(;e.includes("//");)e=e.replaceAll("//","/");return e}const cu={python:"python",sql:"sql",seed:"seed",external:"external",source:"source"},_r={editor:"editor",files:"files","data-catalog":"data-catalog",plans:"plans",tests:"tests",audits:"audits",errors:"errors",data:"data",lineage:"lineage"},ND={NUMBER_1:1,NUMBER_2:2,NUMBER_3:3},LD={init:"init",success:"success",fail:"fail"},lx=(n,e)=>Ft({url:"/api/commands/apply",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),ux=(n,e)=>Ft({url:"/api/commands/evaluate",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),cx=(n,e)=>Ft({url:"/api/commands/fetchdf",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),dx=(n,e)=>Ft({url:"/api/commands/render",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),fx=n=>Ft({url:"/api/files",method:"GET"},n),hx=(n,e)=>Ft({url:`/api/files/${n}`,method:"GET"},e),px=(n,e,t)=>Ft({url:`/api/files/${n}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),BD=(n,e)=>Ft({url:`/api/files/${n}`,method:"DELETE"},e),kD=(n,e,t)=>Ft({url:`/api/directories/${n}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),UD=(n,e)=>Ft({url:`/api/directories/${n}`,method:"DELETE"},e),mx=(n,e)=>Ft({url:"/api/plan",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),yx=n=>Ft({url:"/api/plan/cancel",method:"POST"},n),gx=n=>Ft({url:"/api/environments",method:"GET"},n),jD=(n,e)=>Ft({url:`/api/environments/${n}`,method:"DELETE"},e),vx=(n,e,t,s)=>Ft({url:`/api/lineage/${n}/${e}`,method:"GET",params:t},s),wx=(n,e)=>Ft({url:`/api/lineage/${n}`,method:"GET"},e),Sx=n=>Ft({url:"/api/models",method:"GET"},n),_x=(n,e)=>Ft({url:`/api/models/${n}`,method:"GET"},e),bx=n=>Ft({url:"/api/meta",method:"GET"},n),Ix=n=>Ft({url:"/api/modules",method:"GET"},n),Ex=(n,e)=>Ft({url:"/api/table_diff",method:"GET",params:n},e),Qr=N.lazy(()=>an(()=>import("./Root-DSGcTlxk.js"),[])),xx=N.lazy(()=>an(()=>import("./Editor-DgIo0RbF.js"),[])),Dx=N.lazy(()=>an(()=>import("./Plan-CFJZVnkR.js"),[])),Cx=N.lazy(()=>an(()=>import("./Content-T59G6CRd.js"),[])),Ox=N.lazy(()=>an(()=>import("./DataCatalog-CsA-vDbc.js"),[])),Rx=N.lazy(()=>an(()=>import("./Tests-DAbOEH7t.js"),[])),Fx=N.lazy(()=>an(()=>import("./Audits-4U9LnWyN.js"),[])),Tx=N.lazy(()=>an(()=>import("./Data-Dvs4EVTS.js"),[])),uf=N.lazy(()=>an(()=>import("./Models-CCm5MLTD.js"),[])),Mx=N.lazy(()=>an(()=>import("./Lineage-BbLp8RL_.js"),[])),Ax=N.lazy(()=>an(()=>import("./Errors-BOLt2obm.js"),[])),Px=N.lazy(()=>an(()=>import("./Content-DfnWzoRW.js"),[])),Zn=N.lazy(()=>an(()=>import("./Welcome-c37SRGFq.js"),[])),rt={Home:"/",Editor:"/editor",DataCatalog:"/data-catalog",DataCatalogModels:"/data-catalog/models",Data:"/data",Lineage:"/lineage",LineageModels:"/lineage/models",Tests:"/tests",Audits:"/audits",Errors:"/errors",Plan:"/plan",NotFound:"/not-found"},Ky={plan:[_r.plans]};function Nx(n){const e=[{path:"*",element:nc(n.list)?B.jsx(pn,{link:rt.Home,message:"Back To Main"}):B.jsx(pn,{headline:"Empty"})},{path:rt.Home,element:B.jsx(Qr,{})},...[{path:rt.Editor,element:B.jsx(Qr,{content:B.jsx(xx,{})})},{path:rt.DataCatalog,element:B.jsx(Qr,{content:B.jsx(uf,{route:rt.DataCatalog})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.DataCatalog,message:"Back To Data Catalog"})},{path:"models",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.DataCatalog,message:"Back To Data Catalog"})},{path:":modelName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Ox,{})})}]}]},{path:rt.Data,element:B.jsx(Qr,{content:B.jsx(uf,{route:rt.Data})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Data,message:"Back To Data"})},{path:"models",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Data,message:"Back To Data"})},{path:":modelName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Tx,{})})}]}]},{path:rt.Lineage,element:B.jsx(Qr,{content:B.jsx(uf,{route:rt.Lineage})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Lineage,message:"Back To Lineage"})},{path:"models",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Lineage,message:"Back To Lineage"})},{path:":modelName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Mx,{})})}]}]},{path:rt.Errors,element:B.jsx(Qr,{content:B.jsx(Ax,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to errors report",tagline:"Here you can see all the errors that occurred."})},{path:"*",element:B.jsx(pn,{link:rt.Errors,message:"Back To Errors"})},{path:":id",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Px,{})})}]},{path:rt.Plan,element:B.jsx(Qr,{content:B.jsx(Dx,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:B.jsx(pn,{link:rt.Plan,message:"Back To Plan"})},{path:"environments",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:B.jsx(pn,{link:rt.Plan,message:"Back To Plan"})},{path:":environmentName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Cx,{})})}]}]},{path:rt.Tests,element:B.jsx(Qr,{content:B.jsx(Rx,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to tests report",tagline:"Here you can run tests and see the results."})},{path:"*",element:B.jsx(pn,{link:rt.Tests,message:"Back To Tests"})}]},{path:rt.Audits,element:B.jsx(Qr,{content:B.jsx(Fx,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to audits report",tagline:"Here you can run audits and see the results."})},{path:"*",element:B.jsx(pn,{link:rt.Audits,message:"Back To Audits"})}]}].filter(t=>{var a;const s=t.path.replace("/","");return qt(Ky[s])?n.list.includes(s):(a=Ky[s])==null?void 0:a.some(u=>n.list.includes(u))})].filter(Boolean);return Z1(e,{basename:z0()})}const Ut={API:"api",General:"general",RunPlan:"run-plan",ApplyPlan:"apply-plan",CancelPlan:"cancel-plan",Environments:"environments",Models:"models",Fetchdf:"fetchdf",EvaluateModel:"evaluate-model",RenderQuery:"render-query",ColumnLineage:"column-lineage",ModelLineage:"model-lineage",Meta:"meta",Modules:"modules",FileExplorer:"file-explorer",Table:"table",TableDiff:"table-diff",SaveFile:"save-file"},V0=N.createContext({errors:new Set,addError:()=>({removeError:()=>{},error:{}}),removeError:()=>{},clearErrors:()=>{}});function Lx({children:n}){const[e,t]=N.useState(new Set);function s(d,h){const p={id:ff(),key:d,status:h.status,timestamp:h.timestamp??Date.now(),message:h.message,description:h.description,type:h.type,origin:h.origin,trigger:h.trigger,stack:h.stack,traceback:h.traceback};return t(y=>new Set(y.add(p))),{removeError:()=>a(p),error:p}}function a(d){t(h=>(h.forEach(p=>{(p===d||p.key===d)&&h.delete(p)}),new Set(h)))}function u(){t(new Set)}return B.jsx(V0.Provider,{value:{errors:e,addError:s,removeError:a,clearErrors:u},children:n})}function hh(){return N.useContext(V0)}const $0=60*1e3,Bx=5*$0,uc=10*$0;function kx(n){return Zt({queryKey:["/api/modules"],queryFn:Ix,enabled:!0},{...n,errorKey:Ut.Modules,trigger:"API -> useApiModules"})}function zD(n){return Zt({queryKey:["/api/meta"],queryFn:bx,enabled:!0},{...n,errorKey:Ut.Meta,trigger:"API -> useApiMeta"})}function VD(n){return Zt({queryKey:["/api/models"],queryFn:Sx},{...n,errorKey:Ut.Models,trigger:"API -> useApiModels"})}function $D(n,e){return Zt({queryKey:["/api/models",n],queryFn:async({signal:t})=>await _x(n,{signal:t})},{...e,errorKey:Ut.Models,trigger:"API -> useApiModel"})}function WD(n){return Zt({queryKey:["/api/files"],queryFn:fx},{...n,errorKey:Ut.FileExplorer,trigger:"API -> useApiFiles"})}function QD(n,e){return Zt({queryKey:["/api/files",n],queryFn:async({signal:t})=>await hx(n,{signal:t})},{...e,errorKey:Ut.FileExplorer,trigger:"API -> useApiFileByPath"})}function HD(n,e){return Zt({queryKey:["/api/lineage",n],queryFn:async({signal:t})=>await wx(n,{signal:t})},{...e,errorKey:Ut.ModelLineage,trigger:"API -> useApiModelLineage"})}function qD(n,e,t,s){return Zt({queryKey:["/api/lineage",n,e],queryFn:async({signal:a})=>await vx(n,e,s,{signal:a})},{...t,errorKey:Ut.ColumnLineage,trigger:"API -> useApiColumnLineage"})}function KD(n){return Zt({queryKey:["/api/environments"],queryFn:gx},{...n,errorKey:Ut.Environments,trigger:"API -> useApiEnvironments"})}function YD(n){return Zt({queryKey:["/api/commands/apply"],queryFn:yx},{...n,errorKey:Ut.CancelPlan,trigger:"API -> useApiCancelPlan"})}function GD(n,e,t){return Zt({queryKey:["/api/plan",n],async queryFn({signal:s}){return await mx({environment:n,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:Ut.RunPlan,trigger:"API -> useApiPlanRun"})}function JD(n,e,t){return Zt({queryKey:["/api/commands/apply",n],async queryFn({signal:s}){return await lx({environment:n,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:Ut.ApplyPlan,trigger:"API -> useApiPlanApply"})}function XD(n,e){return Zt({queryKey:["/api/commands/fetchd"],queryFn:async({signal:t})=>await cx(n,{signal:t})},{...e,errorKey:Ut.Fetchdf,trigger:"API -> useApiFetchdf",delay:uc})}function ZD(n,e){return Zt({queryKey:["/api/commands/render"],queryFn:async({signal:t})=>await dx(n,{signal:t})},{...e,errorKey:Ut.RenderQuery,trigger:"API -> useApiRender",delay:uc})}function eC(n,e){return Zt({queryKey:["/api/commands/table_diff"],queryFn:async({signal:t})=>await Ex(n,{signal:t})},{...e,errorKey:Ut.TableDiff,trigger:"API -> useApiTableDiff",delay:uc})}function tC(n,e){return Zt({queryKey:["/api/commands/evaluate"],queryFn:async({signal:t})=>await ux(n,{signal:t})},{...e,errorKey:Ut.EvaluateModel,trigger:"API -> useApiEvaluate",delay:uc})}function nC(n){const{addError:e}=hh();return O_({mutationFn:async({path:t,body:s})=>await px(t,s),onError(t){e(Ut.SaveFile,t)},async onMutate({path:t}){await n.cancelQueries({queryKey:["/api/files",t]})}})}function Zt(n,{delay:e=Bx,removeTimeoutErrorAfter:t,errorKey:s=Ut.API,trigger:a}){const u=n.queryKey.join(" -> "),d=Bf(),{addError:h}=hh(),[p,y]=N.useState(!1);let g,v=function(){console.log(`[REQUEST TIMEOUT] ${u} id: ${String(g)} timed out after ${e}ms`);const{removeError:q}=h(s,{message:"Request timed out",description:`Request ${u} with timeoutId: ${String(g)} timed out after ${e}ms`,timestamp:Date.now(),origin:"useQueryTimeout",trigger:a});y(!0),T(),sn(t)&&setTimeout(()=>q(),t)};function S(){console.log(`[CLEAR TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`),clearTimeout(g),g=void 0,v=void 0}function I(){g=setTimeout(()=>{v==null||v()},e),console.log(`[START TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`)}function T(){S(),d.cancelQueries({queryKey:n.queryKey}),console.log(`[REQUEST CANCELED] ${u} at ${Date.now()}`)}function A(Y){S(),Ca(Y)||Y.name==="AbortError"?console.log(`[REQUEST ABORTED] ${u} aborted by React Query at ${Date.now()}`):(console.log(`[REQUEST FAILED] ${u} failed at ${Date.now()}`),h(s,Y))}function M(){S(),console.log(`[REQUEST COMPLETED] ${u} completed at ${Date.now()}`)}async function K(...Y){return I(),n.queryFn(...Y)}const W=C_({cacheTime:0,enabled:!1,queryKey:n.queryKey,queryFn:K,meta:{...n.meta,onError:A,onSuccess:M}});return{...W,refetch:async(...Y)=>new Promise(q=>{W.refetch(...Y,{throwOnError:!0}).then(q).catch(ce=>ce)}),cancel:T,isTimeout:p}}class W0{constructor(e){wt(this,"_initial");wt(this,"isModel",!0);qt(e)?this._initial=Object.assign({id:ff()}):this._initial=sn(e==null?void 0:e.id)?e:new Proxy(Object.assign(e??{},{id:ff()}),{set(){throw new Error("Cannot change initial file")}})}get initial(){return this._initial}get id(){return this.initial.id}}class Yy extends W0{constructor(t=[]){super();wt(this,"modules",new Set);this.modules=new Set(t)}get list(){return Array.from(this.modules)}get isEmpty(){return this.modules.size===0}get hasErrors(){return this.modules.has(_r.errors)}get hasEditor(){return this.modules.has(_r.editor)}get hasFiles(){return this.modules.has(_r.files)}get hasProjectEditor(){return this.hasEditor&&this.hasFiles}get hasOnlyProjectEditor(){return this.modules.size===2&&this.hasProjectEditor}get hasOnlyDataCatalog(){return this.modules.size===1&&this.hasDataCatalog}get hasProjectEditorAndModule(){return this.modules.size===3&&this.hasProjectEditor&&Ui(this.hasErrors)}get hasDataCatalog(){return this.modules.has(_r["data-catalog"])}get hasPlans(){return this.modules.has(_r.plans)}get hasOnlyPlans(){return this.modules.size===1&&this.hasPlans}get hasOnlyPlansAndErrors(){return this.modules.size===2&&this.hasPlans&&this.hasErrors}get hasTests(){return this.modules.has(_r.tests)}get hasAudits(){return this.modules.has(_r.audits)}get hasData(){return this.modules.has(_r.data)}get hasLineage(){return this.modules.has(_r.lineage)}get hasModuleAndErrors(){return this.hasErrors&&(this.modules.size===2||this.modules.size===3&&this.hasProjectEditor)}get hasSingleModule(){return this.modules.size===1}get showModuleNavigation(){return this.isEmpty||this.hasSingleModule||this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule?!0:Ui(this.isEmpty)}get showHistoryNavigation(){return this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule||this.hasDataCatalog?!0:Ui(this.isEmpty)}get showNavigation(){return this.hasErrors||this.hasPlans||this.showHistoryNavigation}update(t=[]){this.modules=new Set(t)}defaultNavigationRoute(){return this.hasEditor?rt.Editor:this.hasPlans?rt.Plan:this.hasDataCatalog?rt.DataCatalog:rt.NotFound}}class Ux extends W0{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,dialect:(t==null?void 0:t.dialect)??"Default",columns:(t==null?void 0:t.columns)??[],details:(t==null?void 0:t.details)??{}});wt(this,"_details",{});wt(this,"_detailsIndex","");wt(this,"name");wt(this,"fqn");wt(this,"path");wt(this,"full_path");wt(this,"dialect");wt(this,"type");wt(this,"columns");wt(this,"default_catalog");wt(this,"description");wt(this,"sql");wt(this,"definition");wt(this,"hash");this.name=encodeURI(this.initial.name),this.fqn=encodeURI(this.initial.fqn),this.default_catalog=this.initial.default_catalog,this.path=this.initial.path,this.full_path=this.initial.full_path,this.dialect=this.initial.dialect,this.description=this.initial.description,this.sql=this.initial.sql,this.definition=this.initial.definition,this.columns=this.initial.columns??[],this.type=this.initial.type,this.hash=this.initial.hash,this.details=this.initial.details??{}}get defaultCatalog(){return this.default_catalog}get details(){return this._details}set details(t){const s=[];for(const a of Object.values(t))nc(a)?a.forEach(u=>{s.push(...Object.values(u))}):s.push(a);this._details=t,this._detailsIndex=s.join(" ")}get index(){return[this.displayName,this.path,this.type,...this.columns.map(t=>Object.values(t)).flat(),this._detailsIndex,this.dialect,this.description].filter(Boolean).join(" ").toLowerCase()}get isModelPython(){return this.type===cu.python}get isModelSQL(){return this.type===cu.sql}get isModelSeed(){return this.type===cu.seed}get isModelExternal(){return this.type===cu.external}get displayName(){return decodeURI(this.name)}update(t={}){for(const[s,a]of Object.entries(t))s==="columns"?this.columns=a:s==="details"?this.details=a:s==="name"?this.name=encodeURI(a):s==="fqn"?this.fqn=encodeURI(a):s==="type"?this.type=a:s==="default_catalog"?this.default_catalog=a:s==="description"?this.description=a:s in this&&(this[s]=a)}}const jx={},Gy=n=>{let e;const t=new Set,s=(g,v)=>{const S=typeof g=="function"?g(e):g;if(!Object.is(S,e)){const I=e;e=v??(typeof S!="object"||S===null)?S:Object.assign({},e,S),t.forEach(T=>T(e,I))}},a=()=>e,p={setState:s,getState:a,getInitialState:()=>y,subscribe:g=>(t.add(g),()=>t.delete(g)),destroy:()=>{(jx?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},y=e=n(s,a,p);return p},zx=n=>n?Gy(n):Gy;var cf={exports:{}},df={};/**
82
+ ]`}concat(...e){const t=this.schema,s=this.data.concat(e.flatMap(({data:a})=>a));return new zn(t,s.map(a=>new nr(t,a)))}slice(e,t){const s=this.schema;[e,t]=i0({length:this.numRows},e,t);const a=l0(this.data,this._offsets,e,t);return new zn(s,a.map(u=>new nr(s,u)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){const t=this.data.map(s=>s.children[e]);if(t.length===0){const{type:s}=this.schema.fields[e],a=ke({type:s,length:0,nullCount:0});t.push(a._changeLengthAndBackfillNullBitmap(this.numRows))}return new ot(t)}return null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=[...this.batches];if(e>-1&&e<this.numCols){t||(t=new ot([ke({type:new zi,length:this.numRows})]));const u=s.fields.slice(),d=u[e].clone({type:t.type}),h=this.schema.fields.map((p,y)=>this.getChildAt(y));[u[e],h[e]]=[d,t],[s,a]=af(s,h)}return new zn(s,a)}select(e){const t=this.schema.fields.reduce((s,a,u)=>s.set(a.name,u),new Map);return this.selectAt(e.map(s=>t.get(s)).filter(s=>s>-1))}selectAt(e){const t=this.schema.selectAt(e),s=this.batches.map(a=>a.selectAt(e));return new zn(t,s)}assign(e){const t=this.schema.fields,[s,a]=e.schema.fields.reduce((h,p,y)=>{const[g,v]=h,S=t.findIndex(I=>I.name===p.name);return~S?v[S]=y:g.push(y),h},[[],[]]),u=this.schema.assign(e.schema),d=[...t.map((h,p)=>[p,a[p]]).map(([h,p])=>p===void 0?this.getChildAt(h):e.getChildAt(p)),...s.map(h=>e.getChildAt(h))].filter(Boolean);return new zn(...af(u,d))}}I0=Symbol.toStringTag;zn[I0]=(n=>(n.schema=null,n.batches=[],n._offsets=new Uint32Array([0]),n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,n.isValid=mo(rh),n.get=mo(Sn.getVisitFn(O.Struct)),n.set=u0($n.getVisitFn(O.Struct)),n.indexOf=c0(ku.getVisitFn(O.Struct)),n.getByteLength=mo(Ar.getVisitFn(O.Struct)),"Table"))(zn.prototype);var E0;let nr=class xa{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof Je))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=ke({nullCount:0,type:new on(this.schema.fields),children:this.schema.fields.map(t=>ke({type:t.type,nullCount:0}))})]=e,!(this.data instanceof It))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Uy(this.schema,this.data.children);break}case 1:{const[t]=e,{fields:s,children:a,length:u}=Object.keys(t).reduce((p,y,g)=>(p.children[g]=t[y],p.length=Math.max(p.length,t[y].length),p.fields[g]=gt.new({name:y,type:t[y].type,nullable:!0}),p),{length:0,fields:new Array,children:new Array}),d=new Je(s),h=ke({type:new on(s),length:u,children:a,nullCount:0});[this.schema,this.data]=Uy(d,h.children,u);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=x0(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(e){return this.data.getValid(e)}get(e){return Sn.visit(this.data,e)}set(e,t){return $n.visit(this.data,e,t)}indexOf(e,t){return ku.visit(this.data,e,t)}getByteLength(e){return Ar.visit(this.data,e)}[Symbol.iterator](){return ih.visit(new ot([this.data]))}toArray(){return[...this]}concat(...e){return new zn(this.schema,[this,...e])}slice(e,t){const[s]=new ot([this.data]).slice(e,t).data;return new xa(this.schema,s)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)===null||t===void 0?void 0:t.findIndex(s=>s.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new ot([this.data.children[e]]):null}setChild(e,t){var s;return this.setChildAt((s=this.schema.fields)===null||s===void 0?void 0:s.findIndex(a=>a.name===e),t)}setChildAt(e,t){let s=this.schema,a=this.data;if(e>-1&&e<this.numCols){t||(t=new ot([ke({type:new zi,length:this.numRows})]));const u=s.fields.slice(),d=a.children.slice(),h=u[e].clone({type:t.type});[u[e],d[e]]=[h,t.data[0]],s=new Je(u,new Map(this.schema.metadata)),a=ke({type:new on(u),children:d})}return new xa(s,a)}select(e){const t=this.schema.select(e),s=new on(t.fields),a=[];for(const u of e){const d=this.schema.fields.findIndex(h=>h.name===u);~d&&(a[d]=this.data.children[d])}return new xa(t,ke({type:s,length:this.numRows,children:a}))}selectAt(e){const t=this.schema.selectAt(e),s=e.map(u=>this.data.children[u]).filter(Boolean),a=ke({type:new on(t.fields),length:this.numRows,children:s});return new xa(t,a)}};E0=Symbol.toStringTag;nr[E0]=(n=>(n._nullCount=-1,n[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(nr.prototype);function Uy(n,e,t=e.reduce((s,a)=>Math.max(s,a.length),0)){var s;const a=[...n.fields],u=[...e],d=(t+63&-64)>>3;for(const[h,p]of n.fields.entries()){const y=e[h];(!y||y.length!==t)&&(a[h]=p.clone({nullable:!0}),u[h]=(s=y==null?void 0:y._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:ke({type:p.type,length:t,nullCount:t,nullBitmap:new Uint8Array(d)}))}return[n.assign(a),ke({type:new on(a),length:t,children:u})]}function x0(n,e,t=new Map){for(let s=-1,a=n.length;++s<a;){const d=n[s].type,h=e[s];if(Re.isDictionary(d)){if(!t.has(d.id))h.dictionary&&t.set(d.id,h.dictionary);else if(t.get(d.id)!==h.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}d.children&&d.children.length>0&&x0(d.children,h.children,t)}return t}class D0 extends nr{constructor(e){const t=e.fields.map(a=>ke({type:a.type})),s=ke({type:new on(e.fields),nullCount:0,children:t});super(e,s)}}var qu;(function(n){n[n.BUFFER=0]="BUFFER"})(qu||(qu={}));var Ku;(function(n){n[n.LZ4_FRAME=0]="LZ4_FRAME",n[n.ZSTD=1]="ZSTD"})(Ku||(Ku={}));class Bi{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(e,t){return(t||new Bi).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsBodyCompression(e,t){return e.setPosition(e.position()+ct),(t||new Bi).__init(e.readInt32(e.position())+e.position(),e)}codec(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):Ku.LZ4_FRAME}method(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):qu.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,Ku.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,qu.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(e,t,s){return Bi.startBodyCompression(e),Bi.addCodec(e,t),Bi.addMethod(e,s),Bi.endBodyCompression(e)}}class C0{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,s){return e.prep(8,16),e.writeInt64(BigInt(s??0)),e.writeInt64(BigInt(t??0)),e.offset()}}let O0=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,s){return e.prep(8,16),e.writeInt64(BigInt(s??0)),e.writeInt64(BigInt(t??0)),e.offset()}},Yr=class Tf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(e,t){return(t||new Tf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsRecordBatch(e,t){return e.setPosition(e.position()+ct),(t||new Tf).__init(e.readInt32(e.position())+e.position(),e)}length(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}nodes(e,t){const s=this.bb.__offset(this.bb_pos,6);return s?(t||new O0).__init(this.bb.__vector(this.bb_pos+s)+e*16,this.bb):null}nodesLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){const s=this.bb.__offset(this.bb_pos,8);return s?(t||new C0).__init(this.bb.__vector(this.bb_pos+s)+e*16,this.bb):null}buffersLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){const t=this.bb.__offset(this.bb_pos,10);return t?(e||new Bi).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}static startRecordBatch(e){e.startObject(4)}static addLength(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static endRecordBatch(e){return e.endObject()}},ao=class Mf{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(e,t){return(t||new Mf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsDictionaryBatch(e,t){return e.setPosition(e.position()+ct),(t||new Mf).__init(e.readInt32(e.position())+e.position(),e)}id(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}data(e){const t=this.bb.__offset(this.bb_pos,6);return t?(e||new Yr).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt("0"))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}};var Yu;(function(n){n[n.NONE=0]="NONE",n[n.Schema=1]="Schema",n[n.DictionaryBatch=2]="DictionaryBatch",n[n.RecordBatch=3]="RecordBatch",n[n.Tensor=4]="Tensor",n[n.SparseTensor=5]="SparseTensor"})(Yu||(Yu={}));let Ai=class Sr{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(e,t){return(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,t){return e.setPosition(e.position()+ct),(t||new Sr).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):So.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Yu.NONE}header(e){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,t){const s=this.bb.__offset(this.bb_pos,12);return s?(t||new kt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+s)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,So.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,Yu.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt("0"))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let s=t.length-1;s>=0;s--)e.addOffset(t[s]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(e,t,s,a,u,d){return Sr.startMessage(e),Sr.addVersion(e,t),Sr.addHeaderType(e,s),Sr.addHeader(e,a),Sr.addBodyLength(e,u),Sr.addCustomMetadata(e,d),Sr.endMessage(e)}};class EE extends Ve{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return _s.startNull(t),_s.endNull(t)}visitInt(e,t){return On.startInt(t),On.addBitWidth(t,e.bitWidth),On.addIsSigned(t,e.isSigned),On.endInt(t)}visitFloat(e,t){return Or.startFloatingPoint(t),Or.addPrecision(t,e.precision),Or.endFloatingPoint(t)}visitBinary(e,t){return vs.startBinary(t),vs.endBinary(t)}visitBool(e,t){return ws.startBool(t),ws.endBool(t)}visitUtf8(e,t){return Is.startUtf8(t),Is.endUtf8(t)}visitDecimal(e,t){return gn.startDecimal(t),gn.addScale(t,e.scale),gn.addPrecision(t,e.precision),gn.addBitWidth(t,e.bitWidth),gn.endDecimal(t)}visitDate(e,t){return hu.startDate(t),hu.addUnit(t,e.unit),hu.endDate(t)}visitTime(e,t){return Un.startTime(t),Un.addUnit(t,e.unit),Un.addBitWidth(t,e.bitWidth),Un.endTime(t)}visitTimestamp(e,t){const s=e.timezone&&t.createString(e.timezone)||void 0;return jn.startTimestamp(t),jn.addUnit(t,e.unit),s!==void 0&&jn.addTimezone(t,s),jn.endTimestamp(t)}visitInterval(e,t){return Rr.startInterval(t),Rr.addUnit(t,e.unit),Rr.endInterval(t)}visitList(e,t){return Ss.startList(t),Ss.endList(t)}visitStruct(e,t){return bs.startStruct_(t),bs.endStruct_(t)}visitUnion(e,t){vn.startTypeIdsVector(t,e.typeIds.length);const s=vn.createTypeIdsVector(t,e.typeIds);return vn.startUnion(t),vn.addMode(t,e.mode),vn.addTypeIds(t,s),vn.endUnion(t)}visitDictionary(e,t){const s=this.visit(e.indices,t);return Jr.startDictionaryEncoding(t),Jr.addId(t,BigInt(e.id)),Jr.addIsOrdered(t,e.isOrdered),s!==void 0&&Jr.addIndexType(t,s),Jr.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return Dr.startFixedSizeBinary(t),Dr.addByteWidth(t,e.byteWidth),Dr.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return Cr.startFixedSizeList(t),Cr.addListSize(t,e.listSize),Cr.endFixedSizeList(t)}visitMap(e,t){return pu.startMap(t),pu.addKeysSorted(t,e.keysSorted),pu.endMap(t)}}const lf=new EE;function xE(n,e=new Map){return new Je(CE(n,e),yu(n.customMetadata),e)}function R0(n){return new ar(n.count,F0(n.columns),T0(n.columns))}function DE(n){return new ii(R0(n.data),n.id,n.isDelta)}function CE(n,e){return(n.fields||[]).filter(Boolean).map(t=>gt.fromJSON(t,e))}function jy(n,e){return(n.children||[]).filter(Boolean).map(t=>gt.fromJSON(t,e))}function F0(n){return(n||[]).reduce((e,t)=>[...e,new Ro(t.count,OE(t.VALIDITY)),...F0(t.children)],[])}function T0(n,e=[]){for(let t=-1,s=(n||[]).length;++t<s;){const a=n[t];a.VALIDITY&&e.push(new Zr(e.length,a.VALIDITY.length)),a.TYPE&&e.push(new Zr(e.length,a.TYPE.length)),a.OFFSET&&e.push(new Zr(e.length,a.OFFSET.length)),a.DATA&&e.push(new Zr(e.length,a.DATA.length)),e=T0(a.children,e)}return e}function OE(n){return(n||[]).reduce((e,t)=>e+ +(t===0),0)}function RE(n,e){let t,s,a,u,d,h;return!e||!(u=n.dictionary)?(d=Vy(n,jy(n,e)),a=new gt(n.name,d,n.nullable,yu(n.customMetadata))):e.has(t=u.id)?(s=(s=u.indexType)?zy(s):new La,h=new vo(e.get(t),s,t,u.isOrdered),a=new gt(n.name,h,n.nullable,yu(n.customMetadata))):(s=(s=u.indexType)?zy(s):new La,e.set(t,d=Vy(n,jy(n,e))),h=new vo(d,s,t,u.isOrdered),a=new gt(n.name,h,n.nullable,yu(n.customMetadata))),a||null}function yu(n){return new Map(Object.entries(n||{}))}function zy(n){return new Vi(n.isSigned,n.bitWidth)}function Vy(n,e){const t=n.type.name;switch(t){case"NONE":return new zi;case"null":return new zi;case"binary":return new Du;case"utf8":return new Cu;case"bool":return new Ou;case"list":return new Au((e||[])[0]);case"struct":return new on(e||[]);case"struct_":return new on(e||[])}switch(t){case"int":{const s=n.type;return new Vi(s.isSigned,s.bitWidth)}case"floatingpoint":{const s=n.type;return new Ba(wn[s.precision])}case"decimal":{const s=n.type;return new Ru(s.scale,s.precision,s.bitWidth)}case"date":{const s=n.type;return new Fu(ri[s.unit])}case"time":{const s=n.type;return new ka(Ke[s.unit],s.bitWidth)}case"timestamp":{const s=n.type;return new Tu(Ke[s.unit],s.timezone)}case"interval":{const s=n.type;return new Mu(ji[s.unit])}case"union":{const s=n.type;return new Pu(sr[s.mode],s.typeIds||[],e||[])}case"fixedsizebinary":{const s=n.type;return new Nu(s.byteWidth)}case"fixedsizelist":{const s=n.type;return new Lu(s.listSize,(e||[])[0])}case"map":{const s=n.type;return new Bu((e||[])[0],s.keysSorted)}}throw new Error(`Unrecognized type: "${t}"`)}var FE=v0,TE=wo;class rr{static fromJSON(e,t){const s=new rr(0,Vn.V4,t);return s._createHeader=ME(e,t),s}static decode(e){e=new TE(Ge(e));const t=Ai.getRootAsMessage(e),s=t.bodyLength(),a=t.version(),u=t.headerType(),d=new rr(s,a,u);return d._createHeader=AE(t,u),d}static encode(e){const t=new FE;let s=-1;return e.isSchema()?s=Je.encode(t,e.header()):e.isRecordBatch()?s=ar.encode(t,e.header()):e.isDictionaryBatch()&&(s=ii.encode(t,e.header())),Ai.startMessage(t),Ai.addVersion(t,Vn.V4),Ai.addHeader(t,s),Ai.addHeaderType(t,e.headerType),Ai.addBodyLength(t,BigInt(e.bodyLength)),Ai.finishMessageBuffer(t,Ai.endMessage(t)),t.asUint8Array()}static from(e,t=0){if(e instanceof Je)return new rr(0,Vn.V4,st.Schema,e);if(e instanceof ar)return new rr(t,Vn.V4,st.RecordBatch,e);if(e instanceof ii)return new rr(t,Vn.V4,st.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}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===st.Schema}isRecordBatch(){return this.headerType===st.RecordBatch}isDictionaryBatch(){return this.headerType===st.DictionaryBatch}constructor(e,t,s,a){this._version=t,this._headerType=s,this.body=new Uint8Array(0),a&&(this._createHeader=()=>a),this._bodyLength=or(e)}}class ar{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,s){this._nodes=t,this._buffers=s,this._length=or(e)}}class ii{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(e,t,s=!1){this._data=e,this._isDelta=s,this._id=or(t)}}class Zr{constructor(e,t){this.offset=or(e),this.length=or(t)}}class Ro{constructor(e,t){this.length=or(e),this.nullCount=or(t)}}function ME(n,e){return()=>{switch(e){case st.Schema:return Je.fromJSON(n);case st.RecordBatch:return ar.fromJSON(n);case st.DictionaryBatch:return ii.fromJSON(n)}throw new Error(`Unrecognized Message type: { name: ${st[e]}, type: ${e} }`)}}function AE(n,e){return()=>{switch(e){case st.Schema:return Je.decode(n.header(new br));case st.RecordBatch:return ar.decode(n.header(new Yr),n.version());case st.DictionaryBatch:return ii.decode(n.header(new ao),n.version())}throw new Error(`Unrecognized Message type: { name: ${st[e]}, type: ${e} }`)}}gt.encode=WE;gt.decode=VE;gt.fromJSON=RE;Je.encode=$E;Je.decode=PE;Je.fromJSON=xE;ar.encode=QE;ar.decode=NE;ar.fromJSON=R0;ii.encode=HE;ii.decode=LE;ii.fromJSON=DE;Ro.encode=qE;Ro.decode=kE;Zr.encode=KE;Zr.decode=BE;function PE(n,e=new Map){const t=zE(n,e);return new Je(t,gu(n),e)}function NE(n,e=Vn.V4){if(n.compression()!==null)throw new Error("Record batch compression not implemented");return new ar(n.length(),UE(n),jE(n,e))}function LE(n,e=Vn.V4){return new ii(ar.decode(n.data(),e),n.id(),n.isDelta())}function BE(n){return new Zr(n.offset(),n.length())}function kE(n){return new Ro(n.length(),n.nullCount())}function UE(n){const e=[];for(let t,s=-1,a=-1,u=n.nodesLength();++s<u;)(t=n.nodes(s))&&(e[++a]=Ro.decode(t));return e}function jE(n,e){const t=[];for(let s,a=-1,u=-1,d=n.buffersLength();++a<d;)(s=n.buffers(a))&&(e<Vn.V4&&(s.bb_pos+=8*(a+1)),t[++u]=Zr.decode(s));return t}function zE(n,e){const t=[];for(let s,a=-1,u=-1,d=n.fieldsLength();++a<d;)(s=n.fields(a))&&(t[++u]=gt.decode(s,e));return t}function $y(n,e){const t=[];for(let s,a=-1,u=-1,d=n.childrenLength();++a<d;)(s=n.children(a))&&(t[++u]=gt.decode(s,e));return t}function VE(n,e){let t,s,a,u,d,h;return!e||!(h=n.dictionary())?(a=Qy(n,$y(n,e)),s=new gt(n.name(),a,n.nullable(),gu(n))):e.has(t=or(h.id()))?(u=(u=h.indexType())?Wy(u):new La,d=new vo(e.get(t),u,t,h.isOrdered()),s=new gt(n.name(),d,n.nullable(),gu(n))):(u=(u=h.indexType())?Wy(u):new La,e.set(t,a=Qy(n,$y(n,e))),d=new vo(a,u,t,h.isOrdered()),s=new gt(n.name(),d,n.nullable(),gu(n))),s||null}function gu(n){const e=new Map;if(n)for(let t,s,a=-1,u=Math.trunc(n.customMetadataLength());++a<u;)(t=n.customMetadata(a))&&(s=t.key())!=null&&e.set(s,t.value());return e}function Wy(n){return new Vi(n.isSigned(),n.bitWidth())}function Qy(n,e){const t=n.typeType();switch(t){case Et.NONE:return new zi;case Et.Null:return new zi;case Et.Binary:return new Du;case Et.Utf8:return new Cu;case Et.Bool:return new Ou;case Et.List:return new Au((e||[])[0]);case Et.Struct_:return new on(e||[])}switch(t){case Et.Int:{const s=n.type(new On);return new Vi(s.isSigned(),s.bitWidth())}case Et.FloatingPoint:{const s=n.type(new Or);return new Ba(s.precision())}case Et.Decimal:{const s=n.type(new gn);return new Ru(s.scale(),s.precision(),s.bitWidth())}case Et.Date:{const s=n.type(new hu);return new Fu(s.unit())}case Et.Time:{const s=n.type(new Un);return new ka(s.unit(),s.bitWidth())}case Et.Timestamp:{const s=n.type(new jn);return new Tu(s.unit(),s.timezone())}case Et.Interval:{const s=n.type(new Rr);return new Mu(s.unit())}case Et.Union:{const s=n.type(new vn);return new Pu(s.mode(),s.typeIdsArray()||[],e||[])}case Et.FixedSizeBinary:{const s=n.type(new Dr);return new Nu(s.byteWidth())}case Et.FixedSizeList:{const s=n.type(new Cr);return new Lu(s.listSize(),(e||[])[0])}case Et.Map:{const s=n.type(new pu);return new Bu((e||[])[0],s.keysSorted())}}throw new Error(`Unrecognized type: "${Et[t]}" (${t})`)}function $E(n,e){const t=e.fields.map(u=>gt.encode(n,u));br.startFieldsVector(n,t.length);const s=br.createFieldsVector(n,t),a=e.metadata&&e.metadata.size>0?br.createCustomMetadataVector(n,[...e.metadata].map(([u,d])=>{const h=n.createString(`${u}`),p=n.createString(`${d}`);return kt.startKeyValue(n),kt.addKey(n,h),kt.addValue(n,p),kt.endKeyValue(n)})):-1;return br.startSchema(n),br.addFields(n,s),br.addEndianness(n,YE?_o.Little:_o.Big),a!==-1&&br.addCustomMetadata(n,a),br.endSchema(n)}function WE(n,e){let t=-1,s=-1,a=-1;const u=e.type;let d=e.typeId;Re.isDictionary(u)?(d=u.dictionary.typeId,a=lf.visit(u,n),s=lf.visit(u.dictionary,n)):s=lf.visit(u,n);const h=(u.children||[]).map(g=>gt.encode(n,g)),p=Ln.createChildrenVector(n,h),y=e.metadata&&e.metadata.size>0?Ln.createCustomMetadataVector(n,[...e.metadata].map(([g,v])=>{const S=n.createString(`${g}`),I=n.createString(`${v}`);return kt.startKeyValue(n),kt.addKey(n,S),kt.addValue(n,I),kt.endKeyValue(n)})):-1;return e.name&&(t=n.createString(e.name)),Ln.startField(n),Ln.addType(n,s),Ln.addTypeType(n,d),Ln.addChildren(n,p),Ln.addNullable(n,!!e.nullable),t!==-1&&Ln.addName(n,t),a!==-1&&Ln.addDictionary(n,a),y!==-1&&Ln.addCustomMetadata(n,y),Ln.endField(n)}function QE(n,e){const t=e.nodes||[],s=e.buffers||[];Yr.startNodesVector(n,t.length);for(const d of t.slice().reverse())Ro.encode(n,d);const a=n.endVector();Yr.startBuffersVector(n,s.length);for(const d of s.slice().reverse())Zr.encode(n,d);const u=n.endVector();return Yr.startRecordBatch(n),Yr.addLength(n,BigInt(e.length)),Yr.addNodes(n,a),Yr.addBuffers(n,u),Yr.endRecordBatch(n)}function HE(n,e){const t=ar.encode(n,e.data);return ao.startDictionaryBatch(n),ao.addId(n,BigInt(e.id)),ao.addIsDelta(n,e.isDelta),ao.addData(n,t),ao.endDictionaryBatch(n)}function qE(n,e){return O0.createFieldNode(n,BigInt(e.length),BigInt(e.nullCount))}function KE(n,e){return C0.createBuffer(n,BigInt(e.offset),BigInt(e.length))}const YE=(()=>{const n=new ArrayBuffer(2);return new DataView(n).setInt16(0,256,!0),new Int16Array(n)[0]===256})(),ch=n=>`Expected ${st[n]} Message in stream, but was null or length 0.`,dh=n=>`Header pointer of flatbuffer-encoded ${st[n]} Message is null or length 0.`,M0=(n,e)=>`Expected to read ${n} metadata bytes, but only read ${e}.`,A0=(n,e)=>`Expected to read ${n} bytes for message body, but only read ${e}.`;class P0{constructor(e){this.source=e instanceof Qu?e:new Qu(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?xt:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(ch(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const t=Ge(this.source.read(e));if(t.byteLength<e)throw new Error(A0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){const t=st.Schema,s=this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(dh(t));return a}readMetadataLength(){const e=this.source.read(lc),t=e&&new wo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}}readMetadata(e){const t=this.source.read(e);if(!t)return xt;if(t.byteLength<e)throw new Error(M0(e,t.byteLength));return{done:!1,value:rr.decode(t)}}}class GE{constructor(e,t){this.source=e instanceof Eo?e:Xg(e)?new Hu(e,t):new Eo(e)}[Symbol.asyncIterator](){return this}next(){return ve(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?xt:e})}throw(e){return ve(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return ve(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return ve(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(ch(e));return t.value})}readMessageBody(e){return ve(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array(0);const t=Ge(yield this.source.read(e));if(t.byteLength<e)throw new Error(A0(e,t.byteLength));return t.byteOffset%8===0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(e=!1){return ve(this,void 0,void 0,function*(){const t=st.Schema,s=yield this.readMessage(t),a=s==null?void 0:s.header();if(e&&!a)throw new Error(dh(t));return a})}readMetadataLength(){return ve(this,void 0,void 0,function*(){const e=yield this.source.read(lc),t=e&&new wo(e),s=(t==null?void 0:t.readInt32(0))||0;return{done:s===0,value:s}})}readMetadata(e){return ve(this,void 0,void 0,function*(){const t=yield this.source.read(e);if(!t)return xt;if(t.byteLength<e)throw new Error(M0(e,t.byteLength));return{done:!1,value:rr.decode(t)}})}}class JE extends P0{constructor(e){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof By?e:new By(e)}next(){const{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:rr.fromJSON(e.schema,st.Schema)};if(this._dictionaryIndex<e.dictionaries.length){const t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:rr.fromJSON(t,st.DictionaryBatch)}}if(this._batchIndex<e.batches.length){const t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:rr.fromJSON(t,st.RecordBatch)}}return this._body=[],xt}readMessageBody(e){return t(this._body);function t(s){return(s||[]).reduce((a,u)=>[...a,...u.VALIDITY&&[u.VALIDITY]||[],...u.TYPE&&[u.TYPE]||[],...u.OFFSET&&[u.OFFSET]||[],...u.DATA&&[u.DATA]||[],...t(u.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw new Error(ch(e));return t.value}readSchema(){const e=st.Schema,t=this.readMessage(e),s=t==null?void 0:t.header();if(!t||!s)throw new Error(dh(e));return s}}const lc=4,Af="ARROW1",Gu=new Uint8Array(Af.length);for(let n=0;n<Af.length;n+=1)Gu[n]=Af.codePointAt(n);function fh(n,e=0){for(let t=-1,s=Gu.length;++t<s;)if(Gu[t]!==n[e+t])return!1;return!0}const qa=Gu.length,N0=qa+lc,XE=qa*2+lc;class ti extends S0{constructor(e){super(),this._impl=e}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(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){const t=this._impl.open(e);return Ma(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return kn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return kn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,t){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof ti?e:bf(e)?nx(e):Xg(e)?sx(e):Ma(e)?ve(this,void 0,void 0,function*(){return yield ti.from(yield e)}):Zg(e)||qf(e)||tv(e)||Hf(e)?ix(new Eo(e)):rx(new Qu(e))}static readAll(e){return e instanceof ti?e.isSync()?Hy(e):qy(e):bf(e)||ArrayBuffer.isView(e)||sc(e)||Jg(e)?Hy(e):qy(e)}}class Ju extends ti{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Fr(this,arguments,function*(){yield Te(yield*fu(uo(this[Symbol.iterator]())))})}}class Xu extends ti{constructor(e){super(e),this._impl=e}readAll(){var e,t,s,a;return ve(this,void 0,void 0,function*(){const u=new Array;try{for(var d=!0,h=uo(this),p;p=yield h.next(),e=p.done,!e;d=!0){a=p.value,d=!1;const y=a;u.push(y)}}catch(y){t={error:y}}finally{try{!d&&!e&&(s=h.return)&&(yield s.call(h))}finally{if(t)throw t.error}}return u})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class L0 extends Ju{constructor(e){super(e),this._impl=e}}class ZE extends Xu{constructor(e){super(e),this._impl=e}}class B0{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t){const s=this._loadVectors(e,t,this.schema.fields),a=ke({type:new on(this.schema.fields),length:e.length,children:s});return new nr(this.schema,a)}_loadDictionaryBatch(e,t){const{id:s,isDelta:a}=e,{dictionaries:u,schema:d}=this,h=u.get(s);if(a||!h){const p=d.dictionaries.get(s),y=this._loadVectors(e.data,t,[p]);return(h&&a?h.concat(new ot(y)):new ot(y)).memoize()}return h.memoize()}_loadVectors(e,t,s){return new b0(t,e.nodes,e.buffers,this.dictionaries).visitMany(s)}}class Zu extends B0{constructor(e,t){super(t),this._reader=bf(e)?new JE(this._handle=e):new P0(this._handle=e)}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(e){return this.closed||(this.autoDestroy=U0(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):xt}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):xt}next(){if(this.closed)return xt;let e;const{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new D0(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class ec extends B0{constructor(e,t){super(t),this._reader=new GE(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ve(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return ve(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=U0(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return ve(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):xt})}return(e){return ve(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):xt})}next(){return ve(this,void 0,void 0,function*(){if(this.closed)return xt;let e;const{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(s,a)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const s=e.header(),a=yield t.readMessageBody(e.bodyLength),u=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,u)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new D0(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return ve(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class k0 extends Zu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof ky?e:new ky(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(st.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null}_readDictionaryBatch(e){var t;const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&this._handle.seek(s.offset)){const a=this._reader.readMessage(st.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}}_readFooter(){const{_handle:e}=this,t=e.size-N0,s=e.readInt32(t),a=e.readAt(t-s,s);return sh.decode(a)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(this._recordBatchIndex);if(s&&this._handle.seek(s.offset))return this._reader.readMessage(e)}return null}}class ex extends ec{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){const s=typeof t[0]!="number"?t.shift():void 0,a=t[0]instanceof Map?t.shift():void 0;super(e instanceof Hu?e:new Hu(e,s),a)}isFile(){return!0}isAsync(){return!0}open(e){const t=Object.create(null,{open:{get:()=>super.open}});return ve(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const s of this._footer.dictionaryBatches())s&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){var t;return ve(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());const s=(t=this._footer)===null||t===void 0?void 0:t.getRecordBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(st.RecordBatch);if(a!=null&&a.isRecordBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength);return this._loadRecordBatch(u,d)}}return null})}_readDictionaryBatch(e){var t;return ve(this,void 0,void 0,function*(){const s=(t=this._footer)===null||t===void 0?void 0:t.getDictionaryBatch(e);if(s&&(yield this._handle.seek(s.offset))){const a=yield this._reader.readMessage(st.DictionaryBatch);if(a!=null&&a.isDictionaryBatch()){const u=a.header(),d=yield this._reader.readMessageBody(a.bodyLength),h=this._loadDictionaryBatch(u,d);this.dictionaries.set(u.id,h)}}})}_readFooter(){return ve(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const t=e.size-N0,s=yield e.readInt32(t),a=yield e.readAt(t-s,s);return sh.decode(a)})}_readNextMessageAndValidate(e){return ve(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}}class tx extends Zu{constructor(e,t){super(e,t)}_loadVectors(e,t,s){return new hE(t,e.nodes,e.buffers,this.dictionaries).visitMany(s)}}function U0(n,e){return e&&typeof e.autoDestroy=="boolean"?e.autoDestroy:n.autoDestroy}function*Hy(n){const e=ti.from(n);try{if(!e.open({autoDestroy:!1}).closed)do yield e;while(!e.reset().open().closed)}finally{e.cancel()}}function qy(n){return Fr(this,arguments,function*(){const t=yield Te(ti.from(n));try{if(!(yield Te(t.open({autoDestroy:!1}))).closed)do yield yield Te(t);while(!(yield Te(t.reset().open())).closed)}finally{yield Te(t.cancel())}})}function nx(n){return new Ju(new tx(n))}function rx(n){const e=n.peek(qa+7&-8);return e&&e.byteLength>=4?fh(e)?new L0(new k0(n.read())):new Ju(new Zu(n)):new Ju(new Zu(function*(){}()))}function ix(n){return ve(this,void 0,void 0,function*(){const e=yield n.peek(qa+7&-8);return e&&e.byteLength>=4?fh(e)?new L0(new k0(yield n.read())):new Xu(new ec(n)):new Xu(new ec(function(){return Fr(this,arguments,function*(){})}()))})}function sx(n){return ve(this,void 0,void 0,function*(){const{size:e}=yield n.stat(),t=new Hu(n,e);return e>=XE&&fh(yield t.readAt(0,qa+7&-8))?new ZE(new ex(t)):new Xu(new ec(t))})}function j0(n){const e=ti.from(n);return Ma(e)?e.then(t=>j0(t)):e.isAsync()?e.readAll().then(t=>new zn(t)):new zn(e.readAll())}async function Ft(n,e){const{url:t,method:s,params:a,data:u,headers:d,credentials:h,mode:p,cache:y}=n,g=Object.keys({...a}).length>0,v=t.replace(/([^:]\/)\/+/g,"$1"),S=new URL(z0(v),window.location.origin);if(g){const I=Object.entries({...a}).reduce((T,[A,M])=>(M!=null&&(T[A]=String(M)),T),{});S.search=new URLSearchParams(I).toString()}return await new Promise((I,T)=>{fetch(S,{method:s,credentials:h,mode:p,cache:y,headers:ox(d),body:ax(u),signal:e==null?void 0:e.signal}).then(async A=>{if(A.status===204)return{ok:!0};const M=A.headers.get("Content-Type");if(qt(M))return{ok:!1,message:"Empty response"};if(A.status>=400)try{const q=await A.json();throw q.status=q.status??A.status,q}catch(q){throw{message:A.statusText,...q}}const K=M.includes("text/event-stream"),W=M.includes("application/json"),Y=M.includes("application/vnd.apache.arrow.stream");if(W)return await A.json();if(Y)return await j0(A);if(K){const ce=(await A.text()).trim().replace("data: ","").trim();return JSON.parse(ce)}}).then(I).catch(T)})}function ox(n){return{"Content-Type":"application/json",...n??{}}}function ax(n){try{return JSON.stringify(n)}catch{return""}}function z0(n="/"){let e=`${Da(window.__BASE_URL__)?"/":window.__BASE_URL__}/${n}`;for(;e.includes("//");)e=e.replaceAll("//","/");return e}const cu={python:"python",sql:"sql",seed:"seed",external:"external",source:"source"},_r={editor:"editor",files:"files","data-catalog":"data-catalog",plans:"plans",tests:"tests",audits:"audits",errors:"errors",data:"data",lineage:"lineage"},ND={NUMBER_1:1,NUMBER_2:2,NUMBER_3:3},LD={init:"init",success:"success",fail:"fail"},lx=(n,e)=>Ft({url:"/api/commands/apply",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),ux=(n,e)=>Ft({url:"/api/commands/evaluate",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),cx=(n,e)=>Ft({url:"/api/commands/fetchdf",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),dx=(n,e)=>Ft({url:"/api/commands/render",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),fx=n=>Ft({url:"/api/files",method:"GET"},n),hx=(n,e)=>Ft({url:`/api/files/${n}`,method:"GET"},e),px=(n,e,t)=>Ft({url:`/api/files/${n}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),BD=(n,e)=>Ft({url:`/api/files/${n}`,method:"DELETE"},e),kD=(n,e,t)=>Ft({url:`/api/directories/${n}`,method:"POST",headers:{"Content-Type":"application/json"},data:e},t),UD=(n,e)=>Ft({url:`/api/directories/${n}`,method:"DELETE"},e),mx=(n,e)=>Ft({url:"/api/plan",method:"POST",headers:{"Content-Type":"application/json"},data:n},e),yx=n=>Ft({url:"/api/plan/cancel",method:"POST"},n),gx=n=>Ft({url:"/api/environments",method:"GET"},n),jD=(n,e)=>Ft({url:`/api/environments/${n}`,method:"DELETE"},e),vx=(n,e,t,s)=>Ft({url:`/api/lineage/${n}/${e}`,method:"GET",params:t},s),wx=(n,e)=>Ft({url:`/api/lineage/${n}`,method:"GET"},e),Sx=n=>Ft({url:"/api/models",method:"GET"},n),_x=(n,e)=>Ft({url:`/api/models/${n}`,method:"GET"},e),bx=n=>Ft({url:"/api/meta",method:"GET"},n),Ix=n=>Ft({url:"/api/modules",method:"GET"},n),Ex=(n,e)=>Ft({url:"/api/table_diff",method:"GET",params:n},e),Qr=N.lazy(()=>an(()=>import("./Root-BIGZcS_U.js"),[])),xx=N.lazy(()=>an(()=>import("./Editor-Cpn7iBcm.js"),[])),Dx=N.lazy(()=>an(()=>import("./Plan-BQe3-3RL.js"),[])),Cx=N.lazy(()=>an(()=>import("./Content-KG4KSDDO.js"),[])),Ox=N.lazy(()=>an(()=>import("./DataCatalog-BJTDeU-_.js"),[])),Rx=N.lazy(()=>an(()=>import("./Tests-DSsKelgd.js"),[])),Fx=N.lazy(()=>an(()=>import("./Audits-DRkR6sg0.js"),[])),Tx=N.lazy(()=>an(()=>import("./Data-D-rZnh8x.js"),[])),uf=N.lazy(()=>an(()=>import("./Models-Dn2xoUA7.js"),[])),Mx=N.lazy(()=>an(()=>import("./Lineage-ZXdxdqzl.js"),[])),Ax=N.lazy(()=>an(()=>import("./Errors-DyDRdQyq.js"),[])),Px=N.lazy(()=>an(()=>import("./Content-pMJLtxGr.js"),[])),Zn=N.lazy(()=>an(()=>import("./Welcome-C0F3fb3h.js"),[])),rt={Home:"/",Editor:"/editor",DataCatalog:"/data-catalog",DataCatalogModels:"/data-catalog/models",Data:"/data",Lineage:"/lineage",LineageModels:"/lineage/models",Tests:"/tests",Audits:"/audits",Errors:"/errors",Plan:"/plan",NotFound:"/not-found"},Ky={plan:[_r.plans]};function Nx(n){const e=[{path:"*",element:nc(n.list)?B.jsx(pn,{link:rt.Home,message:"Back To Main"}):B.jsx(pn,{headline:"Empty"})},{path:rt.Home,element:B.jsx(Qr,{})},...[{path:rt.Editor,element:B.jsx(Qr,{content:B.jsx(xx,{})})},{path:rt.DataCatalog,element:B.jsx(Qr,{content:B.jsx(uf,{route:rt.DataCatalog})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.DataCatalog,message:"Back To Data Catalog"})},{path:"models",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data Catalog",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.DataCatalog,message:"Back To Data Catalog"})},{path:":modelName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Ox,{})})}]}]},{path:rt.Data,element:B.jsx(Qr,{content:B.jsx(uf,{route:rt.Data})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Data,message:"Back To Data"})},{path:"models",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Data",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Data,message:"Back To Data"})},{path:":modelName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Tx,{})})}]}]},{path:rt.Lineage,element:B.jsx(Qr,{content:B.jsx(uf,{route:rt.Lineage})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Lineage,message:"Back To Lineage"})},{path:"models",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to the Lineage",tagline:"Here you can find all the information about the models and their fields."})},{path:"*",element:B.jsx(pn,{link:rt.Lineage,message:"Back To Lineage"})},{path:":modelName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Mx,{})})}]}]},{path:rt.Errors,element:B.jsx(Qr,{content:B.jsx(Ax,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to errors report",tagline:"Here you can see all the errors that occurred."})},{path:"*",element:B.jsx(pn,{link:rt.Errors,message:"Back To Errors"})},{path:":id",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Px,{})})}]},{path:rt.Plan,element:B.jsx(Qr,{content:B.jsx(Dx,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:B.jsx(pn,{link:rt.Plan,message:"Back To Plan"})},{path:"environments",children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to plan",tagline:"Here you can run the plan and apply the changes."})},{path:"*",element:B.jsx(pn,{link:rt.Plan,message:"Back To Plan"})},{path:":environmentName",element:B.jsx(N.Suspense,{fallback:B.jsx("div",{className:"flex justify-center items-center w-full h-full",children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:"Loading Content..."})]})}),children:B.jsx(Cx,{})})}]}]},{path:rt.Tests,element:B.jsx(Qr,{content:B.jsx(Rx,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to tests report",tagline:"Here you can run tests and see the results."})},{path:"*",element:B.jsx(pn,{link:rt.Tests,message:"Back To Tests"})}]},{path:rt.Audits,element:B.jsx(Qr,{content:B.jsx(Fx,{})}),children:[{index:!0,element:B.jsx(Zn,{headline:"Welcome to audits report",tagline:"Here you can run audits and see the results."})},{path:"*",element:B.jsx(pn,{link:rt.Audits,message:"Back To Audits"})}]}].filter(t=>{var a;const s=t.path.replace("/","");return qt(Ky[s])?n.list.includes(s):(a=Ky[s])==null?void 0:a.some(u=>n.list.includes(u))})].filter(Boolean);return Z1(e,{basename:z0()})}const Ut={API:"api",General:"general",RunPlan:"run-plan",ApplyPlan:"apply-plan",CancelPlan:"cancel-plan",Environments:"environments",Models:"models",Fetchdf:"fetchdf",EvaluateModel:"evaluate-model",RenderQuery:"render-query",ColumnLineage:"column-lineage",ModelLineage:"model-lineage",Meta:"meta",Modules:"modules",FileExplorer:"file-explorer",Table:"table",TableDiff:"table-diff",SaveFile:"save-file"},V0=N.createContext({errors:new Set,addError:()=>({removeError:()=>{},error:{}}),removeError:()=>{},clearErrors:()=>{}});function Lx({children:n}){const[e,t]=N.useState(new Set);function s(d,h){const p={id:ff(),key:d,status:h.status,timestamp:h.timestamp??Date.now(),message:h.message,description:h.description,type:h.type,origin:h.origin,trigger:h.trigger,stack:h.stack,traceback:h.traceback};return t(y=>new Set(y.add(p))),{removeError:()=>a(p),error:p}}function a(d){t(h=>(h.forEach(p=>{(p===d||p.key===d)&&h.delete(p)}),new Set(h)))}function u(){t(new Set)}return B.jsx(V0.Provider,{value:{errors:e,addError:s,removeError:a,clearErrors:u},children:n})}function hh(){return N.useContext(V0)}const $0=60*1e3,Bx=5*$0,uc=10*$0;function kx(n){return Zt({queryKey:["/api/modules"],queryFn:Ix,enabled:!0},{...n,errorKey:Ut.Modules,trigger:"API -> useApiModules"})}function zD(n){return Zt({queryKey:["/api/meta"],queryFn:bx,enabled:!0},{...n,errorKey:Ut.Meta,trigger:"API -> useApiMeta"})}function VD(n){return Zt({queryKey:["/api/models"],queryFn:Sx},{...n,errorKey:Ut.Models,trigger:"API -> useApiModels"})}function $D(n,e){return Zt({queryKey:["/api/models",n],queryFn:async({signal:t})=>await _x(n,{signal:t})},{...e,errorKey:Ut.Models,trigger:"API -> useApiModel"})}function WD(n){return Zt({queryKey:["/api/files"],queryFn:fx},{...n,errorKey:Ut.FileExplorer,trigger:"API -> useApiFiles"})}function QD(n,e){return Zt({queryKey:["/api/files",n],queryFn:async({signal:t})=>await hx(n,{signal:t})},{...e,errorKey:Ut.FileExplorer,trigger:"API -> useApiFileByPath"})}function HD(n,e){return Zt({queryKey:["/api/lineage",n],queryFn:async({signal:t})=>await wx(n,{signal:t})},{...e,errorKey:Ut.ModelLineage,trigger:"API -> useApiModelLineage"})}function qD(n,e,t,s){return Zt({queryKey:["/api/lineage",n,e],queryFn:async({signal:a})=>await vx(n,e,s,{signal:a})},{...t,errorKey:Ut.ColumnLineage,trigger:"API -> useApiColumnLineage"})}function KD(n){return Zt({queryKey:["/api/environments"],queryFn:gx},{...n,errorKey:Ut.Environments,trigger:"API -> useApiEnvironments"})}function YD(n){return Zt({queryKey:["/api/commands/apply"],queryFn:yx},{...n,errorKey:Ut.CancelPlan,trigger:"API -> useApiCancelPlan"})}function GD(n,e,t){return Zt({queryKey:["/api/plan",n],async queryFn({signal:s}){return await mx({environment:n,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:Ut.RunPlan,trigger:"API -> useApiPlanRun"})}function JD(n,e,t){return Zt({queryKey:["/api/commands/apply",n],async queryFn({signal:s}){return await lx({environment:n,plan_dates:e==null?void 0:e.planDates,plan_options:e==null?void 0:e.planOptions,categories:e==null?void 0:e.categories},{signal:s})}},{...t,errorKey:Ut.ApplyPlan,trigger:"API -> useApiPlanApply"})}function XD(n,e){return Zt({queryKey:["/api/commands/fetchd"],queryFn:async({signal:t})=>await cx(n,{signal:t})},{...e,errorKey:Ut.Fetchdf,trigger:"API -> useApiFetchdf",delay:uc})}function ZD(n,e){return Zt({queryKey:["/api/commands/render"],queryFn:async({signal:t})=>await dx(n,{signal:t})},{...e,errorKey:Ut.RenderQuery,trigger:"API -> useApiRender",delay:uc})}function eC(n,e){return Zt({queryKey:["/api/commands/table_diff"],queryFn:async({signal:t})=>await Ex(n,{signal:t})},{...e,errorKey:Ut.TableDiff,trigger:"API -> useApiTableDiff",delay:uc})}function tC(n,e){return Zt({queryKey:["/api/commands/evaluate"],queryFn:async({signal:t})=>await ux(n,{signal:t})},{...e,errorKey:Ut.EvaluateModel,trigger:"API -> useApiEvaluate",delay:uc})}function nC(n){const{addError:e}=hh();return O_({mutationFn:async({path:t,body:s})=>await px(t,s),onError(t){e(Ut.SaveFile,t)},async onMutate({path:t}){await n.cancelQueries({queryKey:["/api/files",t]})}})}function Zt(n,{delay:e=Bx,removeTimeoutErrorAfter:t,errorKey:s=Ut.API,trigger:a}){const u=n.queryKey.join(" -> "),d=Bf(),{addError:h}=hh(),[p,y]=N.useState(!1);let g,v=function(){console.log(`[REQUEST TIMEOUT] ${u} id: ${String(g)} timed out after ${e}ms`);const{removeError:q}=h(s,{message:"Request timed out",description:`Request ${u} with timeoutId: ${String(g)} timed out after ${e}ms`,timestamp:Date.now(),origin:"useQueryTimeout",trigger:a});y(!0),T(),sn(t)&&setTimeout(()=>q(),t)};function S(){console.log(`[CLEAR TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`),clearTimeout(g),g=void 0,v=void 0}function I(){g=setTimeout(()=>{v==null||v()},e),console.log(`[START TIMEOUT] ${u} id: ${String(g)} at ${Date.now()}`)}function T(){S(),d.cancelQueries({queryKey:n.queryKey}),console.log(`[REQUEST CANCELED] ${u} at ${Date.now()}`)}function A(Y){S(),Ca(Y)||Y.name==="AbortError"?console.log(`[REQUEST ABORTED] ${u} aborted by React Query at ${Date.now()}`):(console.log(`[REQUEST FAILED] ${u} failed at ${Date.now()}`),h(s,Y))}function M(){S(),console.log(`[REQUEST COMPLETED] ${u} completed at ${Date.now()}`)}async function K(...Y){return I(),n.queryFn(...Y)}const W=C_({cacheTime:0,enabled:!1,queryKey:n.queryKey,queryFn:K,meta:{...n.meta,onError:A,onSuccess:M}});return{...W,refetch:async(...Y)=>new Promise(q=>{W.refetch(...Y,{throwOnError:!0}).then(q).catch(ce=>ce)}),cancel:T,isTimeout:p}}class W0{constructor(e){wt(this,"_initial");wt(this,"isModel",!0);qt(e)?this._initial=Object.assign({id:ff()}):this._initial=sn(e==null?void 0:e.id)?e:new Proxy(Object.assign(e??{},{id:ff()}),{set(){throw new Error("Cannot change initial file")}})}get initial(){return this._initial}get id(){return this.initial.id}}class Yy extends W0{constructor(t=[]){super();wt(this,"modules",new Set);this.modules=new Set(t)}get list(){return Array.from(this.modules)}get isEmpty(){return this.modules.size===0}get hasErrors(){return this.modules.has(_r.errors)}get hasEditor(){return this.modules.has(_r.editor)}get hasFiles(){return this.modules.has(_r.files)}get hasProjectEditor(){return this.hasEditor&&this.hasFiles}get hasOnlyProjectEditor(){return this.modules.size===2&&this.hasProjectEditor}get hasOnlyDataCatalog(){return this.modules.size===1&&this.hasDataCatalog}get hasProjectEditorAndModule(){return this.modules.size===3&&this.hasProjectEditor&&Ui(this.hasErrors)}get hasDataCatalog(){return this.modules.has(_r["data-catalog"])}get hasPlans(){return this.modules.has(_r.plans)}get hasOnlyPlans(){return this.modules.size===1&&this.hasPlans}get hasOnlyPlansAndErrors(){return this.modules.size===2&&this.hasPlans&&this.hasErrors}get hasTests(){return this.modules.has(_r.tests)}get hasAudits(){return this.modules.has(_r.audits)}get hasData(){return this.modules.has(_r.data)}get hasLineage(){return this.modules.has(_r.lineage)}get hasModuleAndErrors(){return this.hasErrors&&(this.modules.size===2||this.modules.size===3&&this.hasProjectEditor)}get hasSingleModule(){return this.modules.size===1}get showModuleNavigation(){return this.isEmpty||this.hasSingleModule||this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule?!0:Ui(this.isEmpty)}get showHistoryNavigation(){return this.hasOnlyProjectEditor||this.hasModuleAndErrors||this.hasOnlyDataCatalog?!1:this.hasProjectEditorAndModule||this.hasDataCatalog?!0:Ui(this.isEmpty)}get showNavigation(){return this.hasErrors||this.hasPlans||this.showHistoryNavigation}update(t=[]){this.modules=new Set(t)}defaultNavigationRoute(){return this.hasEditor?rt.Editor:this.hasPlans?rt.Plan:this.hasDataCatalog?rt.DataCatalog:rt.NotFound}}class Ux extends W0{constructor(t){super(t!=null&&t.isModel?t.initial:{...t,dialect:(t==null?void 0:t.dialect)??"Default",columns:(t==null?void 0:t.columns)??[],details:(t==null?void 0:t.details)??{}});wt(this,"_details",{});wt(this,"_detailsIndex","");wt(this,"name");wt(this,"fqn");wt(this,"path");wt(this,"full_path");wt(this,"dialect");wt(this,"type");wt(this,"columns");wt(this,"default_catalog");wt(this,"description");wt(this,"sql");wt(this,"definition");wt(this,"hash");this.name=encodeURI(this.initial.name),this.fqn=encodeURI(this.initial.fqn),this.default_catalog=this.initial.default_catalog,this.path=this.initial.path,this.full_path=this.initial.full_path,this.dialect=this.initial.dialect,this.description=this.initial.description,this.sql=this.initial.sql,this.definition=this.initial.definition,this.columns=this.initial.columns??[],this.type=this.initial.type,this.hash=this.initial.hash,this.details=this.initial.details??{}}get defaultCatalog(){return this.default_catalog}get details(){return this._details}set details(t){const s=[];for(const a of Object.values(t))nc(a)?a.forEach(u=>{s.push(...Object.values(u))}):s.push(a);this._details=t,this._detailsIndex=s.join(" ")}get index(){return[this.displayName,this.path,this.type,...this.columns.map(t=>Object.values(t)).flat(),this._detailsIndex,this.dialect,this.description].filter(Boolean).join(" ").toLowerCase()}get isModelPython(){return this.type===cu.python}get isModelSQL(){return this.type===cu.sql}get isModelSeed(){return this.type===cu.seed}get isModelExternal(){return this.type===cu.external}get displayName(){return decodeURI(this.name)}update(t={}){for(const[s,a]of Object.entries(t))s==="columns"?this.columns=a:s==="details"?this.details=a:s==="name"?this.name=encodeURI(a):s==="fqn"?this.fqn=encodeURI(a):s==="type"?this.type=a:s==="default_catalog"?this.default_catalog=a:s==="description"?this.description=a:s in this&&(this[s]=a)}}const jx={},Gy=n=>{let e;const t=new Set,s=(g,v)=>{const S=typeof g=="function"?g(e):g;if(!Object.is(S,e)){const I=e;e=v??(typeof S!="object"||S===null)?S:Object.assign({},e,S),t.forEach(T=>T(e,I))}},a=()=>e,p={setState:s,getState:a,getInitialState:()=>y,subscribe:g=>(t.add(g),()=>t.delete(g)),destroy:()=>{(jx?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},y=e=n(s,a,p);return p},zx=n=>n?Gy(n):Gy;var cf={exports:{}},df={};/**
83
83
  * @license React
84
84
  * use-sync-external-store-shim/with-selector.production.js
85
85
  *
@@ -87,4 +87,4 @@ Error generating stack: `+f.message+`
87
87
  *
88
88
  * This source code is licensed under the MIT license found in the
89
89
  * LICENSE file in the root directory of this source tree.
90
- */var Jy;function Vx(){if(Jy)return df;Jy=1;var n=Ua(),e=xg();function t(y,g){return y===g&&(y!==0||1/y===1/g)||y!==y&&g!==g}var s=typeof Object.is=="function"?Object.is:t,a=e.useSyncExternalStore,u=n.useRef,d=n.useEffect,h=n.useMemo,p=n.useDebugValue;return df.useSyncExternalStoreWithSelector=function(y,g,v,S,I){var T=u(null);if(T.current===null){var A={hasValue:!1,value:null};T.current=A}else A=T.current;T=h(function(){function K(Z){if(!W){if(W=!0,Y=Z,Z=S(Z),I!==void 0&&A.hasValue){var x=A.value;if(I(x,Z))return q=x}return q=Z}if(x=q,s(Y,Z))return x;var V=S(Z);return I!==void 0&&I(x,V)?(Y=Z,x):(Y=Z,q=V)}var W=!1,Y,q,ce=v===void 0?null:v;return[function(){return K(g())},ce===null?void 0:function(){return K(ce())}]},[g,v,S,I]);var M=a(y,T[0],T[1]);return d(function(){A.hasValue=!0,A.value=M},[M]),p(M),M},df}var Xy;function $x(){return Xy||(Xy=1,cf.exports=Vx()),cf.exports}var Wx=$x();const Qx=tc(Wx),Q0={},{useDebugValue:Hx}=Do,{useSyncExternalStoreWithSelector:qx}=Qx;let Zy=!1;const Kx=n=>n;function Yx(n,e=Kx,t){(Q0?"production":void 0)!=="production"&&t&&!Zy&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Zy=!0);const s=qx(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return Hx(s),s}const eg=n=>{(Q0?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?zx(n):n,t=(s,a)=>Yx(e,s,a);return Object.assign(t,e),t},Gx=n=>n?eg(n):eg,ba={Empty:"",Prod:"prod"},Xr={Local:"local",Remote:"remote"},[tg,Jx]=fg("profile");class Xt{constructor(e,t,s=ba.Prod,a=!1,u=!1){wt(this,"_initial");wt(this,"_type");wt(this,"_createFrom");wt(this,"_isPinned",!1);wt(this,"_isDefault",!1);wt(this,"isModel",!0);this._initial=e,this._type=t??Xr.Local,this._createFrom=this._isDefault?ba.Empty:s,this._isPinned=a,this._isDefault=u}get id(){return this._initial.plan_id??""}get name(){return this._initial.name??ba.Empty}get type(){return this._type}get createFrom(){return this._createFrom}get isProd(){return this.name===ba.Prod}get isDefault(){return this._isDefault}set isDefault(e){this._isDefault=e}get isPinned(){return this._isPinned||this.isDefault||this.isProd}set isPinned(e){this._isPinned=e}get isInitial(){var e;return Da((e=this._initial)==null?void 0:e.plan_id)}get isLocal(){return this._type===Xr.Local}get isRemote(){return this._type===Xr.Remote}get isSyncronized(){return this.isRemote&&Ui(this.isInitial)}get isInitialProd(){return this.isInitial&&this.isProd}setType(e){this._type=e}setCreatedFrom(e){this._createFrom=e}update(e){this._initial=e}static save({environment:e,environments:t}){const s={};sn(e)&&(s.environment={name:e.name,plan_id:e.id,type:e.type,createFrom:e.createFrom,isPinned:e.isPinned,isDefault:e.isDefault}),sn(t)&&(s.environments=Xt.getOnlyLocal(t).map(a=>({name:a.name,plan_id:a.id,type:a.type,createFrom:a.createFrom,isPinned:a.isPinned,isDefault:a.isDefault}))),Jx(s)}static getOnlyLocal(e=[]){return e.filter(t=>Ui(Da(t.name))&&t.isLocal)}static getOnlyRemote(e=[]){return e.filter(t=>Ui(Da(t.name))&&t.isRemote)}static getEnvironment(){const{environment:e}=tg()??{};if(qt(e))return;const{name:t,plan_id:s,type:a,createFrom:u,isPinned:d,isDefault:h}=e;return new Xt({name:t,plan_id:s},a,u,d,h)}static getEnvironments(){const e=tg(),t=new Map;sn(e)&&sn(e.environment)&&t.set(e.environment.name,e.environment),sn(e)&&sn(e.environments)&&e.environments.forEach(a=>t.set(a.name,a));const s=[];return Array.from(t.entries()).forEach(([a,u])=>{s.push(new Xt({name:a,plan_id:u.plan_id},u.type,u.createFrom,u.isPinned,u.isDefault))}),cg(s)&&s.push(new Xt({name:ba.Prod},Xr.Local)),s}static sort(e){return e.sort(t=>t.isRemote?-1:1),e}}const ng="prod",H0=new Set(Xt.getEnvironments()),rg=Xt.getEnvironment()??H0.values().next().value,ig=Gx((n,e)=>({version:void 0,modules:new Yy,splitPaneSizes:[20,80],showConfirmation:!1,confirmations:[],environment:rg,environments:H0,initialStartDate:void 0,initialEndDate:void 0,models:new Map,lastSelectedModel:void 0,setLastSelectedModel(t){n(()=>({lastSelectedModel:t}))},setModules(t){n(()=>({modules:new Yy(t.list)}))},isModel(t){return e().models.has(t)},setSplitPaneSizes(t){n(()=>({splitPaneSizes:t}))},setVersion(t){n(()=>({version:t}))},setShowConfirmation(t){n(()=>({showConfirmation:t}))},addConfirmation(t){n(s=>(s.confirmations.push(t),{confirmations:Array.from(s.confirmations)}))},removeConfirmation(){const t=e();t.confirmations.shift(),n(()=>({confirmations:Array.from(t.confirmations)}))},setModels(t=[]){const s=e();n(()=>({models:t.reduce((a,u)=>{const d=new Ux(u);let h=s.models.get(d.path)??s.models.get(d.name)??s.models.get(d.fqn);return qt(h)?h=d:h.update(u),a.set(h.name,h),a.set(h.fqn,h),a.set(h.path,h),a},new Map)}))},getNextEnvironment(){return e().environments.values().next().value??rg},isExistingEnvironment(t){const s=e();if(t.isModel)return s.environments.has(t);let a=!1;return s.environments.forEach(u=>{u.name===t&&(a=!0)}),a},setEnvironment(t){n(()=>(Xt.save({environment:t}),{environment:t}))},addLocalEnvironment(t,s=ng){n(a=>{if(Da(t))return a;const u=new Xt({name:t},Xr.Local,s);return a.environments.add(u),a.setEnvironment(u),Xt.save({environments:Array.from(a.environments)}),{environments:new Set(a.environments)}})},removeLocalEnvironment(t){n(s=>(s.environments.delete(t),Xt.save({environments:Array.from(s.environments)}),{environments:new Set(s.environments)}))},addRemoteEnvironments(t=[],s,a=[]){n(u=>{const d=Array.from(u.environments);t.forEach(I=>{let T=d.find(({name:A})=>I.name===A);qt(T)?(T=new Xt(I,Xr.Remote),d.push(T)):(T.update(I),T.setType(Xr.Remote)),u.environment.name===I.name&&u.environment.update(I),T.isInitial&&T.isDefault&&u.setEnvironment(T)}),a.forEach(I=>{const T=d.find(({name:A})=>I===A);qt(T)?d.push(new Xt({name:I},Xr.Local,void 0,!0)):T.isPinned=!0});const h=Xt.getEnvironment();let p,y,g;d.forEach(I=>{switch(I.name){case ng:p=I;break;case(h==null?void 0:h.name):y=I;break;case s:I.isDefault=!0,g=I}});const v=u.environment??y??g,S=NS(p==null?void 0:p.isInitial)?p:v;return Xt.save({environments:d,environment:S}),Xt.sort(d),{environment:S,environments:new Set(d)}})},hasRemoteEnvironments(){const t=e();return Array.from(t.environments).some(({type:s})=>s===Xr.Remote)}}));function sg({children:n,className:e}){return B.jsx("div",{className:Tr("flex justify-center items-center w-full h-full",e),children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:n})]})})}const q0=!!(window.__IS_HEADLESS__??!1),og=q0?void 0:N.lazy(()=>an(()=>import("./Header-DmcDkHFL.js"),[])),ag=q0?void 0:N.lazy(()=>an(()=>import("./Footer--bTxQCKB.js"),[]));function Xx(){const{addError:n}=hh(),e=ig(h=>h.modules),t=ig(h=>h.setModules),{refetch:s,cancel:a,isFetching:u}=kx();N.useEffect(()=>(s().then(({data:h})=>{e.update(h),t(e)}).catch(h=>n(Ut.Modules,h)),()=>{a()}),[]);const d=Nx(e);return B.jsxs(B.Fragment,{children:[sn(og)&&B.jsxs(B.Fragment,{children:[B.jsx(og,{}),B.jsx(Dy,{})]}),B.jsx("main",{className:"h-full overflow-hidden relative",children:u?B.jsx(sg,{className:"absolute w-full h-full bg-theme z-10",children:"Building Modules..."}):B.jsx(N.Suspense,{fallback:B.jsx(sg,{children:"Loading Page..."}),children:nc(e.list)?B.jsx(ab,{router:d}):B.jsx(pn,{description:"No Modules Found"})})}),sn(ag)&&B.jsxs(B.Fragment,{children:[B.jsx(Dy,{}),B.jsx(ag,{})]})]})}const Zx=new s_({queryCache:new bg({onError(n,e){e.meta.onError(n)},onSuccess(n,e){e.meta.onSuccess()}}),defaultOptions:{queries:{networkMode:"always",refetchOnWindowFocus:!1,retry:!1,staleTime:1/0}}});QS.createRoot(eD()).render(B.jsx(Do.StrictMode,{children:B.jsx(p_,{client:Zx,children:B.jsx(US,{children:B.jsx(Lx,{children:B.jsx(Xx,{})})})})}));function eD(){const n="root";let e=document.getElementById(n);if(sn(e))return e;const t=document.body,s=t.children[0];return e=document.createElement("div"),e.id=n,e.className="h-full w-full flex flex-col justify-start",s instanceof HTMLElement?t.insertBefore(e,s):t.appendChild(e),e}export{jD as $,WD as A,ID as B,LD as C,rD as D,no as E,cg as F,Ut as G,Yg as H,Dy as I,Da as J,ND as K,ro as L,Xt as M,wD as N,vD as O,dD as P,uD as Q,Do as R,ms as S,bb as T,gD as U,pn as V,mD as W,sD as X,Gg as Y,bD as Z,an as _,ig as a,W0 as a0,Gx as a1,tc as a2,ug as a3,$D as a4,lD as a5,ZD as a6,tC as a7,sg as a8,pD as a9,fg as aA,ff as aB,_D as aC,HD as aD,iD as aa,LS as ab,Eg as ac,c_ as ad,ED as ae,Cy as af,xD as ag,kD as ah,px as ai,BD as aj,UD as ak,eC as al,XD as am,cx as an,nD as ao,zx as ap,Qx as aq,hD as ar,SD as as,Bf as at,QD as au,nC as av,fD as aw,oD as ax,qD as ay,cu as az,Ui as b,Tr as c,hh as d,rt as e,PS as f,NS as g,nc as h,sn as i,B as j,KD as k,GD as l,Rt as m,it as n,aD as o,JD as p,YD as q,N as r,cD as s,R1 as t,yD as u,VD as v,qt as w,z0 as x,$a as y,zD as z};
90
+ */var Jy;function Vx(){if(Jy)return df;Jy=1;var n=Ua(),e=xg();function t(y,g){return y===g&&(y!==0||1/y===1/g)||y!==y&&g!==g}var s=typeof Object.is=="function"?Object.is:t,a=e.useSyncExternalStore,u=n.useRef,d=n.useEffect,h=n.useMemo,p=n.useDebugValue;return df.useSyncExternalStoreWithSelector=function(y,g,v,S,I){var T=u(null);if(T.current===null){var A={hasValue:!1,value:null};T.current=A}else A=T.current;T=h(function(){function K(Z){if(!W){if(W=!0,Y=Z,Z=S(Z),I!==void 0&&A.hasValue){var x=A.value;if(I(x,Z))return q=x}return q=Z}if(x=q,s(Y,Z))return x;var V=S(Z);return I!==void 0&&I(x,V)?(Y=Z,x):(Y=Z,q=V)}var W=!1,Y,q,ce=v===void 0?null:v;return[function(){return K(g())},ce===null?void 0:function(){return K(ce())}]},[g,v,S,I]);var M=a(y,T[0],T[1]);return d(function(){A.hasValue=!0,A.value=M},[M]),p(M),M},df}var Xy;function $x(){return Xy||(Xy=1,cf.exports=Vx()),cf.exports}var Wx=$x();const Qx=tc(Wx),Q0={},{useDebugValue:Hx}=Do,{useSyncExternalStoreWithSelector:qx}=Qx;let Zy=!1;const Kx=n=>n;function Yx(n,e=Kx,t){(Q0?"production":void 0)!=="production"&&t&&!Zy&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Zy=!0);const s=qx(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return Hx(s),s}const eg=n=>{(Q0?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?zx(n):n,t=(s,a)=>Yx(e,s,a);return Object.assign(t,e),t},Gx=n=>n?eg(n):eg,ba={Empty:"",Prod:"prod"},Xr={Local:"local",Remote:"remote"},[tg,Jx]=fg("profile");class Xt{constructor(e,t,s=ba.Prod,a=!1,u=!1){wt(this,"_initial");wt(this,"_type");wt(this,"_createFrom");wt(this,"_isPinned",!1);wt(this,"_isDefault",!1);wt(this,"isModel",!0);this._initial=e,this._type=t??Xr.Local,this._createFrom=this._isDefault?ba.Empty:s,this._isPinned=a,this._isDefault=u}get id(){return this._initial.plan_id??""}get name(){return this._initial.name??ba.Empty}get type(){return this._type}get createFrom(){return this._createFrom}get isProd(){return this.name===ba.Prod}get isDefault(){return this._isDefault}set isDefault(e){this._isDefault=e}get isPinned(){return this._isPinned||this.isDefault||this.isProd}set isPinned(e){this._isPinned=e}get isInitial(){var e;return Da((e=this._initial)==null?void 0:e.plan_id)}get isLocal(){return this._type===Xr.Local}get isRemote(){return this._type===Xr.Remote}get isSyncronized(){return this.isRemote&&Ui(this.isInitial)}get isInitialProd(){return this.isInitial&&this.isProd}setType(e){this._type=e}setCreatedFrom(e){this._createFrom=e}update(e){this._initial=e}static save({environment:e,environments:t}){const s={};sn(e)&&(s.environment={name:e.name,plan_id:e.id,type:e.type,createFrom:e.createFrom,isPinned:e.isPinned,isDefault:e.isDefault}),sn(t)&&(s.environments=Xt.getOnlyLocal(t).map(a=>({name:a.name,plan_id:a.id,type:a.type,createFrom:a.createFrom,isPinned:a.isPinned,isDefault:a.isDefault}))),Jx(s)}static getOnlyLocal(e=[]){return e.filter(t=>Ui(Da(t.name))&&t.isLocal)}static getOnlyRemote(e=[]){return e.filter(t=>Ui(Da(t.name))&&t.isRemote)}static getEnvironment(){const{environment:e}=tg()??{};if(qt(e))return;const{name:t,plan_id:s,type:a,createFrom:u,isPinned:d,isDefault:h}=e;return new Xt({name:t,plan_id:s},a,u,d,h)}static getEnvironments(){const e=tg(),t=new Map;sn(e)&&sn(e.environment)&&t.set(e.environment.name,e.environment),sn(e)&&sn(e.environments)&&e.environments.forEach(a=>t.set(a.name,a));const s=[];return Array.from(t.entries()).forEach(([a,u])=>{s.push(new Xt({name:a,plan_id:u.plan_id},u.type,u.createFrom,u.isPinned,u.isDefault))}),cg(s)&&s.push(new Xt({name:ba.Prod},Xr.Local)),s}static sort(e){return e.sort(t=>t.isRemote?-1:1),e}}const ng="prod",H0=new Set(Xt.getEnvironments()),rg=Xt.getEnvironment()??H0.values().next().value,ig=Gx((n,e)=>({version:void 0,modules:new Yy,splitPaneSizes:[20,80],showConfirmation:!1,confirmations:[],environment:rg,environments:H0,initialStartDate:void 0,initialEndDate:void 0,models:new Map,lastSelectedModel:void 0,setLastSelectedModel(t){n(()=>({lastSelectedModel:t}))},setModules(t){n(()=>({modules:new Yy(t.list)}))},isModel(t){return e().models.has(t)},setSplitPaneSizes(t){n(()=>({splitPaneSizes:t}))},setVersion(t){n(()=>({version:t}))},setShowConfirmation(t){n(()=>({showConfirmation:t}))},addConfirmation(t){n(s=>(s.confirmations.push(t),{confirmations:Array.from(s.confirmations)}))},removeConfirmation(){const t=e();t.confirmations.shift(),n(()=>({confirmations:Array.from(t.confirmations)}))},setModels(t=[]){const s=e();n(()=>({models:t.reduce((a,u)=>{const d=new Ux(u);let h=s.models.get(d.path)??s.models.get(d.name)??s.models.get(d.fqn);return qt(h)?h=d:h.update(u),a.set(h.name,h),a.set(h.fqn,h),a.set(h.path,h),a},new Map)}))},getNextEnvironment(){return e().environments.values().next().value??rg},isExistingEnvironment(t){const s=e();if(t.isModel)return s.environments.has(t);let a=!1;return s.environments.forEach(u=>{u.name===t&&(a=!0)}),a},setEnvironment(t){n(()=>(Xt.save({environment:t}),{environment:t}))},addLocalEnvironment(t,s=ng){n(a=>{if(Da(t))return a;const u=new Xt({name:t},Xr.Local,s);return a.environments.add(u),a.setEnvironment(u),Xt.save({environments:Array.from(a.environments)}),{environments:new Set(a.environments)}})},removeLocalEnvironment(t){n(s=>(s.environments.delete(t),Xt.save({environments:Array.from(s.environments)}),{environments:new Set(s.environments)}))},addRemoteEnvironments(t=[],s,a=[]){n(u=>{const d=Array.from(u.environments);t.forEach(I=>{let T=d.find(({name:A})=>I.name===A);qt(T)?(T=new Xt(I,Xr.Remote),d.push(T)):(T.update(I),T.setType(Xr.Remote)),u.environment.name===I.name&&u.environment.update(I),T.isInitial&&T.isDefault&&u.setEnvironment(T)}),a.forEach(I=>{const T=d.find(({name:A})=>I===A);qt(T)?d.push(new Xt({name:I},Xr.Local,void 0,!0)):T.isPinned=!0});const h=Xt.getEnvironment();let p,y,g;d.forEach(I=>{switch(I.name){case ng:p=I;break;case(h==null?void 0:h.name):y=I;break;case s:I.isDefault=!0,g=I}});const v=u.environment??y??g,S=NS(p==null?void 0:p.isInitial)?p:v;return Xt.save({environments:d,environment:S}),Xt.sort(d),{environment:S,environments:new Set(d)}})},hasRemoteEnvironments(){const t=e();return Array.from(t.environments).some(({type:s})=>s===Xr.Remote)}}));function sg({children:n,className:e}){return B.jsx("div",{className:Tr("flex justify-center items-center w-full h-full",e),children:B.jsxs(ro,{className:"inline-block",children:[B.jsx(ms,{className:"w-3 h-3 border border-neutral-10 mr-4"}),B.jsx("h3",{className:"text-md",children:n})]})})}const q0=!!(window.__IS_HEADLESS__??!1),og=q0?void 0:N.lazy(()=>an(()=>import("./Header-BVwdhMQQ.js"),[])),ag=q0?void 0:N.lazy(()=>an(()=>import("./Footer-D4ok48Gm.js"),[]));function Xx(){const{addError:n}=hh(),e=ig(h=>h.modules),t=ig(h=>h.setModules),{refetch:s,cancel:a,isFetching:u}=kx();N.useEffect(()=>(s().then(({data:h})=>{e.update(h),t(e)}).catch(h=>n(Ut.Modules,h)),()=>{a()}),[]);const d=Nx(e);return B.jsxs(B.Fragment,{children:[sn(og)&&B.jsxs(B.Fragment,{children:[B.jsx(og,{}),B.jsx(Dy,{})]}),B.jsx("main",{className:"h-full overflow-hidden relative",children:u?B.jsx(sg,{className:"absolute w-full h-full bg-theme z-10",children:"Building Modules..."}):B.jsx(N.Suspense,{fallback:B.jsx(sg,{children:"Loading Page..."}),children:nc(e.list)?B.jsx(ab,{router:d}):B.jsx(pn,{description:"No Modules Found"})})}),sn(ag)&&B.jsxs(B.Fragment,{children:[B.jsx(Dy,{}),B.jsx(ag,{})]})]})}const Zx=new s_({queryCache:new bg({onError(n,e){e.meta.onError(n)},onSuccess(n,e){e.meta.onSuccess()}}),defaultOptions:{queries:{networkMode:"always",refetchOnWindowFocus:!1,retry:!1,staleTime:1/0}}});QS.createRoot(eD()).render(B.jsx(Do.StrictMode,{children:B.jsx(p_,{client:Zx,children:B.jsx(US,{children:B.jsx(Lx,{children:B.jsx(Xx,{})})})})}));function eD(){const n="root";let e=document.getElementById(n);if(sn(e))return e;const t=document.body,s=t.children[0];return e=document.createElement("div"),e.id=n,e.className="h-full w-full flex flex-col justify-start",s instanceof HTMLElement?t.insertBefore(e,s):t.appendChild(e),e}export{jD as $,WD as A,ID as B,LD as C,rD as D,no as E,cg as F,Ut as G,Yg as H,Dy as I,Da as J,ND as K,ro as L,Xt as M,wD as N,vD as O,dD as P,uD as Q,Do as R,ms as S,bb as T,gD as U,pn as V,mD as W,sD as X,Gg as Y,bD as Z,an as _,ig as a,W0 as a0,Gx as a1,tc as a2,ug as a3,$D as a4,lD as a5,ZD as a6,tC as a7,sg as a8,pD as a9,fg as aA,ff as aB,_D as aC,HD as aD,iD as aa,LS as ab,Eg as ac,c_ as ad,ED as ae,Cy as af,xD as ag,kD as ah,px as ai,BD as aj,UD as ak,eC as al,XD as am,cx as an,nD as ao,zx as ap,Qx as aq,hD as ar,SD as as,Bf as at,QD as au,nC as av,fD as aw,oD as ax,qD as ay,cu as az,Ui as b,Tr as c,hh as d,rt as e,PS as f,NS as g,nc as h,sn as i,B as j,KD as k,GD as l,Rt as m,it as n,aD as o,JD as p,YD as q,N as r,cD as s,R1 as t,yD as u,VD as v,qt as w,z0 as x,$a as y,zD as z};