diff --git a/assets/Basic-CaUhNBQ_.js b/assets/Basic-BGRWPjtG.js
similarity index 83%
rename from assets/Basic-CaUhNBQ_.js
rename to assets/Basic-BGRWPjtG.js
index 835c32d83e3a6a1b05279e1544cfd6ba4447e30b..36e4a0c8e0d8a681065f47c63052ca2e879e5164 100644
--- a/assets/Basic-CaUhNBQ_.js
+++ b/assets/Basic-BGRWPjtG.js
@@ -1 +1 @@
-import{createElementBlock as e,defineComponent as t,mergeModels as n,normalizeStyle as r,openBlock as i,ref as a,useModel as o,vModelText as s,watch as c,withDirectives as l}from"./index-Cf-fA00n.js";var u=t({__name:`Basic`,props:{modelValue:{default:``},modelModifiers:{}},emits:n([`submit`],[`update:modelValue`]),setup(t,{emit:n}){let u=n,d=o(t,`modelValue`),f=a(),p=a(`auto`);function m(e){e.code===`Enter`&&!e.shiftKey&&(e.preventDefault(),u(`submit`,d.value))}return c(d,()=>{p.value=`auto`,requestAnimationFrame(()=>{f.value&&(p.value=`${f.value.scrollHeight}px`)})},{immediate:!0}),(t,n)=>l((i(),e(`textarea`,{ref_key:`textareaRef`,ref:f,"onUpdate:modelValue":n[0]||=e=>d.value=e,style:r({height:p.value}),onKeydown:m},null,36)),[[s,d.value]])}}),d=u;export{d as Basic_default};
\ No newline at end of file
+import{createElementBlock as e,defineComponent as t,mergeModels as n,normalizeStyle as r,openBlock as i,ref as a,useModel as o,vModelText as s,watch as c,withDirectives as l}from"./index-BSwg6FIo.js";var u=t({__name:`Basic`,props:{modelValue:{default:``},modelModifiers:{}},emits:n([`submit`],[`update:modelValue`]),setup(t,{emit:n}){let u=n,d=o(t,`modelValue`),f=a(),p=a(`auto`);function m(e){e.code===`Enter`&&!e.shiftKey&&(e.preventDefault(),u(`submit`,d.value))}return c(d,()=>{p.value=`auto`,requestAnimationFrame(()=>{f.value&&(p.value=`${f.value.scrollHeight}px`)})},{immediate:!0}),(t,n)=>l((i(),e(`textarea`,{ref_key:`textareaRef`,ref:f,"onUpdate:modelValue":n[0]||=e=>d.value=e,style:r({height:p.value}),onKeydown:m},null,36)),[[s,d.value]])}}),d=u;export{d as Basic_default};
\ No newline at end of file
diff --git a/assets/Button-DMzywyj7.js b/assets/Button-AEge-Qyg.js
similarity index 98%
rename from assets/Button-DMzywyj7.js
rename to assets/Button-AEge-Qyg.js
index 7be52add4189e0c02c75a0cc2e65fc9dfedda566..3fb3dbade959475ada3e347427c16db638986909 100644
--- a/assets/Button-DMzywyj7.js
+++ b/assets/Button-AEge-Qyg.js
@@ -1 +1 @@
-import{Transition as e,__plugin_vue_export_helper_default as t,computed as n,createBaseVNode as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createTextVNode as s,createVNode as c,defineComponent as l,guardReactiveProps as u,mergeModels as d,mergeProps as f,normalizeClass as p,normalizeProps as m,openBlock as h,renderSlot as g,toDisplayString as _,unref as v,useModel as y,watchEffect as b,withCtx as x}from"./index-Cf-fA00n.js";var S=l({__name:`BidirectionalTransition`,props:{fromClass:null,activeClass:null,toClass:null},setup(t){return(n,r)=>(h(),i(e,{"enter-from-class":t.fromClass,"enter-active-class":t.activeClass,"enter-to-class":t.toClass,"leave-from-class":t.toClass,"leave-active-class":t.activeClass,"leave-to-class":t.fromClass},{default:x(()=>[g(n.$slots,`default`)]),_:3},8,[`enter-from-class`,`enter-active-class`,`enter-to-class`,`leave-from-class`,`leave-active-class`,`leave-to-class`]))}}),C=S;const w=`0px`;var T=l({__name:`TransitionVertical`,props:{duration:{default:250},easingEnter:{default:`ease-in-out`},easingLeave:{default:`ease-in-out`},opacityClosed:{default:0},opacityOpened:{default:1}},setup(t){let n=t;function r(e){return{height:e.style.height,width:e.style.width,position:e.style.position,visibility:e.style.visibility,overflow:e.style.overflow,paddingTop:e.style.paddingTop,paddingBottom:e.style.paddingBottom,borderTopWidth:e.style.borderTopWidth,borderBottomWidth:e.style.borderBottomWidth,marginTop:e.style.marginTop,marginBottom:e.style.marginBottom}}function a(e,t){let{width:n}=getComputedStyle(e);e.style.width=n,e.style.position=`absolute`,e.style.visibility=`hidden`,e.style.height=``;let{height:r}=getComputedStyle(e);return e.style.width=t.width,e.style.position=t.position,e.style.visibility=t.visibility,e.style.height=w,e.style.overflow=`hidden`,t.height&&t.height!==w?t.height:r}function o(e,t,n,r,i){let a=e.animate(r,i);e.style.height=t.height,a.onfinish=()=>{e.style.overflow=t.overflow,n()}}function s(e,t){return[{height:w,opacity:n.opacityClosed,paddingTop:w,paddingBottom:w,borderTopWidth:w,borderBottomWidth:w,marginTop:w,marginBottom:w},{height:e,opacity:n.opacityOpened,paddingTop:t.paddingTop,paddingBottom:t.paddingBottom,borderTopWidth:t.borderTopWidth,borderBottomWidth:t.borderBottomWidth,marginTop:t.marginTop,marginBottom:t.marginBottom}]}function c(e,t){let i=e,c=r(i),l=a(i,c),u=s(l,c),d={duration:n.duration,easing:n.easingEnter};o(i,c,t,u,d)}function l(e,t){let i=e,a=r(i),{height:c}=getComputedStyle(i);i.style.height=c,i.style.overflow=`hidden`;let l=s(c,a).reverse(),u={duration:n.duration,easing:n.easingLeave};o(i,a,t,l,u)}return(t,n)=>(h(),i(e,{css:!1,onEnter:c,onLeave:l},{default:x(()=>[g(t.$slots,`default`)]),_:3}))}}),E=T;const D={op50:``};var O=l({__name:`Collapsable`,props:d({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=y(e,`modelValue`);b(()=>{t.default!=null&&(n.value=!!t.default)});function i(e){return n.value=e,e}return(e,l)=>(h(),o(`div`,null,[g(e.$slots,`trigger`,m(u({visible:n.value,setVisible:i})),()=>[r(`button`,{sticky:``,"top-0":``,"z-10":``,flex:``,"items-center":``,"justify-between":``,px2:``,py1:``,"text-sm":``,"backdrop-blur-xl":``,onClick:l[0]||=e=>n.value=!n.value},[r(`span`,null,_(t.label??`Collapsable`),1),l[1]||=s(),r(`span`,D,_(n.value?`▲`:`▼`),1)])]),c(v(E),null,{default:x(()=>[n.value?g(e.$slots,`default`,m(f({key:0},{visible:n.value,setVisible:i}))):a(``,!0)]),_:3})]))}}),k=O,A=l({__name:`Skeleton`,props:{animation:{default:`pulse`}},setup(e){let t=e;return(e,n)=>(h(),o(`div`,{class:p([`skeleton`,t.animation===`none`?``:`skeleton-${t.animation}`]),bg:`neutral-200 dark:neutral-800`,overflow:`hidden`},[g(e.$slots,`default`,{},void 0,!0)],2))}}),j=t(A,[[`__scopeId`,`data-v-f404da2a`]]);const M=[`disabled`],N={class:`flex flex-row items-center justify-center`},P={key:0,class:`mr-2 w-4`},F={key:0,class:`i-svg-spinners:ring-resize h-4 w-4`},I={key:0};var L=l({__name:`Button`,props:{icon:null,label:null,disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},variant:{default:`primary`},size:{default:`md`},block:{type:Boolean,default:!1}},setup(e){let t=e,i=n(()=>t.disabled||t.loading),s={primary:`bg-primary-500 hover:bg-primary-600 dark:bg-primary-400 dark:hover:bg-primary-500 focus:ring-primary-500/50 dark:focus:ring-primary-400/50 text-white`,secondary:`bg-neutral-100 hover:bg-neutral-200 dark:bg-neutral-600 dark:hover:bg-neutral-500 focus:ring-neutral-300/50 dark:focus:ring-neutral-600/50 text-neutral-900 dark:text-neutral-100`,danger:`bg-red-500 hover:bg-red-600 dark:bg-red-400 dark:hover:bg-red-500 focus:ring-red-600/50 dark:focus:ring-red-500/50 text-white`},l={sm:`px-3 py-1.5 text-xs`,md:`px-4 py-2 text-sm`,lg:`px-6 py-3 text-base`},u=n(()=>[`rounded-lg font-medium outline-none transition-all duration-200 ease-in-out`,`disabled:cursor-not-allowed disabled:opacity-50`,t.block?`w-full`:``,l[t.size],s[t.variant],{"opacity-50 cursor-not-allowed":i.value},`focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-neutral-900`]);return(t,n)=>(h(),o(`button`,{disabled:i.value,class:p(u.value)},[r(`div`,N,[c(v(C),{"from-class":`opacity-0 mr-0! w-0!`,"active-class":`transition-[width,margin] ease-in-out overflow-hidden`},{default:x(()=>[e.loading||e.icon?(h(),o(`div`,P,[e.loading?(h(),o(`div`,F)):e.icon?(h(),o(`div`,{key:1,class:p([`h-4 w-4`,e.icon])},null,2)):a(``,!0)])):a(``,!0)]),_:1}),e.label?(h(),o(`span`,I,_(e.label),1)):g(t.$slots,`default`,{key:1})])],10,M))}}),R=L;export{R as Button_default,k as Collapsable_default,j as Skeleton_default,E as TransitionVertical_default};
\ No newline at end of file
+import{Transition as e,__plugin_vue_export_helper_default as t,computed as n,createBaseVNode as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createTextVNode as s,createVNode as c,defineComponent as l,guardReactiveProps as u,mergeModels as d,mergeProps as f,normalizeClass as p,normalizeProps as m,openBlock as h,renderSlot as g,toDisplayString as _,unref as v,useModel as y,watchEffect as b,withCtx as x}from"./index-BSwg6FIo.js";var S=l({__name:`BidirectionalTransition`,props:{fromClass:null,activeClass:null,toClass:null},setup(t){return(n,r)=>(h(),i(e,{"enter-from-class":t.fromClass,"enter-active-class":t.activeClass,"enter-to-class":t.toClass,"leave-from-class":t.toClass,"leave-active-class":t.activeClass,"leave-to-class":t.fromClass},{default:x(()=>[g(n.$slots,`default`)]),_:3},8,[`enter-from-class`,`enter-active-class`,`enter-to-class`,`leave-from-class`,`leave-active-class`,`leave-to-class`]))}}),C=S;const w=`0px`;var T=l({__name:`TransitionVertical`,props:{duration:{default:250},easingEnter:{default:`ease-in-out`},easingLeave:{default:`ease-in-out`},opacityClosed:{default:0},opacityOpened:{default:1}},setup(t){let n=t;function r(e){return{height:e.style.height,width:e.style.width,position:e.style.position,visibility:e.style.visibility,overflow:e.style.overflow,paddingTop:e.style.paddingTop,paddingBottom:e.style.paddingBottom,borderTopWidth:e.style.borderTopWidth,borderBottomWidth:e.style.borderBottomWidth,marginTop:e.style.marginTop,marginBottom:e.style.marginBottom}}function a(e,t){let{width:n}=getComputedStyle(e);e.style.width=n,e.style.position=`absolute`,e.style.visibility=`hidden`,e.style.height=``;let{height:r}=getComputedStyle(e);return e.style.width=t.width,e.style.position=t.position,e.style.visibility=t.visibility,e.style.height=w,e.style.overflow=`hidden`,t.height&&t.height!==w?t.height:r}function o(e,t,n,r,i){let a=e.animate(r,i);e.style.height=t.height,a.onfinish=()=>{e.style.overflow=t.overflow,n()}}function s(e,t){return[{height:w,opacity:n.opacityClosed,paddingTop:w,paddingBottom:w,borderTopWidth:w,borderBottomWidth:w,marginTop:w,marginBottom:w},{height:e,opacity:n.opacityOpened,paddingTop:t.paddingTop,paddingBottom:t.paddingBottom,borderTopWidth:t.borderTopWidth,borderBottomWidth:t.borderBottomWidth,marginTop:t.marginTop,marginBottom:t.marginBottom}]}function c(e,t){let i=e,c=r(i),l=a(i,c),u=s(l,c),d={duration:n.duration,easing:n.easingEnter};o(i,c,t,u,d)}function l(e,t){let i=e,a=r(i),{height:c}=getComputedStyle(i);i.style.height=c,i.style.overflow=`hidden`;let l=s(c,a).reverse(),u={duration:n.duration,easing:n.easingLeave};o(i,a,t,l,u)}return(t,n)=>(h(),i(e,{css:!1,onEnter:c,onLeave:l},{default:x(()=>[g(t.$slots,`default`)]),_:3}))}}),E=T;const D={op50:``};var O=l({__name:`Collapsable`,props:d({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=y(e,`modelValue`);b(()=>{t.default!=null&&(n.value=!!t.default)});function i(e){return n.value=e,e}return(e,l)=>(h(),o(`div`,null,[g(e.$slots,`trigger`,m(u({visible:n.value,setVisible:i})),()=>[r(`button`,{sticky:``,"top-0":``,"z-10":``,flex:``,"items-center":``,"justify-between":``,px2:``,py1:``,"text-sm":``,"backdrop-blur-xl":``,onClick:l[0]||=e=>n.value=!n.value},[r(`span`,null,_(t.label??`Collapsable`),1),l[1]||=s(),r(`span`,D,_(n.value?`▲`:`▼`),1)])]),c(v(E),null,{default:x(()=>[n.value?g(e.$slots,`default`,m(f({key:0},{visible:n.value,setVisible:i}))):a(``,!0)]),_:3})]))}}),k=O,A=l({__name:`Skeleton`,props:{animation:{default:`pulse`}},setup(e){let t=e;return(e,n)=>(h(),o(`div`,{class:p([`skeleton`,t.animation===`none`?``:`skeleton-${t.animation}`]),bg:`neutral-200 dark:neutral-800`,overflow:`hidden`},[g(e.$slots,`default`,{},void 0,!0)],2))}}),j=t(A,[[`__scopeId`,`data-v-f404da2a`]]);const M=[`disabled`],N={class:`flex flex-row items-center justify-center`},P={key:0,class:`mr-2 w-4`},F={key:0,class:`i-svg-spinners:ring-resize h-4 w-4`},I={key:0};var L=l({__name:`Button`,props:{icon:null,label:null,disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},variant:{default:`primary`},size:{default:`md`},block:{type:Boolean,default:!1}},setup(e){let t=e,i=n(()=>t.disabled||t.loading),s={primary:`bg-primary-500 hover:bg-primary-600 dark:bg-primary-400 dark:hover:bg-primary-500 focus:ring-primary-500/50 dark:focus:ring-primary-400/50 text-white`,secondary:`bg-neutral-100 hover:bg-neutral-200 dark:bg-neutral-600 dark:hover:bg-neutral-500 focus:ring-neutral-300/50 dark:focus:ring-neutral-600/50 text-neutral-900 dark:text-neutral-100`,danger:`bg-red-500 hover:bg-red-600 dark:bg-red-400 dark:hover:bg-red-500 focus:ring-red-600/50 dark:focus:ring-red-500/50 text-white`},l={sm:`px-3 py-1.5 text-xs`,md:`px-4 py-2 text-sm`,lg:`px-6 py-3 text-base`},u=n(()=>[`rounded-lg font-medium outline-none transition-all duration-200 ease-in-out`,`disabled:cursor-not-allowed disabled:opacity-50`,t.block?`w-full`:``,l[t.size],s[t.variant],{"opacity-50 cursor-not-allowed":i.value},`focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-neutral-900`]);return(t,n)=>(h(),o(`button`,{disabled:i.value,class:p(u.value)},[r(`div`,N,[c(v(C),{"from-class":`opacity-0 mr-0! w-0!`,"active-class":`transition-[width,margin] ease-in-out overflow-hidden`},{default:x(()=>[e.loading||e.icon?(h(),o(`div`,P,[e.loading?(h(),o(`div`,F)):e.icon?(h(),o(`div`,{key:1,class:p([`h-4 w-4`,e.icon])},null,2)):a(``,!0)])):a(``,!0)]),_:1}),e.label?(h(),o(`span`,I,_(e.label),1)):g(t.$slots,`default`,{key:1})])],10,M))}}),R=L;export{R as Button_default,k as Collapsable_default,j as Skeleton_default,E as TransitionVertical_default};
\ No newline at end of file
diff --git a/assets/CardCreate-93Vgljnn.js b/assets/CardCreate-93Vgljnn.js
new file mode 100644
index 0000000000000000000000000000000000000000..9e7b167ca4c01b70fe812a4653af6c5a4a7b2ed6
--- /dev/null
+++ b/assets/CardCreate-93Vgljnn.js
@@ -0,0 +1 @@
+import{CardCreate_default as e}from"./CardCreate-D42uwy43.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardCreate-Cgti9SIY.js b/assets/CardCreate-Cgti9SIY.js
deleted file mode 100644
index 89c284f0f38758b1146a9137bde56da820a8a698..0000000000000000000000000000000000000000
--- a/assets/CardCreate-Cgti9SIY.js
+++ /dev/null
@@ -1 +0,0 @@
-import{CardCreate_default as e}from"./CardCreate-C3flmtgV.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardCreate-C3flmtgV.js b/assets/CardCreate-D42uwy43.js
similarity index 93%
rename from assets/CardCreate-C3flmtgV.js
rename to assets/CardCreate-D42uwy43.js
index c2895932a7cb8e728e1d3b00f255950bbe30f46d..eeaebae1b10ad3b744a48e3d5070213a3bf2edfd 100644
--- a/assets/CardCreate-C3flmtgV.js
+++ b/assets/CardCreate-D42uwy43.js
@@ -1 +1 @@
-import{createBaseVNode as e,createElementBlock as t,defineComponent as n,openBlock as r,toDisplayString as i,unref as a,useI18n as o}from"./index-Cf-fA00n.js";const s={relative:``,class:`min-h-[120px] flex flex-col cursor-pointer items-center justify-center border-neutral-200 rounded-xl bg-white/60 p-6 dark:border-neutral-700 hover:border-primary-300 dark:bg-black/30 hover:bg-white/80 dark:hover:border-primary-700 dark:hover:bg-black/40`,border:`solid 2`,transition:`all duration-300`,"cursor-pointer":``,"opacity-95":``,hover:`scale-100 opacity-100 shadow-md dark:shadow-lg`},c={"font-medium":``,text:`neutral-600 dark:neutral-300`};var l=n({__name:`CardCreate`,setup(n){let{t:l}=o();return(n,o)=>(r(),t(`div`,s,[o[0]||=e(`div`,{"i-solar:add-square-line-duotone":``,"mb-4":``,"text-5xl":``,text:`neutral-400 dark:neutral-500`},null,-1),e(`p`,c,i(a(l)(`settings.pages.card.create_card`)),1)]))}}),u=l;export{u as CardCreate_default};
\ No newline at end of file
+import{createBaseVNode as e,createElementBlock as t,defineComponent as n,openBlock as r,toDisplayString as i,unref as a,useI18n as o}from"./index-BSwg6FIo.js";const s={relative:``,class:`min-h-[120px] flex flex-col cursor-pointer items-center justify-center border-neutral-200 rounded-xl bg-white/60 p-6 dark:border-neutral-700 hover:border-primary-300 dark:bg-black/30 hover:bg-white/80 dark:hover:border-primary-700 dark:hover:bg-black/40`,border:`solid 2`,transition:`all duration-300`,"cursor-pointer":``,"opacity-95":``,hover:`scale-100 opacity-100 shadow-md dark:shadow-lg`},c={"font-medium":``,text:`neutral-600 dark:neutral-300`};var l=n({__name:`CardCreate`,setup(n){let{t:l}=o();return(n,o)=>(r(),t(`div`,s,[o[0]||=e(`div`,{"i-solar:add-square-line-duotone":``,"mb-4":``,"text-5xl":``,text:`neutral-400 dark:neutral-500`},null,-1),e(`p`,c,i(a(l)(`settings.pages.card.create_card`)),1)]))}}),u=l;export{u as CardCreate_default};
\ No newline at end of file
diff --git a/assets/CardCreationDialog-lFLHJBD8.js b/assets/CardCreationDialog-BsyNmiYp.js
similarity index 96%
rename from assets/CardCreationDialog-lFLHJBD8.js
rename to assets/CardCreationDialog-BsyNmiYp.js
index caebf02f7cd728fe13c10d3a65561727626e125e..f4d922b5ac9eee07fe78719fe851d45db34db3a0 100644
--- a/assets/CardCreationDialog-lFLHJBD8.js
+++ b/assets/CardCreationDialog-BsyNmiYp.js
@@ -1,3 +1,3 @@
-import{Fragment as e,__commonJSMin as t,__plugin_vue_export_helper_default as n,__toESM as r,computed as i,createBaseVNode as a,createBlock as o,createCommentVNode as s,createElementBlock as c,createTextVNode as l,createVNode as u,defineComponent as d,isRef as f,mergeModels as p,normalizeClass as m,openBlock as h,ref as g,renderList as ee,toDisplayString as _,toRaw as te,unref as v,useI18n as y,useModel as b,withCtx as x}from"./index-Cf-fA00n.js";import{useAiriCardStore as ne}from"./stores-aCC6ZHpf.js";import{Button_default as S}from"./Button-DMzywyj7.js";import{FieldInput_default as C,FieldValues_default as re}from"./src-BdFbE9Gc.js";import{$u as w,Bu as T,Iv as ie,Pu as ae,nu as oe}from"./dist-DbabDsG-.js";var E=t((exports,t)=>{function n(e){return e.toLowerCase()}t.exports=n}),D=t((exports,t)=>{var n=E();t.exports=n}),O=t((exports,t)=>{function n(e,t,n){return e.replace(t,n)}t.exports=n}),k=t((exports,t)=>{var n=O();t.exports=n}),A=t((exports,t)=>{var n=String.prototype.trim!==void 0;t.exports=n}),j=t((exports,t)=>{var n=String.prototype.trim;t.exports=n}),M=t((exports,t)=>{var n=j(),r=`
+import{Fragment as e,__commonJSMin as t,__plugin_vue_export_helper_default as n,__toESM as r,computed as i,createBaseVNode as a,createBlock as o,createCommentVNode as s,createElementBlock as c,createTextVNode as l,createVNode as u,defineComponent as d,isRef as f,mergeModels as p,normalizeClass as m,openBlock as h,ref as g,renderList as ee,toDisplayString as _,toRaw as te,unref as v,useI18n as y,useModel as b,withCtx as x}from"./index-BSwg6FIo.js";import{useAiriCardStore as ne}from"./stores-BzkLfyIH.js";import{Button_default as S}from"./Button-AEge-Qyg.js";import{FieldInput_default as C,FieldValues_default as re}from"./src-CX9nVT7I.js";import{$u as w,Bu as T,Iv as ie,Pu as ae,nu as oe}from"./dist-BziUufTI.js";var E=t((exports,t)=>{function n(e){return e.toLowerCase()}t.exports=n}),D=t((exports,t)=>{var n=E();t.exports=n}),O=t((exports,t)=>{function n(e,t,n){return e.replace(t,n)}t.exports=n}),k=t((exports,t)=>{var n=O();t.exports=n}),A=t((exports,t)=>{var n=String.prototype.trim!==void 0;t.exports=n}),j=t((exports,t)=>{var n=String.prototype.trim;t.exports=n}),M=t((exports,t)=>{var n=j(),r=`
\r
\f\v \u2028\u2029 `,i=``;function a(){return n.call(r)===``&&n.call(i)===i}t.exports=a}),N=t((exports,t)=>{var n=k(),r=/^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*([\S\s]*?)[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*$/;function i(e){return n(e,r,`$1`)}t.exports=i}),P=t((exports,t)=>{var n=j();function r(e){return n.call(e)}t.exports=r}),F=t((exports,t)=>{var n=A(),r=M(),i=N(),a=P(),o;o=n&&r()?a:i,t.exports=o}),I=t((exports,t)=>{var n=D(),r=k(),i=F(),a=/\s+/g,o=/[!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,s=/([a-z0-9])([A-Z])/g;function c(e){return e=r(e,o,` `),e=r(e,s,`$1 $2`),e=i(e),e=r(e,a,`-`),n(e)}t.exports=c}),L=t((exports,t)=>{var n=I();t.exports=n}),R=r(L());const z={class:`w-full flex flex-col gap-5`},B={class:`mt-4`},V={class:`border-b border-neutral-200 dark:border-neutral-700`},H={class:`flex justify-center -mb-px sm:justify-start space-x-1`},U=[`onClick`],W={class:`flex items-center gap-1`},G={key:0,class:`w-full rounded-xl bg-red900`},K={class:`w-full p-4`},se={key:1,class:`tab-content ml-auto mr-auto w-95%`},ce={class:`mb-3`},le={class:`input-list ml-auto mr-auto w-90% flex flex-row flex-wrap justify-center gap-8`},ue={key:2,class:`tab-content ml-auto mr-auto w-95%`},de={class:`input-list ml-auto mr-auto w-90% flex flex-row flex-wrap justify-center gap-8`},fe={key:3,class:`tab-content ml-auto mr-auto w-95%`},pe={class:`input-list ml-auto mr-auto w-90% flex flex-row flex-wrap justify-center gap-8`},me={class:`ml-auto mr-1 flex flex-row gap-2`};var q=d({__name:`CardCreationDialog`,props:p({modelValue:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:p([`update:modelValue`],[`update:modelValue`]),setup(t,{emit:n}){let r=n,d=b(t,`modelValue`),{t:p}=y(),E=ne(),D=g(``),O=[{id:`identity`,label:p(`settings.pages.card.creation.identity`),icon:`i-solar:emoji-funny-square-bold-duotone`},{id:`behavior`,label:p(`settings.pages.card.creation.behavior`),icon:`i-solar:chat-round-line-bold-duotone`},{id:`settings`,label:p(`settings.pages.card.creation.settings`),icon:`i-solar:settings-bold-duotone`}],k=i({get:()=>{var e;return O.find(e=>e.id===D.value)?D.value:(e=O[0])?.id||``},set:e=>{D.value=e}}),A=g(!1),j=g(``);function M(e){let t=te(e);if(t.name.length>0)if(/^(?:\d+\.)+\d+$/.test(t.version))if(t.description.length>0)if(t.personality.length>0)if(t.scenario.length>0)if(t.systemPrompt.length>0){if(!(t.postHistoryInstructions.length>0))return A.value=!0,j.value=p(`settings.pages.card.creation.errors.posthistoryinstructions`),!1}else return A.value=!0,j.value=p(`settings.pages.card.creation.errors.systemprompt`),!1;else return A.value=!0,j.value=p(`settings.pages.card.creation.errors.scenario`),!1;else return A.value=!0,j.value=p(`settings.pages.card.creation.errors.personality`),!1;else return A.value=!0,j.value=p(`settings.pages.card.creation.errors.description`),!1;else return A.value=!0,j.value=p(`settings.pages.card.creation.errors.version`),!1;else return A.value=!0,j.value=p(`settings.pages.card.creation.errors.name`),!1;return A.value=!1,E.addCard(t),d.value=!1,!0}let N=g({name:p(`settings.pages.card.creation.defaults.name`),nickname:void 0,version:`1.0`,description:``,notes:void 0,personality:p(`settings.pages.card.creation.defaults.personality`),scenario:p(`settings.pages.card.creation.defaults.scenario`),systemPrompt:p(`settings.pages.card.creation.defaults.systemprompt`),postHistoryInstructions:p(`settings.pages.card.creation.defaults.posthistoryinstructions`),greetings:[],messageExample:[]});function P(e,t){return i({get:()=>N.value[e]??``,set:n=>{let r=n.trim();N.value[e]=r.length>0?t?t(r):r:``}})}let F=P(`name`,e=>(0,R.default)(e)),I=P(`nickname`),L=P(`description`),q=P(`notes`),J=P(`personality`),Y=P(`scenario`),X=i({get:()=>N.value.greetings??[],set:e=>{N.value.greetings=e||[]}}),Z=P(`version`),Q=P(`systemPrompt`),$=P(`postHistoryInstructions`);return(t,n)=>(h(),o(v(oe),{open:d.value,"onUpdate:open":n[12]||=e=>r(`update:modelValue`,e)},{default:x(()=>[u(v(ie),null,{default:x(()=>[u(v(w),{class:`data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-100 bg-black/50 backdrop-blur-sm`}),u(v(ae),{class:`data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-100 m-0 max-h-[90vh] max-w-6xl w-[92vw] flex flex-col overflow-auto border border-neutral-200 rounded-xl bg-white p-5 shadow-xl 2xl:w-[60vw] lg:w-[80vw] md:w-[85vw] xl:w-[70vw] -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800 sm:p-6`},{default:x(()=>[a(`div`,z,[u(v(T),{"text-2xl":``,"font-bold":``,class:`from-primary-500 to-primary-400 bg-gradient-to-r bg-clip-text text-transparent`},{default:x(()=>[l(_(v(p)(`settings.pages.card.create_card`)),1)]),_:1}),a(`div`,B,[a(`div`,V,[a(`div`,H,[(h(),c(e,null,ee(O,e=>a(`button`,{key:e.id,class:m([`px-4 py-2 text-sm font-medium`,[k.value===e.id?`text-primary-600 dark:text-primary-400 border-b-2 border-primary-500 dark:border-primary-400`:`text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300`]]),onClick:t=>k.value=e.id},[a(`div`,W,[a(`div`,{class:m(e.icon)},null,2),l(` `+_(e.label),1)])],10,U)),64))])])]),A.value?(h(),c(`div`,G,[a(`p`,K,_(j.value),1)])):s(``,!0),k.value===`identity`?(h(),c(`div`,se,[a(`p`,ce,_(v(p)(`settings.pages.card.creation.fields_info.subtitle`)),1),a(`div`,le,[u(v(C),{modelValue:v(F),"onUpdate:modelValue":n[0]||=e=>f(F)?F.value=e:null,label:v(p)(`settings.pages.card.creation.name`),description:v(p)(`settings.pages.card.creation.fields_info.name`),required:!0},null,8,[`modelValue`,`label`,`description`]),u(v(C),{modelValue:v(I),"onUpdate:modelValue":n[1]||=e=>f(I)?I.value=e:null,label:v(p)(`settings.pages.card.creation.nickname`),description:v(p)(`settings.pages.card.creation.fields_info.nickname`)},null,8,[`modelValue`,`label`,`description`]),u(v(C),{modelValue:v(L),"onUpdate:modelValue":n[2]||=e=>f(L)?L.value=e:null,label:v(p)(`settings.pages.card.creation.description`),"single-line":!1,required:!0,description:v(p)(`settings.pages.card.creation.fields_info.description`)},null,8,[`modelValue`,`label`,`description`]),u(v(C),{modelValue:v(q),"onUpdate:modelValue":n[3]||=e=>f(q)?q.value=e:null,label:v(p)(`settings.pages.card.creator_notes`),"single-line":!1,description:v(p)(`settings.pages.card.creation.fields_info.notes`)},null,8,[`modelValue`,`label`,`description`])])])):k.value===`behavior`?(h(),c(`div`,ue,[a(`div`,de,[u(v(C),{modelValue:v(J),"onUpdate:modelValue":n[4]||=e=>f(J)?J.value=e:null,label:v(p)(`settings.pages.card.personality`),"single-line":!1,required:!0,description:v(p)(`settings.pages.card.creation.fields_info.personality`)},null,8,[`modelValue`,`label`,`description`]),u(v(C),{modelValue:v(Y),"onUpdate:modelValue":n[5]||=e=>f(Y)?Y.value=e:null,label:v(p)(`settings.pages.card.scenario`),"single-line":!1,required:!0,description:v(p)(`settings.pages.card.creation.fields_info.scenario`)},null,8,[`modelValue`,`label`,`description`]),u(v(re),{modelValue:X.value,"onUpdate:modelValue":n[6]||=e=>X.value=e,label:v(p)(`settings.pages.card.creation.greetings`),description:v(p)(`settings.pages.card.creation.fields_info.greetings`)},null,8,[`modelValue`,`label`,`description`])])])):k.value===`settings`?(h(),c(`div`,fe,[a(`div`,pe,[u(v(C),{modelValue:v(Q),"onUpdate:modelValue":n[7]||=e=>f(Q)?Q.value=e:null,label:v(p)(`settings.pages.card.systemprompt`),"single-line":!1,required:!0,description:v(p)(`settings.pages.card.creation.fields_info.systemprompt`)},null,8,[`modelValue`,`label`,`description`]),u(v(C),{modelValue:v($),"onUpdate:modelValue":n[8]||=e=>f($)?$.value=e:null,label:v(p)(`settings.pages.card.posthistoryinstructions`),"single-line":!1,required:!0,description:v(p)(`settings.pages.card.creation.fields_info.posthistoryinstructions`)},null,8,[`modelValue`,`label`,`description`]),u(v(C),{modelValue:v(Z),"onUpdate:modelValue":n[9]||=e=>f(Z)?Z.value=e:null,label:v(p)(`settings.pages.card.creation.version`),required:!0,description:v(p)(`settings.pages.card.creation.fields_info.version`)},null,8,[`modelValue`,`label`,`description`])])])):s(``,!0),a(`div`,me,[u(v(S),{variant:`secondary`,icon:`i-solar:undo-left-bold-duotone`,label:v(p)(`settings.pages.card.cancel`),disabled:!1,onClick:n[10]||=e=>d.value=!1},null,8,[`label`]),u(v(S),{variant:`primary`,icon:`i-solar:check-circle-bold-duotone`,label:v(p)(`settings.pages.card.creation.create`),disabled:!1,onClick:n[11]||=e=>M(N.value)},null,8,[`label`])])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),J=n(q,[[`__scopeId`,`data-v-367e133d`]]);export{J as CardCreationDialog_default};
\ No newline at end of file
diff --git a/assets/CardCreationDialog-DOEDNVJJ.js b/assets/CardCreationDialog-DOEDNVJJ.js
new file mode 100644
index 0000000000000000000000000000000000000000..c8f8c87da767b29e7de4cdaaa008b393da946aa9
--- /dev/null
+++ b/assets/CardCreationDialog-DOEDNVJJ.js
@@ -0,0 +1 @@
+import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import"./dist-BziUufTI.js";import"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{CardCreationDialog_default as e}from"./CardCreationDialog-BsyNmiYp.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardCreationDialog-PJWzqydp.js b/assets/CardCreationDialog-PJWzqydp.js
deleted file mode 100644
index e94be4fad9be9f702d2d79dd35580ff4ea29de3b..0000000000000000000000000000000000000000
--- a/assets/CardCreationDialog-PJWzqydp.js
+++ /dev/null
@@ -1 +0,0 @@
-import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import"./dist-DbabDsG-.js";import"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{CardCreationDialog_default as e}from"./CardCreationDialog-lFLHJBD8.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardDetailDialog-Cggh12Lo.js b/assets/CardDetailDialog-BCybvJ8-.js
similarity index 95%
rename from assets/CardDetailDialog-Cggh12Lo.js
rename to assets/CardDetailDialog-BCybvJ8-.js
index 84657ea4d1308ad2240bcd097169550a377bd4c6..a3c7b43fc9f4a4e6317ebf3628019ca365289059 100644
--- a/assets/CardDetailDialog-Cggh12Lo.js
+++ b/assets/CardDetailDialog-BCybvJ8-.js
@@ -1 +1 @@
-import{Fragment as e,computed as t,createBaseVNode as n,createCommentVNode as r,createElementBlock as i,createTextVNode as a,createVNode as o,defineComponent as s,normalizeClass as c,openBlock as l,ref as u,renderList as d,storeToRefs as f,toDisplayString as p,unref as m,useI18n as ee,withCtx as h}from"./index-Cf-fA00n.js";import{useAiriCardStore as te}from"./stores-aCC6ZHpf.js";import{Button_default as ne}from"./Button-DMzywyj7.js";import{$u as g,Bu as _,Iv as re,Pu as ie,nu as ae}from"./dist-DbabDsG-.js";import{DeleteCardDialog_default as oe}from"./DeleteCardDialog-5OZGLqwk.js";const se={key:0,class:`w-full flex flex-col gap-5`},ce={flex:`~ col`,"gap-3":``},le={flex:`~ row`,"items-center":``,"justify-between":``},ue={flex:`~ row`,"items-center":``,"gap-2":``},de={key:0,class:`flex items-center gap-1 rounded-full bg-primary-100 px-2 py-0.5 text-xs text-primary-600 font-medium dark:bg-primary-900/40 dark:text-primary-400`},fe={"mt-1":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},pe={"font-medium":``},me={flex:`~ row`,"gap-2":``},he={class:`mt-4`},v={class:`border-b border-neutral-200 dark:border-neutral-700`},y={class:`flex justify-center -mb-px sm:justify-start space-x-1`},b=[`onClick`],x={class:`flex items-center gap-1`},S={key:0},C=[`innerHTML`],w={key:1},T=[`innerHTML`],E={key:2},D={flex:`~ col`,"max-h-60":``,"gap-4":``,"overflow-auto":``,"pr-1":``,"sm:max-h-80":``},O={key:0,flex:`~ col`,"gap-2":``},k={"text-lg":``,"text-neutral-500":``,"font-medium":``,"dark:text-neutral-400":``},A=[`innerHTML`],j={key:3},M={grid:`~ cols-1 sm:cols-3`,"gap-4":``},N={flex:`~ col`,bg:`white/60 dark:black/30`,"gap-1":``,"rounded-lg":``,"p-3":``,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`},P={flex:`~ row`,"items-center":``,"gap-2":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},F={truncate:``,"font-medium":``},I={flex:`~ col`,bg:`white/60 dark:black/30`,"gap-2":``,"rounded-lg":``,"p-3":``,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`},ge={flex:`~ row`,"items-center":``,"gap-2":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},L={truncate:``,"font-medium":``},_e={flex:`~ col`,bg:`white/60 dark:black/30`,"gap-2":``,"rounded-lg":``,"p-3":``,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`},ve={flex:`~ row`,"items-center":``,"gap-2":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},ye={truncate:``,"font-medium":``},be={key:1,bg:`neutral-50/50 dark:neutral-900/50`,"rounded-xl":``,"p-8":``,"text-center":``,border:`~ neutral-200/50 dark:neutral-700/30`,shadow:`sm`};var R=s({__name:`CardDetailDialog`,props:{modelValue:{type:Boolean},cardId:null},emits:[`update:modelValue`],setup(s,{emit:R}){let z=s,B=R,{t:V}=ee(),H=te(),{removeCard:xe}=H,{activeCardId:U}=f(H),W=t(()=>{if(z.cardId)return H.getCard(z.cardId)}),G=t(()=>{var e,t,n,r;if(!W.value||!(!((e=W.value.extensions)==null||(e=e.airi)==null)&&e.modules))return{consciousness:``,speech:``,voice:``};let i=W.value.extensions.airi.modules;return{consciousness:(t=i.consciousness)?.model||``,speech:(n=i.speech)?.model||``,voice:(r=i.speech)?.voice_id||``}}),K=t(()=>W.value?{personality:W.value.personality,scenario:W.value.scenario,systemPrompt:W.value.systemPrompt,postHistoryInstructions:W.value.postHistoryInstructions}:{}),q=t(()=>z.cardId===U.value),J=u(!1);function Se(){J.value=!0,setTimeout(()=>{U.value=z.cardId,J.value=!1},300)}function Y(e){return e?.replace(/\{\{(.*?)\}\}/g,`{{ $1 }}`).trim()}let X=u(!1);function Ce(){W.value&&(xe(z.cardId),B(`update:modelValue`,!1)),X.value=!1}let Z=u(``),Q=t(()=>{var e,t;let n=[];return(e=W.value)?.description&&n.push({id:`description`,label:V(`settings.pages.card.description_label`),icon:`i-solar:document-text-linear`}),(t=W.value)?.notes&&n.push({id:`notes`,label:V(`settings.pages.card.creator_notes`),icon:`i-solar:notes-linear`}),Object.values(K.value).some(e=>!!e)&&n.push({id:`character`,label:V(`settings.pages.card.character`),icon:`i-solar:user-rounded-linear`}),n.push({id:`modules`,label:V(`settings.pages.card.modules`),icon:`i-solar:tuning-square-linear`}),n}),$=t({get:()=>{var e;return Q.value.find(e=>e.id===Z.value)?Z.value:(e=Q.value[0])?.id||``},set:e=>{Z.value=e}});return(t,u)=>{var f;return l(),i(e,null,[o(m(ae),{open:s.modelValue,"onUpdate:open":u[0]||=e=>B(`update:modelValue`,e)},{default:h(()=>[o(m(re),null,{default:h(()=>[o(m(g),{class:`data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-100 bg-black/50 backdrop-blur-sm`}),o(m(ie),{class:`data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-100 m-0 max-h-[90vh] max-w-6xl w-[92vw] flex flex-col overflow-auto border border-neutral-200 rounded-xl bg-white p-5 shadow-xl 2xl:w-[60vw] lg:w-[80vw] md:w-[85vw] xl:w-[70vw] -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800 sm:p-6`},{default:h(()=>[W.value?(l(),i(`div`,se,[n(`div`,ce,[n(`div`,le,[n(`div`,null,[n(`div`,ue,[o(m(_),{"text-2xl":``,"font-bold":``,class:`from-primary-500 to-primary-400 bg-gradient-to-r bg-clip-text text-transparent`},{default:h(()=>[a(p(W.value.name),1)]),_:1}),q.value?(l(),i(`div`,de,[u[3]||=n(`div`,{"i-solar:check-circle-bold-duotone":``,"text-xs":``},null,-1),a(` `+p(m(V)(`settings.pages.card.active_badge`)),1)])):r(``,!0)]),n(`div`,fe,[a(` v`+p(W.value.version)+` `,1),W.value.creator?(l(),i(e,{key:0},[a(` · `+p(m(V)(`settings.pages.card.created_by`))+` `,1),n(`span`,pe,p(W.value.creator),1)],64)):r(``,!0)])]),n(`div`,me,[o(m(ne),{variant:`primary`,icon:q.value?`i-solar:check-circle-bold-duotone`:`i-solar:play-circle-broken`,label:q.value?m(V)(`settings.pages.card.active`):m(V)(`settings.pages.card.activate`),disabled:q.value,class:c({"animate-pulse":J.value}),onClick:Se},null,8,[`icon`,`label`,`disabled`,`class`])])]),n(`div`,he,[n(`div`,v,[n(`div`,y,[(l(!0),i(e,null,d(Q.value,e=>(l(),i(`button`,{key:e.id,class:c([`px-4 py-2 text-sm font-medium`,[$.value===e.id?`text-primary-600 dark:text-primary-400 border-b-2 border-primary-500 dark:border-primary-400`:`text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300`]]),onClick:t=>$.value=e.id},[n(`div`,x,[n(`div`,{class:c(e.icon)},null,2),a(` `+p(e.label),1)])],10,b))),128))])])]),$.value===`notes`&&W.value.notes?(l(),i(`div`,S,[n(`div`,{bg:`white/60 dark:black/30`,border:`~ neutral-200/50 dark:neutral-700/30`,"max-h-60":``,"overflow-auto":``,"whitespace-pre-line":``,"rounded-lg":``,"p-4":``,"text-neutral-700":``,"sm:max-h-80":``,"dark:text-neutral-300":``,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`,innerHTML:Y(W.value.notes)},null,8,C)])):r(``,!0),$.value===`description`&&W.value.description?(l(),i(`div`,w,[n(`div`,{bg:`white/60 dark:black/30`,"max-h-60":``,"overflow-auto":``,"whitespace-pre-line":``,"rounded-lg":``,"p-4":``,"sm:max-h-80":``,text:`neutral-600 dark:neutral-300`,border:`~ neutral-200/50 dark:neutral-700/30`,innerHTML:Y(W.value.description)},null,8,T)])):r(``,!0),$.value===`character`&&Object.values(K.value).some(e=>!!e)?(l(),i(`div`,E,[n(`div`,D,[(l(!0),i(e,null,d(K.value,(t,a)=>(l(),i(e,{key:a},[t?(l(),i(`div`,O,[n(`h2`,k,p(m(V)(`settings.pages.card.${a.toLowerCase()}`)),1),n(`div`,{bg:`white/60 dark:black/30`,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`,"max-h-none":``,"overflow-auto":``,"whitespace-pre-line":``,"rounded-lg":``,"p-3":``,"text-neutral-700":``,"dark:text-neutral-300":``,innerHTML:Y(t)},null,8,A)])):r(``,!0)],64))),128))])])):r(``,!0),$.value===`modules`?(l(),i(`div`,j,[n(`div`,M,[n(`div`,N,[n(`span`,P,[u[4]||=n(`div`,{"i-lucide:ghost":``},null,-1),a(` `+p(m(V)(`settings.pages.card.consciousness.model`)),1)]),n(`div`,F,p(G.value.consciousness??`default`),1)]),n(`div`,I,[n(`span`,ge,[u[5]||=n(`div`,{"i-lucide:mic":``},null,-1),a(` `+p(m(V)(`settings.pages.card.speech.model`)),1)]),n(`div`,L,p(G.value.speech??`default`),1)]),n(`div`,_e,[n(`span`,ve,[u[6]||=n(`div`,{"i-lucide:music":``},null,-1),a(` `+p(m(V)(`settings.pages.card.speech.voice`)),1)]),n(`div`,ye,p(G.value.voice??`default`),1)])])])):r(``,!0)])])):(l(),i(`div`,be,[u[7]||=n(`div`,{"i-solar:card-search-broken":``,"mx-auto":``,"mb-3":``,"text-6xl":``,"text-neutral-400":``},null,-1),a(` `+p(m(V)(`settings.pages.card.card_not_found`)),1)]))]),_:1})]),_:1})]),_:1},8,[`open`]),o(oe,{modelValue:X.value,"onUpdate:modelValue":u[1]||=e=>X.value=e,"card-name":(f=W.value)?.name,onConfirm:Ce,onCancel:u[2]||=e=>X.value=!1},null,8,[`modelValue`,`card-name`])],64)}}}),z=R;export{z as CardDetailDialog_default};
\ No newline at end of file
+import{Fragment as e,computed as t,createBaseVNode as n,createCommentVNode as r,createElementBlock as i,createTextVNode as a,createVNode as o,defineComponent as s,normalizeClass as c,openBlock as l,ref as u,renderList as d,storeToRefs as f,toDisplayString as p,unref as m,useI18n as ee,withCtx as h}from"./index-BSwg6FIo.js";import{useAiriCardStore as te}from"./stores-BzkLfyIH.js";import{Button_default as ne}from"./Button-AEge-Qyg.js";import{$u as g,Bu as _,Iv as re,Pu as ie,nu as ae}from"./dist-BziUufTI.js";import{DeleteCardDialog_default as oe}from"./DeleteCardDialog-DFZll3ve.js";const se={key:0,class:`w-full flex flex-col gap-5`},ce={flex:`~ col`,"gap-3":``},le={flex:`~ row`,"items-center":``,"justify-between":``},ue={flex:`~ row`,"items-center":``,"gap-2":``},de={key:0,class:`flex items-center gap-1 rounded-full bg-primary-100 px-2 py-0.5 text-xs text-primary-600 font-medium dark:bg-primary-900/40 dark:text-primary-400`},fe={"mt-1":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},pe={"font-medium":``},me={flex:`~ row`,"gap-2":``},he={class:`mt-4`},v={class:`border-b border-neutral-200 dark:border-neutral-700`},y={class:`flex justify-center -mb-px sm:justify-start space-x-1`},b=[`onClick`],x={class:`flex items-center gap-1`},S={key:0},C=[`innerHTML`],w={key:1},T=[`innerHTML`],E={key:2},D={flex:`~ col`,"max-h-60":``,"gap-4":``,"overflow-auto":``,"pr-1":``,"sm:max-h-80":``},O={key:0,flex:`~ col`,"gap-2":``},k={"text-lg":``,"text-neutral-500":``,"font-medium":``,"dark:text-neutral-400":``},A=[`innerHTML`],j={key:3},M={grid:`~ cols-1 sm:cols-3`,"gap-4":``},N={flex:`~ col`,bg:`white/60 dark:black/30`,"gap-1":``,"rounded-lg":``,"p-3":``,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`},P={flex:`~ row`,"items-center":``,"gap-2":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},F={truncate:``,"font-medium":``},I={flex:`~ col`,bg:`white/60 dark:black/30`,"gap-2":``,"rounded-lg":``,"p-3":``,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`},ge={flex:`~ row`,"items-center":``,"gap-2":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},L={truncate:``,"font-medium":``},_e={flex:`~ col`,bg:`white/60 dark:black/30`,"gap-2":``,"rounded-lg":``,"p-3":``,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`},ve={flex:`~ row`,"items-center":``,"gap-2":``,"text-sm":``,"text-neutral-500":``,"dark:text-neutral-400":``},ye={truncate:``,"font-medium":``},be={key:1,bg:`neutral-50/50 dark:neutral-900/50`,"rounded-xl":``,"p-8":``,"text-center":``,border:`~ neutral-200/50 dark:neutral-700/30`,shadow:`sm`};var R=s({__name:`CardDetailDialog`,props:{modelValue:{type:Boolean},cardId:null},emits:[`update:modelValue`],setup(s,{emit:R}){let z=s,B=R,{t:V}=ee(),H=te(),{removeCard:xe}=H,{activeCardId:U}=f(H),W=t(()=>{if(z.cardId)return H.getCard(z.cardId)}),G=t(()=>{var e,t,n,r;if(!W.value||!(!((e=W.value.extensions)==null||(e=e.airi)==null)&&e.modules))return{consciousness:``,speech:``,voice:``};let i=W.value.extensions.airi.modules;return{consciousness:(t=i.consciousness)?.model||``,speech:(n=i.speech)?.model||``,voice:(r=i.speech)?.voice_id||``}}),K=t(()=>W.value?{personality:W.value.personality,scenario:W.value.scenario,systemPrompt:W.value.systemPrompt,postHistoryInstructions:W.value.postHistoryInstructions}:{}),q=t(()=>z.cardId===U.value),J=u(!1);function Se(){J.value=!0,setTimeout(()=>{U.value=z.cardId,J.value=!1},300)}function Y(e){return e?.replace(/\{\{(.*?)\}\}/g,`{{ $1 }}`).trim()}let X=u(!1);function Ce(){W.value&&(xe(z.cardId),B(`update:modelValue`,!1)),X.value=!1}let Z=u(``),Q=t(()=>{var e,t;let n=[];return(e=W.value)?.description&&n.push({id:`description`,label:V(`settings.pages.card.description_label`),icon:`i-solar:document-text-linear`}),(t=W.value)?.notes&&n.push({id:`notes`,label:V(`settings.pages.card.creator_notes`),icon:`i-solar:notes-linear`}),Object.values(K.value).some(e=>!!e)&&n.push({id:`character`,label:V(`settings.pages.card.character`),icon:`i-solar:user-rounded-linear`}),n.push({id:`modules`,label:V(`settings.pages.card.modules`),icon:`i-solar:tuning-square-linear`}),n}),$=t({get:()=>{var e;return Q.value.find(e=>e.id===Z.value)?Z.value:(e=Q.value[0])?.id||``},set:e=>{Z.value=e}});return(t,u)=>{var f;return l(),i(e,null,[o(m(ae),{open:s.modelValue,"onUpdate:open":u[0]||=e=>B(`update:modelValue`,e)},{default:h(()=>[o(m(re),null,{default:h(()=>[o(m(g),{class:`data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-100 bg-black/50 backdrop-blur-sm`}),o(m(ie),{class:`data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-100 m-0 max-h-[90vh] max-w-6xl w-[92vw] flex flex-col overflow-auto border border-neutral-200 rounded-xl bg-white p-5 shadow-xl 2xl:w-[60vw] lg:w-[80vw] md:w-[85vw] xl:w-[70vw] -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800 sm:p-6`},{default:h(()=>[W.value?(l(),i(`div`,se,[n(`div`,ce,[n(`div`,le,[n(`div`,null,[n(`div`,ue,[o(m(_),{"text-2xl":``,"font-bold":``,class:`from-primary-500 to-primary-400 bg-gradient-to-r bg-clip-text text-transparent`},{default:h(()=>[a(p(W.value.name),1)]),_:1}),q.value?(l(),i(`div`,de,[u[3]||=n(`div`,{"i-solar:check-circle-bold-duotone":``,"text-xs":``},null,-1),a(` `+p(m(V)(`settings.pages.card.active_badge`)),1)])):r(``,!0)]),n(`div`,fe,[a(` v`+p(W.value.version)+` `,1),W.value.creator?(l(),i(e,{key:0},[a(` · `+p(m(V)(`settings.pages.card.created_by`))+` `,1),n(`span`,pe,p(W.value.creator),1)],64)):r(``,!0)])]),n(`div`,me,[o(m(ne),{variant:`primary`,icon:q.value?`i-solar:check-circle-bold-duotone`:`i-solar:play-circle-broken`,label:q.value?m(V)(`settings.pages.card.active`):m(V)(`settings.pages.card.activate`),disabled:q.value,class:c({"animate-pulse":J.value}),onClick:Se},null,8,[`icon`,`label`,`disabled`,`class`])])]),n(`div`,he,[n(`div`,v,[n(`div`,y,[(l(!0),i(e,null,d(Q.value,e=>(l(),i(`button`,{key:e.id,class:c([`px-4 py-2 text-sm font-medium`,[$.value===e.id?`text-primary-600 dark:text-primary-400 border-b-2 border-primary-500 dark:border-primary-400`:`text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300`]]),onClick:t=>$.value=e.id},[n(`div`,x,[n(`div`,{class:c(e.icon)},null,2),a(` `+p(e.label),1)])],10,b))),128))])])]),$.value===`notes`&&W.value.notes?(l(),i(`div`,S,[n(`div`,{bg:`white/60 dark:black/30`,border:`~ neutral-200/50 dark:neutral-700/30`,"max-h-60":``,"overflow-auto":``,"whitespace-pre-line":``,"rounded-lg":``,"p-4":``,"text-neutral-700":``,"sm:max-h-80":``,"dark:text-neutral-300":``,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`,innerHTML:Y(W.value.notes)},null,8,C)])):r(``,!0),$.value===`description`&&W.value.description?(l(),i(`div`,w,[n(`div`,{bg:`white/60 dark:black/30`,"max-h-60":``,"overflow-auto":``,"whitespace-pre-line":``,"rounded-lg":``,"p-4":``,"sm:max-h-80":``,text:`neutral-600 dark:neutral-300`,border:`~ neutral-200/50 dark:neutral-700/30`,innerHTML:Y(W.value.description)},null,8,T)])):r(``,!0),$.value===`character`&&Object.values(K.value).some(e=>!!e)?(l(),i(`div`,E,[n(`div`,D,[(l(!0),i(e,null,d(K.value,(t,a)=>(l(),i(e,{key:a},[t?(l(),i(`div`,O,[n(`h2`,k,p(m(V)(`settings.pages.card.${a.toLowerCase()}`)),1),n(`div`,{bg:`white/60 dark:black/30`,border:`~ neutral-200/50 dark:neutral-700/30`,transition:`all duration-200`,hover:`bg-white/80 dark:bg-black/40`,"max-h-none":``,"overflow-auto":``,"whitespace-pre-line":``,"rounded-lg":``,"p-3":``,"text-neutral-700":``,"dark:text-neutral-300":``,innerHTML:Y(t)},null,8,A)])):r(``,!0)],64))),128))])])):r(``,!0),$.value===`modules`?(l(),i(`div`,j,[n(`div`,M,[n(`div`,N,[n(`span`,P,[u[4]||=n(`div`,{"i-lucide:ghost":``},null,-1),a(` `+p(m(V)(`settings.pages.card.consciousness.model`)),1)]),n(`div`,F,p(G.value.consciousness??`default`),1)]),n(`div`,I,[n(`span`,ge,[u[5]||=n(`div`,{"i-lucide:mic":``},null,-1),a(` `+p(m(V)(`settings.pages.card.speech.model`)),1)]),n(`div`,L,p(G.value.speech??`default`),1)]),n(`div`,_e,[n(`span`,ve,[u[6]||=n(`div`,{"i-lucide:music":``},null,-1),a(` `+p(m(V)(`settings.pages.card.speech.voice`)),1)]),n(`div`,ye,p(G.value.voice??`default`),1)])])])):r(``,!0)])])):(l(),i(`div`,be,[u[7]||=n(`div`,{"i-solar:card-search-broken":``,"mx-auto":``,"mb-3":``,"text-6xl":``,"text-neutral-400":``},null,-1),a(` `+p(m(V)(`settings.pages.card.card_not_found`)),1)]))]),_:1})]),_:1})]),_:1},8,[`open`]),o(oe,{modelValue:X.value,"onUpdate:modelValue":u[1]||=e=>X.value=e,"card-name":(f=W.value)?.name,onConfirm:Ce,onCancel:u[2]||=e=>X.value=!1},null,8,[`modelValue`,`card-name`])],64)}}}),z=R;export{z as CardDetailDialog_default};
\ No newline at end of file
diff --git a/assets/CardDetailDialog-DveFVjqZ.js b/assets/CardDetailDialog-DveFVjqZ.js
deleted file mode 100644
index dbe39e034df7059b18b7bc5c7b9d01f8a9177eb1..0000000000000000000000000000000000000000
--- a/assets/CardDetailDialog-DveFVjqZ.js
+++ /dev/null
@@ -1 +0,0 @@
-import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import"./dist-DbabDsG-.js";import"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import"./DeleteCardDialog-5OZGLqwk.js";import{CardDetailDialog_default as e}from"./CardDetailDialog-Cggh12Lo.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardDetailDialog-McUMnIHp.js b/assets/CardDetailDialog-McUMnIHp.js
new file mode 100644
index 0000000000000000000000000000000000000000..f446c1ecb06ac1b381c580fc459c7c917824208e
--- /dev/null
+++ b/assets/CardDetailDialog-McUMnIHp.js
@@ -0,0 +1 @@
+import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import"./dist-BziUufTI.js";import"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import"./DeleteCardDialog-DFZll3ve.js";import{CardDetailDialog_default as e}from"./CardDetailDialog-BCybvJ8-.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardListItem-Bp4LX3UR.js b/assets/CardListItem-C9XT5lUo.js
similarity index 96%
rename from assets/CardListItem-Bp4LX3UR.js
rename to assets/CardListItem-C9XT5lUo.js
index bb1b4d6741ff2487dc0c857d28fb94578e15900c..e4b3c460248f9e285e3c08bbdeff5a7496fcbf04 100644
--- a/assets/CardListItem-Bp4LX3UR.js
+++ b/assets/CardListItem-C9XT5lUo.js
@@ -1 +1 @@
-import{createBaseVNode as e,createBlock as t,createCommentVNode as n,createElementBlock as r,defineComponent as i,normalizeClass as a,openBlock as o,toDisplayString as s,unref as c,withCtx as l,withModifiers as u}from"./index-Cf-fA00n.js";import{CursorFloating_default as d}from"./components-BSoqAjUI.js";const f={relative:``,flex:`~ col 1`,"justify-between":``,"gap-3":``,"overflow-hidden":``,"rounded-lg":``,bg:`white dark:neutral-900`,"p-5":``,transition:`all ease-in-out duration-400`,after:`content-empty absolute inset-0 z--2 w-full h-full bg-dotted-[neutral-200/80] bg-size-10px mask-image-[linear-gradient(165deg,white_30%,transparent_50%)] transition-all duration-400 ease-in-out`,hover:`after:bg-dotted-[primary-300/50] dark:after:bg-dotted-[primary-200/20] text-primary-600/80 dark:text-primary-300/80`},p={"z-1":``,flex:``,"items-start":``,"justify-between":``,"gap-2":``},m={"flex-1":``,truncate:``,"text-lg":``,"font-thin":``},h={key:0,"shrink-0":``,"rounded-md":``,"p-1":``,bg:`primary-100 dark:primary-900/40`,text:`primary-600 dark:primary-400`},g={key:0,"line-clamp-3":``,"min-h-40px":``,"flex-1":``,"text-sm":``,text:`neutral-500 dark:neutral-400`},_={"z-1":``,flex:``,"items-center":``,"justify-between":``,"text-xs":``,text:`neutral-500 dark:neutral-400`},v={flex:``,"items-center":``,"gap-1.5":``},y={flex:``,"items-center":``,"gap-0.5":``},b={flex:``,"items-center":``,"gap-0.5":``},x={flex:``,"items-center":``,"justify-end":``,"px-2":``,"py-1.5":``},S=[`disabled`];var C=i({__name:`CardListItem`,props:{id:null,name:null,description:null,isActive:{type:Boolean},isSelected:{type:Boolean},version:null,consciousnessModel:null,voiceModel:null},emits:[`select`,`activate`,`delete`],setup(i,{emit:C}){let w=C;return(C,T)=>(o(),t(c(d),{relative:``,"min-h-120px":``,flex:`~ col`,"cursor-pointer":``,"overflow-hidden":``,"rounded-xl":``,class:a([i.isSelected?`border-2 border-primary-400 dark:border-primary-600`:`border-2 border-neutral-100 dark:border-neutral-800/25`]),bg:`neutral-200/50 dark:neutral-800/50`,"drop-shadow":`none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none`,transition:`all ease-in-out duration-400`,before:`content-empty absolute inset-0 z-0 w-25% h-full transition-all duration-400 ease-in-out bg-gradient-to-r from-primary-500/0 to-primary-500/0 dark:from-primary-400/0 dark:to-primary-400/0 mask-image-[linear-gradient(120deg,white_100%)] opacity-0`,hover:`before:opacity-100 before:bg-gradient-to-r before:from-primary-500/20 before:via-primary-500/10 before:to-transparent before:dark:from-primary-400/20 before:dark:via-primary-400/10 before:dark:to-transparent`,onClick:T[2]||=e=>w(`select`)},{default:l(()=>[e(`div`,f,[e(`div`,p,[e(`h3`,m,s(i.name),1),i.isActive?(o(),r(`div`,h,T[3]||=[e(`div`,{"i-solar:check-circle-bold-duotone":``,"text-sm":``},null,-1)])):n(``,!0)]),i.description?(o(),r(`p`,g,s(i.description),1)):n(``,!0),e(`div`,_,[e(`div`,null,`v`+s(i.version),1),e(`div`,v,[e(`div`,y,[T[4]||=e(`div`,{"i-lucide:ghost":``,"text-xs":``},null,-1),e(`span`,null,s(i.consciousnessModel),1)]),e(`div`,b,[T[5]||=e(`div`,{"i-lucide:mic":``,"text-xs":``},null,-1),e(`span`,null,s(i.voiceModel),1)])])])]),e(`div`,x,[e(`button`,{"rounded-lg":``,"p-1.5":``,"transition-colors":``,hover:`bg-neutral-200 dark:bg-neutral-700/50`,disabled:i.isActive,onClick:T[0]||=u(e=>w(`activate`),[`stop`])},[e(`div`,{class:a([i.isActive?`i-solar:check-circle-bold-duotone text-primary-500 dark:text-primary-400`:`i-solar:play-circle-broken text-neutral-500 dark:text-neutral-400`])},null,2)],8,S),i.id===`default`?n(``,!0):(o(),r(`button`,{key:0,"rounded-lg":``,"p-1.5":``,"transition-colors":``,hover:`bg-neutral-200 dark:bg-neutral-700/50`,onClick:T[1]||=u(e=>w(`delete`),[`stop`])},T[6]||=[e(`div`,{"i-solar:trash-bin-trash-linear":``,text:`neutral-500 dark:neutral-400`},null,-1)]))])]),_:1},8,[`class`]))}}),w=C;export{w as CardListItem_default};
\ No newline at end of file
+import{createBaseVNode as e,createBlock as t,createCommentVNode as n,createElementBlock as r,defineComponent as i,normalizeClass as a,openBlock as o,toDisplayString as s,unref as c,withCtx as l,withModifiers as u}from"./index-BSwg6FIo.js";import{CursorFloating_default as d}from"./components-DetbLrEi.js";const f={relative:``,flex:`~ col 1`,"justify-between":``,"gap-3":``,"overflow-hidden":``,"rounded-lg":``,bg:`white dark:neutral-900`,"p-5":``,transition:`all ease-in-out duration-400`,after:`content-empty absolute inset-0 z--2 w-full h-full bg-dotted-[neutral-200/80] bg-size-10px mask-image-[linear-gradient(165deg,white_30%,transparent_50%)] transition-all duration-400 ease-in-out`,hover:`after:bg-dotted-[primary-300/50] dark:after:bg-dotted-[primary-200/20] text-primary-600/80 dark:text-primary-300/80`},p={"z-1":``,flex:``,"items-start":``,"justify-between":``,"gap-2":``},m={"flex-1":``,truncate:``,"text-lg":``,"font-thin":``},h={key:0,"shrink-0":``,"rounded-md":``,"p-1":``,bg:`primary-100 dark:primary-900/40`,text:`primary-600 dark:primary-400`},g={key:0,"line-clamp-3":``,"min-h-40px":``,"flex-1":``,"text-sm":``,text:`neutral-500 dark:neutral-400`},_={"z-1":``,flex:``,"items-center":``,"justify-between":``,"text-xs":``,text:`neutral-500 dark:neutral-400`},v={flex:``,"items-center":``,"gap-1.5":``},y={flex:``,"items-center":``,"gap-0.5":``},b={flex:``,"items-center":``,"gap-0.5":``},x={flex:``,"items-center":``,"justify-end":``,"px-2":``,"py-1.5":``},S=[`disabled`];var C=i({__name:`CardListItem`,props:{id:null,name:null,description:null,isActive:{type:Boolean},isSelected:{type:Boolean},version:null,consciousnessModel:null,voiceModel:null},emits:[`select`,`activate`,`delete`],setup(i,{emit:C}){let w=C;return(C,T)=>(o(),t(c(d),{relative:``,"min-h-120px":``,flex:`~ col`,"cursor-pointer":``,"overflow-hidden":``,"rounded-xl":``,class:a([i.isSelected?`border-2 border-primary-400 dark:border-primary-600`:`border-2 border-neutral-100 dark:border-neutral-800/25`]),bg:`neutral-200/50 dark:neutral-800/50`,"drop-shadow":`none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none`,transition:`all ease-in-out duration-400`,before:`content-empty absolute inset-0 z-0 w-25% h-full transition-all duration-400 ease-in-out bg-gradient-to-r from-primary-500/0 to-primary-500/0 dark:from-primary-400/0 dark:to-primary-400/0 mask-image-[linear-gradient(120deg,white_100%)] opacity-0`,hover:`before:opacity-100 before:bg-gradient-to-r before:from-primary-500/20 before:via-primary-500/10 before:to-transparent before:dark:from-primary-400/20 before:dark:via-primary-400/10 before:dark:to-transparent`,onClick:T[2]||=e=>w(`select`)},{default:l(()=>[e(`div`,f,[e(`div`,p,[e(`h3`,m,s(i.name),1),i.isActive?(o(),r(`div`,h,T[3]||=[e(`div`,{"i-solar:check-circle-bold-duotone":``,"text-sm":``},null,-1)])):n(``,!0)]),i.description?(o(),r(`p`,g,s(i.description),1)):n(``,!0),e(`div`,_,[e(`div`,null,`v`+s(i.version),1),e(`div`,v,[e(`div`,y,[T[4]||=e(`div`,{"i-lucide:ghost":``,"text-xs":``},null,-1),e(`span`,null,s(i.consciousnessModel),1)]),e(`div`,b,[T[5]||=e(`div`,{"i-lucide:mic":``,"text-xs":``},null,-1),e(`span`,null,s(i.voiceModel),1)])])])]),e(`div`,x,[e(`button`,{"rounded-lg":``,"p-1.5":``,"transition-colors":``,hover:`bg-neutral-200 dark:bg-neutral-700/50`,disabled:i.isActive,onClick:T[0]||=u(e=>w(`activate`),[`stop`])},[e(`div`,{class:a([i.isActive?`i-solar:check-circle-bold-duotone text-primary-500 dark:text-primary-400`:`i-solar:play-circle-broken text-neutral-500 dark:text-neutral-400`])},null,2)],8,S),i.id===`default`?n(``,!0):(o(),r(`button`,{key:0,"rounded-lg":``,"p-1.5":``,"transition-colors":``,hover:`bg-neutral-200 dark:bg-neutral-700/50`,onClick:T[1]||=u(e=>w(`delete`),[`stop`])},T[6]||=[e(`div`,{"i-solar:trash-bin-trash-linear":``,text:`neutral-500 dark:neutral-400`},null,-1)]))])]),_:1},8,[`class`]))}}),w=C;export{w as CardListItem_default};
\ No newline at end of file
diff --git a/assets/CardListItem-KoeisllI.js b/assets/CardListItem-KoeisllI.js
new file mode 100644
index 0000000000000000000000000000000000000000..5a44c704d78c74f460631c0d00c0bc716f0390ba
--- /dev/null
+++ b/assets/CardListItem-KoeisllI.js
@@ -0,0 +1 @@
+import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{CardListItem_default as e}from"./CardListItem-C9XT5lUo.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CardListItem-MSEXNvPv.js b/assets/CardListItem-MSEXNvPv.js
deleted file mode 100644
index 2c7425e9a0cf775949bbd74690d100a7e83423f1..0000000000000000000000000000000000000000
--- a/assets/CardListItem-MSEXNvPv.js
+++ /dev/null
@@ -1 +0,0 @@
-import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{CardListItem_default as e}from"./CardListItem-Bp4LX3UR.js";export{e as default};
\ No newline at end of file
diff --git a/assets/CheckBar-DG1gh8Et.js b/assets/CheckBar-eDXKHwAa.js
similarity index 95%
rename from assets/CheckBar-DG1gh8Et.js
rename to assets/CheckBar-eDXKHwAa.js
index 61012bbdfd5902a6102b5cc678ce17895733d55e..d417821b78e4578b977f062f7ca5a071e103ff81 100644
--- a/assets/CheckBar-DG1gh8Et.js
+++ b/assets/CheckBar-eDXKHwAa.js
@@ -1 +1 @@
-import{Transition as e,createBaseVNode as t,createCommentVNode as n,createElementBlock as r,createTextVNode as i,createVNode as a,defineComponent as o,mergeModels as s,normalizeClass as c,openBlock as l,toDisplayString as u,useModel as d,vModelCheckbox as f,withCtx as p,withDirectives as m}from"./index-Cf-fA00n.js";const h={class:`w-full flex cursor-pointer items-center justify-between rounded-lg px-4 py-3 text-sm outline-none transition-all duration-250 ease-in-out`,bg:`neutral-50 dark:neutral-800`,hover:`bg-neutral-200 dark:bg-neutral-700`},g=[`aria-checked`],_={key:0,text:`sm neutral-500`};var v=o({__name:`CheckBar`,props:s({text:null,iconOn:null,iconOff:null,description:null},{modelValue:{type:Boolean},modelModifiers:{}}),emits:[`update:modelValue`],setup(o){let s=d(o,`modelValue`);return(d,v)=>(l(),r(`label`,h,[m(t(`input`,{"onUpdate:modelValue":v[0]||=e=>s.value=e,"aria-checked":s.value,type:`checkbox`,hidden:``},null,8,g),[[f,s.value]]),t(`div`,null,[i(u(d.$t(o.text))+` `,1),o.description?(l(),r(`div`,_,u(d.$t(o.description)),1)):n(``,!0)]),a(e,{name:`slide-away`,mode:`out-in`},{default:p(()=>[s.value?(l(),r(`div`,{key:0,class:c(o.iconOn),transition:`all ease-in-out duration-250`},null,2)):(l(),r(`div`,{key:1,class:c(o.iconOff),transition:`all ease-in-out duration-250`},null,2))]),_:1})]))}}),y=v;export{y as CheckBar_default};
\ No newline at end of file
+import{Transition as e,createBaseVNode as t,createCommentVNode as n,createElementBlock as r,createTextVNode as i,createVNode as a,defineComponent as o,mergeModels as s,normalizeClass as c,openBlock as l,toDisplayString as u,useModel as d,vModelCheckbox as f,withCtx as p,withDirectives as m}from"./index-BSwg6FIo.js";const h={class:`w-full flex cursor-pointer items-center justify-between rounded-lg px-4 py-3 text-sm outline-none transition-all duration-250 ease-in-out`,bg:`neutral-50 dark:neutral-800`,hover:`bg-neutral-200 dark:bg-neutral-700`},g=[`aria-checked`],_={key:0,text:`sm neutral-500`};var v=o({__name:`CheckBar`,props:s({text:null,iconOn:null,iconOff:null,description:null},{modelValue:{type:Boolean},modelModifiers:{}}),emits:[`update:modelValue`],setup(o){let s=d(o,`modelValue`);return(d,v)=>(l(),r(`label`,h,[m(t(`input`,{"onUpdate:modelValue":v[0]||=e=>s.value=e,"aria-checked":s.value,type:`checkbox`,hidden:``},null,8,g),[[f,s.value]]),t(`div`,null,[i(u(d.$t(o.text))+` `,1),o.description?(l(),r(`div`,_,u(d.$t(o.description)),1)):n(``,!0)]),a(e,{name:`slide-away`,mode:`out-in`},{default:p(()=>[s.value?(l(),r(`div`,{key:0,class:c(o.iconOn),transition:`all ease-in-out duration-250`},null,2)):(l(),r(`div`,{key:1,class:c(o.iconOff),transition:`all ease-in-out duration-250`},null,2))]),_:1})]))}}),y=v;export{y as CheckBar_default};
\ No newline at end of file
diff --git a/assets/ColorPalette-DFqjkBzI.js b/assets/ColorPalette-BdHvvd1C.js
similarity index 90%
rename from assets/ColorPalette-DFqjkBzI.js
rename to assets/ColorPalette-BdHvvd1C.js
index c505413b8109fe72d2c56ea9fbe878c32b03131b..6959a5f5f51b4acfd235c61370c2ca67a5b881f8 100644
--- a/assets/ColorPalette-DFqjkBzI.js
+++ b/assets/ColorPalette-BdHvvd1C.js
@@ -1 +1 @@
-import{DEFAULT_THEME_COLORS_HUE as e,Fragment as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createTextVNode as a,createVNode as o,defineComponent as s,normalizeClass as c,normalizeStyle as l,openBlock as u,renderList as d,toDisplayString as f,unref as p,useSettings as m,withCtx as h}from"./index-Cf-fA00n.js";import{Gg as g,Hg as _,Ug as v,Wg as y,jg as b,qg as x}from"./dist-DbabDsG-.js";const S={key:0,flex:``,"gap-2":``};var C=s({__name:`ColorPalette`,props:{colors:null},setup(s){let C=m();return(m,w)=>s.colors.length?(u(),i(`div`,S,[(u(!0),i(t,null,d(s.colors,({hex:t,name:r})=>(u(),n(p(_),{key:t||`default`},{default:h(()=>[o(p(y),null,{default:h(()=>[o(p(b),{transition:`all ease-in-out duration-250`,"size-6":``,"cursor-pointer":``,"rounded-full":``,"bg-primary-500":``,style:l(t?{background:t}:{"--chromatic-hue":p(e)}),class:c(p(C).isColorSelectedForPrimary(t)?`scale-150 mx-1`:`hover:scale-110`),onClick:e=>p(C).applyPrimaryColorFrom(t)},null,8,[`style`,`class`,`onClick`]),o(p(x),null,{default:h(()=>[o(p(v),{bg:`white dark:neutral-800`,"rounded-lg":``,"px-3":``,"py-1.5":``,"text-sm":``,"shadow-md":``},{default:h(()=>[a(f(r)+` `,1),o(p(g),{"fill-white":``,"dark:fill-neutral-800":``})]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))])):r(``,!0)}}),w=C;export{w as ColorPalette_default};
\ No newline at end of file
+import{DEFAULT_THEME_COLORS_HUE as e,Fragment as t,createBlock as n,createCommentVNode as r,createElementBlock as i,createTextVNode as a,createVNode as o,defineComponent as s,normalizeClass as c,normalizeStyle as l,openBlock as u,renderList as d,toDisplayString as f,unref as p,useSettings as m,withCtx as h}from"./index-BSwg6FIo.js";import{Gg as g,Hg as _,Ug as v,Wg as y,jg as b,qg as x}from"./dist-BziUufTI.js";const S={key:0,flex:``,"gap-2":``};var C=s({__name:`ColorPalette`,props:{colors:null},setup(s){let C=m();return(m,w)=>s.colors.length?(u(),i(`div`,S,[(u(!0),i(t,null,d(s.colors,({hex:t,name:r})=>(u(),n(p(_),{key:t||`default`},{default:h(()=>[o(p(y),null,{default:h(()=>[o(p(b),{transition:`all ease-in-out duration-250`,"size-6":``,"cursor-pointer":``,"rounded-full":``,"bg-primary-500":``,style:l(t?{background:t}:{"--chromatic-hue":p(e)}),class:c(p(C).isColorSelectedForPrimary(t)?`scale-150 mx-1`:`hover:scale-110`),onClick:e=>p(C).applyPrimaryColorFrom(t)},null,8,[`style`,`class`,`onClick`]),o(p(x),null,{default:h(()=>[o(p(v),{bg:`white dark:neutral-800`,"rounded-lg":``,"px-3":``,"py-1.5":``,"text-sm":``,"shadow-md":``},{default:h(()=>[a(f(r)+` `,1),o(p(g),{"fill-white":``,"dark:fill-neutral-800":``})]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))])):r(``,!0)}}),w=C;export{w as ColorPalette_default};
\ No newline at end of file
diff --git a/assets/DeleteCardDialog-ChdXAy_R.js b/assets/DeleteCardDialog-ChdXAy_R.js
new file mode 100644
index 0000000000000000000000000000000000000000..9cf70ef4c806ec5918865ab9c2af7cb52c78012f
--- /dev/null
+++ b/assets/DeleteCardDialog-ChdXAy_R.js
@@ -0,0 +1 @@
+import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import"./dist-BziUufTI.js";import{DeleteCardDialog_default as e}from"./DeleteCardDialog-DFZll3ve.js";export{e as default};
\ No newline at end of file
diff --git a/assets/DeleteCardDialog-5OZGLqwk.js b/assets/DeleteCardDialog-DFZll3ve.js
similarity index 89%
rename from assets/DeleteCardDialog-5OZGLqwk.js
rename to assets/DeleteCardDialog-DFZll3ve.js
index 0a3c92f192ed209e890000b10c9bdf4c911c4948..6fb7e38ce495ca177302bd3e7aef9a7f6170e188 100644
--- a/assets/DeleteCardDialog-5OZGLqwk.js
+++ b/assets/DeleteCardDialog-DFZll3ve.js
@@ -1 +1 @@
-import{createBaseVNode as e,createBlock as t,createTextVNode as n,createVNode as r,defineComponent as i,openBlock as a,toDisplayString as o,unref as s,useI18n as c,withCtx as l}from"./index-Cf-fA00n.js";import{Button_default as u}from"./Button-DMzywyj7.js";import{Av as d,Fv as f,Mv as p,Nv as m,Ov as h,Tv as g,Vv as _,kv as v}from"./dist-DbabDsG-.js";const y={class:`flex flex-row justify-end gap-3`};var b=i({__name:`DeleteCardDialog`,props:{modelValue:{type:Boolean},cardName:null},emits:[`update:modelValue`,`confirm`,`cancel`],setup(i,{emit:b}){let x=b,{t:S}=c();function C(){x(`update:modelValue`,!1),x(`cancel`)}function w(){x(`update:modelValue`,!1),x(`confirm`)}return(c,b)=>(a(),t(s(g),{open:i.modelValue,"onUpdate:open":b[0]||=e=>x(`update:modelValue`,e)},{default:l(()=>[r(s(d),null,{default:l(()=>[r(s(v),{class:`data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-100 bg-black/50`}),r(s(h),{class:`data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-100 max-w-md w-full border border-neutral-200 rounded-xl bg-white p-6 shadow-xl -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800`},{default:l(()=>[r(s(_),{class:`mb-4 text-xl font-bold`},{default:l(()=>[n(o(s(S)(`settings.pages.card.delete_card`)),1)]),_:1}),r(s(f),{class:`mb-6`},{default:l(()=>[n(o(s(S)(`settings.pages.card.delete_confirmation`))+` `,1),e(`b`,null,`"`+o(i.cardName||``)+`"`,1)]),_:1}),e(`div`,y,[r(s(p),{"as-child":``},{default:l(()=>[r(s(u),{variant:`secondary`,label:s(S)(`settings.pages.card.cancel`),onClick:C},null,8,[`label`])]),_:1}),r(s(m),{"as-child":``},{default:l(()=>[r(s(u),{variant:`danger`,label:s(S)(`settings.pages.card.delete`),onClick:w},null,8,[`label`])]),_:1})])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),x=b;export{x as DeleteCardDialog_default};
\ No newline at end of file
+import{createBaseVNode as e,createBlock as t,createTextVNode as n,createVNode as r,defineComponent as i,openBlock as a,toDisplayString as o,unref as s,useI18n as c,withCtx as l}from"./index-BSwg6FIo.js";import{Button_default as u}from"./Button-AEge-Qyg.js";import{Av as d,Fv as f,Mv as p,Nv as m,Ov as h,Tv as g,Vv as _,kv as v}from"./dist-BziUufTI.js";const y={class:`flex flex-row justify-end gap-3`};var b=i({__name:`DeleteCardDialog`,props:{modelValue:{type:Boolean},cardName:null},emits:[`update:modelValue`,`confirm`,`cancel`],setup(i,{emit:b}){let x=b,{t:S}=c();function C(){x(`update:modelValue`,!1),x(`cancel`)}function w(){x(`update:modelValue`,!1),x(`confirm`)}return(c,b)=>(a(),t(s(g),{open:i.modelValue,"onUpdate:open":b[0]||=e=>x(`update:modelValue`,e)},{default:l(()=>[r(s(d),null,{default:l(()=>[r(s(v),{class:`data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-100 bg-black/50`}),r(s(h),{class:`data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-100 max-w-md w-full border border-neutral-200 rounded-xl bg-white p-6 shadow-xl -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800`},{default:l(()=>[r(s(_),{class:`mb-4 text-xl font-bold`},{default:l(()=>[n(o(s(S)(`settings.pages.card.delete_card`)),1)]),_:1}),r(s(f),{class:`mb-6`},{default:l(()=>[n(o(s(S)(`settings.pages.card.delete_confirmation`))+` `,1),e(`b`,null,`"`+o(i.cardName||``)+`"`,1)]),_:1}),e(`div`,y,[r(s(p),{"as-child":``},{default:l(()=>[r(s(u),{variant:`secondary`,label:s(S)(`settings.pages.card.cancel`),onClick:C},null,8,[`label`])]),_:1}),r(s(m),{"as-child":``},{default:l(()=>[r(s(u),{variant:`danger`,label:s(S)(`settings.pages.card.delete`),onClick:w},null,8,[`label`])]),_:1})])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),x=b;export{x as DeleteCardDialog_default};
\ No newline at end of file
diff --git a/assets/DeleteCardDialog-DQsCrsDB.js b/assets/DeleteCardDialog-DQsCrsDB.js
deleted file mode 100644
index c4334a23566e9c603821473a6b88ca2151e2c9e9..0000000000000000000000000000000000000000
--- a/assets/DeleteCardDialog-DQsCrsDB.js
+++ /dev/null
@@ -1 +0,0 @@
-import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import"./dist-DbabDsG-.js";import{DeleteCardDialog_default as e}from"./DeleteCardDialog-5OZGLqwk.js";export{e as default};
\ No newline at end of file
diff --git a/assets/HeaderLink-B4zLlE8_.js b/assets/HeaderLink-rfbghXs_.js
similarity index 92%
rename from assets/HeaderLink-B4zLlE8_.js
rename to assets/HeaderLink-rfbghXs_.js
index e88f0ccec8a076a7c91783c43a98e8d3dc986a82..796e63aaf84c1ef26409ec40ed30fb9def40a47f 100644
--- a/assets/HeaderLink-B4zLlE8_.js
+++ b/assets/HeaderLink-rfbghXs_.js
@@ -1 +1 @@
-import{RouterLink as e,__plugin_vue_export_helper_default as t,createBaseVNode as n,createBlock as r,createElementBlock as i,defineComponent as a,openBlock as o,unref as s,useDark as c,withCtx as l}from"./index-Cf-fA00n.js";var u=`/assets/logo-dark-B0bvNYTh.svg`,d=`/assets/logo-B2aCU-bH.svg`;const f=[`src`],p=[`src`];var m=a({__name:`HeaderLink`,setup(t){let a=c();return(t,c)=>(o(),r(s(e),{to:`/`,flex:`~`,"items-center":``,"gap-2":``,"px-2":``,"text-nowrap":``,"text-2xl":``,"outline-none":``},{default:l(()=>[s(a)?(o(),i(`img`,{key:0,src:s(u),"h-8":``,"w-8":``,class:`theme-colored`},null,8,f)):(o(),i(`img`,{key:1,src:s(d),"h-8":``,"w-8":``,class:`theme-colored`},null,8,p)),c[0]||=n(`div`,{"translate-y":`[2px]`,"font-semibold":``,"font-quicksand":``},[n(`span`,null,`AIRI`)],-1)]),_:1,__:[0]}))}}),h=t(m,[[`__scopeId`,`data-v-2542c9d9`]]);export{h as HeaderLink_default};
\ No newline at end of file
+import{RouterLink as e,__plugin_vue_export_helper_default as t,createBaseVNode as n,createBlock as r,createElementBlock as i,defineComponent as a,openBlock as o,unref as s,useDark as c,withCtx as l}from"./index-BSwg6FIo.js";var u=`/assets/logo-dark-B0bvNYTh.svg`,d=`/assets/logo-B2aCU-bH.svg`;const f=[`src`],p=[`src`];var m=a({__name:`HeaderLink`,setup(t){let a=c();return(t,c)=>(o(),r(s(e),{to:`/`,flex:`~`,"items-center":``,"gap-2":``,"px-2":``,"text-nowrap":``,"text-2xl":``,"outline-none":``},{default:l(()=>[s(a)?(o(),i(`img`,{key:0,src:s(u),"h-8":``,"w-8":``,class:`theme-colored`},null,8,f)):(o(),i(`img`,{key:1,src:s(d),"h-8":``,"w-8":``,class:`theme-colored`},null,8,p)),c[0]||=n(`div`,{"translate-y":`[2px]`,"font-semibold":``,"font-quicksand":``},[n(`span`,null,`AIRI`)],-1)]),_:1,__:[0]}))}}),h=t(m,[[`__scopeId`,`data-v-2542c9d9`]]);export{h as HeaderLink_default};
\ No newline at end of file
diff --git a/assets/IconAnimation-DRw41kxZ.js b/assets/IconAnimation-LJjhLEIS.js
similarity index 95%
rename from assets/IconAnimation-DRw41kxZ.js
rename to assets/IconAnimation-LJjhLEIS.js
index 8c561025508f44095ffc0d828a02387d5082b099..36a60eaaeacc5511f483c9dd53e9a8492d48b9f4 100644
--- a/assets/IconAnimation-DRw41kxZ.js
+++ b/assets/IconAnimation-LJjhLEIS.js
@@ -1 +1 @@
-import{computed as e,createBaseVNode as t,createElementBlock as n,defineComponent as r,normalizeClass as i,normalizeStyle as a,openBlock as o,ref as s,watch as c}from"./index-Cf-fA00n.js";var l=r({__name:`IconAnimation`,props:{icon:null,iconSize:null,position:null,duration:null,started:{type:Boolean},textColor:null,isReverse:{type:Boolean},zIndex:null},emits:[`animationEnded`],setup(r,{emit:l}){let u=r,d=l,f=s(!1);c(()=>u.started,e=>{e&&requestAnimationFrame(()=>{f.value=!0})});let p=e(()=>({opacity:f.value===u.isReverse?0:1,size:f.value===u.isReverse?u.iconSize:25,position:f.value===u.isReverse?u.position:`calc(50dvw - 12.5rem), calc(50dvh - 12.5rem)`,textColor:f.value===u.isReverse?u.textColor:`text-white`})),m=s([]),h=s(!1);function g(e){m.value.push(e.propertyName),m.value.includes(`color`)&&m.value.includes(`width`)&&m.value.includes(`height`)&&m.value.includes(`transform`)&&(h.value=!0,d(`animationEnded`))}return(e,s)=>(o(),n(`div`,{"pointer-events-none":``,fixed:``,w:`100dvw`,h:`100dvh`,style:a({zIndex:h.value?r.zIndex:void 0})},[t(`div`,{fixed:``,"inset-0":``,"bg-primary-500":``,"transition-opacity":``,"ease-linear":``,style:a({opacity:p.value.opacity,transitionDuration:`${r.duration}ms`})},null,4),t(`div`,{fixed:``,"inset-0":``,"ease-in-out":``,style:a({width:`${p.value.size}rem`,height:`${p.value.size}rem`,transform:`translate(${p.value.position})`,transitionDuration:`${r.duration}ms`}),class:i([p.value.textColor,u.icon,{"transition-all":f.value}]),onTransitionend:g},null,38)],4))}}),u=l;export{u as IconAnimation_default};
\ No newline at end of file
+import{computed as e,createBaseVNode as t,createElementBlock as n,defineComponent as r,normalizeClass as i,normalizeStyle as a,openBlock as o,ref as s,watch as c}from"./index-BSwg6FIo.js";var l=r({__name:`IconAnimation`,props:{icon:null,iconSize:null,position:null,duration:null,started:{type:Boolean},textColor:null,isReverse:{type:Boolean},zIndex:null},emits:[`animationEnded`],setup(r,{emit:l}){let u=r,d=l,f=s(!1);c(()=>u.started,e=>{e&&requestAnimationFrame(()=>{f.value=!0})});let p=e(()=>({opacity:f.value===u.isReverse?0:1,size:f.value===u.isReverse?u.iconSize:25,position:f.value===u.isReverse?u.position:`calc(50dvw - 12.5rem), calc(50dvh - 12.5rem)`,textColor:f.value===u.isReverse?u.textColor:`text-white`})),m=s([]),h=s(!1);function g(e){m.value.push(e.propertyName),m.value.includes(`color`)&&m.value.includes(`width`)&&m.value.includes(`height`)&&m.value.includes(`transform`)&&(h.value=!0,d(`animationEnded`))}return(e,s)=>(o(),n(`div`,{"pointer-events-none":``,fixed:``,w:`100dvw`,h:`100dvh`,style:a({zIndex:h.value?r.zIndex:void 0})},[t(`div`,{fixed:``,"inset-0":``,"bg-primary-500":``,"transition-opacity":``,"ease-linear":``,style:a({opacity:p.value.opacity,transitionDuration:`${r.duration}ms`})},null,4),t(`div`,{fixed:``,"inset-0":``,"ease-in-out":``,style:a({width:`${p.value.size}rem`,height:`${p.value.size}rem`,transform:`translate(${p.value.position})`,transitionDuration:`${r.duration}ms`}),class:i([p.value.textColor,u.icon,{"transition-all":f.value}]),onTransitionend:g},null,38)],4))}}),u=l;export{u as IconAnimation_default};
\ No newline at end of file
diff --git a/assets/InputFile-CO8Q65-Q.js b/assets/InputFile-R2knYJRe.js
similarity index 96%
rename from assets/InputFile-CO8Q65-Q.js
rename to assets/InputFile-R2knYJRe.js
index 3e55ee85368c9fe065a0fc5fa0fb866e4dc05140..15b4459ccd92e3fc8039ced202f20b3a874f0ff2 100644
--- a/assets/InputFile-CO8Q65-Q.js
+++ b/assets/InputFile-R2knYJRe.js
@@ -1 +1 @@
-import{createBaseVNode as e,createElementBlock as t,defineComponent as n,mergeModels as r,normalizeClass as i,openBlock as a,ref as o,refDebounced as s,renderSlot as c,unref as l,useModel as u}from"./index-Cf-fA00n.js";const d=[`accept`,`multiple`],f={key:0,text:`center`,"text-sm":``},p={key:1,text:`center`,"text-sm":``};var m=n({__name:`InputFile`,props:r({accept:null,multiple:{type:Boolean}},{modelValue:{required:!1,default:()=>[]},modelModifiers:{}}),emits:[`update:modelValue`],setup(n){let r=u(n,`modelValue`),m=o(),h=o(!1),g=s(h,150);function _(e){let t=e.target;t.files&&t.files.length>0&&(m.value=t.files[0]),r.value=Array.from(t.files||[]),h.value=!1}return(o,s)=>(a(),t(`label`,{relative:``,class:i([`min-h-[120px] flex flex-col cursor-pointer items-center justify-center rounded-xl p-6`,[l(g)?`border-primary-400 dark:border-primary-600 hover:border-primary-300 dark:hover:border-primary-700`:`border-neutral-200 dark:border-neutral-700 hover:border-primary-300 dark:hover:border-primary-700`,l(g)?`bg-primary-50/5 dark:bg-primary-900/5`:`bg-white/60 dark:bg-black/30 hover:bg-white/80 dark:hover:bg-black/40`]]),border:`dashed 2`,transition:`all duration-300`,"cursor-pointer":``,"opacity-95":``,hover:`scale-100 opacity-100 shadow-md dark:shadow-lg`,onDragover:s[0]||=e=>h.value=!0,onDragleave:s[1]||=e=>h.value=!1},[e(`input`,{type:`file`,accept:n.accept,multiple:n.multiple,"cursor-pointer":``,class:`absolute inset-0 h-full w-full opacity-0`,onChange:_},null,40,d),c(o.$slots,`default`,{isDragging:l(g),firstFile:m.value,files:r.value},()=>[e(`div`,{class:i([`flex flex-col items-center`,[l(g)?`text-primary-500 dark:text-primary-400`:`text-neutral-400 dark:text-neutral-500`]])},[s[2]||=e(`div`,{"i-solar:upload-square-line-duotone":``,"mb-2":``,"text-5xl":``},null,-1),s[3]||=e(`p`,{"font-medium":``,text:`center lg`},` Upload `,-1),l(g)?(a(),t(`p`,f,` Release to upload `)):(a(),t(`p`,p,` Click or drag and drop a file here `))],2)])],34))}}),h=m;export{h as InputFile_default};
\ No newline at end of file
+import{createBaseVNode as e,createElementBlock as t,defineComponent as n,mergeModels as r,normalizeClass as i,openBlock as a,ref as o,refDebounced as s,renderSlot as c,unref as l,useModel as u}from"./index-BSwg6FIo.js";const d=[`accept`,`multiple`],f={key:0,text:`center`,"text-sm":``},p={key:1,text:`center`,"text-sm":``};var m=n({__name:`InputFile`,props:r({accept:null,multiple:{type:Boolean}},{modelValue:{required:!1,default:()=>[]},modelModifiers:{}}),emits:[`update:modelValue`],setup(n){let r=u(n,`modelValue`),m=o(),h=o(!1),g=s(h,150);function _(e){let t=e.target;t.files&&t.files.length>0&&(m.value=t.files[0]),r.value=Array.from(t.files||[]),h.value=!1}return(o,s)=>(a(),t(`label`,{relative:``,class:i([`min-h-[120px] flex flex-col cursor-pointer items-center justify-center rounded-xl p-6`,[l(g)?`border-primary-400 dark:border-primary-600 hover:border-primary-300 dark:hover:border-primary-700`:`border-neutral-200 dark:border-neutral-700 hover:border-primary-300 dark:hover:border-primary-700`,l(g)?`bg-primary-50/5 dark:bg-primary-900/5`:`bg-white/60 dark:bg-black/30 hover:bg-white/80 dark:hover:bg-black/40`]]),border:`dashed 2`,transition:`all duration-300`,"cursor-pointer":``,"opacity-95":``,hover:`scale-100 opacity-100 shadow-md dark:shadow-lg`,onDragover:s[0]||=e=>h.value=!0,onDragleave:s[1]||=e=>h.value=!1},[e(`input`,{type:`file`,accept:n.accept,multiple:n.multiple,"cursor-pointer":``,class:`absolute inset-0 h-full w-full opacity-0`,onChange:_},null,40,d),c(o.$slots,`default`,{isDragging:l(g),firstFile:m.value,files:r.value},()=>[e(`div`,{class:i([`flex flex-col items-center`,[l(g)?`text-primary-500 dark:text-primary-400`:`text-neutral-400 dark:text-neutral-500`]])},[s[2]||=e(`div`,{"i-solar:upload-square-line-duotone":``,"mb-2":``,"text-5xl":``},null,-1),s[3]||=e(`p`,{"font-medium":``,text:`center lg`},` Upload `,-1),l(g)?(a(),t(`p`,f,` Release to upload `)):(a(),t(`p`,p,` Click or drag and drop a file here `))],2)])],34))}}),h=m;export{h as InputFile_default};
\ No newline at end of file
diff --git a/assets/Textarea-BrmCjHkJ.js b/assets/Textarea-CuugR8VV.js
similarity index 84%
rename from assets/Textarea-BrmCjHkJ.js
rename to assets/Textarea-CuugR8VV.js
index db0a387ac19eb145c28f66591e8ffecf220c4d87..e222e108c533b083531da7d029d3c6e0fd98aa09 100644
--- a/assets/Textarea-BrmCjHkJ.js
+++ b/assets/Textarea-CuugR8VV.js
@@ -1 +1 @@
-import{createBlock as e,defineComponent as t,openBlock as n,useModel as r}from"./index-Cf-fA00n.js";import{Basic_default as i}from"./Basic-CaUhNBQ_.js";var a=t({__name:`Textarea`,props:{modelValue:{default:``},modelModifiers:{}},emits:[`update:modelValue`],setup(t){let a=r(t,`modelValue`);return(t,r)=>(n(),e(i,{modelValue:a.value,"onUpdate:modelValue":r[0]||=e=>a.value=e,border:`focus:primary-300 dark:focus:primary-400/50 2 solid neutral-100 dark:neutral-900`,transition:`all duration-200 ease-in-out`,text:`disabled:neutral-400 dark:disabled:neutral-600`,cursor:`disabled:not-allowed`,"w-full":``,"rounded-lg":``,"px-2":``,"py-1":``,"text-sm":``,"outline-none":``,shadow:`sm`,bg:`neutral-50 dark:neutral-950 focus:neutral-50 dark:focus:neutral-900`},null,8,[`modelValue`]))}}),o=a;export{o as Textarea_default};
\ No newline at end of file
+import{createBlock as e,defineComponent as t,openBlock as n,useModel as r}from"./index-BSwg6FIo.js";import{Basic_default as i}from"./Basic-BGRWPjtG.js";var a=t({__name:`Textarea`,props:{modelValue:{default:``},modelModifiers:{}},emits:[`update:modelValue`],setup(t){let a=r(t,`modelValue`);return(t,r)=>(n(),e(i,{modelValue:a.value,"onUpdate:modelValue":r[0]||=e=>a.value=e,border:`focus:primary-300 dark:focus:primary-400/50 2 solid neutral-100 dark:neutral-900`,transition:`all duration-200 ease-in-out`,text:`disabled:neutral-400 dark:disabled:neutral-600`,cursor:`disabled:not-allowed`,"w-full":``,"rounded-lg":``,"px-2":``,"py-1":``,"text-sm":``,"outline-none":``,shadow:`sm`,bg:`neutral-50 dark:neutral-950 focus:neutral-50 dark:focus:neutral-900`},null,8,[`modelValue`]))}}),o=a;export{o as Textarea_default};
\ No newline at end of file
diff --git a/assets/_...all_-DNFpqeuX.js b/assets/_...all_-B_osODv_.js
similarity index 72%
rename from assets/_...all_-DNFpqeuX.js
rename to assets/_...all_-B_osODv_.js
index a51a0817e93d21070e2dc408b1a89422ecc3f7fd..8e32378b824f4f6a34ca36248e2ac1f21288115a 100644
--- a/assets/_...all_-DNFpqeuX.js
+++ b/assets/_...all_-B_osODv_.js
@@ -1 +1 @@
-import{__plugin_vue_export_helper_default as e,createElementBlock as t,openBlock as n}from"./index-Cf-fA00n.js";const r={};function i(e,r){return n(),t(`div`,null,` 404 - Page not found `)}var a=e(r,[[`render`,i]]);export{a as default};
\ No newline at end of file
+import{__plugin_vue_export_helper_default as e,createElementBlock as t,openBlock as n}from"./index-BSwg6FIo.js";const r={};function i(e,r){return n(),t(`div`,null,` 404 - Page not found `)}var a=e(r,[[`render`,i]]);export{a as default};
\ No newline at end of file
diff --git a/assets/__vite-browser-external-Cbx_usA-.js b/assets/__vite-browser-external-Cbx_usA-.js
deleted file mode 100644
index 0b2da0cc314c2c5502311af42b8e63b8f640132b..0000000000000000000000000000000000000000
--- a/assets/__vite-browser-external-Cbx_usA-.js
+++ /dev/null
@@ -1 +0,0 @@
-import{__commonJSMin as e}from"./index-Cf-fA00n.js";var t=e((exports,t)=>{t.exports={}});export default t();
\ No newline at end of file
diff --git a/assets/__vite-browser-external-CoPuN2cl.js b/assets/__vite-browser-external-CoPuN2cl.js
new file mode 100644
index 0000000000000000000000000000000000000000..fae13eaadd5cec23bcf56f8d1f75ad680d937129
--- /dev/null
+++ b/assets/__vite-browser-external-CoPuN2cl.js
@@ -0,0 +1 @@
+import{__commonJSMin as e}from"./index-BSwg6FIo.js";var t=e((exports,t)=>{t.exports={}});export{t as require___vite_browser_external};
\ No newline at end of file
diff --git a/assets/__vite-browser-external-CubORAmj.js b/assets/__vite-browser-external-CubORAmj.js
new file mode 100644
index 0000000000000000000000000000000000000000..0f683d3a4d6e5b9a279b829786d7762f6a3659ff
--- /dev/null
+++ b/assets/__vite-browser-external-CubORAmj.js
@@ -0,0 +1 @@
+import{require___vite_browser_external as e}from"./__vite-browser-external-CoPuN2cl.js";export default e();
\ No newline at end of file
diff --git a/assets/__vite-optional-peer-dep_effect_xsschema-DJmQZR04.js b/assets/__vite-optional-peer-dep_effect_xsschema-CSjxbBMs.js
similarity index 100%
rename from assets/__vite-optional-peer-dep_effect_xsschema-DJmQZR04.js
rename to assets/__vite-optional-peer-dep_effect_xsschema-CSjxbBMs.js
diff --git a/assets/__vite-optional-peer-dep_sury_xsschema-B_lOmKXZ.js b/assets/__vite-optional-peer-dep_sury_xsschema-CwAhyDn8.js
similarity index 100%
rename from assets/__vite-optional-peer-dep_sury_xsschema-B_lOmKXZ.js
rename to assets/__vite-optional-peer-dep_sury_xsschema-CwAhyDn8.js
diff --git a/assets/airi-card-DlU_VhGi.js b/assets/airi-card-DlU_VhGi.js
deleted file mode 100644
index 8ad38f30741783cfc1a0e9e821daf3573969b3fe..0000000000000000000000000000000000000000
--- a/assets/airi-card-DlU_VhGi.js
+++ /dev/null
@@ -1 +0,0 @@
-import{Fragment as e,computed as t,createBaseVNode as n,createBlock as r,createCommentVNode as i,createElementBlock as a,createVNode as o,defineComponent as s,normalizeClass as c,openBlock as l,ref as u,renderList as d,resolveDirective as ee,storeToRefs as f,toDisplayString as p,unref as m,useI18n as h,vModelText as te,watch as ne,withCtx as re,withDirectives as g}from"./index-Cf-fA00n.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import{useAiriCardStore as ie}from"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import{Select_default as ae}from"./src-BdFbE9Gc.js";import"./dist-DbabDsG-.js";import{InputFile_default as _}from"./InputFile-CO8Q65-Q.js";import"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{route_block_default as v}from"./route-block-BOaMwwtm.js";import{CardCreate_default as y}from"./CardCreate-C3flmtgV.js";import{CardCreationDialog_default as b}from"./CardCreationDialog-lFLHJBD8.js";import{DeleteCardDialog_default as x}from"./DeleteCardDialog-5OZGLqwk.js";import{CardDetailDialog_default as S}from"./CardDetailDialog-Cggh12Lo.js";import{CardListItem_default as oe}from"./CardListItem-Bp4LX3UR.js";const se={"rounded-xl":``,"p-4":``,flex:`~ col gap-4`},ce={flex:`~ row`,"flex-wrap":``,"items-center":``,"justify-between":``,"gap-4":``},C={class:`relative min-w-[200px] flex-1`,"inline-flex":`~`,"w-full":``,"items-center":``},w=[`placeholder`],T={class:`relative flex flex-row justify-start gap-2 lg:flex-col`},E={class:`top-[-32px] whitespace-nowrap text-sm text-neutral-500 leading-10 lg:absolute dark:text-neutral-400`},D={key:0,flex:``,"flex-col":``,"items-center":``},O={"font-medium":``,text:`neutral-600 dark:neutral-300`},k={text:`neutral-500 dark:neutral-400`,"mt-2":``,"text-sm":``},A={key:1,flex:``,"flex-col":``,"items-center":``},j={"font-medium":``,text:`primary-600 dark:primary-300`},M={key:1,class:`col-span-full rounded-xl p-8 text-center`,border:`~ neutral-200/50 dark:neutral-700/30`,bg:`neutral-50/50 dark:neutral-900/50`},N={key:2,class:`col-span-full flex items-center gap-3 border-2 border-amber-200 rounded-xl bg-amber-50/80 p-4 dark:border-amber-800 dark:bg-amber-900/30`},P={class:`flex flex-col`},F={class:`font-medium`},I={class:`text-sm text-amber-600 dark:text-amber-400`},L={text:`neutral-200/50 dark:neutral-600/20`,"pointer-events-none":``,fixed:``,top:`[calc(100dvh-15rem)]`,"bottom-0":``,"right--5":``,"z--1":``,initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":``,flex:``,"items-center":``,"justify-center":``};var R=s({__name:`index`,setup(s){let{t:v}=h(),R=ie(),{addCard:z,removeCard:B}=R,{cards:V,activeCardId:H}=f(R),U=u(``),W=u(!1),G=u(!1),K=u(``),q=u(`nameAsc`),J=u([]);ne(J,async e=>{let t=e[0];if(t)try{let e=await t.text(),n=JSON.parse(e);U.value=z(n),W.value=!0}catch(e){console.error(`Error processing card file:`,e)}});let Y=t(()=>Array.from(V.value.entries()).map(([e,t])=>({id:e,name:t.name,description:t.description}))),le=t(()=>{if(!K.value)return Y.value;let e=K.value.toLowerCase();return Y.value.filter(t=>t.name.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))}),X=t(()=>{let e=[...le.value];return q.value===`nameAsc`?e.sort((e,t)=>e.name.localeCompare(t.name)):q.value===`nameDesc`?e.sort((e,t)=>t.name.localeCompare(e.name)):q.value===`recent`?e.sort((e,t)=>t.id.localeCompare(e.id)):e}),Z=u(!1),Q=u(null);function ue(){Q.value&&(B(Q.value),Q.value=null,Z.value=!1)}function de(e){Q.value=e,Z.value=!0}function fe(e){U.value=e,W.value=!0}function pe(){G.value=!0}function me(e){H.value=e}function he(e){let t=V.value.get(e);return t?.version||`1.0.0`}function $(e,t){var n,r,i;let a=V.value.get(e);if(!a||!(!((n=a.extensions)==null||(n=n.airi)==null)&&n.modules))return`default`;let o=a.extensions.airi.modules;return t===`consciousness`?(r=o.consciousness)?.model&&o.consciousness.model.split(`-`).pop()||`default`:t===`voice`&&(i=o.speech)?.voice_id||`default`}return(t,s)=>{var u;let f=ee(`motion`);return l(),a(e,null,[n(`div`,se,[n(`div`,ce,[n(`div`,C,[s[7]||=n(`div`,{class:`pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3`},[n(`div`,{"i-solar:magnifer-line-duotone":``,class:`text-neutral-500 dark:text-neutral-400`})],-1),g(n(`input`,{"onUpdate:modelValue":s[0]||=e=>K.value=e,type:`search`,class:`w-full rounded-xl p-2.5 pl-10 text-sm outline-none`,border:`focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800`,transition:`all duration-200 ease-in-out`,bg:`white dark:neutral-900`,placeholder:m(v)(`settings.pages.card.search`)},null,8,w),[[te,K.value]])]),n(`div`,T,[n(`div`,E,p(m(v)(`settings.pages.card.sort_by`))+`: `,1),o(m(ae),{modelValue:q.value,"onUpdate:modelValue":s[1]||=e=>q.value=e,options:[{value:`nameAsc`,label:m(v)(`settings.pages.card.name_asc`)},{value:`nameDesc`,label:m(v)(`settings.pages.card.name_desc`)},{value:`recent`,label:m(v)(`settings.pages.card.recent`)}],placeholder:`Select sort option`,class:`min-w-[150px]`},null,8,[`modelValue`,`options`])])]),n(`div`,{class:c([`mt-4`,{"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4 grid-auto-rows-[minmax(min-content,max-content)] grid-auto-flow-dense sm:grid-cols-[repeat(auto-fill,minmax(240px,1fr))] sm:gap-5 md:grid-cols-[repeat(auto-fill,minmax(220px,1fr))] lg:grid-cols-[repeat(auto-fill,minmax(250px,1fr))]":m(V).size>0}])},[o(m(_),{modelValue:J.value,"onUpdate:modelValue":s[2]||=e=>J.value=e,accept:`*.json`},{default:re(({isDragging:e})=>[e?(l(),a(`div`,A,[s[9]||=n(`div`,{"i-solar:upload-minimalistic-bold":``,class:`mb-2 text-5xl text-primary-500 dark:text-primary-400`},null,-1),n(`p`,j,p(m(v)(`settings.pages.card.drop_here`)),1)])):(l(),a(`div`,D,[s[8]||=n(`div`,{"i-solar:upload-square-line-duotone":``,"mb-4":``,"text-5xl":``,text:`neutral-400 dark:neutral-500`},null,-1),n(`p`,O,p(m(v)(`settings.pages.card.upload`)),1),n(`p`,k,p(m(v)(`settings.pages.card.upload_desc`)),1)]))]),_:1},8,[`modelValue`]),o(y,{onClick:pe}),m(V).size>0?(l(!0),a(e,{key:0},d(X.value,e=>(l(),r(oe,{id:e.id,key:e.id,name:e.name,description:e.description,"is-active":e.id===m(H),"is-selected":e.id===U.value&&W.value,version:he(e.id),"consciousness-model":$(e.id,`consciousness`),"voice-model":$(e.id,`voice`),onSelect:t=>fe(e.id),onActivate:t=>me(e.id),onDelete:t=>de(e.id)},null,8,[`id`,`name`,`description`,`is-active`,`is-selected`,`version`,`consciousness-model`,`voice-model`,`onSelect`,`onActivate`,`onDelete`]))),128)):i(``,!0),m(V).size===0?(l(),a(`div`,M,[s[10]||=n(`div`,{"i-solar:card-search-broken":``,"mx-auto":``,"mb-3":``,"text-6xl":``,"text-neutral-400":``},null,-1),n(`p`,null,p(m(v)(`settings.pages.card.no_cards`)),1)])):i(``,!0),K.value&&X.value.length===0?(l(),a(`div`,N,[s[11]||=n(`div`,{"i-solar:info-circle-line-duotone":``,class:`text-2xl text-amber-500 dark:text-amber-400`},null,-1),n(`div`,P,[n(`span`,F,p(m(v)(`settings.pages.card.no_results`)),1),n(`span`,I,p(m(v)(`settings.pages.card.try_different_search`)),1)])])):i(``,!0)],2)]),o(x,{modelValue:Z.value,"onUpdate:modelValue":s[3]||=e=>Z.value=e,"card-name":Q.value?(u=m(R).getCard(Q.value))?.name:``,onConfirm:ue,onCancel:s[4]||=e=>Q.value=null},null,8,[`modelValue`,`card-name`]),o(S,{modelValue:W.value,"onUpdate:modelValue":s[5]||=e=>W.value=e,"card-id":U.value},null,8,[`modelValue`,`card-id`]),o(b,{modelValue:G.value,"onUpdate:modelValue":s[6]||=e=>G.value=e},null,8,[`modelValue`]),g((l(),a(`div`,L,s[12]||=[n(`div`,{text:`60`,"i-solar:emoji-funny-square-bold-duotone":``},null,-1)])),[[f]])],64)}}});typeof v==`function`&&v(R);var z=R;export{z as default};
\ No newline at end of file
diff --git a/assets/airi-card-gp_HXphd.js b/assets/airi-card-gp_HXphd.js
new file mode 100644
index 0000000000000000000000000000000000000000..c8787ef609eccaa3b83ad01290be8581f253592d
--- /dev/null
+++ b/assets/airi-card-gp_HXphd.js
@@ -0,0 +1 @@
+import{Fragment as e,computed as t,createBaseVNode as n,createBlock as r,createCommentVNode as i,createElementBlock as a,createVNode as o,defineComponent as s,normalizeClass as c,openBlock as l,ref as u,renderList as d,resolveDirective as ee,storeToRefs as f,toDisplayString as p,unref as m,useI18n as h,vModelText as te,watch as ne,withCtx as re,withDirectives as g}from"./index-BSwg6FIo.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import{useAiriCardStore as ie}from"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import{Select_default as ae}from"./src-CX9nVT7I.js";import"./dist-BziUufTI.js";import{InputFile_default as _}from"./InputFile-R2knYJRe.js";import"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{route_block_default as v}from"./route-block-CC3cgg4Q.js";import{CardCreate_default as y}from"./CardCreate-D42uwy43.js";import{CardCreationDialog_default as b}from"./CardCreationDialog-BsyNmiYp.js";import{DeleteCardDialog_default as x}from"./DeleteCardDialog-DFZll3ve.js";import{CardDetailDialog_default as S}from"./CardDetailDialog-BCybvJ8-.js";import{CardListItem_default as oe}from"./CardListItem-C9XT5lUo.js";const se={"rounded-xl":``,"p-4":``,flex:`~ col gap-4`},ce={flex:`~ row`,"flex-wrap":``,"items-center":``,"justify-between":``,"gap-4":``},C={class:`relative min-w-[200px] flex-1`,"inline-flex":`~`,"w-full":``,"items-center":``},w=[`placeholder`],T={class:`relative flex flex-row justify-start gap-2 lg:flex-col`},E={class:`top-[-32px] whitespace-nowrap text-sm text-neutral-500 leading-10 lg:absolute dark:text-neutral-400`},D={key:0,flex:``,"flex-col":``,"items-center":``},O={"font-medium":``,text:`neutral-600 dark:neutral-300`},k={text:`neutral-500 dark:neutral-400`,"mt-2":``,"text-sm":``},A={key:1,flex:``,"flex-col":``,"items-center":``},j={"font-medium":``,text:`primary-600 dark:primary-300`},M={key:1,class:`col-span-full rounded-xl p-8 text-center`,border:`~ neutral-200/50 dark:neutral-700/30`,bg:`neutral-50/50 dark:neutral-900/50`},N={key:2,class:`col-span-full flex items-center gap-3 border-2 border-amber-200 rounded-xl bg-amber-50/80 p-4 dark:border-amber-800 dark:bg-amber-900/30`},P={class:`flex flex-col`},F={class:`font-medium`},I={class:`text-sm text-amber-600 dark:text-amber-400`},L={text:`neutral-200/50 dark:neutral-600/20`,"pointer-events-none":``,fixed:``,top:`[calc(100dvh-15rem)]`,"bottom-0":``,"right--5":``,"z--1":``,initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":``,flex:``,"items-center":``,"justify-center":``};var R=s({__name:`index`,setup(s){let{t:v}=h(),R=ie(),{addCard:z,removeCard:B}=R,{cards:V,activeCardId:H}=f(R),U=u(``),W=u(!1),G=u(!1),K=u(``),q=u(`nameAsc`),J=u([]);ne(J,async e=>{let t=e[0];if(t)try{let e=await t.text(),n=JSON.parse(e);U.value=z(n),W.value=!0}catch(e){console.error(`Error processing card file:`,e)}});let Y=t(()=>Array.from(V.value.entries()).map(([e,t])=>({id:e,name:t.name,description:t.description}))),le=t(()=>{if(!K.value)return Y.value;let e=K.value.toLowerCase();return Y.value.filter(t=>t.name.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))}),X=t(()=>{let e=[...le.value];return q.value===`nameAsc`?e.sort((e,t)=>e.name.localeCompare(t.name)):q.value===`nameDesc`?e.sort((e,t)=>t.name.localeCompare(e.name)):q.value===`recent`?e.sort((e,t)=>t.id.localeCompare(e.id)):e}),Z=u(!1),Q=u(null);function ue(){Q.value&&(B(Q.value),Q.value=null,Z.value=!1)}function de(e){Q.value=e,Z.value=!0}function fe(e){U.value=e,W.value=!0}function pe(){G.value=!0}function me(e){H.value=e}function he(e){let t=V.value.get(e);return t?.version||`1.0.0`}function $(e,t){var n,r,i;let a=V.value.get(e);if(!a||!(!((n=a.extensions)==null||(n=n.airi)==null)&&n.modules))return`default`;let o=a.extensions.airi.modules;return t===`consciousness`?(r=o.consciousness)?.model&&o.consciousness.model.split(`-`).pop()||`default`:t===`voice`&&(i=o.speech)?.voice_id||`default`}return(t,s)=>{var u;let f=ee(`motion`);return l(),a(e,null,[n(`div`,se,[n(`div`,ce,[n(`div`,C,[s[7]||=n(`div`,{class:`pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3`},[n(`div`,{"i-solar:magnifer-line-duotone":``,class:`text-neutral-500 dark:text-neutral-400`})],-1),g(n(`input`,{"onUpdate:modelValue":s[0]||=e=>K.value=e,type:`search`,class:`w-full rounded-xl p-2.5 pl-10 text-sm outline-none`,border:`focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800`,transition:`all duration-200 ease-in-out`,bg:`white dark:neutral-900`,placeholder:m(v)(`settings.pages.card.search`)},null,8,w),[[te,K.value]])]),n(`div`,T,[n(`div`,E,p(m(v)(`settings.pages.card.sort_by`))+`: `,1),o(m(ae),{modelValue:q.value,"onUpdate:modelValue":s[1]||=e=>q.value=e,options:[{value:`nameAsc`,label:m(v)(`settings.pages.card.name_asc`)},{value:`nameDesc`,label:m(v)(`settings.pages.card.name_desc`)},{value:`recent`,label:m(v)(`settings.pages.card.recent`)}],placeholder:`Select sort option`,class:`min-w-[150px]`},null,8,[`modelValue`,`options`])])]),n(`div`,{class:c([`mt-4`,{"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4 grid-auto-rows-[minmax(min-content,max-content)] grid-auto-flow-dense sm:grid-cols-[repeat(auto-fill,minmax(240px,1fr))] sm:gap-5 md:grid-cols-[repeat(auto-fill,minmax(220px,1fr))] lg:grid-cols-[repeat(auto-fill,minmax(250px,1fr))]":m(V).size>0}])},[o(m(_),{modelValue:J.value,"onUpdate:modelValue":s[2]||=e=>J.value=e,accept:`*.json`},{default:re(({isDragging:e})=>[e?(l(),a(`div`,A,[s[9]||=n(`div`,{"i-solar:upload-minimalistic-bold":``,class:`mb-2 text-5xl text-primary-500 dark:text-primary-400`},null,-1),n(`p`,j,p(m(v)(`settings.pages.card.drop_here`)),1)])):(l(),a(`div`,D,[s[8]||=n(`div`,{"i-solar:upload-square-line-duotone":``,"mb-4":``,"text-5xl":``,text:`neutral-400 dark:neutral-500`},null,-1),n(`p`,O,p(m(v)(`settings.pages.card.upload`)),1),n(`p`,k,p(m(v)(`settings.pages.card.upload_desc`)),1)]))]),_:1},8,[`modelValue`]),o(y,{onClick:pe}),m(V).size>0?(l(!0),a(e,{key:0},d(X.value,e=>(l(),r(oe,{id:e.id,key:e.id,name:e.name,description:e.description,"is-active":e.id===m(H),"is-selected":e.id===U.value&&W.value,version:he(e.id),"consciousness-model":$(e.id,`consciousness`),"voice-model":$(e.id,`voice`),onSelect:t=>fe(e.id),onActivate:t=>me(e.id),onDelete:t=>de(e.id)},null,8,[`id`,`name`,`description`,`is-active`,`is-selected`,`version`,`consciousness-model`,`voice-model`,`onSelect`,`onActivate`,`onDelete`]))),128)):i(``,!0),m(V).size===0?(l(),a(`div`,M,[s[10]||=n(`div`,{"i-solar:card-search-broken":``,"mx-auto":``,"mb-3":``,"text-6xl":``,"text-neutral-400":``},null,-1),n(`p`,null,p(m(v)(`settings.pages.card.no_cards`)),1)])):i(``,!0),K.value&&X.value.length===0?(l(),a(`div`,N,[s[11]||=n(`div`,{"i-solar:info-circle-line-duotone":``,class:`text-2xl text-amber-500 dark:text-amber-400`},null,-1),n(`div`,P,[n(`span`,F,p(m(v)(`settings.pages.card.no_results`)),1),n(`span`,I,p(m(v)(`settings.pages.card.try_different_search`)),1)])])):i(``,!0)],2)]),o(x,{modelValue:Z.value,"onUpdate:modelValue":s[3]||=e=>Z.value=e,"card-name":Q.value?(u=m(R).getCard(Q.value))?.name:``,onConfirm:ue,onCancel:s[4]||=e=>Q.value=null},null,8,[`modelValue`,`card-name`]),o(S,{modelValue:W.value,"onUpdate:modelValue":s[5]||=e=>W.value=e,"card-id":U.value},null,8,[`modelValue`,`card-id`]),o(b,{modelValue:G.value,"onUpdate:modelValue":s[6]||=e=>G.value=e},null,8,[`modelValue`]),g((l(),a(`div`,L,s[12]||=[n(`div`,{text:`60`,"i-solar:emoji-funny-square-bold-duotone":``},null,-1)])),[[f]])],64)}}});typeof v==`function`&&v(R);var z=R;export{z as default};
\ No newline at end of file
diff --git a/assets/alibaba-cloud-model-studio-BPpbwzjz.js b/assets/alibaba-cloud-model-studio-BPpbwzjz.js
new file mode 100644
index 0000000000000000000000000000000000000000..74084cc63d8b7dde4edfa04e50591924ba666f7f
--- /dev/null
+++ b/assets/alibaba-cloud-model-studio-BPpbwzjz.js
@@ -0,0 +1 @@
+import{computed as e,createBaseVNode as t,createBlock as n,createVNode as r,defineComponent as i,onMounted as a,openBlock as o,ref as s,storeToRefs as c,unref as l,useI18n as u,watch as d,withCtx as f}from"./index-BSwg6FIo.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import{useProvidersStore as p,useSpeechStore as m}from"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import{FieldRange_default as h}from"./src-CX9nVT7I.js";import{SpeechPlayground_default as g,SpeechProviderSettings_default as _}from"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{route_block_default as v}from"./route-block-CC3cgg4Q.js";const y={flex:`~ col gap-4`},b=`alibaba-cloud-model-studio`,x=`cosyvoice-v1`;var S=i({__name:`alibaba-cloud-model-studio`,setup(i){let v={speed:1},S=s(0),C=s(1),w=s(0),T=m(),E=p(),{providers:D}=c(E),{t:O}=u(),k=e(()=>{var e;return!!(e=D.value[b])?.apiKey}),A=e(()=>T.availableVoices[b]||[]);async function j(e,t,n){let r=E.getProviderInstance(b);if(!r)throw Error(`Failed to initialize speech provider`);let i=E.getProviderConfig(b),a=i.model||x;return await T.speech(r,a,e,t,{...i,...v})}return a(async()=>{let e=E.getProviderConfig(b),t=E.getProviderMetadata(b);await t.validators.validateProviderConfig(e)?await T.loadVoicesForProvider(b):console.error(`Failed to validate provider config`,e)}),d(S,async()=>{let e=E.getProviderConfig(b);e.pitch=S.value}),d(C,async()=>{let e=E.getProviderConfig(b);e.speed=C.value}),d(w,async()=>{let e=E.getProviderConfig(b);e.volume=w.value}),d(D,async()=>{let e=E.getProviderConfig(b),t=E.getProviderMetadata(b);await t.validators.validateProviderConfig(e)?await T.loadVoicesForProvider(b):console.error(`Failed to validate provider config`,e)},{immediate:!0}),(e,i)=>(o(),n(l(_),{"provider-id":b,"default-model":x,"additional-settings":v},{"voice-settings":f(()=>[t(`div`,y,[r(l(h),{modelValue:S.value,"onUpdate:modelValue":i[0]||=e=>S.value=e,label:l(O)(`settings.pages.providers.provider.common.fields.field.pitch.label`),description:l(O)(`settings.pages.providers.provider.common.fields.field.pitch.description`),min:-100,max:100,step:1,"format-value":e=>`${e}%`},null,8,[`modelValue`,`label`,`description`,`format-value`]),r(l(h),{modelValue:C.value,"onUpdate:modelValue":i[1]||=e=>C.value=e,label:l(O)(`settings.pages.providers.provider.common.fields.field.speed.label`),description:l(O)(`settings.pages.providers.provider.common.fields.field.speed.description`),min:.5,max:2,step:.01},null,8,[`modelValue`,`label`,`description`]),r(l(h),{modelValue:w.value,"onUpdate:modelValue":i[2]||=e=>w.value=e,label:l(O)(`settings.pages.providers.provider.common.fields.field.volume.label`),description:l(O)(`settings.pages.providers.provider.common.fields.field.volume.description`),min:-100,max:100,step:1,"format-value":e=>`${e}%`},null,8,[`modelValue`,`label`,`description`,`format-value`])])]),playground:f(()=>[r(l(g),{"available-voices":A.value,"generate-speech":j,"api-key-configured":k.value,"default-text":`Hello! This is a test of the ElevenLabs voice synthesis.`},null,8,[`available-voices`,`api-key-configured`])]),_:1}))}});typeof v==`function`&&v(S);var C=S;export{C as default};
\ No newline at end of file
diff --git a/assets/alibaba-cloud-model-studio-KiHuJ042.js b/assets/alibaba-cloud-model-studio-KiHuJ042.js
deleted file mode 100644
index 0bbd16b204f0ebce754da5d8f9dc5da193790aee..0000000000000000000000000000000000000000
--- a/assets/alibaba-cloud-model-studio-KiHuJ042.js
+++ /dev/null
@@ -1 +0,0 @@
-import{computed as e,createBaseVNode as t,createBlock as n,createVNode as r,defineComponent as i,onMounted as a,openBlock as o,ref as s,storeToRefs as c,unref as l,useI18n as u,watch as d,withCtx as f}from"./index-Cf-fA00n.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import{useProvidersStore as p,useSpeechStore as m}from"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import{FieldRange_default as h}from"./src-BdFbE9Gc.js";import{SpeechPlayground_default as g,SpeechProviderSettings_default as _}from"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{route_block_default as v}from"./route-block-BOaMwwtm.js";const y={flex:`~ col gap-4`},b=`alibaba-cloud-model-studio`,x=`cosyvoice-v1`;var S=i({__name:`alibaba-cloud-model-studio`,setup(i){let v={speed:1},S=s(0),C=s(1),w=s(0),T=m(),E=p(),{providers:D}=c(E),{t:O}=u(),k=e(()=>{var e;return!!(e=D.value[b])?.apiKey}),A=e(()=>T.availableVoices[b]||[]);async function j(e,t,n){let r=E.getProviderInstance(b);if(!r)throw Error(`Failed to initialize speech provider`);let i=E.getProviderConfig(b),a=i.model||x;return await T.speech(r,a,e,t,{...i,...v})}return a(async()=>{let e=E.getProviderConfig(b),t=E.getProviderMetadata(b);await t.validators.validateProviderConfig(e)?await T.loadVoicesForProvider(b):console.error(`Failed to validate provider config`,e)}),d(S,async()=>{let e=E.getProviderConfig(b);e.pitch=S.value}),d(C,async()=>{let e=E.getProviderConfig(b);e.speed=C.value}),d(w,async()=>{let e=E.getProviderConfig(b);e.volume=w.value}),d(D,async()=>{let e=E.getProviderConfig(b),t=E.getProviderMetadata(b);await t.validators.validateProviderConfig(e)?await T.loadVoicesForProvider(b):console.error(`Failed to validate provider config`,e)},{immediate:!0}),(e,i)=>(o(),n(l(_),{"provider-id":b,"default-model":x,"additional-settings":v},{"voice-settings":f(()=>[t(`div`,y,[r(l(h),{modelValue:S.value,"onUpdate:modelValue":i[0]||=e=>S.value=e,label:l(O)(`settings.pages.providers.provider.common.fields.field.pitch.label`),description:l(O)(`settings.pages.providers.provider.common.fields.field.pitch.description`),min:-100,max:100,step:1,"format-value":e=>`${e}%`},null,8,[`modelValue`,`label`,`description`,`format-value`]),r(l(h),{modelValue:C.value,"onUpdate:modelValue":i[1]||=e=>C.value=e,label:l(O)(`settings.pages.providers.provider.common.fields.field.speed.label`),description:l(O)(`settings.pages.providers.provider.common.fields.field.speed.description`),min:.5,max:2,step:.01},null,8,[`modelValue`,`label`,`description`]),r(l(h),{modelValue:w.value,"onUpdate:modelValue":i[2]||=e=>w.value=e,label:l(O)(`settings.pages.providers.provider.common.fields.field.volume.label`),description:l(O)(`settings.pages.providers.provider.common.fields.field.volume.description`),min:-100,max:100,step:1,"format-value":e=>`${e}%`},null,8,[`modelValue`,`label`,`description`,`format-value`])])]),playground:f(()=>[r(l(g),{"available-voices":A.value,"generate-speech":j,"api-key-configured":k.value,"default-text":`Hello! This is a test of the ElevenLabs voice synthesis.`},null,8,[`available-voices`,`api-key-configured`])]),_:1}))}});typeof v==`function`&&v(S);var C=S;export{C as default};
\ No newline at end of file
diff --git a/assets/anthropic-Cr1OFPlt.js b/assets/anthropic-Cr1OFPlt.js
deleted file mode 100644
index 4e7821b50c9056aa71326a7aaab0ee22d8275229..0000000000000000000000000000000000000000
--- a/assets/anthropic-Cr1OFPlt.js
+++ /dev/null
@@ -1 +0,0 @@
-import{computed as e,createBaseVNode as t,createBlock as n,createTextVNode as r,createVNode as i,defineComponent as a,onMounted as o,openBlock as s,storeToRefs as c,unref as l,useI18n as u,useRouter as d,watch as f,withCtx as p}from"./index-Cf-fA00n.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import{useProvidersStore as m}from"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import{ProviderAdvancedSettings_default as h,ProviderApiKeyInput_default as g,ProviderBaseUrlInput_default as _,ProviderBasicSettings_default as v,ProviderSettingsContainer_default as y,ProviderSettingsLayout_default as b}from"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{route_block_default as x}from"./route-block-BOaMwwtm.js";const S=`anthropic`;var C=a({__name:`anthropic`,setup(a){let{t:x}=u(),C=d(),w=m(),{providers:T}=c(w),E=e(()=>w.getProviderMetadata(S)),D=e({get:()=>{var e;return(e=T.value[S])?.apiKey||``},set:e=>{T.value[S]||(T.value[S]={}),T.value[S].apiKey=e}}),O=e({get:()=>{var e;return(e=T.value[S])?.baseUrl||`https://api.anthropic.com/v1/`},set:e=>{T.value[S]||(T.value[S]={}),T.value[S].baseUrl=e}});o(()=>{var e,t;T.value[S]||(T.value[S]={baseUrl:`https://api.anthropic.com/v1/`}),D.value=(e=T.value[S])?.apiKey||``,O.value=(t=T.value[S])?.baseUrl||`https://api.anthropic.com/v1/`}),f([D,O],()=>{T.value[S]={...T.value[S],apiKey:D.value,baseUrl:O.value||`https://api.anthropic.com/v1/`}});function k(){T.value[S]={baseUrl:`https://api.anthropic.com/v1/`}}return(e,a)=>{var o,c;return s(),n(l(b),{"provider-name":(o=E.value)?.localizedName||`Anthropic | Claude`,"provider-icon":(c=E.value)?.icon,"on-back":()=>l(C).back()},{default:p(()=>[a[2]||=t(`div`,{bg:`orange-50 dark:orange-900/20`,"rounded-xl":``,"p-4":``,flex:`~ col gap-3`},[t(`h2`,{"text-xl":``,"font-semibold":``,text:`orange-700 dark:orange-500`},` Before you start `),t(`p`,null,[r(` While Anthropic recently did announce that they are having a beta support for OpenAI SDK compatibility `),t(`a`,{underline:``,href:`https://docs.anthropic.com/en/api/openai-sdk`},`(you can read more here)`),r(`, but due to the implementation details comes with `),t(`a`,{underline:``,href:`https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS`},`CORS`),r(` restrictions which not aligned with the OpenAI SDK, it's currently not possible to use this provider in the browser. `)]),t(`p`,null,[r(` If you do need to use this provider, you will need a dedicated proxy backend like a Serverless Function running on `),t(`a`,{underline:``,href:`https://workers.cloudflare.com/`},`Cloudflare Workers`),r(` or some CORS bypassing services to bypass the CORS restrictions. `)])],-1),i(l(y),null,{default:p(()=>[i(l(v),{title:l(x)(`settings.pages.providers.common.section.basic.title`),description:l(x)(`settings.pages.providers.common.section.basic.description`),"on-reset":k},{default:p(()=>{var e;return[i(l(g),{modelValue:D.value,"onUpdate:modelValue":a[0]||=e=>D.value=e,"provider-name":(e=E.value)?.localizedName||`Anthropic`,placeholder:`sk-...`},null,8,[`modelValue`,`provider-name`])]}),_:1},8,[`title`,`description`]),i(l(h),{title:l(x)(`settings.pages.providers.common.section.advanced.title`)},{default:p(()=>[i(l(_),{modelValue:O.value,"onUpdate:modelValue":a[1]||=e=>O.value=e,placeholder:`https://api.anthropic.com/v1/`},null,8,[`modelValue`])]),_:1},8,[`title`])]),_:1})]),_:1,__:[2]},8,[`provider-name`,`provider-icon`,`on-back`])}}});typeof x==`function`&&x(C);var w=C;export{w as default};
\ No newline at end of file
diff --git a/assets/anthropic-D6Mj8Jul.js b/assets/anthropic-D6Mj8Jul.js
new file mode 100644
index 0000000000000000000000000000000000000000..2dcc4fea692403314f23e73ca4b439d3c08881af
--- /dev/null
+++ b/assets/anthropic-D6Mj8Jul.js
@@ -0,0 +1 @@
+import{computed as e,createBaseVNode as t,createBlock as n,createTextVNode as r,createVNode as i,defineComponent as a,onMounted as o,openBlock as s,storeToRefs as c,unref as l,useI18n as u,useRouter as d,watch as f,withCtx as p}from"./index-BSwg6FIo.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import{useProvidersStore as m}from"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import{ProviderAdvancedSettings_default as h,ProviderApiKeyInput_default as g,ProviderBaseUrlInput_default as _,ProviderBasicSettings_default as v,ProviderSettingsContainer_default as y,ProviderSettingsLayout_default as b}from"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{route_block_default as x}from"./route-block-CC3cgg4Q.js";const S=`anthropic`;var C=a({__name:`anthropic`,setup(a){let{t:x}=u(),C=d(),w=m(),{providers:T}=c(w),E=e(()=>w.getProviderMetadata(S)),D=e({get:()=>{var e;return(e=T.value[S])?.apiKey||``},set:e=>{T.value[S]||(T.value[S]={}),T.value[S].apiKey=e}}),O=e({get:()=>{var e;return(e=T.value[S])?.baseUrl||`https://api.anthropic.com/v1/`},set:e=>{T.value[S]||(T.value[S]={}),T.value[S].baseUrl=e}});o(()=>{var e,t;T.value[S]||(T.value[S]={baseUrl:`https://api.anthropic.com/v1/`}),D.value=(e=T.value[S])?.apiKey||``,O.value=(t=T.value[S])?.baseUrl||`https://api.anthropic.com/v1/`}),f([D,O],()=>{T.value[S]={...T.value[S],apiKey:D.value,baseUrl:O.value||`https://api.anthropic.com/v1/`}});function k(){T.value[S]={baseUrl:`https://api.anthropic.com/v1/`}}return(e,a)=>{var o,c;return s(),n(l(b),{"provider-name":(o=E.value)?.localizedName||`Anthropic | Claude`,"provider-icon":(c=E.value)?.icon,"on-back":()=>l(C).back()},{default:p(()=>[a[2]||=t(`div`,{bg:`orange-50 dark:orange-900/20`,"rounded-xl":``,"p-4":``,flex:`~ col gap-3`},[t(`h2`,{"text-xl":``,"font-semibold":``,text:`orange-700 dark:orange-500`},` Before you start `),t(`p`,null,[r(` While Anthropic recently did announce that they are having a beta support for OpenAI SDK compatibility `),t(`a`,{underline:``,href:`https://docs.anthropic.com/en/api/openai-sdk`},`(you can read more here)`),r(`, but due to the implementation details comes with `),t(`a`,{underline:``,href:`https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS`},`CORS`),r(` restrictions which not aligned with the OpenAI SDK, it's currently not possible to use this provider in the browser. `)]),t(`p`,null,[r(` If you do need to use this provider, you will need a dedicated proxy backend like a Serverless Function running on `),t(`a`,{underline:``,href:`https://workers.cloudflare.com/`},`Cloudflare Workers`),r(` or some CORS bypassing services to bypass the CORS restrictions. `)])],-1),i(l(y),null,{default:p(()=>[i(l(v),{title:l(x)(`settings.pages.providers.common.section.basic.title`),description:l(x)(`settings.pages.providers.common.section.basic.description`),"on-reset":k},{default:p(()=>{var e;return[i(l(g),{modelValue:D.value,"onUpdate:modelValue":a[0]||=e=>D.value=e,"provider-name":(e=E.value)?.localizedName||`Anthropic`,placeholder:`sk-...`},null,8,[`modelValue`,`provider-name`])]}),_:1},8,[`title`,`description`]),i(l(h),{title:l(x)(`settings.pages.providers.common.section.advanced.title`)},{default:p(()=>[i(l(_),{modelValue:O.value,"onUpdate:modelValue":a[1]||=e=>O.value=e,placeholder:`https://api.anthropic.com/v1/`},null,8,[`modelValue`])]),_:1},8,[`title`])]),_:1})]),_:1,__:[2]},8,[`provider-name`,`provider-icon`,`on-back`])}}});typeof x==`function`&&x(C);var w=C;export{w as default};
\ No newline at end of file
diff --git a/assets/appearance-B6qqUE9Q.js b/assets/appearance-B6qqUE9Q.js
new file mode 100644
index 0000000000000000000000000000000000000000..92bf4f0fe472ad10630a0e6b767d7c29cb54b892
--- /dev/null
+++ b/assets/appearance-B6qqUE9Q.js
@@ -0,0 +1 @@
+import{Fragment as e,computed as t,createBaseVNode as n,createBlock as r,createElementBlock as i,defineComponent as a,normalizeStyle as o,openBlock as s,renderList as c,resolveDirective as l,unref as u,useI18n as d,withDirectives as f}from"./index-BSwg6FIo.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import{IconItem_default as p}from"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{route_block_default as m}from"./route-block-CC3cgg4Q.js";const h={flex:`~ col gap-4`,"font-thin":``},g={flex:`~ col gap-4`},_={text:`neutral-200/50 dark:neutral-600/20`,"pointer-events-none":``,fixed:``,top:`[calc(100dvh-12rem)]`,"bottom-0":``,"right--10":``,"z--1":``,initial:{scale:.9,opacity:0,rotate:180},enter:{scale:1,opacity:1,rotate:0},duration:500,"size-60":``,flex:``,"items-center":``,"justify-center":``},v={text:`60`,"i-solar:settings-bold-duotone":``};var y=a({__name:`index`,setup(a){let{t:m}=d(),y=t(()=>[{title:m(`settings.pages.themes.general.title`),description:m(`settings.pages.themes.general.description`),icon:`i-solar:emoji-funny-square-bold-duotone`,to:`/settings/appearance/general`},{title:m(`settings.pages.themes.color-scheme.title`),description:m(`settings.pages.themes.color-scheme.description`),icon:`i-solar:pallete-2-bold-duotone`,to:`/settings/appearance/color-scheme`},{title:m(`settings.pages.themes.developer.title`),description:m(`settings.pages.themes.developer.description`),icon:`i-solar:code-bold-duotone`,to:`/settings/appearance/developer`}]);return(t,a)=>{let d=l(`motion`);return s(),i(`div`,h,[a[0]||=n(`div`,null,null,-1),n(`div`,g,[(s(!0),i(e,null,c(y.value,(e,t)=>f((s(),r(u(p),{key:e.to,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250,style:o({transitionDelay:`${t*50}ms`}),title:e.title,description:e.description,icon:e.icon,to:e.to},null,8,[`style`,`title`,`description`,`icon`,`to`])),[[d]])),128))]),f((s(),i(`div`,_,[f(n(`div`,v,null,512),[[d]])])),[[d]])])}}});typeof m==`function`&&m(y);var b=y;export{b as default};
\ No newline at end of file
diff --git a/assets/appearance-NhZQsHpm.js b/assets/appearance-NhZQsHpm.js
deleted file mode 100644
index c85b541221101bb3d36132cb93722d85fee1c877..0000000000000000000000000000000000000000
--- a/assets/appearance-NhZQsHpm.js
+++ /dev/null
@@ -1 +0,0 @@
-import{Fragment as e,computed as t,createBaseVNode as n,createBlock as r,createElementBlock as i,defineComponent as a,normalizeStyle as o,openBlock as s,renderList as c,resolveDirective as l,unref as u,useI18n as d,withDirectives as f}from"./index-Cf-fA00n.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import{IconItem_default as p}from"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{route_block_default as m}from"./route-block-BOaMwwtm.js";const h={flex:`~ col gap-4`,"font-thin":``},g={flex:`~ col gap-4`},_={text:`neutral-200/50 dark:neutral-600/20`,"pointer-events-none":``,fixed:``,top:`[calc(100dvh-12rem)]`,"bottom-0":``,"right--10":``,"z--1":``,initial:{scale:.9,opacity:0,rotate:180},enter:{scale:1,opacity:1,rotate:0},duration:500,"size-60":``,flex:``,"items-center":``,"justify-center":``},v={text:`60`,"i-solar:settings-bold-duotone":``};var y=a({__name:`index`,setup(a){let{t:m}=d(),y=t(()=>[{title:m(`settings.pages.themes.general.title`),description:m(`settings.pages.themes.general.description`),icon:`i-solar:emoji-funny-square-bold-duotone`,to:`/settings/appearance/general`},{title:m(`settings.pages.themes.color-scheme.title`),description:m(`settings.pages.themes.color-scheme.description`),icon:`i-solar:pallete-2-bold-duotone`,to:`/settings/appearance/color-scheme`},{title:m(`settings.pages.themes.developer.title`),description:m(`settings.pages.themes.developer.description`),icon:`i-solar:code-bold-duotone`,to:`/settings/appearance/developer`}]);return(t,a)=>{let d=l(`motion`);return s(),i(`div`,h,[a[0]||=n(`div`,null,null,-1),n(`div`,g,[(s(!0),i(e,null,c(y.value,(e,t)=>f((s(),r(u(p),{key:e.to,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250,style:o({transitionDelay:`${t*50}ms`}),title:e.title,description:e.description,icon:e.icon,to:e.to},null,8,[`style`,`title`,`description`,`icon`,`to`])),[[d]])),128))]),f((s(),i(`div`,_,[f(n(`div`,v,null,512),[[d]])])),[[d]])])}}});typeof m==`function`&&m(y);var b=y;export{b as default};
\ No newline at end of file
diff --git a/assets/audio-DRohdm1H.js b/assets/audio-DlHM02zp.js
similarity index 89%
rename from assets/audio-DRohdm1H.js
rename to assets/audio-DlHM02zp.js
index 2d400371ec5c08ea6d8ec4e05de29661fdcdb096..6d45740fa4ac41ea53b16dba2ed1db7e86644164 100644
--- a/assets/audio-DRohdm1H.js
+++ b/assets/audio-DlHM02zp.js
@@ -1 +1 @@
-import{createBaseVNode as e,createElementBlock as t,defineComponent as n,openBlock as r,ref as i}from"./index-Cf-fA00n.js";var a=n({__name:`audio`,setup(n){let a=i(),o=i();function s(e){var t,n;if(!e)return;let r=(t=o.value)==null||(t=t.files)==null?void 0:t[0];if(!r)return;let i=document.createElement(`audio`);(n=a.value)?.appendChild(i),i.src=URL.createObjectURL(r),i.controls=!0,i.load(),i.play()}return(n,i)=>(r(),t(`div`,null,[e(`div`,null,[e(`div`,{ref_key:`containerRef`,ref:a},null,512),e(`input`,{ref_key:`fileInputRef`,ref:o,type:`file`,onChange:s},null,544)])]))}}),o=a;export{o as default};
\ No newline at end of file
+import{createBaseVNode as e,createElementBlock as t,defineComponent as n,openBlock as r,ref as i}from"./index-BSwg6FIo.js";var a=n({__name:`audio`,setup(n){let a=i(),o=i();function s(e){var t,n;if(!e)return;let r=(t=o.value)==null||(t=t.files)==null?void 0:t[0];if(!r)return;let i=document.createElement(`audio`);(n=a.value)?.appendChild(i),i.src=URL.createObjectURL(r),i.controls=!0,i.load(),i.play()}return(n,i)=>(r(),t(`div`,null,[e(`div`,null,[e(`div`,{ref_key:`containerRef`,ref:a},null,512),e(`input`,{ref_key:`fileInputRef`,ref:o,type:`file`,onChange:s},null,544)])]))}}),o=a;export{o as default};
\ No newline at end of file
diff --git a/assets/background-remove-BEjjwojk.js b/assets/background-remove-BBVN5gMF.js
similarity index 99%
rename from assets/background-remove-BEjjwojk.js
rename to assets/background-remove-BBVN5gMF.js
index aa4b051b1f296dfbc5b8a3de5fdded5862e64396..a479adecb0cad374bfcf3169e232a2009b7db9a5 100644
--- a/assets/background-remove-BEjjwojk.js
+++ b/assets/background-remove-BBVN5gMF.js
@@ -1,4 +1,4 @@
-var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return exports.defineProperty=i,exports}({});import{Fragment as t,__export as n,__require as r,computed as i,createBaseVNode as a,createCommentVNode as o,createElementBlock as s,createVNode as c,defineComponent as l,normalizeStyle as u,onMounted as d,openBlock as f,ref as p,renderList as m,toDisplayString as h,unref as g}from"./index-Cf-fA00n.js";import"./src-BdFbE9Gc.js";import{InputFile_default as _}from"./InputFile-CO8Q65-Q.js";import{check as v}from"./webgpu-D5T_t3sR.js";const y=new Map,b=[],x=(e,t,n)=>{if(t&&typeof t.init==`function`&&typeof t.createInferenceSessionHandler==`function`){let r=y.get(e);if(r===void 0)y.set(e,{backend:t,priority:n});else if(r.priority>n)return;else if(r.priority===n&&r.backend!==t)throw Error(`cannot register backend "${e}" using priority ${n}`);if(n>=0){let t=b.indexOf(e);t!==-1&&b.splice(t,1);for(let t=0;t{let t=y.get(e);if(!t)return`backend not found.`;if(t.initialized)return t.backend;if(t.aborted)return t.error;{let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init(e)),await t.initPromise,t.initialized=!0,t.backend}catch(e){return n||(t.error=`${e}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},C=async e=>{let t=e.executionProviders||[],n=t.map(e=>typeof e==`string`?e:e.name),r=n.length===0?b:n,i,a=[],o=new Set;for(let e of r){let t=await S(e);typeof t==`string`?a.push({name:e,err:t}):(i||=t,i===t&&o.add(e))}if(!i)throw Error(`no available backend found. ERR: ${a.map(e=>`[${e.name}] ${e.err}`).join(`, `)}`);for(let{name:e,err:t}of a)n.includes(e)&&console.warn(`removing requested execution provider "${e}" from session options because it is not available: ${t}`);let s=t.filter(e=>o.has(typeof e==`string`?e:e.name));return[i,new Proxy(e,{get:(e,t)=>t===`executionProviders`?s:Reflect.get(e,t)})]},w=`1.22.0`;let T=`warning`;const E={wasm:{},webgl:{},webgpu:{},versions:{common:w},set logLevel(e){if(e!==void 0){if(typeof e!=`string`||[`verbose`,`info`,`warning`,`error`,`fatal`].indexOf(e)===-1)throw Error(`Unsupported logging level: ${e}`);T=e}},get logLevel(){return T}};Object.defineProperty(E,`logLevel`,{enumerable:!0});const D=E,O=(e,t)=>{let n=typeof document<`u`?document.createElement(`canvas`):new OffscreenCanvas(1,1);n.width=e.dims[3],n.height=e.dims[2];let r=n.getContext(`2d`);if(r!=null){let i,a;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[3]):(i=e.dims[3],a=e.dims[2]);let o=t?.format===void 0?`RGB`:t.format,s=t?.norm,c,l;s===void 0||s.mean===void 0?c=[255,255,255,255]:typeof s.mean==`number`?c=[s.mean,s.mean,s.mean,s.mean]:(c=[s.mean[0],s.mean[1],s.mean[2],0],s.mean[3]!==void 0&&(c[3]=s.mean[3])),s===void 0||s.bias===void 0?l=[0,0,0,0]:typeof s.bias==`number`?l=[s.bias,s.bias,s.bias,s.bias]:(l=[s.bias[0],s.bias[1],s.bias[2],0],s.bias[3]!==void 0&&(l[3]=s.bias[3]));let u=a*i,d=0,f=u,p=u*2,m=-1;o===`RGBA`?(d=0,f=u,p=u*2,m=u*3):o===`RGB`?(d=0,f=u,p=u*2):o===`RBG`&&(d=0,p=u,f=u*2);for(let t=0;t{let n=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):new OffscreenCanvas(1,1).getContext(`2d`),r;if(n!=null){let i,a,o;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[1],o=e.dims[3]):(i=e.dims[3],a=e.dims[2],o=e.dims[1]);let s=t===void 0||t.format===void 0?`RGB`:t.format,c=t?.norm,l,u;c===void 0||c.mean===void 0?l=[255,255,255,255]:typeof c.mean==`number`?l=[c.mean,c.mean,c.mean,c.mean]:(l=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(l[3]=c.mean[3])),c===void 0||c.bias===void 0?u=[0,0,0,0]:typeof c.bias==`number`?u=[c.bias,c.bias,c.bias,c.bias]:(u=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(u[3]=c.bias[3]));let d=a*i;if(t!==void 0&&(t.format!==void 0&&o===4&&t.format!==`RGBA`||o===3&&t.format!==`RGB`&&t.format!==`BGR`))throw Error(`Tensor format doesn't match input tensor dims`);let f=4,p=0,m=1,h=2,g=3,_=0,v=d,y=d*2,b=-1;s===`RGBA`?(_=0,v=d,y=d*2,b=d*3):s===`RGB`?(_=0,v=d,y=d*2):s===`RBG`&&(_=0,y=d,v=d*2),r=n.createImageData(i,a);for(let t=0;t{if(e===void 0)throw Error(`Image buffer must be defined`);if(t.height===void 0||t.width===void 0)throw Error(`Image height and width must be defined`);if(t.tensorLayout===`NHWC`)throw Error(`NHWC Tensor layout is not supported yet`);let{height:n,width:r}=t,i=t.norm??{mean:255,bias:0},a,o;a=typeof i.mean==`number`?[i.mean,i.mean,i.mean,i.mean]:[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],o=typeof i.bias==`number`?[i.bias,i.bias,i.bias,i.bias]:[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let s=t.format===void 0?`RGBA`:t.format,c=t.tensorFormat===void 0||t.tensorFormat===void 0?`RGB`:t.tensorFormat,l=n*r,u=c===`RGBA`?new Float32Array(l*4):new Float32Array(l*3),d=4,f=0,p=1,m=2,h=3,g=0,_=l,v=l*2,y=-1;s===`RGB`&&(d=3,f=0,p=1,m=2,h=-1),c===`RGBA`?y=l*3:c===`RBG`?(g=0,v=l,_=l*2):c===`BGR`&&(v=0,_=l,g=l*2);for(let t=0;t{let n=typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement,r=typeof ImageData<`u`&&e instanceof ImageData,i=typeof ImageBitmap<`u`&&e instanceof ImageBitmap,a=typeof e==`string`,o,s=t??{},c=()=>{if(typeof document<`u`)return document.createElement(`canvas`);if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(1,1);throw Error(`Canvas is not supported`)},l=e=>typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas?e.getContext(`2d`):null;if(n){let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let n=e.height,i=e.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(n=t.resizedHeight,i=t.resizedWidth),t!==void 0){if(s=t,t.tensorFormat!==void 0)throw Error(`Image input config format must be RGBA for HTMLImageElement`);s.tensorFormat=`RGBA`,s.height=n,s.width=i}else s.tensorFormat=`RGBA`,s.height=n,s.width=i;r.drawImage(e,0,0),o=r.getImageData(0,0,i,n).data}else throw Error(`Can not access image data`)}else if(r){let n,r;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(n=t.resizedHeight,r=t.resizedWidth):(n=e.height,r=e.width),t!==void 0&&(s=t),s.format=`RGBA`,s.height=n,s.width=r,t!==void 0){let t=c();t.width=r,t.height=n;let i=l(t);if(i!=null)i.putImageData(e,0,0),o=i.getImageData(0,0,r,n).data;else throw Error(`Can not access image data`)}else o=e.data}else if(i){if(t===void 0)throw Error(`Please provide image config with format for Imagebitmap`);let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let t=e.height,n=e.width;return r.drawImage(e,0,0,n,t),o=r.getImageData(0,0,n,t).data,s.height=t,s.width=n,k(o,s)}else throw Error(`Can not access image data`)}else if(a)return new Promise((t,n)=>{let r=c(),i=l(r);if(!e||!i)return n();let a=new Image;a.crossOrigin=`Anonymous`,a.src=e,a.onload=()=>{r.width=a.width,r.height=a.height,i.drawImage(a,0,0,r.width,r.height);let e=i.getImageData(0,0,r.width,r.height);s.height=r.height,s.width=r.width,t(k(e.data,s))}});else throw Error(`Input data provided is not supported - aborted tensor creation`);if(o!==void 0)return k(o,s);throw Error(`Input data provided is not supported - aborted tensor creation`)},ne=(e,t)=>{let{width:n,height:r,download:i,dispose:a}=t,o=[1,r,n,4];return new j({location:`texture`,type:`float32`,texture:e,dims:o,download:i,dispose:a})},re=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new j({location:`gpu-buffer`,type:n??`float32`,gpuBuffer:e,dims:r,download:i,dispose:a})},ie=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new j({location:`ml-tensor`,type:n??`float32`,mlTensor:e,dims:r,download:i,dispose:a})},A=(e,t,n)=>new j({location:`cpu-pinned`,type:e,data:t,dims:n??[t.length]}),ae=new Map([[`float32`,Float32Array],[`uint8`,Uint8Array],[`int8`,Int8Array],[`uint16`,Uint16Array],[`int16`,Int16Array],[`int32`,Int32Array],[`bool`,Uint8Array],[`float64`,Float64Array],[`uint32`,Uint32Array],[`int4`,Uint8Array],[`uint4`,Uint8Array]]),oe=new Map([[Float32Array,`float32`],[Uint8Array,`uint8`],[Int8Array,`int8`],[Uint16Array,`uint16`],[Int16Array,`int16`],[Int32Array,`int32`],[Float64Array,`float64`],[Uint32Array,`uint32`]]);let se=!1;const ce=()=>{if(!se){se=!0;let e=typeof BigInt64Array<`u`&&BigInt64Array.from,t=typeof BigUint64Array<`u`&&BigUint64Array.from,n=globalThis.Float16Array,r=n!==void 0&&n.from;e&&(ae.set(`int64`,BigInt64Array),oe.set(BigInt64Array,`int64`)),t&&(ae.set(`uint64`,BigUint64Array),oe.set(BigUint64Array,`uint64`)),r?(ae.set(`float16`,n),oe.set(n,`float16`)):ae.set(`float16`,Uint16Array)}},le=e=>{let t=1;for(let n=0;n{switch(e.location){case`cpu`:return new j(e.type,e.data,t);case`cpu-pinned`:return new j({location:`cpu-pinned`,data:e.data,type:e.type,dims:t});case`texture`:return new j({location:`texture`,texture:e.texture,type:e.type,dims:t});case`gpu-buffer`:return new j({location:`gpu-buffer`,gpuBuffer:e.gpuBuffer,type:e.type,dims:t});case`ml-tensor`:return new j({location:`ml-tensor`,mlTensor:e.mlTensor,type:e.type,dims:t});default:throw Error(`tensorReshape: tensor location ${e.location} is not supported`)}};var j=class{constructor(e,t,n){ce();let r,i;if(typeof e==`object`&&`location`in e)switch(this.dataLocation=e.location,r=e.type,i=e.dims,e.location){case`cpu-pinned`:{let t=ae.get(r);if(!t)throw TypeError(`unsupported type "${r}" to create tensor from pinned buffer`);if(!(e.data instanceof t))throw TypeError(`buffer should be of type ${t.name}`);this.cpuData=e.data;break}case`texture`:if(r!==`float32`)throw TypeError(`unsupported type "${r}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break;case`gpu-buffer`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break;case`ml-tensor`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint64`&&r!==`int8`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break;default:throw Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,o;if(typeof e==`string`)if(r=e,o=n,e===`string`){if(!Array.isArray(t))throw TypeError(`A string tensor's data must be a string array.`);a=t}else{let n=ae.get(e);if(n===void 0)throw TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if(e===`float16`&&n===Uint16Array||e===`uint4`||e===`int4`)throw TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${n.name} as data.`);a=e===`uint64`||e===`int64`?n.from(t,BigInt):n.from(t)}else if(t instanceof n)a=t;else if(t instanceof Uint8ClampedArray)if(e===`uint8`)a=Uint8Array.from(t);else throw TypeError(`A Uint8ClampedArray tensor's data must be type of uint8`);else if(e===`float16`&&t instanceof Uint16Array&&n!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw TypeError(`A ${r} tensor's data must be type of ${n}`)}else if(o=t,Array.isArray(e)){if(e.length===0)throw TypeError(`Tensor type cannot be inferred from an empty array.`);let t=typeof e[0];if(t===`string`)r=`string`,a=e;else if(t===`boolean`)r=`bool`,a=Uint8Array.from(e);else throw TypeError(`Invalid element type of data array: ${t}.`)}else if(e instanceof Uint8ClampedArray)r=`uint8`,a=Uint8Array.from(e);else{let t=oe.get(e.constructor);if(t===void 0)throw TypeError(`Unsupported type for tensor data: ${e.constructor}.`);r=t,a=e}if(o===void 0)o=[a.length];else if(!Array.isArray(o))throw TypeError(`A tensor's dims must be a number array`);i=o,this.cpuData=a,this.dataLocation=`cpu`}let a=le(i);if(this.cpuData&&a!==this.cpuData.length&&!((r===`uint4`||r===`int4`)&&Math.ceil(a/2)===this.cpuData.length))throw Error(`Tensor's size(${a}) does not match data length(${this.cpuData.length}).`);this.type=r,this.dims=i,this.size=a}static async fromImage(e,t){return te(e,t)}static fromTexture(e,t){return ne(e,t)}static fromGpuBuffer(e,t){return re(e,t)}static fromMLTensor(e,t){return ie(e,t)}static fromPinnedBuffer(e,t,n){return A(e,t,n)}toDataURL(e){return O(this,e)}toImageData(e){return ee(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw Error(`The data is not stored as a WebGL texture.`);return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw Error(`The data is not stored as a WebGPU buffer.`);return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw Error(`The data is not stored as a WebNN MLTensor.`);return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case`cpu`:case`cpu-pinned`:return this.data;case`texture`:case`gpu-buffer`:case`ml-tensor`:if(!this.downloader)throw Error(`The current tensor is not created with a specified data downloader.`);if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation=`cpu`,this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}default:throw Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation=`none`}ensureValid(){if(this.dataLocation===`none`)throw Error(`The tensor is disposed.`)}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw Error(`Cannot reshape a tensor that owns GPU resource.`);return ue(this,e)}};const M=j,de=(e,t)=>{(E.trace===void 0?!E.wasm.trace:!E.trace)||console.timeStamp(`${e}::ORT::${t}`)},fe=(e,t)=>{var n;let r=(n=Error().stack)?.split(/\r\n|\r|\n/g)||[],i=!1;for(let n=0;n{(E.trace===void 0?!E.wasm.trace:!E.trace)||fe(`BEGIN`,e)},N=e=>{(E.trace===void 0?!E.wasm.trace:!E.trace)||fe(`END`,e)};var P=class e{constructor(e){this.handler=e}async run(e,t,n){pe();let r={},i={};if(typeof e!=`object`||!e||e instanceof M||Array.isArray(e))throw TypeError(`'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.`);let a=!0;if(typeof t==`object`){if(t===null)throw TypeError(`Unexpected argument[1]: cannot be null.`);if(t instanceof M)throw TypeError(`'fetches' cannot be a Tensor`);if(Array.isArray(t)){if(t.length===0)throw TypeError(`'fetches' cannot be an empty array.`);a=!1;for(let e of t){if(typeof e!=`string`)throw TypeError(`'fetches' must be a string array or an object.`);if(this.outputNames.indexOf(e)===-1)throw RangeError(`'fetches' contains invalid output name: ${e}.`);r[e]=null}if(typeof n==`object`&&n)i=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else{let e=!1,o=Object.getOwnPropertyNames(t);for(let n of this.outputNames)if(o.indexOf(n)!==-1){let i=t[n];(i===null||i instanceof M)&&(e=!0,a=!1,r[n]=i)}if(e){if(typeof n==`object`&&n)i=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else i=t}}else if(t!==void 0)throw TypeError(`Unexpected argument[1]: must be 'fetches' or 'options'.`);for(let t of this.inputNames)if(e[t]===void 0)throw Error(`input '${t}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)r[e]=null;let o=await this.handler.run(e,r,i),s={};for(let e in o)if(Object.hasOwnProperty.call(o,e)){let t=o[e];t instanceof M?s[e]=t:s[e]=new M(t.type,t.data,t.dims)}return N(),s}async release(){return this.handler.dispose()}static async create(t,n,r,i){pe();let a,o={};if(typeof t==`string`){if(a=t,typeof n==`object`&&n)o=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else if(t instanceof Uint8Array){if(a=t,typeof n==`object`&&n)o=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&t instanceof SharedArrayBuffer){let e=t,s=0,c=t.byteLength;if(typeof n==`object`&&n)o=n;else if(typeof n==`number`){if(s=n,!Number.isSafeInteger(s))throw RangeError(`'byteOffset' must be an integer.`);if(s<0||s>=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(c=t.byteLength-s,typeof r==`number`){if(c=r,!Number.isSafeInteger(c))throw RangeError(`'byteLength' must be an integer.`);if(c<=0||s+c>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-s}].`);if(typeof i==`object`&&i)o=i;else if(i!==void 0)throw TypeError(`'options' must be an object.`)}else if(r!==void 0)throw TypeError(`'byteLength' must be a number.`)}else if(n!==void 0)throw TypeError(`'options' must be an object.`);a=new Uint8Array(e,s,c)}else throw TypeError(`Unexpected argument[0]: must be 'path' or 'buffer'.`);let[s,c]=await C(o),l=await s.createInferenceSessionHandler(a,c);return N(),new e(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}};const F=P;var I={};n(I,{InferenceSession:()=>F,TRACE:()=>de,TRACE_FUNC_BEGIN:()=>pe,TRACE_FUNC_END:()=>N,Tensor:()=>M,env:()=>D,registerBackend:()=>x});var me={};n(me,{InferenceSession:()=>ut,TRACE:()=>rt,TRACE_FUNC_BEGIN:()=>at,TRACE_FUNC_END:()=>ot,Tensor:()=>tt,default:()=>Sf,env:()=>R,registerBackend:()=>Te});
+var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return exports.defineProperty=i,exports}({});import{Fragment as t,__export as n,__require as r,computed as i,createBaseVNode as a,createCommentVNode as o,createElementBlock as s,createVNode as c,defineComponent as l,normalizeStyle as u,onMounted as d,openBlock as f,ref as p,renderList as m,toDisplayString as h,unref as g}from"./index-BSwg6FIo.js";import"./src-CX9nVT7I.js";import{InputFile_default as _}from"./InputFile-R2knYJRe.js";import{check as v}from"./webgpu-aYTuek9b.js";const y=new Map,b=[],x=(e,t,n)=>{if(t&&typeof t.init==`function`&&typeof t.createInferenceSessionHandler==`function`){let r=y.get(e);if(r===void 0)y.set(e,{backend:t,priority:n});else if(r.priority>n)return;else if(r.priority===n&&r.backend!==t)throw Error(`cannot register backend "${e}" using priority ${n}`);if(n>=0){let t=b.indexOf(e);t!==-1&&b.splice(t,1);for(let t=0;t{let t=y.get(e);if(!t)return`backend not found.`;if(t.initialized)return t.backend;if(t.aborted)return t.error;{let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init(e)),await t.initPromise,t.initialized=!0,t.backend}catch(e){return n||(t.error=`${e}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},C=async e=>{let t=e.executionProviders||[],n=t.map(e=>typeof e==`string`?e:e.name),r=n.length===0?b:n,i,a=[],o=new Set;for(let e of r){let t=await S(e);typeof t==`string`?a.push({name:e,err:t}):(i||=t,i===t&&o.add(e))}if(!i)throw Error(`no available backend found. ERR: ${a.map(e=>`[${e.name}] ${e.err}`).join(`, `)}`);for(let{name:e,err:t}of a)n.includes(e)&&console.warn(`removing requested execution provider "${e}" from session options because it is not available: ${t}`);let s=t.filter(e=>o.has(typeof e==`string`?e:e.name));return[i,new Proxy(e,{get:(e,t)=>t===`executionProviders`?s:Reflect.get(e,t)})]},w=`1.22.0`;let T=`warning`;const E={wasm:{},webgl:{},webgpu:{},versions:{common:w},set logLevel(e){if(e!==void 0){if(typeof e!=`string`||[`verbose`,`info`,`warning`,`error`,`fatal`].indexOf(e)===-1)throw Error(`Unsupported logging level: ${e}`);T=e}},get logLevel(){return T}};Object.defineProperty(E,`logLevel`,{enumerable:!0});const D=E,O=(e,t)=>{let n=typeof document<`u`?document.createElement(`canvas`):new OffscreenCanvas(1,1);n.width=e.dims[3],n.height=e.dims[2];let r=n.getContext(`2d`);if(r!=null){let i,a;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[3]):(i=e.dims[3],a=e.dims[2]);let o=t?.format===void 0?`RGB`:t.format,s=t?.norm,c,l;s===void 0||s.mean===void 0?c=[255,255,255,255]:typeof s.mean==`number`?c=[s.mean,s.mean,s.mean,s.mean]:(c=[s.mean[0],s.mean[1],s.mean[2],0],s.mean[3]!==void 0&&(c[3]=s.mean[3])),s===void 0||s.bias===void 0?l=[0,0,0,0]:typeof s.bias==`number`?l=[s.bias,s.bias,s.bias,s.bias]:(l=[s.bias[0],s.bias[1],s.bias[2],0],s.bias[3]!==void 0&&(l[3]=s.bias[3]));let u=a*i,d=0,f=u,p=u*2,m=-1;o===`RGBA`?(d=0,f=u,p=u*2,m=u*3):o===`RGB`?(d=0,f=u,p=u*2):o===`RBG`&&(d=0,p=u,f=u*2);for(let t=0;t{let n=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):new OffscreenCanvas(1,1).getContext(`2d`),r;if(n!=null){let i,a,o;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[1],o=e.dims[3]):(i=e.dims[3],a=e.dims[2],o=e.dims[1]);let s=t===void 0||t.format===void 0?`RGB`:t.format,c=t?.norm,l,u;c===void 0||c.mean===void 0?l=[255,255,255,255]:typeof c.mean==`number`?l=[c.mean,c.mean,c.mean,c.mean]:(l=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(l[3]=c.mean[3])),c===void 0||c.bias===void 0?u=[0,0,0,0]:typeof c.bias==`number`?u=[c.bias,c.bias,c.bias,c.bias]:(u=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(u[3]=c.bias[3]));let d=a*i;if(t!==void 0&&(t.format!==void 0&&o===4&&t.format!==`RGBA`||o===3&&t.format!==`RGB`&&t.format!==`BGR`))throw Error(`Tensor format doesn't match input tensor dims`);let f=4,p=0,m=1,h=2,g=3,_=0,v=d,y=d*2,b=-1;s===`RGBA`?(_=0,v=d,y=d*2,b=d*3):s===`RGB`?(_=0,v=d,y=d*2):s===`RBG`&&(_=0,y=d,v=d*2),r=n.createImageData(i,a);for(let t=0;t{if(e===void 0)throw Error(`Image buffer must be defined`);if(t.height===void 0||t.width===void 0)throw Error(`Image height and width must be defined`);if(t.tensorLayout===`NHWC`)throw Error(`NHWC Tensor layout is not supported yet`);let{height:n,width:r}=t,i=t.norm??{mean:255,bias:0},a,o;a=typeof i.mean==`number`?[i.mean,i.mean,i.mean,i.mean]:[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],o=typeof i.bias==`number`?[i.bias,i.bias,i.bias,i.bias]:[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let s=t.format===void 0?`RGBA`:t.format,c=t.tensorFormat===void 0||t.tensorFormat===void 0?`RGB`:t.tensorFormat,l=n*r,u=c===`RGBA`?new Float32Array(l*4):new Float32Array(l*3),d=4,f=0,p=1,m=2,h=3,g=0,_=l,v=l*2,y=-1;s===`RGB`&&(d=3,f=0,p=1,m=2,h=-1),c===`RGBA`?y=l*3:c===`RBG`?(g=0,v=l,_=l*2):c===`BGR`&&(v=0,_=l,g=l*2);for(let t=0;t{let n=typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement,r=typeof ImageData<`u`&&e instanceof ImageData,i=typeof ImageBitmap<`u`&&e instanceof ImageBitmap,a=typeof e==`string`,o,s=t??{},c=()=>{if(typeof document<`u`)return document.createElement(`canvas`);if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(1,1);throw Error(`Canvas is not supported`)},l=e=>typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas?e.getContext(`2d`):null;if(n){let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let n=e.height,i=e.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(n=t.resizedHeight,i=t.resizedWidth),t!==void 0){if(s=t,t.tensorFormat!==void 0)throw Error(`Image input config format must be RGBA for HTMLImageElement`);s.tensorFormat=`RGBA`,s.height=n,s.width=i}else s.tensorFormat=`RGBA`,s.height=n,s.width=i;r.drawImage(e,0,0),o=r.getImageData(0,0,i,n).data}else throw Error(`Can not access image data`)}else if(r){let n,r;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(n=t.resizedHeight,r=t.resizedWidth):(n=e.height,r=e.width),t!==void 0&&(s=t),s.format=`RGBA`,s.height=n,s.width=r,t!==void 0){let t=c();t.width=r,t.height=n;let i=l(t);if(i!=null)i.putImageData(e,0,0),o=i.getImageData(0,0,r,n).data;else throw Error(`Can not access image data`)}else o=e.data}else if(i){if(t===void 0)throw Error(`Please provide image config with format for Imagebitmap`);let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let t=e.height,n=e.width;return r.drawImage(e,0,0,n,t),o=r.getImageData(0,0,n,t).data,s.height=t,s.width=n,k(o,s)}else throw Error(`Can not access image data`)}else if(a)return new Promise((t,n)=>{let r=c(),i=l(r);if(!e||!i)return n();let a=new Image;a.crossOrigin=`Anonymous`,a.src=e,a.onload=()=>{r.width=a.width,r.height=a.height,i.drawImage(a,0,0,r.width,r.height);let e=i.getImageData(0,0,r.width,r.height);s.height=r.height,s.width=r.width,t(k(e.data,s))}});else throw Error(`Input data provided is not supported - aborted tensor creation`);if(o!==void 0)return k(o,s);throw Error(`Input data provided is not supported - aborted tensor creation`)},ne=(e,t)=>{let{width:n,height:r,download:i,dispose:a}=t,o=[1,r,n,4];return new j({location:`texture`,type:`float32`,texture:e,dims:o,download:i,dispose:a})},re=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new j({location:`gpu-buffer`,type:n??`float32`,gpuBuffer:e,dims:r,download:i,dispose:a})},ie=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new j({location:`ml-tensor`,type:n??`float32`,mlTensor:e,dims:r,download:i,dispose:a})},A=(e,t,n)=>new j({location:`cpu-pinned`,type:e,data:t,dims:n??[t.length]}),ae=new Map([[`float32`,Float32Array],[`uint8`,Uint8Array],[`int8`,Int8Array],[`uint16`,Uint16Array],[`int16`,Int16Array],[`int32`,Int32Array],[`bool`,Uint8Array],[`float64`,Float64Array],[`uint32`,Uint32Array],[`int4`,Uint8Array],[`uint4`,Uint8Array]]),oe=new Map([[Float32Array,`float32`],[Uint8Array,`uint8`],[Int8Array,`int8`],[Uint16Array,`uint16`],[Int16Array,`int16`],[Int32Array,`int32`],[Float64Array,`float64`],[Uint32Array,`uint32`]]);let se=!1;const ce=()=>{if(!se){se=!0;let e=typeof BigInt64Array<`u`&&BigInt64Array.from,t=typeof BigUint64Array<`u`&&BigUint64Array.from,n=globalThis.Float16Array,r=n!==void 0&&n.from;e&&(ae.set(`int64`,BigInt64Array),oe.set(BigInt64Array,`int64`)),t&&(ae.set(`uint64`,BigUint64Array),oe.set(BigUint64Array,`uint64`)),r?(ae.set(`float16`,n),oe.set(n,`float16`)):ae.set(`float16`,Uint16Array)}},le=e=>{let t=1;for(let n=0;n{switch(e.location){case`cpu`:return new j(e.type,e.data,t);case`cpu-pinned`:return new j({location:`cpu-pinned`,data:e.data,type:e.type,dims:t});case`texture`:return new j({location:`texture`,texture:e.texture,type:e.type,dims:t});case`gpu-buffer`:return new j({location:`gpu-buffer`,gpuBuffer:e.gpuBuffer,type:e.type,dims:t});case`ml-tensor`:return new j({location:`ml-tensor`,mlTensor:e.mlTensor,type:e.type,dims:t});default:throw Error(`tensorReshape: tensor location ${e.location} is not supported`)}};var j=class{constructor(e,t,n){ce();let r,i;if(typeof e==`object`&&`location`in e)switch(this.dataLocation=e.location,r=e.type,i=e.dims,e.location){case`cpu-pinned`:{let t=ae.get(r);if(!t)throw TypeError(`unsupported type "${r}" to create tensor from pinned buffer`);if(!(e.data instanceof t))throw TypeError(`buffer should be of type ${t.name}`);this.cpuData=e.data;break}case`texture`:if(r!==`float32`)throw TypeError(`unsupported type "${r}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break;case`gpu-buffer`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break;case`ml-tensor`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint64`&&r!==`int8`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break;default:throw Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,o;if(typeof e==`string`)if(r=e,o=n,e===`string`){if(!Array.isArray(t))throw TypeError(`A string tensor's data must be a string array.`);a=t}else{let n=ae.get(e);if(n===void 0)throw TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if(e===`float16`&&n===Uint16Array||e===`uint4`||e===`int4`)throw TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${n.name} as data.`);a=e===`uint64`||e===`int64`?n.from(t,BigInt):n.from(t)}else if(t instanceof n)a=t;else if(t instanceof Uint8ClampedArray)if(e===`uint8`)a=Uint8Array.from(t);else throw TypeError(`A Uint8ClampedArray tensor's data must be type of uint8`);else if(e===`float16`&&t instanceof Uint16Array&&n!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw TypeError(`A ${r} tensor's data must be type of ${n}`)}else if(o=t,Array.isArray(e)){if(e.length===0)throw TypeError(`Tensor type cannot be inferred from an empty array.`);let t=typeof e[0];if(t===`string`)r=`string`,a=e;else if(t===`boolean`)r=`bool`,a=Uint8Array.from(e);else throw TypeError(`Invalid element type of data array: ${t}.`)}else if(e instanceof Uint8ClampedArray)r=`uint8`,a=Uint8Array.from(e);else{let t=oe.get(e.constructor);if(t===void 0)throw TypeError(`Unsupported type for tensor data: ${e.constructor}.`);r=t,a=e}if(o===void 0)o=[a.length];else if(!Array.isArray(o))throw TypeError(`A tensor's dims must be a number array`);i=o,this.cpuData=a,this.dataLocation=`cpu`}let a=le(i);if(this.cpuData&&a!==this.cpuData.length&&!((r===`uint4`||r===`int4`)&&Math.ceil(a/2)===this.cpuData.length))throw Error(`Tensor's size(${a}) does not match data length(${this.cpuData.length}).`);this.type=r,this.dims=i,this.size=a}static async fromImage(e,t){return te(e,t)}static fromTexture(e,t){return ne(e,t)}static fromGpuBuffer(e,t){return re(e,t)}static fromMLTensor(e,t){return ie(e,t)}static fromPinnedBuffer(e,t,n){return A(e,t,n)}toDataURL(e){return O(this,e)}toImageData(e){return ee(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw Error(`The data is not stored as a WebGL texture.`);return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw Error(`The data is not stored as a WebGPU buffer.`);return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw Error(`The data is not stored as a WebNN MLTensor.`);return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case`cpu`:case`cpu-pinned`:return this.data;case`texture`:case`gpu-buffer`:case`ml-tensor`:if(!this.downloader)throw Error(`The current tensor is not created with a specified data downloader.`);if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation=`cpu`,this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}default:throw Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation=`none`}ensureValid(){if(this.dataLocation===`none`)throw Error(`The tensor is disposed.`)}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw Error(`Cannot reshape a tensor that owns GPU resource.`);return ue(this,e)}};const M=j,de=(e,t)=>{(E.trace===void 0?!E.wasm.trace:!E.trace)||console.timeStamp(`${e}::ORT::${t}`)},fe=(e,t)=>{var n;let r=(n=Error().stack)?.split(/\r\n|\r|\n/g)||[],i=!1;for(let n=0;n{(E.trace===void 0?!E.wasm.trace:!E.trace)||fe(`BEGIN`,e)},N=e=>{(E.trace===void 0?!E.wasm.trace:!E.trace)||fe(`END`,e)};var P=class e{constructor(e){this.handler=e}async run(e,t,n){pe();let r={},i={};if(typeof e!=`object`||!e||e instanceof M||Array.isArray(e))throw TypeError(`'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.`);let a=!0;if(typeof t==`object`){if(t===null)throw TypeError(`Unexpected argument[1]: cannot be null.`);if(t instanceof M)throw TypeError(`'fetches' cannot be a Tensor`);if(Array.isArray(t)){if(t.length===0)throw TypeError(`'fetches' cannot be an empty array.`);a=!1;for(let e of t){if(typeof e!=`string`)throw TypeError(`'fetches' must be a string array or an object.`);if(this.outputNames.indexOf(e)===-1)throw RangeError(`'fetches' contains invalid output name: ${e}.`);r[e]=null}if(typeof n==`object`&&n)i=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else{let e=!1,o=Object.getOwnPropertyNames(t);for(let n of this.outputNames)if(o.indexOf(n)!==-1){let i=t[n];(i===null||i instanceof M)&&(e=!0,a=!1,r[n]=i)}if(e){if(typeof n==`object`&&n)i=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else i=t}}else if(t!==void 0)throw TypeError(`Unexpected argument[1]: must be 'fetches' or 'options'.`);for(let t of this.inputNames)if(e[t]===void 0)throw Error(`input '${t}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)r[e]=null;let o=await this.handler.run(e,r,i),s={};for(let e in o)if(Object.hasOwnProperty.call(o,e)){let t=o[e];t instanceof M?s[e]=t:s[e]=new M(t.type,t.data,t.dims)}return N(),s}async release(){return this.handler.dispose()}static async create(t,n,r,i){pe();let a,o={};if(typeof t==`string`){if(a=t,typeof n==`object`&&n)o=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else if(t instanceof Uint8Array){if(a=t,typeof n==`object`&&n)o=n;else if(n!==void 0)throw TypeError(`'options' must be an object.`)}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&t instanceof SharedArrayBuffer){let e=t,s=0,c=t.byteLength;if(typeof n==`object`&&n)o=n;else if(typeof n==`number`){if(s=n,!Number.isSafeInteger(s))throw RangeError(`'byteOffset' must be an integer.`);if(s<0||s>=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(c=t.byteLength-s,typeof r==`number`){if(c=r,!Number.isSafeInteger(c))throw RangeError(`'byteLength' must be an integer.`);if(c<=0||s+c>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-s}].`);if(typeof i==`object`&&i)o=i;else if(i!==void 0)throw TypeError(`'options' must be an object.`)}else if(r!==void 0)throw TypeError(`'byteLength' must be a number.`)}else if(n!==void 0)throw TypeError(`'options' must be an object.`);a=new Uint8Array(e,s,c)}else throw TypeError(`Unexpected argument[0]: must be 'path' or 'buffer'.`);let[s,c]=await C(o),l=await s.createInferenceSessionHandler(a,c);return N(),new e(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}};const F=P;var I={};n(I,{InferenceSession:()=>F,TRACE:()=>de,TRACE_FUNC_BEGIN:()=>pe,TRACE_FUNC_END:()=>N,Tensor:()=>M,env:()=>D,registerBackend:()=>x});var me={};n(me,{InferenceSession:()=>ut,TRACE:()=>rt,TRACE_FUNC_BEGIN:()=>at,TRACE_FUNC_END:()=>ot,Tensor:()=>tt,default:()=>Sf,env:()=>R,registerBackend:()=>Te});
/*!
* ONNX Runtime Web v1.22.0-dev.20250409-89f8206ba4
* Copyright (c) Microsoft Corporation. All rights reserved.
diff --git a/assets/browser-DdKKYS3c.js b/assets/browser-_6RX04wP.js
similarity index 100%
rename from assets/browser-DdKKYS3c.js
rename to assets/browser-_6RX04wP.js
diff --git a/assets/chat-BFEmtOw2.js b/assets/chat-6NJMDnl7.js
similarity index 98%
rename from assets/chat-BFEmtOw2.js
rename to assets/chat-6NJMDnl7.js
index a0bb13c3a07029845280974a6e335de72d47ec49..1cb4a0bd24be7f52f31f02e318126e16acac6750 100644
--- a/assets/chat-BFEmtOw2.js
+++ b/assets/chat-6NJMDnl7.js
@@ -1,3 +1,3 @@
-var e=function(exports){function t(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function n(e,n,r){return e.set(t(e,n),r),r}function r(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function i(e,t,n){r(e,t),t.set(e,n)}function a(e,n){return e.get(t(e,n))}return exports.classPrivateFieldGet2=a,exports.classPrivateFieldInitSpec=i,exports.classPrivateFieldSet2=n,exports}({});import{Fragment as t,createBaseVNode as n,createCommentVNode as r,createElementBlock as i,defineComponent as a,isRef as o,openBlock as s,ref as c,renderList as l,toDisplayString as u,toRaw as d,unref as f,useLocalStorage as p,vModelText as m,withDirectives as h}from"./index-Cf-fA00n.js";import{streamText as g}from"./dist-DZR9wFAU.js";var _,v,y;let b;const x=()=>{let e=null;return{getStore:()=>(e===null&&console.warn("Woops! Looks like you are calling `getContext` after `await fn()`. Please move `getContext` to top level of handler."),e),run(t,n){e=t;try{return n()}finally{e=null}}}},S=new WeakMap,C=new WeakMap;let w=0,T=0;const E=e=>{let t=`${w++}`,n={debugLabel:e?.debugLabel??t,include:e=>r.has(e),with:i=>{let a=`${T++}`,o={[Symbol.toStringTag]:e?.debugLabel??`WorkflowEvent(${t}.${a})`,toString:()=>e?.debugLabel?e.debugLabel:`WorkflowEvent(${t}.${a})`,toJSON:()=>({type:e?.debugLabel?e.debugLabel:t,data:i}),get data(){return i}};return r.add(o),C.set(o,n),o}},r=new WeakSet;S.set(n,r),Object.defineProperty(n,Symbol.toStringTag,{get:()=>n?.debugLabel??`WorkflowEvent<${t}>`}),Object.defineProperty(n,`displayName`,{value:n?.debugLabel??`WorkflowEvent<${t}>`});let i=e?.uniqueId;return Object.defineProperty(n,`uniqueId`,{get:()=>(i||=t,i),set:()=>{throw Error(`uniqueId is readonly`)}}),n.toString=()=>e?.debugLabel??`WorkflowEvent<${t}>`,n},D=e=>typeof e==`object`&&e?S.has(e):!1,O=e=>typeof e==`object`&&e?C.get(e):void 0,k=e=>typeof e==`object`&&!!e&&`data`in e,A=e=>e!=null&&typeof e.then==`function`;function j(e,t){let n=Array(e.length);for(let r of t)for(let t=0;t(e.add(t),()=>{e.delete(t)}),publish:(...t)=>{let n=[];for(let r of e)n.push(r(...t));return n}};return M.set(t,e),t}var F=class extends TransformStream{constructor(){super({transform:(e,t)=>{O(e)&&t.enqueue(JSON.stringify({data:e.data,uniqueId:O(e).uniqueId})+`
+var e=function(exports){function t(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function n(e,n,r){return e.set(t(e,n),r),r}function r(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function i(e,t,n){r(e,t),t.set(e,n)}function a(e,n){return e.get(t(e,n))}return exports.classPrivateFieldGet2=a,exports.classPrivateFieldInitSpec=i,exports.classPrivateFieldSet2=n,exports}({});import{Fragment as t,createBaseVNode as n,createCommentVNode as r,createElementBlock as i,defineComponent as a,isRef as o,openBlock as s,ref as c,renderList as l,toDisplayString as u,toRaw as d,unref as f,useLocalStorage as p,vModelText as m,withDirectives as h}from"./index-BSwg6FIo.js";import{streamText as g}from"./dist-D1uPCnfx.js";var _,v,y;let b;const x=()=>{let e=null;return{getStore:()=>(e===null&&console.warn("Woops! Looks like you are calling `getContext` after `await fn()`. Please move `getContext` to top level of handler."),e),run(t,n){e=t;try{return n()}finally{e=null}}}},S=new WeakMap,C=new WeakMap;let w=0,T=0;const E=e=>{let t=`${w++}`,n={debugLabel:e?.debugLabel??t,include:e=>r.has(e),with:i=>{let a=`${T++}`,o={[Symbol.toStringTag]:e?.debugLabel??`WorkflowEvent(${t}.${a})`,toString:()=>e?.debugLabel?e.debugLabel:`WorkflowEvent(${t}.${a})`,toJSON:()=>({type:e?.debugLabel?e.debugLabel:t,data:i}),get data(){return i}};return r.add(o),C.set(o,n),o}},r=new WeakSet;S.set(n,r),Object.defineProperty(n,Symbol.toStringTag,{get:()=>n?.debugLabel??`WorkflowEvent<${t}>`}),Object.defineProperty(n,`displayName`,{value:n?.debugLabel??`WorkflowEvent<${t}>`});let i=e?.uniqueId;return Object.defineProperty(n,`uniqueId`,{get:()=>(i||=t,i),set:()=>{throw Error(`uniqueId is readonly`)}}),n.toString=()=>e?.debugLabel??`WorkflowEvent<${t}>`,n},D=e=>typeof e==`object`&&e?S.has(e):!1,O=e=>typeof e==`object`&&e?C.get(e):void 0,k=e=>typeof e==`object`&&!!e&&`data`in e,A=e=>e!=null&&typeof e.then==`function`;function j(e,t){let n=Array(e.length);for(let r of t)for(let t=0;t(e.add(t),()=>{e.delete(t)}),publish:(...t)=>{let n=[];for(let r of e)n.push(r(...t));return n}};return M.set(t,e),t}var F=class extends TransformStream{constructor(){super({transform:(e,t)=>{O(e)&&t.enqueue(JSON.stringify({data:e.data,uniqueId:O(e).uniqueId})+`
`)}})}},I=(_=new WeakMap,class extends TransformStream{constructor(t){super({transform:(t,n)=>{let r=t.split(`
`).map(e=>e.trim()).filter(e=>e.length>0);r.forEach(t=>{let r=JSON.parse(t),i=Object.values(e.classPrivateFieldGet2(_,this)).find(e=>e.uniqueId===r.uniqueId);if(i){let e=i.with(r.data);n.enqueue(e)}else console.warn(`Unknown event: ${r.uniqueId}`)})}}),e.classPrivateFieldInitSpec(this,_,void 0),e.classPrivateFieldSet2(_,this,t)}}),L=(v=new WeakMap,y=new WeakMap,b=Symbol.asyncIterator,class t extends ReadableStream{on(t,n){return e.classPrivateFieldGet2(y,this).subscribe(e=>{t.include(e)&&n(e)})}constructor(t,n){if(!t&&!n)throw TypeError(`Either subscribable or root stream must be provided`);if(super(),e.classPrivateFieldInitSpec(this,v,void 0),e.classPrivateFieldInitSpec(this,y,void 0),t){e.classPrivateFieldSet2(y,this,t);let r;e.classPrivateFieldSet2(v,this,n??new ReadableStream({start:e=>{r=t.subscribe(t=>{e.enqueue(t)})},cancel:()=>{r()}}))}else{e.classPrivateFieldSet2(y,this,P()),e.classPrivateFieldSet2(v,this,n.pipeThrough(new TransformStream({transform:(t,n)=>{e.classPrivateFieldGet2(y,this).publish(t),n.enqueue(t)}})));return}}static fromReadableStream(e){return new t(null,e.pipeThrough(new TransformStream({transform:(e,t)=>{t.enqueue(e)}})))}static fromResponse(e,n){let r=e.body;if(!r)throw Error(`Response body is not readable`);return new t(null,r.pipeThrough(new TextDecoderStream).pipeThrough(new I(n)))}toResponse(t,n=new F){return new Response(e.classPrivateFieldGet2(v,this).pipeThrough(n).pipeThrough(new TextEncoderStream),t)}get locked(){return e.classPrivateFieldGet2(v,this).locked}[b](){return e.classPrivateFieldGet2(v,this)[Symbol.asyncIterator]()}cancel(t){return e.classPrivateFieldGet2(v,this).cancel(t)}getReader(){return e.classPrivateFieldGet2(v,this).getReader()}pipeThrough(n,r){let i=e.classPrivateFieldGet2(v,this).pipeThrough(n,r);return new t(null,i)}pipeTo(t,n){return e.classPrivateFieldGet2(v,this).pipeTo(t,n)}tee(){let[n,r]=e.classPrivateFieldGet2(v,this).tee();return[new t(e.classPrivateFieldGet2(y,this),n),new t(e.classPrivateFieldGet2(y,this),r)]}forEach(t){return e.classPrivateFieldGet2(v,this).pipeTo(new WritableStream({write:e=>{t(e)}}))}map(e){return this.pipeThrough(new TransformStream({transform:(t,n)=>{n.enqueue(e(t))}}))}values(t){return e.classPrivateFieldGet2(v,this).values(t)}take(e){let t=0;return this.pipeThrough(new TransformStream({transform:(n,r)=>{t=e&&r.terminate()}}))}filter(e){return this.pipeThrough(new TransformStream({transform:(t,n)=>{(typeof e==`function`?e(t):D(e)?e.include(t):e===t)&&n.enqueue(t)}}))}until(e){return this.pipeThrough(new TransformStream({transform:(t,n)=>{n.enqueue(t),(typeof e==`function`?e(t):D(e)?e.include(t):e===t)&&n.terminate()}}))}async toArray(){let e=[];return await this.pipeTo(new WritableStream({write:t=>{e.push(t)}})),e}});const R=x();function z(){let e=R.getStore();if(!e)throw Error(`No current context found`);return e}const B=x(),V=new WeakMap,H=({listeners:e})=>{let t=[],n=(e,t,n,r)=>{let c,l={get abortController(){return c||=new AbortController,c},async:`constructor`in e?e.constructor.name===`AsyncFunction`:!1,pending:null,handler:e,inputEvents:t,inputs:n,outputs:[],prev:r,next:new Set,get root(){return o}};l.prev.next.add(l);let u=i(l);B.run(l,()=>{let e=[...new Set([...N(s.__internal__call_context),...N(u.__internal__call_context)])];R.run(u,()=>{let t=0,n=r=>{if(t===e.length){let e;try{e=r.handler(...r.inputs)}catch(e){if(c??a)(c??a).abort(e);else throw console.error(`unhandled error in handler`,e),e}A(e)?(l.async=!0,l.pending=e.then(e=>(k(e)&&u.sendEvent(e),e))):k(e)&&u.sendEvent(e)}let i=e[t];i&&(t++,i(r,n))};n(l)})})},r=r=>{let i=[...t];[...e].filter(([e])=>{let t=j(e,i);return t.length===e.length}).map(([e,a])=>{let o=j(e,i);o.forEach(e=>{t.splice(t.indexOf(e),1)});for(let t of a)n(t,e,o,r)})},i=e=>{let n=null;return{get stream(){if(!n){let t=P();s.__internal__call_send_event.subscribe(n=>{let r=V.get(n);for(;r;){if(r===e){t.publish(n);break}r=r.prev}}),n=new L(t,null)}return n},get signal(){return e.abortController.signal},sendEvent:(...n)=>{n.forEach(n=>{V.set(n,e),e.outputs.push(n),t.push(n),s.__internal__call_send_event.publish(n,e),r(e)})},__internal__call_context:P(),__internal__call_send_event:P()}},a=new AbortController,o={get abortController(){return a||=new AbortController,a},async:!1,pending:null,inputEvents:[],inputs:[],outputs:[],handler:null,prev:null,next:new Set,get root(){return o}},s=i(o);return s},U=()=>{let e={steps:new Map};return{handle:(t,n)=>{if(e.steps.has(t)){let r=e.steps.get(t);r.add(n)}else{let r=new Set;r.add(n),e.steps.set(t,r)}},createContext(){return H({listeners:e.steps})}}};function W(e,t){let n=(...e)=>{let n=t.filter(([t])=>t.every((t,n)=>t.include(e[n]))).map(([e,t])=>t),r=z(),i=r.sendEvent;return(...e)=>{for(let t=0;tt.include(e[n])))return i(...e)}return console.warn(`Invalid input detected [%s]`,e.map(e=>e.data).join(`, `)),i(...e)}};return{...e,strictHandle:(t,n)=>{let r=(...e)=>{let t=z();return n(t.safeSendEvent,...e)};return e.handle(t,r)},createContext(){let t=e.createContext();return t.__internal__call_context.subscribe((e,t)=>{z().safeSendEvent=n(...e.inputs),t(e)}),t}}}async function G(e,t,n){let{stream:r,sendEvent:i}=e.createContext();i(t);let a=(await r.until(n).toArray()).at(-1);if(!a)throw Error(`No output event received`);return a}const K={flex:``,"flex-col":``,"gap-2":``},q={flex:`~ col`,"gap-2":``},J={flex:``,"flex-col":``,"gap-2":``},Y={grid:``,"grid-cols-2":``,"gap-2":``},X={flex:``,"items-center":``,"gap-2":``},Z={flex:``,"items-center":``,"gap-2":``},Q={flex:``,"items-center":``,"gap-2":``},$={key:0},ee={key:1};var te=a({__name:`chat`,setup(e){let a=p(`settings/llm/baseUrl`,`https://openrouter.ai/api/v1/`),_=p(`settings/llm/apiKey`,``),v=p(`settings/llm/model`,`openai/gpt-4o-mini`),y=c(``),b=c([]),x=c({role:`assistant`,content:``}),S=c(!1),C=E(),w=E(),T=E(),D=E(),O=E();async function k(){S.value=!0;try{let e=W(U(),[[[C],[w,O]],[[w],[T]],[[T],[D]]]);e.handle([C],async()=>{let{sendEvent:t}=e.createContext();x.value={role:`assistant`,content:``},b.value.push({role:`user`,content:y.value}),b.value.push(x.value);let n=await g({baseURL:a.value,apiKey:_.value,model:v.value,messages:b.value.slice(0,b.value.length-1).map(e=>d(e))});for await(let e of n.chunkStream)t(w.with(e.choices[0].delta.content||``));return O.with()}),e.handle([w],async e=>{x.value.content?x.value.content+=e.data:x.value.content=e.data}),await G(e,C.with(),O)}catch(e){console.error(e)}finally{S.value=!1}}return(e,c)=>(s(),i(`div`,K,[n(`div`,q,[n(`div`,J,[c[7]||=n(`div`,null,[n(`span`,{"text-neutral-500":``,"dark:text-neutral-400":``},`LLM`)],-1),n(`div`,Y,[n(`label`,X,[c[4]||=n(`span`,{"text-nowrap":``},` Base URL `,-1),h(n(`input`,{"onUpdate:modelValue":c[0]||=e=>o(a)?a.value=e:null,border:`focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800`,transition:`all duration-200 ease-in-out`,text:`disabled:neutral-400 dark:disabled:neutral-600`,cursor:`disabled:not-allowed`,"w-full":``,"rounded-lg":``,"px-2":``,"py-1":``,"text-nowrap":``,"text-sm":``,"outline-none":``,shadow:`sm`,bg:`neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900`},null,512),[[m,f(a)]])]),n(`label`,Z,[c[5]||=n(`span`,{"text-nowrap":``},` API Key `,-1),h(n(`input`,{"onUpdate:modelValue":c[1]||=e=>o(_)?_.value=e:null,type:`password`,border:`focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800`,transition:`all duration-200 ease-in-out`,text:`disabled:neutral-400 dark:disabled:neutral-600`,cursor:`disabled:not-allowed`,"w-full":``,"rounded-lg":``,"px-2":``,"py-1":``,"text-nowrap":``,"text-sm":``,"outline-none":``,shadow:`sm`,bg:`neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900`},null,512),[[m,f(_)]])]),n(`label`,Q,[c[6]||=n(`span`,{"text-nowrap":``},` Model `,-1),h(n(`input`,{"onUpdate:modelValue":c[2]||=e=>o(v)?v.value=e:null,border:`focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800`,transition:`all duration-200 ease-in-out`,text:`disabled:neutral-400 dark:disabled:neutral-600`,cursor:`disabled:not-allowed`,"w-full":``,"rounded-lg":``,"px-2":``,"py-1":``,"text-nowrap":``,"text-sm":``,"outline-none":``,shadow:`sm`,bg:`neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900`},null,512),[[m,f(v)]])])])]),n(`div`,null,[h(n(`textarea`,{"onUpdate:modelValue":c[3]||=e=>y.value=e,border:`focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800`,transition:`all duration-200 ease-in-out`,text:`disabled:neutral-400 dark:disabled:neutral-600`,cursor:`disabled:not-allowed`,"w-full":``,"rounded-lg":``,"px-2":``,"py-1":``,"text-nowrap":``,"text-sm":``,"outline-none":``,shadow:`sm`,bg:`neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900`},null,512),[[m,y.value]])]),n(`button`,{"rounded-lg":``,bg:`blue-100 dark:blue-900`,"px-4":``,"py-2":``,onClick:k},` Send `),n(`div`,null,[(s(!0),i(t,null,l(b.value,(e,t)=>(s(),i(`div`,{key:t},[e.role===`user`?(s(),i(`div`,$,[n(`span`,null,u(e.content),1)])):r(``,!0),e.role===`assistant`?(s(),i(`div`,ee,[n(`span`,null,u(e.content),1)])):r(``,!0)]))),128))])])]))}}),ne=te;export{ne as default};
\ No newline at end of file
diff --git a/assets/cloudflare-workers-ai-C4yLEnia.js b/assets/cloudflare-workers-ai-C4yLEnia.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f93fa303b7829bc80d64b2762546e4ccd56dacb
--- /dev/null
+++ b/assets/cloudflare-workers-ai-C4yLEnia.js
@@ -0,0 +1 @@
+import{computed as e,createBlock as t,createVNode as n,defineComponent as r,onMounted as i,openBlock as a,storeToRefs as o,unref as s,useI18n as c,useRouter as l,watch as u,withCtx as d}from"./index-BSwg6FIo.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import{useProvidersStore as f}from"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import"./src-CX9nVT7I.js";import{ProviderAccountIdInput_default as p,ProviderApiKeyInput_default as m,ProviderBasicSettings_default as h,ProviderSettingsContainer_default as g,ProviderSettingsLayout_default as _}from"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{route_block_default as v}from"./route-block-CC3cgg4Q.js";const y=`cloudflare-workers-ai`;var b=r({__name:`cloudflare-workers-ai`,setup(r){let{t:v}=c(),b=l(),x=f(),{providers:S}=o(x),C=e(()=>x.getProviderMetadata(y)),w=e({get:()=>{var e;return(e=S.value[y])?.apiKey||``},set:e=>{S.value[y]||(S.value[y]={}),S.value[y].apiKey=e}}),T=e({get:()=>{var e;return(e=S.value[y])?.accountId||``},set:e=>{S.value[y]||(S.value[y]={}),S.value[y].accountId=e}});i(()=>{var e,t;x.initializeProvider(y),w.value=(e=S.value[y])?.apiKey||``,T.value=(t=S.value[y])?.accountId||``}),u([w,T],()=>{S.value[y]={...S.value[y],apiKey:w.value,accountId:T.value}});function E(){var e;S.value[y]={...(e=C.value)?.defaultOptions}}return(e,r)=>{var i,o;return a(),t(s(_),{"provider-name":(i=C.value)?.localizedName,"provider-icon-color":(o=C.value)?.iconColor,"on-back":()=>s(b).back()},{default:d(()=>[n(s(g),null,{default:d(()=>[n(s(h),{title:s(v)(`settings.pages.providers.common.section.basic.title`),description:s(v)(`settings.pages.providers.common.section.basic.description`),"on-reset":E},{default:d(()=>{var e;return[n(s(m),{modelValue:w.value,"onUpdate:modelValue":r[0]||=e=>w.value=e,"provider-name":(e=C.value)?.localizedName,placeholder:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.api-key.placeholder`)},null,8,[`modelValue`,`provider-name`,`placeholder`]),n(s(p),{modelValue:T.value,"onUpdate:modelValue":r[1]||=e=>T.value=e,label:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.label`),description:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.description`),placeholder:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.placeholder`)},null,8,[`modelValue`,`label`,`description`,`placeholder`])]}),_:1},8,[`title`,`description`])]),_:1})]),_:1},8,[`provider-name`,`provider-icon-color`,`on-back`])}}});typeof v==`function`&&v(b);var x=b;export{x as default};
\ No newline at end of file
diff --git a/assets/cloudflare-workers-ai-M--wBxqu.js b/assets/cloudflare-workers-ai-M--wBxqu.js
deleted file mode 100644
index df9dd64d0ebf2fd2197d85e5f60ddebea44515bf..0000000000000000000000000000000000000000
--- a/assets/cloudflare-workers-ai-M--wBxqu.js
+++ /dev/null
@@ -1 +0,0 @@
-import{computed as e,createBlock as t,createVNode as n,defineComponent as r,onMounted as i,openBlock as a,storeToRefs as o,unref as s,useI18n as c,useRouter as l,watch as u,withCtx as d}from"./index-Cf-fA00n.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import{useProvidersStore as f}from"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import"./src-BdFbE9Gc.js";import{ProviderAccountIdInput_default as p,ProviderApiKeyInput_default as m,ProviderBasicSettings_default as h,ProviderSettingsContainer_default as g,ProviderSettingsLayout_default as _}from"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{route_block_default as v}from"./route-block-BOaMwwtm.js";const y=`cloudflare-workers-ai`;var b=r({__name:`cloudflare-workers-ai`,setup(r){let{t:v}=c(),b=l(),x=f(),{providers:S}=o(x),C=e(()=>x.getProviderMetadata(y)),w=e({get:()=>{var e;return(e=S.value[y])?.apiKey||``},set:e=>{S.value[y]||(S.value[y]={}),S.value[y].apiKey=e}}),T=e({get:()=>{var e;return(e=S.value[y])?.accountId||``},set:e=>{S.value[y]||(S.value[y]={}),S.value[y].accountId=e}});i(()=>{var e,t;x.initializeProvider(y),w.value=(e=S.value[y])?.apiKey||``,T.value=(t=S.value[y])?.accountId||``}),u([w,T],()=>{S.value[y]={...S.value[y],apiKey:w.value,accountId:T.value}});function E(){var e;S.value[y]={...(e=C.value)?.defaultOptions}}return(e,r)=>{var i,o;return a(),t(s(_),{"provider-name":(i=C.value)?.localizedName,"provider-icon-color":(o=C.value)?.iconColor,"on-back":()=>s(b).back()},{default:d(()=>[n(s(g),null,{default:d(()=>[n(s(h),{title:s(v)(`settings.pages.providers.common.section.basic.title`),description:s(v)(`settings.pages.providers.common.section.basic.description`),"on-reset":E},{default:d(()=>{var e;return[n(s(m),{modelValue:w.value,"onUpdate:modelValue":r[0]||=e=>w.value=e,"provider-name":(e=C.value)?.localizedName,placeholder:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.api-key.placeholder`)},null,8,[`modelValue`,`provider-name`,`placeholder`]),n(s(p),{modelValue:T.value,"onUpdate:modelValue":r[1]||=e=>T.value=e,label:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.label`),description:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.description`),placeholder:s(v)(`settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.placeholder`)},null,8,[`modelValue`,`label`,`description`,`placeholder`])]}),_:1},8,[`title`,`description`])]),_:1})]),_:1},8,[`provider-name`,`provider-icon-color`,`on-back`])}}});typeof v==`function`&&v(b);var x=b;export{x as default};
\ No newline at end of file
diff --git a/assets/color-scheme-BB8LYAOa.js b/assets/color-scheme-BB8LYAOa.js
new file mode 100644
index 0000000000000000000000000000000000000000..a6eadafbcdfc389fb6406ce61b1028d2bb496e2f
--- /dev/null
+++ b/assets/color-scheme-BB8LYAOa.js
@@ -0,0 +1 @@
+import{Fragment as e,__plugin_vue_export_helper_default as t,createBaseVNode as n,createBlock as r,createElementBlock as i,createTextVNode as a,createVNode as o,defineComponent as s,openBlock as c,renderList as l,resolveDirective as u,toDisplayString as d,unref as f,useI18n as p,useSettings as m,vModelCheckbox as h,withCtx as g,withDirectives as _}from"./index-BSwg6FIo.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-D9DoS9jO.js";import"./types-Ba2_UENo.js";import"./stores-BzkLfyIH.js";import"./__vite-browser-external-CoPuN2cl.js";import"./Button-AEge-Qyg.js";import{ColorHueRange_default as v}from"./src-CX9nVT7I.js";import"./dist-BziUufTI.js";import{Section_default as y}from"./components-DetbLrEi.js";import"./composables-BpmQTBvS.js";import"./queue-Cw0r8hJ-.js";import"./sleep-CvjNLutj.js";import"./queues-XZuprNy-.js";import"./dist-D1uPCnfx.js";import"./webgpu-aYTuek9b.js";import{route_block_default as b}from"./route-block-CC3cgg4Q.js";import{ColorPalette_default as x}from"./ColorPalette-BdHvvd1C.js";var S=[[],[`#A5978B`,`#D8CAAF`,`#B8B4A7`,`#C4BCB1`,`#E5DED8`,`#9A8F7D`,`#BEB5A7`,`#C9C0B6`],[`#7A9EAF`,`#B8C7CC`,`#D4B79C`,`#8B9D77`,`#C7D5CB`,`#E6D0B1`,`#94A7B1`,`#B4C8C3`],[`#D9B48F`,`#B5917A`,`#8C7A6B`,`#A17F5F`,`#B98C46`,`#C7A252`,`#DAB300`,`#D19826`],[`#9BA7B0`,`#C1CBD4`,`#A5ADB6`,`#8B959E`,`#D4DCE4`,`#7F8A94`,`#B3BCC6`,`#98A4AE`],[`#E4C6D0`,`#A61B29`,`#5D513C`,`#789262`,`#1C0D1A`,`#F7C242`,`#62A9DD`,`#8C4B3C`]];const C={flex:``,"items-center":``,"justify-between":``,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:300,delay:5*50,transition:`all ease-in-out duration-250`},w={"text-lg":``,"font-semibold":``},T={relative:``,flex:``,"cursor-pointer":``,"items-center":``,"gap-2":``},E={class:`color-bar`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:320,delay:7*50,transition:`all ease-in-out duration-250`},D={"text-white":``,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:330,delay:8*50,transition:`all ease-in-out duration-250`},O={class:`color-bar transparency-grid`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:340,delay:9*50,transition:`all ease-in-out duration-250`},k=[`duration`,`delay`],A={"font-medium":``},j={text:`sm neutral-500`},M={text:`neutral-200/50 dark:neutral-600/20`,"pointer-events-none":``,fixed:``,top:`[65dvh]`,"right--15":``,"z--1":``,initial:{scale:.9,opacity:0,rotate:30},enter:{scale:1,opacity:1,rotate:0},duration:250,flex:``,"items-center":``,"justify-center":``};var N=s({__name:`color-scheme`,setup(t){let s=m(),{t:b}=p();return(t,p)=>{let m=u(`motion`);return c(),i(e,null,[_((c(),r(f(y),{"mb-2":``,title:f(b)(`settings.pages.themes.sections.section.custom-color.title`),icon:`i-solar:pallete-2-bold-duotone`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:290,delay:4*50,transition:`all ease-in-out duration-250`},{default:g(()=>[_((c(),i(`div`,C,[n(`span`,w,d(t.$t(`settings.pages.themes.sections.section.custom-color.fields.field.primary-color.label`)),1),n(`label`,T,[_(n(`input`,{"onUpdate:modelValue":p[0]||=e=>f(s).themeColorsHueDynamic=e,type:`checkbox`,class:`peer sr-only`},null,512),[[h,f(s).themeColorsHueDynamic]]),p[2]||=n(`div`,{class:`h-6 w-11 rounded-full bg-neutral-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white dark:bg-neutral-600 peer-checked:bg-primary-500 after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white`},null,-1),a(` `+d(t.$t(`settings.pages.themes.sections.section.custom-color.fields.field.primary-color.rgb-on.title`)),1)])])),[[m]]),_(o(f(v),{modelValue:f(s).themeColorsHue,"onUpdate:modelValue":p[1]||=e=>f(s).themeColorsHue=e,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:310,delay:6*50,disabled:f(s).themeColorsHueDynamic},null,8,[`modelValue`,`disabled`]),[[m]]),_((c(),i(`div`,E,[p[4]||=n(`span`,{"bg-primary-50":``},`50`,-1),p[5]||=n(`span`,{"bg-primary-100":``},`100`,-1),p[6]||=n(`span`,{"bg-primary-200":``},`200`,-1),p[7]||=n(`span`,{"bg-primary-300":``},`300`,-1),p[8]||=n(`span`,{"bg-primary-400":``},`400`,-1),p[9]||=n(`span`,{"bg-primary-500":``},`500`,-1),_((c(),i(`div`,D,p[3]||=[n(`span`,{"bg-primary-600":``},`600`,-1),n(`span`,{"bg-primary-700":``},`700`,-1),n(`span`,{"bg-primary-800":``},`800`,-1),n(`span`,{"bg-primary-900":``},`900`,-1),n(`span`,{"bg-primary-950":``},`950`,-1)])),[[m]])])),[[m]]),_((c(),i(`div`,O,p[10]||=[n(`span`,{bg:`primary-500/5`},`500/5`,-1),n(`span`,{bg:`primary-500/10`},`500/10`,-1),n(`span`,{bg:`primary-500/20`},`500/20`,-1),n(`span`,{bg:`primary-500/30`},`500/30`,-1),n(`span`,{bg:`primary-500/40`},`500/40`,-1),n(`span`,{bg:`primary-500/50`},`500/50`,-1),n(`span`,{bg:`primary-500/60`},`500/60`,-1),n(`span`,{bg:`primary-500/70`},`500/70`,-1),n(`span`,{bg:`primary-500/80`},`500/80`,-1),n(`span`,{bg:`primary-500/90`},`500/90`,-1),n(`span`,{bg:`primary-500`},`500`,-1)])),[[m]])]),_:1},8,[`title`])),[[m]]),_((c(),r(f(y),{"mb-2":``,title:f(b)(`settings.pages.themes.sections.section.theme-presets.title`),icon:`i-solar:magic-stick-2-bold-duotone`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:350,delay:10*50,transition:`all ease-in-out duration-250`},{default:g(()=>[(c(!0),i(e,null,l(t.$tm(`settings.pages.themes.sections.section.theme-presets.presets`),({title:e,description:r,colors:a},s)=>_((c(),i(`div`,{key:s,class:`w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out`,bg:`neutral-100 dark:neutral-800`,hover:`bg-neutral-200 dark:bg-neutral-700`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:360+s*10,delay:11*50+s*50,transition:`all ease-in-out duration-250`},[n(`div`,null,[n(`span`,A,d(t.$rt(e)),1),n(`div`,j,d(t.$rt(r)),1)]),o(x,{colors:a.map((e,n)=>({hex:f(S)[s][n],name:t.$rt(e)}))},null,8,[`colors`])],8,k)),[[m]])),128))]),_:1},8,[`title`])),[[m]]),_((c(),i(`div`,M,p[11]||=[n(`div`,{text:`60`,"i-solar:pallete-2-bold-duotone":``},null,-1)])),[[m]])],64)}}});typeof b==`function`&&b(N);var P=t(N,[[`__scopeId`,`data-v-29f357ba`]]);export{P as default};
\ No newline at end of file
diff --git a/assets/color-scheme-CskZyzcJ.js b/assets/color-scheme-CskZyzcJ.js
deleted file mode 100644
index deed5305519b983aadffce76d56c4813755a125a..0000000000000000000000000000000000000000
--- a/assets/color-scheme-CskZyzcJ.js
+++ /dev/null
@@ -1 +0,0 @@
-import{Fragment as e,__plugin_vue_export_helper_default as t,createBaseVNode as n,createBlock as r,createElementBlock as i,createTextVNode as a,createVNode as o,defineComponent as s,openBlock as c,renderList as l,resolveDirective as u,toDisplayString as d,unref as f,useI18n as p,useSettings as m,vModelCheckbox as h,withCtx as g,withDirectives as _}from"./index-Cf-fA00n.js";import"./import-url-browser-DNuYZxPr.js";import"./duckdb-mvp-C3i5IjU8.js";import"./index-CISmcbXk-BFnELXJu.js";import"./types-Ba2_UENo.js";import"./stores-aCC6ZHpf.js";import"./Button-DMzywyj7.js";import{ColorHueRange_default as v}from"./src-BdFbE9Gc.js";import"./dist-DbabDsG-.js";import{Section_default as y}from"./components-BSoqAjUI.js";import"./composables-DLneOHEU.js";import"./queue-BTyzVjP2.js";import"./sleep-CeqmTEA-.js";import"./queues-DsznaBl8.js";import"./dist-DZR9wFAU.js";import"./webgpu-D5T_t3sR.js";import{route_block_default as b}from"./route-block-BOaMwwtm.js";import{ColorPalette_default as x}from"./ColorPalette-DFqjkBzI.js";var S=[[],[`#A5978B`,`#D8CAAF`,`#B8B4A7`,`#C4BCB1`,`#E5DED8`,`#9A8F7D`,`#BEB5A7`,`#C9C0B6`],[`#7A9EAF`,`#B8C7CC`,`#D4B79C`,`#8B9D77`,`#C7D5CB`,`#E6D0B1`,`#94A7B1`,`#B4C8C3`],[`#D9B48F`,`#B5917A`,`#8C7A6B`,`#A17F5F`,`#B98C46`,`#C7A252`,`#DAB300`,`#D19826`],[`#9BA7B0`,`#C1CBD4`,`#A5ADB6`,`#8B959E`,`#D4DCE4`,`#7F8A94`,`#B3BCC6`,`#98A4AE`],[`#E4C6D0`,`#A61B29`,`#5D513C`,`#789262`,`#1C0D1A`,`#F7C242`,`#62A9DD`,`#8C4B3C`]];const C={flex:``,"items-center":``,"justify-between":``,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:300,delay:5*50,transition:`all ease-in-out duration-250`},w={"text-lg":``,"font-semibold":``},T={relative:``,flex:``,"cursor-pointer":``,"items-center":``,"gap-2":``},E={class:`color-bar`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:320,delay:7*50,transition:`all ease-in-out duration-250`},D={"text-white":``,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:330,delay:8*50,transition:`all ease-in-out duration-250`},O={class:`color-bar transparency-grid`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:340,delay:9*50,transition:`all ease-in-out duration-250`},k=[`duration`,`delay`],A={"font-medium":``},j={text:`sm neutral-500`},M={text:`neutral-200/50 dark:neutral-600/20`,"pointer-events-none":``,fixed:``,top:`[65dvh]`,"right--15":``,"z--1":``,initial:{scale:.9,opacity:0,rotate:30},enter:{scale:1,opacity:1,rotate:0},duration:250,flex:``,"items-center":``,"justify-center":``};var N=s({__name:`color-scheme`,setup(t){let s=m(),{t:b}=p();return(t,p)=>{let m=u(`motion`);return c(),i(e,null,[_((c(),r(f(y),{"mb-2":``,title:f(b)(`settings.pages.themes.sections.section.custom-color.title`),icon:`i-solar:pallete-2-bold-duotone`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:290,delay:4*50,transition:`all ease-in-out duration-250`},{default:g(()=>[_((c(),i(`div`,C,[n(`span`,w,d(t.$t(`settings.pages.themes.sections.section.custom-color.fields.field.primary-color.label`)),1),n(`label`,T,[_(n(`input`,{"onUpdate:modelValue":p[0]||=e=>f(s).themeColorsHueDynamic=e,type:`checkbox`,class:`peer sr-only`},null,512),[[h,f(s).themeColorsHueDynamic]]),p[2]||=n(`div`,{class:`h-6 w-11 rounded-full bg-neutral-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white dark:bg-neutral-600 peer-checked:bg-primary-500 after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white`},null,-1),a(` `+d(t.$t(`settings.pages.themes.sections.section.custom-color.fields.field.primary-color.rgb-on.title`)),1)])])),[[m]]),_(o(f(v),{modelValue:f(s).themeColorsHue,"onUpdate:modelValue":p[1]||=e=>f(s).themeColorsHue=e,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:310,delay:6*50,disabled:f(s).themeColorsHueDynamic},null,8,[`modelValue`,`disabled`]),[[m]]),_((c(),i(`div`,E,[p[4]||=n(`span`,{"bg-primary-50":``},`50`,-1),p[5]||=n(`span`,{"bg-primary-100":``},`100`,-1),p[6]||=n(`span`,{"bg-primary-200":``},`200`,-1),p[7]||=n(`span`,{"bg-primary-300":``},`300`,-1),p[8]||=n(`span`,{"bg-primary-400":``},`400`,-1),p[9]||=n(`span`,{"bg-primary-500":``},`500`,-1),_((c(),i(`div`,D,p[3]||=[n(`span`,{"bg-primary-600":``},`600`,-1),n(`span`,{"bg-primary-700":``},`700`,-1),n(`span`,{"bg-primary-800":``},`800`,-1),n(`span`,{"bg-primary-900":``},`900`,-1),n(`span`,{"bg-primary-950":``},`950`,-1)])),[[m]])])),[[m]]),_((c(),i(`div`,O,p[10]||=[n(`span`,{bg:`primary-500/5`},`500/5`,-1),n(`span`,{bg:`primary-500/10`},`500/10`,-1),n(`span`,{bg:`primary-500/20`},`500/20`,-1),n(`span`,{bg:`primary-500/30`},`500/30`,-1),n(`span`,{bg:`primary-500/40`},`500/40`,-1),n(`span`,{bg:`primary-500/50`},`500/50`,-1),n(`span`,{bg:`primary-500/60`},`500/60`,-1),n(`span`,{bg:`primary-500/70`},`500/70`,-1),n(`span`,{bg:`primary-500/80`},`500/80`,-1),n(`span`,{bg:`primary-500/90`},`500/90`,-1),n(`span`,{bg:`primary-500`},`500`,-1)])),[[m]])]),_:1},8,[`title`])),[[m]]),_((c(),r(f(y),{"mb-2":``,title:f(b)(`settings.pages.themes.sections.section.theme-presets.title`),icon:`i-solar:magic-stick-2-bold-duotone`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:350,delay:10*50,transition:`all ease-in-out duration-250`},{default:g(()=>[(c(!0),i(e,null,l(t.$tm(`settings.pages.themes.sections.section.theme-presets.presets`),({title:e,description:r,colors:a},s)=>_((c(),i(`div`,{key:s,class:`w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out`,bg:`neutral-100 dark:neutral-800`,hover:`bg-neutral-200 dark:bg-neutral-700`,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:360+s*10,delay:11*50+s*50,transition:`all ease-in-out duration-250`},[n(`div`,null,[n(`span`,A,d(t.$rt(e)),1),n(`div`,j,d(t.$rt(r)),1)]),o(x,{colors:a.map((e,n)=>({hex:f(S)[s][n],name:t.$rt(e)}))},null,8,[`colors`])],8,k)),[[m]])),128))]),_:1},8,[`title`])),[[m]]),_((c(),i(`div`,M,p[11]||=[n(`div`,{text:`60`,"i-solar:pallete-2-bold-duotone":``},null,-1)])),[[m]])],64)}}});typeof b==`function`&&b(N);var P=t(N,[[`__scopeId`,`data-v-29f357ba`]]);export{P as default};
\ No newline at end of file
diff --git a/assets/components-BSoqAjUI.js b/assets/components-DetbLrEi.js
similarity index 97%
rename from assets/components-BSoqAjUI.js
rename to assets/components-DetbLrEi.js
index 47900bfadc727a6b5a8012767e36d221de2681cd..682ea82a378074d414155ab2a65f41c6b0e0b553 100644
--- a/assets/components-BSoqAjUI.js
+++ b/assets/components-DetbLrEi.js
@@ -1,5 +1,5 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/__vite-browser-external-Cbx_usA-.js","assets/index-Cf-fA00n.js","assets/index-5P7QcyEX.css","assets/default-node-BTCCoimW.js","assets/import-url-browser-CajlDqRn.js","assets/import-url-browser-DNuYZxPr.js","assets/duckdb-mvp-C3i5IjU8.js","assets/import-url-node-BGiLk3V8.js"])))=>i.map(i=>d[i]);
-var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return exports.defineProperty=i,exports}({});import{AdditiveBlending as t,AlwaysStencilFunc as n,AnimationMixer as r,Audio as i,AudioListener as a,AudioLoader as o,BackSide as s,Box2 as c,Box3 as l,BoxGeometry as u,BufferAttribute as d,BufferGeometry as f,CatmullRomCurve3 as p,ClampToEdgeWrapping as m,Color as h,CompressedTexture as g,CubeCamera as _,CubeReflectionMapping as v,CubeTextureLoader as y,CylinderGeometry as b,DataTexture as x,DataTextureLoader as S,DataUtils as C,DepthTexture as w,DoubleSide as T,EdgesGeometry as E,Ee as D,EquirectangularReflectionMapping as O,Euler as k,EventDispatcher as A,ExtrudeGeometry as j,FileLoader as M,Float32BufferAttribute as N,FloatType as ee,Fragment as P,FrontSide as F,Group as I,HalfFloatType as te,InstancedBufferGeometry as ne,InstancedInterleavedBuffer as L,InstancedMesh as re,InterleavedBuffer as R,InterleavedBufferAttribute as ie,InterpolateDiscrete as ae,InterpolateLinear as oe,Ir as se,Line as ce,Line3 as le,LineBasicMaterial as ue,LinearFilter as de,LinearMipmapLinearFilter as fe,LinearMipmapNearestFilter as pe,Loader as me,MOUSE as he,Material as ge,MathUtils as _e,Matrix3 as ve,Matrix4 as ye,Mesh as be,MeshBasicMaterial as xe,MeshDepthMaterial as Se,MeshStandardMaterial as Ce,MirroredRepeatWrapping as we,Mn as Te,NearestFilter as Ee,NearestMipmapLinearFilter as De,NearestMipmapNearestFilter as Oe,NoToneMapping as ke,Object3D as Ae,OctahedronGeometry as je,OrthographicCamera as Me,Path as Ne,PerspectiveCamera as Pe,Plane as Fe,PlaneGeometry as Ie,PropertyBinding as Le,Q as Re,QuadraticBezierCurve3 as ze,Quaternion as Be,REVISION as Ve,RGBAFormat as He,RawShaderMaterial as Ue,Ray as We,Raycaster as Ge,RepeatWrapping as Ke,ReplaceStencilOp as qe,Scene as Je,ShaderChunk as Ye,ShaderMaterial as Xe,Shape as Ze,ShapeGeometry as Qe,ShapePath as $e,ShapeUtils as et,SkinnedMesh as tt,Sphere as nt,SphereGeometry as rt,Spherical as it,TOUCH as at,Texture as ot,TextureLoader as st,TorusGeometry as ct,Triangle as lt,Uniform as ut,UniformsLib as dt,UniformsUtils as ft,Vector2 as pt,Vector3 as z,Vector4 as mt,Vn as ht,WebGLCubeRenderTarget as gt,WebGLRenderTarget as _t,WebGLRenderer as vt,WireframeGeometry as yt,__commonJSMin as bt,__export as xt,__plugin_vue_export_helper_default as St,__require as Ct,__toDynamicImportESM as wt,__toESM as Tt,__vitePreload as Et,breakpointsTailwind as Dt,computed as Ot,createBaseVNode as B,createBlock as kt,createCommentVNode as At,createElementBlock as V,createTextVNode as jt,createVNode as Mt,defineComponent as H,defu as Nt,dn as Pt,formatHex as Ft,getCurrentInstance as It,getCurrentScope as Lt,guardReactiveProps as Rt,io as zt,isReactive as Bt,isRef as Vt,mergeModels as Ht,mergeProps as Ut,nextTick as Wt,normalizeClass as Gt,normalizeProps as Kt,normalizeStyle as qt,onBeforeUnmount as Jt,onMounted as Yt,onScopeDispose as Xt,onUnmounted as Zt,openBlock as U,pe as Qt,reactive as $t,ref as W,render as en,renderList as tn,renderSlot as nn,resolveComponent as rn,resolveDirective as an,shallowReactive as on,shallowRef as sn,so as cn,storeToRefs as ln,toDisplayString as un,toRaw as dn,toRef as fn,toRefs as pn,toValue$1 as mn,unref as G,useAttrs as hn,useBreakpoints as gn,useDark as _n,useDebounceFn as vn,useElementBounding as yn,useI18n as bn,useModel as xn,useRouter as Sn,useSettings as Cn,useSlots as wn,useWindowSize as Tn,vModelCheckbox as En,vModelRadio as Dn,vModelSelect as On,vModelText as kn,watch as K,watchDebounced as An,watchEffect as jn,withAsyncContext as Mn,withCtx as Nn,withDirectives as Pn,withModifiers as Fn}from"./index-Cf-fA00n.js";import{getImportUrlBundles as In}from"./import-url-browser-DNuYZxPr.js";import{generateSpeech as Ln,useAudioContext as Rn,useChatStore as zn,useProvidersStore as Bn,useSpeakingStore as Vn,useSpeechStore as Hn}from"./stores-aCC6ZHpf.js";import{Collapsable_default as Un,TransitionVertical_default as Wn}from"./Button-DMzywyj7.js";import{FieldCheckbox_default as Gn,FieldInput_default as Kn,Input_default as qn}from"./src-BdFbE9Gc.js";import{VRMUtils as Jn,clipFromVRMAnimation as Yn,lerp as Xn,loadVRMAnimation as Zn,loadVrm as Qn,randFloat as $n,randomSaccadeInterval as er,useBlink as tr,useIdleEyeSaccades as nr,useMarkdown as rr,useVRMEmote as ir}from"./composables-DLneOHEU.js";import{useQueue as ar}from"./queue-BTyzVjP2.js";import{EMOTION_EmotionMotionName_value as or,EMOTION_VRMExpressionName_value as sr,EmotionThinkMotionName as cr,llmInferenceEndToken as lr,useDelayMessageQueue as ur,useEmotionsMessageQueue as dr,useMessageContentQueue as fr}from"./queues-DsznaBl8.js";var pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i;let ea,ta,na,ra;var ia=H({__name:`AudioSpectrum`,props:{stream:null,bars:{default:32},minFreq:{default:60},maxFreq:{default:4e3}},setup(e){let t=e,n=W(Array.from({length:t.bars}).fill(0));Yt(()=>{r()}),K(()=>t.stream,()=>{r()});function r(){if(!t.stream)return;let e=new(window.AudioContext||window.webkitAudioContext),r=e.createMediaStreamSource(t.stream),i=e.createAnalyser();i.fftSize=2048,r.connect(i);let a=i.frequencyBinCount,o=new Uint8Array(a),s=e.sampleRate,c=s/i.fftSize,l=Math.floor(t.minFreq/c),u=Math.floor(t.maxFreq/c),d=u-l,f=Math.floor(d/t.bars),p=()=>{try{requestAnimationFrame(p),i.getByteFrequencyData(o);let e=Array.from({length:t.bars}).fill(0);for(let n=0;nnn(e.$slots,`default`,{frequencies:n.value})}}),aa=ia;const oa={"h-full":``,flex:``,"items-center":``,"gap-1":``},sa=5;var ca=H({__name:`AudioSpectrumVisualizer`,props:{frequencies:null,barsClass:null},setup(e){let t=e;function n(e,t){let n=.1,r=1;return n+(r-n)*(e/t)}function r(e,r){let i=n(r,t.frequencies.length);return Math.min(100,Math.max(10,e*100*sa*i))}return(t,n)=>(U(),V(`div`,oa,[(U(!0),V(P,null,tn(e.frequencies,(t,n)=>(U(),V(`div`,{key:n,"h-full":``,flex:``,"flex-1":``,"items-end":``},[B(`div`,{transition:`all 100 ease-in-out`,"mx-auto":``,"my-0":``,"w-full":``,"rounded-full":``,class:Gt(e.barsClass),style:qt({height:`${r(t,n)}%`})},null,6)]))),128))]))}}),la=ca,ua=H({__name:`Volumed`,props:{perspective:null,transform:null},setup(e){return(t,n)=>(U(),V(`div`,{class:`volumed`,style:qt({perspective:`${e.perspective}px`,transform:e.transform})},[nn(t.$slots,`default`,{},void 0,!0)],4))}}),da=St(ua,[[`__scopeId`,`data-v-568551bc`]]),fa=H({__name:`CursorMomentum`,props:{baseSpeed:{default:.1},friction:{default:.95},momentumFactor:{default:.005}},setup(e,{expose:t}){let n=e,r=W(1),i=W(0),a=0,o=fn(()=>n.friction),s=fn(()=>n.baseSpeed),c=fn(()=>n.momentumFactor);function l(e){a||=e;let t=e-a;a=e,r.value=s.value+(r.value-s.value)*o.value,i.value+=r.value*t,requestAnimationFrame(l)}function u(e){let t=Math.sqrt(e.movementX**2+e.movementY**2);r.value+=t*c.value}return Yt(()=>{window.addEventListener(`mousemove`,u),requestAnimationFrame(l)}),Zt(()=>{window.removeEventListener(`mousemove`,u)}),t({momentum:r,currentValue:i}),(e,t)=>nn(e.$slots,`default`,{momentum:r.value,currentValue:i.value})}}),pa=fa,ma=H({__name:`TestDummyMarkerFlat`,props:{size:null},setup(e){return(t,n)=>(U(),V(`div`,{class:`test-dummy-flat`,style:qt({width:`${e.size}px`,height:`${e.size}px`})},n[0]||=[B(`div`,{class:`marker`},null,-1)],4))}}),ha=St(ma,[[`__scopeId`,`data-v-b4ef37ac`]]),ga=H({__name:`TestDummyMarker`,setup(e){return(e,t)=>(U(),kt(pa,{"base-speed":.1,friction:.95,"momentum-factor":5e-4},{default:Nn(({currentValue:e})=>[Mt(da,{perspective:800,transform:`rotateX(45deg) translateY(3px)`},{default:Nn(()=>[Mt(ha,{size:24,style:qt({transform:`rotate(${e}deg)`})},null,8,[`style`])]),_:2},1024)]),_:1}))}}),_a=ga,va;(function(e){e[e.WEBGL_LEGACY=0]=`WEBGL_LEGACY`,e[e.WEBGL=1]=`WEBGL`,e[e.WEBGL2=2]=`WEBGL2`})(va||={});var ya;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.WEBGL=1]=`WEBGL`,e[e.CANVAS=2]=`CANVAS`})(ya||={});var ba;(function(e){e[e.COLOR=16384]=`COLOR`,e[e.DEPTH=256]=`DEPTH`,e[e.STENCIL=1024]=`STENCIL`})(ba||={});var xa;(function(e){e[e.NORMAL=0]=`NORMAL`,e[e.ADD=1]=`ADD`,e[e.MULTIPLY=2]=`MULTIPLY`,e[e.SCREEN=3]=`SCREEN`,e[e.OVERLAY=4]=`OVERLAY`,e[e.DARKEN=5]=`DARKEN`,e[e.LIGHTEN=6]=`LIGHTEN`,e[e.COLOR_DODGE=7]=`COLOR_DODGE`,e[e.COLOR_BURN=8]=`COLOR_BURN`,e[e.HARD_LIGHT=9]=`HARD_LIGHT`,e[e.SOFT_LIGHT=10]=`SOFT_LIGHT`,e[e.DIFFERENCE=11]=`DIFFERENCE`,e[e.EXCLUSION=12]=`EXCLUSION`,e[e.HUE=13]=`HUE`,e[e.SATURATION=14]=`SATURATION`,e[e.COLOR=15]=`COLOR`,e[e.LUMINOSITY=16]=`LUMINOSITY`,e[e.NORMAL_NPM=17]=`NORMAL_NPM`,e[e.ADD_NPM=18]=`ADD_NPM`,e[e.SCREEN_NPM=19]=`SCREEN_NPM`,e[e.NONE=20]=`NONE`,e[e.SRC_OVER=0]=`SRC_OVER`,e[e.SRC_IN=21]=`SRC_IN`,e[e.SRC_OUT=22]=`SRC_OUT`,e[e.SRC_ATOP=23]=`SRC_ATOP`,e[e.DST_OVER=24]=`DST_OVER`,e[e.DST_IN=25]=`DST_IN`,e[e.DST_OUT=26]=`DST_OUT`,e[e.DST_ATOP=27]=`DST_ATOP`,e[e.ERASE=26]=`ERASE`,e[e.SUBTRACT=28]=`SUBTRACT`,e[e.XOR=29]=`XOR`})(xa||={});var Sa;(function(e){e[e.POINTS=0]=`POINTS`,e[e.LINES=1]=`LINES`,e[e.LINE_LOOP=2]=`LINE_LOOP`,e[e.LINE_STRIP=3]=`LINE_STRIP`,e[e.TRIANGLES=4]=`TRIANGLES`,e[e.TRIANGLE_STRIP=5]=`TRIANGLE_STRIP`,e[e.TRIANGLE_FAN=6]=`TRIANGLE_FAN`})(Sa||={});var Ca;(function(e){e[e.RGBA=6408]=`RGBA`,e[e.RGB=6407]=`RGB`,e[e.RG=33319]=`RG`,e[e.RED=6403]=`RED`,e[e.RGBA_INTEGER=36249]=`RGBA_INTEGER`,e[e.RGB_INTEGER=36248]=`RGB_INTEGER`,e[e.RG_INTEGER=33320]=`RG_INTEGER`,e[e.RED_INTEGER=36244]=`RED_INTEGER`,e[e.ALPHA=6406]=`ALPHA`,e[e.LUMINANCE=6409]=`LUMINANCE`,e[e.LUMINANCE_ALPHA=6410]=`LUMINANCE_ALPHA`,e[e.DEPTH_COMPONENT=6402]=`DEPTH_COMPONENT`,e[e.DEPTH_STENCIL=34041]=`DEPTH_STENCIL`})(Ca||={});var wa;(function(e){e[e.TEXTURE_2D=3553]=`TEXTURE_2D`,e[e.TEXTURE_CUBE_MAP=34067]=`TEXTURE_CUBE_MAP`,e[e.TEXTURE_2D_ARRAY=35866]=`TEXTURE_2D_ARRAY`,e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]=`TEXTURE_CUBE_MAP_POSITIVE_X`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]=`TEXTURE_CUBE_MAP_NEGATIVE_X`,e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]=`TEXTURE_CUBE_MAP_POSITIVE_Y`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]=`TEXTURE_CUBE_MAP_NEGATIVE_Y`,e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]=`TEXTURE_CUBE_MAP_POSITIVE_Z`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]=`TEXTURE_CUBE_MAP_NEGATIVE_Z`})(wa||={});var Ta;(function(e){e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.UNSIGNED_SHORT_5_6_5=33635]=`UNSIGNED_SHORT_5_6_5`,e[e.UNSIGNED_SHORT_4_4_4_4=32819]=`UNSIGNED_SHORT_4_4_4_4`,e[e.UNSIGNED_SHORT_5_5_5_1=32820]=`UNSIGNED_SHORT_5_5_5_1`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]=`UNSIGNED_INT_10F_11F_11F_REV`,e[e.UNSIGNED_INT_2_10_10_10_REV=33640]=`UNSIGNED_INT_2_10_10_10_REV`,e[e.UNSIGNED_INT_24_8=34042]=`UNSIGNED_INT_24_8`,e[e.UNSIGNED_INT_5_9_9_9_REV=35902]=`UNSIGNED_INT_5_9_9_9_REV`,e[e.BYTE=5120]=`BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.INT=5124]=`INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]=`FLOAT_32_UNSIGNED_INT_24_8_REV`,e[e.HALF_FLOAT=36193]=`HALF_FLOAT`})(Ta||={});var Ea;(function(e){e[e.FLOAT=0]=`FLOAT`,e[e.INT=1]=`INT`,e[e.UINT=2]=`UINT`})(Ea||={});var Da;(function(e){e[e.NEAREST=0]=`NEAREST`,e[e.LINEAR=1]=`LINEAR`})(Da||={});var Oa;(function(e){e[e.CLAMP=33071]=`CLAMP`,e[e.REPEAT=10497]=`REPEAT`,e[e.MIRRORED_REPEAT=33648]=`MIRRORED_REPEAT`})(Oa||={});var ka;(function(e){e[e.OFF=0]=`OFF`,e[e.POW2=1]=`POW2`,e[e.ON=2]=`ON`,e[e.ON_MANUAL=3]=`ON_MANUAL`})(ka||={});var Aa;(function(e){e[e.NPM=0]=`NPM`,e[e.UNPACK=1]=`UNPACK`,e[e.PMA=2]=`PMA`,e[e.NO_PREMULTIPLIED_ALPHA=0]=`NO_PREMULTIPLIED_ALPHA`,e[e.PREMULTIPLY_ON_UPLOAD=1]=`PREMULTIPLY_ON_UPLOAD`,e[e.PREMULTIPLY_ALPHA=2]=`PREMULTIPLY_ALPHA`,e[e.PREMULTIPLIED_ALPHA=2]=`PREMULTIPLIED_ALPHA`})(Aa||={});var ja;(function(e){e[e.NO=0]=`NO`,e[e.YES=1]=`YES`,e[e.AUTO=2]=`AUTO`,e[e.BLEND=0]=`BLEND`,e[e.CLEAR=1]=`CLEAR`,e[e.BLIT=2]=`BLIT`})(ja||={});var Ma;(function(e){e[e.AUTO=0]=`AUTO`,e[e.MANUAL=1]=`MANUAL`})(Ma||={});var Na;(function(e){e.LOW=`lowp`,e.MEDIUM=`mediump`,e.HIGH=`highp`})(Na||={});var Pa;(function(e){e[e.NONE=0]=`NONE`,e[e.SCISSOR=1]=`SCISSOR`,e[e.STENCIL=2]=`STENCIL`,e[e.SPRITE=3]=`SPRITE`,e[e.COLOR=4]=`COLOR`})(Pa||={});var Fa;(function(e){e[e.RED=1]=`RED`,e[e.GREEN=2]=`GREEN`,e[e.BLUE=4]=`BLUE`,e[e.ALPHA=8]=`ALPHA`})(Fa||={});var Ia;(function(e){e[e.NONE=0]=`NONE`,e[e.LOW=2]=`LOW`,e[e.MEDIUM=4]=`MEDIUM`,e[e.HIGH=8]=`HIGH`})(Ia||={});var La;(function(e){e[e.ELEMENT_ARRAY_BUFFER=34963]=`ELEMENT_ARRAY_BUFFER`,e[e.ARRAY_BUFFER=34962]=`ARRAY_BUFFER`,e[e.UNIFORM_BUFFER=35345]=`UNIFORM_BUFFER`})(La||={});var Ra={createCanvas:function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,n},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var e;return(e=document.baseURI)??window.location.href},fetch:function(e,t){return fetch(e,t)}},za=/iPhone/i,Ba=/iPod/i,Va=/iPad/i,Ha=/\biOS-universal(?:.+)Mac\b/i,Ua=/\bAndroid(?:.+)Mobile\b/i,Wa=/Android/i,Ga=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ka=/Silk/i,qa=/Windows Phone/i,Ja=/\bWindows(?:.+)ARM\b/i,Ya=/BlackBerry/i,Xa=/BB10/i,Za=/Opera Mini/i,Qa=/\b(CriOS|Chrome)(?:.+)Mobile/i,$a=/Mobile(?:.+)Firefox\b/i,eo=function(e){return e!==void 0&&e.platform===`MacIntel`&&typeof e.maxTouchPoints==`number`&&e.maxTouchPoints>1&&typeof MSStream>`u`};function to(e){return function(t){return t.test(e)}}function no(e){var t={userAgent:``,platform:``,maxTouchPoints:0};!e&&typeof navigator<`u`?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e==`string`?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var n=t.userAgent,r=n.split(`[FBAN`);r[1]!==void 0&&(n=r[0]),r=n.split(`Twitter`),r[1]!==void 0&&(n=r[0]);var i=to(n),a={apple:{phone:i(za)&&!i(qa),ipod:i(Ba),tablet:!i(za)&&(i(Va)||eo(t))&&!i(qa),universal:i(Ha),device:(i(za)||i(Ba)||i(Va)||i(Ha)||eo(t))&&!i(qa)},amazon:{phone:i(Ga),tablet:!i(Ga)&&i(Ka),device:i(Ga)||i(Ka)},android:{phone:!i(qa)&&i(Ga)||!i(qa)&&i(Ua),tablet:!i(qa)&&!i(Ga)&&!i(Ua)&&(i(Ka)||i(Wa)),device:!i(qa)&&(i(Ga)||i(Ka)||i(Ua)||i(Wa))||i(/\bokhttp\b/i)},windows:{phone:i(qa),tablet:i(Ja),device:i(qa)||i(Ja)},other:{blackberry:i(Ya),blackberry10:i(Xa),opera:i(Za),firefox:i($a),chrome:i(Qa),device:i(Ya)||i(Xa)||i(Za)||i($a)||i(Qa)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var ro=no(globalThis.navigator);function io(){return!ro.apple.device}function ao(e){var t=!0;if(ro.tablet||ro.phone){if(ro.apple.device){var n=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(n){var r=parseInt(n[1],10);r<11&&(t=!1)}}if(ro.android.device){var n=navigator.userAgent.match(/Android\s([0-9.]*)/);if(n){var r=parseInt(n[1],10);r<7&&(t=!1)}}}return t?e:4}var oo={ADAPTER:Ra,MIPMAP_TEXTURES:ka.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:Ia.NONE,SPRITE_MAX_TEXTURES:ao(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:Ma.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Oa.CLAMP,SCALE_MODE:Da.LINEAR,PRECISION_VERTEX:Na.HIGH,PRECISION_FRAGMENT:ro.apple.device?Na.HIGH:Na.MEDIUM,CAN_UPLOAD_SAME_BUFFER:io(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},so=bt((exports,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{t.exports=n,t.exports.default=n;function n(e,t,n){n||=2;var i=t&&t.length,o=i?t[0]*n:e.length,s=r(e,0,o,n,!0),c=[];if(!s||s.next===s.prev)return c;var l,d,f,p,m,h,g;if(i&&(s=u(e,t,s,n)),e.length>80*n){l=f=e[0],d=p=e[1];for(var _=n;_f&&(f=m),h>p&&(p=h);g=Math.max(f-l,p-d),g=g===0?0:32767/g}return a(s,c,n,l,d,g,0),c}function r(e,t,n,r,i){var a,o;if(i===N(e,t,n,r)>0)for(a=t;a=t;a-=r)o=A(a,e[a],e[a+1],o);return o&&S(o,o.next)&&(j(o),o=o.next),o}function i(e,t){if(!e)return e;t||=e;var n=e,r;do if(r=!1,!n.steiner&&(S(n,n.next)||x(n.prev,n,n.next)===0)){if(j(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function a(e,t,n,r,u,d,f){if(e){!f&&d&&h(e,r,u,d);for(var p=e,m,g;e.prev!==e.next;){if(m=e.prev,g=e.next,d?s(e,r,u,d):o(e)){t.push(m.i/n|0),t.push(e.i/n|0),t.push(g.i/n|0),j(e),e=g.next,p=g.next;continue}if(e=g,e===p){f?f===1?(e=c(i(e),t,n),a(e,t,n,r,u,d,2)):f===2&&l(e,t,n,r,u,d):a(i(e),t,n,r,u,d,1);break}}}}function o(e){var t=e.prev,n=e,r=e.next;if(x(t,n,r)>=0)return!1;for(var i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=ia?i>o?i:o:a>o?a:o,p=s>c?s>l?s:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&y(i,s,a,c,o,l,m.x,m.y)&&x(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function s(e,t,n,r){var i=e.prev,a=e,o=e.next;if(x(i,a,o)>=0)return!1;for(var s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=sc?s>l?s:l:c>l?c:l,g=u>d?u>f?u:f:d>f?d:f,v=_(p,m,t,n,r),b=_(h,g,t,n,r),S=e.prevZ,C=e.nextZ;S&&S.z>=v&&C&&C.z<=b;){if(S.x>=p&&S.x<=h&&S.y>=m&&S.y<=g&&S!==i&&S!==o&&y(s,u,c,d,l,f,S.x,S.y)&&x(S.prev,S,S.next)>=0||(S=S.prevZ,C.x>=p&&C.x<=h&&C.y>=m&&C.y<=g&&C!==i&&C!==o&&y(s,u,c,d,l,f,C.x,C.y)&&x(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;S&&S.z>=v;){if(S.x>=p&&S.x<=h&&S.y>=m&&S.y<=g&&S!==i&&S!==o&&y(s,u,c,d,l,f,S.x,S.y)&&x(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;C&&C.z<=b;){if(C.x>=p&&C.x<=h&&C.y>=m&&C.y<=g&&C!==i&&C!==o&&y(s,u,c,d,l,f,C.x,C.y)&&x(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function c(e,t,n){var r=e;do{var a=r.prev,o=r.next.next;!S(a,o)&&C(a,r,r.next,o)&&D(a,o)&&D(o,a)&&(t.push(a.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),j(r),j(r.next),r=e=o),r=r.next}while(r!==e);return i(r)}function l(e,t,n,r,o,s){var c=e;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&b(c,l)){var u=k(c,l);c=i(c,c.next),u=i(u,u.next),a(c,t,n,r,o,s,0),a(u,t,n,r,o,s,0);return}l=l.next}c=c.next}while(c!==e)}function u(e,t,n,i){var a=[],o,s,c,l,u;for(o=0,s=t.length;o=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a&&(a=s,o=n.x=n.x&&n.x>=l&&r!==n.x&&y(io.x||n.x===o.x&&m(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function m(e,t){return x(e.prev,e,t.prev)<0&&x(t.next,e,e.next)<0}function h(e,t,n,r){var i=e;do i.z===0&&(i.z=_(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function _(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function v(e){var t=e,n=e;do(t.x=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function b(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!E(e,t)&&(D(e,t)&&D(t,e)&&O(e,t)&&(x(e.prev,e,t.prev)||x(e,t.prev,t))||S(e,t)&&x(e.prev,e,e.next)>0&&x(t.prev,t,t.next)>0)}function x(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function S(e,t){return e.x===t.x&&e.y===t.y}function C(e,t,n,r){var i=T(x(e,t,n)),a=T(x(e,t,r)),o=T(x(n,r,e)),s=T(x(n,r,t));return!!(i!==a&&o!==s||i===0&&w(e,n,t)||a===0&&w(e,r,t)||o===0&&w(n,e,r)||s===0&&w(n,t,r))}function w(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function T(e){return e>0?1:e<0?-1:0}function E(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&C(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function D(e,t){return x(e.prev,e,e.next)<0?x(e,t,e.next)>=0&&x(e,e.prev,t)>=0:x(e,t,e.prev)<0||x(e,e.next,t)<0}function O(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function k(e,t){var n=new M(e.i,e.x,e.y),r=new M(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function A(e,t,n,r){var i=new M(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function j(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function M(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}n.deviation=function(e,t,n,r){var i=t&&t.length,a=i?t[0]*n:e.length,o=Math.abs(N(e,0,a,n));if(i)for(var s=0,c=t.length;s0&&(r+=e[i-1].length,n.holes.push(r))}return n}}),lo=bt((exports,t)=>{(function(n){var r=typeof exports==`object`&&exports&&!exports.nodeType&&exports,i=typeof t==`object`&&t&&!t.nodeType&&t,a=typeof global==`object`&&global;(a.global===a||a.window===a||a.self===a)&&(n=a);var o,s=2147483647,c=36,l=1,u=26,d=38,f=700,p=72,m=128,h=`-`,g=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},b=c-l,x=Math.floor,S=String.fromCharCode,C;function w(e){throw RangeError(y[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function E(e,t){var n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(v,`.`);var i=e.split(`.`),a=T(i,t).join(`.`);return r+a}function D(e){for(var t=[],n=0,r=e.length,i,a;n=55296&&i<=56319&&n65535&&(e-=65536,t+=S(e>>>10&1023|55296),e=56320|e&1023),t+=S(e),t}).join(``)}function k(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function A(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function j(e,t,n){var r=0;for(e=n?x(e/f):e>>1,e+=x(e/t);e>b*u>>1;r+=c)e=x(e/b);return x(r+(b+1)*e/(e+d))}function M(e){var t=[],n=e.length,r,i=0,a=m,o=p,d,f,g,_,v,y,b,S,C;for(d=e.lastIndexOf(h),d<0&&(d=0),f=0;f=128&&w(`not-basic`),t.push(e.charCodeAt(f));for(g=d>0?d+1:0;g=n&&w(`invalid-input`),b=k(e.charCodeAt(g++)),(b>=c||b>x((s-i)/v))&&w(`overflow`),i+=b*v,S=y<=o?l:y>=o+u?u:y-o,!(bx(s/C)&&w(`overflow`),v*=C;r=t.length+1,o=j(i-_,r,_==0),x(i/r)>s-a&&w(`overflow`),a+=x(i/r),i%=r,t.splice(i++,0,a)}return O(t)}function N(e){var t,n,r,i,a,o,d,f,g,_,v,y=[],b,C,T,E;for(e=D(e),b=e.length,t=m,n=0,a=p,o=0;o=t&&vx((s-n)/C)&&w(`overflow`),n+=(d-t)*C,t=d,o=0;os&&w(`overflow`),v==t){for(f=n,g=c;_=g<=a?l:g>=a+u?u:g-a,!(f<_);g+=c)E=f-_,T=c-_,y.push(S(A(_+E%T,0))),f=x(E/T);y.push(S(A(f,0))),a=j(n,C,r==i),n=0,++r}++n,++t}return y.join(``)}function ee(e){return E(e,function(e){return g.test(e)?M(e.slice(4).toLowerCase()):e})}function P(e){return E(e,function(e){return _.test(e)?`xn--`+N(e):e})}if(o={version:`1.4.1`,ucs2:{decode:D,encode:O},decode:M,encode:N,toASCII:P,toUnicode:ee},typeof define==`function`&&typeof define.amd==`object`&&define.amd)define(`punycode`,function(){return o});else if(r&&i)if(t.exports==r)i.exports=o;else for(C in o)o.hasOwnProperty(C)&&(r[C]=o[C]);else n.punycode=o})(void 0)}),uo=bt((exports,t)=>{Object.defineProperty(exports,`__esModule`,{value:!0});function n(){let e,t,n=n=>{if(n&&(typeof n==`object`||typeof n==`function`)){if(e)return e.get(n)}else if(t)return t.get(n)},r=(n,r)=>{n&&(typeof n==`object`||typeof n==`function`)?(e||=new WeakMap,e.set(n,r)):(t||=new Map,t.set(n,r))},i=n=>{if(n&&(typeof n==`object`||typeof n==`function`)){if(e)return e.has(n)}else if(t)return t.has(n);return!1},a=e=>{if(!i(e))throw TypeError(`Side channel does not contain the given key`)};return{get:n,set:r,has:i,assert:a}}exports.default=n,(typeof exports.default==`object`&&exports.default!==null||typeof exports.default==`function`)&&(Object.assign(exports.default,exports),t.exports=exports.default)}),fo=bt((exports,t)=>{var n=String.prototype.replace,r=/%20/g,i={RFC1738:`RFC1738`,RFC3986:`RFC3986`};t.exports={default:i.RFC3986,formatters:{RFC1738:function(e){return n.call(e,r,`+`)},RFC3986:function(e){return String(e)}},RFC1738:i.RFC1738,RFC3986:i.RFC3986}}),po=bt((exports,t)=>{var n=fo(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e}(),o=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],a=0;a=d?s.slice(l,l+d):s,f=[],p=0;p=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||o===n.RFC1738&&(m===40||m===41)){f[f.length]=u.charAt(p);continue}if(m<128){f[f.length]=a[m];continue}if(m<2048){f[f.length]=a[192|m>>6]+a[128|m&63];continue}if(m<55296||m>=57344){f[f.length]=a[224|m>>12]+a[128|m>>6&63]+a[128|m&63];continue}p+=1,m=65536+((m&1023)<<10|u.charCodeAt(p)&1023),f[f.length]=a[240|m>>18]+a[128|m>>12&63]+a[128|m>>6&63]+a[128|m&63]}c+=f.join(``)}return c},p=function(e){for(var t=[{obj:{o:e},prop:`o`}],n=[],r=0;r{var n=uo(),r=po(),i=fo(),a=Object.prototype.hasOwnProperty,o={brackets:function(e){return e+`[]`},comma:`comma`,indices:function(e,t){return e+`[`+t+`]`},repeat:function(e){return e}},s=Array.isArray,c=Array.prototype.push,l=function(e,t){c.apply(e,s(t)?t:[t])},u=Date.prototype.toISOString,d=i.default,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,commaRoundTrip:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:r.encode,encodeValuesOnly:!1,filter:void 0,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},p=function(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`},m={},h=function e(t,i,a,o,c,u,d,h,g,_,v,y,b,x,S,C,w,T){for(var E=t,D=T,O=0,k=!1;(D=D.get(m))!==void 0&&!k;){var A=D.get(t);if(O+=1,A!==void 0){if(A===O)throw RangeError(`Cyclic object value`);k=!0}D.get(m)===void 0&&(O=0)}if(typeof _==`function`?E=_(i,E):E instanceof Date?E=b(E):a===`comma`&&s(E)&&(E=r.maybeMap(E,function(e){return e instanceof Date?b(e):e})),E===null){if(u)return g&&!C?g(i,f.encoder,w,`key`,x):i;E=``}if(p(E)||r.isBuffer(E)){if(g){var j=C?i:g(i,f.encoder,w,`key`,x);return[S(j)+`=`+S(g(E,f.encoder,w,`value`,x))]}return[S(i)+`=`+S(String(E))]}var M=[];if(E===void 0)return M;var N;if(a===`comma`&&s(E))C&&g&&(E=r.maybeMap(E,g)),N=[{value:E.length>0?E.join(`,`)||null:void 0}];else if(s(_))N=_;else{var ee=Object.keys(E);N=v?ee.sort(v):ee}var P=h?String(i).replace(/\./g,`%2E`):String(i),F=o&&s(E)&&E.length===1?P+`[]`:P;if(c&&s(E)&&E.length===0)return F+`[]`;for(var I=0;I0?b+y:``}}),ho=bt((exports,t)=>{var n=po(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:`utf-8`,charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:`&`,depth:5,duplicates:`combine`,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(e){return e.replace(/(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},s=function(e,t,n){if(e&&typeof e==`string`&&t.comma&&e.indexOf(`,`)>-1)return e.split(`,`);if(t.throwOnLimitExceeded&&n>=t.arrayLimit)throw RangeError(`Array limit exceeded. Only `+t.arrayLimit+` element`+(t.arrayLimit===1?``:`s`)+` allowed in an array.`);return e},c=`utf8=%26%2310003%3B`,l=`utf8=%E2%9C%93`,u=function(e,t){var u={__proto__:null},d=t.ignoreQueryPrefix?e.replace(/^\?/,``):e;d=d.replace(/%5B/gi,`[`).replace(/%5D/gi,`]`);var f=t.parameterLimit===1/0?void 0:t.parameterLimit,p=d.split(t.delimiter,t.throwOnLimitExceeded?f+1:f);if(t.throwOnLimitExceeded&&p.length>f)throw RangeError(`Parameter limit exceeded. Only `+f+` parameter`+(f===1?``:`s`)+` allowed.`);var m=-1,h,g=t.charset;if(t.charsetSentinel)for(h=0;h-1&&(x=i(x)?[x]:x);var S=r.call(u,b);S&&t.duplicates===`combine`?u[b]=n.combine(u[b],x):(!S||t.duplicates===`last`)&&(u[b]=x)}return u},d=function(e,t,r,i){var a=0;if(e.length>0&&e[e.length-1]===`[]`){var o=e.slice(0,-1).join(``);a=Array.isArray(t)&&t[o]?t[o].length:0}for(var c=i?t:s(t,r,a),l=e.length-1;l>=0;--l){var u,d=e[l];if(d===`[]`&&r.parseArrays)u=r.allowEmptyArrays&&(c===``||r.strictNullHandling&&c===null)?[]:n.combine([],c);else{u=r.plainObjects?{__proto__:null}:{};var f=d.charAt(0)===`[`&&d.charAt(d.length-1)===`]`?d.slice(1,-1):d,p=r.decodeDotInKeys?f.replace(/%2E/g,`.`):f,m=parseInt(p,10);!r.parseArrays&&p===``?u={0:c}:!isNaN(m)&&d!==p&&String(m)===p&&m>=0&&r.parseArrays&&m<=r.arrayLimit?(u=[],u[m]=c):p!==`__proto__`&&(u[p]=c)}c=u}return c},f=function(e,t,n,i){if(e){var a=n.allowDots?e.replace(/\.([^.[]+)/g,`[$1]`):e,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,c=n.depth>0&&o.exec(a),l=c?a.slice(0,c.index):a,u=[];if(l){if(!n.plainObjects&&r.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var f=0;n.depth>0&&(c=s.exec(a))!==null&&f{var n=mo(),r=ho(),i=fo();t.exports={formats:i,parse:r,stringify:n}}),_o=bt(exports=>{var t=lo();function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var r=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,o=[`<`,`>`,`"`,"`",` `,`\r`,`
+const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/__vite-browser-external-CubORAmj.js","assets/__vite-browser-external-CoPuN2cl.js","assets/index-BSwg6FIo.js","assets/index-5P7QcyEX.css","assets/default-node-G9zSbWb2.js","assets/import-url-browser-CajlDqRn.js","assets/import-url-browser-DNuYZxPr.js","assets/duckdb-mvp-C3i5IjU8.js","assets/import-url-node-BGiLk3V8.js"])))=>i.map(i=>d[i]);
+var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t(e)}function n(e,n){if(t(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(t(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function r(e){var r=n(e,`string`);return t(r)==`symbol`?r:r+``}function i(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return exports.defineProperty=i,exports}({});import{AdditiveBlending as t,AlwaysStencilFunc as n,AnimationMixer as r,Audio as i,AudioListener as a,AudioLoader as o,BackSide as s,Box2 as c,Box3 as l,BoxGeometry as u,BufferAttribute as d,BufferGeometry as f,CatmullRomCurve3 as p,ClampToEdgeWrapping as m,Color as h,CompressedTexture as g,CubeCamera as _,CubeReflectionMapping as v,CubeTextureLoader as y,CylinderGeometry as b,DataTexture as x,DataTextureLoader as S,DataUtils as C,DepthTexture as w,DoubleSide as T,EdgesGeometry as E,Ee as D,EquirectangularReflectionMapping as O,Euler as k,EventDispatcher as A,ExtrudeGeometry as j,FileLoader as M,Float32BufferAttribute as N,FloatType as ee,Fragment as P,FrontSide as F,Group as I,HalfFloatType as te,InstancedBufferGeometry as ne,InstancedInterleavedBuffer as L,InstancedMesh as re,InterleavedBuffer as R,InterleavedBufferAttribute as ie,InterpolateDiscrete as ae,InterpolateLinear as oe,Ir as se,Line as ce,Line3 as le,LineBasicMaterial as ue,LinearFilter as de,LinearMipmapLinearFilter as fe,LinearMipmapNearestFilter as pe,Loader as me,MOUSE as he,Material as ge,MathUtils as _e,Matrix3 as ve,Matrix4 as ye,Mesh as be,MeshBasicMaterial as xe,MeshDepthMaterial as Se,MeshStandardMaterial as Ce,MirroredRepeatWrapping as we,Mn as Te,NearestFilter as Ee,NearestMipmapLinearFilter as De,NearestMipmapNearestFilter as Oe,NoToneMapping as ke,Object3D as Ae,OctahedronGeometry as je,OrthographicCamera as Me,Path as Ne,PerspectiveCamera as Pe,Plane as Fe,PlaneGeometry as Ie,PropertyBinding as Le,Q as Re,QuadraticBezierCurve3 as ze,Quaternion as Be,REVISION as Ve,RGBAFormat as He,RawShaderMaterial as Ue,Ray as We,Raycaster as Ge,RepeatWrapping as Ke,ReplaceStencilOp as qe,Scene as Je,ShaderChunk as Ye,ShaderMaterial as Xe,Shape as Ze,ShapeGeometry as Qe,ShapePath as $e,ShapeUtils as et,SkinnedMesh as tt,Sphere as nt,SphereGeometry as rt,Spherical as it,TOUCH as at,Texture as ot,TextureLoader as st,TorusGeometry as ct,Triangle as lt,Uniform as ut,UniformsLib as dt,UniformsUtils as ft,Vector2 as pt,Vector3 as z,Vector4 as mt,Vn as ht,WebGLCubeRenderTarget as gt,WebGLRenderTarget as _t,WebGLRenderer as vt,WireframeGeometry as yt,__commonJSMin as bt,__export as xt,__plugin_vue_export_helper_default as St,__require as Ct,__toDynamicImportESM as wt,__toESM as Tt,__vitePreload as Et,breakpointsTailwind as Dt,computed as Ot,createBaseVNode as B,createBlock as kt,createCommentVNode as At,createElementBlock as V,createTextVNode as jt,createVNode as Mt,defineComponent as H,defu as Nt,dn as Pt,formatHex as Ft,getCurrentInstance as It,getCurrentScope as Lt,guardReactiveProps as Rt,io as zt,isReactive as Bt,isRef as Vt,mergeModels as Ht,mergeProps as Ut,nextTick as Wt,normalizeClass as Gt,normalizeProps as Kt,normalizeStyle as qt,onBeforeUnmount as Jt,onMounted as Yt,onScopeDispose as Xt,onUnmounted as Zt,openBlock as U,pe as Qt,reactive as $t,ref as W,render as en,renderList as tn,renderSlot as nn,resolveComponent as rn,resolveDirective as an,shallowReactive as on,shallowRef as sn,so as cn,storeToRefs as ln,toDisplayString as un,toRaw as dn,toRef as fn,toRefs as pn,toValue$1 as mn,unref as G,useAttrs as hn,useBreakpoints as gn,useDark as _n,useDebounceFn as vn,useElementBounding as yn,useI18n as bn,useModel as xn,useRouter as Sn,useSettings as Cn,useSlots as wn,useWindowSize as Tn,vModelCheckbox as En,vModelRadio as Dn,vModelSelect as On,vModelText as kn,watch as K,watchDebounced as An,watchEffect as jn,withAsyncContext as Mn,withCtx as Nn,withDirectives as Pn,withModifiers as Fn}from"./index-BSwg6FIo.js";import{getImportUrlBundles as In}from"./import-url-browser-DNuYZxPr.js";import{generateSpeech as Ln,useAudioContext as Rn,useChatStore as zn,useProvidersStore as Bn,useSpeakingStore as Vn,useSpeechStore as Hn}from"./stores-BzkLfyIH.js";import{Collapsable_default as Un,TransitionVertical_default as Wn}from"./Button-AEge-Qyg.js";import{FieldCheckbox_default as Gn,FieldInput_default as Kn,Input_default as qn}from"./src-CX9nVT7I.js";import{VRMUtils as Jn,clipFromVRMAnimation as Yn,lerp as Xn,loadVRMAnimation as Zn,loadVrm as Qn,randFloat as $n,randomSaccadeInterval as er,useBlink as tr,useIdleEyeSaccades as nr,useMarkdown as rr,useVRMEmote as ir}from"./composables-BpmQTBvS.js";import{useQueue as ar}from"./queue-Cw0r8hJ-.js";import{EMOTION_EmotionMotionName_value as or,EMOTION_VRMExpressionName_value as sr,EmotionThinkMotionName as cr,llmInferenceEndToken as lr,useDelayMessageQueue as ur,useEmotionsMessageQueue as dr,useMessageContentQueue as fr}from"./queues-XZuprNy-.js";var pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i;let ea,ta,na,ra;var ia=H({__name:`AudioSpectrum`,props:{stream:null,bars:{default:32},minFreq:{default:60},maxFreq:{default:4e3}},setup(e){let t=e,n=W(Array.from({length:t.bars}).fill(0));Yt(()=>{r()}),K(()=>t.stream,()=>{r()});function r(){if(!t.stream)return;let e=new(window.AudioContext||window.webkitAudioContext),r=e.createMediaStreamSource(t.stream),i=e.createAnalyser();i.fftSize=2048,r.connect(i);let a=i.frequencyBinCount,o=new Uint8Array(a),s=e.sampleRate,c=s/i.fftSize,l=Math.floor(t.minFreq/c),u=Math.floor(t.maxFreq/c),d=u-l,f=Math.floor(d/t.bars),p=()=>{try{requestAnimationFrame(p),i.getByteFrequencyData(o);let e=Array.from({length:t.bars}).fill(0);for(let n=0;nnn(e.$slots,`default`,{frequencies:n.value})}}),aa=ia;const oa={"h-full":``,flex:``,"items-center":``,"gap-1":``},sa=5;var ca=H({__name:`AudioSpectrumVisualizer`,props:{frequencies:null,barsClass:null},setup(e){let t=e;function n(e,t){let n=.1,r=1;return n+(r-n)*(e/t)}function r(e,r){let i=n(r,t.frequencies.length);return Math.min(100,Math.max(10,e*100*sa*i))}return(t,n)=>(U(),V(`div`,oa,[(U(!0),V(P,null,tn(e.frequencies,(t,n)=>(U(),V(`div`,{key:n,"h-full":``,flex:``,"flex-1":``,"items-end":``},[B(`div`,{transition:`all 100 ease-in-out`,"mx-auto":``,"my-0":``,"w-full":``,"rounded-full":``,class:Gt(e.barsClass),style:qt({height:`${r(t,n)}%`})},null,6)]))),128))]))}}),la=ca,ua=H({__name:`Volumed`,props:{perspective:null,transform:null},setup(e){return(t,n)=>(U(),V(`div`,{class:`volumed`,style:qt({perspective:`${e.perspective}px`,transform:e.transform})},[nn(t.$slots,`default`,{},void 0,!0)],4))}}),da=St(ua,[[`__scopeId`,`data-v-568551bc`]]),fa=H({__name:`CursorMomentum`,props:{baseSpeed:{default:.1},friction:{default:.95},momentumFactor:{default:.005}},setup(e,{expose:t}){let n=e,r=W(1),i=W(0),a=0,o=fn(()=>n.friction),s=fn(()=>n.baseSpeed),c=fn(()=>n.momentumFactor);function l(e){a||=e;let t=e-a;a=e,r.value=s.value+(r.value-s.value)*o.value,i.value+=r.value*t,requestAnimationFrame(l)}function u(e){let t=Math.sqrt(e.movementX**2+e.movementY**2);r.value+=t*c.value}return Yt(()=>{window.addEventListener(`mousemove`,u),requestAnimationFrame(l)}),Zt(()=>{window.removeEventListener(`mousemove`,u)}),t({momentum:r,currentValue:i}),(e,t)=>nn(e.$slots,`default`,{momentum:r.value,currentValue:i.value})}}),pa=fa,ma=H({__name:`TestDummyMarkerFlat`,props:{size:null},setup(e){return(t,n)=>(U(),V(`div`,{class:`test-dummy-flat`,style:qt({width:`${e.size}px`,height:`${e.size}px`})},n[0]||=[B(`div`,{class:`marker`},null,-1)],4))}}),ha=St(ma,[[`__scopeId`,`data-v-b4ef37ac`]]),ga=H({__name:`TestDummyMarker`,setup(e){return(e,t)=>(U(),kt(pa,{"base-speed":.1,friction:.95,"momentum-factor":5e-4},{default:Nn(({currentValue:e})=>[Mt(da,{perspective:800,transform:`rotateX(45deg) translateY(3px)`},{default:Nn(()=>[Mt(ha,{size:24,style:qt({transform:`rotate(${e}deg)`})},null,8,[`style`])]),_:2},1024)]),_:1}))}}),_a=ga,va;(function(e){e[e.WEBGL_LEGACY=0]=`WEBGL_LEGACY`,e[e.WEBGL=1]=`WEBGL`,e[e.WEBGL2=2]=`WEBGL2`})(va||={});var ya;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.WEBGL=1]=`WEBGL`,e[e.CANVAS=2]=`CANVAS`})(ya||={});var ba;(function(e){e[e.COLOR=16384]=`COLOR`,e[e.DEPTH=256]=`DEPTH`,e[e.STENCIL=1024]=`STENCIL`})(ba||={});var xa;(function(e){e[e.NORMAL=0]=`NORMAL`,e[e.ADD=1]=`ADD`,e[e.MULTIPLY=2]=`MULTIPLY`,e[e.SCREEN=3]=`SCREEN`,e[e.OVERLAY=4]=`OVERLAY`,e[e.DARKEN=5]=`DARKEN`,e[e.LIGHTEN=6]=`LIGHTEN`,e[e.COLOR_DODGE=7]=`COLOR_DODGE`,e[e.COLOR_BURN=8]=`COLOR_BURN`,e[e.HARD_LIGHT=9]=`HARD_LIGHT`,e[e.SOFT_LIGHT=10]=`SOFT_LIGHT`,e[e.DIFFERENCE=11]=`DIFFERENCE`,e[e.EXCLUSION=12]=`EXCLUSION`,e[e.HUE=13]=`HUE`,e[e.SATURATION=14]=`SATURATION`,e[e.COLOR=15]=`COLOR`,e[e.LUMINOSITY=16]=`LUMINOSITY`,e[e.NORMAL_NPM=17]=`NORMAL_NPM`,e[e.ADD_NPM=18]=`ADD_NPM`,e[e.SCREEN_NPM=19]=`SCREEN_NPM`,e[e.NONE=20]=`NONE`,e[e.SRC_OVER=0]=`SRC_OVER`,e[e.SRC_IN=21]=`SRC_IN`,e[e.SRC_OUT=22]=`SRC_OUT`,e[e.SRC_ATOP=23]=`SRC_ATOP`,e[e.DST_OVER=24]=`DST_OVER`,e[e.DST_IN=25]=`DST_IN`,e[e.DST_OUT=26]=`DST_OUT`,e[e.DST_ATOP=27]=`DST_ATOP`,e[e.ERASE=26]=`ERASE`,e[e.SUBTRACT=28]=`SUBTRACT`,e[e.XOR=29]=`XOR`})(xa||={});var Sa;(function(e){e[e.POINTS=0]=`POINTS`,e[e.LINES=1]=`LINES`,e[e.LINE_LOOP=2]=`LINE_LOOP`,e[e.LINE_STRIP=3]=`LINE_STRIP`,e[e.TRIANGLES=4]=`TRIANGLES`,e[e.TRIANGLE_STRIP=5]=`TRIANGLE_STRIP`,e[e.TRIANGLE_FAN=6]=`TRIANGLE_FAN`})(Sa||={});var Ca;(function(e){e[e.RGBA=6408]=`RGBA`,e[e.RGB=6407]=`RGB`,e[e.RG=33319]=`RG`,e[e.RED=6403]=`RED`,e[e.RGBA_INTEGER=36249]=`RGBA_INTEGER`,e[e.RGB_INTEGER=36248]=`RGB_INTEGER`,e[e.RG_INTEGER=33320]=`RG_INTEGER`,e[e.RED_INTEGER=36244]=`RED_INTEGER`,e[e.ALPHA=6406]=`ALPHA`,e[e.LUMINANCE=6409]=`LUMINANCE`,e[e.LUMINANCE_ALPHA=6410]=`LUMINANCE_ALPHA`,e[e.DEPTH_COMPONENT=6402]=`DEPTH_COMPONENT`,e[e.DEPTH_STENCIL=34041]=`DEPTH_STENCIL`})(Ca||={});var wa;(function(e){e[e.TEXTURE_2D=3553]=`TEXTURE_2D`,e[e.TEXTURE_CUBE_MAP=34067]=`TEXTURE_CUBE_MAP`,e[e.TEXTURE_2D_ARRAY=35866]=`TEXTURE_2D_ARRAY`,e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]=`TEXTURE_CUBE_MAP_POSITIVE_X`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]=`TEXTURE_CUBE_MAP_NEGATIVE_X`,e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]=`TEXTURE_CUBE_MAP_POSITIVE_Y`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]=`TEXTURE_CUBE_MAP_NEGATIVE_Y`,e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]=`TEXTURE_CUBE_MAP_POSITIVE_Z`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]=`TEXTURE_CUBE_MAP_NEGATIVE_Z`})(wa||={});var Ta;(function(e){e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.UNSIGNED_SHORT_5_6_5=33635]=`UNSIGNED_SHORT_5_6_5`,e[e.UNSIGNED_SHORT_4_4_4_4=32819]=`UNSIGNED_SHORT_4_4_4_4`,e[e.UNSIGNED_SHORT_5_5_5_1=32820]=`UNSIGNED_SHORT_5_5_5_1`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]=`UNSIGNED_INT_10F_11F_11F_REV`,e[e.UNSIGNED_INT_2_10_10_10_REV=33640]=`UNSIGNED_INT_2_10_10_10_REV`,e[e.UNSIGNED_INT_24_8=34042]=`UNSIGNED_INT_24_8`,e[e.UNSIGNED_INT_5_9_9_9_REV=35902]=`UNSIGNED_INT_5_9_9_9_REV`,e[e.BYTE=5120]=`BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.INT=5124]=`INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]=`FLOAT_32_UNSIGNED_INT_24_8_REV`,e[e.HALF_FLOAT=36193]=`HALF_FLOAT`})(Ta||={});var Ea;(function(e){e[e.FLOAT=0]=`FLOAT`,e[e.INT=1]=`INT`,e[e.UINT=2]=`UINT`})(Ea||={});var Da;(function(e){e[e.NEAREST=0]=`NEAREST`,e[e.LINEAR=1]=`LINEAR`})(Da||={});var Oa;(function(e){e[e.CLAMP=33071]=`CLAMP`,e[e.REPEAT=10497]=`REPEAT`,e[e.MIRRORED_REPEAT=33648]=`MIRRORED_REPEAT`})(Oa||={});var ka;(function(e){e[e.OFF=0]=`OFF`,e[e.POW2=1]=`POW2`,e[e.ON=2]=`ON`,e[e.ON_MANUAL=3]=`ON_MANUAL`})(ka||={});var Aa;(function(e){e[e.NPM=0]=`NPM`,e[e.UNPACK=1]=`UNPACK`,e[e.PMA=2]=`PMA`,e[e.NO_PREMULTIPLIED_ALPHA=0]=`NO_PREMULTIPLIED_ALPHA`,e[e.PREMULTIPLY_ON_UPLOAD=1]=`PREMULTIPLY_ON_UPLOAD`,e[e.PREMULTIPLY_ALPHA=2]=`PREMULTIPLY_ALPHA`,e[e.PREMULTIPLIED_ALPHA=2]=`PREMULTIPLIED_ALPHA`})(Aa||={});var ja;(function(e){e[e.NO=0]=`NO`,e[e.YES=1]=`YES`,e[e.AUTO=2]=`AUTO`,e[e.BLEND=0]=`BLEND`,e[e.CLEAR=1]=`CLEAR`,e[e.BLIT=2]=`BLIT`})(ja||={});var Ma;(function(e){e[e.AUTO=0]=`AUTO`,e[e.MANUAL=1]=`MANUAL`})(Ma||={});var Na;(function(e){e.LOW=`lowp`,e.MEDIUM=`mediump`,e.HIGH=`highp`})(Na||={});var Pa;(function(e){e[e.NONE=0]=`NONE`,e[e.SCISSOR=1]=`SCISSOR`,e[e.STENCIL=2]=`STENCIL`,e[e.SPRITE=3]=`SPRITE`,e[e.COLOR=4]=`COLOR`})(Pa||={});var Fa;(function(e){e[e.RED=1]=`RED`,e[e.GREEN=2]=`GREEN`,e[e.BLUE=4]=`BLUE`,e[e.ALPHA=8]=`ALPHA`})(Fa||={});var Ia;(function(e){e[e.NONE=0]=`NONE`,e[e.LOW=2]=`LOW`,e[e.MEDIUM=4]=`MEDIUM`,e[e.HIGH=8]=`HIGH`})(Ia||={});var La;(function(e){e[e.ELEMENT_ARRAY_BUFFER=34963]=`ELEMENT_ARRAY_BUFFER`,e[e.ARRAY_BUFFER=34962]=`ARRAY_BUFFER`,e[e.UNIFORM_BUFFER=35345]=`UNIFORM_BUFFER`})(La||={});var Ra={createCanvas:function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,n},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var e;return(e=document.baseURI)??window.location.href},fetch:function(e,t){return fetch(e,t)}},za=/iPhone/i,Ba=/iPod/i,Va=/iPad/i,Ha=/\biOS-universal(?:.+)Mac\b/i,Ua=/\bAndroid(?:.+)Mobile\b/i,Wa=/Android/i,Ga=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Ka=/Silk/i,qa=/Windows Phone/i,Ja=/\bWindows(?:.+)ARM\b/i,Ya=/BlackBerry/i,Xa=/BB10/i,Za=/Opera Mini/i,Qa=/\b(CriOS|Chrome)(?:.+)Mobile/i,$a=/Mobile(?:.+)Firefox\b/i,eo=function(e){return e!==void 0&&e.platform===`MacIntel`&&typeof e.maxTouchPoints==`number`&&e.maxTouchPoints>1&&typeof MSStream>`u`};function to(e){return function(t){return t.test(e)}}function no(e){var t={userAgent:``,platform:``,maxTouchPoints:0};!e&&typeof navigator<`u`?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e==`string`?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var n=t.userAgent,r=n.split(`[FBAN`);r[1]!==void 0&&(n=r[0]),r=n.split(`Twitter`),r[1]!==void 0&&(n=r[0]);var i=to(n),a={apple:{phone:i(za)&&!i(qa),ipod:i(Ba),tablet:!i(za)&&(i(Va)||eo(t))&&!i(qa),universal:i(Ha),device:(i(za)||i(Ba)||i(Va)||i(Ha)||eo(t))&&!i(qa)},amazon:{phone:i(Ga),tablet:!i(Ga)&&i(Ka),device:i(Ga)||i(Ka)},android:{phone:!i(qa)&&i(Ga)||!i(qa)&&i(Ua),tablet:!i(qa)&&!i(Ga)&&!i(Ua)&&(i(Ka)||i(Wa)),device:!i(qa)&&(i(Ga)||i(Ka)||i(Ua)||i(Wa))||i(/\bokhttp\b/i)},windows:{phone:i(qa),tablet:i(Ja),device:i(qa)||i(Ja)},other:{blackberry:i(Ya),blackberry10:i(Xa),opera:i(Za),firefox:i($a),chrome:i(Qa),device:i(Ya)||i(Xa)||i(Za)||i($a)||i(Qa)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var ro=no(globalThis.navigator);function io(){return!ro.apple.device}function ao(e){var t=!0;if(ro.tablet||ro.phone){if(ro.apple.device){var n=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(n){var r=parseInt(n[1],10);r<11&&(t=!1)}}if(ro.android.device){var n=navigator.userAgent.match(/Android\s([0-9.]*)/);if(n){var r=parseInt(n[1],10);r<7&&(t=!1)}}}return t?e:4}var oo={ADAPTER:Ra,MIPMAP_TEXTURES:ka.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:Ia.NONE,SPRITE_MAX_TEXTURES:ao(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:Ma.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Oa.CLAMP,SCALE_MODE:Da.LINEAR,PRECISION_VERTEX:Na.HIGH,PRECISION_FRAGMENT:ro.apple.device?Na.HIGH:Na.MEDIUM,CAN_UPLOAD_SAME_BUFFER:io(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},so=bt((exports,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i{t.exports=n,t.exports.default=n;function n(e,t,n){n||=2;var i=t&&t.length,o=i?t[0]*n:e.length,s=r(e,0,o,n,!0),c=[];if(!s||s.next===s.prev)return c;var l,d,f,p,m,h,g;if(i&&(s=u(e,t,s,n)),e.length>80*n){l=f=e[0],d=p=e[1];for(var _=n;_f&&(f=m),h>p&&(p=h);g=Math.max(f-l,p-d),g=g===0?0:32767/g}return a(s,c,n,l,d,g,0),c}function r(e,t,n,r,i){var a,o;if(i===N(e,t,n,r)>0)for(a=t;a=t;a-=r)o=A(a,e[a],e[a+1],o);return o&&S(o,o.next)&&(j(o),o=o.next),o}function i(e,t){if(!e)return e;t||=e;var n=e,r;do if(r=!1,!n.steiner&&(S(n,n.next)||x(n.prev,n,n.next)===0)){if(j(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function a(e,t,n,r,u,d,f){if(e){!f&&d&&h(e,r,u,d);for(var p=e,m,g;e.prev!==e.next;){if(m=e.prev,g=e.next,d?s(e,r,u,d):o(e)){t.push(m.i/n|0),t.push(e.i/n|0),t.push(g.i/n|0),j(e),e=g.next,p=g.next;continue}if(e=g,e===p){f?f===1?(e=c(i(e),t,n),a(e,t,n,r,u,d,2)):f===2&&l(e,t,n,r,u,d):a(i(e),t,n,r,u,d,1);break}}}}function o(e){var t=e.prev,n=e,r=e.next;if(x(t,n,r)>=0)return!1;for(var i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=ia?i>o?i:o:a>o?a:o,p=s>c?s>l?s:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&y(i,s,a,c,o,l,m.x,m.y)&&x(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function s(e,t,n,r){var i=e.prev,a=e,o=e.next;if(x(i,a,o)>=0)return!1;for(var s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=sc?s>l?s:l:c>l?c:l,g=u>d?u>f?u:f:d>f?d:f,v=_(p,m,t,n,r),b=_(h,g,t,n,r),S=e.prevZ,C=e.nextZ;S&&S.z>=v&&C&&C.z<=b;){if(S.x>=p&&S.x<=h&&S.y>=m&&S.y<=g&&S!==i&&S!==o&&y(s,u,c,d,l,f,S.x,S.y)&&x(S.prev,S,S.next)>=0||(S=S.prevZ,C.x>=p&&C.x<=h&&C.y>=m&&C.y<=g&&C!==i&&C!==o&&y(s,u,c,d,l,f,C.x,C.y)&&x(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;S&&S.z>=v;){if(S.x>=p&&S.x<=h&&S.y>=m&&S.y<=g&&S!==i&&S!==o&&y(s,u,c,d,l,f,S.x,S.y)&&x(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;C&&C.z<=b;){if(C.x>=p&&C.x<=h&&C.y>=m&&C.y<=g&&C!==i&&C!==o&&y(s,u,c,d,l,f,C.x,C.y)&&x(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function c(e,t,n){var r=e;do{var a=r.prev,o=r.next.next;!S(a,o)&&C(a,r,r.next,o)&&D(a,o)&&D(o,a)&&(t.push(a.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),j(r),j(r.next),r=e=o),r=r.next}while(r!==e);return i(r)}function l(e,t,n,r,o,s){var c=e;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&b(c,l)){var u=k(c,l);c=i(c,c.next),u=i(u,u.next),a(c,t,n,r,o,s,0),a(u,t,n,r,o,s,0);return}l=l.next}c=c.next}while(c!==e)}function u(e,t,n,i){var a=[],o,s,c,l,u;for(o=0,s=t.length;o=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a&&(a=s,o=n.x=n.x&&n.x>=l&&r!==n.x&&y(io.x||n.x===o.x&&m(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function m(e,t){return x(e.prev,e,t.prev)<0&&x(t.next,e,e.next)<0}function h(e,t,n,r){var i=e;do i.z===0&&(i.z=_(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function _(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function v(e){var t=e,n=e;do(t.x=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function b(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!E(e,t)&&(D(e,t)&&D(t,e)&&O(e,t)&&(x(e.prev,e,t.prev)||x(e,t.prev,t))||S(e,t)&&x(e.prev,e,e.next)>0&&x(t.prev,t,t.next)>0)}function x(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function S(e,t){return e.x===t.x&&e.y===t.y}function C(e,t,n,r){var i=T(x(e,t,n)),a=T(x(e,t,r)),o=T(x(n,r,e)),s=T(x(n,r,t));return!!(i!==a&&o!==s||i===0&&w(e,n,t)||a===0&&w(e,r,t)||o===0&&w(n,e,r)||s===0&&w(n,t,r))}function w(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function T(e){return e>0?1:e<0?-1:0}function E(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&C(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function D(e,t){return x(e.prev,e,e.next)<0?x(e,t,e.next)>=0&&x(e,e.prev,t)>=0:x(e,t,e.prev)<0||x(e,e.next,t)<0}function O(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function k(e,t){var n=new M(e.i,e.x,e.y),r=new M(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function A(e,t,n,r){var i=new M(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function j(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function M(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}n.deviation=function(e,t,n,r){var i=t&&t.length,a=i?t[0]*n:e.length,o=Math.abs(N(e,0,a,n));if(i)for(var s=0,c=t.length;s0&&(r+=e[i-1].length,n.holes.push(r))}return n}}),lo=bt((exports,t)=>{(function(n){var r=typeof exports==`object`&&exports&&!exports.nodeType&&exports,i=typeof t==`object`&&t&&!t.nodeType&&t,a=typeof global==`object`&&global;(a.global===a||a.window===a||a.self===a)&&(n=a);var o,s=2147483647,c=36,l=1,u=26,d=38,f=700,p=72,m=128,h=`-`,g=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},b=c-l,x=Math.floor,S=String.fromCharCode,C;function w(e){throw RangeError(y[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function E(e,t){var n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(v,`.`);var i=e.split(`.`),a=T(i,t).join(`.`);return r+a}function D(e){for(var t=[],n=0,r=e.length,i,a;n=55296&&i<=56319&&n65535&&(e-=65536,t+=S(e>>>10&1023|55296),e=56320|e&1023),t+=S(e),t}).join(``)}function k(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function A(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function j(e,t,n){var r=0;for(e=n?x(e/f):e>>1,e+=x(e/t);e>b*u>>1;r+=c)e=x(e/b);return x(r+(b+1)*e/(e+d))}function M(e){var t=[],n=e.length,r,i=0,a=m,o=p,d,f,g,_,v,y,b,S,C;for(d=e.lastIndexOf(h),d<0&&(d=0),f=0;f=128&&w(`not-basic`),t.push(e.charCodeAt(f));for(g=d>0?d+1:0;g=n&&w(`invalid-input`),b=k(e.charCodeAt(g++)),(b>=c||b>x((s-i)/v))&&w(`overflow`),i+=b*v,S=y<=o?l:y>=o+u?u:y-o,!(bx(s/C)&&w(`overflow`),v*=C;r=t.length+1,o=j(i-_,r,_==0),x(i/r)>s-a&&w(`overflow`),a+=x(i/r),i%=r,t.splice(i++,0,a)}return O(t)}function N(e){var t,n,r,i,a,o,d,f,g,_,v,y=[],b,C,T,E;for(e=D(e),b=e.length,t=m,n=0,a=p,o=0;o=t&&vx((s-n)/C)&&w(`overflow`),n+=(d-t)*C,t=d,o=0;os&&w(`overflow`),v==t){for(f=n,g=c;_=g<=a?l:g>=a+u?u:g-a,!(f<_);g+=c)E=f-_,T=c-_,y.push(S(A(_+E%T,0))),f=x(E/T);y.push(S(A(f,0))),a=j(n,C,r==i),n=0,++r}++n,++t}return y.join(``)}function ee(e){return E(e,function(e){return g.test(e)?M(e.slice(4).toLowerCase()):e})}function P(e){return E(e,function(e){return _.test(e)?`xn--`+N(e):e})}if(o={version:`1.4.1`,ucs2:{decode:D,encode:O},decode:M,encode:N,toASCII:P,toUnicode:ee},typeof define==`function`&&typeof define.amd==`object`&&define.amd)define(`punycode`,function(){return o});else if(r&&i)if(t.exports==r)i.exports=o;else for(C in o)o.hasOwnProperty(C)&&(r[C]=o[C]);else n.punycode=o})(void 0)}),uo=bt((exports,t)=>{Object.defineProperty(exports,`__esModule`,{value:!0});function n(){let e,t,n=n=>{if(n&&(typeof n==`object`||typeof n==`function`)){if(e)return e.get(n)}else if(t)return t.get(n)},r=(n,r)=>{n&&(typeof n==`object`||typeof n==`function`)?(e||=new WeakMap,e.set(n,r)):(t||=new Map,t.set(n,r))},i=n=>{if(n&&(typeof n==`object`||typeof n==`function`)){if(e)return e.has(n)}else if(t)return t.has(n);return!1},a=e=>{if(!i(e))throw TypeError(`Side channel does not contain the given key`)};return{get:n,set:r,has:i,assert:a}}exports.default=n,(typeof exports.default==`object`&&exports.default!==null||typeof exports.default==`function`)&&(Object.assign(exports.default,exports),t.exports=exports.default)}),fo=bt((exports,t)=>{var n=String.prototype.replace,r=/%20/g,i={RFC1738:`RFC1738`,RFC3986:`RFC3986`};t.exports={default:i.RFC3986,formatters:{RFC1738:function(e){return n.call(e,r,`+`)},RFC3986:function(e){return String(e)}},RFC1738:i.RFC1738,RFC3986:i.RFC3986}}),po=bt((exports,t)=>{var n=fo(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e}(),o=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(i(n)){for(var r=[],a=0;a=d?s.slice(l,l+d):s,f=[],p=0;p=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||o===n.RFC1738&&(m===40||m===41)){f[f.length]=u.charAt(p);continue}if(m<128){f[f.length]=a[m];continue}if(m<2048){f[f.length]=a[192|m>>6]+a[128|m&63];continue}if(m<55296||m>=57344){f[f.length]=a[224|m>>12]+a[128|m>>6&63]+a[128|m&63];continue}p+=1,m=65536+((m&1023)<<10|u.charCodeAt(p)&1023),f[f.length]=a[240|m>>18]+a[128|m>>12&63]+a[128|m>>6&63]+a[128|m&63]}c+=f.join(``)}return c},p=function(e){for(var t=[{obj:{o:e},prop:`o`}],n=[],r=0;r{var n=uo(),r=po(),i=fo(),a=Object.prototype.hasOwnProperty,o={brackets:function(e){return e+`[]`},comma:`comma`,indices:function(e,t){return e+`[`+t+`]`},repeat:function(e){return e}},s=Array.isArray,c=Array.prototype.push,l=function(e,t){c.apply(e,s(t)?t:[t])},u=Date.prototype.toISOString,d=i.default,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,commaRoundTrip:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:r.encode,encodeValuesOnly:!1,filter:void 0,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},p=function(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`},m={},h=function e(t,i,a,o,c,u,d,h,g,_,v,y,b,x,S,C,w,T){for(var E=t,D=T,O=0,k=!1;(D=D.get(m))!==void 0&&!k;){var A=D.get(t);if(O+=1,A!==void 0){if(A===O)throw RangeError(`Cyclic object value`);k=!0}D.get(m)===void 0&&(O=0)}if(typeof _==`function`?E=_(i,E):E instanceof Date?E=b(E):a===`comma`&&s(E)&&(E=r.maybeMap(E,function(e){return e instanceof Date?b(e):e})),E===null){if(u)return g&&!C?g(i,f.encoder,w,`key`,x):i;E=``}if(p(E)||r.isBuffer(E)){if(g){var j=C?i:g(i,f.encoder,w,`key`,x);return[S(j)+`=`+S(g(E,f.encoder,w,`value`,x))]}return[S(i)+`=`+S(String(E))]}var M=[];if(E===void 0)return M;var N;if(a===`comma`&&s(E))C&&g&&(E=r.maybeMap(E,g)),N=[{value:E.length>0?E.join(`,`)||null:void 0}];else if(s(_))N=_;else{var ee=Object.keys(E);N=v?ee.sort(v):ee}var P=h?String(i).replace(/\./g,`%2E`):String(i),F=o&&s(E)&&E.length===1?P+`[]`:P;if(c&&s(E)&&E.length===0)return F+`[]`;for(var I=0;I0?b+y:``}}),ho=bt((exports,t)=>{var n=po(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:`utf-8`,charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:`&`,depth:5,duplicates:`combine`,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(e){return e.replace(/(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},s=function(e,t,n){if(e&&typeof e==`string`&&t.comma&&e.indexOf(`,`)>-1)return e.split(`,`);if(t.throwOnLimitExceeded&&n>=t.arrayLimit)throw RangeError(`Array limit exceeded. Only `+t.arrayLimit+` element`+(t.arrayLimit===1?``:`s`)+` allowed in an array.`);return e},c=`utf8=%26%2310003%3B`,l=`utf8=%E2%9C%93`,u=function(e,t){var u={__proto__:null},d=t.ignoreQueryPrefix?e.replace(/^\?/,``):e;d=d.replace(/%5B/gi,`[`).replace(/%5D/gi,`]`);var f=t.parameterLimit===1/0?void 0:t.parameterLimit,p=d.split(t.delimiter,t.throwOnLimitExceeded?f+1:f);if(t.throwOnLimitExceeded&&p.length>f)throw RangeError(`Parameter limit exceeded. Only `+f+` parameter`+(f===1?``:`s`)+` allowed.`);var m=-1,h,g=t.charset;if(t.charsetSentinel)for(h=0;h-1&&(x=i(x)?[x]:x);var S=r.call(u,b);S&&t.duplicates===`combine`?u[b]=n.combine(u[b],x):(!S||t.duplicates===`last`)&&(u[b]=x)}return u},d=function(e,t,r,i){var a=0;if(e.length>0&&e[e.length-1]===`[]`){var o=e.slice(0,-1).join(``);a=Array.isArray(t)&&t[o]?t[o].length:0}for(var c=i?t:s(t,r,a),l=e.length-1;l>=0;--l){var u,d=e[l];if(d===`[]`&&r.parseArrays)u=r.allowEmptyArrays&&(c===``||r.strictNullHandling&&c===null)?[]:n.combine([],c);else{u=r.plainObjects?{__proto__:null}:{};var f=d.charAt(0)===`[`&&d.charAt(d.length-1)===`]`?d.slice(1,-1):d,p=r.decodeDotInKeys?f.replace(/%2E/g,`.`):f,m=parseInt(p,10);!r.parseArrays&&p===``?u={0:c}:!isNaN(m)&&d!==p&&String(m)===p&&m>=0&&r.parseArrays&&m<=r.arrayLimit?(u=[],u[m]=c):p!==`__proto__`&&(u[p]=c)}c=u}return c},f=function(e,t,n,i){if(e){var a=n.allowDots?e.replace(/\.([^.[]+)/g,`[$1]`):e,o=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,c=n.depth>0&&o.exec(a),l=c?a.slice(0,c.index):a,u=[];if(l){if(!n.plainObjects&&r.call(Object.prototype,l)&&!n.allowPrototypes)return;u.push(l)}for(var f=0;n.depth>0&&(c=s.exec(a))!==null&&f{var n=mo(),r=ho(),i=fo();t.exports={formats:i,parse:r,stringify:n}}),_o=bt(exports=>{var t=lo();function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var r=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,o=[`<`,`>`,`"`,"`",` `,`\r`,`
`,` `],s=[`{`,`}`,`|`,`\\`,`^`,"`"].concat(o),c=[`'`].concat(s),l=[`%`,`/`,`?`,`;`,`#`].concat(c),u=[`/`,`?`,`#`],d=255,f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},h={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=go();function v(e,t,r){if(e&&typeof e==`object`&&e instanceof n)return e;var i=new n;return i.parse(e,t,r),i}n.prototype.parse=function(e,n,i){if(typeof e!=`string`)throw TypeError(`Parameter 'url' must be a string, not `+typeof e);var o=e.indexOf(`?`),s=o!==-1&&o127?ee+=`x`:ee+=N[P];if(!ee.match(f)){var I=j.slice(0,E),te=j.slice(E+1),ne=N.match(p);ne&&(I.push(ne[1]),te.unshift(ne[2])),te.length&&(b=`/`+te.join(`.`)+b),this.hostname=I.join(`.`);break}}}this.hostname.length>d?this.hostname=``:this.hostname=this.hostname.toLowerCase(),A||(this.hostname=t.toASCII(this.hostname));var L=this.port?`:`+this.port:``,re=this.hostname||``;this.host=re+L,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),b[0]!==`/`&&(b=`/`+b))}if(!m[C])for(var E=0,M=c.length;E0?r.host.split(`@`):!1;w&&(r.auth=w.shift(),r.hostname=w.shift(),r.host=r.hostname)}return r.search=e.search,r.query=e.query,(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:``)+(r.search?r.search:``)),r.href=r.format(),r}if(!S.length)return r.pathname=null,r.search?r.path=`/`+r.search:r.path=null,r.href=r.format(),r;for(var T=S.slice(-1)[0],E=(r.host||e.host||S.length>1)&&(T===`.`||T===`..`)||T===``,D=0,O=S.length;O>=0;O--)T=S[O],T===`.`?S.splice(O,1):T===`..`?(S.splice(O,1),D++):D&&(S.splice(O,1),D--);if(!b&&!x)for(;D--;)S.unshift(`..`);b&&S[0]!==``&&(!S[0]||S[0].charAt(0)!==`/`)&&S.unshift(``),E&&S.join(`/`).substr(-1)!==`/`&&S.push(``);var k=S[0]===``||S[0]&&S[0].charAt(0)===`/`;if(C){r.hostname=k?``:S.length?S.shift():``,r.host=r.hostname;var w=r.host&&r.host.indexOf(`@`)>0?r.host.split(`@`):!1;w&&(r.auth=w.shift(),r.hostname=w.shift(),r.host=r.hostname)}return b||=r.host&&S.length,b&&!k&&S.unshift(``),S.length>0?r.pathname=S.join(`/`):(r.pathname=null,r.path=null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:``)+(r.search?r.search:``)),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=i.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},exports.parse=v,exports.resolve=b,exports.resolveObject=x,exports.format=y,exports.Url=n}),vo=Tt(so(),1),yo=Tt(co(),1),bo=Tt(_o(),1),xo={parse:bo.parse,format:bo.format,resolve:bo.resolve};oo.RETINA_PREFIX=/@([0-9\.]+)x/,oo.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var So=!1,Co=`6.5.10`;function wo(e){var t;if(!So){if(oo.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf(`chrome`)>-1){var n=[`
%c %c %c PixiJS `+Co+` - ✰ `+e+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥
@@ -3763,11 +3763,11 @@ float PCSS (sampler2D shadowMap, vec4 coords) {
}`,r=Ye.shadowmap_pars_fragment,{renderer:i,scene:a,camera:o}=cn();function s(e,t){let i=r;i=i.replace(`#ifdef USE_SHADOWMAP`,`#ifdef USE_SHADOWMAP
${n(t)}`),i=i.replace(`#if defined( SHADOWMAP_TYPE_PCF )`,`${bA}
#if defined( SHADOWMAP_TYPE_PCF )`),Ye.shadowmap_pars_fragment=i,e.shadowMap.enabled=!0}function c(e,t,n){t.traverse(t=>{var n,r;`material`in t&&t.material&&(e.properties.remove(t.material),typeof t.material==`object`&&`dispose`in t.material&&typeof t.material.dispose==`function`&&((r=(n=t.material).dispose)==null||r.call(n)))}),e.info.programs&&(e.info.programs.length=0),e.compile(t,n)}return Zt(()=>{o.value&&(Ye.shadowmap_pars_fragment=r,c(i.value,a.value,o.value))}),K(t,()=>{o.value&&(s(i.value,t),c(i.value,a.value,o.value))},{immediate:!0}),(e,t)=>(U(),V(`TresGroup`))}});var SA=class extends Ae{constructor(){super(),Sb(this,`virtualScene`,null),this.virtualScene=new Je}add(...e){return this.virtualScene.add(...e),this}dispose(){this.virtualScene.traverse(e=>{e instanceof be&&(e.geometry.dispose(),e.material.dispose(),e.material.map&&e.material.map.dispose(),this.virtualScene.remove(e))}),this.virtualScene=null}};const CA=H({__name:`component`,props:{background:{type:[Boolean,String],default:!1},blur:{default:0},files:{default:()=>[]},path:{default:``},preset:{default:void 0},resolution:{default:256},near:{default:1},far:{default:1e3},frames:{default:1/0},backgroundIntensity:{default:1},backgroundRotation:{},environmentIntensity:{default:1},environmentRotation:{},syncMaterials:{type:Boolean}},async setup(e,{expose:t}){let n,r,i=e,a=W(null);t({texture:a});let{extend:o,renderer:c,scene:l}=Qt();o({EnvironmentScene:SA});let d=null,f=W(null),p=null,m=W(null),h=([n,r]=Mn(()=>RT(i,f)),n=await n,r(),n),{onBeforeRender:g}=zt(),v=1;g(()=>{if(p&&m.value&&f.value&&(i.frames===1/0||v{if(e&&t!=null&&t.virtualScene){let n=dn(t).virtualScene,r=n.children.find(e=>e instanceof be&&e.userData.isEnvironment);r||(r=new be(new u(1,1,1),new xe({side:s})),r.userData.isEnvironment=!0,n.add(r)),n.background=e,n.backgroundBlurriness=i.blur}},{immediate:!0});let y=e=>{e&&d!=null&&d.length?(l.value.environment=e.texture,i.background&&(l.value.background=e.texture)):h.value&&(l.value.environment=h.value,i.background&&(l.value.background=h.value))};return K(h,()=>{f.value&&y(f.value)},{immediate:!0,deep:!0}),K(()=>wn().default,e=>{var t;if(e&&(d=e(),Array.isArray(d)&&d.length>0)){o({EnvironmentScene:SA}),f.value=new gt(i.resolution),f.value.texture.type=te,p=new _(i.near,i.far,f.value),y(f.value);return}(t=f.value)==null||t.dispose(),f.value=null,y()},{immediate:!0,deep:!0}),a.value=h.value,Zt(()=>{var e,t;(e=m.value)==null||e.dispose(),(t=f.value)==null||t.dispose()}),(e,t)=>f.value?(U(),V(`TresEnvironmentScene`,{key:0,ref_key:`environmentScene`,ref:m},[nn(e.$slots,`default`)],512)):At(``,!0)}}),wA={key:0,args:[0,1,64]},TA={key:1,args:[.5,1,64]},EA={key:2},DA=[`tone-mapped`,`map`,`side`,`color`],OA=H({__name:`index`,props:{args:{default:null},form:{default:`rect`},toneMapped:{type:Boolean,default:!1},map:{default:null},intensity:{default:1},color:{default:new h(16777215)}},setup(e,{expose:t}){let n=e,r=W(),i=W();return jn(()=>{r.value&&(r.value.color.copy(new h(n.color)),r.value.color.multiplyScalar(n.intensity),r.value.needsUpdate=!0)}),t({mesh:i}),(e,t)=>(U(),V(`TresMesh`,{ref_key:`mesh`,ref:i},[e.form===`circle`?(U(),V(`TresRingGeometry`,wA)):e.form===`ring`?(U(),V(`TresRingGeometry`,TA)):e.form===`rect`?(U(),V(`TresPlaneGeometry`,EA)):(U(),kt(n.form,{key:3,args:e.args},null,8,[`args`])),B(`TresMeshBasicMaterial`,{ref_key:`material`,ref:r,"tone-mapped":e.toneMapped,map:e.map,side:G(T),color:e.color},null,8,DA)],512))}});var kA=H({__name:`Range`,props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`mousedown`],setup(e,{emit:t}){let n=e,r=t,i=W(null);function a(e,t,n){return Math.min(Math.max(e,t),n)}function o(e){let t=e.toString();if(t.includes(`e-`))return Number.parseInt(t.split(`e-`)[1],10);let n=t.includes(`.`)?t.split(`.`)[1].length:0;return n}function s(e,t){let n=o(t),r=10**(n+3);return Number.parseFloat((e*r/r).toFixed(n))}let c=Ot(()=>s(a(n.modelValue,n.min,n.max),n.step)),l=Ot(()=>{let e=(c.value-n.min)/(n.max-n.min)*100;return{width:`${e}%`,backgroundSize:`${e}% 100%`}});function u(e){if(!i.value)return c.value;let t=i.value.getBoundingClientRect(),r=e.clientX-t.left,a=r/t.width,o=n.max-n.min,s=n.min+o*a,l=Math.round(s/n.step)*n.step;return Math.min(Math.max(l,n.min),n.max)}function d(e){if(n.disabled)return;let t=u(e);r(`update:modelValue`,t)}function f(e){if(n.disabled)return;e.preventDefault();let t=u(e);r(`update:modelValue`,t),window.addEventListener(`mousemove`,d),window.addEventListener(`mouseup`,p)}function p(e){window.removeEventListener(`mousemove`,d),window.removeEventListener(`mouseup`,p)}return Zt(()=>{window.removeEventListener(`mousemove`,d),window.removeEventListener(`mouseup`,p)}),(t,n)=>(U(),V(`span`,{ref_key:`sliderRef`,ref:i,class:Gt([`range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50`,{disabled:e.disabled}]),bg:`[#e6e1fc] dark:[#676085]`,"touch-action-none":``,relative:``,"inline-block":``,"w-full":``,"cursor-ew-resize":``,"rounded-sm":``,onMousedown:f},[B(`span`,{style:qt(l.value),bg:`[#cabeff] dark:[#4e34b9]`,relative:``,block:``,"rounded-sm":``,h:`[14px]`},null,4),B(`span`,{role:`slider`,class:`slider-thumb`,style:qt({left:`${(c.value-e.min)/(e.max-e.min)*100}%`}),absolute:``,"rounded-sm":``,w:`[1px]`,h:`[14px]`,bg:`neutral-100 dark:neutral-400`,top:`50%`,transform:`translate-x-[50%] translate-y-[-50%]`},null,4)],34))}}),AA=kA,jA=H({__name:`Model`,props:{model:null,idleAnimation:null,loadAnimations:null,position:null,paused:{type:Boolean}},emits:[`loadModelProgress`,`error`],setup(e,{expose:t,emit:n}){let i=e,a=n,o,s=W(),c=W(),{scene:l}=Qt(),{onBeforeRender:u}=zt(),d=tr(),f=nr(),p=W();K(()=>i.position,([e,t,n])=>{s.value&&s.value.scene.position.set(e,t,n)}),Yt(async()=>{if(l.value)try{let e=await Qn(i.model,{scene:l.value,lookAt:!0,position:i.position,onProgress:e=>a(`loadModelProgress`,Number.parseFloat((100*(e.loaded/e.total)).toFixed(2)))});if(!e){console.warn(`No VRM model loaded`);return}let t=await Zn(i.idleAnimation),n=await Yn(e,t);if(!n){console.warn(`No VRM animation loaded`);return}c.value=new r(e.scene),c.value.clipAction(n).play(),p.value=ir(e),s.value=e,o=u(({delta:e})=>{var t,n,r;(t=c.value)?.update(e),(n=s.value)?.update(e),d.update(s.value,e),f.update(s.value,e),(r=p.value)?.update(e)}).off}catch(e){a(`error`,e)}}),Zt(()=>{o?.(),s.value&&(s.value.scene.removeFromParent(),Jn.deepDispose(s.value.scene))}),t({setExpression(e){var t;(t=p.value)?.setEmotionWithResetAfter(e,1e3)}});let{pause:m,resume:h}=zt();return K(()=>i.paused,e=>{e?m():h()}),(e,t)=>nn(e.$slots,`default`)}}),MA=jA;const NA=[`position`],PA={absolute:``,bottom:`3`,right:`3`},FA={flex:`~ row`,"cursor-pointer":``},IA=[`checked`,`aria-checked`],LA={key:0,"min-w":`50vw`,z:`{var t;(t=f.value)?.setExpression(e)}}),(e,t)=>(U(),kt(rb,{relative:``},{default:Nn(({height:e,width:n})=>[Mt(G(ht),{alpha:!0,antialias:!0,width:n,height:e},{default:Nn(()=>[Mt(G(HE)),B(`TresPerspectiveCamera`,{position:[o.value,s.value,c.value]},null,8,NA),t[14]||=B(`TresDirectionalLight`,{color:16777215,intensity:1.2,position:[1,1,1]},null,-1),t[15]||=B(`TresAmbientLight`,{color:16777215,intensity:1.5},null,-1),Mt(MA,{ref_key:`modelRef`,ref:f,model:r.model,"idle-animation":r.idleAnimation,position:[l.value,u.value,d.value],paused:r.paused,onLoadModelProgress:t[0]||=e=>i(`loadModelProgress`,e),onError:t[1]||=e=>i(`error`,e)},null,8,[`model`,`idle-animation`,`position`,`paused`])]),_:2,__:[14,15]},1032,[`width`,`height`]),B(`div`,PA,[B(`div`,FA,[B(`label`,{class:Gt([a.value?`bg-neutral-300 dark:bg-neutral-200`:`bg-neutral-100 dark:bg-neutral-700`]),transition:`all ease-in-out duration-500`,text:`lg neutral-500 dark:neutral-400`,"m-1":``,"h-fit":``,"w-fit":``,"cursor-pointer":``,"appearance-none":``,"gap-1":``,"rounded-lg":``,"rounded-md":``,"border-none":``,"p-2":``,"outline-none":``},[Pn(B(`input`,{"onUpdate:modelValue":t[2]||=e=>a.value=e,checked:a.value,"aria-checked":a.value,name:`showLive2DViewerInspector`,type:`checkbox`,"appearance-none":``,"outline-none":``,hidden:``},null,8,IA),[[En,a.value]]),t[16]||=B(`div`,{"select-none":``},[B(`div`,{"i-solar:bug-bold-duotone":``})],-1)],2)]),Mt(G(Wn),null,{default:Nn(()=>[a.value?(U(),V(`div`,LA,[B(`div`,RA,[B(`div`,zA,[B(`span`,null,un(G(p)(`stage.viewers.debug-menu.vrm.model.title`)),1)]),Mt(Un,{"h-fit":``,"w-full":``,flex:`~ col`,border:`~ gray/25 rounded-lg`,divide:`y dashed gray/25`,"of-clip":``,"shadow-sm":``},{label:Nn(()=>[B(`span`,BA,un(G(p)(`stage.viewers.debug-menu.vrm.camera`)),1)]),default:Nn(()=>[B(`div`,VA,[t[17]||=B(`div`,{text:`neutral-400 dark:neutral-500`},[B(`span`,null,`X`)],-1),B(`label`,HA,[Mt(AA,{modelValue:o.value,"onUpdate:modelValue":t[3]||=e=>o.value=e,min:-10,max:10,step:.01},null,8,[`modelValue`])]),B(`div`,UA,[B(`span`,null,un(o.value),1)]),t[18]||=B(`div`,{text:`neutral-400 dark:neutral-500`},[B(`span`,null,`Y`)],-1),B(`label`,WA,[Mt(AA,{modelValue:s.value,"onUpdate:modelValue":t[4]||=e=>s.value=e,min:-10,max:10,step:.01},null,8,[`modelValue`])]),B(`div`,GA,[B(`span`,null,un(s.value),1)]),t[19]||=B(`div`,{text:`neutral-400 dark:neutral-500`},[B(`span`,null,`Z`)],-1),B(`label`,KA,[Mt(AA,{modelValue:c.value,"onUpdate:modelValue":t[5]||=e=>c.value=e,min:-10,max:10,step:.01},null,8,[`modelValue`])]),B(`div`,qA,[B(`span`,null,un(c.value),1)])])]),_:1}),Mt(Un,{"h-fit":``,"w-full":``,flex:`~ col`,border:`~ gray/25 rounded-lg`,divide:`y dashed gray/25`,"of-clip":``,"shadow-sm":``},{label:Nn(()=>[B(`span`,JA,un(G(p)(`stage.viewers.debug-menu.vrm.model.title`)),1)]),default:Nn(()=>[B(`div`,YA,[t[20]||=B(`div`,{text:`neutral-400 dark:neutral-500`},[B(`span`,null,`X`)],-1),B(`label`,XA,[Mt(AA,{modelValue:l.value,"onUpdate:modelValue":t[6]||=e=>l.value=e,min:-10,max:10,step:.01},null,8,[`modelValue`])]),B(`div`,ZA,[B(`span`,null,un(l.value),1)]),t[21]||=B(`div`,{text:`neutral-400 dark:neutral-500`},[B(`span`,null,`Y`)],-1),B(`label`,QA,[Mt(AA,{modelValue:u.value,"onUpdate:modelValue":t[7]||=e=>u.value=e,min:-10,max:10,step:.01},null,8,[`modelValue`])]),B(`div`,$A,[B(`span`,null,un(u.value),1)]),t[22]||=B(`div`,{text:`neutral-400 dark:neutral-500`},[B(`span`,null,`Z`)],-1),B(`label`,ej,[Mt(AA,{modelValue:d.value,"onUpdate:modelValue":t[8]||=e=>d.value=e,min:-10,max:10,step:.01},null,8,[`modelValue`])]),B(`div`,tj,[B(`span`,null,un(d.value),1)])])]),_:1}),B(`div`,nj,[B(`span`,null,un(G(p)(`stage.viewers.debug-menu.emotions`)),1)]),B(`div`,rj,[B(`button`,{"rounded-lg":``,bg:`neutral-100/70 dark:neutral-800/50`,"px-2":``,"py-1":``,"backdrop-blur-sm":``,onClick:t[9]||=e=>{var t;return(t=f.value)?.setExpression(`neutral`)}},un(G(p)(`stage.viewers.debug-menu.emotions-btn.neutral`)),1),B(`button`,{"rounded-lg":``,bg:`neutral-100/70 dark:neutral-800/50`,"px-2":``,"py-1":``,"backdrop-blur-sm":``,onClick:t[10]||=e=>{var t;return(t=f.value)?.setExpression(`surprised`)}},un(G(p)(`stage.viewers.debug-menu.emotions-btn.surprised`)),1),B(`button`,{"rounded-lg":``,bg:`neutral-100/70 dark:neutral-800/50`,"px-2":``,"py-1":``,"backdrop-blur-sm":``,onClick:t[11]||=e=>{var t;return(t=f.value)?.setExpression(`sad`)}},un(G(p)(`stage.viewers.debug-menu.emotions-btn.sad`)),1),B(`button`,{"rounded-lg":``,bg:`neutral-100/70 dark:neutral-800/50`,"px-2":``,"py-1":``,"backdrop-blur-sm":``,onClick:t[12]||=e=>{var t;return(t=f.value)?.setExpression(`angry`)}},un(G(p)(`stage.viewers.debug-menu.emotions-btn.angry`)),1),B(`button`,{"rounded-lg":``,bg:`neutral-100/70 dark:neutral-800/50`,"px-2":``,"py-1":``,"backdrop-blur-sm":``,onClick:t[13]||=e=>{var t;return(t=f.value)?.setExpression(`happy`)}},un(G(p)(`stage.viewers.debug-menu.emotions-btn.happy`)),1)])])])):At(``,!0)]),_:1})])]),_:1}))}}),aj=ij;const oj=[`onClick`],sj={flex:``,"gap-1.5":``};var cj=H({__name:`Section`,props:{title:null,icon:null,innerClass:null,expand:{type:Boolean,default:!0}},setup(e){return(t,n)=>(U(),kt(Un,{default:e.expand},{trigger:Nn(t=>[B(`button`,{class:`w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out`,bg:`neutral-100 dark:neutral-800`,hover:`bg-neutral-200 dark:bg-neutral-700`,onClick:e=>t.setVisible(!t.visible)},[B(`div`,sj,[B(`div`,{class:Gt(e.icon),"size-6":``},null,2),jt(` `+un(e.title),1)]),B(`div`,{"i-solar:alt-arrow-down-bold-duotone":``,transition:`transform duration-250`,class:Gt({"rotate-180":t.visible})},null,2)],8,oj)]),default:Nn(()=>[B(`div`,{grid:``,"gap-2":``,"p-4":``,class:Gt(e.innerClass)},[nn(t.$slots,`default`)],2)]),_:3},8,[`default`]))}}),lj=cj;function uj(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function dj(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function fj(e){return this instanceof fj?(this.v=e,this):new fj(e)}function pj(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof fj?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function mj(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:fj(e[r](t)),done:!1}:i?i(t):t}:i}}function hj(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof dj==`function`?dj(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}const gj=new TextDecoder(`utf-8`),_j=e=>gj.decode(e),vj=new TextEncoder,yj=e=>vj.encode(e),bj=e=>typeof e==`number`,xj=e=>typeof e==`boolean`,Sj=e=>typeof e==`function`,Cj=e=>e!=null&&Object(e)===e,wj=e=>Cj(e)&&Sj(e.then),Tj=e=>Cj(e)&&Sj(e[Symbol.iterator]),Ej=e=>Cj(e)&&Sj(e[Symbol.asyncIterator]),Dj=e=>Cj(e)&&Cj(e.schema),Oj=e=>Cj(e)&&`done`in e&&`value`in e,kj=e=>Cj(e)&&Sj(e.stat)&&bj(e.fd),Aj=e=>Cj(e)&&Nj(e.body),jj=e=>`_getDOMStream`in e&&`_getNodeStream`in e,Mj=e=>Cj(e)&&Sj(e.abort)&&Sj(e.getWriter)&&!jj(e),Nj=e=>Cj(e)&&Sj(e.cancel)&&Sj(e.getReader)&&!jj(e),Pj=e=>Cj(e)&&Sj(e.end)&&Sj(e.write)&&xj(e.writable)&&!jj(e),Fj=e=>Cj(e)&&Sj(e.read)&&Sj(e.pipe)&&xj(e.readable)&&!jj(e),Ij=e=>Cj(e)&&Sj(e.clear)&&Sj(e.bytes)&&Sj(e.position)&&Sj(e.setPosition)&&Sj(e.capacity)&&Sj(e.getBufferIdentifier)&&Sj(e.createLong),Lj=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function Rj(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++ce+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++cVj(Int32Array,e),Uj=e=>Vj(BigInt64Array,e),Wj=e=>Vj(Uint8Array,e),Gj=e=>(e.next(),e);function*Kj(e,t){let n=function*(e){yield e},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Lj?n(t):Tj(t)?t:n(t);return yield*Gj(function*(t){let n=null;do n=t.next(yield Vj(e,n));while(!n.done)}(r[Symbol.iterator]())),new e}const qj=e=>Kj(Uint8Array,e);function Jj(e,t){return pj(this,arguments,function*(){if(wj(t))return yield fj(yield fj(yield*mj(hj(Jj(e,yield fj(t))))));let n=function(e){return pj(this,arguments,function*(){yield yield fj(yield fj(e))})},r=function(e){return pj(this,arguments,function*(){yield fj(yield*mj(hj(Gj(function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)}(e[Symbol.iterator]())))))})},i=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Lj?n(t):Tj(t)?r(t):Ej(t)?t:n(t);return yield fj(yield*mj(hj(Gj(function(t){return pj(this,arguments,function*(){let n=null;do n=yield fj(t.next(yield yield fj(Vj(e,n))));while(!n.done)})}(i[Symbol.asyncIterator]()))))),yield fj(new e)})}const Yj=e=>Jj(Uint8Array,e);function Xj(e,t,n){if(e!==0){n=n.slice(0,t);for(let t=-1,r=n.length;++t0)do if(e[n]!==t[n])return!1;while(++n(e.next(),e);function*eM(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?Bj(r,o)[0]:([i,r,s]=Bj(r,o),i)}({cmd:a,size:o}=(yield(()=>null)())||{cmd:`read`,size:0});let l=qj(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(onull)()))||{cmd:`read`,size:0});let l=Yj(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?yield fj(l.next()):yield fj(l.next(o-s)),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield fj(c()));while(onull)()))||{cmd:`read`,size:0});let l=new rM(e);try{do if({done:t,value:i}=Number.isNaN(o-s)?yield fj(l.read()):yield fj(l.read(o-s)),!t&&i.byteLength>0&&(r.push(Wj(i)),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield fj(c()));while(o{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return uj(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return uj(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=Wj(t)),t})}};const iM=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function aM(e){return pj(this,arguments,function*(){let t=[],n=`error`,r=!1,i=null,a,o,s=0,c=[],l;function u(){return a===`peek`?Bj(c,o)[0]:([l,c,s]=Bj(c,o),l)}if({cmd:a,size:o}=(yield yield fj((()=>null)()))||{cmd:`read`,size:0},e.isTTY)return yield yield fj(new Uint8Array),yield fj(null);try{t[0]=iM(e,`end`),t[1]=iM(e,`error`);do{if(t[2]=iM(e,`readable`),[n,i]=yield fj(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((r=n===`end`)||(Number.isFinite(o-s)?(l=Wj(e.read(o-s)),l.byteLength0&&(c.push(l),s+=l.byteLength)),r||o<=s)do({cmd:a,size:o}=yield yield fj(u()));while(o{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var oM;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(oM||={});var sM;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(sM||={});var cM;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(cM||={});var lM;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(lM||={});var uM;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(uM||={});var dM;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(dM||={});const fM=2,pM=4,mM=4,hM=4,gM=new Int32Array(2),_M=new Float32Array(gM.buffer),vM=new Float64Array(gM.buffer),yM=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var bM;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(bM||={});var xM=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}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))<>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){_M[0]=t,this.writeInt32(e,gM[0])}writeFloat64(e,t){vM[0]=t,this.writeInt32(e,gM[yM?0:1]),this.writeInt32(e+4,gM[yM?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);let r=2;this.addInt16(e-this.object_start);let i=(n+r)*fM;this.addInt16(i);let a=0,o=this.space;outer_loop:for(t=0;t=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,pM+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n),i=t=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){let t=e.endObject();return t}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},$M=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+hM),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){let t=e.endObject();return t}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},eN;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`})(eN||={});var tN=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+hM),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):eN.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new NM).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new PM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let 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,eN.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 n=t.length-1;n>=0;n--)e.addOffset(t[n]);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 n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){let t=e.endObject();return t}},nN=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+hM),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):AM.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new tN).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new PM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let 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(){let 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,AM.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);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 n=t.length-1;n>=0;n--)e.addOffset(t[n]);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 n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){let t=e.endObject();return t}static finishSchemaBuffer(e,t){e.finish(t)}static finishSizePrefixedSchemaBuffer(e,t){e.finish(t,void 0,!0)}static createSchema(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},rN;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(rN||={});var Y;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`})(Y||={});var iN;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(iN||={});const aN=void 0;function oN(e){if(e===null)return`null`;if(e===aN)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>oN(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function sN(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function cN(e,t){return sN(e/t)+sN(e%t)/sN(t)}const lN=Symbol.for(`isArrowBigNum`);function uN(e,...t){return t.length===0?Object.setPrototypeOf(Vj(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}uN.prototype[lN]=!0,uN.prototype.toJSON=function(){return`"${_N(this)}"`},uN.prototype.valueOf=function(e){return gN(this,e)},uN.prototype.toString=function(){return _N(this)},uN.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return gN(this);case`string`:return _N(this);case`default`:return vN(this)}return _N(this)};function dN(...e){return uN.apply(this,e)}function fN(...e){return uN.apply(this,e)}function pN(...e){return uN.apply(this,e)}Object.setPrototypeOf(dN.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(fN.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(pN.prototype,Object.create(Uint32Array.prototype)),Object.assign(dN.prototype,uN.prototype,{constructor:dN,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(fN.prototype,uN.prototype,{constructor:fN,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(pN.prototype,uN.prototype,{constructor:pN,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const mN=BigInt(4294967296)*BigInt(4294967296),hN=mN-BigInt(1);function gN(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<=0)return yN(e);t=t.slice();let r=1;for(let e=0;e(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=`DataType`))(UN.prototype);var WN=class extends UN{constructor(){super(Y.Null)}toString(){return`Null`}};SN=Symbol.toStringTag,WN[SN]=(e=>e[Symbol.toStringTag]=`Null`)(WN.prototype);var GN=class extends UN{constructor(e,t){super(Y.Int),this.isSigned=e,this.bitWidth=t}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};CN=Symbol.toStringTag,GN[CN]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(GN.prototype);var KN=class extends GN{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},qN=class extends GN{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},JN=class extends GN{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},YN=class extends GN{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},XN=class extends GN{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ZN=class extends GN{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},QN=class extends GN{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},$N=class extends GN{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(KN.prototype,`ArrayType`,{value:Int8Array}),Object.defineProperty(qN.prototype,`ArrayType`,{value:Int16Array}),Object.defineProperty(JN.prototype,`ArrayType`,{value:Int32Array}),Object.defineProperty(YN.prototype,`ArrayType`,{value:BigInt64Array}),Object.defineProperty(XN.prototype,`ArrayType`,{value:Uint8Array}),Object.defineProperty(ZN.prototype,`ArrayType`,{value:Uint16Array}),Object.defineProperty(QN.prototype,`ArrayType`,{value:Uint32Array}),Object.defineProperty($N.prototype,`ArrayType`,{value:BigUint64Array});var eP=class extends UN{constructor(e){super(Y.Float),this.precision=e}get ArrayType(){switch(this.precision){case cM.HALF:return Uint16Array;case cM.SINGLE:return Float32Array;case cM.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};wN=Symbol.toStringTag,eP[wN]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(eP.prototype);var tP=class extends eP{constructor(){super(cM.HALF)}},nP=class extends eP{constructor(){super(cM.SINGLE)}},rP=class extends eP{constructor(){super(cM.DOUBLE)}};Object.defineProperty(tP.prototype,`ArrayType`,{value:Uint16Array}),Object.defineProperty(nP.prototype,`ArrayType`,{value:Float32Array}),Object.defineProperty(rP.prototype,`ArrayType`,{value:Float64Array});var iP=class extends UN{constructor(){super(Y.Binary)}toString(){return`Binary`}};TN=Symbol.toStringTag,iP[TN]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(iP.prototype);var aP=class extends UN{constructor(){super(Y.LargeBinary)}toString(){return`LargeBinary`}};EN=Symbol.toStringTag,aP[EN]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(aP.prototype);var oP=class extends UN{constructor(){super(Y.Utf8)}toString(){return`Utf8`}};DN=Symbol.toStringTag,oP[DN]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(oP.prototype);var sP=class extends UN{constructor(){super(Y.LargeUtf8)}toString(){return`LargeUtf8`}};ON=Symbol.toStringTag,sP[ON]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(sP.prototype);var cP=class extends UN{constructor(){super(Y.Bool)}toString(){return`Bool`}};kN=Symbol.toStringTag,cP[kN]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(cP.prototype);var lP=class extends UN{constructor(e,t,n=128){super(Y.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};AN=Symbol.toStringTag,lP[AN]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(lP.prototype);var uP=class extends UN{constructor(e){super(Y.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${lM[this.unit]}>`}get ArrayType(){return this.unit===lM.DAY?Int32Array:BigInt64Array}};jN=Symbol.toStringTag,uP[jN]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(uP.prototype);var dP=class extends UN{constructor(e,t){super(Y.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${uM[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};MN=Symbol.toStringTag,dP[MN]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(dP.prototype);var fP=class extends UN{constructor(e,t){super(Y.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${uM[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};NN=Symbol.toStringTag,fP[NN]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(fP.prototype);var pP=class extends UN{constructor(e){super(Y.Interval),this.unit=e}toString(){return`Interval<${dM[this.unit]}>`}};PN=Symbol.toStringTag,pP[PN]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(pP.prototype);var mP=class extends UN{constructor(e){super(Y.Duration),this.unit=e}toString(){return`Duration<${uM[this.unit]}>`}};FN=Symbol.toStringTag,mP[FN]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(mP.prototype);var hP=class extends UN{constructor(e){super(Y.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};IN=Symbol.toStringTag,hP[IN]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(hP.prototype);var gP=class extends UN{constructor(e){super(Y.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};LN=Symbol.toStringTag,gP[LN]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(gP.prototype);var _P=class extends UN{constructor(e,t,n){super(Y.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};RN=Symbol.toStringTag,_P[RN]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(_P.prototype);var vP=class extends UN{constructor(e){super(Y.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};zN=Symbol.toStringTag,vP[zN]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(vP.prototype);var yP=class extends UN{constructor(e,t){super(Y.FixedSizeList),this.listSize=e,this.children=[t]}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}>`}};BN=Symbol.toStringTag,yP[BN]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(yP.prototype);var bP=class extends UN{constructor(e,t=!1){var n,r,i;if(super(Y.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,(n=e?.type)?.children)){let t=(r=e?.type)?.children[0];t&&(t.name=`key`);let n=(i=e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};VN=Symbol.toStringTag,bP[VN]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(bP.prototype);const xP=(e=>()=>++e)(-1);var SP=class extends UN{constructor(e,t,n,r){super(Y.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?xP():sN(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};HN=Symbol.toStringTag,SP[HN]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(SP.prototype);function CP(e){let t=e;switch(e.typeId){case Y.Decimal:return e.bitWidth/32;case Y.Interval:return 1+t.unit;case Y.FixedSizeList:return t.listSize;case Y.FixedSizeBinary:return t.byteWidth;default:return 1}}var wP=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return TP(this,e,t)}getVisitFnByTypeId(e,t=!0){return EP(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}visitLargeUtf8(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(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}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function TP(e,t,n=!0){return typeof t==`number`?EP(e,t,n):typeof t==`string`&&t in Y?EP(e,Y[t],n):t&&t instanceof UN?EP(e,DP(t),n):t?.type&&t.type instanceof UN?EP(e,DP(t.type),n):EP(e,Y.NONE,n)}function EP(e,t,n=!0){let r=null;switch(t){case Y.Null:r=e.visitNull;break;case Y.Bool:r=e.visitBool;break;case Y.Int:r=e.visitInt;break;case Y.Int8:r=e.visitInt8||e.visitInt;break;case Y.Int16:r=e.visitInt16||e.visitInt;break;case Y.Int32:r=e.visitInt32||e.visitInt;break;case Y.Int64:r=e.visitInt64||e.visitInt;break;case Y.Uint8:r=e.visitUint8||e.visitInt;break;case Y.Uint16:r=e.visitUint16||e.visitInt;break;case Y.Uint32:r=e.visitUint32||e.visitInt;break;case Y.Uint64:r=e.visitUint64||e.visitInt;break;case Y.Float:r=e.visitFloat;break;case Y.Float16:r=e.visitFloat16||e.visitFloat;break;case Y.Float32:r=e.visitFloat32||e.visitFloat;break;case Y.Float64:r=e.visitFloat64||e.visitFloat;break;case Y.Utf8:r=e.visitUtf8;break;case Y.LargeUtf8:r=e.visitLargeUtf8;break;case Y.Binary:r=e.visitBinary;break;case Y.LargeBinary:r=e.visitLargeBinary;break;case Y.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case Y.Date:r=e.visitDate;break;case Y.DateDay:r=e.visitDateDay||e.visitDate;break;case Y.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case Y.Timestamp:r=e.visitTimestamp;break;case Y.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case Y.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case Y.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case Y.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case Y.Time:r=e.visitTime;break;case Y.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case Y.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case Y.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case Y.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case Y.Decimal:r=e.visitDecimal;break;case Y.List:r=e.visitList;break;case Y.Struct:r=e.visitStruct;break;case Y.Union:r=e.visitUnion;break;case Y.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case Y.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case Y.Dictionary:r=e.visitDictionary;break;case Y.Interval:r=e.visitInterval;break;case Y.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case Y.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case Y.Duration:r=e.visitDuration;break;case Y.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case Y.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case Y.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case Y.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case Y.FixedSizeList:r=e.visitFixedSizeList;break;case Y.Map:r=e.visitMap;break}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${Y[t]}'`)}function DP(e){switch(e.typeId){case Y.Null:return Y.Null;case Y.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?Y.Int8:Y.Uint8;case 16:return n?Y.Int16:Y.Uint16;case 32:return n?Y.Int32:Y.Uint32;case 64:return n?Y.Int64:Y.Uint64}return Y.Int}case Y.Float:switch(e.precision){case cM.HALF:return Y.Float16;case cM.SINGLE:return Y.Float32;case cM.DOUBLE:return Y.Float64}return Y.Float;case Y.Binary:return Y.Binary;case Y.LargeBinary:return Y.LargeBinary;case Y.Utf8:return Y.Utf8;case Y.LargeUtf8:return Y.LargeUtf8;case Y.Bool:return Y.Bool;case Y.Decimal:return Y.Decimal;case Y.Time:switch(e.unit){case uM.SECOND:return Y.TimeSecond;case uM.MILLISECOND:return Y.TimeMillisecond;case uM.MICROSECOND:return Y.TimeMicrosecond;case uM.NANOSECOND:return Y.TimeNanosecond}return Y.Time;case Y.Timestamp:switch(e.unit){case uM.SECOND:return Y.TimestampSecond;case uM.MILLISECOND:return Y.TimestampMillisecond;case uM.MICROSECOND:return Y.TimestampMicrosecond;case uM.NANOSECOND:return Y.TimestampNanosecond}return Y.Timestamp;case Y.Date:switch(e.unit){case lM.DAY:return Y.DateDay;case lM.MILLISECOND:return Y.DateMillisecond}return Y.Date;case Y.Interval:switch(e.unit){case dM.DAY_TIME:return Y.IntervalDayTime;case dM.YEAR_MONTH:return Y.IntervalYearMonth}return Y.Interval;case Y.Duration:switch(e.unit){case uM.SECOND:return Y.DurationSecond;case uM.MILLISECOND:return Y.DurationMillisecond;case uM.MICROSECOND:return Y.DurationMicrosecond;case uM.NANOSECOND:return Y.DurationNanosecond}return Y.Duration;case Y.Map:return Y.Map;case Y.List:return Y.List;case Y.Struct:return Y.Struct;case Y.Union:switch(e.mode){case sM.Dense:return Y.DenseUnion;case sM.Sparse:return Y.SparseUnion}return Y.Union;case Y.FixedSizeBinary:return Y.FixedSizeBinary;case Y.FixedSizeList:return Y.FixedSizeList;case Y.Dictionary:return Y.Dictionary}throw Error(`Unrecognized type '${Y[e.typeId]}'`)}wP.prototype.visitInt8=null,wP.prototype.visitInt16=null,wP.prototype.visitInt32=null,wP.prototype.visitInt64=null,wP.prototype.visitUint8=null,wP.prototype.visitUint16=null,wP.prototype.visitUint32=null,wP.prototype.visitUint64=null,wP.prototype.visitFloat16=null,wP.prototype.visitFloat32=null,wP.prototype.visitFloat64=null,wP.prototype.visitDateDay=null,wP.prototype.visitDateMillisecond=null,wP.prototype.visitTimestampSecond=null,wP.prototype.visitTimestampMillisecond=null,wP.prototype.visitTimestampMicrosecond=null,wP.prototype.visitTimestampNanosecond=null,wP.prototype.visitTimeSecond=null,wP.prototype.visitTimeMillisecond=null,wP.prototype.visitTimeMicrosecond=null,wP.prototype.visitTimeNanosecond=null,wP.prototype.visitDenseUnion=null,wP.prototype.visitSparseUnion=null,wP.prototype.visitIntervalDayTime=null,wP.prototype.visitIntervalYearMonth=null,wP.prototype.visitDuration=null,wP.prototype.visitDurationSecond=null,wP.prototype.visitDurationMillisecond=null,wP.prototype.visitDurationMicrosecond=null,wP.prototype.visitDurationNanosecond=null;const OP=new Float64Array(1),kP=new Uint32Array(OP.buffer);function AP(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function jP(e){if(e!==e)return 32256;OP[0]=e;let t=(kP[1]&2147483648)>>16&65535,n=kP[1]&2146435072,r=0;return n>=1089470464?kP[0]>0?n=31744:(n=(n&2080374784)>>16,r=(kP[1]&1048575)>>10):n<=1056964608?(r=1048576+(kP[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(kP[1]&1048575)+512>>10),t|n|r&65535}var MP=class extends wP{};function NP(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const PP=(e,t,n)=>{e[t]=Math.floor(n/864e5)},FP=(e,t,n,r)=>{if(n+1{let i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},RP=({values:e},t,n)=>{e[t]=n},zP=({values:e},t,n)=>{e[t]=jP(n)},BP=(e,t,n)=>{switch(e.type.precision){case cM.HALF:return zP(e,t,n);case cM.SINGLE:case cM.DOUBLE:return RP(e,t,n)}},VP=({values:e},t,n)=>{PP(e,t,n.valueOf())},HP=({values:e},t,n)=>{e[t]=BigInt(n)},UP=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},WP=({values:e,valueOffsets:t},n,r)=>FP(e,t,n,r),GP=({values:e,valueOffsets:t},n,r)=>FP(e,t,n,yj(r)),KP=(e,t,n)=>{e.type.unit===lM.DAY?VP(e,t,n):HP(e,t,n)},qP=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},JP=({values:e},t,n)=>{e[t]=BigInt(n)},YP=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},XP=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},ZP=(e,t,n)=>{switch(e.type.unit){case uM.SECOND:return qP(e,t,n);case uM.MILLISECOND:return JP(e,t,n);case uM.MICROSECOND:return YP(e,t,n);case uM.NANOSECOND:return XP(e,t,n)}},QP=({values:e},t,n)=>{e[t]=n},$P=({values:e},t,n)=>{e[t]=n},eF=({values:e},t,n)=>{e[t]=n},tF=({values:e},t,n)=>{e[t]=n},nF=(e,t,n)=>{switch(e.type.unit){case uM.SECOND:return QP(e,t,n);case uM.MILLISECOND:return $P(e,t,n);case uM.MICROSECOND:return eF(e,t,n);case uM.NANOSECOND:return tF(e,t,n)}},rF=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},iF=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=wF.getVisitFn(r);if(Array.isArray(n))for(let e=-1,o=i[t],s=i[t+1];o{let r=e.children[0],{valueOffsets:i}=e,a=wF.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},oF=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),sF=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),cF=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),lF=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),uF=(e,t,n)=>{let r=e.type.children.map(e=>wF.getVisitFn(e.type)),i=n instanceof Map?cF(t,n):n instanceof CL?sF(t,n):Array.isArray(n)?oF(t,n):lF(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},dF=(e,t,n)=>{e.type.mode===sM.Dense?fF(e,t,n):pF(e,t,n)},fF=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wF.visit(i,e.valueOffsets[t],n)},pF=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wF.visit(i,t,n)},mF=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},hF=(e,t,n)=>{e.type.unit===dM.DAY_TIME?gF(e,t,n):_F(e,t,n)},gF=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},_F=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},vF=({values:e},t,n)=>{e[t]=n},yF=({values:e},t,n)=>{e[t]=n},bF=({values:e},t,n)=>{e[t]=n},xF=({values:e},t,n)=>{e[t]=n},SF=(e,t,n)=>{switch(e.type.unit){case uM.SECOND:return vF(e,t,n);case uM.MILLISECOND:return yF(e,t,n);case uM.MICROSECOND:return bF(e,t,n);case uM.NANOSECOND:return xF(e,t,n)}},CF=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=wF.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e`${oN(e)}: ${oN(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new OF(this[TF],this[EF])}},OF=class{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(){let e=this.childIndex;return ee.name)}has(e,t){return e[TF].type.children.findIndex(e=>e.name===t)!==-1}getOwnPropertyDescriptor(e,t){if(e[TF].type.children.findIndex(e=>e.name===t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[TF].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=bI.visit(e[TF].children[n],e[EF]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[TF].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(wF.visit(e[TF].children[r],e[EF],n),Reflect.set(e,t,n))}},AF=class extends wP{};function jF(e){return(t,n)=>t.getValid(n)?e(t,n):null}const MF=(e,t)=>864e5*e[t],NF=(e,t)=>null,PF=(e,t,n)=>{if(n+1>=t.length)return null;let r=sN(t[n]),i=sN(t[n+1]);return e.subarray(r,i)},FF=({offset:e,values:t},n)=>{let r=e+n,i=t[r>>3];return(i&1<MF(e,t),LF=({values:e},t)=>sN(e[t]),RF=({stride:e,values:t},n)=>t[e*n],zF=({stride:e,values:t},n)=>AP(t[e*n]),BF=({values:e},t)=>e[t],VF=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),HF=({values:e,valueOffsets:t},n)=>PF(e,t,n),UF=({values:e,valueOffsets:t},n)=>{let r=PF(e,t,n);return r===null?null:_j(r)},WF=({values:e},t)=>e[t],GF=({type:e,values:t},n)=>e.precision===cM.HALF?AP(t[n]):t[n],KF=(e,t)=>e.type.unit===lM.DAY?IF(e,t):LF(e,t),qF=({values:e},t)=>1e3*sN(e[t]),JF=({values:e},t)=>sN(e[t]),YF=({values:e},t)=>cN(e[t],BigInt(1e3)),XF=({values:e},t)=>cN(e[t],BigInt(1e6)),ZF=(e,t)=>{switch(e.type.unit){case uM.SECOND:return qF(e,t);case uM.MILLISECOND:return JF(e,t);case uM.MICROSECOND:return YF(e,t);case uM.NANOSECOND:return XF(e,t)}},QF=({values:e},t)=>e[t],$F=({values:e},t)=>e[t],eI=({values:e},t)=>e[t],tI=({values:e},t)=>e[t],nI=(e,t)=>{switch(e.type.unit){case uM.SECOND:return QF(e,t);case uM.MILLISECOND:return $F(e,t);case uM.MICROSECOND:return eI(e,t);case uM.NANOSECOND:return tI(e,t)}},rI=({values:e,stride:t},n)=>bN.decimal(e.subarray(t*n,t*(n+1))),iI=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:a,[t*r+1]:o}=n,s=i[0],c=s.slice(a,o-a);return new CL([c])},aI=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new TI(o.slice(i,a-i))},oI=(e,t)=>new DF(e,t),sI=(e,t)=>e.type.mode===sM.Dense?cI(e,t):lI(e,t),cI=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return bI.visit(r,e.valueOffsets[t])},lI=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return bI.visit(r,t)},uI=(e,t)=>{var n;return(n=e.dictionary)?.get(e.values[t])},dI=(e,t)=>e.type.unit===dM.DAY_TIME?fI(e,t):pI(e,t),fI=({values:e},t)=>e.subarray(2*t,2*(t+1)),pI=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},mI=({values:e},t)=>e[t],hI=({values:e},t)=>e[t],gI=({values:e},t)=>e[t],_I=({values:e},t)=>e[t],vI=(e,t)=>{switch(e.type.unit){case uM.SECOND:return mI(e,t);case uM.MILLISECOND:return hI(e,t);case uM.MICROSECOND:return gI(e,t);case uM.NANOSECOND:return _I(e,t)}},yI=(e,t)=>{let{stride:n,children:r}=e,i=r[0],a=i.slice(t*n,n);return new CL([a])};AF.prototype.visitNull=jF(NF),AF.prototype.visitBool=jF(FF),AF.prototype.visitInt=jF(WF),AF.prototype.visitInt8=jF(RF),AF.prototype.visitInt16=jF(RF),AF.prototype.visitInt32=jF(RF),AF.prototype.visitInt64=jF(BF),AF.prototype.visitUint8=jF(RF),AF.prototype.visitUint16=jF(RF),AF.prototype.visitUint32=jF(RF),AF.prototype.visitUint64=jF(BF),AF.prototype.visitFloat=jF(GF),AF.prototype.visitFloat16=jF(zF),AF.prototype.visitFloat32=jF(RF),AF.prototype.visitFloat64=jF(RF),AF.prototype.visitUtf8=jF(UF),AF.prototype.visitLargeUtf8=jF(UF),AF.prototype.visitBinary=jF(HF),AF.prototype.visitLargeBinary=jF(HF),AF.prototype.visitFixedSizeBinary=jF(VF),AF.prototype.visitDate=jF(KF),AF.prototype.visitDateDay=jF(IF),AF.prototype.visitDateMillisecond=jF(LF),AF.prototype.visitTimestamp=jF(ZF),AF.prototype.visitTimestampSecond=jF(qF),AF.prototype.visitTimestampMillisecond=jF(JF),AF.prototype.visitTimestampMicrosecond=jF(YF),AF.prototype.visitTimestampNanosecond=jF(XF),AF.prototype.visitTime=jF(nI),AF.prototype.visitTimeSecond=jF(QF),AF.prototype.visitTimeMillisecond=jF($F),AF.prototype.visitTimeMicrosecond=jF(eI),AF.prototype.visitTimeNanosecond=jF(tI),AF.prototype.visitDecimal=jF(rI),AF.prototype.visitList=jF(iI),AF.prototype.visitStruct=jF(oI),AF.prototype.visitUnion=jF(sI),AF.prototype.visitDenseUnion=jF(cI),AF.prototype.visitSparseUnion=jF(lI),AF.prototype.visitDictionary=jF(uI),AF.prototype.visitInterval=jF(dI),AF.prototype.visitIntervalDayTime=jF(fI),AF.prototype.visitIntervalYearMonth=jF(pI),AF.prototype.visitDuration=jF(vI),AF.prototype.visitDurationSecond=jF(mI),AF.prototype.visitDurationMillisecond=jF(hI),AF.prototype.visitDurationMicrosecond=jF(gI),AF.prototype.visitDurationNanosecond=jF(_I),AF.prototype.visitFixedSizeList=jF(yI),AF.prototype.visitMap=jF(aI);const bI=new AF,xI=Symbol.for(`keys`),SI=Symbol.for(`vals`),CI=Symbol.for(`kKeysAsStrings`),wI=Symbol.for(`_kKeysAsStrings`);var TI=class{constructor(e){return this[xI]=new CL([e.children[0]]).memoize(),this[SI]=e.children[1],new Proxy(this,new DI)}get[CI](){return this[wI]||(this[wI]=Array.from(this[xI].toArray(),String))}[Symbol.iterator](){return new EI(this[xI],this[SI])}get size(){return this[xI].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[xI],t=this[SI],n={};for(let r=-1,i=e.length;++r`${oN(e)}: ${oN(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},EI=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),bI.visit(this.vals,e)]})}},DI=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[CI]}has(e,t){return e[CI].includes(t)}getOwnPropertyDescriptor(e,t){let n=e[CI].indexOf(t);if(n!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[CI].indexOf(t);if(n!==-1){let r=bI.visit(Reflect.get(e,SI),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[CI].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(wF.visit(Reflect.get(e,SI),r,n),Reflect.set(e,t,n))}};Object.defineProperties(TI.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[xI]:{writable:!0,enumerable:!1,configurable:!1,value:null},[SI]:{writable:!0,enumerable:!1,configurable:!1,value:null},[wI]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let OI;function kI(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(e,a,o):[a,o]}const AI=(e,t)=>e<0?t+e:e,jI=e=>e!==e;function MI(e){let t=typeof e;if(t!==`object`||e===null)return jI(e)?jI:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date?e.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?Zj(e,t):!1:e instanceof Map?PI(e):Array.isArray(e)?NI(e):e instanceof CL?FI(e):II(e,!0)}function NI(e){let t=[];for(let n=-1,r=e.length;++n!1;let r=[];for(let t=-1,i=n.length;++t{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return RI(e,n);case Map:return BI(e,n,n.keys());case TI:case DF:case Object:case void 0:return BI(e,n,t||Object.keys(n))}return n instanceof CL?zI(e,n):!1}}function RI(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r>r}function UI(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength>3):WI(new GI(n,e,t,null,VI)).subarray(0,r)),i}return n}function WI(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var GI=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8==0?0:8-t%8);return KI(e,t,i)+KI(e,r,n)+qI(e,i>>3,r-i>>3)}function qI(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=JI(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=JI(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=JI(a.getUint8(i)),i+=1;return r}function JI(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const YI=-1;var XI=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return UN.isSparseUnion(e)||UN.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(UN.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=YI&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-KI(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=CP(t),a&&((c=a[0])&&(this.valueOffsets=c),(c=a[1])&&(this.values=c),(c=a[2])&&(this.nullBitmap=c),(c=a[3])&&(this.typeIds=c)))}getValid(e){let{type:t}=this;if(UN.isUnion(t)){let n=t,r=this.children[n.typeIdToChildIndex[this.typeIds[e]]],i=n.mode===sM.Dense?this.valueOffsets[e]:e;return r.getValid(i)}if(this.nullable&&this.nullCount>0){let t=this.offset+e,n=this.nullBitmap[t>>3];return(n&1<>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(UI(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children){return new e(t,n,r,i,a,o,this.dictionary)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===Y.Null)return this.clone(this.type,0,e,0);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<0&&r.set(UI(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[iN.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;return(i=a[iN.TYPE])&&(a[iN.TYPE]=i.subarray(e,e+t)),(i=a[iN.OFFSET])&&(a[iN.OFFSET]=i.subarray(e,e+t+1))||(i=a[iN.DATA])&&(a[iN.DATA]=r===6?i:i.subarray(n*e,n*(e+t))),a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};XI.prototype.children=Object.freeze([]);var ZI=class e extends wP{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new XI(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=Wj(e.data),i=Wj(e.nullBitmap),a=Hj(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new XI(t,n,o,s,[a,r,i])}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=Wj(e.data),i=Wj(e.nullBitmap),a=Uj(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new XI(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=Wj(e.data),i=Wj(e.nullBitmap),a=Hj(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new XI(t,n,o,s,[a,r,i])}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=Wj(e.data),i=Wj(e.nullBitmap),a=Uj(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new XI(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length/CP(t),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length/CP(t),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length/CP(t),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length/CP(t),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length/CP(t),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=Wj(e.nullBitmap),a=Hj(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new XI(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=Wj(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=Vj(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;if(UN.isSparseUnion(t))return new XI(t,n,a,o,[void 0,void 0,void 0,i],r);let s=Hj(e.valueOffsets);return new XI(t,n,a,o,[s,void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=Wj(t.nullBitmap),a=Vj(n.indices.ArrayType,t.data),{dictionary:o=new CL([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new XI(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length/CP(t),nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=Wj(e.nullBitmap),i=Vj(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new XI(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=Wj(t.nullBitmap),{length:o=i.length/CP(n),nullCount:s=t.nullBitmap?-1:0}=t;return new XI(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=Wj(t.nullBitmap),o=Hj(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new XI(n,r,s,c,[o,void 0,a],[i])}};const QI=new ZI;function $I(e){return QI.visit(e)}var eL=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function nL(e){return e.reduce((e,t)=>e+t.nullCount,0)}function rL(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function iL(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function aL(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function fL(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new GI(n,e.offset+(t||0),e.length,n,VI)){if(!i)return r;++r}return-1}function pL(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case Y.Union:break;case Y.Dictionary:break;default:return fL(e,n)}let r=bI.getVisitFn(e),i=MI(t);for(let t=(n||0)-1,a=e.length;++t{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new eL(e.data.length,t=>{let r=e.data[t],i=r.length,a=e.slice(n,n+i);return n+=i,new vL(a)})}var vL=class{constructor(e){this.vector=e,this.index=0}next(){return this.indexe.data):t;if(a.length===0||a.some(e=>!(e instanceof XI)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let o=(n=a[0])?.type;switch(a.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:n}=xL[o.typeId],r=a[0];this.isValid=e=>oL(r,e),this.get=t=>e(r,t),this.set=(e,n)=>t(r,e,n),this.indexOf=e=>n(r,e),this._offsets=[0,r.length];break}default:Object.setPrototypeOf(this,SL[o.typeId]),this._offsets=rL(a);break}this.data=a,this.type=o,this.stride=CP(o),this.numChildren=(i=(r=o.children)?.length)??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return tL(this.data)}get nullCount(){return nL(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${Y[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(AI(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return yL.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(kI(this,t,n,({data:e,_offsets:t},n,r)=>iL(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case Y.Int:case Y.Float:case Y.Decimal:case Y.Time:case Y.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return UN.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(UN.isDictionary(this.type)){let t=new wL(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new wL(this)}unmemoize(){if(UN.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};bL=Symbol.toStringTag,CL[bL]=(e=>{e.type=UN.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(Y).map(e=>Y[e]).filter(e=>typeof e==`number`&&e!==Y.NONE);for(let n of t){let t=bI.getVisitFnByTypeId(n),r=wF.getVisitFnByTypeId(n),i=hL.getVisitFnByTypeId(n);xL[n]={get:t,set:r,indexOf:i},SL[n]=Object.create(e,{isValid:{value:sL(oL)},get:{value:sL(bI.getVisitFnByTypeId(n))},set:{value:cL(wF.getVisitFnByTypeId(n))},indexOf:{value:lL(hL.getVisitFnByTypeId(n))}})}return`Vector`})(CL.prototype);var wL=class e extends CL{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,`get`,{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,`set`,{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,`slice`,{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,`isMemoized`,{value:!0}),Object.defineProperty(this,`unmemoize`,{value:()=>new CL(this.data)}),Object.defineProperty(this,`memoize`,{value:()=>this})}},TL=class{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,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},EL=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+hM),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):oM.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new nN).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new TL).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new TL).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new PM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let 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,oM.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 n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){let t=e.endObject();return t}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}},DL=class e{constructor(e=[],t,n,r=oM.V5){this.fields=e||[],this.metadata=t||new Map,n||=AL(this.fields),this.dictionaries=n,this.metadataVersion=r}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(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=kL(kL(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return~t?(r[t]=e.clone({metadata:kL(kL(new Map,r[t].metadata),e.metadata)}))&&!1:!0}),o=AL(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};DL.prototype.fields=null,DL.prototype.metadata=null,DL.prototype.dictionaries=null;var OL=class e{static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};OL.prototype.type=null,OL.prototype.name=null,OL.prototype.nullable=null,OL.prototype.metadata=null;function kL(e,t){return new Map([...e||new Map,...t||new Map])}function AL(e,t=new Map){for(let n=-1,r=e.length;++n0&&AL(i.children,t)}return t}var jL=SM,ML=xM,NL=class{static decode(e){e=new ML(Wj(e));let t=EL.getRootAsFooter(e),n=DL.decode(t.schema(),new Map,t.version());return new PL(n,t)}static encode(e){let t=new jL,n=DL.encode(t,e.schema);EL.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())FL.encode(t,n);let r=t.endVector();EL.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())FL.encode(t,n);let i=t.endVector();return EL.startFooter(t),EL.addSchema(t,n),EL.addVersion(t,oM.V5),EL.addRecordBatches(t,r),EL.addDictionaries(t,i),EL.finishFooterBuffer(t,EL.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=oM.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t=0&&e=0&&e=0&&e=0&ðis._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return uj(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){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(IL);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Qj.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Qj.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return uj(this,void 0,void 0,function*(){return yield this.abort(e),IL})}return(e){return uj(this,void 0,void 0,function*(){return yield this.close(),IL})}read(e){return uj(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return uj(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((e,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(IL)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},BL=class extends zL{write(e){if((e=Wj(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?_j(this.toUint8Array(!0)):this.toUint8Array(!1).then(_j)}toUint8Array(e=!1){return e?Bj(this._values)[0]:(()=>uj(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var o=!0,s=hj(this),c;c=yield s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return Bj(i,a)[0]}))()}},VL=class{constructor(e){e&&(this.source=new UL(Qj.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)}},HL=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof BL?this.source=new WL(Qj.fromAsyncIterable(t)):Fj(t)?this.source=new WL(Qj.fromNodeStream(t)):Nj(t)?this.source=new WL(Qj.fromDOMStream(t)):Aj(t)?this.source=new WL(Qj.fromDOMStream(t.body)):Tj(t)?this.source=new WL(Qj.fromIterable(t)):(wj(t)||Ej(t))&&(this.source=new WL(Qj.fromAsyncIterable(t)))}[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)}},UL=class{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)||IL)}return(e){return Object.create(this.source.return&&this.source.return(e)||IL)}},WL=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return uj(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return uj(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return uj(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return uj(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return uj(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||IL;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return uj(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||IL;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},GL=class extends VL{constructor(e,t){super(),this.position=0,this.buffer=Wj(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),euj(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending}))()}readInt32(e){return uj(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return uj(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]>>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]>>0&&++t[1],t[1]>>0&&++t[2],t[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`${JL(this.buffer[3])} ${JL(this.buffer[2])} ${JL(this.buffer[1])} ${JL(this.buffer[0])}`}static multiply(t,n){let r=new e(new Uint32Array(t.buffer));return r.times(n)}static add(t,n){let r=new e(new Uint32Array(t.buffer));return r.plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=r?1:0;n0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readDictionary(e){return this.dictionaries.get(e.id)}},nR=class extends tR{constructor(e,t,n,r,i){super(new Uint8Array,t,n,r,i),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:WI(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return Vj(Uint8Array,Vj(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return Vj(Uint8Array,Vj(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;return UN.isTimestamp(e)||(UN.isInt(e)||UN.isTime(e))&&e.bitWidth===64||UN.isDuration(e)||UN.isDate(e)&&e.unit===lM.MILLISECOND?Vj(Uint8Array,$L.convertArray(n[t])):UN.isDecimal(e)?Vj(Uint8Array,eR.convertArray(n[t])):UN.isBinary(e)||UN.isLargeBinary(e)||UN.isFixedSizeBinary(e)?rR(n[t]):UN.isBool(e)?WI(n[t]):UN.isUtf8(e)||UN.isLargeUtf8(e)?yj(n[t].join(``)):Vj(Uint8Array,Vj(e.ArrayType,n[t].map(e=>+e)))}};function rR(e){let t=e.join(``),n=new Uint8Array(t.length/2);for(let e=0;e>1]=Number.parseInt(t.slice(e,e+2),16);return n}var iR=class extends wP{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((e,n)=>this.compareFields(e,t[n]))}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 aR(e,t){return t instanceof e.constructor}function oR(e,t){return e===t||aR(e,t)}function sR(e,t){return e===t||aR(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function cR(e,t){return e===t||aR(e,t)&&e.precision===t.precision}function lR(e,t){return e===t||aR(e,t)&&e.byteWidth===t.byteWidth}function uR(e,t){return e===t||aR(e,t)&&e.unit===t.unit}function dR(e,t){return e===t||aR(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function fR(e,t){return e===t||aR(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function pR(e,t){return e===t||aR(e,t)&&e.children.length===t.children.length&&xR.compareManyFields(e.children,t.children)}function mR(e,t){return e===t||aR(e,t)&&e.children.length===t.children.length&&xR.compareManyFields(e.children,t.children)}function hR(e,t){return e===t||aR(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&xR.compareManyFields(e.children,t.children)}function gR(e,t){return e===t||aR(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&xR.visit(e.indices,t.indices)&&xR.visit(e.dictionary,t.dictionary)}function _R(e,t){return e===t||aR(e,t)&&e.unit===t.unit}function vR(e,t){return e===t||aR(e,t)&&e.unit===t.unit}function yR(e,t){return e===t||aR(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&xR.compareManyFields(e.children,t.children)}function bR(e,t){return e===t||aR(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&xR.compareManyFields(e.children,t.children)}iR.prototype.visitNull=oR,iR.prototype.visitBool=oR,iR.prototype.visitInt=sR,iR.prototype.visitInt8=sR,iR.prototype.visitInt16=sR,iR.prototype.visitInt32=sR,iR.prototype.visitInt64=sR,iR.prototype.visitUint8=sR,iR.prototype.visitUint16=sR,iR.prototype.visitUint32=sR,iR.prototype.visitUint64=sR,iR.prototype.visitFloat=cR,iR.prototype.visitFloat16=cR,iR.prototype.visitFloat32=cR,iR.prototype.visitFloat64=cR,iR.prototype.visitUtf8=oR,iR.prototype.visitLargeUtf8=oR,iR.prototype.visitBinary=oR,iR.prototype.visitLargeBinary=oR,iR.prototype.visitFixedSizeBinary=lR,iR.prototype.visitDate=uR,iR.prototype.visitDateDay=uR,iR.prototype.visitDateMillisecond=uR,iR.prototype.visitTimestamp=dR,iR.prototype.visitTimestampSecond=dR,iR.prototype.visitTimestampMillisecond=dR,iR.prototype.visitTimestampMicrosecond=dR,iR.prototype.visitTimestampNanosecond=dR,iR.prototype.visitTime=fR,iR.prototype.visitTimeSecond=fR,iR.prototype.visitTimeMillisecond=fR,iR.prototype.visitTimeMicrosecond=fR,iR.prototype.visitTimeNanosecond=fR,iR.prototype.visitDecimal=oR,iR.prototype.visitList=pR,iR.prototype.visitStruct=mR,iR.prototype.visitUnion=hR,iR.prototype.visitDenseUnion=hR,iR.prototype.visitSparseUnion=hR,iR.prototype.visitDictionary=gR,iR.prototype.visitInterval=_R,iR.prototype.visitIntervalDayTime=_R,iR.prototype.visitIntervalYearMonth=_R,iR.prototype.visitDuration=vR,iR.prototype.visitDurationSecond=vR,iR.prototype.visitDurationMillisecond=vR,iR.prototype.visitDurationMicrosecond=vR,iR.prototype.visitDurationNanosecond=vR,iR.prototype.visitFixedSizeList=yR,iR.prototype.visitMap=bR;const xR=new iR;function SR(e,t){return xR.compareSchemas(e,t)}function CR(e,t){return wR(e,t.map(e=>e.data.concat()))}function wR(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(o=1/0,s=-1;++s0&&(r[a++]=$I({type:new gP(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new kR(e,t))]}function TR(e,t,n,r,i){var a;let o=(t+63&-64)>>3;for(let s=-1,c=r.length;++s=t)l===t?n[s]=c:(n[s]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,r[s].unshift(c.slice(t,l-t))));else{let r=e[s];e[s]=r.clone({nullable:!0}),n[s]=(a=c?._changeLengthAndBackfillNullBitmap(t))??$I({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return n}var ER,DR=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new DL([]),this._offsets=[0],this;let i,a;t[0]instanceof DL&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(a=t.pop());let o=t=>{if(t){if(t instanceof kR)return[t];if(t instanceof e)return t.batches;if(t instanceof XI){if(t.type instanceof gP)return[new kR(new DL(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>o(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>o(e));else if(typeof t==`object`){let e=Object.keys(t),n=e.map(e=>new CL([t[e]])),r=i??new DL(e.map((e,t)=>new OL(String(e),n[t].type,n[t].nullable))),[,a]=CR(r,n);return a.length===0?[new kR(t)]:a}}return[]},s=t.flatMap(e=>o(e));if(i=(r=i??(n=s[0])?.schema)??new DL([]),!(i instanceof DL))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of s){if(!(e instanceof kR))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!SR(i,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=i,this.batches=s,this._offsets=a??rL(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=nL(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(AI(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?yL.visit(new CL(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
- `)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new kR(n,e)))}slice(t,n){let r=this.schema;[t,n]=kI({length:this.numRows},t,n);let i=iL(this.data,this._offsets,t,n);return new e(r,i.map(e=>new kR(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&et.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=$I({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new CL(t)}return null}setChild(e,t){var n;return this.setChildAt((n=this.schema.fields)?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&tthis.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=CR(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(...CR(a,o))}};ER=Symbol.toStringTag,DR[ER]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=sL(oL),e.get=sL(bI.getVisitFn(Y.Struct)),e.set=cL(wF.getVisitFn(Y.Struct)),e.indexOf=lL(hL.getVisitFn(Y.Struct)),`Table`))(DR.prototype);var OR,kR=class e{constructor(...e){switch(e.length){case 2:if([this.schema]=e,!(this.schema instanceof DL)||([,this.data=$I({nullCount:0,type:new gP(this.schema.fields),children:this.schema.fields.map(e=>$I({type:e.type,nullCount:0}))})]=e,!(this.data instanceof XI)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=AR(this.schema,this.data.children);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=OL.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new DL(n),o=$I({type:new gP(n),length:i,children:r,nullCount:0});[this.schema,this.data]=AR(a,o.children,i);break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get dictionaries(){return this._dictionaries||=jR(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 bI.visit(this.data,e)}at(e){return this.get(AI(e,this.numRows))}set(e,t){return wF.visit(this.data,e,t)}indexOf(e,t){return hL.visit(this.data,e,t)}[Symbol.iterator](){return yL.visit(new CL([this.data]))}toArray(){return[...this]}concat(...e){return new DR(this.schema,[this,...e])}slice(t,n){let[r]=new CL([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&et.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&tt.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,$I({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=$I({type:new gP(n.fields),length:this.numRows,children:r});return new e(n,i)}};OR=Symbol.toStringTag,kR[OR]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,`RecordBatch`))(kR.prototype);function AR(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){var r;let i=[...e.fields],a=[...t],o=(n+63&-64)>>3;for(let[s,c]of e.fields.entries()){let e=t[s];(!e||e.length!==n)&&(i[s]=c.clone({nullable:!0}),a[s]=(r=e?._changeLengthAndBackfillNullBitmap(n))??$I({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(o)}))}return[e.assign(i),$I({type:new gP(i),length:n,children:a})]}function jR(e,t,n=new Map){var r,i;if(((r=e?.length)??0)>0&&e?.length===t?.length)for(let r=-1,a=e.length;++r$I({type:e.type})),n=$I({type:new gP(e.fields),nullCount:0,children:t});super(e,n)}},NR=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+hM),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):oM.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):rN.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new PM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let 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,oM.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,rN.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 n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){let t=e.endObject();return t}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}},PR=class extends wP{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return JM.startNull(t),JM.endNull(t)}visitInt(e,t){return MM.startInt(t),MM.addBitWidth(t,e.bitWidth),MM.addIsSigned(t,e.isSigned),MM.endInt(t)}visitFloat(e,t){return HM.startFloatingPoint(t),HM.addPrecision(t,e.precision),HM.endFloatingPoint(t)}visitBinary(e,t){return FM.startBinary(t),FM.endBinary(t)}visitLargeBinary(e,t){return WM.startLargeBinary(t),WM.endLargeBinary(t)}visitBool(e,t){return IM.startBool(t),IM.endBool(t)}visitUtf8(e,t){return $M.startUtf8(t),$M.endUtf8(t)}visitLargeUtf8(e,t){return GM.startLargeUtf8(t),GM.endLargeUtf8(t)}visitDecimal(e,t){return RM.startDecimal(t),RM.addScale(t,e.scale),RM.addPrecision(t,e.precision),RM.addBitWidth(t,e.bitWidth),RM.endDecimal(t)}visitDate(e,t){return LM.startDate(t),LM.addUnit(t,e.unit),LM.endDate(t)}visitTime(e,t){return XM.startTime(t),XM.addUnit(t,e.unit),XM.addBitWidth(t,e.bitWidth),XM.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return ZM.startTimestamp(t),ZM.addUnit(t,e.unit),n!==void 0&&ZM.addTimezone(t,n),ZM.endTimestamp(t)}visitInterval(e,t){return UM.startInterval(t),UM.addUnit(t,e.unit),UM.endInterval(t)}visitDuration(e,t){return zM.startDuration(t),zM.addUnit(t,e.unit),zM.endDuration(t)}visitList(e,t){return KM.startList(t),KM.endList(t)}visitStruct(e,t){return YM.startStruct_(t),YM.endStruct_(t)}visitUnion(e,t){QM.startTypeIdsVector(t,e.typeIds.length);let n=QM.createTypeIdsVector(t,e.typeIds);return QM.startUnion(t),QM.addMode(t,e.mode),QM.addTypeIds(t,n),QM.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return NM.startDictionaryEncoding(t),NM.addId(t,BigInt(e.id)),NM.addIsOrdered(t,e.isOrdered),n!==void 0&&NM.addIndexType(t,n),NM.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return BM.startFixedSizeBinary(t),BM.addByteWidth(t,e.byteWidth),BM.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return VM.startFixedSizeList(t),VM.addListSize(t,e.listSize),VM.endFixedSizeList(t)}visitMap(e,t){return qM.startMap(t),qM.addKeysSorted(t,e.keysSorted),qM.endMap(t)}};const FR=new PR;function IR(e,t=new Map){return new DL(zR(e,t),GR(e.metadata),t)}function LR(e){return new ZR(e.count,VR(e.columns),HR(e.columns))}function RR(e){return new QR(LR(e.data),e.id,e.isDelta)}function zR(e,t){return(e.fields||[]).filter(Boolean).map(e=>OL.fromJSON(e,t))}function BR(e,t){return(e.children||[]).filter(Boolean).map(e=>OL.fromJSON(e,t))}function VR(e){return(e||[]).reduce((e,t)=>[...e,new ez(t.count,UR(t.VALIDITY)),...VR(t.children)],[])}function HR(e,t=[]){for(let n=-1,r=(e||[]).length;++ne+ +(t===0),0)}function WR(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=qR(e,BR(e,t)),i=new OL(e.name,o,e.nullable,GR(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?KR(r):new JN,s=new SP(t.get(n),r,n,a.isOrdered),i=new OL(e.name,s,e.nullable,GR(e.metadata))):(r=(r=a.indexType)?KR(r):new JN,t.set(n,o=qR(e,BR(e,t))),s=new SP(o,r,n,a.isOrdered),i=new OL(e.name,s,e.nullable,GR(e.metadata))),i||null}function GR(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function KR(e){return new GN(e.isSigned,e.bitWidth)}function qR(e,t){let n=e.type.name;switch(n){case`NONE`:return new WN;case`null`:return new WN;case`binary`:return new iP;case`largebinary`:return new aP;case`utf8`:return new oP;case`largeutf8`:return new sP;case`bool`:return new cP;case`list`:return new hP((t||[])[0]);case`struct`:return new gP(t||[]);case`struct_`:return new gP(t||[])}switch(n){case`int`:{let t=e.type;return new GN(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new eP(cM[t.precision])}case`decimal`:{let t=e.type;return new lP(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new uP(lM[t.unit])}case`time`:{let t=e.type;return new dP(uM[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new fP(uM[t.unit],t.timezone)}case`interval`:{let t=e.type;return new pP(dM[t.unit])}case`duration`:{let t=e.type;return new mP(uM[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new _P(sM[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new vP(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new yP(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new bP((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var JR=SM,YR=xM,XR=class e{static fromJSON(t,n){let r=new e(0,oM.V5,n);return r._createHeader=tz(t,n),r}static decode(t){t=new YR(Wj(t));let n=NR.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=new e(r,i,a);return o._createHeader=nz(n,a),o}static encode(e){let t=new JR,n=-1;return e.isSchema()?n=DL.encode(t,e.header()):e.isRecordBatch()?n=ZR.encode(t,e.header()):e.isDictionaryBatch()&&(n=QR.encode(t,e.header())),NR.startMessage(t),NR.addVersion(t,oM.V5),NR.addHeader(t,n),NR.addHeaderType(t,e.headerType),NR.addBodyLength(t,BigInt(e.bodyLength)),NR.finishMessageBuffer(t,NR.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof DL)return new e(0,oM.V5,rN.Schema,t);if(t instanceof ZR)return new e(n,oM.V5,rN.RecordBatch,t);if(t instanceof QR)return new e(n,oM.V5,rN.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===rN.Schema}isRecordBatch(){return this.headerType===rN.RecordBatch}isDictionaryBatch(){return this.headerType===rN.DictionaryBatch}constructor(e,t,n,r){this._version=t,this._headerType=n,this.body=new Uint8Array,r&&(this._createHeader=()=>r),this._bodyLength=sN(e)}},ZR=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,n){this._nodes=t,this._buffers=n,this._length=sN(e)}},QR=class{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,n=!1){this._data=e,this._isDelta=n,this._id=sN(t)}},$R=class{constructor(e,t){this.offset=sN(e),this.length=sN(t)}},ez=class{constructor(e,t){this.length=sN(e),this.nullCount=sN(t)}};function tz(e,t){return()=>{switch(t){case rN.Schema:return DL.fromJSON(e);case rN.RecordBatch:return ZR.fromJSON(e);case rN.DictionaryBatch:return QR.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${rN[t]}, type: ${t} }`)}}function nz(e,t){return()=>{switch(t){case rN.Schema:return DL.decode(e.header(new nN),new Map,e.version());case rN.RecordBatch:return ZR.decode(e.header(new OM),e.version());case rN.DictionaryBatch:return QR.decode(e.header(new kM),e.version())}throw Error(`Unrecognized Message type: { name: ${rN[t]}, type: ${t} }`)}}OL.encode=_z,OL.decode=fz,OL.fromJSON=WR,DL.encode=gz,DL.decode=rz,DL.fromJSON=IR,ZR.encode=vz,ZR.decode=iz,ZR.fromJSON=LR,QR.encode=yz,QR.decode=az,QR.fromJSON=RR,ez.encode=bz,ez.decode=sz,$R.encode=xz,$R.decode=oz;function rz(e,t=new Map,n=oM.V5){let r=uz(e,t);return new DL(r,pz(e),t,n)}function iz(e,t=oM.V5){if(e.compression()!==null)throw Error(`Record batch compression not implemented`);return new ZR(e.length(),cz(e),lz(e,t))}function az(e,t=oM.V5){return new QR(ZR.decode(e.data(),t),e.id(),e.isDelta())}function oz(e){return new $R(e.offset(),e.length())}function sz(e){return new ez(e.length(),e.nullCount())}function cz(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++rOL.encode(e,t));nN.startFieldsVector(e,n.length);let r=nN.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?nN.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return PM.startKeyValue(e),PM.addKey(e,r),PM.addValue(e,i),PM.endKeyValue(e)})):-1;return nN.startSchema(e),nN.addFields(e,r),nN.addEndianness(e,Sz?AM.Little:AM.Big),i!==-1&&nN.addCustomMetadata(e,i),nN.endSchema(e)}function _z(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;UN.isDictionary(a)?(o=a.dictionary.typeId,i=FR.visit(a,e),r=FR.visit(a.dictionary,e)):r=FR.visit(a,e);let s=(a.children||[]).map(t=>OL.encode(e,t)),c=tN.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?tN.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return PM.startKeyValue(e),PM.addKey(e,r),PM.addValue(e,i),PM.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),tN.startField(e),tN.addType(e,r),tN.addTypeType(e,o),tN.addChildren(e,c),tN.addNullable(e,!!t.nullable),n!==-1&&tN.addName(e,n),i!==-1&&tN.addDictionary(e,i),l!==-1&&tN.addCustomMetadata(e,l),tN.endField(e)}function vz(e,t){let n=t.nodes||[],r=t.buffers||[];OM.startNodesVector(e,n.length);for(let t of n.slice().reverse())ez.encode(e,t);let i=e.endVector();OM.startBuffersVector(e,r.length);for(let t of r.slice().reverse())$R.encode(e,t);let a=e.endVector();return OM.startRecordBatch(e),OM.addLength(e,BigInt(t.length)),OM.addNodes(e,i),OM.addBuffers(e,a),OM.endRecordBatch(e)}function yz(e,t){let n=ZR.encode(e,t.data);return kM.startDictionaryBatch(e),kM.addId(e,BigInt(t.id)),kM.addIsDelta(e,t.isDelta),kM.addData(e,n),kM.endDictionaryBatch(e)}function bz(e,t){return DM.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function xz(e,t){return EM.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const Sz=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Cz=e=>`Expected ${rN[e]} Message in stream, but was null or length 0.`,wz=e=>`Header pointer of flatbuffer-encoded ${rN[e]} Message is null or length 0.`,Tz=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Ez=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;var Dz=class{constructor(e){this.source=e instanceof VL?e:new VL(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?IL: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 Error(Cz(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=Wj(this.source.read(e));if(t.byteLength[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Cz(e));return t.value}readSchema(){let e=rN.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(wz(e));return n}};const Az=4,jz=`ARROW1`,Mz=new Uint8Array(jz.length);for(let e=0;ethis):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 Qj.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Qj.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(t){return t instanceof e?t:Dj(t)?Zz(t):kj(t)?eB(t):wj(t)?(()=>uj(this,void 0,void 0,function*(){return yield e.from(yield t)}))():Aj(t)||Nj(t)||Fj(t)||Ej(t)?$z(new HL(t)):Qz(new VL(t))}static readAll(t){return t instanceof e?t.isSync()?Yz(t):Xz(t):Dj(t)||ArrayBuffer.isView(t)||Tj(t)||Oj(t)?Yz(t):Xz(t)}},Rz=class extends Lz{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return pj(this,arguments,function*(){yield fj(yield*mj(hj(this[Symbol.iterator]())))})}},zz=class extends Lz{constructor(e){super(e),this._impl=e}readAll(){return uj(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=hj(this),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bz=class extends Rz{constructor(e){super(e),this._impl=e}},Vz=class extends zz{constructor(e){super(e),this._impl=e}},Hz=class{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){let n=this._loadVectors(e,t,this.schema.fields),r=$I({type:new gP(this.schema.fields),length:e.length,children:n});return new kR(this.schema,r)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new CL(c)):new CL(c)).memoize()}_loadVectors(e,t,n){return new tR(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Uz=class extends Hz{constructor(e,t){super(t),this._reader=Dj(e)?new kz(this._handle=e):new Dz(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=Jz(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):IL}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):IL}next(){if(this.closed)return IL;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadRecordBatch(n,r);return{done:!1,value:i}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new MR(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},Wz=class extends Hz{constructor(e,t){super(t),this._reader=new Oz(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return uj(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 uj(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Jz(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return uj(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):IL})}return(e){return uj(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):IL})}next(){return uj(this,void 0,void 0,function*(){if(this.closed)return IL;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadRecordBatch(n,r);return{done:!1,value:i}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new MR(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return uj(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},Gz=class extends Uz{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 GL?e:new GL(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();let n=(t=this._footer)?.getRecordBatch(e);if(n&&this._handle.seek(n.offset)){let e=this._reader.readMessage(rN.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadRecordBatch(t,n);return r}}return null}_readDictionaryBatch(e){var t;let n=(t=this._footer)?.getDictionaryBatch(e);if(n&&this._handle.seek(n.offset)){let e=this._reader.readMessage(rN.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-Fz,n=e.readInt32(t),r=e.readAt(t-n,n);return NL.decode(r)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return uj(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return uj(this,void 0,void 0,function*(){var t;if(this.closed)return null;this._footer||(yield this.open());let n=(t=this._footer)?.getRecordBatch(e);if(n&&(yield this._handle.seek(n.offset))){let e=yield this._reader.readMessage(rN.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadRecordBatch(t,n);return r}}return null})}_readDictionaryBatch(e){return uj(this,void 0,void 0,function*(){var t;let n=(t=this._footer)?.getDictionaryBatch(e);if(n&&(yield this._handle.seek(n.offset))){let e=yield this._reader.readMessage(rN.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return uj(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Fz,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return NL.decode(r)})}_readNextMessageAndValidate(e){return uj(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?Nz(t)?new Bz(new Gz(e.read())):new Rz(new Uz(e)):new Rz(new Uz(function*(){}()))}function $z(e){return uj(this,void 0,void 0,function*(){let t=yield e.peek(Pz+7&-8);return t&&t.byteLength>=4?Nz(t)?new Bz(new Gz(yield e.read())):new zz(new Wz(e)):new zz(new Wz(function(){return pj(this,arguments,function*(){})}()))})}function eB(e){return uj(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new KL(e,t);return t>=Iz&&Nz(yield n.readAt(0,Pz+7&-8))?new Vz(new Kz(n)):new zz(new Wz(n))})}var tB=class e extends wP{static assemble(...t){let n=e=>e.flatMap(e=>Array.isArray(e)?n(e):e instanceof kR?e.data.children:e.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof CL)return this.visitMany(e.data),this;let{type:t}=e;if(!UN.isDictionary(t)){let{length:n}=e;if(n>2147483647)throw RangeError(`Cannot write arrays larger than 2^31 - 1 in length`);if(UN.isUnion(t))this.nodes.push(new ez(n,0));else{let{nullCount:r}=e;UN.isNull(t)||nB.call(this,r<=0?new Uint8Array:UI(e.offset,n,e.nullBitmap)),this.nodes.push(new ez(n,r))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function nB(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new $R(this._byteLength,t)),this._byteLength+=t,this}function rB(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:a}=e;if(nB.call(this,i),n.mode===sM.Sparse)return cB.call(this,e);if(n.mode===sM.Dense){if(e.offset<=0)return nB.call(this,a),cB.call(this,e);{let o=new Int32Array(r),s=Object.create(null),c=Object.create(null);for(let e,n,l=-1;++l{let i=n.typeIds[t],a=s[i],o=c[i];return e.slice(a,Math.min(r,o))}))}}return this}function iB(e){let t;return e.nullCount>=e.length?nB.call(this,new Uint8Array):(t=e.values)instanceof Uint8Array?nB.call(this,UI(e.offset,e.length,t)):nB.call(this,WI(e.values))}function aB(e){return nB.call(this,e.values.subarray(0,e.length*e.stride))}function oB(e){let{length:t,values:n,valueOffsets:r}=e,i=sN(r[0]),a=sN(r[t]),o=Math.min(a-i,n.byteLength-i);return nB.call(this,Xj(-i,t+1,r)),nB.call(this,n.subarray(i,i+o)),this}function sB(e){let{length:t,valueOffsets:n}=e;if(n){let{0:r,[t]:i}=n;return nB.call(this,Xj(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function cB(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}tB.prototype.visitBool=iB,tB.prototype.visitInt=aB,tB.prototype.visitFloat=aB,tB.prototype.visitUtf8=oB,tB.prototype.visitLargeUtf8=oB,tB.prototype.visitBinary=oB,tB.prototype.visitLargeBinary=oB,tB.prototype.visitFixedSizeBinary=aB,tB.prototype.visitDate=aB,tB.prototype.visitTimestamp=aB,tB.prototype.visitTime=aB,tB.prototype.visitDecimal=aB,tB.prototype.visitList=sB,tB.prototype.visitStruct=cB,tB.prototype.visitUnion=rB,tB.prototype.visitInterval=aB,tB.prototype.visitDuration=aB,tB.prototype.visitFixedSizeList=sB,tB.prototype.visitMap=sB;var lB=class extends RL{static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}constructor(e){super(),this._position=0,this._started=!1,this._sink=new BL,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Cj(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy==`boolean`?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat==`boolean`?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return wj(e)?e.then(e=>this.writeAll(e)):Ej(e)?pB(this,e):fB(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,t=null){return e===this._sink||e instanceof BL?this._sink=e:(this._sink=new BL,e&&Mj(e)?this.toDOMStream({type:`bytes`}).pipeTo(e):e&&Pj(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!t||!SR(t,this._schema))&&(t==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=t,this._writeSchema(t))),this}write(e){let t=null;if(this._sink){if(e==null||e instanceof DR&&!(t=e.schema)||e instanceof kR&&!(t=e.schema))return this.finish()&&void 0}else throw Error(`RecordBatchWriter is closed`);if(t&&!SR(t,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof kR?e instanceof MR||this._writeRecordBatch(e):e instanceof DR?this.writeAll(e.batches):Tj(e)&&this.writeAll(e)}_writeMessage(e,t=8){let n=t-1,r=XR.encode(e),i=r.byteLength,a=this._writeLegacyIpcFormat?4:8,o=i+a+n&~n,s=o-i-a;return e.headerType===rN.RecordBatch?this._recordBatchBlocks.push(new FL(o,e.bodyLength,this._position)):e.headerType===rN.DictionaryBatch&&this._dictionaryBlocks.push(new FL(o,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-a)),i>0&&this._write(r),this._writePadding(s)}_write(e){if(this._started){let t=Wj(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(XR.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Mz)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:r,buffers:i}=tB.assemble(e),a=new ZR(e.numRows,n,r),o=XR.from(a,t);return this._writeDictionaries(e)._writeMessage(o)._writeBodyBuffers(i)}_writeDictionaryBatch(e,t,n=!1){let{byteLength:r,nodes:i,bufferRegions:a,buffers:o}=tB.assemble(new CL([e])),s=new ZR(e.length,i,a),c=new QR(s,t,n),l=XR.from(c,r);return this._writeMessage(l)._writeBodyBuffers(o)}_writeBodyBuffers(e){let t,n,r;for(let i=-1,a=e.length;++i0&&(this._write(t),(r=(n+7&-8)-n)>0&&this._writePadding(r));return this}_writeDictionaries(e){var t,n;for(let[r,i]of e.dictionaries){let e=(t=i?.data)??[],a=this._seenDictionaries.get(r),o=(n=this._dictionaryDeltaOffsets.get(r))??0;if(!a||a.data[0]!==e[0])for(let[t,n]of e.entries())this._writeDictionaryBatch(n,r,t>0);else if(or.writeAll(e)):Ej(t)?pB(r,t):fB(r,t)}},dB=class e extends lB{static writeAll(t){let n=new e;return wj(t)?t.then(e=>n.writeAll(e)):Ej(t)?pB(n,t):fB(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,t,n=!1){if(!n&&this._seenDictionaries.has(t))throw Error(`The Arrow File format does not support replacement dictionaries. `);return super._writeDictionaryBatch(e,t,n)}_writeFooter(e){let t=NL.encode(new NL(e,oM.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}};function fB(e,t){let n=t;t instanceof DR&&(n=t.batches,e.reset(void 0,t.schema));for(let t of n)e.write(t);return e.finish()}function pB(e,t){return uj(this,void 0,void 0,function*(){var n,r,i,a,o,s,c;try{for(n=!0,r=hj(t);i=yield r.next(),a=i.done,!a;n=!0){c=i.value,n=!1;let t=c;e.write(t)}}catch(e){o={error:e}}finally{try{!n&&!a&&(s=r.return)&&(yield s.call(r))}finally{if(o)throw o.error}}return e.finish()})}function mB(e,t=`stream`){return(t===`stream`?uB:dB).writeAll(e).toUint8Array(!0)}var hB=Object.create,gB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,vB=Object.getOwnPropertyNames,yB=Object.getPrototypeOf,bB=Object.prototype.hasOwnProperty,xB=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),SB=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of vB(t))!bB.call(e,i)&&i!==n&&gB(e,i,{get:()=>t[i],enumerable:!(r=_B(t,i))||r.enumerable});return e},CB=(e,t,n)=>(n=e==null?{}:hB(yB(e)),SB(t||!e||!e.__esModule?gB(n,`default`,{value:e,enumerable:!0}):n,e)),wB=xB((e,t)=>{t.exports=Worker}),TB=(e=>(e[e.UNDEFINED=0]=`UNDEFINED`,e[e.AUTOMATIC=1]=`AUTOMATIC`,e[e.READ_ONLY=2]=`READ_ONLY`,e[e.READ_WRITE=3]=`READ_WRITE`,e))(TB||{}),EB=(e=>(e[e.IDENTIFIER=0]=`IDENTIFIER`,e[e.NUMERIC_CONSTANT=1]=`NUMERIC_CONSTANT`,e[e.STRING_CONSTANT=2]=`STRING_CONSTANT`,e[e.OPERATOR=3]=`OPERATOR`,e[e.KEYWORD=4]=`KEYWORD`,e[e.COMMENT=5]=`COMMENT`,e))(EB||{}),DB=(e=>(e[e.NONE=0]=`NONE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARNING=3]=`WARNING`,e[e.ERROR=4]=`ERROR`,e))(DB||{}),OB=(e=>(e[e.NONE=0]=`NONE`,e[e.CONNECT=1]=`CONNECT`,e[e.DISCONNECT=2]=`DISCONNECT`,e[e.OPEN=3]=`OPEN`,e[e.QUERY=4]=`QUERY`,e[e.INSTANTIATE=5]=`INSTANTIATE`,e))(OB||{}),kB=(e=>(e[e.NONE=0]=`NONE`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`,e[e.START=3]=`START`,e[e.RUN=4]=`RUN`,e[e.CAPTURE=5]=`CAPTURE`,e))(kB||{}),AB=(e=>(e[e.NONE=0]=`NONE`,e[e.WEB_WORKER=1]=`WEB_WORKER`,e[e.NODE_WORKER=2]=`NODE_WORKER`,e[e.BINDINGS=3]=`BINDINGS`,e[e.ASYNC_DUCKDB=4]=`ASYNC_DUCKDB`,e))(AB||{}),jB=class{log(e){}},MB=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}},NB=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e))(NB||{}),PB=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=Lz.from(t);return console.assert(n.isSync(),`Reader is not sync`),console.assert(n.isFile(),`Reader is not file`),new DR(n)}async send(e,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.startPendingQuery(this._conn,e,t);for(;n==null;)n=await this._bindings.pollPendingQuery(this._conn);let r=new FB(this._bindings,this._conn,n),i=await Lz.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new IB(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=mB(e,`stream`);await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},FB=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight==null?e=await this.db.fetchQueryResults(this.conn):(e=await this._inFlight,this._inFlight=null),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},IB=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=Lz.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new DR(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new FB(this.bindings,this.connectionId,t),r=await Lz.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},LB=(e=>(e.CANCEL_PENDING_QUERY=`CANCEL_PENDING_QUERY`,e.CLOSE_PREPARED=`CLOSE_PREPARED`,e.COLLECT_FILE_STATISTICS=`COLLECT_FILE_STATISTICS`,e.REGISTER_OPFS_FILE_NAME=`REGISTER_OPFS_FILE_NAME`,e.CONNECT=`CONNECT`,e.COPY_FILE_TO_BUFFER=`COPY_FILE_TO_BUFFER`,e.COPY_FILE_TO_PATH=`COPY_FILE_TO_PATH`,e.CREATE_PREPARED=`CREATE_PREPARED`,e.DISCONNECT=`DISCONNECT`,e.DROP_FILE=`DROP_FILE`,e.DROP_FILES=`DROP_FILES`,e.EXPORT_FILE_STATISTICS=`EXPORT_FILE_STATISTICS`,e.FETCH_QUERY_RESULTS=`FETCH_QUERY_RESULTS`,e.FLUSH_FILES=`FLUSH_FILES`,e.GET_FEATURE_FLAGS=`GET_FEATURE_FLAGS`,e.GET_TABLE_NAMES=`GET_TABLE_NAMES`,e.GET_VERSION=`GET_VERSION`,e.GLOB_FILE_INFOS=`GLOB_FILE_INFOS`,e.INSERT_ARROW_FROM_IPC_STREAM=`INSERT_ARROW_FROM_IPC_STREAM`,e.INSERT_CSV_FROM_PATH=`IMPORT_CSV_FROM_PATH`,e.INSERT_JSON_FROM_PATH=`IMPORT_JSON_FROM_PATH`,e.INSTANTIATE=`INSTANTIATE`,e.OPEN=`OPEN`,e.PING=`PING`,e.POLL_PENDING_QUERY=`POLL_PENDING_QUERY`,e.REGISTER_FILE_BUFFER=`REGISTER_FILE_BUFFER`,e.REGISTER_FILE_HANDLE=`REGISTER_FILE_HANDLE`,e.REGISTER_FILE_URL=`REGISTER_FILE_URL`,e.RESET=`RESET`,e.RUN_PREPARED=`RUN_PREPARED`,e.RUN_QUERY=`RUN_QUERY`,e.SEND_PREPARED=`SEND_PREPARED`,e.START_PENDING_QUERY=`START_PENDING_QUERY`,e.TOKENIZE=`TOKENIZE`,e))(LB||{}),RB=(e=>(e.CONNECTION_INFO=`CONNECTION_INFO`,e.ERROR=`ERROR`,e.FEATURE_FLAGS=`FEATURE_FLAGS`,e.FILE_BUFFER=`FILE_BUFFER`,e.FILE_INFOS=`FILE_INFOS`,e.FILE_SIZE=`FILE_SIZE`,e.FILE_STATISTICS=`FILE_STATISTICS`,e.INSTANTIATE_PROGRESS=`INSTANTIATE_PROGRESS`,e.LOG=`LOG`,e.OK=`OK`,e.PREPARED_STATEMENT_ID=`PREPARED_STATEMENT_ID`,e.QUERY_PLAN=`QUERY_PLAN`,e.QUERY_RESULT=`QUERY_RESULT`,e.QUERY_RESULT_CHUNK=`QUERY_RESULT_CHUNK`,e.QUERY_RESULT_HEADER=`QUERY_RESULT_HEADER`,e.QUERY_RESULT_HEADER_OR_NULL=`QUERY_RESULT_HEADER_OR_NULL`,e.REGISTERED_FILE=`REGISTERED_FILE`,e.SCRIPT_TOKENS=`SCRIPT_TOKENS`,e.SUCCESS=`SUCCESS`,e.TABLE_NAMES=`TABLE_NAMES`,e.VERSION_STRING=`VERSION_STRING`,e))(RB||{}),zB=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((e,t)=>{this.promiseResolver=e,this.promiseRejecter=t})}};function BB(e){switch(e.typeId){case Y.Binary:return{sqlType:`binary`};case Y.Bool:return{sqlType:`bool`};case Y.Date:return{sqlType:`date`};case Y.DateDay:return{sqlType:`date32[d]`};case Y.DateMillisecond:return{sqlType:`date64[ms]`};case Y.Decimal:{let t=e;return{sqlType:`decimal`,precision:t.precision,scale:t.scale}}case Y.Float:return{sqlType:`float`};case Y.Float16:return{sqlType:`float16`};case Y.Float32:return{sqlType:`float32`};case Y.Float64:return{sqlType:`float64`};case Y.Int:return{sqlType:`int32`};case Y.Int16:return{sqlType:`int16`};case Y.Int32:return{sqlType:`int32`};case Y.Int64:return{sqlType:`int64`};case Y.Uint16:return{sqlType:`uint16`};case Y.Uint32:return{sqlType:`uint32`};case Y.Uint64:return{sqlType:`uint64`};case Y.Uint8:return{sqlType:`uint8`};case Y.IntervalDayTime:return{sqlType:`interval[dt]`};case Y.IntervalYearMonth:return{sqlType:`interval[m]`};case Y.List:return{sqlType:`list`,valueType:BB(e.valueType)};case Y.FixedSizeBinary:return{sqlType:`fixedsizebinary`,byteWidth:e.byteWidth};case Y.Null:return{sqlType:`null`};case Y.Utf8:return{sqlType:`utf8`};case Y.Struct:return{sqlType:`struct`,fields:e.children.map(e=>VB(e.name,e.type))};case Y.Map:{let t=e;return{sqlType:`map`,keyType:BB(t.keyType),valueType:BB(t.valueType)}}case Y.Time:return{sqlType:`time[s]`};case Y.TimeMicrosecond:return{sqlType:`time[us]`};case Y.TimeMillisecond:return{sqlType:`time[ms]`};case Y.TimeNanosecond:return{sqlType:`time[ns]`};case Y.TimeSecond:return{sqlType:`time[s]`};case Y.Timestamp:return{sqlType:`timestamp`,timezone:e.timezone||void 0};case Y.TimestampSecond:return{sqlType:`timestamp[s]`,timezone:e.timezone||void 0};case Y.TimestampMicrosecond:return{sqlType:`timestamp[us]`,timezone:e.timezone||void 0};case Y.TimestampNanosecond:return{sqlType:`timestamp[ns]`,timezone:e.timezone||void 0};case Y.TimestampMillisecond:return{sqlType:`timestamp[ms]`,timezone:e.timezone||void 0}}throw Error(`unsupported arrow type: ${e.toString()}`)}function VB(e,t){let n=BB(t);return n.name=e,n}var HB=new TextEncoder,UB=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener(`message`,this._onMessageHandler),this._worker.addEventListener(`error`,this._onErrorHandler),this._worker.addEventListener(`close`,this._onCloseHandler),this._workerShutdownPromise=new Promise((e,t)=>{this._workerShutdownResolver=e})}detach(){this._worker&&(this._worker.removeEventListener(`message`,this._onMessageHandler),this._worker.removeEventListener(`error`,this._onErrorHandler),this._worker.removeEventListener(`close`,this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error(`cannot send a message since the worker is not set!`);return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case`LOG`:this._logger.log(n.data);return;case`INSTANTIATE_PROGRESS`:for(let e of this._onInstantiationProgress)e(n.data);return}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn(`unassociated response: [${n.requestId}, ${n.type.toString()}]`);return}if(this._pendingRequests.delete(n.requestId),n.type==`ERROR`){let e=Error(n.data.message);e.name=n.data.name,(t=Object.getOwnPropertyDescriptor(e,`stack`))!=null&&t.writable&&(e.stack=n.data.stack),r.promiseRejecter(e);return}switch(r.type){case`CLOSE_PREPARED`:case`COLLECT_FILE_STATISTICS`:case`REGISTER_OPFS_FILE_NAME`:case`COPY_FILE_TO_PATH`:case`DISCONNECT`:case`DROP_FILE`:case`DROP_FILES`:case`FLUSH_FILES`:case`INSERT_ARROW_FROM_IPC_STREAM`:case`IMPORT_CSV_FROM_PATH`:case`IMPORT_JSON_FROM_PATH`:case`OPEN`:case`PING`:case`REGISTER_FILE_BUFFER`:case`REGISTER_FILE_HANDLE`:case`REGISTER_FILE_URL`:case`RESET`:if(n.type==`OK`){r.promiseResolver(n.data);return}break;case`INSTANTIATE`:if(this._onInstantiationProgress=[],n.type==`OK`){r.promiseResolver(n.data);return}break;case`GLOB_FILE_INFOS`:if(n.type==`FILE_INFOS`){r.promiseResolver(n.data);return}break;case`GET_VERSION`:if(n.type==`VERSION_STRING`){r.promiseResolver(n.data);return}break;case`GET_FEATURE_FLAGS`:if(n.type==`FEATURE_FLAGS`){r.promiseResolver(n.data);return}break;case`GET_TABLE_NAMES`:if(n.type==`TABLE_NAMES`){r.promiseResolver(n.data);return}break;case`TOKENIZE`:if(n.type==`SCRIPT_TOKENS`){r.promiseResolver(n.data);return}break;case`COPY_FILE_TO_BUFFER`:if(n.type==`FILE_BUFFER`){r.promiseResolver(n.data);return}break;case`EXPORT_FILE_STATISTICS`:if(n.type==`FILE_STATISTICS`){r.promiseResolver(n.data);return}break;case`CONNECT`:if(n.type==`CONNECTION_INFO`){r.promiseResolver(n.data);return}break;case`RUN_PREPARED`:case`RUN_QUERY`:if(n.type==`QUERY_RESULT`){r.promiseResolver(n.data);return}break;case`SEND_PREPARED`:if(n.type==`QUERY_RESULT_HEADER`){r.promiseResolver(n.data);return}break;case`START_PENDING_QUERY`:if(n.type==`QUERY_RESULT_HEADER_OR_NULL`){r.promiseResolver(n.data);return}break;case`POLL_PENDING_QUERY`:if(n.type==`QUERY_RESULT_HEADER_OR_NULL`){r.promiseResolver(n.data);return}break;case`CANCEL_PENDING_QUERY`:if(this._onInstantiationProgress=[],n.type==`SUCCESS`){r.promiseResolver(n.data);return}break;case`FETCH_QUERY_RESULTS`:if(n.type==`QUERY_RESULT_CHUNK`){r.promiseResolver(n.data);return}break;case`CREATE_PREPARED`:if(n.type==`PREPARED_STATEMENT_ID`){r.promiseResolver(n.data);return}break}r.promiseRejecter(Error(`unexpected response type: ${n.type.toString()}`))}onError(e){console.error(e),console.error(`error in duckdb worker: ${e.message}`),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn(`worker terminated with ${this._pendingRequests.size} pending requests`);return}this._pendingRequests.clear()}async reset(){let e=new zB(`RESET`,null);return await this.postTask(e)}async ping(){let e=new zB(`PING`,null);await this.postTask(e)}async dropFile(e){let t=new zB(`DROP_FILE`,e);return await this.postTask(t)}async dropFiles(){let e=new zB(`DROP_FILES`,null);return await this.postTask(e)}async flushFiles(){let e=new zB(`FLUSH_FILES`,null);return await this.postTask(e)}async instantiate(e,t=null,n=e=>{}){this._onInstantiationProgress.push(n);let r=new zB(`INSTANTIATE`,[e,t]);return await this.postTask(r)}async getVersion(){let e=new zB(`GET_VERSION`,null);return await this.postTask(e)}async getFeatureFlags(){let e=new zB(`GET_FEATURE_FLAGS`,null);return await this.postTask(e)}async open(e){let t=new zB(`OPEN`,e);await this.postTask(t)}async tokenize(e){let t=new zB(`TOKENIZE`,e);return await this.postTask(t)}async connectInternal(){let e=new zB(`CONNECT`,null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new PB(this,e)}async disconnect(e){let t=new zB(`DISCONNECT`,e);await this.postTask(t)}async runQuery(e,t){let n=new zB(`RUN_QUERY`,[e,t]);return await this.postTask(n)}async startPendingQuery(e,t,n=!1){let r=new zB(`START_PENDING_QUERY`,[e,t,n]);return await this.postTask(r)}async pollPendingQuery(e){let t=new zB(`POLL_PENDING_QUERY`,e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new zB(`CANCEL_PENDING_QUERY`,e);return await this.postTask(t)}async fetchQueryResults(e){let t=new zB(`FETCH_QUERY_RESULTS`,e);return await this.postTask(t)}async getTableNames(e,t){let n=new zB(`GET_TABLE_NAMES`,[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new zB(`CREATE_PREPARED`,[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new zB(`CLOSE_PREPARED`,[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new zB(`RUN_PREPARED`,[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new zB(`SEND_PREPARED`,[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new zB(`GLOB_FILE_INFOS`,e);return await this.postTask(t)}async registerFileText(e,t){let n=HB.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new zB(`REGISTER_FILE_URL`,[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let n=new zB(`REGISTER_FILE_BUFFER`,[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new zB(`REGISTER_FILE_HANDLE`,[e,t,n,r]);await this.postTask(i,[])}async registerOPFSFileName(e){let t=new zB(`REGISTER_OPFS_FILE_NAME`,[e]);await this.postTask(t,[])}async collectFileStatistics(e,t){let n=new zB(`COLLECT_FILE_STATISTICS`,[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new zB(`EXPORT_FILE_STATISTICS`,e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new zB(`COPY_FILE_TO_BUFFER`,e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new zB(`COPY_FILE_TO_PATH`,[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new zB(`INSERT_ARROW_FROM_IPC_STREAM`,[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let e=[];for(let t in n.columns){let r=n.columns[t];e.push(VB(t,r))}n.columnsFlat=e,delete n.columns}let r=new zB(`IMPORT_CSV_FROM_PATH`,[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let e=[];for(let t in n.columns){let r=n.columns[t];e.push(VB(t,r))}n.columnsFlat=e,delete n.columns}let r=new zB(`IMPORT_JSON_FROM_PATH`,[e,t,n]);await this.postTask(r)}};function WB(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<`u`&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var GB=WB(),KB=(e=>(e[e.BUFFER=0]=`BUFFER`,e[e.NODE_FS=1]=`NODE_FS`,e[e.BROWSER_FILEREADER=2]=`BROWSER_FILEREADER`,e[e.BROWSER_FSACCESS=3]=`BROWSER_FSACCESS`,e[e.HTTP=4]=`HTTP`,e[e.S3=5]=`S3`,e))(KB||{}),qB=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),JB=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),YB=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),XB=()=>(async e=>{try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),ZB={name:`@duckdb/duckdb-wasm`,version:`1.29.1-dev68.0`,description:`DuckDB powered by WebAssembly`,license:`MIT`,repository:{type:`git`,url:`https://github.com/duckdb/duckdb-wasm.git`},keywords:[`sql`,`duckdb`,`relational`,`database`,`data`,`query`,`wasm`,`analytics`,`olap`,`arrow`,`parquet`,`json`,`csv`],dependencies:{"apache-arrow":`^17.0.0`},devDependencies:{"@types/emscripten":`^1.39.10`,"@types/jasmine":`^5.1.4`,"@typescript-eslint/eslint-plugin":`^6.21.0`,"@typescript-eslint/parser":`^6.21.0`,esbuild:`^0.20.2`,eslint:`^8.57.0`,"eslint-plugin-jasmine":`^4.1.3`,"eslint-plugin-react":`^7.34.0`,"fast-glob":`^3.3.2`,jasmine:`^5.1.0`,"jasmine-core":`^5.1.2`,"jasmine-spec-reporter":`^7.0.0`,"js-sha256":`^0.11.0`,karma:`^6.4.2`,"karma-chrome-launcher":`^3.2.0`,"karma-coverage":`^2.2.1`,"karma-firefox-launcher":`^2.1.3`,"karma-jasmine":`^5.1.0`,"karma-jasmine-html-reporter":`^2.1.0`,"karma-sourcemap-loader":`^0.4.0`,"karma-spec-reporter":`^0.0.36`,"make-dir":`^4.0.0`,nyc:`^15.1.0`,prettier:`^3.2.5`,puppeteer:`^22.8.0`,rimraf:`^5.0.5`,s3rver:`^3.7.1`,typedoc:`^0.25.13`,typescript:`^5.3.3`,"wasm-feature-detect":`^1.6.1`,"web-worker":`^1.2.0`},scripts:{"build:debug":`node bundle.mjs debug && tsc --emitDeclarationOnly`,"build:release":`node bundle.mjs release && tsc --emitDeclarationOnly`,docs:`typedoc`,report:`node ./coverage.mjs`,"test:node":`node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:node:debug":`node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:node:coverage":`nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:firefox":`karma start ./karma/tests-firefox.cjs`,"test:chrome":`karma start ./karma/tests-chrome.cjs`,"test:chrome:eh":`karma start ./karma/tests-chrome-eh.cjs`,"test:chrome:coverage":`karma start ./karma/tests-chrome-coverage.cjs`,"test:browser":`karma start ./karma/tests-all.cjs`,"test:browser:debug":`karma start ./karma/tests-debug.cjs`,test:`npm run test:chrome && npm run test:node`,"test:coverage":`npm run test:chrome:coverage && npm run test:node:coverage && npm run report`,lint:`eslint src test`},files:[`dist`,`!dist/tests-*`,`!dist/duckdb-browser-mvp.worker.js.map`,`!dist/types/test`],main:`dist/duckdb-browser.cjs`,module:`dist/duckdb-browser.mjs`,types:`dist/duckdb-browser.d.ts`,jsdelivr:`dist/duckdb-browser.cjs`,unpkg:`dist/duckdb-browser.mjs`,sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":`./dist/duckdb-mvp.wasm`,"./dist/duckdb-eh.wasm":`./dist/duckdb-eh.wasm`,"./dist/duckdb-coi.wasm":`./dist/duckdb-coi.wasm`,"./dist/duckdb-browser":`./dist/duckdb-browser.mjs`,"./dist/duckdb-browser.cjs":`./dist/duckdb-browser.cjs`,"./dist/duckdb-browser.mjs":`./dist/duckdb-browser.mjs`,"./dist/duckdb-browser-coi.pthread.worker.js":`./dist/duckdb-browser-coi.pthread.worker.js`,"./dist/duckdb-browser-coi.worker.js":`./dist/duckdb-browser-coi.worker.js`,"./dist/duckdb-browser-eh.worker.js":`./dist/duckdb-browser-eh.worker.js`,"./dist/duckdb-browser-mvp.worker.js":`./dist/duckdb-browser-mvp.worker.js`,"./dist/duckdb-node":`./dist/duckdb-node.cjs`,"./dist/duckdb-node.cjs":`./dist/duckdb-node.cjs`,"./dist/duckdb-node-blocking":`./dist/duckdb-node-blocking.cjs`,"./dist/duckdb-node-blocking.cjs":`./dist/duckdb-node-blocking.cjs`,"./dist/duckdb-node-eh.worker.cjs":`./dist/duckdb-node-eh.worker.cjs`,"./dist/duckdb-node-mvp.worker.cjs":`./dist/duckdb-node-mvp.worker.cjs`,"./blocking":{node:{types:`./dist/duckdb-node-blocking.d.ts`,require:`./dist/duckdb-node-blocking.cjs`,import:`./dist/duckdb-node-blocking.cjs`},types:`./dist/duckdb-node-blocking.d.ts`,import:`./dist/duckdb-node-blocking.mjs`,require:`./dist/duckdb-node-blocking.cjs`},".":{browser:{types:`./dist/duckdb-browser.d.ts`,import:`./dist/duckdb-browser.mjs`,require:`./dist/duckdb-browser.cjs`},node:{types:`./dist/duckdb-node.d.ts`,import:`./dist/duckdb-node.cjs`,require:`./dist/duckdb-node.cjs`},types:`./dist/duckdb-browser.d.ts`,import:`./dist/duckdb-browser.mjs`,require:`./dist/duckdb-browser.cjs`}}},QB=ZB.name,$B=ZB.version,eV=ZB.version.split(`.`),tV=eV[0],nV=eV[1],rV=eV[2],iV=()=>typeof navigator>`u`,aV=()=>iV()?`node`:navigator.userAgent,oV=()=>aV().includes(`Firefox`),sV=()=>/^((?!chrome|android).)*safari/i.test(aV()),cV=null,lV=null,uV=null,dV=null,fV=null;async function pV(){return cV??=typeof BigInt64Array<`u`,lV??=await JB(),uV??=await XB(),dV??=await YB(),fV??=await qB(),{bigInt64Array:cV,crossOriginIsolated:iV()||globalThis.crossOriginIsolated||!1,wasmExceptions:lV,wasmSIMD:dV,wasmThreads:uV,wasmBulkMemory:fV}}async function mV(e){let t=await pV();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var hV=CB(wB());const gV=Symbol.for(`constructDateFrom`),_V={},vV={};function yV(e,t){try{let n=_V[e]||(_V[e]=new Intl.DateTimeFormat(`en-GB`,{timeZone:e,hour:`numeric`,timeZoneName:`longOffset`}).format),r=n(t).split(`GMT`)[1]||``;return r in vV?vV[r]:xV(r,r.split(`:`))}catch{if(e in vV)return vV[e];let t=e?.match(bV);return t?xV(e,t.slice(1)):NaN}}const bV=/([+-]\d\d):?(\d\d)?/;function xV(e,t){let n=+t[0],r=+(t[1]||0);return vV[e]=n>0?n*60+r:n*60-r}var SV=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(yV(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),EV(this,NaN),wV(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){return-yV(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),wV(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};const CV=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!CV.test(e))return;let t=e.replace(CV,`$1UTC`);SV.prototype[t]&&(e.startsWith(`get`)?SV.prototype[e]=function(){return this.internal[t]()}:(SV.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),TV(this),+this},SV.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),wV(this),+this}))});function wV(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function TV(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),EV(e)}function EV(e){let t=yV(e.timeZone,e),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);let r=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),a=r-i,o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=r-t;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=yV(e.timeZone,e),l=-new Date(+e).getTimezoneOffset(),u=l-c,d=c!==t,f=u-s;if(d&&f){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+f);let t=yV(e.timeZone,e),n=c-t;n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var DV=class e extends SV{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${OV(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset(),t=e>0?`-`:`+`,n=String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),r=String(Math.abs(e)%60).padStart(2,`0`);return[t,n,r]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};function OV(e,t){return new Intl.DateTimeFormat(`en-GB`,{timeZone:e,timeZoneName:`long`}).format(t).slice(12)}const kV=new TextDecoder(`utf-8`),AV=e=>kV.decode(e),jV=new TextEncoder,MV=e=>jV.encode(e),NV=e=>typeof e==`function`,PV=e=>e!=null&&Object(e)===e,FV=e=>PV(e)&&NV(e.then),IV=e=>PV(e)&&NV(e[Symbol.iterator]),LV=e=>PV(e)&&NV(e[Symbol.asyncIterator]),RV=e=>PV(e)&&`done`in e&&`value`in e,zV=e=>PV(e)&&NV(e.clear)&&NV(e.bytes)&&NV(e.position)&&NV(e.setPosition)&&NV(e.capacity)&&NV(e.getBufferIdentifier)&&NV(e.createLong);var BV={};xt(BV,{compareArrayLike:()=>TH,joinUint8Arrays:()=>WV,memcpy:()=>UV,rebaseValueOffsets:()=>wH,toArrayBufferView:()=>GV,toArrayBufferViewAsyncIterator:()=>mH,toArrayBufferViewIterator:()=>iH,toBigInt64Array:()=>YV,toBigUint64Array:()=>$V,toFloat32Array:()=>eH,toFloat32ArrayAsyncIterator:()=>xH,toFloat32ArrayIterator:()=>dH,toFloat64Array:()=>tH,toFloat64ArrayAsyncIterator:()=>SH,toFloat64ArrayIterator:()=>fH,toInt16Array:()=>qV,toInt16ArrayAsyncIterator:()=>gH,toInt16ArrayIterator:()=>oH,toInt32Array:()=>JV,toInt32ArrayAsyncIterator:()=>_H,toInt32ArrayIterator:()=>sH,toInt8Array:()=>KV,toInt8ArrayAsyncIterator:()=>hH,toInt8ArrayIterator:()=>aH,toUint16Array:()=>ZV,toUint16ArrayAsyncIterator:()=>yH,toUint16ArrayIterator:()=>lH,toUint32Array:()=>QV,toUint32ArrayAsyncIterator:()=>bH,toUint32ArrayIterator:()=>uH,toUint8Array:()=>XV,toUint8ArrayAsyncIterator:()=>vH,toUint8ArrayIterator:()=>cH,toUint8ClampedArray:()=>nH,toUint8ClampedArrayAsyncIterator:()=>CH,toUint8ClampedArrayIterator:()=>pH});const VV=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function HV(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++ce+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++cGV(Int8Array,e),qV=e=>GV(Int16Array,e),JV=e=>GV(Int32Array,e),YV=e=>GV(BigInt64Array,e),XV=e=>GV(Uint8Array,e),ZV=e=>GV(Uint16Array,e),QV=e=>GV(Uint32Array,e),$V=e=>GV(BigUint64Array,e),eH=e=>GV(Float32Array,e),tH=e=>GV(Float64Array,e),nH=e=>GV(Uint8ClampedArray,e),rH=e=>(e.next(),e);function*iH(e,t){let n=function*(e){yield e},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof VV?n(t):IV(t)?t:n(t);return yield*rH(function*(t){let n=null;do n=t.next(yield GV(e,n));while(!n.done)}(r[Symbol.iterator]())),new e}const aH=e=>iH(Int8Array,e),oH=e=>iH(Int16Array,e),sH=e=>iH(Int32Array,e),cH=e=>iH(Uint8Array,e),lH=e=>iH(Uint16Array,e),uH=e=>iH(Uint32Array,e),dH=e=>iH(Float32Array,e),fH=e=>iH(Float64Array,e),pH=e=>iH(Uint8ClampedArray,e);function mH(e,t){return pj(this,arguments,function*(){if(FV(t))return yield fj(yield fj(yield*mj(hj(mH(e,yield fj(t))))));let n=function(e){return pj(this,arguments,function*(){yield yield fj(yield fj(e))})},r=function(e){return pj(this,arguments,function*(){yield fj(yield*mj(hj(rH(function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)}(e[Symbol.iterator]())))))})},i=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof VV?n(t):IV(t)?r(t):LV(t)?t:n(t);return yield fj(yield*mj(hj(rH(function(t){return pj(this,arguments,function*(){let n=null;do n=yield fj(t.next(yield yield fj(GV(e,n))));while(!n.done)})}(i[Symbol.asyncIterator]()))))),yield fj(new e)})}const hH=e=>mH(Int8Array,e),gH=e=>mH(Int16Array,e),_H=e=>mH(Int32Array,e),vH=e=>mH(Uint8Array,e),yH=e=>mH(Uint16Array,e),bH=e=>mH(Uint32Array,e),xH=e=>mH(Float32Array,e),SH=e=>mH(Float64Array,e),CH=e=>mH(Uint8ClampedArray,e);function wH(e,t,n){if(e!==0){n=n.slice(0,t);for(let t=-1,r=n.length;++t0)do if(e[n]!==t[n])return!1;while(++nPH});const NH=void 0;function PH(e){if(e===null)return`null`;if(e===NH)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>PH(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function FH(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function IH(e,t){return FH(e/t)+FH(e%t)/FH(t)}var LH={};xt(LH,{BN:()=>YH,bigNumToBigInt:()=>qH,bigNumToNumber:()=>GH,bigNumToString:()=>KH,isArrowBigNumSymbol:()=>RH});const RH=Symbol.for(`isArrowBigNum`);function zH(e,...t){return t.length===0?Object.setPrototypeOf(GV(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}zH.prototype[RH]=!0,zH.prototype.toJSON=function(){return`"${KH(this)}"`},zH.prototype.valueOf=function(e){return GH(this,e)},zH.prototype.toString=function(){return KH(this)},zH.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return GH(this);case`string`:return KH(this);case`default`:return qH(this)}return KH(this)};function BH(...e){return zH.apply(this,e)}function VH(...e){return zH.apply(this,e)}function HH(...e){return zH.apply(this,e)}Object.setPrototypeOf(BH.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(VH.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(HH.prototype,Object.create(Uint32Array.prototype)),Object.assign(BH.prototype,zH.prototype,{constructor:BH,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(VH.prototype,zH.prototype,{constructor:VH,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(HH.prototype,zH.prototype,{constructor:HH,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const UH=BigInt(4294967296)*BigInt(4294967296),WH=UH-BigInt(1);function GH(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<0){let e=BigInt(`1`.padEnd(t+1,`0`)),n=c/e,r=s?-(c%e):c%e,i=FH(n),a=`${r}`.padStart(t,`0`),o=s&&i===0?`-`:``;return+`${o}${i}.${a}`}return FH(c)}function KH(e){if(e.byteLength===8){let t=new e.BigIntArray(e.buffer,e.byteOffset,1);return`${t[0]}`}if(!e.signed)return JH(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=new Int16Array([t.at(-1)])[0];if(n>=0)return JH(e);t=t.slice();let r=1;for(let e=0;e(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=`DataType`))(vU.prototype);var yU=class extends vU{constructor(){super(X.Null)}toString(){return`Null`}};ZH=Symbol.toStringTag,yU[ZH]=(e=>e[Symbol.toStringTag]=`Null`)(yU.prototype);var bU=class extends vU{constructor(e,t){super(X.Int),this.isSigned=e,this.bitWidth=t}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};QH=Symbol.toStringTag,bU[QH]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(bU.prototype);var xU=class extends bU{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},SU=class extends bU{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},CU=class extends bU{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},wU=class extends bU{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},TU=class extends bU{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},EU=class extends bU{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},DU=class extends bU{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},OU=class extends bU{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(xU.prototype,`ArrayType`,{value:Int8Array}),Object.defineProperty(SU.prototype,`ArrayType`,{value:Int16Array}),Object.defineProperty(CU.prototype,`ArrayType`,{value:Int32Array}),Object.defineProperty(wU.prototype,`ArrayType`,{value:BigInt64Array}),Object.defineProperty(TU.prototype,`ArrayType`,{value:Uint8Array}),Object.defineProperty(EU.prototype,`ArrayType`,{value:Uint16Array}),Object.defineProperty(DU.prototype,`ArrayType`,{value:Uint32Array}),Object.defineProperty(OU.prototype,`ArrayType`,{value:BigUint64Array});var kU=class extends vU{constructor(e){super(X.Float),this.precision=e}get ArrayType(){switch(this.precision){case DH.HALF:return Uint16Array;case DH.SINGLE:return Float32Array;case DH.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$H=Symbol.toStringTag,kU[$H]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(kU.prototype);var AU=class extends kU{constructor(){super(DH.HALF)}},jU=class extends kU{constructor(){super(DH.SINGLE)}},MU=class extends kU{constructor(){super(DH.DOUBLE)}};Object.defineProperty(AU.prototype,`ArrayType`,{value:Uint16Array}),Object.defineProperty(jU.prototype,`ArrayType`,{value:Float32Array}),Object.defineProperty(MU.prototype,`ArrayType`,{value:Float64Array});var NU=class extends vU{constructor(){super(X.Binary)}toString(){return`Binary`}};eU=Symbol.toStringTag,NU[eU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(NU.prototype);var PU=class extends vU{constructor(){super(X.LargeBinary)}toString(){return`LargeBinary`}};tU=Symbol.toStringTag,PU[tU]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(PU.prototype);var FU=class extends vU{constructor(){super(X.Utf8)}toString(){return`Utf8`}};nU=Symbol.toStringTag,FU[nU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(FU.prototype);var IU=class extends vU{constructor(){super(X.LargeUtf8)}toString(){return`LargeUtf8`}};rU=Symbol.toStringTag,IU[rU]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(IU.prototype);var LU=class extends vU{constructor(){super(X.Bool)}toString(){return`Bool`}};iU=Symbol.toStringTag,LU[iU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(LU.prototype);var RU=class extends vU{constructor(e,t,n=128){super(X.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};aU=Symbol.toStringTag,RU[aU]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(RU.prototype);var zU=class extends vU{constructor(e){super(X.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${OH[this.unit]}>`}get ArrayType(){return this.unit===OH.DAY?Int32Array:BigInt64Array}};oU=Symbol.toStringTag,zU[oU]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(zU.prototype);var BU=class extends vU{constructor(e,t){super(X.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${kH[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};sU=Symbol.toStringTag,BU[sU]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(BU.prototype);var VU=class extends vU{constructor(e,t){super(X.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${kH[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};cU=Symbol.toStringTag,VU[cU]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(VU.prototype);var HU=class extends vU{constructor(e){super(X.Interval),this.unit=e}toString(){return`Interval<${AH[this.unit]}>`}};lU=Symbol.toStringTag,HU[lU]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(HU.prototype);var UU=class extends vU{constructor(e){super(X.Duration),this.unit=e}toString(){return`Duration<${kH[this.unit]}>`}};uU=Symbol.toStringTag,UU[uU]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(UU.prototype);var WU=class extends vU{constructor(e){super(X.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};dU=Symbol.toStringTag,WU[dU]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(WU.prototype);var GU=class extends vU{constructor(e){super(X.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};fU=Symbol.toStringTag,GU[fU]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(GU.prototype);var KU=class extends vU{constructor(e,t,n){super(X.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};pU=Symbol.toStringTag,KU[pU]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(KU.prototype);var qU=class extends vU{constructor(e){super(X.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};mU=Symbol.toStringTag,qU[mU]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(qU.prototype);var JU=class extends vU{constructor(e,t){super(X.FixedSizeList),this.listSize=e,this.children=[t]}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}>`}};hU=Symbol.toStringTag,JU[hU]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(JU.prototype);var YU=class extends vU{constructor(e,t=!1){var n,r,i;if(super(X.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,(n=e?.type)?.children)){let t=(r=e?.type)?.children[0];t&&(t.name=`key`);let n=(i=e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};gU=Symbol.toStringTag,YU[gU]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(YU.prototype);const XU=(e=>()=>++e)(-1);var ZU=class extends vU{constructor(e,t,n,r){super(X.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?XU():FH(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};_U=Symbol.toStringTag,ZU[_U]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(ZU.prototype);function QU(e){let t=e;switch(e.typeId){case X.Decimal:return e.bitWidth/32;case X.Interval:return t.unit===AH.MONTH_DAY_NANO?4:1+t.unit;case X.FixedSizeList:return t.listSize;case X.FixedSizeBinary:return t.byteWidth;default:return 1}}var $U=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return eW(this,e,t)}getVisitFnByTypeId(e,t=!0){return tW(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}visitLargeUtf8(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(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}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function eW(e,t,n=!0){return typeof t==`number`?tW(e,t,n):typeof t==`string`&&t in X?tW(e,X[t],n):t&&t instanceof vU?tW(e,nW(t),n):t?.type&&t.type instanceof vU?tW(e,nW(t.type),n):tW(e,X.NONE,n)}function tW(e,t,n=!0){let r=null;switch(t){case X.Null:r=e.visitNull;break;case X.Bool:r=e.visitBool;break;case X.Int:r=e.visitInt;break;case X.Int8:r=e.visitInt8||e.visitInt;break;case X.Int16:r=e.visitInt16||e.visitInt;break;case X.Int32:r=e.visitInt32||e.visitInt;break;case X.Int64:r=e.visitInt64||e.visitInt;break;case X.Uint8:r=e.visitUint8||e.visitInt;break;case X.Uint16:r=e.visitUint16||e.visitInt;break;case X.Uint32:r=e.visitUint32||e.visitInt;break;case X.Uint64:r=e.visitUint64||e.visitInt;break;case X.Float:r=e.visitFloat;break;case X.Float16:r=e.visitFloat16||e.visitFloat;break;case X.Float32:r=e.visitFloat32||e.visitFloat;break;case X.Float64:r=e.visitFloat64||e.visitFloat;break;case X.Utf8:r=e.visitUtf8;break;case X.LargeUtf8:r=e.visitLargeUtf8;break;case X.Binary:r=e.visitBinary;break;case X.LargeBinary:r=e.visitLargeBinary;break;case X.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case X.Date:r=e.visitDate;break;case X.DateDay:r=e.visitDateDay||e.visitDate;break;case X.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case X.Timestamp:r=e.visitTimestamp;break;case X.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case X.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case X.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case X.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case X.Time:r=e.visitTime;break;case X.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case X.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case X.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case X.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case X.Decimal:r=e.visitDecimal;break;case X.List:r=e.visitList;break;case X.Struct:r=e.visitStruct;break;case X.Union:r=e.visitUnion;break;case X.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case X.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case X.Dictionary:r=e.visitDictionary;break;case X.Interval:r=e.visitInterval;break;case X.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case X.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case X.IntervalMonthDayNano:r=e.visitIntervalMonthDayNano||e.visitInterval;break;case X.Duration:r=e.visitDuration;break;case X.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case X.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case X.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case X.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case X.FixedSizeList:r=e.visitFixedSizeList;break;case X.Map:r=e.visitMap;break}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${X[t]}'`)}function nW(e){switch(e.typeId){case X.Null:return X.Null;case X.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?X.Int8:X.Uint8;case 16:return n?X.Int16:X.Uint16;case 32:return n?X.Int32:X.Uint32;case 64:return n?X.Int64:X.Uint64}return X.Int}case X.Float:switch(e.precision){case DH.HALF:return X.Float16;case DH.SINGLE:return X.Float32;case DH.DOUBLE:return X.Float64}return X.Float;case X.Binary:return X.Binary;case X.LargeBinary:return X.LargeBinary;case X.Utf8:return X.Utf8;case X.LargeUtf8:return X.LargeUtf8;case X.Bool:return X.Bool;case X.Decimal:return X.Decimal;case X.Time:switch(e.unit){case kH.SECOND:return X.TimeSecond;case kH.MILLISECOND:return X.TimeMillisecond;case kH.MICROSECOND:return X.TimeMicrosecond;case kH.NANOSECOND:return X.TimeNanosecond}return X.Time;case X.Timestamp:switch(e.unit){case kH.SECOND:return X.TimestampSecond;case kH.MILLISECOND:return X.TimestampMillisecond;case kH.MICROSECOND:return X.TimestampMicrosecond;case kH.NANOSECOND:return X.TimestampNanosecond}return X.Timestamp;case X.Date:switch(e.unit){case OH.DAY:return X.DateDay;case OH.MILLISECOND:return X.DateMillisecond}return X.Date;case X.Interval:switch(e.unit){case AH.DAY_TIME:return X.IntervalDayTime;case AH.YEAR_MONTH:return X.IntervalYearMonth;case AH.MONTH_DAY_NANO:return X.IntervalMonthDayNano}return X.Interval;case X.Duration:switch(e.unit){case kH.SECOND:return X.DurationSecond;case kH.MILLISECOND:return X.DurationMillisecond;case kH.MICROSECOND:return X.DurationMicrosecond;case kH.NANOSECOND:return X.DurationNanosecond}return X.Duration;case X.Map:return X.Map;case X.List:return X.List;case X.Struct:return X.Struct;case X.Union:switch(e.mode){case EH.Dense:return X.DenseUnion;case EH.Sparse:return X.SparseUnion}return X.Union;case X.FixedSizeBinary:return X.FixedSizeBinary;case X.FixedSizeList:return X.FixedSizeList;case X.Dictionary:return X.Dictionary}throw Error(`Unrecognized type '${X[e.typeId]}'`)}$U.prototype.visitInt8=null,$U.prototype.visitInt16=null,$U.prototype.visitInt32=null,$U.prototype.visitInt64=null,$U.prototype.visitUint8=null,$U.prototype.visitUint16=null,$U.prototype.visitUint32=null,$U.prototype.visitUint64=null,$U.prototype.visitFloat16=null,$U.prototype.visitFloat32=null,$U.prototype.visitFloat64=null,$U.prototype.visitDateDay=null,$U.prototype.visitDateMillisecond=null,$U.prototype.visitTimestampSecond=null,$U.prototype.visitTimestampMillisecond=null,$U.prototype.visitTimestampMicrosecond=null,$U.prototype.visitTimestampNanosecond=null,$U.prototype.visitTimeSecond=null,$U.prototype.visitTimeMillisecond=null,$U.prototype.visitTimeMicrosecond=null,$U.prototype.visitTimeNanosecond=null,$U.prototype.visitDenseUnion=null,$U.prototype.visitSparseUnion=null,$U.prototype.visitIntervalDayTime=null,$U.prototype.visitIntervalYearMonth=null,$U.prototype.visitIntervalMonthDayNano=null,$U.prototype.visitDuration=null,$U.prototype.visitDurationSecond=null,$U.prototype.visitDurationMillisecond=null,$U.prototype.visitDurationMicrosecond=null,$U.prototype.visitDurationNanosecond=null;var rW={};xt(rW,{float64ToUint16:()=>sW,uint16ToFloat64:()=>oW});const iW=new Float64Array(1),aW=new Uint32Array(iW.buffer);function oW(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function sW(e){if(e!==e)return 32256;iW[0]=e;let t=(aW[1]&2147483648)>>16&65535,n=aW[1]&2146435072,r=0;return n>=1089470464?aW[0]>0?n=31744:(n=(n&2080374784)>>16,r=(aW[1]&1048575)>>10):n<=1056964608?(r=1048576+(aW[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(aW[1]&1048575)+512>>10),t|n|r&65535}var cW=class extends $U{};function lW(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const uW=(e,t,n)=>{e[t]=Math.floor(n/864e5)},dW=(e,t,n,r)=>{if(n+1{let i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},mW=({values:e},t,n)=>{e[t]=n},hW=({values:e},t,n)=>{e[t]=sW(n)},gW=(e,t,n)=>{switch(e.type.precision){case DH.HALF:return hW(e,t,n);case DH.SINGLE:case DH.DOUBLE:return mW(e,t,n)}},_W=({values:e},t,n)=>{uW(e,t,n.valueOf())},vW=({values:e},t,n)=>{e[t]=BigInt(n)},yW=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},bW=({values:e,valueOffsets:t},n,r)=>dW(e,t,n,r),xW=({values:e,valueOffsets:t},n,r)=>dW(e,t,n,MV(r)),SW=(e,t,n)=>{e.type.unit===OH.DAY?_W(e,t,n):vW(e,t,n)},CW=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},wW=({values:e},t,n)=>{e[t]=BigInt(n)},TW=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},EW=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},DW=(e,t,n)=>{switch(e.type.unit){case kH.SECOND:return CW(e,t,n);case kH.MILLISECOND:return wW(e,t,n);case kH.MICROSECOND:return TW(e,t,n);case kH.NANOSECOND:return EW(e,t,n)}},OW=({values:e},t,n)=>{e[t]=n},kW=({values:e},t,n)=>{e[t]=n},AW=({values:e},t,n)=>{e[t]=n},jW=({values:e},t,n)=>{e[t]=n},MW=(e,t,n)=>{switch(e.type.unit){case kH.SECOND:return OW(e,t,n);case kH.MILLISECOND:return kW(e,t,n);case kH.MICROSECOND:return AW(e,t,n);case kH.NANOSECOND:return jW(e,t,n)}},NW=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},PW=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=tG.getVisitFn(r);if(Array.isArray(n))for(let e=-1,o=i[t],s=i[t+1];o{let r=e.children[0],{valueOffsets:i}=e,a=tG.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},IW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),LW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),RW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),zW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),BW=(e,t,n)=>{let r=e.type.children.map(e=>tG.getVisitFn(e.type)),i=n instanceof Map?RW(t,n):n instanceof iq?LW(t,n):Array.isArray(n)?IW(t,n):zW(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},VW=(e,t,n)=>{e.type.mode===EH.Dense?HW(e,t,n):UW(e,t,n)},HW=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];tG.visit(i,e.valueOffsets[t],n)},UW=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];tG.visit(i,t,n)},WW=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},GW=(e,t,n)=>{switch(e.type.unit){case AH.YEAR_MONTH:return qW(e,t,n);case AH.DAY_TIME:return KW(e,t,n);case AH.MONTH_DAY_NANO:return JW(e,t,n)}},KW=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},qW=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},JW=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},YW=({values:e},t,n)=>{e[t]=n},XW=({values:e},t,n)=>{e[t]=n},ZW=({values:e},t,n)=>{e[t]=n},QW=({values:e},t,n)=>{e[t]=n},$W=(e,t,n)=>{switch(e.type.unit){case kH.SECOND:return YW(e,t,n);case kH.MILLISECOND:return XW(e,t,n);case kH.MICROSECOND:return ZW(e,t,n);case kH.NANOSECOND:return QW(e,t,n)}},eG=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=tG.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e`${PH(e)}: ${PH(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new aG(this[nG],this[rG])}},aG=class{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(){let e=this.childIndex;return ee.name)}has(e,t){return e[nG].type.children.some(e=>e.name===t)}getOwnPropertyDescriptor(e,t){if(e[nG].type.children.some(e=>e.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[nG].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=$G.visit(e[nG].children[n],e[rG]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[nG].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(tG.visit(e[nG].children[r],e[rG],n),Reflect.set(e,t,n))}};const sG=new oG;var cG=class extends $U{};function lG(e){return(t,n)=>t.getValid(n)?e(t,n):null}const uG=(e,t)=>864e5*e[t],dG=(e,t)=>null,fG=(e,t,n)=>{if(n+1>=t.length)return null;let r=FH(t[n]),i=FH(t[n+1]);return e.subarray(r,i)},pG=({offset:e,values:t},n)=>{let r=e+n,i=t[r>>3];return(i&1<uG(e,t),hG=({values:e},t)=>FH(e[t]),gG=({stride:e,values:t},n)=>t[e*n],_G=({stride:e,values:t},n)=>oW(t[e*n]),vG=({values:e},t)=>e[t],yG=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),bG=({values:e,valueOffsets:t},n)=>fG(e,t,n),xG=({values:e,valueOffsets:t},n)=>{let r=fG(e,t,n);return r===null?null:AV(r)},SG=({values:e},t)=>e[t],CG=({type:e,values:t},n)=>e.precision===DH.HALF?oW(t[n]):t[n],wG=(e,t)=>e.type.unit===OH.DAY?mG(e,t):hG(e,t),TG=({values:e},t)=>1e3*FH(e[t]),EG=({values:e},t)=>FH(e[t]),DG=({values:e},t)=>IH(e[t],BigInt(1e3)),OG=({values:e},t)=>IH(e[t],BigInt(1e6)),kG=(e,t)=>{switch(e.type.unit){case kH.SECOND:return TG(e,t);case kH.MILLISECOND:return EG(e,t);case kH.MICROSECOND:return DG(e,t);case kH.NANOSECOND:return OG(e,t)}},AG=({values:e},t)=>e[t],jG=({values:e},t)=>e[t],MG=({values:e},t)=>e[t],NG=({values:e},t)=>e[t],PG=(e,t)=>{switch(e.type.unit){case kH.SECOND:return AG(e,t);case kH.MILLISECOND:return jG(e,t);case kH.MICROSECOND:return MG(e,t);case kH.NANOSECOND:return NG(e,t)}},FG=({values:e,stride:t},n)=>YH.decimal(e.subarray(t*n,t*(n+1))),IG=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:a,[t*r+1]:o}=n,s=i[0],c=s.slice(a,o-a);return new iq([c])},LG=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new iK(o.slice(i,a-i))},RG=(e,t)=>new iG(e,t),zG=(e,t)=>e.type.mode===EH.Dense?BG(e,t):VG(e,t),BG=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return $G.visit(r,e.valueOffsets[t])},VG=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return $G.visit(r,t)},HG=(e,t)=>{var n;return(n=e.dictionary)?.get(e.values[t])},UG=(e,t)=>e.type.unit===AH.MONTH_DAY_NANO?KG(e,t):e.type.unit===AH.DAY_TIME?WG(e,t):GG(e,t),WG=({values:e},t)=>e.subarray(2*t,2*(t+1)),GG=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},KG=({values:e},t)=>e.subarray(4*t,4*(t+1)),qG=({values:e},t)=>e[t],JG=({values:e},t)=>e[t],YG=({values:e},t)=>e[t],XG=({values:e},t)=>e[t],ZG=(e,t)=>{switch(e.type.unit){case kH.SECOND:return qG(e,t);case kH.MILLISECOND:return JG(e,t);case kH.MICROSECOND:return YG(e,t);case kH.NANOSECOND:return XG(e,t)}},QG=(e,t)=>{let{stride:n,children:r}=e,i=r[0],a=i.slice(t*n,n);return new iq([a])};cG.prototype.visitNull=lG(dG),cG.prototype.visitBool=lG(pG),cG.prototype.visitInt=lG(SG),cG.prototype.visitInt8=lG(gG),cG.prototype.visitInt16=lG(gG),cG.prototype.visitInt32=lG(gG),cG.prototype.visitInt64=lG(vG),cG.prototype.visitUint8=lG(gG),cG.prototype.visitUint16=lG(gG),cG.prototype.visitUint32=lG(gG),cG.prototype.visitUint64=lG(vG),cG.prototype.visitFloat=lG(CG),cG.prototype.visitFloat16=lG(_G),cG.prototype.visitFloat32=lG(gG),cG.prototype.visitFloat64=lG(gG),cG.prototype.visitUtf8=lG(xG),cG.prototype.visitLargeUtf8=lG(xG),cG.prototype.visitBinary=lG(bG),cG.prototype.visitLargeBinary=lG(bG),cG.prototype.visitFixedSizeBinary=lG(yG),cG.prototype.visitDate=lG(wG),cG.prototype.visitDateDay=lG(mG),cG.prototype.visitDateMillisecond=lG(hG),cG.prototype.visitTimestamp=lG(kG),cG.prototype.visitTimestampSecond=lG(TG),cG.prototype.visitTimestampMillisecond=lG(EG),cG.prototype.visitTimestampMicrosecond=lG(DG),cG.prototype.visitTimestampNanosecond=lG(OG),cG.prototype.visitTime=lG(PG),cG.prototype.visitTimeSecond=lG(AG),cG.prototype.visitTimeMillisecond=lG(jG),cG.prototype.visitTimeMicrosecond=lG(MG),cG.prototype.visitTimeNanosecond=lG(NG),cG.prototype.visitDecimal=lG(FG),cG.prototype.visitList=lG(IG),cG.prototype.visitStruct=lG(RG),cG.prototype.visitUnion=lG(zG),cG.prototype.visitDenseUnion=lG(BG),cG.prototype.visitSparseUnion=lG(VG),cG.prototype.visitDictionary=lG(HG),cG.prototype.visitInterval=lG(UG),cG.prototype.visitIntervalDayTime=lG(WG),cG.prototype.visitIntervalYearMonth=lG(GG),cG.prototype.visitIntervalMonthDayNano=lG(KG),cG.prototype.visitDuration=lG(ZG),cG.prototype.visitDurationSecond=lG(qG),cG.prototype.visitDurationMillisecond=lG(JG),cG.prototype.visitDurationMicrosecond=lG(YG),cG.prototype.visitDurationNanosecond=lG(XG),cG.prototype.visitFixedSizeList=lG(QG),cG.prototype.visitMap=lG(LG);const $G=new cG,eK=Symbol.for(`keys`),tK=Symbol.for(`vals`),nK=Symbol.for(`kKeysAsStrings`),rK=Symbol.for(`_kKeysAsStrings`);var iK=class{constructor(e){return this[eK]=new iq([e.children[0]]).memoize(),this[tK]=e.children[1],new Proxy(this,new oK)}get[nK](){return this[rK]||(this[rK]=Array.from(this[eK].toArray(),String))}[Symbol.iterator](){return new aK(this[eK],this[tK])}get size(){return this[eK].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[eK],t=this[tK],n={};for(let r=-1,i=e.length;++r`${PH(e)}: ${PH(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},aK=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),$G.visit(this.vals,e)]})}},oK=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[nK]}has(e,t){return e[nK].includes(t)}getOwnPropertyDescriptor(e,t){let n=e[nK].indexOf(t);if(n!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[nK].indexOf(t);if(n!==-1){let r=$G.visit(Reflect.get(e,tK),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[nK].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(tG.visit(Reflect.get(e,tK),r,n),Reflect.set(e,t,n))}};Object.defineProperties(iK.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[eK]:{writable:!0,enumerable:!1,configurable:!1,value:null},[tK]:{writable:!0,enumerable:!1,configurable:!1,value:null},[rK]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var sK={};xt(sK,{clampRange:()=>lK,createElementComparator:()=>fK,wrapIndex:()=>uK});let cK;function lK(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(e,a,o):[a,o]}const uK=(e,t)=>e<0?t+e:e,dK=e=>e!==e;function fK(e){let t=typeof e;if(t!==`object`||e===null)return dK(e)?dK:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date?e.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?TH(e,t):!1:e instanceof Map?mK(e):Array.isArray(e)?pK(e):e instanceof iq?hK(e):gK(e,!0)}function pK(e){let t=[];for(let n=-1,r=e.length;++n!1;let r=[];for(let t=-1,i=n.length;++t{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return vK(e,n);case Map:return bK(e,n,n.keys());case iK:case iG:case Object:case void 0:return bK(e,n,t||Object.keys(n))}return n instanceof iq?yK(e,n):!1}}function vK(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++rDK,getBit:()=>CK,getBool:()=>SK,packBools:()=>EK,popcnt_array:()=>kK,popcnt_bit_range:()=>OK,popcnt_uint32:()=>AK,setBool:()=>wK,truncateBitmap:()=>TK});function SK(e,t,n,r){return(n&1<>r}function wK(e,t,n){return n?!!(e[t>>3]|=1<>3]&=~(1<0||n.byteLength>3):EK(new DK(n,e,t,null,SK)).subarray(0,r)),i}return n}function EK(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var DK=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8==0?0:8-t%8);return OK(e,t,i)+OK(e,r,n)+kK(e,i>>3,r-i>>3)}function kK(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=AK(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=AK(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=AK(a.getUint8(i)),i+=1;return r}function AK(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const jK=-1;var MK=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return vU.isSparseUnion(e)||vU.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(vU.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=jK&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-OK(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=QU(t),a&&((c=a[0])&&(this.valueOffsets=c),(c=a[1])&&(this.values=c),(c=a[2])&&(this.nullBitmap=c),(c=a[3])&&(this.typeIds=c)))}getValid(e){let{type:t}=this;if(vU.isUnion(t)){let n=t,r=this.children[n.typeIdToChildIndex[this.typeIds[e]]],i=n.mode===EH.Dense?this.valueOffsets[e]:e;return r.getValid(i)}if(this.nullable&&this.nullCount>0){let t=this.offset+e,n=this.nullBitmap[t>>3];return(n&1<>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(TK(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children){return new e(t,n,r,i,a,o,this.dictionary)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===X.Null)return this.clone(this.type,0,e,0);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<0&&r.set(TK(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[jH.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;return(i=a[jH.TYPE])&&(a[jH.TYPE]=i.subarray(e,e+t)),(i=a[jH.OFFSET])&&(a[jH.OFFSET]=i.subarray(e,e+t+1))||(i=a[jH.DATA])&&(a[jH.DATA]=r===6?i:i.subarray(n*e,n*(e+t))),a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};MK.prototype.children=Object.freeze([]);var NK=class e extends $U{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new MK(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=JV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=YV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=JV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=YV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=XV(e.nullBitmap),a=JV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=XV(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=GV(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;if(vU.isSparseUnion(t))return new MK(t,n,a,o,[void 0,void 0,void 0,i],r);let s=JV(e.valueOffsets);return new MK(t,n,a,o,[s,void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=XV(t.nullBitmap),a=GV(n.indices.ArrayType,t.data),{dictionary:o=new iq([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new MK(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=XV(t.nullBitmap),{length:o=i.length/QU(n),nullCount:s=t.nullBitmap?-1:0}=t;return new MK(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=XV(t.nullBitmap),o=JV(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new MK(n,r,s,c,[o,void 0,a],[i])}};const PK=new NK;var FK=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function LK(e){return e.reduce((e,t)=>e+t.nullCount,0)}function RK(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function zK(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function BK(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function qK(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new DK(n,e.offset+(t||0),e.length,n,SK)){if(!i)return r;++r}return-1}function JK(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case X.Union:break;case X.Dictionary:break;default:return qK(e,n)}let r=$G.getVisitFn(e),i=fK(t);for(let t=(n||0)-1,a=e.length;++t{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new FK(e.data.length,t=>{let r=e.data[t],i=r.length,a=e.slice(n,n+i);return n+=i,new $K(a)})}var $K=class{constructor(e){this.vector=e,this.index=0}next(){return this.indexe.data):t;if(a.length===0||a.some(e=>!(e instanceof MK)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let o=(n=a[0])?.type;switch(a.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:n}=nq[o.typeId],r=a[0];this.isValid=e=>VK(r,e),this.get=t=>e(r,t),this.set=(e,n)=>t(r,e,n),this.indexOf=e=>n(r,e),this._offsets=[0,r.length];break}default:Object.setPrototypeOf(this,rq[o.typeId]),this._offsets=RK(a);break}this.data=a,this.type=o,this.stride=QU(o),this.numChildren=(i=(r=o.children)?.length)??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return IK(this.data)}get nullCount(){return LK(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${X[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(uK(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return eq.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(lK(this,t,n,({data:e,_offsets:t},n,r)=>zK(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case X.Int:case X.Float:case X.Decimal:case X.Time:case X.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return vU.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(vU.isDictionary(this.type)){let t=new aq(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new aq(this)}unmemoize(){if(vU.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};tq=Symbol.toStringTag,iq[tq]=(e=>{e.type=vU.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(X).map(e=>X[e]).filter(e=>typeof e==`number`&&e!==X.NONE);for(let n of t){let t=$G.getVisitFnByTypeId(n),r=tG.getVisitFnByTypeId(n),i=XK.getVisitFnByTypeId(n);nq[n]={get:t,set:r,indexOf:i},rq[n]=Object.create(e,{isValid:{value:HK(VK)},get:{value:HK($G.getVisitFnByTypeId(n))},set:{value:UK(tG.getVisitFnByTypeId(n))},indexOf:{value:WK(XK.getVisitFnByTypeId(n))}})}return`Vector`})(iq.prototype);var aq=class e extends iq{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,`get`,{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,`set`,{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,`slice`,{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,`isMemoized`,{value:!0}),Object.defineProperty(this,`unmemoize`,{value:()=>new iq(this.data)}),Object.defineProperty(this,`memoize`,{value:()=>this})}},oq={};xt(oq,{BaseInt64:()=>dq,Int128:()=>mq,Int64:()=>pq,Uint64:()=>fq});const sq=65536;function cq(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const lq=8,uq=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];var dq=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]>>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]>>0&&++t[1],t[1]>>0&&++t[2],t[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`${cq(this.buffer[3])} ${cq(this.buffer[2])} ${cq(this.buffer[1])} ${cq(this.buffer[0])}`}static multiply(t,n){let r=new e(new Uint32Array(t.buffer));return r.times(n)}static add(t,n){let r=new e(new Uint32Array(t.buffer));return r.plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=r?1:0;ngq,toIntervalDayTimeObjects:()=>vq,toIntervalMonthDayNanoInt32Array:()=>_q,toIntervalMonthDayNanoObjects:()=>yq});function gq(e){var t,n;let r=e.length,i=new Int32Array(r*2);for(let a=0,o=0;a>BigInt(32))):o+=2}return i}function vq(e){let t=e.length,n=Array(t/2);for(let r=0,i=0;r>>0);r[a++]={months:e[i],days:e[i+1],nanoseconds:t?`${n}`:n}}return r}var bq=class extends $U{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((e,n)=>this.compareFields(e,t[n]))}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 xq(e,t){return t instanceof e.constructor}function Sq(e,t){return e===t||xq(e,t)}function Cq(e,t){return e===t||xq(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function wq(e,t){return e===t||xq(e,t)&&e.precision===t.precision}function Tq(e,t){return e===t||xq(e,t)&&e.byteWidth===t.byteWidth}function Eq(e,t){return e===t||xq(e,t)&&e.unit===t.unit}function Dq(e,t){return e===t||xq(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Oq(e,t){return e===t||xq(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function kq(e,t){return e===t||xq(e,t)&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}function Aq(e,t){return e===t||xq(e,t)&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}function jq(e,t){return e===t||xq(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&Lq.compareManyFields(e.children,t.children)}function Mq(e,t){return e===t||xq(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Lq.visit(e.indices,t.indices)&&Lq.visit(e.dictionary,t.dictionary)}function Nq(e,t){return e===t||xq(e,t)&&e.unit===t.unit}function Pq(e,t){return e===t||xq(e,t)&&e.unit===t.unit}function Fq(e,t){return e===t||xq(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}function Iq(e,t){return e===t||xq(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}bq.prototype.visitNull=Sq,bq.prototype.visitBool=Sq,bq.prototype.visitInt=Cq,bq.prototype.visitInt8=Cq,bq.prototype.visitInt16=Cq,bq.prototype.visitInt32=Cq,bq.prototype.visitInt64=Cq,bq.prototype.visitUint8=Cq,bq.prototype.visitUint16=Cq,bq.prototype.visitUint32=Cq,bq.prototype.visitUint64=Cq,bq.prototype.visitFloat=wq,bq.prototype.visitFloat16=wq,bq.prototype.visitFloat32=wq,bq.prototype.visitFloat64=wq,bq.prototype.visitUtf8=Sq,bq.prototype.visitLargeUtf8=Sq,bq.prototype.visitBinary=Sq,bq.prototype.visitLargeBinary=Sq,bq.prototype.visitFixedSizeBinary=Tq,bq.prototype.visitDate=Eq,bq.prototype.visitDateDay=Eq,bq.prototype.visitDateMillisecond=Eq,bq.prototype.visitTimestamp=Dq,bq.prototype.visitTimestampSecond=Dq,bq.prototype.visitTimestampMillisecond=Dq,bq.prototype.visitTimestampMicrosecond=Dq,bq.prototype.visitTimestampNanosecond=Dq,bq.prototype.visitTime=Oq,bq.prototype.visitTimeSecond=Oq,bq.prototype.visitTimeMillisecond=Oq,bq.prototype.visitTimeMicrosecond=Oq,bq.prototype.visitTimeNanosecond=Oq,bq.prototype.visitDecimal=Sq,bq.prototype.visitList=kq,bq.prototype.visitStruct=Aq,bq.prototype.visitUnion=jq,bq.prototype.visitDenseUnion=jq,bq.prototype.visitSparseUnion=jq,bq.prototype.visitDictionary=Mq,bq.prototype.visitInterval=Nq,bq.prototype.visitIntervalDayTime=Nq,bq.prototype.visitIntervalYearMonth=Nq,bq.prototype.visitIntervalMonthDayNano=Nq,bq.prototype.visitDuration=Pq,bq.prototype.visitDurationSecond=Pq,bq.prototype.visitDurationMillisecond=Pq,bq.prototype.visitDurationMicrosecond=Pq,bq.prototype.visitDurationNanosecond=Pq,bq.prototype.visitFixedSizeList=Fq,bq.prototype.visitMap=Iq;const Lq=new bq;function Rq(e,t){return Lq.compareSchemas(e,t)}function zq(e,t){return Lq.compareFields(e,t)}function Bq(e,t){return Lq.visit(e,t)}const Vq=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},LH),oq),xK),rW),BV),sK),MH),hq),{compareSchemas:Rq,compareFields:zq,compareTypes:Bq}),Hq=365.2425,Uq=10**8*24*60*60*1e3,Wq=6048e5,Gq=864e5,Kq=3600,qq=Kq*24,Jq=qq*7,Yq=qq*Hq,Xq=Yq/12,Zq=Xq*3,Qq=Symbol.for(`constructDateFrom`);function $q(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Qq in e?e[Qq](t):e instanceof Date?new e.constructor(t):new Date(t)}function eJ(e,t){return $q(t||e,e)}let tJ={};function nJ(){return tJ}function rJ(e,t){var n,r;let i=nJ(),a=t?.weekStartsOn??(t==null||(n=t.locale)==null||(n=n.options)==null?void 0:n.weekStartsOn)??i.weekStartsOn??((r=i.locale)==null||(r=r.options)==null?void 0:r.weekStartsOn)??0,o=eJ(e,t?.in),s=o.getDay(),c=(s=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function oJ(e){let t=eJ(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function sJ(e,...t){let n=$q.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function cJ(e,t){let n=eJ(e,t?.in);return n.setHours(0,0,0,0),n}function lJ(e,t,n){let[r,i]=sJ(n?.in,e,t),a=cJ(r),o=cJ(i),s=+a-oJ(a),c=+o-oJ(o);return Math.round((s-c)/Gq)}function uJ(e,t){let n=aJ(e,t),r=$q(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),iJ(r)}function dJ(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function fJ(e){return!(!dJ(e)&&typeof e!=`number`||isNaN(+eJ(e)))}function pJ(e,t){let n=eJ(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const mJ={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},hJ=(e,t,n)=>{let r,i=mJ[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function gJ(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}const _J={full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},vJ={full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},yJ={full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},bJ={date:gJ({formats:_J,defaultWidth:`full`}),time:gJ({formats:vJ,defaultWidth:`full`}),dateTime:gJ({formats:yJ,defaultWidth:`full`})},xJ={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},SJ=(e,t,n,r)=>xJ[e];function CJ(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const wJ={narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},TJ={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},EJ={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},DJ={narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},OJ={narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},kJ={narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},AJ=(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},jJ={ordinalNumber:AJ,era:CJ({values:wJ,defaultWidth:`wide`}),quarter:CJ({values:TJ,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:CJ({values:EJ,defaultWidth:`wide`}),day:CJ({values:DJ,defaultWidth:`wide`}),dayPeriod:CJ({values:OJ,defaultWidth:`wide`,formattingValues:kJ,defaultFormattingWidth:`wide`})};function MJ(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?PJ(s,e=>e.test(o)):NJ(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function NJ(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function PJ(e,t){for(let n=0;n{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const IJ=/^(\d+)(th|st|nd|rd)?/i,LJ=/\d+/i,RJ={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},zJ={any:[/^b/i,/^(a|c)/i]},BJ={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},VJ={any:[/1/i,/2/i,/3/i,/4/i]},HJ={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},UJ={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},WJ={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},GJ={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},KJ={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},qJ={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},JJ={ordinalNumber:FJ({matchPattern:IJ,parsePattern:LJ,valueCallback:e=>parseInt(e,10)}),era:MJ({matchPatterns:RJ,defaultMatchWidth:`wide`,parsePatterns:zJ,defaultParseWidth:`any`}),quarter:MJ({matchPatterns:BJ,defaultMatchWidth:`wide`,parsePatterns:VJ,defaultParseWidth:`any`,valueCallback:e=>e+1}),month:MJ({matchPatterns:HJ,defaultMatchWidth:`wide`,parsePatterns:UJ,defaultParseWidth:`any`}),day:MJ({matchPatterns:WJ,defaultMatchWidth:`wide`,parsePatterns:GJ,defaultParseWidth:`any`}),dayPeriod:MJ({matchPatterns:KJ,defaultMatchWidth:`any`,parsePatterns:qJ,defaultParseWidth:`any`})},YJ={code:`en-US`,formatDistance:hJ,formatLong:bJ,formatRelative:SJ,localize:jJ,match:JJ,options:{weekStartsOn:0,firstWeekContainsDate:1}};function XJ(e,t){let n=eJ(e,t?.in),r=lJ(n,pJ(n)),i=r+1;return i}function ZJ(e,t){let n=eJ(e,t?.in),r=iJ(n)-+uJ(n);return Math.round(r/Wq)+1}function QJ(e,t){var n,r;let i=eJ(e,t?.in),a=i.getFullYear(),o=nJ(),s=t?.firstWeekContainsDate??(t==null||(n=t.locale)==null||(n=n.options)==null?void 0:n.firstWeekContainsDate)??o.firstWeekContainsDate??((r=o.locale)==null||(r=r.options)==null?void 0:r.firstWeekContainsDate)??1,c=$q(t?.in||e,0);c.setFullYear(a+1,0,s),c.setHours(0,0,0,0);let l=rJ(c,t),u=$q(t?.in||e,0);u.setFullYear(a,0,s),u.setHours(0,0,0,0);let d=rJ(u,t);return+i>=+l?a+1:+i>=+d?a:a-1}function $J(e,t){var n,r;let i=nJ(),a=t?.firstWeekContainsDate??(t==null||(n=t.locale)==null||(n=n.options)==null?void 0:n.firstWeekContainsDate)??i.firstWeekContainsDate??((r=i.locale)==null||(r=r.options)==null?void 0:r.firstWeekContainsDate)??1,o=QJ(e,t),s=$q(t?.in||e,0);s.setFullYear(o,0,a),s.setHours(0,0,0,0);let c=rJ(s,t);return c}function eY(e,t){let n=eJ(e,t?.in),r=rJ(n,t)-+$J(n,t);return Math.round(r/Wq)+1}function tY(e,t){let n=e<0?`-`:``,r=Math.abs(e).toString().padStart(t,`0`);return n+r}const nY={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return tY(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):tY(n+1,2)},d(e,t){return tY(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];case`aaaa`:default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return tY(e.getHours()%12||12,t.length)},H(e,t){return tY(e.getHours(),t.length)},m(e,t){return tY(e.getMinutes(),t.length)},s(e,t){return tY(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*10**(n-3));return tY(i,t.length)}},rY={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},iY={G:function(e,t,n){let r=e.getFullYear()>0?1:0;switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});case`GGGG`:default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return nY.y(e,t)},Y:function(e,t,n,r){let i=QJ(e,r),a=i>0?i:1-i;if(t===`YY`){let e=a%100;return tY(e,2)}return t===`Yo`?n.ordinalNumber(a,{unit:`year`}):tY(a,t.length)},R:function(e,t){let n=aJ(e);return tY(n,t.length)},u:function(e,t){let n=e.getFullYear();return tY(n,t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return tY(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});case`QQQQ`:default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return tY(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});case`qqqq`:default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return nY.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});case`MMMM`:default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return tY(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});case`LLLL`:default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=eY(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):tY(i,t.length)},I:function(e,t,n){let r=ZJ(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):tY(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):nY.d(e,t)},D:function(e,t,n){let r=XJ(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):tY(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});case`EEEE`:default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return tY(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});case`eeee`:default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return tY(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});case`cccc`:default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return tY(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});case`iiii`:default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours(),i=r/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`aaaa`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?rY.noon:r===0?rY.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`bbbb`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?rY.evening:r>=12?rY.afternoon:r>=4?rY.morning:rY.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`BBBB`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return nY.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):nY.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):tY(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):tY(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):nY.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):nY.s(e,t)},S:function(e,t){return nY.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return oY(r);case`XXXX`:case`XX`:return sY(r);case`XXXXX`:case`XXX`:default:return sY(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return oY(r);case`xxxx`:case`xx`:return sY(r);case`xxxxx`:case`xxx`:default:return sY(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+aY(r,`:`);case`OOOO`:default:return`GMT`+sY(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+aY(r,`:`);case`zzzz`:default:return`GMT`+sY(r,`:`)}},t:function(e,t,n){let r=Math.trunc(e/1e3);return tY(r,t.length)},T:function(e,t,n){return tY(+e,t.length)}};function aY(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+tY(a,2)}function oY(e,t){if(e%60==0){let t=e>0?`-`:`+`;return t+tY(Math.abs(e)/60,2)}return sY(e,t)}function sY(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=tY(Math.trunc(r/60),2),a=tY(r%60,2);return n+i+t+a}const cY=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});case`PPPP`:default:return t.date({width:`full`})}},lY=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});case`pppp`:default:return t.time({width:`full`})}},uY=(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return cY(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;case`PPPP`:default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,cY(r,t)).replace(`{{time}}`,lY(i,t))},dY={p:lY,P:uY},fY=/^D+$/,pY=/^Y+$/,mY=[`D`,`DD`,`YY`,`YYYY`];function hY(e){return fY.test(e)}function gY(e){return pY.test(e)}function _Y(e,t,n){let r=vY(e,t,n);if(console.warn(r),mY.includes(e))throw RangeError(r)}function vY(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const yY=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bY=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xY=/^'([^]*?)'?$/,SY=/''/g,CY=/[a-zA-Z]/;function wY(e,t,n){var r,i,a,o;let s=nJ(),c=n?.locale??s.locale??YJ,l=n?.firstWeekContainsDate??(n==null||(r=n.locale)==null||(r=r.options)==null?void 0:r.firstWeekContainsDate)??s.firstWeekContainsDate??((i=s.locale)==null||(i=i.options)==null?void 0:i.firstWeekContainsDate)??1,u=n?.weekStartsOn??(n==null||(a=n.locale)==null||(a=a.options)==null?void 0:a.weekStartsOn)??s.weekStartsOn??((o=s.locale)==null||(o=o.options)==null?void 0:o.weekStartsOn)??0,d=eJ(e,n?.in);if(!fJ(d))throw RangeError(`Invalid time value`);let f=t.match(bY).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=dY[t];return n(e,c.formatLong)}return e}).join(``).match(yY).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:TY(e)};if(iY[t])return{isToken:!0,value:e};if(t.match(CY))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});c.localize.preprocessor&&(f=c.localize.preprocessor(d,f));let p={firstWeekContainsDate:l,weekStartsOn:u,locale:c};return f.map(r=>{if(!r.isToken)return r.value;let i=r.value;(!n?.useAdditionalWeekYearTokens&&gY(i)||!n?.useAdditionalDayOfYearTokens&&hY(i))&&_Y(i,t,String(e));let a=iY[i[0]];return a(d,i,c.localize,p)}).join(``)}function TY(e){let t=e.match(xY);return t?t[1].replace(SY,`'`):e}function EY(e,t){return eJ(e*1e3,t?.in)}function DY(e,t){let n=OY(t)?new t(0):$q(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function OY(e){var t;return typeof e==`function`&&(t=e.prototype)?.constructor===e}function kY(e,t){if(t===void 0)return e.trimEnd();let n=e.length;switch(typeof t){case`string`:if(t.length!==1)throw Error(`The 'chars' parameter should be a single character string.`);for(;n>0&&e[n-1]===t;)n--;break;case`object`:for(;n>0&&t.includes(e[n-1]);)n--}return e.substring(0,n)}function AY(e){return e==null}function jY(e){return e!=null}async function MY(){if(typeof window<`u`&&window!==null)return`browser`;try{let e=await Et(()=>import(`./__vite-browser-external-Cbx_usA-.js`).then(wt(1)),__vite__mapDeps([0,1,2]));return e!==void 0&&e.versions!=null&&e.versions.node!=null?`node`:`unknown`}catch{return`unknown`}}function NY(e){return AY(e)?!1:vU.isInt(e.type)&&!zY(e)||PY(e)}function PY(e){return AY(e)?!1:vU.isInt(e.type)&&e.type.isSigned===!1}function FY(e){return AY(e)?!1:vU.isFloat(e.type)??!1}function IY(e){return AY(e)?!1:vU.isDecimal(e.type)}function LY(e){return AY(e)?!1:vU.isBool(e.type)}function RY(e){return AY(e)?!1:vU.isDuration(e.type)}function zY(e){return AY(e)?!1:vU.isInt(e.type)&&e.metadata.get(`ARROW:extension:name`)===`period`}function BY(e){return AY(e)?!1:vU.isTimestamp(e.type)}function VY(e){return AY(e)?!1:vU.isDate(e.type)}function HY(e){return AY(e)?!1:vU.isTime(e.type)}function UY(e){return AY(e)?!1:vU.isList(e.type)||vU.isFixedSizeList(e.type)}function WY(e){return AY(e)?!1:vU.isStruct(e.type)||vU.isMap(e.type)}function GY(e){return AY(e)?!1:vU.isStruct(e.type)&&e.metadata.get(`ARROW:extension:name`)===`interval`||vU.isInterval(e.type)}const KY=new Date(1970,0,1);function qY(e,t){let n;if(t===kH.MILLISECOND)n=1e3;else if(t===kH.MICROSECOND)n=1e3*1e3;else if(t===kH.NANOSECOND)n=1e3*1e3*1e3;else return Number(e);return typeof e==`bigint`&&!Number.isSafeInteger(Number(e))?Number(e/BigInt(n)):Number(e)/n}function JY(e,t){var n;let r=qY(e,(t==null||(n=t.type)==null?void 0:n.unit)??kH.SECOND);return EY(r)}function YY(e,t){let n=JY(e,t);return wY(n,n.getMilliseconds()===0?`HH:mm:ss`:`HH:mm:ss.SSS`)}function XY(e){let t=`yyyy-MM-dd`;return e instanceof Date||typeof e==`number`&&Number.isFinite(e)?wY(e,t):(console.warn(`Unsupported date value: ${e}`),String(e))}function ZY(e,t){var n;if(!(e instanceof Date||typeof e==`number`&&Number.isFinite(e)))return console.warn(`Unsupported datetime value: ${e}`),null;let r,i=t==null||(n=t.type)==null?void 0:n.timezone;return r=i?new SV(e,i):new SV(e),DY(r,Date)}function QY(e,t){var n;let r=(t==null||(n=t.type)==null?void 0:n.scale)||0,i=Vq.bigNumToString(new Vq.BN(e)).padStart(r,`0`);if(r===0)return i;let a=``;i.startsWith(`-`)&&(a=`-`,i=i.slice(1));let o=i.slice(0,-r)||`0`,s=kY(i.slice(-r),`0`)||``;return`${a}${o}${s?`.${s}`:``}`}const $Y=new Intl.NumberFormat(`en-US`,{style:`decimal`,maximumFractionDigits:4,minimumFractionDigits:4,useGrouping:!0});function eX(e){let t=e[0],n=e[1],r=[];return t!==0&&r.push(`${t} year${t>1?`s`:``}`),n!==0&&r.push(`${n} month${n>1?`s`:``}`),r.length?r.join(` `):`0 months`}function tX(e,t){if(vU.isInterval(t?.type))return eX(e);let n=t&&t.metadata.get(`ARROW:extension:name`);if(n&&n===`pandas.interval`){var r,i;let n=JSON.parse(t.metadata.get(`ARROW:extension:metadata`)),{closed:a}=n,o=e.toJSON(),s=a===`both`||a===`left`?`[`:`(`,c=a===`both`||a===`right`?`]`:`)`,l=rX(o.left,(r=t.type)==null||(r=r.children)==null?void 0:r[0]),u=rX(o.right,(i=t.type)==null||(i=i.children)==null?void 0:i[1]);return`${s+l}, ${u+c}`}return String(e)}function nX(e,t){return t?.type instanceof GU?JSON.parse(JSON.stringify(e,(e,t)=>{if(jY(t))return typeof t==`bigint`?Number(t):t})):JSON.parse(JSON.stringify(e,(e,t)=>typeof t==`bigint`?Number(t):t))}function rX(e,t){if(AY(e))return null;let n=e instanceof Date||Number.isFinite(e);if(n&&VY(t))return XY(e);if(typeof e==`bigint`&&HY(t))return YY(Number(e),t);if(n&&BY(t))return ZY(e,t);if(zY(t))throw Error(`Period type is not supported yet`);if(GY(t))return tX(e,t);if(RY(t))throw Error(`Duration type is not supported yet`);return IY(t)?QY(e,t):FY(t)&&Number.isFinite(e)||NY(t)?e:WY(t)||UY(t)?nX(e,t):LY(t)?!!e:String(e)}function iX(e){let t=(e.toArray()||[]).map(e=>e.toJSON())||[],n=t.map(t=>(e.schema.fields.forEach(e=>t[e.name]=rX(t[e.name],e)),t));return n}let aX=function(e){return e.ORIGIN_PRIVATE_FS=`origin-private-fs`,e.NODE_FS=`node-fs`,e}({});async function oX(e){let t=Nt(e,{logger:!1}),n,r,i=await MY();if(i===`browser`){if(t.bundles===void 0){let{getBundles:e}=await Et(async()=>{let{getBundles:e}=await import(`./default-browser-DTRWbcB3.js`);return{getBundles:e}},[]);t.bundles=await e()}r=await mV(await t.bundles),n=new Worker(r.mainWorker)}else if(i===`node`){if(t.bundles===void 0){let{getBundles:e}=await Et(async()=>{let{getBundles:e}=await import(`./default-node-BTCCoimW.js`);return{getBundles:e}},__vite__mapDeps([3,1,2]));t.bundles=await e()}r=await mV(await t.bundles);let e=r.mainWorker;e.startsWith(`/@fs/`)&&(e=e.replace(`/@fs/`,`file://`));let i=await Et(()=>import(`./browser-CMSJHaBF.js`),[]);n=new i.default(e,{type:`module`})}else throw Error(`Unsupported environment: ${i}`);let a;a=t.logger===!0?new MB:t.logger===!1?new jB:t.logger;let o=new UB(a,n);if(await o.instantiate(r.mainModule,r.pthreadWorker),t.storage)switch(t.storage.type){case aX.ORIGIN_PRIVATE_FS:try{let e=t.storage.path;e.startsWith(`/`)&&(e=e.slice(1)),await o.open({path:`opfs://${e}`,accessMode:t.storage.accessMode})}catch(e){throw await o.terminate(),await n.terminate(),e}break;case aX.NODE_FS:try{await o.open({path:t.storage.path,accessMode:t.storage.accessMode,useDirectIO:!0})}catch(e){throw await o.terminate(),await n.terminate(),e}break}let s=await o.connect();async function c(e,t=[]){if(!t||t.length===0){let t=await s.query(e);return{_results:t,_schema:t.schema,columns:t.schema.fields,rows:iX(t)}}let n=await s.prepare(e),r=await n.query(...t);return n.close(),{_results:r,_schema:r.schema,columns:r.schema.fields,rows:iX(r)}}return{worker:n,db:o,conn:s,query:async(e,t=[])=>c(e,t).then(e=>e.rows),queryWithColumns:async(e,t=[])=>c(e,t),close:async()=>{await s.close(),await o.terminate(),await n.terminate()}}}async function sX(e,t){await(await e).conn.send(`BEGIN TRANSACTION`);try{let n=await t(e);return await(await e).conn.send(`COMMIT`),n}catch(t){throw await(await e).conn.send(`ROLLBACK`),t}}async function cX(e,t,n){await(await e).conn.send(`SAVEPOINT ${t}`);try{let r=await n(e);return await(await e).conn.send(`RELEASE SAVEPOINT ${t}`),r}catch(n){throw await(await e).conn.send(`ROLLBACK TO SAVEPOINT ${t}`),n}}const Z=Symbol.for(`drizzle:entityKind`),lX=Symbol.for(`drizzle:hasOwnEntityKind`);function Q(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,Z))throw Error(`Class "${t.name??``}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(Z in n&&n[Z]===t[Z])return!0;n=Object.getPrototypeOf(n)}return!1}var uX=(pr=class{constructor(t,n){e.defineProperty(this,`name`,void 0),e.defineProperty(this,`keyAsName`,void 0),e.defineProperty(this,`primary`,void 0),e.defineProperty(this,`notNull`,void 0),e.defineProperty(this,`default`,void 0),e.defineProperty(this,`defaultFn`,void 0),e.defineProperty(this,`onUpdateFn`,void 0),e.defineProperty(this,`hasDefault`,void 0),e.defineProperty(this,`isUnique`,void 0),e.defineProperty(this,`uniqueName`,void 0),e.defineProperty(this,`uniqueType`,void 0),e.defineProperty(this,`dataType`,void 0),e.defineProperty(this,`columnType`,void 0),e.defineProperty(this,`enumValues`,void 0),e.defineProperty(this,`generated`,void 0),e.defineProperty(this,`generatedIdentity`,void 0),e.defineProperty(this,`config`,void 0),this.table=t,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},e.defineProperty(pr,Z,`Column`),pr),dX=(mr=class{constructor(t,n,r){e.defineProperty(this,`config`,void 0),e.defineProperty(this,`$default`,this.$defaultFn),e.defineProperty(this,`$onUpdate`,this.$onUpdateFn),this.config={name:t,keyAsName:t===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:n,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},e.defineProperty(mr,Z,`ColumnBuilder`),mr);const fX=Symbol.for(`drizzle:Name`);var pX=(hr=class{constructor(t,n){e.defineProperty(this,`reference`,void 0),e.defineProperty(this,`_onUpdate`,`no action`),e.defineProperty(this,`_onDelete`,`no action`),this.reference=()=>{let{name:e,columns:n,foreignColumns:r}=t();return{name:e,columns:n,foreignTable:r[0].table,foreignColumns:r}},n&&(this._onUpdate=n.onUpdate,this._onDelete=n.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?`no action`:e,this}onDelete(e){return this._onDelete=e===void 0?`no action`:e,this}build(e){return new mX(e,this)}},e.defineProperty(hr,Z,`PgForeignKeyBuilder`),hr),mX=(gr=class{constructor(t,n){e.defineProperty(this,`reference`,void 0),e.defineProperty(this,`onUpdate`,void 0),e.defineProperty(this,`onDelete`,void 0),this.table=t,this.reference=n.reference,this.onUpdate=n._onUpdate,this.onDelete=n._onDelete}getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[fX],...r,n[0].table[fX],...i];return e??`${a.join(`_`)}_fk`}},e.defineProperty(gr,Z,`PgForeignKey`),gr);function hX(e,...t){return e(...t)}function gX(e,t){return`${e[fX]}_${t.join(`_`)}_unique`}var _X=(_r=class{constructor(t,n){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`nullsNotDistinctConfig`,!1),this.name=n,this.columns=t}nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new yX(e,this.columns,this.nullsNotDistinctConfig,this.name)}},e.defineProperty(_r,Z,`PgUniqueConstraintBuilder`),_r),vX=(vr=class{constructor(t){e.defineProperty(this,`name`,void 0),this.name=t}on(...e){return new _X(e,this.name)}},e.defineProperty(vr,Z,`PgUniqueOnConstraintBuilder`),vr),yX=(yr=class{constructor(t,n,r,i){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`name`,void 0),e.defineProperty(this,`nullsNotDistinct`,!1),this.table=t,this.columns=n,this.name=i??gX(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=r}getName(){return this.name}},e.defineProperty(yr,Z,`PgUniqueConstraint`),yr);function bX(e,t,n){for(let r=t;rArray.isArray(e)?CX(e):typeof e==`string`?`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:`${e}`).join(`,`)}}`}var wX=(br=class extends dX{constructor(...t){super(...t),e.defineProperty(this,`foreignKeyConfigs`,[])}array(e){return new OX(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:`always`,mode:`stored`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>hX((n,r)=>{let i=new pX(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)},n,r))}buildExtraConfigColumn(e){return new EX(e,this.config)}},e.defineProperty(br,Z,`PgColumnBuilder`),br),TX=(xr=class extends uX{constructor(e,t){t.uniqueName||=gX(e,[t.name]),super(e,t),this.table=e}},e.defineProperty(xr,Z,`PgColumn`),xr),EX=(Sr=class extends TX{constructor(...t){super(...t),e.defineProperty(this,`indexConfig`,{order:this.config.order??`asc`,nulls:this.config.nulls??`last`,opClass:this.config.opClass}),e.defineProperty(this,`defaultConfig`,{order:`asc`,nulls:`last`,opClass:void 0})}getSQLType(){return this.getSQLType()}asc(){return this.indexConfig.order=`asc`,this}desc(){return this.indexConfig.order=`desc`,this}nullsFirst(){return this.indexConfig.nulls=`first`,this}nullsLast(){return this.indexConfig.nulls=`last`,this}op(e){return this.indexConfig.opClass=e,this}},e.defineProperty(Sr,Z,`ExtraConfigColumn`),Sr),DX=(Cr=class{constructor(t,n,r,i){e.defineProperty(this,`name`,void 0),e.defineProperty(this,`keyAsName`,void 0),e.defineProperty(this,`type`,void 0),e.defineProperty(this,`indexConfig`,void 0),this.name=t,this.keyAsName=n,this.type=r,this.indexConfig=i}},e.defineProperty(Cr,Z,`IndexedColumn`),Cr),OX=(wr=class extends wX{constructor(e,t,n){super(e,`array`,`PgArray`),this.config.baseBuilder=t,this.config.size=n}build(e){let t=this.config.baseBuilder.build(e);return new kX(e,this.config,t)}},e.defineProperty(wr,Z,`PgArrayBuilder`),wr),kX=(Tr=class t extends TX{constructor(t,n,r,i){super(t,n),e.defineProperty(this,`size`,void 0),this.baseColumn=r,this.range=i,this.size=n.size}getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==`number`?this.size:``}]`}mapFromDriverValue(e){return typeof e==`string`&&(e=SX(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,n=!1){let r=e.map(e=>e===null?null:Q(this.baseColumn,t)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return n?r:CX(r)}},e.defineProperty(Tr,Z,`PgArray`),Tr),AX=(Er=class extends wX{constructor(e,t){super(e,`string`,`PgEnumObjectColumn`),this.config.enum=t}build(e){return new jX(e,this.config)}},e.defineProperty(Er,Z,`PgEnumObjectColumnBuilder`),Er),jX=(Dr=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`enum`,void 0),e.defineProperty(this,`enumValues`,this.config.enum.enumValues),this.enum=n.enum}getSQLType(){return this.enum.enumName}},e.defineProperty(Dr,Z,`PgEnumObjectColumn`),Dr);const MX=Symbol.for(`drizzle:isPgEnum`);function NX(e){return!!e&&typeof e==`function`&&MX in e&&e[MX]===!0}var PX=(Or=class extends wX{constructor(e,t){super(e,`string`,`PgEnumColumn`),this.config.enum=t}build(e){return new FX(e,this.config)}},e.defineProperty(Or,Z,`PgEnumColumnBuilder`),Or),FX=(kr=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`enum`,this.config.enum),e.defineProperty(this,`enumValues`,this.config.enum.enumValues),this.enum=n.enum}getSQLType(){return this.enum.enumName}},e.defineProperty(kr,Z,`PgEnumColumn`),kr),IX=(Ar=class{constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},e.defineProperty(Ar,Z,`Subquery`),Ar),LX=(jr=class extends IX{},e.defineProperty(jr,Z,`WithSubquery`),jr),RX=`0.44.2`;let zX,BX;const VX={startActiveSpan(e,t){return zX?(BX||=zX.trace.getTracer(`drizzle-orm`,RX),hX((n,r)=>r.startActiveSpan(e,e=>{try{return t(e)}catch(t){throw e.setStatus({code:n.SpanStatusCode.ERROR,message:t instanceof Error?t.message:`Unknown error`}),t}finally{e.end()}}),zX,BX)):t()}},HX=Symbol.for(`drizzle:ViewBaseConfig`),UX=Symbol.for(`drizzle:Schema`),WX=Symbol.for(`drizzle:Columns`),GX=Symbol.for(`drizzle:ExtraConfigColumns`),KX=Symbol.for(`drizzle:OriginalName`),qX=Symbol.for(`drizzle:BaseName`),JX=Symbol.for(`drizzle:IsAlias`),YX=Symbol.for(`drizzle:ExtraConfigBuilder`),XX=Symbol.for(`drizzle:IsDrizzleTable`);var ZX=(Mr=class{constructor(t,n,r){e.defineProperty(this,fX,void 0),e.defineProperty(this,KX,void 0),e.defineProperty(this,UX,void 0),e.defineProperty(this,WX,void 0),e.defineProperty(this,GX,void 0),e.defineProperty(this,qX,void 0),e.defineProperty(this,JX,!1),e.defineProperty(this,XX,!0),e.defineProperty(this,YX,void 0),this[fX]=this[KX]=t,this[UX]=n,this[qX]=r}},e.defineProperty(Mr,Z,`Table`),e.defineProperty(Mr,`Symbol`,{Name:fX,Schema:UX,OriginalName:KX,Columns:WX,ExtraConfigColumns:GX,BaseName:qX,IsAlias:JX,ExtraConfigBuilder:YX}),Mr);function QX(e){return e[fX]}function $X(e){return`${e[UX]??`public`}.${e[fX]}`}var eZ=(Nr=class{},e.defineProperty(Nr,Z,`FakePrimitiveParam`),Nr);function tZ(e){return e!=null&&typeof e.getSQL==`function`}function nZ(e){let t={sql:``,params:[]};for(let r of e){var n;t.sql+=r.sql,t.params.push(...r.params),(n=r.typings)?.length&&(t.typings||=[],t.typings.push(...r.typings))}return t}var rZ=(Pr=class{constructor(t){e.defineProperty(this,`value`,void 0),this.value=Array.isArray(t)?t:[t]}getSQL(){return new iZ([this])}},e.defineProperty(Pr,Z,`StringChunk`),Pr),iZ=(Fr=class t{constructor(t){e.defineProperty(this,`decoder`,sZ),e.defineProperty(this,`shouldInlineParams`,!1),e.defineProperty(this,`usedTables`,[]),this.queryChunks=t;for(let e of t)if(Q(e,ZX)){let t=e[ZX.Symbol.Schema];this.usedTables.push(t===void 0?e[ZX.Symbol.Name]:t+`.`+e[ZX.Symbol.Name])}}append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return VX.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:l}=r;return nZ(e.map(e=>{if(Q(e,rZ))return{sql:e.value.join(``),params:[]};if(Q(e,aZ))return{sql:a(e.value),params:[]};if(e===void 0)return{sql:``,params:[]};if(Array.isArray(e)){let t=[new rZ(`(`)];for(let[n,r]of e.entries())t.push(r),ne},cZ={mapToDriverValue:e=>e},lZ={...sZ,...cZ};var uZ=(Lr=class{constructor(t,n=cZ){e.defineProperty(this,`brand`,void 0),this.value=t,this.encoder=n}getSQL(){return new iZ([this])}},e.defineProperty(Lr,Z,`Param`),Lr);function $(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new rZ(e[0]));for(let[r,i]of t.entries())n.push(i,new rZ(e[r+1]));return new iZ(n)}(e=>{function t(){return new iZ([])}e.empty=t;function n(e){return new iZ(e)}e.fromList=n;function r(e){return new iZ([new rZ(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new iZ(n)}e.join=i;function a(e){return new aZ(e)}e.identifier=a;function o(e){return new dZ(e)}e.placeholder=o;function s(e,t){return new uZ(e,t)}e.param=s})($||={}),(t=>{class n{constructor(t,n){e.defineProperty(this,`isSelectionField`,!1),this.sql=t,this.fieldAlias=n}getSQL(){return this.sql}clone(){return new n(this.sql,this.fieldAlias)}}e.defineProperty(n,Z,`SQL.Aliased`),t.Aliased=n})(iZ||={});var dZ=(Rr=class{constructor(e){this.name=e}getSQL(){return new iZ([this])}},e.defineProperty(Rr,Z,`Placeholder`),Rr);function fZ(e,t){return e.map(e=>{if(Q(e,dZ)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(Q(e,uZ)&&Q(e.value,dZ)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}const pZ=Symbol.for(`drizzle:IsDrizzleView`);var mZ=(zr=class{constructor({name:t,schema:n,selectedFields:r,query:i}){e.defineProperty(this,HX,void 0),e.defineProperty(this,pZ,!0),this[HX]={name:t,originalName:t,schema:n,selectedFields:r,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new iZ([this])}},e.defineProperty(zr,Z,`View`),zr);uX.prototype.getSQL=function(){return new iZ([this])},ZX.prototype.getSQL=function(){return new iZ([this])},IX.prototype.getSQL=function(){return new iZ([this])};var hZ=(Br=class{constructor(e){this.table=e}get(e,t){return t===`table`?this.table:e[t]}},e.defineProperty(Br,Z,`ColumnAliasProxyHandler`),Br),gZ=(Vr=class{constructor(e,t){this.alias=e,this.replaceOriginalName=t}get(e,t){if(t===ZX.Symbol.IsAlias)return!0;if(t===ZX.Symbol.Name||this.replaceOriginalName&&t===ZX.Symbol.OriginalName)return this.alias;if(t===HX)return{...e[HX],name:this.alias,isAlias:!0};if(t===ZX.Symbol.Columns){let t=e[ZX.Symbol.Columns];if(!t)return t;let n={};return Object.keys(t).map(r=>{n[r]=new Proxy(t[r],new hZ(new Proxy(e,this)))}),n}let n=e[t];return Q(n,uX)?new Proxy(n,new hZ(new Proxy(e,this))):n}},e.defineProperty(Vr,Z,`TableAliasProxyHandler`),Vr),_Z=(Hr=class{constructor(e){this.alias=e}get(e,t){return t===`sourceTable`?vZ(e.sourceTable,this.alias):e[t]}},e.defineProperty(Hr,Z,`RelationTableAliasProxyHandler`),Hr);function vZ(e,t){return new Proxy(e,new gZ(t,!1))}function yZ(e,t){return new Proxy(e,new hZ(new Proxy(e.table,new gZ(t,!1))))}function bZ(e,t){return new iZ.Aliased(xZ(e.sql,t),e.fieldAlias)}function xZ(e,t){return $.join(e.queryChunks.map(e=>Q(e,uX)?yZ(e,t):Q(e,iZ)?xZ(e,t):Q(e,iZ.Aliased)?bZ(e,t):e))}var SZ=(Ur=class extends Error{constructor({message:e,cause:t}){super(e),this.name=`DrizzleError`,this.cause=t}},e.defineProperty(Ur,Z,`DrizzleError`),Ur),CZ=(Wr=class extends SZ{constructor(){super({message:`Rollback`})}},e.defineProperty(Wr,Z,`TransactionRollbackError`),Wr),wZ=(Gr=class{write(e){console.log(e)}},e.defineProperty(Gr,Z,`ConsoleLogWriter`),Gr),TZ=(Kr=class{constructor(t){e.defineProperty(this,`writer`,void 0),this.writer=t?.writer??new wZ}logQuery(e,t){let n=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),r=n.length?` -- params: [${n.join(`, `)}]`:``;this.writer.write(`Query: ${e}${r}`)}},e.defineProperty(Kr,Z,`DefaultLogger`),Kr),EZ=(qr=class{logQuery(){}},e.defineProperty(qr,Z,`NoopLogger`),qr),DZ=(ea=Symbol.toStringTag,Jr=class{constructor(){e.defineProperty(this,ea,`QueryPromise`)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}},e.defineProperty(Jr,Z,`QueryPromise`),Jr);function OZ(e,t){return Object.entries(e).reduce((e,[n,r])=>{if(typeof n!=`string`)return e;let i=t?[...t,n]:[n];return Q(r,uX)||Q(r,iZ)||Q(r,iZ.Aliased)?e.push({path:i,field:r}):Q(r,ZX)?e.push(...OZ(r[ZX.Symbol.Columns],i)):e.push(...OZ(r,i)),e},[])}function kZ(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let[e,t]of n.entries())if(t!==r[e])return!1;return!0}function AZ(e,t){let n=Object.entries(t).filter(([,e])=>e!==void 0).map(([t,n])=>Q(n,iZ)||Q(n,uX)?[t,n]:[t,new uZ(n,e[ZX.Symbol.Columns][t])]);if(n.length===0)throw Error(`No values to set`);return Object.fromEntries(n)}function jZ(e,t){for(let n of t)for(let t of Object.getOwnPropertyNames(n.prototype)){if(t===`constructor`)continue;Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(n.prototype,t)||Object.create(null))}}function MZ(e){return e[ZX.Symbol.Columns]}function NZ(e){return Q(e,IX)?e._.alias:Q(e,mZ)?e[HX].name:Q(e,iZ)?void 0:e[ZX.Symbol.IsAlias]?e[ZX.Symbol.Name]:e[ZX.Symbol.BaseName]}function PZ(e){if(typeof e!=`object`||!e||e.constructor.name!==`Object`)return!1;if(`logger`in e){let t=typeof e.logger;return!(t!==`boolean`&&(t!==`object`||typeof e.logger.logQuery!=`function`)&&t!==`undefined`)}if(`schema`in e){let t=typeof e.schema;return!(t!==`object`&&t!==`undefined`)}if(`casing`in e){let t=typeof e.casing;return!(t!==`string`&&t!==`undefined`)}if(`mode`in e)return!(e.mode!==`default`||e.mode!==`planetscale`||e.mode!==void 0);if(`connection`in e){let t=typeof e.connection;return!(t!==`string`&&t!==`object`&&t!==`undefined`)}if(`client`in e){let t=typeof e.client;return!(t!==`object`&&t!==`function`&&t!==`undefined`)}return Object.keys(e).length===0}var FZ=(Yr=class extends wX{defaultNow(){return this.default($`now()`)}},e.defineProperty(Yr,Z,`PgDateColumnBaseBuilder`),Yr),IZ=(Xr=class extends FZ{constructor(e){super(e,`date`,`PgDate`)}build(e){return new LZ(e,this.config)}},e.defineProperty(Xr,Z,`PgDateBuilder`),Xr),LZ=(Zr=class extends TX{getSQLType(){return`date`}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}},e.defineProperty(Zr,Z,`PgDate`),Zr),RZ=(Qr=class extends FZ{constructor(e){super(e,`string`,`PgDateString`)}build(e){return new zZ(e,this.config)}},e.defineProperty(Qr,Z,`PgDateStringBuilder`),Qr),zZ=($r=class extends TX{getSQLType(){return`date`}},e.defineProperty($r,Z,`PgDateString`),$r),BZ=(ei=class extends wX{constructor(e){super(e,`json`,`PgJson`)}build(e){return new VZ(e,this.config)}},e.defineProperty(ei,Z,`PgJsonBuilder`),ei),VZ=(ti=class extends TX{constructor(e,t){super(e,t)}getSQLType(){return`json`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}},e.defineProperty(ti,Z,`PgJson`),ti),HZ=(ni=class extends wX{constructor(e){super(e,`json`,`PgJsonb`)}build(e){return new UZ(e,this.config)}},e.defineProperty(ni,Z,`PgJsonbBuilder`),ni),UZ=(ri=class extends TX{constructor(e,t){super(e,t)}getSQLType(){return`jsonb`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}},e.defineProperty(ri,Z,`PgJsonb`),ri),WZ=(ii=class extends wX{constructor(e,t,n){super(e,`string`,`PgNumeric`),this.config.precision=t,this.config.scale=n}build(e){return new GZ(e,this.config)}},e.defineProperty(ii,Z,`PgNumericBuilder`),ii),GZ=(ai=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`scale`,void 0),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},e.defineProperty(ai,Z,`PgNumeric`),ai),KZ=(oi=class extends wX{constructor(e,t,n){super(e,`number`,`PgNumericNumber`),this.config.precision=t,this.config.scale=n}build(e){return new qZ(e,this.config)}},e.defineProperty(oi,Z,`PgNumericNumberBuilder`),oi),qZ=(si=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`scale`,void 0),e.defineProperty(this,`mapToDriverValue`,String),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},e.defineProperty(si,Z,`PgNumericNumber`),si),JZ=(ci=class extends wX{constructor(e,t,n){super(e,`bigint`,`PgNumericBigInt`),this.config.precision=t,this.config.scale=n}build(e){return new YZ(e,this.config)}},e.defineProperty(ci,Z,`PgNumericBigIntBuilder`),ci),YZ=(li=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`scale`,void 0),e.defineProperty(this,`mapFromDriverValue`,BigInt),e.defineProperty(this,`mapToDriverValue`,String),this.precision=n.precision,this.scale=n.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},e.defineProperty(li,Z,`PgNumericBigInt`),li),XZ=(ui=class extends FZ{constructor(e,t,n){super(e,`string`,`PgTime`),this.withTimezone=t,this.precision=n,this.config.withTimezone=t,this.config.precision=n}build(e){return new ZZ(e,this.config)}},e.defineProperty(ui,Z,`PgTimeBuilder`),ui),ZZ=(di=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`withTimezone`,void 0),e.defineProperty(this,`precision`,void 0),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){let e=this.precision===void 0?``:`(${this.precision})`;return`time${e}${this.withTimezone?` with time zone`:``}`}},e.defineProperty(di,Z,`PgTime`),di),QZ=(fi=class extends FZ{constructor(e,t,n){super(e,`date`,`PgTimestamp`),this.config.withTimezone=t,this.config.precision=n}build(e){return new $Z(e,this.config)}},e.defineProperty(fi,Z,`PgTimestampBuilder`),fi),$Z=(pi=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`withTimezone`,void 0),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`mapFromDriverValue`,e=>new Date(this.withTimezone?e:e+`+0000`)),e.defineProperty(this,`mapToDriverValue`,e=>e.toISOString()),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){let e=this.precision===void 0?``:` (${this.precision})`;return`timestamp${e}${this.withTimezone?` with time zone`:``}`}},e.defineProperty(pi,Z,`PgTimestamp`),pi),eQ=(mi=class extends FZ{constructor(e,t,n){super(e,`string`,`PgTimestampString`),this.config.withTimezone=t,this.config.precision=n}build(e){return new tQ(e,this.config)}},e.defineProperty(mi,Z,`PgTimestampStringBuilder`),mi),tQ=(hi=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`withTimezone`,void 0),e.defineProperty(this,`precision`,void 0),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){let e=this.precision===void 0?``:`(${this.precision})`;return`timestamp${e}${this.withTimezone?` with time zone`:``}`}},e.defineProperty(hi,Z,`PgTimestampString`),hi),nQ=(gi=class extends wX{constructor(e){super(e,`string`,`PgUUID`)}defaultRandom(){return this.default($`gen_random_uuid()`)}build(e){return new rQ(e,this.config)}},e.defineProperty(gi,Z,`PgUUIDBuilder`),gi),rQ=(_i=class extends TX{getSQLType(){return`uuid`}},e.defineProperty(_i,Z,`PgUUID`),_i);const iQ=Symbol.for(`drizzle:PgInlineForeignKeys`),aQ=Symbol.for(`drizzle:EnableRLS`);var oQ=(ta=ZX.Symbol.ExtraConfigBuilder,na=ZX.Symbol.ExtraConfigColumns,vi=class extends ZX{constructor(...t){super(...t),e.defineProperty(this,iQ,[]),e.defineProperty(this,aQ,!1),e.defineProperty(this,ta,void 0),e.defineProperty(this,na,{})}},e.defineProperty(vi,Z,`PgTable`),e.defineProperty(vi,`Symbol`,Object.assign({},ZX.Symbol,{InlineForeignKeys:iQ,EnableRLS:aQ})),vi),sQ=(yi=class{constructor(t,n){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`name`,void 0),this.columns=t,this.name=n}build(e){return new cQ(e,this.columns,this.name)}},e.defineProperty(yi,Z,`PgPrimaryKeyBuilder`),yi),cQ=(bi=class{constructor(t,n,r){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`name`,void 0),this.table=t,this.columns=n,this.name=r}getName(){return this.name??`${this.table[oQ.Symbol.Name]}_${this.columns.map(e=>e.name).join(`_`)}_pk`}},e.defineProperty(bi,Z,`PgPrimaryKey`),bi);function lQ(e,t){return oZ(t)&&!tZ(e)&&!Q(e,uZ)&&!Q(e,dZ)&&!Q(e,uX)&&!Q(e,ZX)&&!Q(e,mZ)?new uZ(e,t):e}const uQ=(e,t)=>$`${e} = ${lQ(t,e)}`,dQ=(e,t)=>$`${e} <> ${lQ(t,e)}`;function fQ(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new iZ(t):new iZ([new rZ(`(`),$.join(t,new rZ(` and `)),new rZ(`)`)])}function pQ(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new iZ(t):new iZ([new rZ(`(`),$.join(t,new rZ(` or `)),new rZ(`)`)])}function mQ(e){return $`not ${e}`}const hQ=(e,t)=>$`${e} > ${lQ(t,e)}`,gQ=(e,t)=>$`${e} >= ${lQ(t,e)}`,_Q=(e,t)=>$`${e} < ${lQ(t,e)}`,vQ=(e,t)=>$`${e} <= ${lQ(t,e)}`;function yQ(e,t){return Array.isArray(t)?t.length===0?$`false`:$`${e} in ${t.map(t=>lQ(t,e))}`:$`${e} in ${lQ(t,e)}`}function bQ(e,t){return Array.isArray(t)?t.length===0?$`true`:$`${e} not in ${t.map(t=>lQ(t,e))}`:$`${e} not in ${lQ(t,e)}`}function xQ(e){return $`${e} is null`}function SQ(e){return $`${e} is not null`}function CQ(e){return $`exists ${e}`}function wQ(e){return $`not exists ${e}`}function TQ(e,t,n){return $`${e} between ${lQ(t,e)} and ${lQ(n,e)}`}function EQ(e,t,n){return $`${e} not between ${lQ(t,e)} and ${lQ(n,e)}`}function DQ(e,t){return $`${e} like ${t}`}function OQ(e,t){return $`${e} not like ${t}`}function kQ(e,t){return $`${e} ilike ${t}`}function AQ(e,t){return $`${e} not ilike ${t}`}function jQ(e){return $`${e} asc`}function MQ(e){return $`${e} desc`}var NQ=(xi=class{constructor(t,n,r){e.defineProperty(this,`referencedTableName`,void 0),e.defineProperty(this,`fieldName`,void 0),this.sourceTable=t,this.referencedTable=n,this.relationName=r,this.referencedTableName=n[ZX.Symbol.Name]}},e.defineProperty(xi,Z,`Relation`),xi),PQ=(Si=class{constructor(e,t){this.table=e,this.config=t}},e.defineProperty(Si,Z,`Relations`),Si),FQ=(Ci=class e extends NQ{constructor(e,t,n,r){super(e,t,n?.relationName),this.config=n,this.isNullable=r}withFieldName(t){let n=new e(this.sourceTable,this.referencedTable,this.config,this.isNullable);return n.fieldName=t,n}},e.defineProperty(Ci,Z,`One`),Ci),IQ=(wi=class e extends NQ{constructor(e,t,n){super(e,t,n?.relationName),this.config=n}withFieldName(t){let n=new e(this.sourceTable,this.referencedTable,this.config);return n.fieldName=t,n}},e.defineProperty(wi,Z,`Many`),wi);function LQ(){return{and:fQ,between:TQ,eq:uQ,exists:CQ,gt:hQ,gte:gQ,ilike:kQ,inArray:yQ,isNull:xQ,isNotNull:SQ,like:DQ,lt:_Q,lte:vQ,ne:dQ,not:mQ,notBetween:EQ,notExists:wQ,notLike:OQ,notIlike:AQ,notInArray:bQ,or:pQ,sql:$}}function RQ(){return{sql:$,asc:jQ,desc:MQ}}function zQ(e,t){Object.keys(e).length===1&&`default`in e&&!Q(e.default,ZX)&&(e=e.default);let n={},r={},i={};for(let[o,s]of Object.entries(e))if(Q(s,ZX)){var a;let e=$X(s),t=r[e];n[e]=o,i[o]={tsName:o,dbName:s[ZX.Symbol.Name],schema:s[ZX.Symbol.Schema],columns:s[ZX.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]};for(let e of Object.values(s[ZX.Symbol.Columns]))e.primary&&i[o].primaryKey.push(e);let c=(a=s[ZX.Symbol.ExtraConfigBuilder])?.call(s,s[ZX.Symbol.ExtraConfigColumns]);if(c)for(let e of Object.values(c))Q(e,sQ)&&i[o].primaryKey.push(...e.columns)}else if(Q(s,PQ)){let e=$X(s.table),a=n[e],o=s.config(t(s.table)),c;for(let[t,n]of Object.entries(o))if(a){let e=i[a];e.relations[t]=n,c&&e.primaryKey.push(...c)}else e in r||(r[e]={relations:{},primaryKey:c}),r[e].relations[t]=n}return{tables:i,tableNamesMap:n}}function BQ(e){return function(t,n){return new FQ(e,t,n,n?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)}}function VQ(e){return function(t,n){return new IQ(e,t,n)}}function HQ(e,t,n){if(Q(n,FQ)&&n.config)return{fields:n.config.fields,references:n.config.references};let r=t[$X(n.referencedTable)];if(!r)throw Error(`Table "${n.referencedTable[ZX.Symbol.Name]}" not found in schema`);let i=e[r];if(!i)throw Error(`Table "${r}" not found in schema`);let a=n.sourceTable,o=t[$X(a)];if(!o)throw Error(`Table "${a[ZX.Symbol.Name]}" not found in schema`);let s=[];for(let e of Object.values(i.relations))(n.relationName&&n!==e&&e.relationName===n.relationName||!n.relationName&&e.referencedTable===n.sourceTable)&&s.push(e);if(s.length>1)throw n.relationName?Error(`There are multiple relations with name "${n.relationName}" in table "${r}"`):Error(`There are multiple relations between "${r}" and "${n.sourceTable[ZX.Symbol.Name]}". Please specify relation name`);if(s[0]&&Q(s[0],FQ)&&s[0].config)return{fields:s[0].config.references,references:s[0].config.fields};throw Error(`There is not enough information to infer relation "${o}.${n.fieldName}"`)}function UQ(e){return{one:BQ(e),many:VQ(e)}}function WQ(e,t,n,r,i=e=>e){let a={};for(let[o,s]of r.entries())if(s.isJson){let r=t.relations[s.tsKey],c=n[o],l=typeof c==`string`?JSON.parse(c):c;a[s.tsKey]=Q(r,FQ)?l&&WQ(e,e[s.relationTableTsKey],l,s.selection,i):l.map(t=>WQ(e,e[s.relationTableTsKey],t,s.selection,i))}else{let e=i(n[o]),t=s.field,r;r=Q(t,uX)?t:Q(t,iZ)?t.decoder:t.sql.decoder,a[s.tsKey]=e===null?null:r.mapFromDriverValue(e)}return a}var GQ=(Ti=class t{constructor(t){e.defineProperty(this,`config`,void 0),this.config={...t}}get(e,n){if(n===`_`)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(n===HX)return{...e[HX],selectedFields:new Proxy(e[HX].selectedFields,this)};if(typeof n==`symbol`)return e[n];let r=Q(e,IX)?e._.selectedFields:Q(e,mZ)?e[HX].selectedFields:e,i=r[n];if(Q(i,iZ.Aliased)){if(this.config.sqlAliasedBehavior===`sql`&&!i.isSelectionField)return i.sql;let e=i.clone();return e.isSelectionField=!0,e}if(Q(i,iZ)){if(this.config.sqlBehavior===`sql`)return i;throw Error(`You tried to reference "${n}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return Q(i,uX)?this.config.alias?new Proxy(i,new hZ(new Proxy(i.table,new gZ(this.config.alias,this.config.replaceOriginalName??!1)))):i:typeof i!=`object`||!i?i:new Proxy(i,new t(this.config))}},e.defineProperty(Ti,Z,`SelectionProxyHandler`),Ti);function KQ(e){let t=e.replace(/['\u2019]/g,``).match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[];return t.map(e=>e.toLowerCase()).join(`_`)}function qQ(e){let t=e.replace(/['\u2019]/g,``).match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[];return t.reduce((e,t,n)=>{let r=n===0?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`;return e+r},``)}function JQ(e){return e}var YQ=(Ei=class{constructor(t){e.defineProperty(this,`cache`,{}),e.defineProperty(this,`cachedTables`,{}),e.defineProperty(this,`convert`,void 0),this.convert=t===`snake_case`?KQ:t===`camelCase`?qQ:JQ}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[ZX.Symbol.Schema]??`public`,n=e.table[ZX.Symbol.OriginalName],r=`${t}.${n}.${e.name}`;return this.cache[r]||this.cacheTable(e.table),this.cache[r]}cacheTable(e){let t=e[ZX.Symbol.Schema]??`public`,n=e[ZX.Symbol.OriginalName],r=`${t}.${n}`;if(!this.cachedTables[r]){for(let t of Object.values(e[ZX.Symbol.Columns])){let e=`${r}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[r]=!0}}clearCache(){this.cache={},this.cachedTables={}}},e.defineProperty(Ei,Z,`CasingCache`),Ei),XQ=(Di=class extends mZ{},e.defineProperty(Di,Z,`PgViewBase`),Di),ZQ=(Oi=class{constructor(t){e.defineProperty(this,`casing`,void 0),this.casing=new YQ(t?.casing)}async migrate(e,t,n){let r=typeof n==`string`?`__drizzle_migrations`:n.migrationsTable??`__drizzle_migrations`,i=typeof n==`string`?`drizzle`:n.migrationsSchema??`drizzle`,a=$`
+ `)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new kR(n,e)))}slice(t,n){let r=this.schema;[t,n]=kI({length:this.numRows},t,n);let i=iL(this.data,this._offsets,t,n);return new e(r,i.map(e=>new kR(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&et.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=$I({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new CL(t)}return null}setChild(e,t){var n;return this.setChildAt((n=this.schema.fields)?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&tthis.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=CR(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(...CR(a,o))}};ER=Symbol.toStringTag,DR[ER]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=sL(oL),e.get=sL(bI.getVisitFn(Y.Struct)),e.set=cL(wF.getVisitFn(Y.Struct)),e.indexOf=lL(hL.getVisitFn(Y.Struct)),`Table`))(DR.prototype);var OR,kR=class e{constructor(...e){switch(e.length){case 2:if([this.schema]=e,!(this.schema instanceof DL)||([,this.data=$I({nullCount:0,type:new gP(this.schema.fields),children:this.schema.fields.map(e=>$I({type:e.type,nullCount:0}))})]=e,!(this.data instanceof XI)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=AR(this.schema,this.data.children);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=OL.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new DL(n),o=$I({type:new gP(n),length:i,children:r,nullCount:0});[this.schema,this.data]=AR(a,o.children,i);break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get dictionaries(){return this._dictionaries||=jR(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 bI.visit(this.data,e)}at(e){return this.get(AI(e,this.numRows))}set(e,t){return wF.visit(this.data,e,t)}indexOf(e,t){return hL.visit(this.data,e,t)}[Symbol.iterator](){return yL.visit(new CL([this.data]))}toArray(){return[...this]}concat(...e){return new DR(this.schema,[this,...e])}slice(t,n){let[r]=new CL([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(e){var t;return this.getChildAt((t=this.schema.fields)?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&et.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&tt.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,$I({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=$I({type:new gP(n.fields),length:this.numRows,children:r});return new e(n,i)}};OR=Symbol.toStringTag,kR[OR]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,`RecordBatch`))(kR.prototype);function AR(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){var r;let i=[...e.fields],a=[...t],o=(n+63&-64)>>3;for(let[s,c]of e.fields.entries()){let e=t[s];(!e||e.length!==n)&&(i[s]=c.clone({nullable:!0}),a[s]=(r=e?._changeLengthAndBackfillNullBitmap(n))??$I({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(o)}))}return[e.assign(i),$I({type:new gP(i),length:n,children:a})]}function jR(e,t,n=new Map){var r,i;if(((r=e?.length)??0)>0&&e?.length===t?.length)for(let r=-1,a=e.length;++r$I({type:e.type})),n=$I({type:new gP(e.fields),nullCount:0,children:t});super(e,n)}},NR=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+hM),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):oM.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):rN.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new PM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let 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,oM.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,rN.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 n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){let t=e.endObject();return t}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}},PR=class extends wP{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return JM.startNull(t),JM.endNull(t)}visitInt(e,t){return MM.startInt(t),MM.addBitWidth(t,e.bitWidth),MM.addIsSigned(t,e.isSigned),MM.endInt(t)}visitFloat(e,t){return HM.startFloatingPoint(t),HM.addPrecision(t,e.precision),HM.endFloatingPoint(t)}visitBinary(e,t){return FM.startBinary(t),FM.endBinary(t)}visitLargeBinary(e,t){return WM.startLargeBinary(t),WM.endLargeBinary(t)}visitBool(e,t){return IM.startBool(t),IM.endBool(t)}visitUtf8(e,t){return $M.startUtf8(t),$M.endUtf8(t)}visitLargeUtf8(e,t){return GM.startLargeUtf8(t),GM.endLargeUtf8(t)}visitDecimal(e,t){return RM.startDecimal(t),RM.addScale(t,e.scale),RM.addPrecision(t,e.precision),RM.addBitWidth(t,e.bitWidth),RM.endDecimal(t)}visitDate(e,t){return LM.startDate(t),LM.addUnit(t,e.unit),LM.endDate(t)}visitTime(e,t){return XM.startTime(t),XM.addUnit(t,e.unit),XM.addBitWidth(t,e.bitWidth),XM.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return ZM.startTimestamp(t),ZM.addUnit(t,e.unit),n!==void 0&&ZM.addTimezone(t,n),ZM.endTimestamp(t)}visitInterval(e,t){return UM.startInterval(t),UM.addUnit(t,e.unit),UM.endInterval(t)}visitDuration(e,t){return zM.startDuration(t),zM.addUnit(t,e.unit),zM.endDuration(t)}visitList(e,t){return KM.startList(t),KM.endList(t)}visitStruct(e,t){return YM.startStruct_(t),YM.endStruct_(t)}visitUnion(e,t){QM.startTypeIdsVector(t,e.typeIds.length);let n=QM.createTypeIdsVector(t,e.typeIds);return QM.startUnion(t),QM.addMode(t,e.mode),QM.addTypeIds(t,n),QM.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return NM.startDictionaryEncoding(t),NM.addId(t,BigInt(e.id)),NM.addIsOrdered(t,e.isOrdered),n!==void 0&&NM.addIndexType(t,n),NM.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return BM.startFixedSizeBinary(t),BM.addByteWidth(t,e.byteWidth),BM.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return VM.startFixedSizeList(t),VM.addListSize(t,e.listSize),VM.endFixedSizeList(t)}visitMap(e,t){return qM.startMap(t),qM.addKeysSorted(t,e.keysSorted),qM.endMap(t)}};const FR=new PR;function IR(e,t=new Map){return new DL(zR(e,t),GR(e.metadata),t)}function LR(e){return new ZR(e.count,VR(e.columns),HR(e.columns))}function RR(e){return new QR(LR(e.data),e.id,e.isDelta)}function zR(e,t){return(e.fields||[]).filter(Boolean).map(e=>OL.fromJSON(e,t))}function BR(e,t){return(e.children||[]).filter(Boolean).map(e=>OL.fromJSON(e,t))}function VR(e){return(e||[]).reduce((e,t)=>[...e,new ez(t.count,UR(t.VALIDITY)),...VR(t.children)],[])}function HR(e,t=[]){for(let n=-1,r=(e||[]).length;++ne+ +(t===0),0)}function WR(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=qR(e,BR(e,t)),i=new OL(e.name,o,e.nullable,GR(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?KR(r):new JN,s=new SP(t.get(n),r,n,a.isOrdered),i=new OL(e.name,s,e.nullable,GR(e.metadata))):(r=(r=a.indexType)?KR(r):new JN,t.set(n,o=qR(e,BR(e,t))),s=new SP(o,r,n,a.isOrdered),i=new OL(e.name,s,e.nullable,GR(e.metadata))),i||null}function GR(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function KR(e){return new GN(e.isSigned,e.bitWidth)}function qR(e,t){let n=e.type.name;switch(n){case`NONE`:return new WN;case`null`:return new WN;case`binary`:return new iP;case`largebinary`:return new aP;case`utf8`:return new oP;case`largeutf8`:return new sP;case`bool`:return new cP;case`list`:return new hP((t||[])[0]);case`struct`:return new gP(t||[]);case`struct_`:return new gP(t||[])}switch(n){case`int`:{let t=e.type;return new GN(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new eP(cM[t.precision])}case`decimal`:{let t=e.type;return new lP(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new uP(lM[t.unit])}case`time`:{let t=e.type;return new dP(uM[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new fP(uM[t.unit],t.timezone)}case`interval`:{let t=e.type;return new pP(dM[t.unit])}case`duration`:{let t=e.type;return new mP(uM[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new _P(sM[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new vP(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new yP(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new bP((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var JR=SM,YR=xM,XR=class e{static fromJSON(t,n){let r=new e(0,oM.V5,n);return r._createHeader=tz(t,n),r}static decode(t){t=new YR(Wj(t));let n=NR.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=new e(r,i,a);return o._createHeader=nz(n,a),o}static encode(e){let t=new JR,n=-1;return e.isSchema()?n=DL.encode(t,e.header()):e.isRecordBatch()?n=ZR.encode(t,e.header()):e.isDictionaryBatch()&&(n=QR.encode(t,e.header())),NR.startMessage(t),NR.addVersion(t,oM.V5),NR.addHeader(t,n),NR.addHeaderType(t,e.headerType),NR.addBodyLength(t,BigInt(e.bodyLength)),NR.finishMessageBuffer(t,NR.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof DL)return new e(0,oM.V5,rN.Schema,t);if(t instanceof ZR)return new e(n,oM.V5,rN.RecordBatch,t);if(t instanceof QR)return new e(n,oM.V5,rN.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===rN.Schema}isRecordBatch(){return this.headerType===rN.RecordBatch}isDictionaryBatch(){return this.headerType===rN.DictionaryBatch}constructor(e,t,n,r){this._version=t,this._headerType=n,this.body=new Uint8Array,r&&(this._createHeader=()=>r),this._bodyLength=sN(e)}},ZR=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,t,n){this._nodes=t,this._buffers=n,this._length=sN(e)}},QR=class{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,n=!1){this._data=e,this._isDelta=n,this._id=sN(t)}},$R=class{constructor(e,t){this.offset=sN(e),this.length=sN(t)}},ez=class{constructor(e,t){this.length=sN(e),this.nullCount=sN(t)}};function tz(e,t){return()=>{switch(t){case rN.Schema:return DL.fromJSON(e);case rN.RecordBatch:return ZR.fromJSON(e);case rN.DictionaryBatch:return QR.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${rN[t]}, type: ${t} }`)}}function nz(e,t){return()=>{switch(t){case rN.Schema:return DL.decode(e.header(new nN),new Map,e.version());case rN.RecordBatch:return ZR.decode(e.header(new OM),e.version());case rN.DictionaryBatch:return QR.decode(e.header(new kM),e.version())}throw Error(`Unrecognized Message type: { name: ${rN[t]}, type: ${t} }`)}}OL.encode=_z,OL.decode=fz,OL.fromJSON=WR,DL.encode=gz,DL.decode=rz,DL.fromJSON=IR,ZR.encode=vz,ZR.decode=iz,ZR.fromJSON=LR,QR.encode=yz,QR.decode=az,QR.fromJSON=RR,ez.encode=bz,ez.decode=sz,$R.encode=xz,$R.decode=oz;function rz(e,t=new Map,n=oM.V5){let r=uz(e,t);return new DL(r,pz(e),t,n)}function iz(e,t=oM.V5){if(e.compression()!==null)throw Error(`Record batch compression not implemented`);return new ZR(e.length(),cz(e),lz(e,t))}function az(e,t=oM.V5){return new QR(ZR.decode(e.data(),t),e.id(),e.isDelta())}function oz(e){return new $R(e.offset(),e.length())}function sz(e){return new ez(e.length(),e.nullCount())}function cz(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++rOL.encode(e,t));nN.startFieldsVector(e,n.length);let r=nN.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?nN.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return PM.startKeyValue(e),PM.addKey(e,r),PM.addValue(e,i),PM.endKeyValue(e)})):-1;return nN.startSchema(e),nN.addFields(e,r),nN.addEndianness(e,Sz?AM.Little:AM.Big),i!==-1&&nN.addCustomMetadata(e,i),nN.endSchema(e)}function _z(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;UN.isDictionary(a)?(o=a.dictionary.typeId,i=FR.visit(a,e),r=FR.visit(a.dictionary,e)):r=FR.visit(a,e);let s=(a.children||[]).map(t=>OL.encode(e,t)),c=tN.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?tN.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return PM.startKeyValue(e),PM.addKey(e,r),PM.addValue(e,i),PM.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),tN.startField(e),tN.addType(e,r),tN.addTypeType(e,o),tN.addChildren(e,c),tN.addNullable(e,!!t.nullable),n!==-1&&tN.addName(e,n),i!==-1&&tN.addDictionary(e,i),l!==-1&&tN.addCustomMetadata(e,l),tN.endField(e)}function vz(e,t){let n=t.nodes||[],r=t.buffers||[];OM.startNodesVector(e,n.length);for(let t of n.slice().reverse())ez.encode(e,t);let i=e.endVector();OM.startBuffersVector(e,r.length);for(let t of r.slice().reverse())$R.encode(e,t);let a=e.endVector();return OM.startRecordBatch(e),OM.addLength(e,BigInt(t.length)),OM.addNodes(e,i),OM.addBuffers(e,a),OM.endRecordBatch(e)}function yz(e,t){let n=ZR.encode(e,t.data);return kM.startDictionaryBatch(e),kM.addId(e,BigInt(t.id)),kM.addIsDelta(e,t.isDelta),kM.addData(e,n),kM.endDictionaryBatch(e)}function bz(e,t){return DM.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function xz(e,t){return EM.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const Sz=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),Cz=e=>`Expected ${rN[e]} Message in stream, but was null or length 0.`,wz=e=>`Header pointer of flatbuffer-encoded ${rN[e]} Message is null or length 0.`,Tz=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Ez=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;var Dz=class{constructor(e){this.source=e instanceof VL?e:new VL(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?IL: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 Error(Cz(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=Wj(this.source.read(e));if(t.byteLength[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(Cz(e));return t.value}readSchema(){let e=rN.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(wz(e));return n}};const Az=4,jz=`ARROW1`,Mz=new Uint8Array(jz.length);for(let e=0;ethis):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 Qj.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Qj.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(t){return t instanceof e?t:Dj(t)?Zz(t):kj(t)?eB(t):wj(t)?(()=>uj(this,void 0,void 0,function*(){return yield e.from(yield t)}))():Aj(t)||Nj(t)||Fj(t)||Ej(t)?$z(new HL(t)):Qz(new VL(t))}static readAll(t){return t instanceof e?t.isSync()?Yz(t):Xz(t):Dj(t)||ArrayBuffer.isView(t)||Tj(t)||Oj(t)?Yz(t):Xz(t)}},Rz=class extends Lz{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return pj(this,arguments,function*(){yield fj(yield*mj(hj(this[Symbol.iterator]())))})}},zz=class extends Lz{constructor(e){super(e),this._impl=e}readAll(){return uj(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=hj(this),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Bz=class extends Rz{constructor(e){super(e),this._impl=e}},Vz=class extends zz{constructor(e){super(e),this._impl=e}},Hz=class{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){let n=this._loadVectors(e,t,this.schema.fields),r=$I({type:new gP(this.schema.fields),length:e.length,children:n});return new kR(this.schema,r)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new CL(c)):new CL(c)).memoize()}_loadVectors(e,t,n){return new tR(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Uz=class extends Hz{constructor(e,t){super(t),this._reader=Dj(e)?new kz(this._handle=e):new Dz(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=Jz(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):IL}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):IL}next(){if(this.closed)return IL;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadRecordBatch(n,r);return{done:!1,value:i}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new MR(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},Wz=class extends Hz{constructor(e,t){super(t),this._reader=new Oz(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return uj(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 uj(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Jz(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return uj(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):IL})}return(e){return uj(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):IL})}next(){return uj(this,void 0,void 0,function*(){if(this.closed)return IL;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadRecordBatch(n,r);return{done:!1,value:i}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new MR(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return uj(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},Gz=class extends Uz{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 GL?e:new GL(e),t)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var t;if(this.closed)return null;this._footer||this.open();let n=(t=this._footer)?.getRecordBatch(e);if(n&&this._handle.seek(n.offset)){let e=this._reader.readMessage(rN.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadRecordBatch(t,n);return r}}return null}_readDictionaryBatch(e){var t;let n=(t=this._footer)?.getDictionaryBatch(e);if(n&&this._handle.seek(n.offset)){let e=this._reader.readMessage(rN.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-Fz,n=e.readInt32(t),r=e.readAt(t-n,n);return NL.decode(r)}_readNextMessageAndValidate(e){var t;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return uj(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return uj(this,void 0,void 0,function*(){var t;if(this.closed)return null;this._footer||(yield this.open());let n=(t=this._footer)?.getRecordBatch(e);if(n&&(yield this._handle.seek(n.offset))){let e=yield this._reader.readMessage(rN.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadRecordBatch(t,n);return r}}return null})}_readDictionaryBatch(e){return uj(this,void 0,void 0,function*(){var t;let n=(t=this._footer)?.getDictionaryBatch(e);if(n&&(yield this._handle.seek(n.offset))){let e=yield this._reader.readMessage(rN.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return uj(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-Fz,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return NL.decode(r)})}_readNextMessageAndValidate(e){return uj(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?Nz(t)?new Bz(new Gz(e.read())):new Rz(new Uz(e)):new Rz(new Uz(function*(){}()))}function $z(e){return uj(this,void 0,void 0,function*(){let t=yield e.peek(Pz+7&-8);return t&&t.byteLength>=4?Nz(t)?new Bz(new Gz(yield e.read())):new zz(new Wz(e)):new zz(new Wz(function(){return pj(this,arguments,function*(){})}()))})}function eB(e){return uj(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new KL(e,t);return t>=Iz&&Nz(yield n.readAt(0,Pz+7&-8))?new Vz(new Kz(n)):new zz(new Wz(n))})}var tB=class e extends wP{static assemble(...t){let n=e=>e.flatMap(e=>Array.isArray(e)?n(e):e instanceof kR?e.data.children:e.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof CL)return this.visitMany(e.data),this;let{type:t}=e;if(!UN.isDictionary(t)){let{length:n}=e;if(n>2147483647)throw RangeError(`Cannot write arrays larger than 2^31 - 1 in length`);if(UN.isUnion(t))this.nodes.push(new ez(n,0));else{let{nullCount:r}=e;UN.isNull(t)||nB.call(this,r<=0?new Uint8Array:UI(e.offset,n,e.nullBitmap)),this.nodes.push(new ez(n,r))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function nB(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new $R(this._byteLength,t)),this._byteLength+=t,this}function rB(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:a}=e;if(nB.call(this,i),n.mode===sM.Sparse)return cB.call(this,e);if(n.mode===sM.Dense){if(e.offset<=0)return nB.call(this,a),cB.call(this,e);{let o=new Int32Array(r),s=Object.create(null),c=Object.create(null);for(let e,n,l=-1;++l{let i=n.typeIds[t],a=s[i],o=c[i];return e.slice(a,Math.min(r,o))}))}}return this}function iB(e){let t;return e.nullCount>=e.length?nB.call(this,new Uint8Array):(t=e.values)instanceof Uint8Array?nB.call(this,UI(e.offset,e.length,t)):nB.call(this,WI(e.values))}function aB(e){return nB.call(this,e.values.subarray(0,e.length*e.stride))}function oB(e){let{length:t,values:n,valueOffsets:r}=e,i=sN(r[0]),a=sN(r[t]),o=Math.min(a-i,n.byteLength-i);return nB.call(this,Xj(-i,t+1,r)),nB.call(this,n.subarray(i,i+o)),this}function sB(e){let{length:t,valueOffsets:n}=e;if(n){let{0:r,[t]:i}=n;return nB.call(this,Xj(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function cB(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}tB.prototype.visitBool=iB,tB.prototype.visitInt=aB,tB.prototype.visitFloat=aB,tB.prototype.visitUtf8=oB,tB.prototype.visitLargeUtf8=oB,tB.prototype.visitBinary=oB,tB.prototype.visitLargeBinary=oB,tB.prototype.visitFixedSizeBinary=aB,tB.prototype.visitDate=aB,tB.prototype.visitTimestamp=aB,tB.prototype.visitTime=aB,tB.prototype.visitDecimal=aB,tB.prototype.visitList=sB,tB.prototype.visitStruct=cB,tB.prototype.visitUnion=rB,tB.prototype.visitInterval=aB,tB.prototype.visitDuration=aB,tB.prototype.visitFixedSizeList=sB,tB.prototype.visitMap=sB;var lB=class extends RL{static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}constructor(e){super(),this._position=0,this._started=!1,this._sink=new BL,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Cj(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy==`boolean`?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat==`boolean`?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return wj(e)?e.then(e=>this.writeAll(e)):Ej(e)?pB(this,e):fB(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,t=null){return e===this._sink||e instanceof BL?this._sink=e:(this._sink=new BL,e&&Mj(e)?this.toDOMStream({type:`bytes`}).pipeTo(e):e&&Pj(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!t||!SR(t,this._schema))&&(t==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=t,this._writeSchema(t))),this}write(e){let t=null;if(this._sink){if(e==null||e instanceof DR&&!(t=e.schema)||e instanceof kR&&!(t=e.schema))return this.finish()&&void 0}else throw Error(`RecordBatchWriter is closed`);if(t&&!SR(t,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,t)}e instanceof kR?e instanceof MR||this._writeRecordBatch(e):e instanceof DR?this.writeAll(e.batches):Tj(e)&&this.writeAll(e)}_writeMessage(e,t=8){let n=t-1,r=XR.encode(e),i=r.byteLength,a=this._writeLegacyIpcFormat?4:8,o=i+a+n&~n,s=o-i-a;return e.headerType===rN.RecordBatch?this._recordBatchBlocks.push(new FL(o,e.bodyLength,this._position)):e.headerType===rN.DictionaryBatch&&this._dictionaryBlocks.push(new FL(o,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-a)),i>0&&this._write(r),this._writePadding(s)}_write(e){if(this._started){let t=Wj(e);t&&t.byteLength>0&&(this._sink.write(t),this._position+=t.byteLength)}return this}_writeSchema(e){return this._writeMessage(XR.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Mz)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){let{byteLength:t,nodes:n,bufferRegions:r,buffers:i}=tB.assemble(e),a=new ZR(e.numRows,n,r),o=XR.from(a,t);return this._writeDictionaries(e)._writeMessage(o)._writeBodyBuffers(i)}_writeDictionaryBatch(e,t,n=!1){let{byteLength:r,nodes:i,bufferRegions:a,buffers:o}=tB.assemble(new CL([e])),s=new ZR(e.length,i,a),c=new QR(s,t,n),l=XR.from(c,r);return this._writeMessage(l)._writeBodyBuffers(o)}_writeBodyBuffers(e){let t,n,r;for(let i=-1,a=e.length;++i0&&(this._write(t),(r=(n+7&-8)-n)>0&&this._writePadding(r));return this}_writeDictionaries(e){var t,n;for(let[r,i]of e.dictionaries){let e=(t=i?.data)??[],a=this._seenDictionaries.get(r),o=(n=this._dictionaryDeltaOffsets.get(r))??0;if(!a||a.data[0]!==e[0])for(let[t,n]of e.entries())this._writeDictionaryBatch(n,r,t>0);else if(or.writeAll(e)):Ej(t)?pB(r,t):fB(r,t)}},dB=class e extends lB{static writeAll(t){let n=new e;return wj(t)?t.then(e=>n.writeAll(e)):Ej(t)?pB(n,t):fB(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,t,n=!1){if(!n&&this._seenDictionaries.has(t))throw Error(`The Arrow File format does not support replacement dictionaries. `);return super._writeDictionaryBatch(e,t,n)}_writeFooter(e){let t=NL.encode(new NL(e,oM.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(t)._write(Int32Array.of(t.byteLength))._writeMagic()}};function fB(e,t){let n=t;t instanceof DR&&(n=t.batches,e.reset(void 0,t.schema));for(let t of n)e.write(t);return e.finish()}function pB(e,t){return uj(this,void 0,void 0,function*(){var n,r,i,a,o,s,c;try{for(n=!0,r=hj(t);i=yield r.next(),a=i.done,!a;n=!0){c=i.value,n=!1;let t=c;e.write(t)}}catch(e){o={error:e}}finally{try{!n&&!a&&(s=r.return)&&(yield s.call(r))}finally{if(o)throw o.error}}return e.finish()})}function mB(e,t=`stream`){return(t===`stream`?uB:dB).writeAll(e).toUint8Array(!0)}var hB=Object.create,gB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,vB=Object.getOwnPropertyNames,yB=Object.getPrototypeOf,bB=Object.prototype.hasOwnProperty,xB=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),SB=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of vB(t))!bB.call(e,i)&&i!==n&&gB(e,i,{get:()=>t[i],enumerable:!(r=_B(t,i))||r.enumerable});return e},CB=(e,t,n)=>(n=e==null?{}:hB(yB(e)),SB(t||!e||!e.__esModule?gB(n,`default`,{value:e,enumerable:!0}):n,e)),wB=xB((e,t)=>{t.exports=Worker}),TB=(e=>(e[e.UNDEFINED=0]=`UNDEFINED`,e[e.AUTOMATIC=1]=`AUTOMATIC`,e[e.READ_ONLY=2]=`READ_ONLY`,e[e.READ_WRITE=3]=`READ_WRITE`,e))(TB||{}),EB=(e=>(e[e.IDENTIFIER=0]=`IDENTIFIER`,e[e.NUMERIC_CONSTANT=1]=`NUMERIC_CONSTANT`,e[e.STRING_CONSTANT=2]=`STRING_CONSTANT`,e[e.OPERATOR=3]=`OPERATOR`,e[e.KEYWORD=4]=`KEYWORD`,e[e.COMMENT=5]=`COMMENT`,e))(EB||{}),DB=(e=>(e[e.NONE=0]=`NONE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARNING=3]=`WARNING`,e[e.ERROR=4]=`ERROR`,e))(DB||{}),OB=(e=>(e[e.NONE=0]=`NONE`,e[e.CONNECT=1]=`CONNECT`,e[e.DISCONNECT=2]=`DISCONNECT`,e[e.OPEN=3]=`OPEN`,e[e.QUERY=4]=`QUERY`,e[e.INSTANTIATE=5]=`INSTANTIATE`,e))(OB||{}),kB=(e=>(e[e.NONE=0]=`NONE`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`,e[e.START=3]=`START`,e[e.RUN=4]=`RUN`,e[e.CAPTURE=5]=`CAPTURE`,e))(kB||{}),AB=(e=>(e[e.NONE=0]=`NONE`,e[e.WEB_WORKER=1]=`WEB_WORKER`,e[e.NODE_WORKER=2]=`NODE_WORKER`,e[e.BINDINGS=3]=`BINDINGS`,e[e.ASYNC_DUCKDB=4]=`ASYNC_DUCKDB`,e))(AB||{}),jB=class{log(e){}},MB=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}},NB=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e))(NB||{}),PB=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=Lz.from(t);return console.assert(n.isSync(),`Reader is not sync`),console.assert(n.isFile(),`Reader is not file`),new DR(n)}async send(e,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.startPendingQuery(this._conn,e,t);for(;n==null;)n=await this._bindings.pollPendingQuery(this._conn);let r=new FB(this._bindings,this._conn,n),i=await Lz.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new IB(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=mB(e,`stream`);await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},FB=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight==null?e=await this.db.fetchQueryResults(this.conn):(e=await this._inFlight,this._inFlight=null),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},IB=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=Lz.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new DR(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new FB(this.bindings,this.connectionId,t),r=await Lz.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},LB=(e=>(e.CANCEL_PENDING_QUERY=`CANCEL_PENDING_QUERY`,e.CLOSE_PREPARED=`CLOSE_PREPARED`,e.COLLECT_FILE_STATISTICS=`COLLECT_FILE_STATISTICS`,e.REGISTER_OPFS_FILE_NAME=`REGISTER_OPFS_FILE_NAME`,e.CONNECT=`CONNECT`,e.COPY_FILE_TO_BUFFER=`COPY_FILE_TO_BUFFER`,e.COPY_FILE_TO_PATH=`COPY_FILE_TO_PATH`,e.CREATE_PREPARED=`CREATE_PREPARED`,e.DISCONNECT=`DISCONNECT`,e.DROP_FILE=`DROP_FILE`,e.DROP_FILES=`DROP_FILES`,e.EXPORT_FILE_STATISTICS=`EXPORT_FILE_STATISTICS`,e.FETCH_QUERY_RESULTS=`FETCH_QUERY_RESULTS`,e.FLUSH_FILES=`FLUSH_FILES`,e.GET_FEATURE_FLAGS=`GET_FEATURE_FLAGS`,e.GET_TABLE_NAMES=`GET_TABLE_NAMES`,e.GET_VERSION=`GET_VERSION`,e.GLOB_FILE_INFOS=`GLOB_FILE_INFOS`,e.INSERT_ARROW_FROM_IPC_STREAM=`INSERT_ARROW_FROM_IPC_STREAM`,e.INSERT_CSV_FROM_PATH=`IMPORT_CSV_FROM_PATH`,e.INSERT_JSON_FROM_PATH=`IMPORT_JSON_FROM_PATH`,e.INSTANTIATE=`INSTANTIATE`,e.OPEN=`OPEN`,e.PING=`PING`,e.POLL_PENDING_QUERY=`POLL_PENDING_QUERY`,e.REGISTER_FILE_BUFFER=`REGISTER_FILE_BUFFER`,e.REGISTER_FILE_HANDLE=`REGISTER_FILE_HANDLE`,e.REGISTER_FILE_URL=`REGISTER_FILE_URL`,e.RESET=`RESET`,e.RUN_PREPARED=`RUN_PREPARED`,e.RUN_QUERY=`RUN_QUERY`,e.SEND_PREPARED=`SEND_PREPARED`,e.START_PENDING_QUERY=`START_PENDING_QUERY`,e.TOKENIZE=`TOKENIZE`,e))(LB||{}),RB=(e=>(e.CONNECTION_INFO=`CONNECTION_INFO`,e.ERROR=`ERROR`,e.FEATURE_FLAGS=`FEATURE_FLAGS`,e.FILE_BUFFER=`FILE_BUFFER`,e.FILE_INFOS=`FILE_INFOS`,e.FILE_SIZE=`FILE_SIZE`,e.FILE_STATISTICS=`FILE_STATISTICS`,e.INSTANTIATE_PROGRESS=`INSTANTIATE_PROGRESS`,e.LOG=`LOG`,e.OK=`OK`,e.PREPARED_STATEMENT_ID=`PREPARED_STATEMENT_ID`,e.QUERY_PLAN=`QUERY_PLAN`,e.QUERY_RESULT=`QUERY_RESULT`,e.QUERY_RESULT_CHUNK=`QUERY_RESULT_CHUNK`,e.QUERY_RESULT_HEADER=`QUERY_RESULT_HEADER`,e.QUERY_RESULT_HEADER_OR_NULL=`QUERY_RESULT_HEADER_OR_NULL`,e.REGISTERED_FILE=`REGISTERED_FILE`,e.SCRIPT_TOKENS=`SCRIPT_TOKENS`,e.SUCCESS=`SUCCESS`,e.TABLE_NAMES=`TABLE_NAMES`,e.VERSION_STRING=`VERSION_STRING`,e))(RB||{}),zB=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((e,t)=>{this.promiseResolver=e,this.promiseRejecter=t})}};function BB(e){switch(e.typeId){case Y.Binary:return{sqlType:`binary`};case Y.Bool:return{sqlType:`bool`};case Y.Date:return{sqlType:`date`};case Y.DateDay:return{sqlType:`date32[d]`};case Y.DateMillisecond:return{sqlType:`date64[ms]`};case Y.Decimal:{let t=e;return{sqlType:`decimal`,precision:t.precision,scale:t.scale}}case Y.Float:return{sqlType:`float`};case Y.Float16:return{sqlType:`float16`};case Y.Float32:return{sqlType:`float32`};case Y.Float64:return{sqlType:`float64`};case Y.Int:return{sqlType:`int32`};case Y.Int16:return{sqlType:`int16`};case Y.Int32:return{sqlType:`int32`};case Y.Int64:return{sqlType:`int64`};case Y.Uint16:return{sqlType:`uint16`};case Y.Uint32:return{sqlType:`uint32`};case Y.Uint64:return{sqlType:`uint64`};case Y.Uint8:return{sqlType:`uint8`};case Y.IntervalDayTime:return{sqlType:`interval[dt]`};case Y.IntervalYearMonth:return{sqlType:`interval[m]`};case Y.List:return{sqlType:`list`,valueType:BB(e.valueType)};case Y.FixedSizeBinary:return{sqlType:`fixedsizebinary`,byteWidth:e.byteWidth};case Y.Null:return{sqlType:`null`};case Y.Utf8:return{sqlType:`utf8`};case Y.Struct:return{sqlType:`struct`,fields:e.children.map(e=>VB(e.name,e.type))};case Y.Map:{let t=e;return{sqlType:`map`,keyType:BB(t.keyType),valueType:BB(t.valueType)}}case Y.Time:return{sqlType:`time[s]`};case Y.TimeMicrosecond:return{sqlType:`time[us]`};case Y.TimeMillisecond:return{sqlType:`time[ms]`};case Y.TimeNanosecond:return{sqlType:`time[ns]`};case Y.TimeSecond:return{sqlType:`time[s]`};case Y.Timestamp:return{sqlType:`timestamp`,timezone:e.timezone||void 0};case Y.TimestampSecond:return{sqlType:`timestamp[s]`,timezone:e.timezone||void 0};case Y.TimestampMicrosecond:return{sqlType:`timestamp[us]`,timezone:e.timezone||void 0};case Y.TimestampNanosecond:return{sqlType:`timestamp[ns]`,timezone:e.timezone||void 0};case Y.TimestampMillisecond:return{sqlType:`timestamp[ms]`,timezone:e.timezone||void 0}}throw Error(`unsupported arrow type: ${e.toString()}`)}function VB(e,t){let n=BB(t);return n.name=e,n}var HB=new TextEncoder,UB=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener(`message`,this._onMessageHandler),this._worker.addEventListener(`error`,this._onErrorHandler),this._worker.addEventListener(`close`,this._onCloseHandler),this._workerShutdownPromise=new Promise((e,t)=>{this._workerShutdownResolver=e})}detach(){this._worker&&(this._worker.removeEventListener(`message`,this._onMessageHandler),this._worker.removeEventListener(`error`,this._onErrorHandler),this._worker.removeEventListener(`close`,this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error(`cannot send a message since the worker is not set!`);return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case`LOG`:this._logger.log(n.data);return;case`INSTANTIATE_PROGRESS`:for(let e of this._onInstantiationProgress)e(n.data);return}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn(`unassociated response: [${n.requestId}, ${n.type.toString()}]`);return}if(this._pendingRequests.delete(n.requestId),n.type==`ERROR`){let e=Error(n.data.message);e.name=n.data.name,(t=Object.getOwnPropertyDescriptor(e,`stack`))!=null&&t.writable&&(e.stack=n.data.stack),r.promiseRejecter(e);return}switch(r.type){case`CLOSE_PREPARED`:case`COLLECT_FILE_STATISTICS`:case`REGISTER_OPFS_FILE_NAME`:case`COPY_FILE_TO_PATH`:case`DISCONNECT`:case`DROP_FILE`:case`DROP_FILES`:case`FLUSH_FILES`:case`INSERT_ARROW_FROM_IPC_STREAM`:case`IMPORT_CSV_FROM_PATH`:case`IMPORT_JSON_FROM_PATH`:case`OPEN`:case`PING`:case`REGISTER_FILE_BUFFER`:case`REGISTER_FILE_HANDLE`:case`REGISTER_FILE_URL`:case`RESET`:if(n.type==`OK`){r.promiseResolver(n.data);return}break;case`INSTANTIATE`:if(this._onInstantiationProgress=[],n.type==`OK`){r.promiseResolver(n.data);return}break;case`GLOB_FILE_INFOS`:if(n.type==`FILE_INFOS`){r.promiseResolver(n.data);return}break;case`GET_VERSION`:if(n.type==`VERSION_STRING`){r.promiseResolver(n.data);return}break;case`GET_FEATURE_FLAGS`:if(n.type==`FEATURE_FLAGS`){r.promiseResolver(n.data);return}break;case`GET_TABLE_NAMES`:if(n.type==`TABLE_NAMES`){r.promiseResolver(n.data);return}break;case`TOKENIZE`:if(n.type==`SCRIPT_TOKENS`){r.promiseResolver(n.data);return}break;case`COPY_FILE_TO_BUFFER`:if(n.type==`FILE_BUFFER`){r.promiseResolver(n.data);return}break;case`EXPORT_FILE_STATISTICS`:if(n.type==`FILE_STATISTICS`){r.promiseResolver(n.data);return}break;case`CONNECT`:if(n.type==`CONNECTION_INFO`){r.promiseResolver(n.data);return}break;case`RUN_PREPARED`:case`RUN_QUERY`:if(n.type==`QUERY_RESULT`){r.promiseResolver(n.data);return}break;case`SEND_PREPARED`:if(n.type==`QUERY_RESULT_HEADER`){r.promiseResolver(n.data);return}break;case`START_PENDING_QUERY`:if(n.type==`QUERY_RESULT_HEADER_OR_NULL`){r.promiseResolver(n.data);return}break;case`POLL_PENDING_QUERY`:if(n.type==`QUERY_RESULT_HEADER_OR_NULL`){r.promiseResolver(n.data);return}break;case`CANCEL_PENDING_QUERY`:if(this._onInstantiationProgress=[],n.type==`SUCCESS`){r.promiseResolver(n.data);return}break;case`FETCH_QUERY_RESULTS`:if(n.type==`QUERY_RESULT_CHUNK`){r.promiseResolver(n.data);return}break;case`CREATE_PREPARED`:if(n.type==`PREPARED_STATEMENT_ID`){r.promiseResolver(n.data);return}break}r.promiseRejecter(Error(`unexpected response type: ${n.type.toString()}`))}onError(e){console.error(e),console.error(`error in duckdb worker: ${e.message}`),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn(`worker terminated with ${this._pendingRequests.size} pending requests`);return}this._pendingRequests.clear()}async reset(){let e=new zB(`RESET`,null);return await this.postTask(e)}async ping(){let e=new zB(`PING`,null);await this.postTask(e)}async dropFile(e){let t=new zB(`DROP_FILE`,e);return await this.postTask(t)}async dropFiles(){let e=new zB(`DROP_FILES`,null);return await this.postTask(e)}async flushFiles(){let e=new zB(`FLUSH_FILES`,null);return await this.postTask(e)}async instantiate(e,t=null,n=e=>{}){this._onInstantiationProgress.push(n);let r=new zB(`INSTANTIATE`,[e,t]);return await this.postTask(r)}async getVersion(){let e=new zB(`GET_VERSION`,null);return await this.postTask(e)}async getFeatureFlags(){let e=new zB(`GET_FEATURE_FLAGS`,null);return await this.postTask(e)}async open(e){let t=new zB(`OPEN`,e);await this.postTask(t)}async tokenize(e){let t=new zB(`TOKENIZE`,e);return await this.postTask(t)}async connectInternal(){let e=new zB(`CONNECT`,null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new PB(this,e)}async disconnect(e){let t=new zB(`DISCONNECT`,e);await this.postTask(t)}async runQuery(e,t){let n=new zB(`RUN_QUERY`,[e,t]);return await this.postTask(n)}async startPendingQuery(e,t,n=!1){let r=new zB(`START_PENDING_QUERY`,[e,t,n]);return await this.postTask(r)}async pollPendingQuery(e){let t=new zB(`POLL_PENDING_QUERY`,e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new zB(`CANCEL_PENDING_QUERY`,e);return await this.postTask(t)}async fetchQueryResults(e){let t=new zB(`FETCH_QUERY_RESULTS`,e);return await this.postTask(t)}async getTableNames(e,t){let n=new zB(`GET_TABLE_NAMES`,[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new zB(`CREATE_PREPARED`,[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new zB(`CLOSE_PREPARED`,[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new zB(`RUN_PREPARED`,[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new zB(`SEND_PREPARED`,[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new zB(`GLOB_FILE_INFOS`,e);return await this.postTask(t)}async registerFileText(e,t){let n=HB.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new zB(`REGISTER_FILE_URL`,[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let n=new zB(`REGISTER_FILE_BUFFER`,[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new zB(`REGISTER_FILE_HANDLE`,[e,t,n,r]);await this.postTask(i,[])}async registerOPFSFileName(e){let t=new zB(`REGISTER_OPFS_FILE_NAME`,[e]);await this.postTask(t,[])}async collectFileStatistics(e,t){let n=new zB(`COLLECT_FILE_STATISTICS`,[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new zB(`EXPORT_FILE_STATISTICS`,e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new zB(`COPY_FILE_TO_BUFFER`,e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new zB(`COPY_FILE_TO_PATH`,[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new zB(`INSERT_ARROW_FROM_IPC_STREAM`,[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let e=[];for(let t in n.columns){let r=n.columns[t];e.push(VB(t,r))}n.columnsFlat=e,delete n.columns}let r=new zB(`IMPORT_CSV_FROM_PATH`,[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let e=[];for(let t in n.columns){let r=n.columns[t];e.push(VB(t,r))}n.columnsFlat=e,delete n.columns}let r=new zB(`IMPORT_JSON_FROM_PATH`,[e,t,n]);await this.postTask(r)}};function WB(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<`u`&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var GB=WB(),KB=(e=>(e[e.BUFFER=0]=`BUFFER`,e[e.NODE_FS=1]=`NODE_FS`,e[e.BROWSER_FILEREADER=2]=`BROWSER_FILEREADER`,e[e.BROWSER_FSACCESS=3]=`BROWSER_FSACCESS`,e[e.HTTP=4]=`HTTP`,e[e.S3=5]=`S3`,e))(KB||{}),qB=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),JB=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),YB=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),XB=()=>(async e=>{try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),ZB={name:`@duckdb/duckdb-wasm`,version:`1.29.1-dev68.0`,description:`DuckDB powered by WebAssembly`,license:`MIT`,repository:{type:`git`,url:`https://github.com/duckdb/duckdb-wasm.git`},keywords:[`sql`,`duckdb`,`relational`,`database`,`data`,`query`,`wasm`,`analytics`,`olap`,`arrow`,`parquet`,`json`,`csv`],dependencies:{"apache-arrow":`^17.0.0`},devDependencies:{"@types/emscripten":`^1.39.10`,"@types/jasmine":`^5.1.4`,"@typescript-eslint/eslint-plugin":`^6.21.0`,"@typescript-eslint/parser":`^6.21.0`,esbuild:`^0.20.2`,eslint:`^8.57.0`,"eslint-plugin-jasmine":`^4.1.3`,"eslint-plugin-react":`^7.34.0`,"fast-glob":`^3.3.2`,jasmine:`^5.1.0`,"jasmine-core":`^5.1.2`,"jasmine-spec-reporter":`^7.0.0`,"js-sha256":`^0.11.0`,karma:`^6.4.2`,"karma-chrome-launcher":`^3.2.0`,"karma-coverage":`^2.2.1`,"karma-firefox-launcher":`^2.1.3`,"karma-jasmine":`^5.1.0`,"karma-jasmine-html-reporter":`^2.1.0`,"karma-sourcemap-loader":`^0.4.0`,"karma-spec-reporter":`^0.0.36`,"make-dir":`^4.0.0`,nyc:`^15.1.0`,prettier:`^3.2.5`,puppeteer:`^22.8.0`,rimraf:`^5.0.5`,s3rver:`^3.7.1`,typedoc:`^0.25.13`,typescript:`^5.3.3`,"wasm-feature-detect":`^1.6.1`,"web-worker":`^1.2.0`},scripts:{"build:debug":`node bundle.mjs debug && tsc --emitDeclarationOnly`,"build:release":`node bundle.mjs release && tsc --emitDeclarationOnly`,docs:`typedoc`,report:`node ./coverage.mjs`,"test:node":`node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:node:debug":`node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:node:coverage":`nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs`,"test:firefox":`karma start ./karma/tests-firefox.cjs`,"test:chrome":`karma start ./karma/tests-chrome.cjs`,"test:chrome:eh":`karma start ./karma/tests-chrome-eh.cjs`,"test:chrome:coverage":`karma start ./karma/tests-chrome-coverage.cjs`,"test:browser":`karma start ./karma/tests-all.cjs`,"test:browser:debug":`karma start ./karma/tests-debug.cjs`,test:`npm run test:chrome && npm run test:node`,"test:coverage":`npm run test:chrome:coverage && npm run test:node:coverage && npm run report`,lint:`eslint src test`},files:[`dist`,`!dist/tests-*`,`!dist/duckdb-browser-mvp.worker.js.map`,`!dist/types/test`],main:`dist/duckdb-browser.cjs`,module:`dist/duckdb-browser.mjs`,types:`dist/duckdb-browser.d.ts`,jsdelivr:`dist/duckdb-browser.cjs`,unpkg:`dist/duckdb-browser.mjs`,sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":`./dist/duckdb-mvp.wasm`,"./dist/duckdb-eh.wasm":`./dist/duckdb-eh.wasm`,"./dist/duckdb-coi.wasm":`./dist/duckdb-coi.wasm`,"./dist/duckdb-browser":`./dist/duckdb-browser.mjs`,"./dist/duckdb-browser.cjs":`./dist/duckdb-browser.cjs`,"./dist/duckdb-browser.mjs":`./dist/duckdb-browser.mjs`,"./dist/duckdb-browser-coi.pthread.worker.js":`./dist/duckdb-browser-coi.pthread.worker.js`,"./dist/duckdb-browser-coi.worker.js":`./dist/duckdb-browser-coi.worker.js`,"./dist/duckdb-browser-eh.worker.js":`./dist/duckdb-browser-eh.worker.js`,"./dist/duckdb-browser-mvp.worker.js":`./dist/duckdb-browser-mvp.worker.js`,"./dist/duckdb-node":`./dist/duckdb-node.cjs`,"./dist/duckdb-node.cjs":`./dist/duckdb-node.cjs`,"./dist/duckdb-node-blocking":`./dist/duckdb-node-blocking.cjs`,"./dist/duckdb-node-blocking.cjs":`./dist/duckdb-node-blocking.cjs`,"./dist/duckdb-node-eh.worker.cjs":`./dist/duckdb-node-eh.worker.cjs`,"./dist/duckdb-node-mvp.worker.cjs":`./dist/duckdb-node-mvp.worker.cjs`,"./blocking":{node:{types:`./dist/duckdb-node-blocking.d.ts`,require:`./dist/duckdb-node-blocking.cjs`,import:`./dist/duckdb-node-blocking.cjs`},types:`./dist/duckdb-node-blocking.d.ts`,import:`./dist/duckdb-node-blocking.mjs`,require:`./dist/duckdb-node-blocking.cjs`},".":{browser:{types:`./dist/duckdb-browser.d.ts`,import:`./dist/duckdb-browser.mjs`,require:`./dist/duckdb-browser.cjs`},node:{types:`./dist/duckdb-node.d.ts`,import:`./dist/duckdb-node.cjs`,require:`./dist/duckdb-node.cjs`},types:`./dist/duckdb-browser.d.ts`,import:`./dist/duckdb-browser.mjs`,require:`./dist/duckdb-browser.cjs`}}},QB=ZB.name,$B=ZB.version,eV=ZB.version.split(`.`),tV=eV[0],nV=eV[1],rV=eV[2],iV=()=>typeof navigator>`u`,aV=()=>iV()?`node`:navigator.userAgent,oV=()=>aV().includes(`Firefox`),sV=()=>/^((?!chrome|android).)*safari/i.test(aV()),cV=null,lV=null,uV=null,dV=null,fV=null;async function pV(){return cV??=typeof BigInt64Array<`u`,lV??=await JB(),uV??=await XB(),dV??=await YB(),fV??=await qB(),{bigInt64Array:cV,crossOriginIsolated:iV()||globalThis.crossOriginIsolated||!1,wasmExceptions:lV,wasmSIMD:dV,wasmThreads:uV,wasmBulkMemory:fV}}async function mV(e){let t=await pV();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var hV=CB(wB());const gV=Symbol.for(`constructDateFrom`),_V={},vV={};function yV(e,t){try{let n=_V[e]||(_V[e]=new Intl.DateTimeFormat(`en-GB`,{timeZone:e,hour:`numeric`,timeZoneName:`longOffset`}).format),r=n(t).split(`GMT`)[1]||``;return r in vV?vV[r]:xV(r,r.split(`:`))}catch{if(e in vV)return vV[e];let t=e?.match(bV);return t?xV(e,t.slice(1)):NaN}}const bV=/([+-]\d\d):?(\d\d)?/;function xV(e,t){let n=+t[0],r=+(t[1]||0);return vV[e]=n>0?n*60+r:n*60-r}var SV=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(yV(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),EV(this,NaN),wV(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){return-yV(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),wV(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};const CV=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!CV.test(e))return;let t=e.replace(CV,`$1UTC`);SV.prototype[t]&&(e.startsWith(`get`)?SV.prototype[e]=function(){return this.internal[t]()}:(SV.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),TV(this),+this},SV.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),wV(this),+this}))});function wV(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function TV(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),EV(e)}function EV(e){let t=yV(e.timeZone,e),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);let r=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),a=r-i,o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=r-t;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=yV(e.timeZone,e),l=-new Date(+e).getTimezoneOffset(),u=l-c,d=c!==t,f=u-s;if(d&&f){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+f);let t=yV(e.timeZone,e),n=c-t;n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var DV=class e extends SV{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${OV(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset(),t=e>0?`-`:`+`,n=String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),r=String(Math.abs(e)%60).padStart(2,`0`);return[t,n,r]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}};function OV(e,t){return new Intl.DateTimeFormat(`en-GB`,{timeZone:e,timeZoneName:`long`}).format(t).slice(12)}const kV=new TextDecoder(`utf-8`),AV=e=>kV.decode(e),jV=new TextEncoder,MV=e=>jV.encode(e),NV=e=>typeof e==`function`,PV=e=>e!=null&&Object(e)===e,FV=e=>PV(e)&&NV(e.then),IV=e=>PV(e)&&NV(e[Symbol.iterator]),LV=e=>PV(e)&&NV(e[Symbol.asyncIterator]),RV=e=>PV(e)&&`done`in e&&`value`in e,zV=e=>PV(e)&&NV(e.clear)&&NV(e.bytes)&&NV(e.position)&&NV(e.setPosition)&&NV(e.capacity)&&NV(e.getBufferIdentifier)&&NV(e.createLong);var BV={};xt(BV,{compareArrayLike:()=>TH,joinUint8Arrays:()=>WV,memcpy:()=>UV,rebaseValueOffsets:()=>wH,toArrayBufferView:()=>GV,toArrayBufferViewAsyncIterator:()=>mH,toArrayBufferViewIterator:()=>iH,toBigInt64Array:()=>YV,toBigUint64Array:()=>$V,toFloat32Array:()=>eH,toFloat32ArrayAsyncIterator:()=>xH,toFloat32ArrayIterator:()=>dH,toFloat64Array:()=>tH,toFloat64ArrayAsyncIterator:()=>SH,toFloat64ArrayIterator:()=>fH,toInt16Array:()=>qV,toInt16ArrayAsyncIterator:()=>gH,toInt16ArrayIterator:()=>oH,toInt32Array:()=>JV,toInt32ArrayAsyncIterator:()=>_H,toInt32ArrayIterator:()=>sH,toInt8Array:()=>KV,toInt8ArrayAsyncIterator:()=>hH,toInt8ArrayIterator:()=>aH,toUint16Array:()=>ZV,toUint16ArrayAsyncIterator:()=>yH,toUint16ArrayIterator:()=>lH,toUint32Array:()=>QV,toUint32ArrayAsyncIterator:()=>bH,toUint32ArrayIterator:()=>uH,toUint8Array:()=>XV,toUint8ArrayAsyncIterator:()=>vH,toUint8ArrayIterator:()=>cH,toUint8ClampedArray:()=>nH,toUint8ClampedArrayAsyncIterator:()=>CH,toUint8ClampedArrayIterator:()=>pH});const VV=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function HV(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++ce+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++cGV(Int8Array,e),qV=e=>GV(Int16Array,e),JV=e=>GV(Int32Array,e),YV=e=>GV(BigInt64Array,e),XV=e=>GV(Uint8Array,e),ZV=e=>GV(Uint16Array,e),QV=e=>GV(Uint32Array,e),$V=e=>GV(BigUint64Array,e),eH=e=>GV(Float32Array,e),tH=e=>GV(Float64Array,e),nH=e=>GV(Uint8ClampedArray,e),rH=e=>(e.next(),e);function*iH(e,t){let n=function*(e){yield e},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof VV?n(t):IV(t)?t:n(t);return yield*rH(function*(t){let n=null;do n=t.next(yield GV(e,n));while(!n.done)}(r[Symbol.iterator]())),new e}const aH=e=>iH(Int8Array,e),oH=e=>iH(Int16Array,e),sH=e=>iH(Int32Array,e),cH=e=>iH(Uint8Array,e),lH=e=>iH(Uint16Array,e),uH=e=>iH(Uint32Array,e),dH=e=>iH(Float32Array,e),fH=e=>iH(Float64Array,e),pH=e=>iH(Uint8ClampedArray,e);function mH(e,t){return pj(this,arguments,function*(){if(FV(t))return yield fj(yield fj(yield*mj(hj(mH(e,yield fj(t))))));let n=function(e){return pj(this,arguments,function*(){yield yield fj(yield fj(e))})},r=function(e){return pj(this,arguments,function*(){yield fj(yield*mj(hj(rH(function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)}(e[Symbol.iterator]())))))})},i=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof VV?n(t):IV(t)?r(t):LV(t)?t:n(t);return yield fj(yield*mj(hj(rH(function(t){return pj(this,arguments,function*(){let n=null;do n=yield fj(t.next(yield yield fj(GV(e,n))));while(!n.done)})}(i[Symbol.asyncIterator]()))))),yield fj(new e)})}const hH=e=>mH(Int8Array,e),gH=e=>mH(Int16Array,e),_H=e=>mH(Int32Array,e),vH=e=>mH(Uint8Array,e),yH=e=>mH(Uint16Array,e),bH=e=>mH(Uint32Array,e),xH=e=>mH(Float32Array,e),SH=e=>mH(Float64Array,e),CH=e=>mH(Uint8ClampedArray,e);function wH(e,t,n){if(e!==0){n=n.slice(0,t);for(let t=-1,r=n.length;++t0)do if(e[n]!==t[n])return!1;while(++nPH});const NH=void 0;function PH(e){if(e===null)return`null`;if(e===NH)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>PH(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function FH(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function IH(e,t){return FH(e/t)+FH(e%t)/FH(t)}var LH={};xt(LH,{BN:()=>YH,bigNumToBigInt:()=>qH,bigNumToNumber:()=>GH,bigNumToString:()=>KH,isArrowBigNumSymbol:()=>RH});const RH=Symbol.for(`isArrowBigNum`);function zH(e,...t){return t.length===0?Object.setPrototypeOf(GV(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}zH.prototype[RH]=!0,zH.prototype.toJSON=function(){return`"${KH(this)}"`},zH.prototype.valueOf=function(e){return GH(this,e)},zH.prototype.toString=function(){return KH(this)},zH.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return GH(this);case`string`:return KH(this);case`default`:return qH(this)}return KH(this)};function BH(...e){return zH.apply(this,e)}function VH(...e){return zH.apply(this,e)}function HH(...e){return zH.apply(this,e)}Object.setPrototypeOf(BH.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(VH.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(HH.prototype,Object.create(Uint32Array.prototype)),Object.assign(BH.prototype,zH.prototype,{constructor:BH,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(VH.prototype,zH.prototype,{constructor:VH,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(HH.prototype,zH.prototype,{constructor:HH,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const UH=BigInt(4294967296)*BigInt(4294967296),WH=UH-BigInt(1);function GH(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<0){let e=BigInt(`1`.padEnd(t+1,`0`)),n=c/e,r=s?-(c%e):c%e,i=FH(n),a=`${r}`.padStart(t,`0`),o=s&&i===0?`-`:``;return+`${o}${i}.${a}`}return FH(c)}function KH(e){if(e.byteLength===8){let t=new e.BigIntArray(e.buffer,e.byteOffset,1);return`${t[0]}`}if(!e.signed)return JH(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=new Int16Array([t.at(-1)])[0];if(n>=0)return JH(e);t=t.slice();let r=1;for(let e=0;e(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]=`DataType`))(vU.prototype);var yU=class extends vU{constructor(){super(X.Null)}toString(){return`Null`}};ZH=Symbol.toStringTag,yU[ZH]=(e=>e[Symbol.toStringTag]=`Null`)(yU.prototype);var bU=class extends vU{constructor(e,t){super(X.Int),this.isSigned=e,this.bitWidth=t}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};QH=Symbol.toStringTag,bU[QH]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(bU.prototype);var xU=class extends bU{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},SU=class extends bU{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},CU=class extends bU{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},wU=class extends bU{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},TU=class extends bU{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},EU=class extends bU{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},DU=class extends bU{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},OU=class extends bU{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(xU.prototype,`ArrayType`,{value:Int8Array}),Object.defineProperty(SU.prototype,`ArrayType`,{value:Int16Array}),Object.defineProperty(CU.prototype,`ArrayType`,{value:Int32Array}),Object.defineProperty(wU.prototype,`ArrayType`,{value:BigInt64Array}),Object.defineProperty(TU.prototype,`ArrayType`,{value:Uint8Array}),Object.defineProperty(EU.prototype,`ArrayType`,{value:Uint16Array}),Object.defineProperty(DU.prototype,`ArrayType`,{value:Uint32Array}),Object.defineProperty(OU.prototype,`ArrayType`,{value:BigUint64Array});var kU=class extends vU{constructor(e){super(X.Float),this.precision=e}get ArrayType(){switch(this.precision){case DH.HALF:return Uint16Array;case DH.SINGLE:return Float32Array;case DH.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$H=Symbol.toStringTag,kU[$H]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(kU.prototype);var AU=class extends kU{constructor(){super(DH.HALF)}},jU=class extends kU{constructor(){super(DH.SINGLE)}},MU=class extends kU{constructor(){super(DH.DOUBLE)}};Object.defineProperty(AU.prototype,`ArrayType`,{value:Uint16Array}),Object.defineProperty(jU.prototype,`ArrayType`,{value:Float32Array}),Object.defineProperty(MU.prototype,`ArrayType`,{value:Float64Array});var NU=class extends vU{constructor(){super(X.Binary)}toString(){return`Binary`}};eU=Symbol.toStringTag,NU[eU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(NU.prototype);var PU=class extends vU{constructor(){super(X.LargeBinary)}toString(){return`LargeBinary`}};tU=Symbol.toStringTag,PU[tU]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(PU.prototype);var FU=class extends vU{constructor(){super(X.Utf8)}toString(){return`Utf8`}};nU=Symbol.toStringTag,FU[nU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(FU.prototype);var IU=class extends vU{constructor(){super(X.LargeUtf8)}toString(){return`LargeUtf8`}};rU=Symbol.toStringTag,IU[rU]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))(IU.prototype);var LU=class extends vU{constructor(){super(X.Bool)}toString(){return`Bool`}};iU=Symbol.toStringTag,LU[iU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(LU.prototype);var RU=class extends vU{constructor(e,t,n=128){super(X.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};aU=Symbol.toStringTag,RU[aU]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(RU.prototype);var zU=class extends vU{constructor(e){super(X.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${OH[this.unit]}>`}get ArrayType(){return this.unit===OH.DAY?Int32Array:BigInt64Array}};oU=Symbol.toStringTag,zU[oU]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(zU.prototype);var BU=class extends vU{constructor(e,t){super(X.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${kH[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};sU=Symbol.toStringTag,BU[sU]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(BU.prototype);var VU=class extends vU{constructor(e,t){super(X.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${kH[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};cU=Symbol.toStringTag,VU[cU]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(VU.prototype);var HU=class extends vU{constructor(e){super(X.Interval),this.unit=e}toString(){return`Interval<${AH[this.unit]}>`}};lU=Symbol.toStringTag,HU[lU]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(HU.prototype);var UU=class extends vU{constructor(e){super(X.Duration),this.unit=e}toString(){return`Duration<${kH[this.unit]}>`}};uU=Symbol.toStringTag,UU[uU]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(UU.prototype);var WU=class extends vU{constructor(e){super(X.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};dU=Symbol.toStringTag,WU[dU]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(WU.prototype);var GU=class extends vU{constructor(e){super(X.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};fU=Symbol.toStringTag,GU[fU]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(GU.prototype);var KU=class extends vU{constructor(e,t,n){super(X.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};pU=Symbol.toStringTag,KU[pU]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(KU.prototype);var qU=class extends vU{constructor(e){super(X.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};mU=Symbol.toStringTag,qU[mU]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(qU.prototype);var JU=class extends vU{constructor(e,t){super(X.FixedSizeList),this.listSize=e,this.children=[t]}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}>`}};hU=Symbol.toStringTag,JU[hU]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(JU.prototype);var YU=class extends vU{constructor(e,t=!1){var n,r,i;if(super(X.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,(n=e?.type)?.children)){let t=(r=e?.type)?.children[0];t&&(t.name=`key`);let n=(i=e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};gU=Symbol.toStringTag,YU[gU]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(YU.prototype);const XU=(e=>()=>++e)(-1);var ZU=class extends vU{constructor(e,t,n,r){super(X.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?XU():FH(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};_U=Symbol.toStringTag,ZU[_U]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(ZU.prototype);function QU(e){let t=e;switch(e.typeId){case X.Decimal:return e.bitWidth/32;case X.Interval:return t.unit===AH.MONTH_DAY_NANO?4:1+t.unit;case X.FixedSizeList:return t.listSize;case X.FixedSizeBinary:return t.byteWidth;default:return 1}}var $U=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return eW(this,e,t)}getVisitFnByTypeId(e,t=!0){return tW(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}visitLargeUtf8(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(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}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function eW(e,t,n=!0){return typeof t==`number`?tW(e,t,n):typeof t==`string`&&t in X?tW(e,X[t],n):t&&t instanceof vU?tW(e,nW(t),n):t?.type&&t.type instanceof vU?tW(e,nW(t.type),n):tW(e,X.NONE,n)}function tW(e,t,n=!0){let r=null;switch(t){case X.Null:r=e.visitNull;break;case X.Bool:r=e.visitBool;break;case X.Int:r=e.visitInt;break;case X.Int8:r=e.visitInt8||e.visitInt;break;case X.Int16:r=e.visitInt16||e.visitInt;break;case X.Int32:r=e.visitInt32||e.visitInt;break;case X.Int64:r=e.visitInt64||e.visitInt;break;case X.Uint8:r=e.visitUint8||e.visitInt;break;case X.Uint16:r=e.visitUint16||e.visitInt;break;case X.Uint32:r=e.visitUint32||e.visitInt;break;case X.Uint64:r=e.visitUint64||e.visitInt;break;case X.Float:r=e.visitFloat;break;case X.Float16:r=e.visitFloat16||e.visitFloat;break;case X.Float32:r=e.visitFloat32||e.visitFloat;break;case X.Float64:r=e.visitFloat64||e.visitFloat;break;case X.Utf8:r=e.visitUtf8;break;case X.LargeUtf8:r=e.visitLargeUtf8;break;case X.Binary:r=e.visitBinary;break;case X.LargeBinary:r=e.visitLargeBinary;break;case X.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case X.Date:r=e.visitDate;break;case X.DateDay:r=e.visitDateDay||e.visitDate;break;case X.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case X.Timestamp:r=e.visitTimestamp;break;case X.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case X.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case X.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case X.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case X.Time:r=e.visitTime;break;case X.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case X.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case X.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case X.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case X.Decimal:r=e.visitDecimal;break;case X.List:r=e.visitList;break;case X.Struct:r=e.visitStruct;break;case X.Union:r=e.visitUnion;break;case X.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case X.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case X.Dictionary:r=e.visitDictionary;break;case X.Interval:r=e.visitInterval;break;case X.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case X.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case X.IntervalMonthDayNano:r=e.visitIntervalMonthDayNano||e.visitInterval;break;case X.Duration:r=e.visitDuration;break;case X.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case X.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case X.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case X.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case X.FixedSizeList:r=e.visitFixedSizeList;break;case X.Map:r=e.visitMap;break}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${X[t]}'`)}function nW(e){switch(e.typeId){case X.Null:return X.Null;case X.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?X.Int8:X.Uint8;case 16:return n?X.Int16:X.Uint16;case 32:return n?X.Int32:X.Uint32;case 64:return n?X.Int64:X.Uint64}return X.Int}case X.Float:switch(e.precision){case DH.HALF:return X.Float16;case DH.SINGLE:return X.Float32;case DH.DOUBLE:return X.Float64}return X.Float;case X.Binary:return X.Binary;case X.LargeBinary:return X.LargeBinary;case X.Utf8:return X.Utf8;case X.LargeUtf8:return X.LargeUtf8;case X.Bool:return X.Bool;case X.Decimal:return X.Decimal;case X.Time:switch(e.unit){case kH.SECOND:return X.TimeSecond;case kH.MILLISECOND:return X.TimeMillisecond;case kH.MICROSECOND:return X.TimeMicrosecond;case kH.NANOSECOND:return X.TimeNanosecond}return X.Time;case X.Timestamp:switch(e.unit){case kH.SECOND:return X.TimestampSecond;case kH.MILLISECOND:return X.TimestampMillisecond;case kH.MICROSECOND:return X.TimestampMicrosecond;case kH.NANOSECOND:return X.TimestampNanosecond}return X.Timestamp;case X.Date:switch(e.unit){case OH.DAY:return X.DateDay;case OH.MILLISECOND:return X.DateMillisecond}return X.Date;case X.Interval:switch(e.unit){case AH.DAY_TIME:return X.IntervalDayTime;case AH.YEAR_MONTH:return X.IntervalYearMonth;case AH.MONTH_DAY_NANO:return X.IntervalMonthDayNano}return X.Interval;case X.Duration:switch(e.unit){case kH.SECOND:return X.DurationSecond;case kH.MILLISECOND:return X.DurationMillisecond;case kH.MICROSECOND:return X.DurationMicrosecond;case kH.NANOSECOND:return X.DurationNanosecond}return X.Duration;case X.Map:return X.Map;case X.List:return X.List;case X.Struct:return X.Struct;case X.Union:switch(e.mode){case EH.Dense:return X.DenseUnion;case EH.Sparse:return X.SparseUnion}return X.Union;case X.FixedSizeBinary:return X.FixedSizeBinary;case X.FixedSizeList:return X.FixedSizeList;case X.Dictionary:return X.Dictionary}throw Error(`Unrecognized type '${X[e.typeId]}'`)}$U.prototype.visitInt8=null,$U.prototype.visitInt16=null,$U.prototype.visitInt32=null,$U.prototype.visitInt64=null,$U.prototype.visitUint8=null,$U.prototype.visitUint16=null,$U.prototype.visitUint32=null,$U.prototype.visitUint64=null,$U.prototype.visitFloat16=null,$U.prototype.visitFloat32=null,$U.prototype.visitFloat64=null,$U.prototype.visitDateDay=null,$U.prototype.visitDateMillisecond=null,$U.prototype.visitTimestampSecond=null,$U.prototype.visitTimestampMillisecond=null,$U.prototype.visitTimestampMicrosecond=null,$U.prototype.visitTimestampNanosecond=null,$U.prototype.visitTimeSecond=null,$U.prototype.visitTimeMillisecond=null,$U.prototype.visitTimeMicrosecond=null,$U.prototype.visitTimeNanosecond=null,$U.prototype.visitDenseUnion=null,$U.prototype.visitSparseUnion=null,$U.prototype.visitIntervalDayTime=null,$U.prototype.visitIntervalYearMonth=null,$U.prototype.visitIntervalMonthDayNano=null,$U.prototype.visitDuration=null,$U.prototype.visitDurationSecond=null,$U.prototype.visitDurationMillisecond=null,$U.prototype.visitDurationMicrosecond=null,$U.prototype.visitDurationNanosecond=null;var rW={};xt(rW,{float64ToUint16:()=>sW,uint16ToFloat64:()=>oW});const iW=new Float64Array(1),aW=new Uint32Array(iW.buffer);function oW(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function sW(e){if(e!==e)return 32256;iW[0]=e;let t=(aW[1]&2147483648)>>16&65535,n=aW[1]&2146435072,r=0;return n>=1089470464?aW[0]>0?n=31744:(n=(n&2080374784)>>16,r=(aW[1]&1048575)>>10):n<=1056964608?(r=1048576+(aW[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(aW[1]&1048575)+512>>10),t|n|r&65535}var cW=class extends $U{};function lW(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const uW=(e,t,n)=>{e[t]=Math.floor(n/864e5)},dW=(e,t,n,r)=>{if(n+1{let i=e+n;r?t[i>>3]|=1<>3]&=~(1<{e[t]=n},mW=({values:e},t,n)=>{e[t]=n},hW=({values:e},t,n)=>{e[t]=sW(n)},gW=(e,t,n)=>{switch(e.type.precision){case DH.HALF:return hW(e,t,n);case DH.SINGLE:case DH.DOUBLE:return mW(e,t,n)}},_W=({values:e},t,n)=>{uW(e,t,n.valueOf())},vW=({values:e},t,n)=>{e[t]=BigInt(n)},yW=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},bW=({values:e,valueOffsets:t},n,r)=>dW(e,t,n,r),xW=({values:e,valueOffsets:t},n,r)=>dW(e,t,n,MV(r)),SW=(e,t,n)=>{e.type.unit===OH.DAY?_W(e,t,n):vW(e,t,n)},CW=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},wW=({values:e},t,n)=>{e[t]=BigInt(n)},TW=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},EW=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},DW=(e,t,n)=>{switch(e.type.unit){case kH.SECOND:return CW(e,t,n);case kH.MILLISECOND:return wW(e,t,n);case kH.MICROSECOND:return TW(e,t,n);case kH.NANOSECOND:return EW(e,t,n)}},OW=({values:e},t,n)=>{e[t]=n},kW=({values:e},t,n)=>{e[t]=n},AW=({values:e},t,n)=>{e[t]=n},jW=({values:e},t,n)=>{e[t]=n},MW=(e,t,n)=>{switch(e.type.unit){case kH.SECOND:return OW(e,t,n);case kH.MILLISECOND:return kW(e,t,n);case kH.MICROSECOND:return AW(e,t,n);case kH.NANOSECOND:return jW(e,t,n)}},NW=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},PW=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=tG.getVisitFn(r);if(Array.isArray(n))for(let e=-1,o=i[t],s=i[t+1];o{let r=e.children[0],{valueOffsets:i}=e,a=tG.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},IW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),LW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),RW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),zW=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),BW=(e,t,n)=>{let r=e.type.children.map(e=>tG.getVisitFn(e.type)),i=n instanceof Map?RW(t,n):n instanceof iq?LW(t,n):Array.isArray(n)?IW(t,n):zW(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},VW=(e,t,n)=>{e.type.mode===EH.Dense?HW(e,t,n):UW(e,t,n)},HW=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];tG.visit(i,e.valueOffsets[t],n)},UW=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];tG.visit(i,t,n)},WW=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},GW=(e,t,n)=>{switch(e.type.unit){case AH.YEAR_MONTH:return qW(e,t,n);case AH.DAY_TIME:return KW(e,t,n);case AH.MONTH_DAY_NANO:return JW(e,t,n)}},KW=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},qW=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},JW=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},YW=({values:e},t,n)=>{e[t]=n},XW=({values:e},t,n)=>{e[t]=n},ZW=({values:e},t,n)=>{e[t]=n},QW=({values:e},t,n)=>{e[t]=n},$W=(e,t,n)=>{switch(e.type.unit){case kH.SECOND:return YW(e,t,n);case kH.MILLISECOND:return XW(e,t,n);case kH.MICROSECOND:return ZW(e,t,n);case kH.NANOSECOND:return QW(e,t,n)}},eG=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=tG.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e`${PH(e)}: ${PH(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new aG(this[nG],this[rG])}},aG=class{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(){let e=this.childIndex;return ee.name)}has(e,t){return e[nG].type.children.some(e=>e.name===t)}getOwnPropertyDescriptor(e,t){if(e[nG].type.children.some(e=>e.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[nG].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=$G.visit(e[nG].children[n],e[rG]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[nG].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(tG.visit(e[nG].children[r],e[rG],n),Reflect.set(e,t,n))}};const sG=new oG;var cG=class extends $U{};function lG(e){return(t,n)=>t.getValid(n)?e(t,n):null}const uG=(e,t)=>864e5*e[t],dG=(e,t)=>null,fG=(e,t,n)=>{if(n+1>=t.length)return null;let r=FH(t[n]),i=FH(t[n+1]);return e.subarray(r,i)},pG=({offset:e,values:t},n)=>{let r=e+n,i=t[r>>3];return(i&1<uG(e,t),hG=({values:e},t)=>FH(e[t]),gG=({stride:e,values:t},n)=>t[e*n],_G=({stride:e,values:t},n)=>oW(t[e*n]),vG=({values:e},t)=>e[t],yG=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),bG=({values:e,valueOffsets:t},n)=>fG(e,t,n),xG=({values:e,valueOffsets:t},n)=>{let r=fG(e,t,n);return r===null?null:AV(r)},SG=({values:e},t)=>e[t],CG=({type:e,values:t},n)=>e.precision===DH.HALF?oW(t[n]):t[n],wG=(e,t)=>e.type.unit===OH.DAY?mG(e,t):hG(e,t),TG=({values:e},t)=>1e3*FH(e[t]),EG=({values:e},t)=>FH(e[t]),DG=({values:e},t)=>IH(e[t],BigInt(1e3)),OG=({values:e},t)=>IH(e[t],BigInt(1e6)),kG=(e,t)=>{switch(e.type.unit){case kH.SECOND:return TG(e,t);case kH.MILLISECOND:return EG(e,t);case kH.MICROSECOND:return DG(e,t);case kH.NANOSECOND:return OG(e,t)}},AG=({values:e},t)=>e[t],jG=({values:e},t)=>e[t],MG=({values:e},t)=>e[t],NG=({values:e},t)=>e[t],PG=(e,t)=>{switch(e.type.unit){case kH.SECOND:return AG(e,t);case kH.MILLISECOND:return jG(e,t);case kH.MICROSECOND:return MG(e,t);case kH.NANOSECOND:return NG(e,t)}},FG=({values:e,stride:t},n)=>YH.decimal(e.subarray(t*n,t*(n+1))),IG=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:a,[t*r+1]:o}=n,s=i[0],c=s.slice(a,o-a);return new iq([c])},LG=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new iK(o.slice(i,a-i))},RG=(e,t)=>new iG(e,t),zG=(e,t)=>e.type.mode===EH.Dense?BG(e,t):VG(e,t),BG=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return $G.visit(r,e.valueOffsets[t])},VG=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return $G.visit(r,t)},HG=(e,t)=>{var n;return(n=e.dictionary)?.get(e.values[t])},UG=(e,t)=>e.type.unit===AH.MONTH_DAY_NANO?KG(e,t):e.type.unit===AH.DAY_TIME?WG(e,t):GG(e,t),WG=({values:e},t)=>e.subarray(2*t,2*(t+1)),GG=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},KG=({values:e},t)=>e.subarray(4*t,4*(t+1)),qG=({values:e},t)=>e[t],JG=({values:e},t)=>e[t],YG=({values:e},t)=>e[t],XG=({values:e},t)=>e[t],ZG=(e,t)=>{switch(e.type.unit){case kH.SECOND:return qG(e,t);case kH.MILLISECOND:return JG(e,t);case kH.MICROSECOND:return YG(e,t);case kH.NANOSECOND:return XG(e,t)}},QG=(e,t)=>{let{stride:n,children:r}=e,i=r[0],a=i.slice(t*n,n);return new iq([a])};cG.prototype.visitNull=lG(dG),cG.prototype.visitBool=lG(pG),cG.prototype.visitInt=lG(SG),cG.prototype.visitInt8=lG(gG),cG.prototype.visitInt16=lG(gG),cG.prototype.visitInt32=lG(gG),cG.prototype.visitInt64=lG(vG),cG.prototype.visitUint8=lG(gG),cG.prototype.visitUint16=lG(gG),cG.prototype.visitUint32=lG(gG),cG.prototype.visitUint64=lG(vG),cG.prototype.visitFloat=lG(CG),cG.prototype.visitFloat16=lG(_G),cG.prototype.visitFloat32=lG(gG),cG.prototype.visitFloat64=lG(gG),cG.prototype.visitUtf8=lG(xG),cG.prototype.visitLargeUtf8=lG(xG),cG.prototype.visitBinary=lG(bG),cG.prototype.visitLargeBinary=lG(bG),cG.prototype.visitFixedSizeBinary=lG(yG),cG.prototype.visitDate=lG(wG),cG.prototype.visitDateDay=lG(mG),cG.prototype.visitDateMillisecond=lG(hG),cG.prototype.visitTimestamp=lG(kG),cG.prototype.visitTimestampSecond=lG(TG),cG.prototype.visitTimestampMillisecond=lG(EG),cG.prototype.visitTimestampMicrosecond=lG(DG),cG.prototype.visitTimestampNanosecond=lG(OG),cG.prototype.visitTime=lG(PG),cG.prototype.visitTimeSecond=lG(AG),cG.prototype.visitTimeMillisecond=lG(jG),cG.prototype.visitTimeMicrosecond=lG(MG),cG.prototype.visitTimeNanosecond=lG(NG),cG.prototype.visitDecimal=lG(FG),cG.prototype.visitList=lG(IG),cG.prototype.visitStruct=lG(RG),cG.prototype.visitUnion=lG(zG),cG.prototype.visitDenseUnion=lG(BG),cG.prototype.visitSparseUnion=lG(VG),cG.prototype.visitDictionary=lG(HG),cG.prototype.visitInterval=lG(UG),cG.prototype.visitIntervalDayTime=lG(WG),cG.prototype.visitIntervalYearMonth=lG(GG),cG.prototype.visitIntervalMonthDayNano=lG(KG),cG.prototype.visitDuration=lG(ZG),cG.prototype.visitDurationSecond=lG(qG),cG.prototype.visitDurationMillisecond=lG(JG),cG.prototype.visitDurationMicrosecond=lG(YG),cG.prototype.visitDurationNanosecond=lG(XG),cG.prototype.visitFixedSizeList=lG(QG),cG.prototype.visitMap=lG(LG);const $G=new cG,eK=Symbol.for(`keys`),tK=Symbol.for(`vals`),nK=Symbol.for(`kKeysAsStrings`),rK=Symbol.for(`_kKeysAsStrings`);var iK=class{constructor(e){return this[eK]=new iq([e.children[0]]).memoize(),this[tK]=e.children[1],new Proxy(this,new oK)}get[nK](){return this[rK]||(this[rK]=Array.from(this[eK].toArray(),String))}[Symbol.iterator](){return new aK(this[eK],this[tK])}get size(){return this[eK].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[eK],t=this[tK],n={};for(let r=-1,i=e.length;++r`${PH(e)}: ${PH(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},aK=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),$G.visit(this.vals,e)]})}},oK=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[nK]}has(e,t){return e[nK].includes(t)}getOwnPropertyDescriptor(e,t){let n=e[nK].indexOf(t);if(n!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[nK].indexOf(t);if(n!==-1){let r=$G.visit(Reflect.get(e,tK),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[nK].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(tG.visit(Reflect.get(e,tK),r,n),Reflect.set(e,t,n))}};Object.defineProperties(iK.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[eK]:{writable:!0,enumerable:!1,configurable:!1,value:null},[tK]:{writable:!0,enumerable:!1,configurable:!1,value:null},[rK]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var sK={};xt(sK,{clampRange:()=>lK,createElementComparator:()=>fK,wrapIndex:()=>uK});let cK;function lK(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(e,a,o):[a,o]}const uK=(e,t)=>e<0?t+e:e,dK=e=>e!==e;function fK(e){let t=typeof e;if(t!==`object`||e===null)return dK(e)?dK:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date?e.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?TH(e,t):!1:e instanceof Map?mK(e):Array.isArray(e)?pK(e):e instanceof iq?hK(e):gK(e,!0)}function pK(e){let t=[];for(let n=-1,r=e.length;++n!1;let r=[];for(let t=-1,i=n.length;++t{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return vK(e,n);case Map:return bK(e,n,n.keys());case iK:case iG:case Object:case void 0:return bK(e,n,t||Object.keys(n))}return n instanceof iq?yK(e,n):!1}}function vK(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++rDK,getBit:()=>CK,getBool:()=>SK,packBools:()=>EK,popcnt_array:()=>kK,popcnt_bit_range:()=>OK,popcnt_uint32:()=>AK,setBool:()=>wK,truncateBitmap:()=>TK});function SK(e,t,n,r){return(n&1<>r}function wK(e,t,n){return n?!!(e[t>>3]|=1<>3]&=~(1<0||n.byteLength>3):EK(new DK(n,e,t,null,SK)).subarray(0,r)),i}return n}function EK(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var DK=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8==0?0:8-t%8);return OK(e,t,i)+OK(e,r,n)+kK(e,i>>3,r-i>>3)}function kK(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=AK(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=AK(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=AK(a.getUint8(i)),i+=1;return r}function AK(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const jK=-1;var MK=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:e}=this;return vU.isSparseUnion(e)||vU.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(vU.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=jK&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-OK(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets):(this.stride=QU(t),a&&((c=a[0])&&(this.valueOffsets=c),(c=a[1])&&(this.values=c),(c=a[2])&&(this.nullBitmap=c),(c=a[3])&&(this.typeIds=c)))}getValid(e){let{type:t}=this;if(vU.isUnion(t)){let n=t,r=this.children[n.typeIdToChildIndex[this.typeIds[e]]],i=n.mode===EH.Dense?this.valueOffsets[e]:e;return r.getValid(i)}if(this.nullable&&this.nullCount>0){let t=this.offset+e,n=this.nullBitmap[t>>3];return(n&1<>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(TK(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children){return new e(t,n,r,i,a,o,this.dictionary)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===X.Null)return this.clone(this.type,0,e,0);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<0&&r.set(TK(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[jH.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;return(i=a[jH.TYPE])&&(a[jH.TYPE]=i.subarray(e,e+t)),(i=a[jH.OFFSET])&&(a[jH.OFFSET]=i.subarray(e,e+t+1))||(i=a[jH.DATA])&&(a[jH.DATA]=r===6?i:i.subarray(n*e,n*(e+t))),a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};MK.prototype.children=Object.freeze([]);var NK=class e extends $U{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new MK(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=JV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=YV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=JV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=XV(e.data),i=XV(e.nullBitmap),a=YV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=XV(e.nullBitmap),a=JV(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new MK(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=XV(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=GV(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;if(vU.isSparseUnion(t))return new MK(t,n,a,o,[void 0,void 0,void 0,i],r);let s=JV(e.valueOffsets);return new MK(t,n,a,o,[s,void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=XV(t.nullBitmap),a=GV(n.indices.ArrayType,t.data),{dictionary:o=new iq([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new MK(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length/QU(t),nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=XV(e.nullBitmap),i=GV(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new MK(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=XV(t.nullBitmap),{length:o=i.length/QU(n),nullCount:s=t.nullBitmap?-1:0}=t;return new MK(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=XV(t.nullBitmap),o=JV(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new MK(n,r,s,c,[o,void 0,a],[i])}};const PK=new NK;var FK=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function LK(e){return e.reduce((e,t)=>e+t.nullCount,0)}function RK(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function zK(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function BK(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n0?0:-1}function qK(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new DK(n,e.offset+(t||0),e.length,n,SK)){if(!i)return r;++r}return-1}function JK(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case X.Union:break;case X.Dictionary:break;default:return qK(e,n)}let r=$G.getVisitFn(e),i=fK(t);for(let t=(n||0)-1,a=e.length;++t{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new FK(e.data.length,t=>{let r=e.data[t],i=r.length,a=e.slice(n,n+i);return n+=i,new $K(a)})}var $K=class{constructor(e){this.vector=e,this.index=0}next(){return this.indexe.data):t;if(a.length===0||a.some(e=>!(e instanceof MK)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let o=(n=a[0])?.type;switch(a.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:n}=nq[o.typeId],r=a[0];this.isValid=e=>VK(r,e),this.get=t=>e(r,t),this.set=(e,n)=>t(r,e,n),this.indexOf=e=>n(r,e),this._offsets=[0,r.length];break}default:Object.setPrototypeOf(this,rq[o.typeId]),this._offsets=RK(a);break}this.data=a,this.type=o,this.stride=QU(o),this.numChildren=(i=(r=o.children)?.length)??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return IK(this.data)}get nullCount(){return LK(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${X[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(uK(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return eq.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(lK(this,t,n,({data:e,_offsets:t},n,r)=>zK(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case X.Int:case X.Float:case X.Decimal:case X.Time:case X.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){var t;return this.getChildAt((t=this.type.children)?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return vU.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(vU.isDictionary(this.type)){let t=new aq(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new aq(this)}unmemoize(){if(vU.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};tq=Symbol.toStringTag,iq[tq]=(e=>{e.type=vU.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(X).map(e=>X[e]).filter(e=>typeof e==`number`&&e!==X.NONE);for(let n of t){let t=$G.getVisitFnByTypeId(n),r=tG.getVisitFnByTypeId(n),i=XK.getVisitFnByTypeId(n);nq[n]={get:t,set:r,indexOf:i},rq[n]=Object.create(e,{isValid:{value:HK(VK)},get:{value:HK($G.getVisitFnByTypeId(n))},set:{value:UK(tG.getVisitFnByTypeId(n))},indexOf:{value:WK(XK.getVisitFnByTypeId(n))}})}return`Vector`})(iq.prototype);var aq=class e extends iq{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,`get`,{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,`set`,{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,`slice`,{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,`isMemoized`,{value:!0}),Object.defineProperty(this,`unmemoize`,{value:()=>new iq(this.data)}),Object.defineProperty(this,`memoize`,{value:()=>this})}},oq={};xt(oq,{BaseInt64:()=>dq,Int128:()=>mq,Int64:()=>pq,Uint64:()=>fq});const sq=65536;function cq(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const lq=8,uq=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];var dq=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]>>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]>>0&&++t[1],t[1]>>0&&++t[2],t[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`${cq(this.buffer[3])} ${cq(this.buffer[2])} ${cq(this.buffer[1])} ${cq(this.buffer[0])}`}static multiply(t,n){let r=new e(new Uint32Array(t.buffer));return r.times(n)}static add(t,n){let r=new e(new Uint32Array(t.buffer));return r.plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=r?1:0;ngq,toIntervalDayTimeObjects:()=>vq,toIntervalMonthDayNanoInt32Array:()=>_q,toIntervalMonthDayNanoObjects:()=>yq});function gq(e){var t,n;let r=e.length,i=new Int32Array(r*2);for(let a=0,o=0;a>BigInt(32))):o+=2}return i}function vq(e){let t=e.length,n=Array(t/2);for(let r=0,i=0;r>>0);r[a++]={months:e[i],days:e[i+1],nanoseconds:t?`${n}`:n}}return r}var bq=class extends $U{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((e,n)=>this.compareFields(e,t[n]))}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 xq(e,t){return t instanceof e.constructor}function Sq(e,t){return e===t||xq(e,t)}function Cq(e,t){return e===t||xq(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function wq(e,t){return e===t||xq(e,t)&&e.precision===t.precision}function Tq(e,t){return e===t||xq(e,t)&&e.byteWidth===t.byteWidth}function Eq(e,t){return e===t||xq(e,t)&&e.unit===t.unit}function Dq(e,t){return e===t||xq(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Oq(e,t){return e===t||xq(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function kq(e,t){return e===t||xq(e,t)&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}function Aq(e,t){return e===t||xq(e,t)&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}function jq(e,t){return e===t||xq(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&Lq.compareManyFields(e.children,t.children)}function Mq(e,t){return e===t||xq(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Lq.visit(e.indices,t.indices)&&Lq.visit(e.dictionary,t.dictionary)}function Nq(e,t){return e===t||xq(e,t)&&e.unit===t.unit}function Pq(e,t){return e===t||xq(e,t)&&e.unit===t.unit}function Fq(e,t){return e===t||xq(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}function Iq(e,t){return e===t||xq(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Lq.compareManyFields(e.children,t.children)}bq.prototype.visitNull=Sq,bq.prototype.visitBool=Sq,bq.prototype.visitInt=Cq,bq.prototype.visitInt8=Cq,bq.prototype.visitInt16=Cq,bq.prototype.visitInt32=Cq,bq.prototype.visitInt64=Cq,bq.prototype.visitUint8=Cq,bq.prototype.visitUint16=Cq,bq.prototype.visitUint32=Cq,bq.prototype.visitUint64=Cq,bq.prototype.visitFloat=wq,bq.prototype.visitFloat16=wq,bq.prototype.visitFloat32=wq,bq.prototype.visitFloat64=wq,bq.prototype.visitUtf8=Sq,bq.prototype.visitLargeUtf8=Sq,bq.prototype.visitBinary=Sq,bq.prototype.visitLargeBinary=Sq,bq.prototype.visitFixedSizeBinary=Tq,bq.prototype.visitDate=Eq,bq.prototype.visitDateDay=Eq,bq.prototype.visitDateMillisecond=Eq,bq.prototype.visitTimestamp=Dq,bq.prototype.visitTimestampSecond=Dq,bq.prototype.visitTimestampMillisecond=Dq,bq.prototype.visitTimestampMicrosecond=Dq,bq.prototype.visitTimestampNanosecond=Dq,bq.prototype.visitTime=Oq,bq.prototype.visitTimeSecond=Oq,bq.prototype.visitTimeMillisecond=Oq,bq.prototype.visitTimeMicrosecond=Oq,bq.prototype.visitTimeNanosecond=Oq,bq.prototype.visitDecimal=Sq,bq.prototype.visitList=kq,bq.prototype.visitStruct=Aq,bq.prototype.visitUnion=jq,bq.prototype.visitDenseUnion=jq,bq.prototype.visitSparseUnion=jq,bq.prototype.visitDictionary=Mq,bq.prototype.visitInterval=Nq,bq.prototype.visitIntervalDayTime=Nq,bq.prototype.visitIntervalYearMonth=Nq,bq.prototype.visitIntervalMonthDayNano=Nq,bq.prototype.visitDuration=Pq,bq.prototype.visitDurationSecond=Pq,bq.prototype.visitDurationMillisecond=Pq,bq.prototype.visitDurationMicrosecond=Pq,bq.prototype.visitDurationNanosecond=Pq,bq.prototype.visitFixedSizeList=Fq,bq.prototype.visitMap=Iq;const Lq=new bq;function Rq(e,t){return Lq.compareSchemas(e,t)}function zq(e,t){return Lq.compareFields(e,t)}function Bq(e,t){return Lq.visit(e,t)}const Vq=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},LH),oq),xK),rW),BV),sK),MH),hq),{compareSchemas:Rq,compareFields:zq,compareTypes:Bq}),Hq=365.2425,Uq=10**8*24*60*60*1e3,Wq=6048e5,Gq=864e5,Kq=3600,qq=Kq*24,Jq=qq*7,Yq=qq*Hq,Xq=Yq/12,Zq=Xq*3,Qq=Symbol.for(`constructDateFrom`);function $q(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Qq in e?e[Qq](t):e instanceof Date?new e.constructor(t):new Date(t)}function eJ(e,t){return $q(t||e,e)}let tJ={};function nJ(){return tJ}function rJ(e,t){var n,r;let i=nJ(),a=t?.weekStartsOn??(t==null||(n=t.locale)==null||(n=n.options)==null?void 0:n.weekStartsOn)??i.weekStartsOn??((r=i.locale)==null||(r=r.options)==null?void 0:r.weekStartsOn)??0,o=eJ(e,t?.in),s=o.getDay(),c=(s=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function oJ(e){let t=eJ(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function sJ(e,...t){let n=$q.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function cJ(e,t){let n=eJ(e,t?.in);return n.setHours(0,0,0,0),n}function lJ(e,t,n){let[r,i]=sJ(n?.in,e,t),a=cJ(r),o=cJ(i),s=+a-oJ(a),c=+o-oJ(o);return Math.round((s-c)/Gq)}function uJ(e,t){let n=aJ(e,t),r=$q(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),iJ(r)}function dJ(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function fJ(e){return!(!dJ(e)&&typeof e!=`number`||isNaN(+eJ(e)))}function pJ(e,t){let n=eJ(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const mJ={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},hJ=(e,t,n)=>{let r,i=mJ[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function gJ(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}const _J={full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},vJ={full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},yJ={full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},bJ={date:gJ({formats:_J,defaultWidth:`full`}),time:gJ({formats:vJ,defaultWidth:`full`}),dateTime:gJ({formats:yJ,defaultWidth:`full`})},xJ={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},SJ=(e,t,n,r)=>xJ[e];function CJ(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const wJ={narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},TJ={narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},EJ={narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},DJ={narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},OJ={narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},kJ={narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},AJ=(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},jJ={ordinalNumber:AJ,era:CJ({values:wJ,defaultWidth:`wide`}),quarter:CJ({values:TJ,defaultWidth:`wide`,argumentCallback:e=>e-1}),month:CJ({values:EJ,defaultWidth:`wide`}),day:CJ({values:DJ,defaultWidth:`wide`}),dayPeriod:CJ({values:OJ,defaultWidth:`wide`,formattingValues:kJ,defaultFormattingWidth:`wide`})};function MJ(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?PJ(s,e=>e.test(o)):NJ(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function NJ(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function PJ(e,t){for(let n=0;n{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const IJ=/^(\d+)(th|st|nd|rd)?/i,LJ=/\d+/i,RJ={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},zJ={any:[/^b/i,/^(a|c)/i]},BJ={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},VJ={any:[/1/i,/2/i,/3/i,/4/i]},HJ={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},UJ={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},WJ={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},GJ={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},KJ={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},qJ={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},JJ={ordinalNumber:FJ({matchPattern:IJ,parsePattern:LJ,valueCallback:e=>parseInt(e,10)}),era:MJ({matchPatterns:RJ,defaultMatchWidth:`wide`,parsePatterns:zJ,defaultParseWidth:`any`}),quarter:MJ({matchPatterns:BJ,defaultMatchWidth:`wide`,parsePatterns:VJ,defaultParseWidth:`any`,valueCallback:e=>e+1}),month:MJ({matchPatterns:HJ,defaultMatchWidth:`wide`,parsePatterns:UJ,defaultParseWidth:`any`}),day:MJ({matchPatterns:WJ,defaultMatchWidth:`wide`,parsePatterns:GJ,defaultParseWidth:`any`}),dayPeriod:MJ({matchPatterns:KJ,defaultMatchWidth:`any`,parsePatterns:qJ,defaultParseWidth:`any`})},YJ={code:`en-US`,formatDistance:hJ,formatLong:bJ,formatRelative:SJ,localize:jJ,match:JJ,options:{weekStartsOn:0,firstWeekContainsDate:1}};function XJ(e,t){let n=eJ(e,t?.in),r=lJ(n,pJ(n)),i=r+1;return i}function ZJ(e,t){let n=eJ(e,t?.in),r=iJ(n)-+uJ(n);return Math.round(r/Wq)+1}function QJ(e,t){var n,r;let i=eJ(e,t?.in),a=i.getFullYear(),o=nJ(),s=t?.firstWeekContainsDate??(t==null||(n=t.locale)==null||(n=n.options)==null?void 0:n.firstWeekContainsDate)??o.firstWeekContainsDate??((r=o.locale)==null||(r=r.options)==null?void 0:r.firstWeekContainsDate)??1,c=$q(t?.in||e,0);c.setFullYear(a+1,0,s),c.setHours(0,0,0,0);let l=rJ(c,t),u=$q(t?.in||e,0);u.setFullYear(a,0,s),u.setHours(0,0,0,0);let d=rJ(u,t);return+i>=+l?a+1:+i>=+d?a:a-1}function $J(e,t){var n,r;let i=nJ(),a=t?.firstWeekContainsDate??(t==null||(n=t.locale)==null||(n=n.options)==null?void 0:n.firstWeekContainsDate)??i.firstWeekContainsDate??((r=i.locale)==null||(r=r.options)==null?void 0:r.firstWeekContainsDate)??1,o=QJ(e,t),s=$q(t?.in||e,0);s.setFullYear(o,0,a),s.setHours(0,0,0,0);let c=rJ(s,t);return c}function eY(e,t){let n=eJ(e,t?.in),r=rJ(n,t)-+$J(n,t);return Math.round(r/Wq)+1}function tY(e,t){let n=e<0?`-`:``,r=Math.abs(e).toString().padStart(t,`0`);return n+r}const nY={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return tY(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):tY(n+1,2)},d(e,t){return tY(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];case`aaaa`:default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return tY(e.getHours()%12||12,t.length)},H(e,t){return tY(e.getHours(),t.length)},m(e,t){return tY(e.getMinutes(),t.length)},s(e,t){return tY(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*10**(n-3));return tY(i,t.length)}},rY={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},iY={G:function(e,t,n){let r=e.getFullYear()>0?1:0;switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});case`GGGG`:default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return nY.y(e,t)},Y:function(e,t,n,r){let i=QJ(e,r),a=i>0?i:1-i;if(t===`YY`){let e=a%100;return tY(e,2)}return t===`Yo`?n.ordinalNumber(a,{unit:`year`}):tY(a,t.length)},R:function(e,t){let n=aJ(e);return tY(n,t.length)},u:function(e,t){let n=e.getFullYear();return tY(n,t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return tY(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});case`QQQQ`:default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return tY(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});case`qqqq`:default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return nY.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});case`MMMM`:default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return tY(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});case`LLLL`:default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=eY(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):tY(i,t.length)},I:function(e,t,n){let r=ZJ(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):tY(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):nY.d(e,t)},D:function(e,t,n){let r=XJ(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):tY(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});case`EEEE`:default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return tY(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});case`eeee`:default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return tY(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});case`cccc`:default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return tY(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});case`iiii`:default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours(),i=r/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`aaaa`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?rY.noon:r===0?rY.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`bbbb`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?rY.evening:r>=12?rY.afternoon:r>=4?rY.morning:rY.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`BBBB`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return nY.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):nY.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):tY(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):tY(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):nY.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):nY.s(e,t)},S:function(e,t){return nY.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return oY(r);case`XXXX`:case`XX`:return sY(r);case`XXXXX`:case`XXX`:default:return sY(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return oY(r);case`xxxx`:case`xx`:return sY(r);case`xxxxx`:case`xxx`:default:return sY(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+aY(r,`:`);case`OOOO`:default:return`GMT`+sY(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+aY(r,`:`);case`zzzz`:default:return`GMT`+sY(r,`:`)}},t:function(e,t,n){let r=Math.trunc(e/1e3);return tY(r,t.length)},T:function(e,t,n){return tY(+e,t.length)}};function aY(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+tY(a,2)}function oY(e,t){if(e%60==0){let t=e>0?`-`:`+`;return t+tY(Math.abs(e)/60,2)}return sY(e,t)}function sY(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=tY(Math.trunc(r/60),2),a=tY(r%60,2);return n+i+t+a}const cY=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});case`PPPP`:default:return t.date({width:`full`})}},lY=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});case`pppp`:default:return t.time({width:`full`})}},uY=(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return cY(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;case`PPPP`:default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,cY(r,t)).replace(`{{time}}`,lY(i,t))},dY={p:lY,P:uY},fY=/^D+$/,pY=/^Y+$/,mY=[`D`,`DD`,`YY`,`YYYY`];function hY(e){return fY.test(e)}function gY(e){return pY.test(e)}function _Y(e,t,n){let r=vY(e,t,n);if(console.warn(r),mY.includes(e))throw RangeError(r)}function vY(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const yY=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,bY=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,xY=/^'([^]*?)'?$/,SY=/''/g,CY=/[a-zA-Z]/;function wY(e,t,n){var r,i,a,o;let s=nJ(),c=n?.locale??s.locale??YJ,l=n?.firstWeekContainsDate??(n==null||(r=n.locale)==null||(r=r.options)==null?void 0:r.firstWeekContainsDate)??s.firstWeekContainsDate??((i=s.locale)==null||(i=i.options)==null?void 0:i.firstWeekContainsDate)??1,u=n?.weekStartsOn??(n==null||(a=n.locale)==null||(a=a.options)==null?void 0:a.weekStartsOn)??s.weekStartsOn??((o=s.locale)==null||(o=o.options)==null?void 0:o.weekStartsOn)??0,d=eJ(e,n?.in);if(!fJ(d))throw RangeError(`Invalid time value`);let f=t.match(bY).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=dY[t];return n(e,c.formatLong)}return e}).join(``).match(yY).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:TY(e)};if(iY[t])return{isToken:!0,value:e};if(t.match(CY))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});c.localize.preprocessor&&(f=c.localize.preprocessor(d,f));let p={firstWeekContainsDate:l,weekStartsOn:u,locale:c};return f.map(r=>{if(!r.isToken)return r.value;let i=r.value;(!n?.useAdditionalWeekYearTokens&&gY(i)||!n?.useAdditionalDayOfYearTokens&&hY(i))&&_Y(i,t,String(e));let a=iY[i[0]];return a(d,i,c.localize,p)}).join(``)}function TY(e){let t=e.match(xY);return t?t[1].replace(SY,`'`):e}function EY(e,t){return eJ(e*1e3,t?.in)}function DY(e,t){let n=OY(t)?new t(0):$q(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function OY(e){var t;return typeof e==`function`&&(t=e.prototype)?.constructor===e}function kY(e,t){if(t===void 0)return e.trimEnd();let n=e.length;switch(typeof t){case`string`:if(t.length!==1)throw Error(`The 'chars' parameter should be a single character string.`);for(;n>0&&e[n-1]===t;)n--;break;case`object`:for(;n>0&&t.includes(e[n-1]);)n--}return e.substring(0,n)}function AY(e){return e==null}function jY(e){return e!=null}async function MY(){if(typeof window<`u`&&window!==null)return`browser`;try{let e=await Et(()=>import(`./__vite-browser-external-CubORAmj.js`).then(wt(1)),__vite__mapDeps([0,1,2,3]));return e!==void 0&&e.versions!=null&&e.versions.node!=null?`node`:`unknown`}catch{return`unknown`}}function NY(e){return AY(e)?!1:vU.isInt(e.type)&&!zY(e)||PY(e)}function PY(e){return AY(e)?!1:vU.isInt(e.type)&&e.type.isSigned===!1}function FY(e){return AY(e)?!1:vU.isFloat(e.type)??!1}function IY(e){return AY(e)?!1:vU.isDecimal(e.type)}function LY(e){return AY(e)?!1:vU.isBool(e.type)}function RY(e){return AY(e)?!1:vU.isDuration(e.type)}function zY(e){return AY(e)?!1:vU.isInt(e.type)&&e.metadata.get(`ARROW:extension:name`)===`period`}function BY(e){return AY(e)?!1:vU.isTimestamp(e.type)}function VY(e){return AY(e)?!1:vU.isDate(e.type)}function HY(e){return AY(e)?!1:vU.isTime(e.type)}function UY(e){return AY(e)?!1:vU.isList(e.type)||vU.isFixedSizeList(e.type)}function WY(e){return AY(e)?!1:vU.isStruct(e.type)||vU.isMap(e.type)}function GY(e){return AY(e)?!1:vU.isStruct(e.type)&&e.metadata.get(`ARROW:extension:name`)===`interval`||vU.isInterval(e.type)}const KY=new Date(1970,0,1);function qY(e,t){let n;if(t===kH.MILLISECOND)n=1e3;else if(t===kH.MICROSECOND)n=1e3*1e3;else if(t===kH.NANOSECOND)n=1e3*1e3*1e3;else return Number(e);return typeof e==`bigint`&&!Number.isSafeInteger(Number(e))?Number(e/BigInt(n)):Number(e)/n}function JY(e,t){var n;let r=qY(e,(t==null||(n=t.type)==null?void 0:n.unit)??kH.SECOND);return EY(r)}function YY(e,t){let n=JY(e,t);return wY(n,n.getMilliseconds()===0?`HH:mm:ss`:`HH:mm:ss.SSS`)}function XY(e){let t=`yyyy-MM-dd`;return e instanceof Date||typeof e==`number`&&Number.isFinite(e)?wY(e,t):(console.warn(`Unsupported date value: ${e}`),String(e))}function ZY(e,t){var n;if(!(e instanceof Date||typeof e==`number`&&Number.isFinite(e)))return console.warn(`Unsupported datetime value: ${e}`),null;let r,i=t==null||(n=t.type)==null?void 0:n.timezone;return r=i?new SV(e,i):new SV(e),DY(r,Date)}function QY(e,t){var n;let r=(t==null||(n=t.type)==null?void 0:n.scale)||0,i=Vq.bigNumToString(new Vq.BN(e)).padStart(r,`0`);if(r===0)return i;let a=``;i.startsWith(`-`)&&(a=`-`,i=i.slice(1));let o=i.slice(0,-r)||`0`,s=kY(i.slice(-r),`0`)||``;return`${a}${o}${s?`.${s}`:``}`}const $Y=new Intl.NumberFormat(`en-US`,{style:`decimal`,maximumFractionDigits:4,minimumFractionDigits:4,useGrouping:!0});function eX(e){let t=e[0],n=e[1],r=[];return t!==0&&r.push(`${t} year${t>1?`s`:``}`),n!==0&&r.push(`${n} month${n>1?`s`:``}`),r.length?r.join(` `):`0 months`}function tX(e,t){if(vU.isInterval(t?.type))return eX(e);let n=t&&t.metadata.get(`ARROW:extension:name`);if(n&&n===`pandas.interval`){var r,i;let n=JSON.parse(t.metadata.get(`ARROW:extension:metadata`)),{closed:a}=n,o=e.toJSON(),s=a===`both`||a===`left`?`[`:`(`,c=a===`both`||a===`right`?`]`:`)`,l=rX(o.left,(r=t.type)==null||(r=r.children)==null?void 0:r[0]),u=rX(o.right,(i=t.type)==null||(i=i.children)==null?void 0:i[1]);return`${s+l}, ${u+c}`}return String(e)}function nX(e,t){return t?.type instanceof GU?JSON.parse(JSON.stringify(e,(e,t)=>{if(jY(t))return typeof t==`bigint`?Number(t):t})):JSON.parse(JSON.stringify(e,(e,t)=>typeof t==`bigint`?Number(t):t))}function rX(e,t){if(AY(e))return null;let n=e instanceof Date||Number.isFinite(e);if(n&&VY(t))return XY(e);if(typeof e==`bigint`&&HY(t))return YY(Number(e),t);if(n&&BY(t))return ZY(e,t);if(zY(t))throw Error(`Period type is not supported yet`);if(GY(t))return tX(e,t);if(RY(t))throw Error(`Duration type is not supported yet`);return IY(t)?QY(e,t):FY(t)&&Number.isFinite(e)||NY(t)?e:WY(t)||UY(t)?nX(e,t):LY(t)?!!e:String(e)}function iX(e){let t=(e.toArray()||[]).map(e=>e.toJSON())||[],n=t.map(t=>(e.schema.fields.forEach(e=>t[e.name]=rX(t[e.name],e)),t));return n}let aX=function(e){return e.ORIGIN_PRIVATE_FS=`origin-private-fs`,e.NODE_FS=`node-fs`,e}({});async function oX(e){let t=Nt(e,{logger:!1}),n,r,i=await MY();if(i===`browser`){if(t.bundles===void 0){let{getBundles:e}=await Et(async()=>{let{getBundles:e}=await import(`./default-browser-DTRWbcB3.js`);return{getBundles:e}},[]);t.bundles=await e()}r=await mV(await t.bundles),n=new Worker(r.mainWorker)}else if(i===`node`){if(t.bundles===void 0){let{getBundles:e}=await Et(async()=>{let{getBundles:e}=await import(`./default-node-G9zSbWb2.js`);return{getBundles:e}},__vite__mapDeps([4,2,3]));t.bundles=await e()}r=await mV(await t.bundles);let e=r.mainWorker;e.startsWith(`/@fs/`)&&(e=e.replace(`/@fs/`,`file://`));let i=await Et(()=>import(`./browser-CMSJHaBF.js`),[]);n=new i.default(e,{type:`module`})}else throw Error(`Unsupported environment: ${i}`);let a;a=t.logger===!0?new MB:t.logger===!1?new jB:t.logger;let o=new UB(a,n);if(await o.instantiate(r.mainModule,r.pthreadWorker),t.storage)switch(t.storage.type){case aX.ORIGIN_PRIVATE_FS:try{let e=t.storage.path;e.startsWith(`/`)&&(e=e.slice(1)),await o.open({path:`opfs://${e}`,accessMode:t.storage.accessMode})}catch(e){throw await o.terminate(),await n.terminate(),e}break;case aX.NODE_FS:try{await o.open({path:t.storage.path,accessMode:t.storage.accessMode,useDirectIO:!0})}catch(e){throw await o.terminate(),await n.terminate(),e}break}let s=await o.connect();async function c(e,t=[]){if(!t||t.length===0){let t=await s.query(e);return{_results:t,_schema:t.schema,columns:t.schema.fields,rows:iX(t)}}let n=await s.prepare(e),r=await n.query(...t);return n.close(),{_results:r,_schema:r.schema,columns:r.schema.fields,rows:iX(r)}}return{worker:n,db:o,conn:s,query:async(e,t=[])=>c(e,t).then(e=>e.rows),queryWithColumns:async(e,t=[])=>c(e,t),close:async()=>{await s.close(),await o.terminate(),await n.terminate()}}}async function sX(e,t){await(await e).conn.send(`BEGIN TRANSACTION`);try{let n=await t(e);return await(await e).conn.send(`COMMIT`),n}catch(t){throw await(await e).conn.send(`ROLLBACK`),t}}async function cX(e,t,n){await(await e).conn.send(`SAVEPOINT ${t}`);try{let r=await n(e);return await(await e).conn.send(`RELEASE SAVEPOINT ${t}`),r}catch(n){throw await(await e).conn.send(`ROLLBACK TO SAVEPOINT ${t}`),n}}const Z=Symbol.for(`drizzle:entityKind`),lX=Symbol.for(`drizzle:hasOwnEntityKind`);function Q(e,t){if(!e||typeof e!=`object`)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,Z))throw Error(`Class "${t.name??``}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(Z in n&&n[Z]===t[Z])return!0;n=Object.getPrototypeOf(n)}return!1}var uX=(pr=class{constructor(t,n){e.defineProperty(this,`name`,void 0),e.defineProperty(this,`keyAsName`,void 0),e.defineProperty(this,`primary`,void 0),e.defineProperty(this,`notNull`,void 0),e.defineProperty(this,`default`,void 0),e.defineProperty(this,`defaultFn`,void 0),e.defineProperty(this,`onUpdateFn`,void 0),e.defineProperty(this,`hasDefault`,void 0),e.defineProperty(this,`isUnique`,void 0),e.defineProperty(this,`uniqueName`,void 0),e.defineProperty(this,`uniqueType`,void 0),e.defineProperty(this,`dataType`,void 0),e.defineProperty(this,`columnType`,void 0),e.defineProperty(this,`enumValues`,void 0),e.defineProperty(this,`generated`,void 0),e.defineProperty(this,`generatedIdentity`,void 0),e.defineProperty(this,`config`,void 0),this.table=t,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!==`byDefault`}},e.defineProperty(pr,Z,`Column`),pr),dX=(mr=class{constructor(t,n,r){e.defineProperty(this,`config`,void 0),e.defineProperty(this,`$default`,this.$defaultFn),e.defineProperty(this,`$onUpdate`,this.$onUpdateFn),this.config={name:t,keyAsName:t===``,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:n,columnType:r,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===``&&(this.config.name=e)}},e.defineProperty(mr,Z,`ColumnBuilder`),mr);const fX=Symbol.for(`drizzle:Name`);var pX=(hr=class{constructor(t,n){e.defineProperty(this,`reference`,void 0),e.defineProperty(this,`_onUpdate`,`no action`),e.defineProperty(this,`_onDelete`,`no action`),this.reference=()=>{let{name:e,columns:n,foreignColumns:r}=t();return{name:e,columns:n,foreignTable:r[0].table,foreignColumns:r}},n&&(this._onUpdate=n.onUpdate,this._onDelete=n.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?`no action`:e,this}onDelete(e){return this._onDelete=e===void 0?`no action`:e,this}build(e){return new mX(e,this)}},e.defineProperty(hr,Z,`PgForeignKeyBuilder`),hr),mX=(gr=class{constructor(t,n){e.defineProperty(this,`reference`,void 0),e.defineProperty(this,`onUpdate`,void 0),e.defineProperty(this,`onDelete`,void 0),this.table=t,this.reference=n.reference,this.onUpdate=n._onUpdate,this.onDelete=n._onDelete}getName(){let{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[fX],...r,n[0].table[fX],...i];return e??`${a.join(`_`)}_fk`}},e.defineProperty(gr,Z,`PgForeignKey`),gr);function hX(e,...t){return e(...t)}function gX(e,t){return`${e[fX]}_${t.join(`_`)}_unique`}var _X=(_r=class{constructor(t,n){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`nullsNotDistinctConfig`,!1),this.name=n,this.columns=t}nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new yX(e,this.columns,this.nullsNotDistinctConfig,this.name)}},e.defineProperty(_r,Z,`PgUniqueConstraintBuilder`),_r),vX=(vr=class{constructor(t){e.defineProperty(this,`name`,void 0),this.name=t}on(...e){return new _X(e,this.name)}},e.defineProperty(vr,Z,`PgUniqueOnConstraintBuilder`),vr),yX=(yr=class{constructor(t,n,r,i){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`name`,void 0),e.defineProperty(this,`nullsNotDistinct`,!1),this.table=t,this.columns=n,this.name=i??gX(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=r}getName(){return this.name}},e.defineProperty(yr,Z,`PgUniqueConstraint`),yr);function bX(e,t,n){for(let r=t;rArray.isArray(e)?CX(e):typeof e==`string`?`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:`${e}`).join(`,`)}}`}var wX=(br=class extends dX{constructor(...t){super(...t),e.defineProperty(this,`foreignKeyConfigs`,[])}array(e){return new OX(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:`always`,mode:`stored`},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>hX((n,r)=>{let i=new pX(()=>{let t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)},n,r))}buildExtraConfigColumn(e){return new EX(e,this.config)}},e.defineProperty(br,Z,`PgColumnBuilder`),br),TX=(xr=class extends uX{constructor(e,t){t.uniqueName||=gX(e,[t.name]),super(e,t),this.table=e}},e.defineProperty(xr,Z,`PgColumn`),xr),EX=(Sr=class extends TX{constructor(...t){super(...t),e.defineProperty(this,`indexConfig`,{order:this.config.order??`asc`,nulls:this.config.nulls??`last`,opClass:this.config.opClass}),e.defineProperty(this,`defaultConfig`,{order:`asc`,nulls:`last`,opClass:void 0})}getSQLType(){return this.getSQLType()}asc(){return this.indexConfig.order=`asc`,this}desc(){return this.indexConfig.order=`desc`,this}nullsFirst(){return this.indexConfig.nulls=`first`,this}nullsLast(){return this.indexConfig.nulls=`last`,this}op(e){return this.indexConfig.opClass=e,this}},e.defineProperty(Sr,Z,`ExtraConfigColumn`),Sr),DX=(Cr=class{constructor(t,n,r,i){e.defineProperty(this,`name`,void 0),e.defineProperty(this,`keyAsName`,void 0),e.defineProperty(this,`type`,void 0),e.defineProperty(this,`indexConfig`,void 0),this.name=t,this.keyAsName=n,this.type=r,this.indexConfig=i}},e.defineProperty(Cr,Z,`IndexedColumn`),Cr),OX=(wr=class extends wX{constructor(e,t,n){super(e,`array`,`PgArray`),this.config.baseBuilder=t,this.config.size=n}build(e){let t=this.config.baseBuilder.build(e);return new kX(e,this.config,t)}},e.defineProperty(wr,Z,`PgArrayBuilder`),wr),kX=(Tr=class t extends TX{constructor(t,n,r,i){super(t,n),e.defineProperty(this,`size`,void 0),this.baseColumn=r,this.range=i,this.size=n.size}getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size==`number`?this.size:``}]`}mapFromDriverValue(e){return typeof e==`string`&&(e=SX(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,n=!1){let r=e.map(e=>e===null?null:Q(this.baseColumn,t)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return n?r:CX(r)}},e.defineProperty(Tr,Z,`PgArray`),Tr),AX=(Er=class extends wX{constructor(e,t){super(e,`string`,`PgEnumObjectColumn`),this.config.enum=t}build(e){return new jX(e,this.config)}},e.defineProperty(Er,Z,`PgEnumObjectColumnBuilder`),Er),jX=(Dr=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`enum`,void 0),e.defineProperty(this,`enumValues`,this.config.enum.enumValues),this.enum=n.enum}getSQLType(){return this.enum.enumName}},e.defineProperty(Dr,Z,`PgEnumObjectColumn`),Dr);const MX=Symbol.for(`drizzle:isPgEnum`);function NX(e){return!!e&&typeof e==`function`&&MX in e&&e[MX]===!0}var PX=(Or=class extends wX{constructor(e,t){super(e,`string`,`PgEnumColumn`),this.config.enum=t}build(e){return new FX(e,this.config)}},e.defineProperty(Or,Z,`PgEnumColumnBuilder`),Or),FX=(kr=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`enum`,this.config.enum),e.defineProperty(this,`enumValues`,this.config.enum.enumValues),this.enum=n.enum}getSQLType(){return this.enum.enumName}},e.defineProperty(kr,Z,`PgEnumColumn`),kr),IX=(Ar=class{constructor(e,t,n,r=!1,i=[]){this._={brand:`Subquery`,sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}},e.defineProperty(Ar,Z,`Subquery`),Ar),LX=(jr=class extends IX{},e.defineProperty(jr,Z,`WithSubquery`),jr),RX=`0.44.2`;let zX,BX;const VX={startActiveSpan(e,t){return zX?(BX||=zX.trace.getTracer(`drizzle-orm`,RX),hX((n,r)=>r.startActiveSpan(e,e=>{try{return t(e)}catch(t){throw e.setStatus({code:n.SpanStatusCode.ERROR,message:t instanceof Error?t.message:`Unknown error`}),t}finally{e.end()}}),zX,BX)):t()}},HX=Symbol.for(`drizzle:ViewBaseConfig`),UX=Symbol.for(`drizzle:Schema`),WX=Symbol.for(`drizzle:Columns`),GX=Symbol.for(`drizzle:ExtraConfigColumns`),KX=Symbol.for(`drizzle:OriginalName`),qX=Symbol.for(`drizzle:BaseName`),JX=Symbol.for(`drizzle:IsAlias`),YX=Symbol.for(`drizzle:ExtraConfigBuilder`),XX=Symbol.for(`drizzle:IsDrizzleTable`);var ZX=(Mr=class{constructor(t,n,r){e.defineProperty(this,fX,void 0),e.defineProperty(this,KX,void 0),e.defineProperty(this,UX,void 0),e.defineProperty(this,WX,void 0),e.defineProperty(this,GX,void 0),e.defineProperty(this,qX,void 0),e.defineProperty(this,JX,!1),e.defineProperty(this,XX,!0),e.defineProperty(this,YX,void 0),this[fX]=this[KX]=t,this[UX]=n,this[qX]=r}},e.defineProperty(Mr,Z,`Table`),e.defineProperty(Mr,`Symbol`,{Name:fX,Schema:UX,OriginalName:KX,Columns:WX,ExtraConfigColumns:GX,BaseName:qX,IsAlias:JX,ExtraConfigBuilder:YX}),Mr);function QX(e){return e[fX]}function $X(e){return`${e[UX]??`public`}.${e[fX]}`}var eZ=(Nr=class{},e.defineProperty(Nr,Z,`FakePrimitiveParam`),Nr);function tZ(e){return e!=null&&typeof e.getSQL==`function`}function nZ(e){let t={sql:``,params:[]};for(let r of e){var n;t.sql+=r.sql,t.params.push(...r.params),(n=r.typings)?.length&&(t.typings||=[],t.typings.push(...r.typings))}return t}var rZ=(Pr=class{constructor(t){e.defineProperty(this,`value`,void 0),this.value=Array.isArray(t)?t:[t]}getSQL(){return new iZ([this])}},e.defineProperty(Pr,Z,`StringChunk`),Pr),iZ=(Fr=class t{constructor(t){e.defineProperty(this,`decoder`,sZ),e.defineProperty(this,`shouldInlineParams`,!1),e.defineProperty(this,`usedTables`,[]),this.queryChunks=t;for(let e of t)if(Q(e,ZX)){let t=e[ZX.Symbol.Schema];this.usedTables.push(t===void 0?e[ZX.Symbol.Name]:t+`.`+e[ZX.Symbol.Name])}}append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return VX.startActiveSpan(`drizzle.buildSQL`,t=>{let n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,n){let r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:a,escapeParam:o,prepareTyping:s,inlineParams:c,paramStartIndex:l}=r;return nZ(e.map(e=>{if(Q(e,rZ))return{sql:e.value.join(``),params:[]};if(Q(e,aZ))return{sql:a(e.value),params:[]};if(e===void 0)return{sql:``,params:[]};if(Array.isArray(e)){let t=[new rZ(`(`)];for(let[n,r]of e.entries())t.push(r),ne},cZ={mapToDriverValue:e=>e},lZ={...sZ,...cZ};var uZ=(Lr=class{constructor(t,n=cZ){e.defineProperty(this,`brand`,void 0),this.value=t,this.encoder=n}getSQL(){return new iZ([this])}},e.defineProperty(Lr,Z,`Param`),Lr);function $(e,...t){let n=[];(t.length>0||e.length>0&&e[0]!==``)&&n.push(new rZ(e[0]));for(let[r,i]of t.entries())n.push(i,new rZ(e[r+1]));return new iZ(n)}(e=>{function t(){return new iZ([])}e.empty=t;function n(e){return new iZ(e)}e.fromList=n;function r(e){return new iZ([new rZ(e)])}e.raw=r;function i(e,t){let n=[];for(let[r,i]of e.entries())r>0&&t!==void 0&&n.push(t),n.push(i);return new iZ(n)}e.join=i;function a(e){return new aZ(e)}e.identifier=a;function o(e){return new dZ(e)}e.placeholder=o;function s(e,t){return new uZ(e,t)}e.param=s})($||={}),(t=>{class n{constructor(t,n){e.defineProperty(this,`isSelectionField`,!1),this.sql=t,this.fieldAlias=n}getSQL(){return this.sql}clone(){return new n(this.sql,this.fieldAlias)}}e.defineProperty(n,Z,`SQL.Aliased`),t.Aliased=n})(iZ||={});var dZ=(Rr=class{constructor(e){this.name=e}getSQL(){return new iZ([this])}},e.defineProperty(Rr,Z,`Placeholder`),Rr);function fZ(e,t){return e.map(e=>{if(Q(e,dZ)){if(!(e.name in t))throw Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(Q(e,uZ)&&Q(e.value,dZ)){if(!(e.value.name in t))throw Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}const pZ=Symbol.for(`drizzle:IsDrizzleView`);var mZ=(zr=class{constructor({name:t,schema:n,selectedFields:r,query:i}){e.defineProperty(this,HX,void 0),e.defineProperty(this,pZ,!0),this[HX]={name:t,originalName:t,schema:n,selectedFields:r,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new iZ([this])}},e.defineProperty(zr,Z,`View`),zr);uX.prototype.getSQL=function(){return new iZ([this])},ZX.prototype.getSQL=function(){return new iZ([this])},IX.prototype.getSQL=function(){return new iZ([this])};var hZ=(Br=class{constructor(e){this.table=e}get(e,t){return t===`table`?this.table:e[t]}},e.defineProperty(Br,Z,`ColumnAliasProxyHandler`),Br),gZ=(Vr=class{constructor(e,t){this.alias=e,this.replaceOriginalName=t}get(e,t){if(t===ZX.Symbol.IsAlias)return!0;if(t===ZX.Symbol.Name||this.replaceOriginalName&&t===ZX.Symbol.OriginalName)return this.alias;if(t===HX)return{...e[HX],name:this.alias,isAlias:!0};if(t===ZX.Symbol.Columns){let t=e[ZX.Symbol.Columns];if(!t)return t;let n={};return Object.keys(t).map(r=>{n[r]=new Proxy(t[r],new hZ(new Proxy(e,this)))}),n}let n=e[t];return Q(n,uX)?new Proxy(n,new hZ(new Proxy(e,this))):n}},e.defineProperty(Vr,Z,`TableAliasProxyHandler`),Vr),_Z=(Hr=class{constructor(e){this.alias=e}get(e,t){return t===`sourceTable`?vZ(e.sourceTable,this.alias):e[t]}},e.defineProperty(Hr,Z,`RelationTableAliasProxyHandler`),Hr);function vZ(e,t){return new Proxy(e,new gZ(t,!1))}function yZ(e,t){return new Proxy(e,new hZ(new Proxy(e.table,new gZ(t,!1))))}function bZ(e,t){return new iZ.Aliased(xZ(e.sql,t),e.fieldAlias)}function xZ(e,t){return $.join(e.queryChunks.map(e=>Q(e,uX)?yZ(e,t):Q(e,iZ)?xZ(e,t):Q(e,iZ.Aliased)?bZ(e,t):e))}var SZ=(Ur=class extends Error{constructor({message:e,cause:t}){super(e),this.name=`DrizzleError`,this.cause=t}},e.defineProperty(Ur,Z,`DrizzleError`),Ur),CZ=(Wr=class extends SZ{constructor(){super({message:`Rollback`})}},e.defineProperty(Wr,Z,`TransactionRollbackError`),Wr),wZ=(Gr=class{write(e){console.log(e)}},e.defineProperty(Gr,Z,`ConsoleLogWriter`),Gr),TZ=(Kr=class{constructor(t){e.defineProperty(this,`writer`,void 0),this.writer=t?.writer??new wZ}logQuery(e,t){let n=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),r=n.length?` -- params: [${n.join(`, `)}]`:``;this.writer.write(`Query: ${e}${r}`)}},e.defineProperty(Kr,Z,`DefaultLogger`),Kr),EZ=(qr=class{logQuery(){}},e.defineProperty(qr,Z,`NoopLogger`),qr),DZ=(ea=Symbol.toStringTag,Jr=class{constructor(){e.defineProperty(this,ea,`QueryPromise`)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}},e.defineProperty(Jr,Z,`QueryPromise`),Jr);function OZ(e,t){return Object.entries(e).reduce((e,[n,r])=>{if(typeof n!=`string`)return e;let i=t?[...t,n]:[n];return Q(r,uX)||Q(r,iZ)||Q(r,iZ.Aliased)?e.push({path:i,field:r}):Q(r,ZX)?e.push(...OZ(r[ZX.Symbol.Columns],i)):e.push(...OZ(r,i)),e},[])}function kZ(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let[e,t]of n.entries())if(t!==r[e])return!1;return!0}function AZ(e,t){let n=Object.entries(t).filter(([,e])=>e!==void 0).map(([t,n])=>Q(n,iZ)||Q(n,uX)?[t,n]:[t,new uZ(n,e[ZX.Symbol.Columns][t])]);if(n.length===0)throw Error(`No values to set`);return Object.fromEntries(n)}function jZ(e,t){for(let n of t)for(let t of Object.getOwnPropertyNames(n.prototype)){if(t===`constructor`)continue;Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(n.prototype,t)||Object.create(null))}}function MZ(e){return e[ZX.Symbol.Columns]}function NZ(e){return Q(e,IX)?e._.alias:Q(e,mZ)?e[HX].name:Q(e,iZ)?void 0:e[ZX.Symbol.IsAlias]?e[ZX.Symbol.Name]:e[ZX.Symbol.BaseName]}function PZ(e){if(typeof e!=`object`||!e||e.constructor.name!==`Object`)return!1;if(`logger`in e){let t=typeof e.logger;return!(t!==`boolean`&&(t!==`object`||typeof e.logger.logQuery!=`function`)&&t!==`undefined`)}if(`schema`in e){let t=typeof e.schema;return!(t!==`object`&&t!==`undefined`)}if(`casing`in e){let t=typeof e.casing;return!(t!==`string`&&t!==`undefined`)}if(`mode`in e)return!(e.mode!==`default`||e.mode!==`planetscale`||e.mode!==void 0);if(`connection`in e){let t=typeof e.connection;return!(t!==`string`&&t!==`object`&&t!==`undefined`)}if(`client`in e){let t=typeof e.client;return!(t!==`object`&&t!==`function`&&t!==`undefined`)}return Object.keys(e).length===0}var FZ=(Yr=class extends wX{defaultNow(){return this.default($`now()`)}},e.defineProperty(Yr,Z,`PgDateColumnBaseBuilder`),Yr),IZ=(Xr=class extends FZ{constructor(e){super(e,`date`,`PgDate`)}build(e){return new LZ(e,this.config)}},e.defineProperty(Xr,Z,`PgDateBuilder`),Xr),LZ=(Zr=class extends TX{getSQLType(){return`date`}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}},e.defineProperty(Zr,Z,`PgDate`),Zr),RZ=(Qr=class extends FZ{constructor(e){super(e,`string`,`PgDateString`)}build(e){return new zZ(e,this.config)}},e.defineProperty(Qr,Z,`PgDateStringBuilder`),Qr),zZ=($r=class extends TX{getSQLType(){return`date`}},e.defineProperty($r,Z,`PgDateString`),$r),BZ=(ei=class extends wX{constructor(e){super(e,`json`,`PgJson`)}build(e){return new VZ(e,this.config)}},e.defineProperty(ei,Z,`PgJsonBuilder`),ei),VZ=(ti=class extends TX{constructor(e,t){super(e,t)}getSQLType(){return`json`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}},e.defineProperty(ti,Z,`PgJson`),ti),HZ=(ni=class extends wX{constructor(e){super(e,`json`,`PgJsonb`)}build(e){return new UZ(e,this.config)}},e.defineProperty(ni,Z,`PgJsonbBuilder`),ni),UZ=(ri=class extends TX{constructor(e,t){super(e,t)}getSQLType(){return`jsonb`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return e}return e}},e.defineProperty(ri,Z,`PgJsonb`),ri),WZ=(ii=class extends wX{constructor(e,t,n){super(e,`string`,`PgNumeric`),this.config.precision=t,this.config.scale=n}build(e){return new GZ(e,this.config)}},e.defineProperty(ii,Z,`PgNumericBuilder`),ii),GZ=(ai=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`scale`,void 0),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(e){return typeof e==`string`?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},e.defineProperty(ai,Z,`PgNumeric`),ai),KZ=(oi=class extends wX{constructor(e,t,n){super(e,`number`,`PgNumericNumber`),this.config.precision=t,this.config.scale=n}build(e){return new qZ(e,this.config)}},e.defineProperty(oi,Z,`PgNumericNumberBuilder`),oi),qZ=(si=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`scale`,void 0),e.defineProperty(this,`mapToDriverValue`,String),this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(e){return typeof e==`number`?e:Number(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},e.defineProperty(si,Z,`PgNumericNumber`),si),JZ=(ci=class extends wX{constructor(e,t,n){super(e,`bigint`,`PgNumericBigInt`),this.config.precision=t,this.config.scale=n}build(e){return new YZ(e,this.config)}},e.defineProperty(ci,Z,`PgNumericBigIntBuilder`),ci),YZ=(li=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`scale`,void 0),e.defineProperty(this,`mapFromDriverValue`,BigInt),e.defineProperty(this,`mapToDriverValue`,String),this.precision=n.precision,this.scale=n.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?`numeric`:`numeric(${this.precision})`}},e.defineProperty(li,Z,`PgNumericBigInt`),li),XZ=(ui=class extends FZ{constructor(e,t,n){super(e,`string`,`PgTime`),this.withTimezone=t,this.precision=n,this.config.withTimezone=t,this.config.precision=n}build(e){return new ZZ(e,this.config)}},e.defineProperty(ui,Z,`PgTimeBuilder`),ui),ZZ=(di=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`withTimezone`,void 0),e.defineProperty(this,`precision`,void 0),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){let e=this.precision===void 0?``:`(${this.precision})`;return`time${e}${this.withTimezone?` with time zone`:``}`}},e.defineProperty(di,Z,`PgTime`),di),QZ=(fi=class extends FZ{constructor(e,t,n){super(e,`date`,`PgTimestamp`),this.config.withTimezone=t,this.config.precision=n}build(e){return new $Z(e,this.config)}},e.defineProperty(fi,Z,`PgTimestampBuilder`),fi),$Z=(pi=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`withTimezone`,void 0),e.defineProperty(this,`precision`,void 0),e.defineProperty(this,`mapFromDriverValue`,e=>new Date(this.withTimezone?e:e+`+0000`)),e.defineProperty(this,`mapToDriverValue`,e=>e.toISOString()),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){let e=this.precision===void 0?``:` (${this.precision})`;return`timestamp${e}${this.withTimezone?` with time zone`:``}`}},e.defineProperty(pi,Z,`PgTimestamp`),pi),eQ=(mi=class extends FZ{constructor(e,t,n){super(e,`string`,`PgTimestampString`),this.config.withTimezone=t,this.config.precision=n}build(e){return new tQ(e,this.config)}},e.defineProperty(mi,Z,`PgTimestampStringBuilder`),mi),tQ=(hi=class extends TX{constructor(t,n){super(t,n),e.defineProperty(this,`withTimezone`,void 0),e.defineProperty(this,`precision`,void 0),this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){let e=this.precision===void 0?``:`(${this.precision})`;return`timestamp${e}${this.withTimezone?` with time zone`:``}`}},e.defineProperty(hi,Z,`PgTimestampString`),hi),nQ=(gi=class extends wX{constructor(e){super(e,`string`,`PgUUID`)}defaultRandom(){return this.default($`gen_random_uuid()`)}build(e){return new rQ(e,this.config)}},e.defineProperty(gi,Z,`PgUUIDBuilder`),gi),rQ=(_i=class extends TX{getSQLType(){return`uuid`}},e.defineProperty(_i,Z,`PgUUID`),_i);const iQ=Symbol.for(`drizzle:PgInlineForeignKeys`),aQ=Symbol.for(`drizzle:EnableRLS`);var oQ=(ta=ZX.Symbol.ExtraConfigBuilder,na=ZX.Symbol.ExtraConfigColumns,vi=class extends ZX{constructor(...t){super(...t),e.defineProperty(this,iQ,[]),e.defineProperty(this,aQ,!1),e.defineProperty(this,ta,void 0),e.defineProperty(this,na,{})}},e.defineProperty(vi,Z,`PgTable`),e.defineProperty(vi,`Symbol`,Object.assign({},ZX.Symbol,{InlineForeignKeys:iQ,EnableRLS:aQ})),vi),sQ=(yi=class{constructor(t,n){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`name`,void 0),this.columns=t,this.name=n}build(e){return new cQ(e,this.columns,this.name)}},e.defineProperty(yi,Z,`PgPrimaryKeyBuilder`),yi),cQ=(bi=class{constructor(t,n,r){e.defineProperty(this,`columns`,void 0),e.defineProperty(this,`name`,void 0),this.table=t,this.columns=n,this.name=r}getName(){return this.name??`${this.table[oQ.Symbol.Name]}_${this.columns.map(e=>e.name).join(`_`)}_pk`}},e.defineProperty(bi,Z,`PgPrimaryKey`),bi);function lQ(e,t){return oZ(t)&&!tZ(e)&&!Q(e,uZ)&&!Q(e,dZ)&&!Q(e,uX)&&!Q(e,ZX)&&!Q(e,mZ)?new uZ(e,t):e}const uQ=(e,t)=>$`${e} = ${lQ(t,e)}`,dQ=(e,t)=>$`${e} <> ${lQ(t,e)}`;function fQ(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new iZ(t):new iZ([new rZ(`(`),$.join(t,new rZ(` and `)),new rZ(`)`)])}function pQ(...e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new iZ(t):new iZ([new rZ(`(`),$.join(t,new rZ(` or `)),new rZ(`)`)])}function mQ(e){return $`not ${e}`}const hQ=(e,t)=>$`${e} > ${lQ(t,e)}`,gQ=(e,t)=>$`${e} >= ${lQ(t,e)}`,_Q=(e,t)=>$`${e} < ${lQ(t,e)}`,vQ=(e,t)=>$`${e} <= ${lQ(t,e)}`;function yQ(e,t){return Array.isArray(t)?t.length===0?$`false`:$`${e} in ${t.map(t=>lQ(t,e))}`:$`${e} in ${lQ(t,e)}`}function bQ(e,t){return Array.isArray(t)?t.length===0?$`true`:$`${e} not in ${t.map(t=>lQ(t,e))}`:$`${e} not in ${lQ(t,e)}`}function xQ(e){return $`${e} is null`}function SQ(e){return $`${e} is not null`}function CQ(e){return $`exists ${e}`}function wQ(e){return $`not exists ${e}`}function TQ(e,t,n){return $`${e} between ${lQ(t,e)} and ${lQ(n,e)}`}function EQ(e,t,n){return $`${e} not between ${lQ(t,e)} and ${lQ(n,e)}`}function DQ(e,t){return $`${e} like ${t}`}function OQ(e,t){return $`${e} not like ${t}`}function kQ(e,t){return $`${e} ilike ${t}`}function AQ(e,t){return $`${e} not ilike ${t}`}function jQ(e){return $`${e} asc`}function MQ(e){return $`${e} desc`}var NQ=(xi=class{constructor(t,n,r){e.defineProperty(this,`referencedTableName`,void 0),e.defineProperty(this,`fieldName`,void 0),this.sourceTable=t,this.referencedTable=n,this.relationName=r,this.referencedTableName=n[ZX.Symbol.Name]}},e.defineProperty(xi,Z,`Relation`),xi),PQ=(Si=class{constructor(e,t){this.table=e,this.config=t}},e.defineProperty(Si,Z,`Relations`),Si),FQ=(Ci=class e extends NQ{constructor(e,t,n,r){super(e,t,n?.relationName),this.config=n,this.isNullable=r}withFieldName(t){let n=new e(this.sourceTable,this.referencedTable,this.config,this.isNullable);return n.fieldName=t,n}},e.defineProperty(Ci,Z,`One`),Ci),IQ=(wi=class e extends NQ{constructor(e,t,n){super(e,t,n?.relationName),this.config=n}withFieldName(t){let n=new e(this.sourceTable,this.referencedTable,this.config);return n.fieldName=t,n}},e.defineProperty(wi,Z,`Many`),wi);function LQ(){return{and:fQ,between:TQ,eq:uQ,exists:CQ,gt:hQ,gte:gQ,ilike:kQ,inArray:yQ,isNull:xQ,isNotNull:SQ,like:DQ,lt:_Q,lte:vQ,ne:dQ,not:mQ,notBetween:EQ,notExists:wQ,notLike:OQ,notIlike:AQ,notInArray:bQ,or:pQ,sql:$}}function RQ(){return{sql:$,asc:jQ,desc:MQ}}function zQ(e,t){Object.keys(e).length===1&&`default`in e&&!Q(e.default,ZX)&&(e=e.default);let n={},r={},i={};for(let[o,s]of Object.entries(e))if(Q(s,ZX)){var a;let e=$X(s),t=r[e];n[e]=o,i[o]={tsName:o,dbName:s[ZX.Symbol.Name],schema:s[ZX.Symbol.Schema],columns:s[ZX.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]};for(let e of Object.values(s[ZX.Symbol.Columns]))e.primary&&i[o].primaryKey.push(e);let c=(a=s[ZX.Symbol.ExtraConfigBuilder])?.call(s,s[ZX.Symbol.ExtraConfigColumns]);if(c)for(let e of Object.values(c))Q(e,sQ)&&i[o].primaryKey.push(...e.columns)}else if(Q(s,PQ)){let e=$X(s.table),a=n[e],o=s.config(t(s.table)),c;for(let[t,n]of Object.entries(o))if(a){let e=i[a];e.relations[t]=n,c&&e.primaryKey.push(...c)}else e in r||(r[e]={relations:{},primaryKey:c}),r[e].relations[t]=n}return{tables:i,tableNamesMap:n}}function BQ(e){return function(t,n){return new FQ(e,t,n,n?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)}}function VQ(e){return function(t,n){return new IQ(e,t,n)}}function HQ(e,t,n){if(Q(n,FQ)&&n.config)return{fields:n.config.fields,references:n.config.references};let r=t[$X(n.referencedTable)];if(!r)throw Error(`Table "${n.referencedTable[ZX.Symbol.Name]}" not found in schema`);let i=e[r];if(!i)throw Error(`Table "${r}" not found in schema`);let a=n.sourceTable,o=t[$X(a)];if(!o)throw Error(`Table "${a[ZX.Symbol.Name]}" not found in schema`);let s=[];for(let e of Object.values(i.relations))(n.relationName&&n!==e&&e.relationName===n.relationName||!n.relationName&&e.referencedTable===n.sourceTable)&&s.push(e);if(s.length>1)throw n.relationName?Error(`There are multiple relations with name "${n.relationName}" in table "${r}"`):Error(`There are multiple relations between "${r}" and "${n.sourceTable[ZX.Symbol.Name]}". Please specify relation name`);if(s[0]&&Q(s[0],FQ)&&s[0].config)return{fields:s[0].config.references,references:s[0].config.fields};throw Error(`There is not enough information to infer relation "${o}.${n.fieldName}"`)}function UQ(e){return{one:BQ(e),many:VQ(e)}}function WQ(e,t,n,r,i=e=>e){let a={};for(let[o,s]of r.entries())if(s.isJson){let r=t.relations[s.tsKey],c=n[o],l=typeof c==`string`?JSON.parse(c):c;a[s.tsKey]=Q(r,FQ)?l&&WQ(e,e[s.relationTableTsKey],l,s.selection,i):l.map(t=>WQ(e,e[s.relationTableTsKey],t,s.selection,i))}else{let e=i(n[o]),t=s.field,r;r=Q(t,uX)?t:Q(t,iZ)?t.decoder:t.sql.decoder,a[s.tsKey]=e===null?null:r.mapFromDriverValue(e)}return a}var GQ=(Ti=class t{constructor(t){e.defineProperty(this,`config`,void 0),this.config={...t}}get(e,n){if(n===`_`)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(n===HX)return{...e[HX],selectedFields:new Proxy(e[HX].selectedFields,this)};if(typeof n==`symbol`)return e[n];let r=Q(e,IX)?e._.selectedFields:Q(e,mZ)?e[HX].selectedFields:e,i=r[n];if(Q(i,iZ.Aliased)){if(this.config.sqlAliasedBehavior===`sql`&&!i.isSelectionField)return i.sql;let e=i.clone();return e.isSelectionField=!0,e}if(Q(i,iZ)){if(this.config.sqlBehavior===`sql`)return i;throw Error(`You tried to reference "${n}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return Q(i,uX)?this.config.alias?new Proxy(i,new hZ(new Proxy(i.table,new gZ(this.config.alias,this.config.replaceOriginalName??!1)))):i:typeof i!=`object`||!i?i:new Proxy(i,new t(this.config))}},e.defineProperty(Ti,Z,`SelectionProxyHandler`),Ti);function KQ(e){let t=e.replace(/['\u2019]/g,``).match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[];return t.map(e=>e.toLowerCase()).join(`_`)}function qQ(e){let t=e.replace(/['\u2019]/g,``).match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[];return t.reduce((e,t,n)=>{let r=n===0?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`;return e+r},``)}function JQ(e){return e}var YQ=(Ei=class{constructor(t){e.defineProperty(this,`cache`,{}),e.defineProperty(this,`cachedTables`,{}),e.defineProperty(this,`convert`,void 0),this.convert=t===`snake_case`?KQ:t===`camelCase`?qQ:JQ}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[ZX.Symbol.Schema]??`public`,n=e.table[ZX.Symbol.OriginalName],r=`${t}.${n}.${e.name}`;return this.cache[r]||this.cacheTable(e.table),this.cache[r]}cacheTable(e){let t=e[ZX.Symbol.Schema]??`public`,n=e[ZX.Symbol.OriginalName],r=`${t}.${n}`;if(!this.cachedTables[r]){for(let t of Object.values(e[ZX.Symbol.Columns])){let e=`${r}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[r]=!0}}clearCache(){this.cache={},this.cachedTables={}}},e.defineProperty(Ei,Z,`CasingCache`),Ei),XQ=(Di=class extends mZ{},e.defineProperty(Di,Z,`PgViewBase`),Di),ZQ=(Oi=class{constructor(t){e.defineProperty(this,`casing`,void 0),this.casing=new YQ(t?.casing)}async migrate(e,t,n){let r=typeof n==`string`?`__drizzle_migrations`:n.migrationsTable??`__drizzle_migrations`,i=typeof n==`string`?`drizzle`:n.migrationsSchema??`drizzle`,a=$`
CREATE TABLE IF NOT EXISTS ${$.identifier(i)}.${$.identifier(r)} (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at bigint
)
`;await t.execute($`CREATE SCHEMA IF NOT EXISTS ${$.identifier(i)}`),await t.execute(a);let o=await t.all($`select id, hash, created_at from ${$.identifier(i)}.${$.identifier(r)} order by created_at desc limit 1`),s=o[0];await t.transaction(async t=>{for await(let n of e)if(!s||Number(s.created_at){var r;return t[e]!==void 0||(r=n[e])?.onUpdateFn!==void 0}),i=r.length;return $.join(r.flatMap((e,r)=>{let a=n[e],o=t[e]??$.param(a.onUpdateFn(),a),s=$`${$.identifier(this.casing.getColumnCasing(a))} = ${o}`;return r{let i=[];if(Q(e,iZ.Aliased)&&e.isSelectionField)i.push($.identifier(e.fieldAlias));else if(Q(e,iZ.Aliased)||Q(e,iZ)){let n=Q(e,iZ.Aliased)?e.sql:e;t?i.push(new iZ(n.queryChunks.map(e=>Q(e,TX)?$.identifier(this.casing.getColumnCasing(e)):e))):i.push(n),Q(e,iZ.Aliased)&&i.push($` as ${$.identifier(e.fieldAlias)}`)}else Q(e,uX)&&(t?i.push($.identifier(this.casing.getColumnCasing(e))):i.push(e));return ro?.some(({alias:t})=>t===(e[ZX.Symbol.IsAlias]?QX(e):e[ZX.Symbol.BaseName])))(e.field.table)){let t=QX(e.field.table);throw Error(`Your "${e.path.join(`->`)}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}let h=!o||o.length===0,g=this.buildWithCTE(e),_;f&&(_=f===!0?$` distinct`:$` distinct on (${$.join(f.on,$`, `)})`);let v=this.buildSelection(m,{isSingleTable:h}),y=this.buildFromTable(a),b=this.buildJoins(o),x=r?$` where ${r}`:void 0,S=i?$` having ${i}`:void 0,C;s&&s.length>0&&(C=$` order by ${$.join(s,$`, `)}`);let w;c&&c.length>0&&(w=$` group by ${$.join(c,$`, `)}`);let T=typeof l==`object`||typeof l==`number`&&l>=0?$` limit ${l}`:void 0,E=u?$` offset ${u}`:void 0,D=$.empty();if(d){let e=$` for ${$.raw(d.strength)}`;d.config.of&&e.append($` of ${$.join(Array.isArray(d.config.of)?d.config.of:[d.config.of],$`, `)}`),d.config.noWait?e.append($` nowait`):d.config.skipLocked&&e.append($` skip locked`),D.append(e)}let O=$`${g}select${_} ${v} from ${y}${b}${x}${w}${S}${C}${T}${E}${D}`;return p.length>0?this.buildSetOperations(O,p):O}buildSetOperations(e,t){let[n,...r]=t;if(!n)throw Error(`Cannot pass undefined values to any set operator`);return r.length===0?this.buildSetOperationQuery({leftSelect:e,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:n}),r)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:n,rightSelect:r,limit:i,orderBy:a,offset:o}}){let s=$`(${e.getSQL()}) `,c=$`(${r.getSQL()})`,l;if(a&&a.length>0){let e=[];for(let t of a)if(Q(t,TX))e.push($.identifier(t.name));else if(Q(t,iZ)){for(let e=0;e=0?$` limit ${i}`:void 0,d=$.raw(`${t} ${n?`all `:``}`),f=o?$` offset ${o}`:void 0;return $`${s}${d}${c}${l}${u}${f}`}buildInsertQuery({table:e,values:t,onConflict:n,returning:r,withList:i,select:a,overridingSystemValue_:o}){let s=[],c=e[ZX.Symbol.Columns],l=Object.entries(c).filter(([e,t])=>!t.shouldDisableInsert()),u=l.map(([,e])=>$.identifier(this.casing.getColumnCasing(e)));if(a){let e=t;Q(e,iZ)?s.push(e):s.push(e.getSQL())}else{let e=t;s.push($.raw(`values `));for(let[t,n]of e.entries()){let r=[];for(let[e,t]of l){let i=n[e];if(i===void 0||Q(i,uZ)&&i.value===void 0)if(t.defaultFn!==void 0){let e=t.defaultFn(),n=Q(e,iZ)?e:$.param(e,t);r.push(n)}else if(!t.default&&t.onUpdateFn!==void 0){let e=t.onUpdateFn(),n=Q(e,iZ)?e:$.param(e,t);r.push(n)}else r.push($`default`);else r.push(i)}s.push(r),t({dbKey:t.name,tsKey:e,field:yZ(t,o),relationTableTsKey:void 0,isJson:!1,selection:[]}))}else{let r=Object.fromEntries(Object.entries(i.columns).map(([e,t])=>[e,yZ(t,o)]));if(a.where){let e=typeof a.where==`function`?a.where(r,LQ()):a.where;p=e&&xZ(e,o)}let s=[],c=[];if(a.columns){let e=!1;for(let[t,n]of Object.entries(a.columns)){if(n===void 0)continue;t in i.columns&&(!e&&n===!0&&(e=!0),c.push(t))}c.length>0&&(c=e?c.filter(e=>{var t;return(t=a.columns)?.[e]===!0}):Object.keys(i.columns).filter(e=>!c.includes(e)))}else c=Object.keys(i.columns);for(let e of c){let t=i.columns[e];s.push({tsKey:e,value:t})}let h=[];a.with&&(h=Object.entries(a.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:i.relations[e]})));let g;if(a.extras){g=typeof a.extras==`function`?a.extras(r,{sql:$}):a.extras;for(let[e,t]of Object.entries(g))s.push({tsKey:e,value:bZ(t,o)})}for(let{tsKey:e,value:t}of s)l.push({dbKey:Q(t,iZ.Aliased)?t.fieldAlias:i.columns[e].name,tsKey:e,field:Q(t,uX)?yZ(t,o):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let _=typeof a.orderBy==`function`?a.orderBy(r,RQ()):a.orderBy??[];Array.isArray(_)||(_=[_]),f=_.map(e=>Q(e,uX)?yZ(e,o):xZ(e,o)),u=a.limit,d=a.offset;for(let{tsKey:r,queryConfig:i,relation:a}of h){let s=HQ(t,n,a),c=$X(a.referencedTable),u=n[c],d=`${o}_${r}`,f=fQ(...s.fields.map((e,t)=>uQ(yZ(s.references[t],d),yZ(e,o)))),p=this.buildRelationalQueryWithoutPK({fullSchema:e,schema:t,tableNamesMap:n,table:e[u],tableConfig:t[u],queryConfig:Q(a,FQ)?i===!0?{limit:1}:{...i,limit:1}:i,tableAlias:d,joinOn:f,nestedQueryRelation:a}),h=$`${$.identifier(d)}.${$.identifier(`data`)}`.as(r);m.push({on:$`true`,table:new IX(p.sql,{},d),alias:d,joinType:`left`,lateral:!0}),l.push({dbKey:r,tsKey:r,field:h,relationTableTsKey:u,isJson:!0,selection:p.selection})}}if(l.length===0)throw new SZ({message:`No fields selected for table "${i.tsName}" ("${o}")`});let h;if(p=fQ(c,p),s){let e=$`json_build_array(${$.join(l.map(({field:e,tsKey:t,isJson:n})=>n?$`${$.identifier(`${o}_${t}`)}.${$.identifier(`data`)}`:Q(e,iZ.Aliased)?e.sql:e),$`, `)})`;Q(s,IQ)&&(e=$`coalesce(json_agg(${e}${f.length>0?$` order by ${$.join(f,$`, `)}`:void 0}), '[]'::json)`);let t=[{dbKey:`data`,tsKey:`data`,field:e.as(`data`),isJson:!0,relationTableTsKey:i.tsName,selection:l}],n=u!==void 0||d!==void 0||f.length>0;n?(h=this.buildSelectQuery({table:vZ(r,o),fields:{},fieldsFlat:[{path:[],field:$.raw(`*`)}],where:p,limit:u,offset:d,orderBy:f,setOperators:[]}),p=void 0,u=void 0,d=void 0,f=[]):h=vZ(r,o),h=this.buildSelectQuery({table:Q(h,oQ)?h:new IX(h,{},o),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:Q(e,uX)?yZ(e,o):e})),joins:m,where:p,limit:u,offset:d,orderBy:f,setOperators:[]})}else h=this.buildSelectQuery({table:vZ(r,o),fields:{},fieldsFlat:l.map(({field:e})=>({path:[],field:Q(e,uX)?yZ(e,o):e})),joins:m,where:p,limit:u,offset:d,orderBy:f,setOperators:[]});return{tableTsKey:i.tsName,sql:h,selection:l}}},e.defineProperty(Oi,Z,`PgDialect`),Oi),QQ=(ki=class{getSelectedFields(){return this._.selectedFields}},e.defineProperty(ki,Z,`TypedQueryBuilder`),ki),$Q=(Ai=class{constructor(t){e.defineProperty(this,`fields`,void 0),e.defineProperty(this,`session`,void 0),e.defineProperty(this,`dialect`,void 0),e.defineProperty(this,`withList`,[]),e.defineProperty(this,`distinct`,void 0),e.defineProperty(this,`authToken`,void 0),this.fields=t.fields,this.session=t.session,this.dialect=t.dialect,t.withList&&(this.withList=t.withList),this.distinct=t.distinct}setToken(e){return this.authToken=e,this}from(e){let t=!!this.fields,n=e,r;return r=this.fields?this.fields:Q(n,IX)?Object.fromEntries(Object.keys(n._.selectedFields).map(e=>[e,n[e]])):Q(n,XQ)?n[HX].selectedFields:Q(n,iZ)?{}:MZ(n),new t$({table:n,fields:r,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}},e.defineProperty(Ai,Z,`PgSelectBuilder`),Ai),e$=(ji=class extends QQ{constructor({table:t,fields:n,isPartialSelect:r,session:i,dialect:a,withList:o,distinct:s}){super(),e.defineProperty(this,`_`,void 0),e.defineProperty(this,`config`,void 0),e.defineProperty(this,`joinsNotNullableMap`,void 0),e.defineProperty(this,`tableName`,void 0),e.defineProperty(this,`isPartialSelect`,void 0),e.defineProperty(this,`session`,void 0),e.defineProperty(this,`dialect`,void 0),e.defineProperty(this,`cacheConfig`,void 0),e.defineProperty(this,`usedTables`,new Set),e.defineProperty(this,`leftJoin`,this.createJoin(`left`,!1)),e.defineProperty(this,`leftJoinLateral`,this.createJoin(`left`,!0)),e.defineProperty(this,`rightJoin`,this.createJoin(`right`,!1)),e.defineProperty(this,`innerJoin`,this.createJoin(`inner`,!1)),e.defineProperty(this,`innerJoinLateral`,this.createJoin(`inner`,!0)),e.defineProperty(this,`fullJoin`,this.createJoin(`full`,!1)),e.defineProperty(this,`crossJoin`,this.createJoin(`cross`,!1)),e.defineProperty(this,`crossJoinLateral`,this.createJoin(`cross`,!0)),e.defineProperty(this,`union`,this.createSetOperator(`union`,!1)),e.defineProperty(this,`unionAll`,this.createSetOperator(`union`,!0)),e.defineProperty(this,`intersect`,this.createSetOperator(`intersect`,!1)),e.defineProperty(this,`intersectAll`,this.createSetOperator(`intersect`,!0)),e.defineProperty(this,`except`,this.createSetOperator(`except`,!1)),e.defineProperty(this,`exceptAll`,this.createSetOperator(`except`,!0)),this.config={withList:o,table:t,fields:{...n},distinct:s,setOperators:[]},this.isPartialSelect=r,this.session=i,this.dialect=a,this._={selectedFields:n,config:this.config},this.tableName=NZ(t),this.joinsNotNullableMap=typeof this.tableName==`string`?{[this.tableName]:!0}:{};for(let e of d$(t))this.usedTables.add(e)}getUsedTables(){return[...this.usedTables]}createJoin(e,t){return(n,r)=>{var i;let a=this.tableName,o=NZ(n);for(let e of d$(n))this.usedTables.add(e);if(typeof o==`string`&&(i=this.config.joins)?.some(e=>e.alias===o))throw Error(`Alias "${o}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof a==`string`&&(this.config.fields={[a]:this.config.fields}),typeof o==`string`&&!Q(n,iZ))){let e=Q(n,IX)?n._.selectedFields:Q(n,mZ)?n[HX].selectedFields:n[ZX.Symbol.Columns];this.config.fields[o]=e}if(typeof r==`function`&&(r=r(new Proxy(this.config.fields,new GQ({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:r,table:n,joinType:e,alias:o,lateral:t}),typeof o==`string`)switch(e){case`left`:this.joinsNotNullableMap[o]=!1;break;case`right`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[o]=!0;break;case`cross`:case`inner`:this.joinsNotNullableMap[o]=!0;break;case`full`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[o]=!1;break}return this}}createSetOperator(e,t){return n=>{let r=typeof n==`function`?n(r$()):n;if(!kZ(this.getSelectedFields(),r.getSelectedFields()))throw Error(`Set operator error (union / intersect / except): selected fields are not the same or are in a different order`);return this.config.setOperators.push({type:e,isAll:t,rightSelect:r}),this}}addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e==`function`&&(e=e(new Proxy(this.config.fields,new GQ({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))),this.config.where=e,this}having(e){return typeof e==`function`&&(e=e(new Proxy(this.config.fields,new GQ({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]==`function`){let t=e[0](new Proxy(this.config.fields,new GQ({sqlAliasedBehavior:`alias`,sqlBehavior:`sql`})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]==`function`){let t=e[0](new Proxy(this.config.fields,new GQ({sqlAliasedBehavior:`alias`,sqlBehavior:`sql`}))),n=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}else{let t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,t={}){return this.config.lockingClause={strength:e,config:t},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...d$(this.config.table)),this.config.joins)for(let e of this.config.joins)t.push(...d$(e.table));return new Proxy(new IX(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new GQ({alias:e,sqlAliasedBehavior:`alias`,sqlBehavior:`error`}))}getSelectedFields(){return new Proxy(this.config.fields,new GQ({alias:this.tableName,sqlAliasedBehavior:`alias`,sqlBehavior:`error`}))}$dynamic(){return this}$withCache(e){return this.cacheConfig=e===void 0?{config:{},enable:!0,autoInvalidate:!0}:e===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}},e.defineProperty(ji,Z,`PgSelectQueryBuilder`),ji),t$=(Mi=class extends e${constructor(...t){super(...t),e.defineProperty(this,`authToken`,void 0),e.defineProperty(this,`execute`,e=>VX.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken)))}_prepare(e){let{session:t,config:n,dialect:r,joinsNotNullableMap:i,authToken:a,cacheConfig:o,usedTables:s}=this;if(!t)throw Error(`Cannot execute a query on a query builder. Please use a database instance instead.`);let{fields:c}=n;return VX.startActiveSpan(`drizzle.prepareQuery`,()=>{let n=OZ(c),l=t.prepareQuery(r.sqlToQuery(this.getSQL()),n,e,!0,void 0,{type:`select`,tables:[...s]},o);return l.joinsNotNullableMap=i,l.setToken(a)})}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}},e.defineProperty(Mi,Z,`PgSelect`),Mi);jZ(t$,[DZ]);function n$(e,t){return(n,r,...i)=>{let a=[r,...i].map(n=>({type:e,isAll:t,rightSelect:n}));for(let e of a)if(!kZ(n.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error(`Set operator error (union / intersect / except): selected fields are not the same or are in a different order`);return n.addSetOperators(a)}}const r$=()=>({union:i$,unionAll:a$,intersect:o$,intersectAll:s$,except:c$,exceptAll:l$}),i$=n$(`union`,!1),a$=n$(`union`,!0),o$=n$(`intersect`,!1),s$=n$(`intersect`,!0),c$=n$(`except`,!1),l$=n$(`except`,!0);var u$=(Ni=class{constructor(t){e.defineProperty(this,`dialect`,void 0),e.defineProperty(this,`dialectConfig`,void 0),e.defineProperty(this,`$with`,(e,t)=>{let n=this,r=r=>(typeof r==`function`&&(r=r(n)),new Proxy(new LX(r.getSQL(),t??(`getSelectedFields`in r?r.getSelectedFields()??{}:{}),e,!0),new GQ({alias:e,sqlAliasedBehavior:`alias`,sqlBehavior:`error`})));return{as:r}}),this.dialect=Q(t,ZQ)?t:void 0,this.dialectConfig=Q(t,ZQ)?void 0:t}with(...e){let t=this;function n(n){return new $Q({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e})}function r(e){return new $Q({fields:e??void 0,session:void 0,dialect:t.getDialect(),distinct:!0})}function i(e,n){return new $Q({fields:n??void 0,session:void 0,dialect:t.getDialect(),distinct:{on:e}})}return{select:n,selectDistinct:r,selectDistinctOn:i}}select(e){return new $Q({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new $Q({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(e,t){return new $Q({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:e}})}getDialect(){return this.dialect||=new ZQ(this.dialectConfig),this.dialect}},e.defineProperty(Ni,Z,`PgQueryBuilder`),Ni);function d$(e){return Q(e,oQ)?[e[UX]?`${e[UX]}.${e[ZX.Symbol.BaseName]}`:e[ZX.Symbol.BaseName]]:Q(e,IX)?e._.usedTables??[]:Q(e,iZ)?e.usedTables??[]:[]}var f$=(Pi=class extends DZ{constructor(t,n,r,i){super(),e.defineProperty(this,`config`,void 0),e.defineProperty(this,`cacheConfig`,void 0),e.defineProperty(this,`authToken`,void 0),e.defineProperty(this,`execute`,e=>VX.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken))),this.session=n,this.dialect=r,this.config={table:t,withList:i}}where(e){return this.config.where=e,this}returning(e=this.config.table[ZX.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=OZ(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return VX.startActiveSpan(`drizzle.prepareQuery`,()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0,void 0,{type:`delete`,tables:d$(this.config.table)},this.cacheConfig))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new GQ({alias:QX(this.config.table),sqlAliasedBehavior:`alias`,sqlBehavior:`error`})):void 0}$dynamic(){return this}},e.defineProperty(Pi,Z,`PgDelete`),Pi),p$=(Fi=class{constructor(t,n,r,i,a){e.defineProperty(this,`authToken`,void 0),this.table=t,this.session=n,this.dialect=r,this.withList=i,this.overridingSystemValue_=a}setToken(e){return this.authToken=e,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(e){if(e=Array.isArray(e)?e:[e],e.length===0)throw Error(`values() must be called with at least one value`);let t=e.map(e=>{let t={},n=this.table[ZX.Symbol.Columns];for(let r of Object.keys(e)){let i=e[r];t[r]=Q(i,iZ)?i:new uZ(i,n[r])}return t});return new m$(this.table,t,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(e){let t=typeof e==`function`?e(new u$):e;if(!Q(t,iZ)&&!kZ(this.table[WX],t._.selectedFields))throw Error(`Insert select error: selected fields are not the same or are in a different order compared to the table definition`);return new m$(this.table,t,this.session,this.dialect,this.withList,!0)}},e.defineProperty(Fi,Z,`PgInsertBuilder`),Fi),m$=(Ii=class extends DZ{constructor(t,n,r,i,a,o,s){super(),e.defineProperty(this,`config`,void 0),e.defineProperty(this,`cacheConfig`,void 0),e.defineProperty(this,`authToken`,void 0),e.defineProperty(this,`execute`,e=>VX.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken))),this.session=r,this.dialect=i,this.config={table:t,values:n,withList:a,select:o,overridingSystemValue_:s}}returning(e=this.config.table[ZX.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=OZ(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=$`do nothing`;else{let t=``;t=Array.isArray(e.target)?e.target.map(e=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(e))).join(`,`):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target));let n=e.where?$` where ${e.where}`:void 0;this.config.onConflict=$`(${$.raw(t)})${n} do nothing`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw Error(`You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.`);let t=e.where?$` where ${e.where}`:void 0,n=e.targetWhere?$` where ${e.targetWhere}`:void 0,r=e.setWhere?$` where ${e.setWhere}`:void 0,i=this.dialect.buildUpdateSet(this.config.table,AZ(this.config.table,e.set)),a=``;return a=Array.isArray(e.target)?e.target.map(e=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(e))).join(`,`):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target)),this.config.onConflict=$`(${$.raw(a)})${n} do update set ${i}${t}${r}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return VX.startActiveSpan(`drizzle.prepareQuery`,()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0,void 0,{type:`insert`,tables:d$(this.config.table)},this.cacheConfig))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new GQ({alias:QX(this.config.table),sqlAliasedBehavior:`alias`,sqlBehavior:`error`})):void 0}$dynamic(){return this}},e.defineProperty(Ii,Z,`PgInsert`),Ii),h$=(Li=class extends DZ{constructor(t,n,r){super(),e.defineProperty(this,`config`,void 0),e.defineProperty(this,`authToken`,void 0),e.defineProperty(this,`execute`,e=>VX.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(e,this.authToken))),this.session=n,this.dialect=r,this.config={view:t}}concurrently(){if(this.config.withNoData!==void 0)throw Error(`Cannot use concurrently and withNoData together`);return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw Error(`Cannot use concurrently and withNoData together`);return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){return VX.startActiveSpan(`drizzle.prepareQuery`,()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}},e.defineProperty(Li,Z,`PgRefreshMaterializedView`),Li),g$=(Ri=class{constructor(t,n,r,i){e.defineProperty(this,`authToken`,void 0),this.table=t,this.session=n,this.dialect=r,this.withList=i}setToken(e){return this.authToken=e,this}set(e){return new _$(this.table,AZ(this.table,e),this.session,this.dialect,this.withList).setToken(this.authToken)}},e.defineProperty(Ri,Z,`PgUpdateBuilder`),Ri),_$=(zi=class extends DZ{constructor(t,n,r,i,a){super(),e.defineProperty(this,`config`,void 0),e.defineProperty(this,`tableName`,void 0),e.defineProperty(this,`joinsNotNullableMap`,void 0),e.defineProperty(this,`cacheConfig`,void 0),e.defineProperty(this,`leftJoin`,this.createJoin(`left`)),e.defineProperty(this,`rightJoin`,this.createJoin(`right`)),e.defineProperty(this,`innerJoin`,this.createJoin(`inner`)),e.defineProperty(this,`fullJoin`,this.createJoin(`full`)),e.defineProperty(this,`authToken`,void 0),e.defineProperty(this,`execute`,e=>this._prepare().execute(e,this.authToken)),this.session=r,this.dialect=i,this.config={set:n,table:t,withList:a,joins:[]},this.tableName=NZ(t),this.joinsNotNullableMap=typeof this.tableName==`string`?{[this.tableName]:!0}:{}}from(e){let t=e,n=NZ(t);return typeof n==`string`&&(this.joinsNotNullableMap[n]=!0),this.config.from=t,this}getTableLikeFields(e){return Q(e,oQ)?e[ZX.Symbol.Columns]:Q(e,IX)?e._.selectedFields:e[HX].selectedFields}createJoin(e){return(t,n)=>{let r=NZ(t);if(typeof r==`string`&&this.config.joins.some(e=>e.alias===r))throw Error(`Alias "${r}" is already used in this query`);if(typeof n==`function`){let e=this.config.from&&!Q(this.config.from,iZ)?this.getTableLikeFields(this.config.from):void 0;n=n(new Proxy(this.config.table[ZX.Symbol.Columns],new GQ({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})),e&&new Proxy(e,new GQ({sqlAliasedBehavior:`sql`,sqlBehavior:`sql`})))}if(this.config.joins.push({on:n,table:t,joinType:e,alias:r}),typeof r==`string`)switch(e){case`left`:this.joinsNotNullableMap[r]=!1;break;case`right`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!0;break;case`inner`:this.joinsNotNullableMap[r]=!0;break;case`full`:this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[r]=!1;break}return this}}where(e){return this.config.where=e,this}returning(e){if(!e&&(e=Object.assign({},this.config.table[ZX.Symbol.Columns]),this.config.from)){let t=NZ(this.config.from);if(typeof t==`string`&&this.config.from&&!Q(this.config.from,iZ)){let n=this.getTableLikeFields(this.config.from);e[t]=n}for(let t of this.config.joins){let n=NZ(t.table);if(typeof n==`string`&&!Q(t.table,iZ)){let r=this.getTableLikeFields(t.table);e[n]=r}}}return this.config.returningFields=e,this.config.returning=OZ(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e){let t=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0,void 0,{type:`insert`,tables:d$(this.config.table)},this.cacheConfig);return t.joinsNotNullableMap=this.joinsNotNullableMap,t}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new GQ({alias:QX(this.config.table),sqlAliasedBehavior:`alias`,sqlBehavior:`error`})):void 0}$dynamic(){return this}},e.defineProperty(zi,Z,`PgUpdate`),zi),v$=(ra=Symbol.toStringTag,Bi=class t extends iZ{constructor(n){super(t.buildEmbeddedCount(n.source,n.filters).queryChunks),e.defineProperty(this,`sql`,void 0),e.defineProperty(this,`token`,void 0),e.defineProperty(this,ra,`PgCountBuilder`),e.defineProperty(this,`session`,void 0),this.params=n,this.mapWith(Number),this.session=n.session,this.sql=t.buildCount(n.source,n.filters)}static buildEmbeddedCount(e,t){return $`(select count(*) from ${e}${$.raw(` where `).if(t)}${t})`}static buildCount(e,t){return $`select count(*) as count from ${e}${$.raw(` where `).if(t)}${t};`}setToken(e){return this.token=e,this}then(e,t){return Promise.resolve(this.session.count(this.sql,this.token)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}},e.defineProperty(Bi,Z,`PgCountBuilder`),Bi),y$=(Vi=class{constructor(e,t,n,r,i,a,o){this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=r,this.tableConfig=i,this.dialect=a,this.session=o}findMany(e){return new b$(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},`many`)}findFirst(e){return new b$(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},`first`)}},e.defineProperty(Vi,Z,`PgRelationalQueryBuilder`),Vi),b$=(Hi=class extends DZ{constructor(t,n,r,i,a,o,s,c,l){super(),e.defineProperty(this,`authToken`,void 0),this.fullSchema=t,this.schema=n,this.tableNamesMap=r,this.table=i,this.tableConfig=a,this.dialect=o,this.session=s,this.config=c,this.mode=l}_prepare(e){return VX.startActiveSpan(`drizzle.prepareQuery`,()=>{let{query:t,builtQuery:n}=this._toSQL();return this.session.prepareQuery(n,void 0,e,!0,(e,n)=>{let r=e.map(e=>WQ(this.schema,this.tableConfig,e,t.selection,n));return this.mode===`first`?r[0]:r})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){let e=this._getQuery(),t=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:t}}toSQL(){return this._toSQL().builtQuery}setToken(e){return this.authToken=e,this}execute(){return VX.startActiveSpan(`drizzle.operation`,()=>this._prepare().execute(void 0,this.authToken))}},e.defineProperty(Hi,Z,`PgRelationalQuery`),Hi),x$=(Ui=class extends DZ{constructor(e,t,n,r){super(),this.execute=e,this.sql=t,this.query=n,this.mapBatchResult=r}getSQL(){return this.sql}getQuery(){return this.query}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}},e.defineProperty(Ui,Z,`PgRaw`),Ui),S$=(Wi=class{constructor(t,n,r){if(e.defineProperty(this,`query`,void 0),e.defineProperty(this,`$with`,(e,t)=>{let n=this,r=r=>(typeof r==`function`&&(r=r(new u$(n.dialect))),new Proxy(new LX(r.getSQL(),t??(`getSelectedFields`in r?r.getSelectedFields()??{}:{}),e,!0),new GQ({alias:e,sqlAliasedBehavior:`alias`,sqlBehavior:`error`})));return{as:r}}),e.defineProperty(this,`$cache`,void 0),e.defineProperty(this,`authToken`,void 0),this.dialect=t,this.session=n,this._=r?{schema:r.schema,fullSchema:r.fullSchema,tableNamesMap:r.tableNamesMap,session:n}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:n},this.query={},this._.schema)for(let[e,i]of Object.entries(this._.schema))this.query[e]=new y$(r.fullSchema,this._.schema,this._.tableNamesMap,r.fullSchema[e],i,t,n);this.$cache={invalidate:async e=>{}}}$count(e,t){return new v$({source:e,filters:t,session:this.session})}with(...e){let t=this;function n(n){return new $Q({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e})}function r(n){return new $Q({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})}function i(n,r){return new $Q({fields:r??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:{on:n}})}function a(n){return new g$(n,t.session,t.dialect,e)}function o(n){return new p$(n,t.session,t.dialect,e)}function s(n){return new f$(n,t.session,t.dialect,e)}return{select:n,selectDistinct:r,selectDistinctOn:i,update:a,insert:o,delete:s}}select(e){return new $Q({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new $Q({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(e,t){return new $Q({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:{on:e}})}update(e){return new g$(e,this.session,this.dialect)}insert(e){return new p$(e,this.session,this.dialect)}delete(e){return new f$(e,this.session,this.dialect)}refreshMaterializedView(e){return new h$(e,this.session,this.dialect)}execute(e){let t=typeof e==`string`?$.raw(e):e.getSQL(),n=this.dialect.sqlToQuery(t),r=this.session.prepareQuery(n,void 0,void 0,!1);return new x$(()=>r.execute(void 0,this.authToken),t,n,e=>r.mapResult(e,!0))}transaction(e,t){return this.session.transaction(e,t)}},e.defineProperty(Wi,Z,`PgDatabase`),Wi),C$=(Gi=class{},e.defineProperty(Gi,Z,`Cache`),Gi),w$=(Ki=class extends C${strategy(){return`all`}async get(e){}async put(e,t,n,r){}async onMutate(e){}},e.defineProperty(Ki,Z,`NoopCache`),Ki);async function T$(e,t){let n=`${e}-${JSON.stringify(t)}`,r=new TextEncoder,i=r.encode(n),a=await crypto.subtle.digest(`SHA-256`,i),o=[...new Uint8Array(a)],s=o.map(e=>e.toString(16).padStart(2,`0`)).join(``);return s}var E$=class e extends Error{constructor(t,n,r){super(`Failed query: ${t}
-params: ${n}`),this.query=t,this.params=n,this.cause=r,Error.captureStackTrace(this,e),r&&(this.cause=r)}},D$=(qi=class{constructor(t,n,r,i){var a;e.defineProperty(this,`authToken`,void 0),e.defineProperty(this,`joinsNotNullableMap`,void 0),this.query=t,this.cache=n,this.queryMetadata=r,this.cacheConfig=i,n&&n.strategy()===`all`&&i===void 0&&(this.cacheConfig={enable:!0,autoInvalidate:!0}),(a=this.cacheConfig)?.enable||(this.cacheConfig=void 0)}getQuery(){return this.query}mapResult(e,t){return e}setToken(e){return this.authToken=e,this}async queryWithCache(e,t,n){if(this.cache===void 0||Q(this.cache,w$)||this.queryMetadata===void 0)try{return await n()}catch(n){throw new E$(e,t,n)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await n()}catch(n){throw new E$(e,t,n)}if((this.queryMetadata.type===`insert`||this.queryMetadata.type===`update`||this.queryMetadata.type===`delete`)&&this.queryMetadata.tables.length>0)try{let[e]=await Promise.all([n(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return e}catch(n){throw new E$(e,t,n)}if(!this.cacheConfig)try{return await n()}catch(n){throw new E$(e,t,n)}if(this.queryMetadata.type===`select`){let r=await this.cache.get(this.cacheConfig.tag??await T$(e,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(r===void 0){let r;try{r=await n()}catch(n){throw new E$(e,t,n)}return await this.cache.put(this.cacheConfig.tag??await T$(e,t),r,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),r}return r}try{return await n()}catch(n){throw new E$(e,t,n)}}},e.defineProperty(qi,Z,`PgPreparedQuery`),qi),O$=(Ji=class{constructor(e){this.dialect=e}execute(e,t){return VX.startActiveSpan(`drizzle.operation`,()=>{let n=VX.startActiveSpan(`drizzle.prepareQuery`,()=>this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1));return n.setToken(t).execute(void 0,t)})}all(e){return this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1).all()}async count(e,t){let n=await this.execute(e,t);return Number(n[0].count)}},e.defineProperty(Ji,Z,`PgSession`),Ji),k$=(Yi=class extends S${constructor(e,t,n,r=0){super(e,t,n),this.schema=n,this.nestedIndex=r}rollback(){throw new CZ}getTransactionConfigSQL(e){let t=[];return e.isolationLevel&&t.push(`isolation level ${e.isolationLevel}`),e.accessMode&&t.push(e.accessMode),typeof e.deferrable==`boolean`&&t.push(e.deferrable?`deferrable`:`not deferrable`),$.raw(t.join(` `))}setTransaction(e){return this.session.execute($`set transaction ${this.getTransactionConfigSQL(e)}`)}},e.defineProperty(Yi,Z,`PgTransaction`),Yi);function A$(e){return typeof e==`string`&&/^true$/i.test(e)}function j$(e){let t={scheme:`duckdb-wasm:`},n=new URL(e);if(!n.protocol.startsWith(`duckdb-wasm:`))throw Error(`Expected scheme to be "duckdb-wasm:" but got "${n.protocol}"`);n.searchParams.get(`bundles`)===`import-url`&&(t.bundles=`import-url`);let r=n.searchParams.get(`logger`);r&&A$(r)&&(t.logger=!0);let i=n.searchParams.get(`storage`);switch(i){case aX.ORIGIN_PRIVATE_FS:{n.host.length>0&&console.warn(`Host "${n.host}" will be ignored while using Origin Private FS`);let e=n.searchParams.get(`write`);t.storage={type:aX.ORIGIN_PRIVATE_FS,path:n.pathname.startsWith(`/`)?n.pathname.slice(1):n.pathname,...e&&A$(e)&&{accessMode:TB.READ_WRITE}};break}case null:break;default:console.warn(`Unknown storage type "${i}"`);break}return t}var M$=(Xi=class extends D${constructor(e,t,n,r,i,a){super({sql:t,params:n}),this.client=e,this.queryString=t,this.params=n,this.logger=r,this.fields=i,this.customResultMapper=a}async execute(e={}){let t=fZ(this.params,e);this.logger.logQuery(this.queryString,t);let{fields:n,queryString:r,client:i,customResultMapper:a}=this,o=await i;return o.query(r,t)}async all(e={}){let t=fZ(this.params,e);this.logger.logQuery(this.queryString,t);let n=await this.client;return n.query(this.queryString,t)}},e.defineProperty(Xi,Z,`DuckDBWasmPreparedQuery`),Xi),N$=(Zi=class t extends O${constructor(t,n,r,i={}){super(n),e.defineProperty(this,`logger`,void 0),this.client=t,this.schema=r,this.options=i,this.logger=i.logger??new EZ}prepareQuery(e,t,n,r,i){return new M$(this.client,e.sql,e.params,this.logger,t,i)}async query(e,t){this.logger.logQuery(e,t);let n=await this.client;return n.query(e,t)}async queryObjects(e,t){this.logger.logQuery(e,t);let n=await this.client;return n.query(e,t)}transaction(e,n){return sX(this.client,async r=>{let i=new t(r,this.dialect,this.schema,this.options),a=new P$(this.dialect,i,this.schema);return n&&await a.setTransaction(n),e(a)})}},e.defineProperty(Zi,Z,`DuckDBWasmSession`),Zi),P$=(Qi=class t extends k${constructor(t,n,r,i=0){super(t,n,r,i),e.defineProperty(this,`dialect`,void 0),e.defineProperty(this,`session`,void 0),this.dialect=t,this.session=n}async transaction(e){return cX(this.session.client,``,async n=>{let r=new N$(n,this.dialect,this.schema,this.session.options),i=new t(this.dialect,r,this.schema);return e(i)})}},e.defineProperty(Qi,Z,`DuckDBWasmTransaction`),Qi),F$=($i=class extends S${},e.defineProperty($i,Z,`DuckDBWasmDatabase`),$i);function I$(e,t={}){let n=new ZQ({casing:t.casing}),r;t.logger===!0?r=new TZ:t.logger!==!1&&(r=t.logger);let i;if(t.schema){let e=zQ(t.schema,UQ);i={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let a=new N$(e,n,i,{logger:r}),o=new F$(n,a,i);return o.$client=e,o}function L$(e,t){let n=j$(e),r;if(n.bundles===`import-url`){let e=async()=>{let e=await MY();switch(e){case`browser`:return(await Et(async()=>{let{getImportUrlBundles:e}=await import(`./import-url-browser-CajlDqRn.js`);return{getImportUrlBundles:e}},__vite__mapDeps([4,5,6]))).getImportUrlBundles();case`node`:return await(await Et(async()=>{let{getImportUrlBundles:e}=await import(`./import-url-node-BGiLk3V8.js`);return{getImportUrlBundles:e}},__vite__mapDeps([7,6]))).getImportUrlBundles();default:throw Error(`Unsupported environment: "${e}"`)}};r=e()}else{let e=async()=>{let e=await MY();switch(e){case`browser`:return(await Et(async()=>{let{getBundles:e}=await import(`./default-browser-DTRWbcB3.js`);return{getBundles:e}},[])).getBundles();case`node`:return await(await Et(async()=>{let{getBundles:e}=await import(`./default-node-BTCCoimW.js`);return{getBundles:e}},__vite__mapDeps([3,1,2]))).getBundles();default:throw Error(`Unsupported environment: "${e}"`)}};r=e()}return I$(oX({bundles:r,logger:n.logger?new MB:void 0,storage:n.storage}),t)}function R$(...e){if(typeof e[0]==`string`)return L$(e[0],e[1]);if(PZ(e[0])){let{connection:t,client:n,...r}=e[0];if(n)return I$(n,r);if(typeof t==`string`)return L$(t,r);if(t===void 0)throw Error(`connection option is required`);return I$(oX({bundles:t.bundles,logger:t.logger,storage:t.storage}),r)}return I$(e[0],e[1])}(function(e){function t(e){return I$({options:{parsers:{},serializers:{}}},e)}e.mock=t})(R$||={});const z$={relative:``},B$={"h-full":``,"w-full":``},V$={key:0,class:`animate-stripe`,absolute:``,left:`1/2`,bottom:`20%`,z:`20`,"rounded-2xl":``,text:`primary-600`,"px-2":``,"py-2":``,transform:`translate-x--1/2`},H$={bg:`primary-50`,"rounded-xl":``,"px-10":``,"py-6":``},U$=[`innerHTML`];var W$=H({__name:`Stage`,props:{paused:{type:Boolean,default:!1},focusAt:null},setup(e){let t=W(),n=W(),{stageView:r}=ln(Cn()),{mouthOpenSize:i}=ln(Vn()),{audioContext:a,calculateVolume:o}=Rn(),{onBeforeMessageComposed:s,onBeforeSend:c,onTokenLiteral:l,onTokenSpecial:u,onStreamEnd:d,streamingMessage:f,onAssistantResponseEnd:p}=zn(),{process:m}=rr(),h=Bn(),g=W(),_=W(!1),v=W(!1),y=ar({handlers:[e=>new Promise(t=>{let n=a.createBufferSource();n.buffer=e.data.audioBuffer,n.connect(a.destination),n.connect(g.value),_.value=!0,n.start(0),n.onended=()=>{_.value=!1,t()}})]}),b=Hn(),{ssmlEnabled:x,activeSpeechProvider:S,activeSpeechModel:C,activeSpeechVoice:w,pitch:T}=ln(b);async function E(e){try{if(!S.value){console.warn(`No active speech provider configured`);return}if(!w.value){console.warn(`No active speech voice configured`);return}let t=h.getProviderInstance(S.value);if(!t){console.error(`Failed to initialize speech provider`);return}let n=h.getProviderConfig(S.value),r=x.value?b.generateSSML(e.data,w.value,{...n,pitch:T.value}):e.data,i=await Ln({...t.speech(C.value,n),input:r,voice:w.value.id}),o=await a.decodeAudioData(i);await y.add({audioBuffer:o,text:e.data})}catch(e){console.error(`Speech generation failed:`,e)}}let D=ar({handlers:[E]});D.on(`add`,e=>{console.debug(`ttsQueue added`,e)});let O=fr(D),{live2dCurrentMotion:k}=ln(Cn()),A=ar({handlers:[async e=>{if(r.value===`3d`){let t=sr[e.data];if(!t)return;await n.value.setExpression(t)}else r.value===`2d`&&(k.value={group:or[e.data]})}]}),j=dr(A);j.onHandlerEvent(`emotion`,e=>{console.debug(`emotion detected`,e)});let M=ur();M.onHandlerEvent(`delay`,e=>{console.debug(`delay detected`,e)});function N(){requestAnimationFrame(N),_.value&&(i.value=o(g.value,`linear`))}function ee(){v.value||(N(),a.resume(),v.value=!0)}function P(){g.value||=a.createAnalyser()}return s(async()=>{P(),ee()}),c(async()=>{k.value={group:cr}}),l(async e=>{await O.add(e)}),u(async e=>{await M.add(e),await j.add(e)}),d(async()=>{await M.add(lr)}),p(async e=>{}),Zt(()=>{v.value=!1}),Yt(async()=>{t.value=R$({connection:{bundles:In()}}),await t.value.execute(`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(t,a)=>(U(),V(`div`,z$,[B(`div`,B$,[G(r)===`2d`?(U(),kt(yb,{key:0,"focus-at":e.focusAt,"mouth-open-size":G(i),"min-w":`50% 0)try{let[e]=await Promise.all([n(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return e}catch(n){throw new E$(e,t,n)}if(!this.cacheConfig)try{return await n()}catch(n){throw new E$(e,t,n)}if(this.queryMetadata.type===`select`){let r=await this.cache.get(this.cacheConfig.tag??await T$(e,t),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if(r===void 0){let r;try{r=await n()}catch(n){throw new E$(e,t,n)}return await this.cache.put(this.cacheConfig.tag??await T$(e,t),r,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),r}return r}try{return await n()}catch(n){throw new E$(e,t,n)}}},e.defineProperty(qi,Z,`PgPreparedQuery`),qi),O$=(Ji=class{constructor(e){this.dialect=e}execute(e,t){return VX.startActiveSpan(`drizzle.operation`,()=>{let n=VX.startActiveSpan(`drizzle.prepareQuery`,()=>this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1));return n.setToken(t).execute(void 0,t)})}all(e){return this.prepareQuery(this.dialect.sqlToQuery(e),void 0,void 0,!1).all()}async count(e,t){let n=await this.execute(e,t);return Number(n[0].count)}},e.defineProperty(Ji,Z,`PgSession`),Ji),k$=(Yi=class extends S${constructor(e,t,n,r=0){super(e,t,n),this.schema=n,this.nestedIndex=r}rollback(){throw new CZ}getTransactionConfigSQL(e){let t=[];return e.isolationLevel&&t.push(`isolation level ${e.isolationLevel}`),e.accessMode&&t.push(e.accessMode),typeof e.deferrable==`boolean`&&t.push(e.deferrable?`deferrable`:`not deferrable`),$.raw(t.join(` `))}setTransaction(e){return this.session.execute($`set transaction ${this.getTransactionConfigSQL(e)}`)}},e.defineProperty(Yi,Z,`PgTransaction`),Yi);function A$(e){return typeof e==`string`&&/^true$/i.test(e)}function j$(e){let t={scheme:`duckdb-wasm:`},n=new URL(e);if(!n.protocol.startsWith(`duckdb-wasm:`))throw Error(`Expected scheme to be "duckdb-wasm:" but got "${n.protocol}"`);n.searchParams.get(`bundles`)===`import-url`&&(t.bundles=`import-url`);let r=n.searchParams.get(`logger`);r&&A$(r)&&(t.logger=!0);let i=n.searchParams.get(`storage`);switch(i){case aX.ORIGIN_PRIVATE_FS:{n.host.length>0&&console.warn(`Host "${n.host}" will be ignored while using Origin Private FS`);let e=n.searchParams.get(`write`);t.storage={type:aX.ORIGIN_PRIVATE_FS,path:n.pathname.startsWith(`/`)?n.pathname.slice(1):n.pathname,...e&&A$(e)&&{accessMode:TB.READ_WRITE}};break}case null:break;default:console.warn(`Unknown storage type "${i}"`);break}return t}var M$=(Xi=class extends D${constructor(e,t,n,r,i,a){super({sql:t,params:n}),this.client=e,this.queryString=t,this.params=n,this.logger=r,this.fields=i,this.customResultMapper=a}async execute(e={}){let t=fZ(this.params,e);this.logger.logQuery(this.queryString,t);let{fields:n,queryString:r,client:i,customResultMapper:a}=this,o=await i;return o.query(r,t)}async all(e={}){let t=fZ(this.params,e);this.logger.logQuery(this.queryString,t);let n=await this.client;return n.query(this.queryString,t)}},e.defineProperty(Xi,Z,`DuckDBWasmPreparedQuery`),Xi),N$=(Zi=class t extends O${constructor(t,n,r,i={}){super(n),e.defineProperty(this,`logger`,void 0),this.client=t,this.schema=r,this.options=i,this.logger=i.logger??new EZ}prepareQuery(e,t,n,r,i){return new M$(this.client,e.sql,e.params,this.logger,t,i)}async query(e,t){this.logger.logQuery(e,t);let n=await this.client;return n.query(e,t)}async queryObjects(e,t){this.logger.logQuery(e,t);let n=await this.client;return n.query(e,t)}transaction(e,n){return sX(this.client,async r=>{let i=new t(r,this.dialect,this.schema,this.options),a=new P$(this.dialect,i,this.schema);return n&&await a.setTransaction(n),e(a)})}},e.defineProperty(Zi,Z,`DuckDBWasmSession`),Zi),P$=(Qi=class t extends k${constructor(t,n,r,i=0){super(t,n,r,i),e.defineProperty(this,`dialect`,void 0),e.defineProperty(this,`session`,void 0),this.dialect=t,this.session=n}async transaction(e){return cX(this.session.client,``,async n=>{let r=new N$(n,this.dialect,this.schema,this.session.options),i=new t(this.dialect,r,this.schema);return e(i)})}},e.defineProperty(Qi,Z,`DuckDBWasmTransaction`),Qi),F$=($i=class extends S${},e.defineProperty($i,Z,`DuckDBWasmDatabase`),$i);function I$(e,t={}){let n=new ZQ({casing:t.casing}),r;t.logger===!0?r=new TZ:t.logger!==!1&&(r=t.logger);let i;if(t.schema){let e=zQ(t.schema,UQ);i={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}let a=new N$(e,n,i,{logger:r}),o=new F$(n,a,i);return o.$client=e,o}function L$(e,t){let n=j$(e),r;if(n.bundles===`import-url`){let e=async()=>{let e=await MY();switch(e){case`browser`:return(await Et(async()=>{let{getImportUrlBundles:e}=await import(`./import-url-browser-CajlDqRn.js`);return{getImportUrlBundles:e}},__vite__mapDeps([5,6,7]))).getImportUrlBundles();case`node`:return await(await Et(async()=>{let{getImportUrlBundles:e}=await import(`./import-url-node-BGiLk3V8.js`);return{getImportUrlBundles:e}},__vite__mapDeps([8,7]))).getImportUrlBundles();default:throw Error(`Unsupported environment: "${e}"`)}};r=e()}else{let e=async()=>{let e=await MY();switch(e){case`browser`:return(await Et(async()=>{let{getBundles:e}=await import(`./default-browser-DTRWbcB3.js`);return{getBundles:e}},[])).getBundles();case`node`:return await(await Et(async()=>{let{getBundles:e}=await import(`./default-node-G9zSbWb2.js`);return{getBundles:e}},__vite__mapDeps([4,2,3]))).getBundles();default:throw Error(`Unsupported environment: "${e}"`)}};r=e()}return I$(oX({bundles:r,logger:n.logger?new MB:void 0,storage:n.storage}),t)}function R$(...e){if(typeof e[0]==`string`)return L$(e[0],e[1]);if(PZ(e[0])){let{connection:t,client:n,...r}=e[0];if(n)return I$(n,r);if(typeof t==`string`)return L$(t,r);if(t===void 0)throw Error(`connection option is required`);return I$(oX({bundles:t.bundles,logger:t.logger,storage:t.storage}),r)}return I$(e[0],e[1])}(function(e){function t(e){return I$({options:{parsers:{},serializers:{}}},e)}e.mock=t})(R$||={});const z$={relative:``},B$={"h-full":``,"w-full":``},V$={key:0,class:`animate-stripe`,absolute:``,left:`1/2`,bottom:`20%`,z:`20`,"rounded-2xl":``,text:`primary-600`,"px-2":``,"py-2":``,transform:`translate-x--1/2`},H$={bg:`primary-50`,"rounded-xl":``,"px-10":``,"py-6":``},U$=[`innerHTML`];var W$=H({__name:`Stage`,props:{paused:{type:Boolean,default:!1},focusAt:null},setup(e){let t=W(),n=W(),{stageView:r}=ln(Cn()),{mouthOpenSize:i}=ln(Vn()),{audioContext:a,calculateVolume:o}=Rn(),{onBeforeMessageComposed:s,onBeforeSend:c,onTokenLiteral:l,onTokenSpecial:u,onStreamEnd:d,streamingMessage:f,onAssistantResponseEnd:p}=zn(),{process:m}=rr(),h=Bn(),g=W(),_=W(!1),v=W(!1),y=ar({handlers:[e=>new Promise(t=>{let n=a.createBufferSource();n.buffer=e.data.audioBuffer,n.connect(a.destination),n.connect(g.value),_.value=!0,n.start(0),n.onended=()=>{_.value=!1,t()}})]}),b=Hn(),{ssmlEnabled:x,activeSpeechProvider:S,activeSpeechModel:C,activeSpeechVoice:w,pitch:T}=ln(b);async function E(e){try{if(!S.value){console.warn(`No active speech provider configured`);return}if(!w.value){console.warn(`No active speech voice configured`);return}let t=h.getProviderInstance(S.value);if(!t){console.error(`Failed to initialize speech provider`);return}let n=h.getProviderConfig(S.value),r=x.value?b.generateSSML(e.data,w.value,{...n,pitch:T.value}):e.data,i=await Ln({...t.speech(C.value,n),input:r,voice:w.value.id}),o=await a.decodeAudioData(i);await y.add({audioBuffer:o,text:e.data})}catch(e){console.error(`Speech generation failed:`,e)}}let D=ar({handlers:[E]});D.on(`add`,e=>{console.debug(`ttsQueue added`,e)});let O=fr(D),{live2dCurrentMotion:k}=ln(Cn()),A=ar({handlers:[async e=>{if(r.value===`3d`){let t=sr[e.data];if(!t)return;await n.value.setExpression(t)}else r.value===`2d`&&(k.value={group:or[e.data]})}]}),j=dr(A);j.onHandlerEvent(`emotion`,e=>{console.debug(`emotion detected`,e)});let M=ur();M.onHandlerEvent(`delay`,e=>{console.debug(`delay detected`,e)});function N(){requestAnimationFrame(N),_.value&&(i.value=o(g.value,`linear`))}function ee(){v.value||(N(),a.resume(),v.value=!0)}function P(){g.value||=a.createAnalyser()}return s(async()=>{P(),ee()}),c(async()=>{k.value={group:cr}}),l(async e=>{await O.add(e)}),u(async e=>{await M.add(e),await j.add(e)}),d(async()=>{await M.add(lr)}),p(async e=>{}),Zt(()=>{v.value=!1}),Yt(async()=>{t.value=R$({connection:{bundles:In()}}),await t.value.execute(`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(t,a)=>(U(),V(`div`,z$,[B(`div`,B$,[G(r)===`2d`?(U(),kt(yb,{key:0,"focus-at":e.focusAt,"mouth-open-size":G(i),"min-w":`50% =array.length-1?``:array[index$1+offset]}function useLlmmarkerParser(options){let state=States.Literal,buffer=``;return{async consume(textPart){for(let i=0;i