@g4rcez/components 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -167,5 +167,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
167
167
  *
168
168
  * This source code is licensed under the MIT license found in the
169
169
  * LICENSE file in the root directory of this source tree.
170
- */var pb;function wM(){return pb||(pb=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=b,t=fb();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;function c(u,f,d,h,p){var m=s(null),y;m.current===null?(y={hasValue:!1,value:null},m.current=y):y=m.current;var v=a(function(){var x=!1,E,C,O=function(_){if(!x){x=!0,E=_;var j=h(_);if(p!==void 0&&y.hasValue){var D=y.value;if(p(D,j))return C=D,D}return C=j,j}var k=E,F=C;if(r(k,_))return F;var $=h(_);return p!==void 0&&p(F,$)?F:(E=_,C=$,$)},I=d===void 0?null:d,N=function(){return O(f())},L=I===null?void 0:function(){return O(I())};return[N,L]},[f,d,h,p]),w=v[0],g=v[1],T=o(u,w,g);return i(function(){y.hasValue=!0,y.value=T},[T]),l(T),T}hb.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),hb}process.env.NODE_ENV==="production"?bM():wM();const Do=e=>{const t=b.useRef(e??{});return b.useEffect(()=>void(t.current=e),[e]),t},xM=e=>{const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current},SM=e=>Object.entries(e),mb=e=>e instanceof Promise,gb=(e,t,n,r)=>t===e?n.reduce((o,s)=>s(o,t,r),e):e.constructor.name===Object.name?n.reduce((o,s)=>s(o,t,r),{...t,...e}):n.reduce((o,s)=>s(o,t,r),e),TM=(e,t,n,r,o,s)=>(...i)=>{const a=performance.now(),l=t(...i),c=(u,f)=>n(d=>gb(u,d,s,f));return mb(l)?l.then(u=>{o.current={method:e,props:r(),time:performance.now()-a},c(u,o.current)}):(o.current={method:e,props:r(),time:performance.now()-a},void c(l,o.current))},EM=(e,t,n,r,o,s)=>(...i)=>{o.current={method:e,time:0,props:r()};const a=t(...i),l=c=>n(u=>gb(c,u,s,o.current));return mb(a)?a.then(c=>l(c)):l(a)},ef=(e,t,n)=>{const[r,o]=b.useState(()=>e),s=Do(r),i=Do((n==null?void 0:n.props)??{}),a=Do(t),l=Do((n==null?void 0:n.postMiddleware)??[]),c=Do((n==null?void 0:n.interceptor)??[]),u=b.useRef(e),f=xM(r),d=Do(f),h=b.useRef(null);b.useEffect(()=>{if(h.current===null)return;const m=h.current;l.current.forEach(y=>{y(r,f,m)})},[r,l,f]);const[p]=b.useState(()=>{const m=()=>i.current,y=a.current({props:m,state:()=>s.current,initialState:u.current,previousState:()=>d.current});return SM(y).reduce((v,[w,g])=>({...v,[w]:n!=null&&n.debug?TM(w,g,o,m,h,c.current):EM(w,g,o,m,h,c.current)}),{})});return[r,p,i.current]},CM=(e,t=0)=>{let n;return function(...o){clearTimeout(n),n=setTimeout(()=>e(...o),t)}};function PM(e,t){return b.useRef(CM(e,t)).current}function tf(e,t,n){var r,o,s,i,a;t==null&&(t=100);function l(){var u=Date.now()-i;u<t&&u>=0?r=setTimeout(l,t-u):(r=null,n||(a=e.apply(s,o),s=o=null))}var c=function(){s=this,o=arguments,i=Date.now();var u=n&&!r;return r||(r=setTimeout(l,t)),u&&(a=e.apply(s,o),s=o=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=e.apply(s,o),s=o=null,clearTimeout(r),r=null)},c}tf.debounce=tf;var OM=tf;const yb=Jd(OM);function kM(e){let{debounce:t,scroll:n,polyfill:r,offsetSize:o}={debounce:0,scroll:!1,offsetSize:!1};const s=r||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[i,a]=b.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=b.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:i}),c=t?typeof t=="number"?t:t.scroll:null,u=t?typeof t=="number"?t:t.resize:null,f=b.useRef(!1);b.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[d,h,p]=b.useMemo(()=>{const w=()=>{if(!l.current.element)return;const{left:g,top:T,width:x,height:E,bottom:C,right:O,x:I,y:N}=l.current.element.getBoundingClientRect(),L={left:g,top:T,width:x,height:E,bottom:C,right:O,x:I,y:N};l.current.element instanceof HTMLElement&&o&&(L.height=l.current.element.offsetHeight,L.width=l.current.element.offsetWidth),Object.freeze(L),f.current&&!DM(l.current.lastBounds,L)&&a(l.current.lastBounds=L)};return[w,u?yb(w,u):w,c?yb(w,c):w]},[a,o,c,u]);function m(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",p,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function y(){l.current.element&&(l.current.resizeObserver=new s(p),l.current.resizeObserver.observe(l.current.element),n&&l.current.scrollContainers&&l.current.scrollContainers.forEach(w=>w.addEventListener("scroll",p,{capture:!0,passive:!0})))}const v=w=>{!w||w===l.current.element||(m(),l.current.element=w,l.current.scrollContainers=vb(w),y())};return AM(p,!!n),_M(h),b.useEffect(()=>{m(),y()},[n,p,h]),b.useEffect(()=>m,[]),[v,i,d]}function _M(e){b.useEffect(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function AM(e,t){b.useEffect(()=>{if(t){const n=e;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[e,t])}function vb(e){const t=[];if(!e||e===document.body)return t;const{overflow:n,overflowX:r,overflowY:o}=window.getComputedStyle(e);return[n,r,o].some(s=>s==="auto"||s==="scroll")&&t.push(e),[...t,...vb(e.parentElement)]}const IM=["x","y","top","bottom","left","right","width","height"],DM=(e,t)=>IM.every(n=>e[n]===t[n]),MM=({children:e})=>{const[t,n]=kM();return S.jsx(Jt.div,{animate:{height:n.height>0?n.height:"auto"},children:S.jsx("div",{ref:t,children:e})})},NM={type:"spring",bounce:.1,duration:.3},bb=e=>(t=1)=>({x:`${100*e*t}%`,opacity:.5}),wb={middle:{x:"0%",opacity:1},enter:bb(1),exit:bb(-1)},xb={exit:{visibility:"hidden"}},FM=e=>{const t=vn(Zm(e));return Km({start:t,end:yo(t,41)})},Sb=(e,t)=>e.toLocaleDateString(t,{month:"long"}),LM=(e,t)=>Array.from({length:12}).map((n,r)=>{const o=Zm(new Date(e).setMonth(r)),s=Sb(o,t);return S.jsx("option",{value:s,"data-index":r,children:s},s)}),nf={ArrowLeft:(e,t)=>t==="days"?kk(e,1):fg(e,1),ArrowRight:(e,t)=>t==="days"?yo(e,1):Ji(e,1),ArrowUp:(e,t)=>t==="days"?_k(e,1):Ak(e,1),ArrowDown:(e,t)=>t==="days"?Ym(e,1):qm(e,1)},Tb=(e,t=0)=>{const n=e.toISOString(),r=()=>{const o=document.querySelector(`button[data-date="${n}"]`);if(o)return o.focus({preventScroll:!1})};t===0&&r(),setTimeout(r,t)},Nr=e=>e.getFullYear().toString().padStart(4,"0"),Eb=({locale:e,disabledDate:t,markToday:n=!0,autoFocusToday:r=!0,date:o,onChange:s})=>{const i=o||new Date,[a,l]=ef({date:i,isAnimating:!1,year:Nr(i),direction:void 0,months:LM(i,e),week:Km({start:vn(i),end:$P(i)})},p=>({onChangeYear:m=>({year:m}),setToday:()=>({date:bo(new Date)}),onExitComplete:()=>(Tb(p.state().date,200),{isAnimating:!1}),date:m=>{const y=m(p.state().date);return{date:y,year:Nr(y)}},nextMonth:()=>{const m=p.state();if(m.isAnimating)return m;const y=Ji(m.date,1);return{date:y,isAnimating:!0,direction:1,year:Nr(y)}},previousMonth:()=>{const m=p.state();if(m.isAnimating)return m;const y=fg(m.date,1);return{date:y,isAnimating:!0,direction:-1,year:Nr(y)}},onSelectDate:m=>{const y=m.currentTarget.dataset.date||"",v=new Date(y);return{date:v,year:Nr(v)}},onChangeMonth:m=>{const y=m.target.value,w=Array.from(m.target.options).find(g=>g.value===y);if(w){const g=w.dataset.index||"",T=new Date(p.state().date);return T.setMonth(+g),{date:T,year:Nr(T)}}return p.state()},onKeyDown:m=>{const y=m.key;if(y in nf){(y==="ArrowUp"||y==="ArrowDown")&&m.preventDefault();const v=p.state().date,w=kn.keyof(nf,y)?nf[y](v,m.shiftKey?"month":"days"):null;if(w!==null)return Tb(w),{date:w,year:Nr(w)}}return p.state()}})),c=FM(a.date),u=a.date.toISOString(),f=Sb(a.date,e);b.useEffect(()=>s==null?void 0:s(a.date),[u]);const d=PM(p=>{l.date(m=>{const y=new Date(m);return y.setFullYear(+p),y})},700),h=p=>{const m=p.currentTarget.value;l.onChangeYear(m),d(m)};return S.jsx(XD,{transition:NM,children:S.jsxs("div",{className:"relative overflow-hidden",children:[S.jsx("div",{className:"flex flex-col justify-center rounded text-center",children:S.jsx(MM,{children:S.jsx(Ea,{presenceAffectsLayout:!0,mode:"popLayout",initial:!1,custom:a.direction,onExitComplete:l.onExitComplete,children:S.jsxs(Jt.div,{initial:"enter",animate:"middle",exit:"exit",children:[S.jsxs("header",{className:"relative flex justify-between",children:[S.jsx(Jt.button,{onClick:l.previousMonth,variants:xb,className:"z-calendar rounded-full p-1.5 hover:bg-primary-subtle",children:S.jsx(ux,{className:"h-4 w-4"})}),S.jsx(Jt.span,{variants:wb,custom:a.direction,className:"absolute z-normal isolate inset-0 flex items-center justify-center font-semibold",children:S.jsxs("span",{className:"w-fit flex items-center justify-center gap-0.5 py-1",children:[S.jsx("select",{style:{width:`${f.length}ch`},value:f,onChange:l.onChangeMonth,className:"appearance-none capitalize bg-transparent proportional-nums hover:text-primary cursor-pointer w-fit",children:a.months}),S.jsx(fp,{mask:"int",value:a.year,maxLength:4,placeholder:"YYYY",onChange:h,style:{width:`${a.year.length}ch`},className:"w-16 bg-transparent appearance-none hover:text-primary cursor-pointer"})]})}),S.jsx(Jt.button,{variants:xb,className:"z-calendar rounded-full p-1.5 hover:bg-primary-subtle",onClick:l.nextMonth,children:S.jsx(qd,{className:"h-4 w-4"})}),S.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)"}})]}),S.jsx("div",{className:"mt-4 grid grid-cols-7 gap-y-4",children:a.week.map(p=>S.jsx("span",{className:"font-medium capitalize text-sm",children:p.toLocaleDateString(e,{weekday:"short"})},p.toString()))}),S.jsx(Jt.ul,{onKeyDown:l.onKeyDown,variants:wb,custom:a.direction,className:"mt-4 pb-2 grid grid-cols-7 gap-y-4",children:c.map(p=>{const m=p.toISOString(),y=m===u,v=Ok(p)&&n,w=(t==null?void 0:t(p))||!1,g=!Pk(p,a.date)||w;return S.jsx("li",{className:"w-full flex items-center justify-center",children:S.jsx("button",{type:"button","data-date":m,disabled:w,onClick:l.onSelectDate,"data-view":a.date.getMonth().toString(),className:`size-8 disabled:cursor-not-allowed rounded-full font-semibold flex items-center justify-center proportional-nums ${v?"text-primary":""} ${g?"text-disabled":""} ${y?"bg-primary text-primary-foreground":""}`,children:p.getDate()})},m)})})]},f)})})}),S.jsx("footer",{className:"text-center text-primary mt-2",children:S.jsx("button",{className:"hover:scale-105 transition-transform duration-300",type:"button",onClick:l.setToday,children:"Today"})})]})})},Mo=e=>{const t=b.useId(),[n,r]=b.useState(e.open),o=b.useRef(null),s=b.useMemo(()=>[fl(10),gd({fallbackAxisSideDirection:"end"}),md(),yd({padding:5,element:o})],[e.arrow]),{refs:i,floatingStyles:a,context:l}=vi({open:n,middleware:s,transform:!0,whileElementsMounted:ul,onOpenChange:(p,m)=>{var v;const y=m==null?void 0:m.relatedTarget;y&&y.dataset.floating==="true"&&!p||(r(p),(v=e.onChange)==null||v.call(e,p))}}),c=$d(l),u=yi(l),f=xi(l),{getReferenceProps:d,getFloatingProps:h}=bi([c,u,f]);return S.jsxs(b.Fragment,{children:[S.jsx("button",{ref:i.setReference,...d(),type:"button",children:e.trigger}),n&&S.jsx(gi,{id:`${t}-portal`,children:S.jsx(vl,{returnFocus:!0,visuallyHiddenDismiss:!0,restoreFocus:!0,context:l,modal:!1,children:S.jsxs("div",{className:"bg-floating-background relative min-w-96 isolate z-floating border shadow-2xl p-6 border-floating-border rounded-lg",ref:i.setFloating,style:a,"aria-labelledby":t,...h(),children:[S.jsx(Td,{ref:o,context:l,strokeWidth:.1,className:"fill-floating-background stroke-floating-border"}),S.jsx("header",{className:"mb-2",children:S.jsx("h3",{className:"leading-snug font-medium text-2xl tracking-wide text-left",children:e.title})}),e.children]})})})]})},Cb=new Date(1970,11,31),rf={year:()=>[/\d/,/\d/,/\d/,/\d/],month:()=>[/\d/,/\d/],day:()=>[/\d/,/\d/],literal:e=>e.split("")},Pb={year:()=>"yyyy",month:()=>"MM",day:()=>"dd",literal:e=>e},VM={literal:(e,t)=>t,year:e=>e.getFullYear(),day:e=>e.getDate().toString().padStart(2,"0"),month:e=>(e.getMonth()+1).toString().padStart(2,"0")},$M=({date:e,locale:t,disabledDate:n,autoFocusToday:r,onChange:o,markToday:s,...i})=>{const a=b.useMemo(()=>new Intl.DateTimeFormat(t),[t]),[l,c]=b.useState(e||void 0),[u,f]=b.useState(!1),d=a.formatToParts(Cb).flatMap(w=>kn.keyof(rf,w.type)?rf[w.type](w.value):[]),h=a.formatToParts(Cb).reduce((w,g)=>w+(kn.keyof(Pb,g.type)?Pb[g.type](g.value):""),""),[p,m]=b.useState(l?a.formatToParts(l).reduce((w,g)=>w+(kn.keyof(rf,g.type)?VM[g.type](l,g.value):""),""):""),y=w=>{const g=w.target.value;if(m(g),d.length===g.length&&d.every((x,E)=>{const C=g.charAt(E);return typeof x=="string"?C===x:x.test(C)})){const x=bo(Ek(g,h,new Date));c(x),o==null||o(x)}},v=w=>{c(w),o==null||o(w),m(OO(w,h))};return S.jsx(us,{...i,mask:d,value:p,onChange:y,className:"uppercase",formNoValidate:!u,placeholder:h,required:i.required??!0,error:u?void 0:i.error,name:i.name?`${i.name}-picker`:i.name,right:S.jsxs(b.Fragment,{children:[S.jsx("input",{defaultValue:l==null?void 0:l.toISOString(),hidden:!0,type:"date",name:i.name}),S.jsx(Mo,{trigger:S.jsx(cx,{}),onChange:f,open:u,children:S.jsx(Eb,{...i,locale:t,date:l,onChange:v,markToday:s,disabledDate:n,autoFocusToday:r})})]})})},RM=wc("inline-flex rounded-pill gap-1.5 text-main-foreground border-2 border-transparent items-center justify-center align-middle whitespace-nowrap",{variants:{size:{icon:"p-1",big:"h-12 px-6 py-4",default:"h-8 px-4 py-2",small:"h-6 p-2 px-3 text-sm"},theme:{raw:"",main:"bg-primary-subtle text-primary-hover",warn:"bg-warn-subtle text-warn-hover",danger:"bg-danger-subtle text-danger-hover",secondary:"bg-secondary-subtle text-secondary-hover",success:"bg-success-subtle text-success-hover",info:"bg-info-subtle text-info-hover",loading:"animate-pulse bg-disabled duration-700 opacity-70",disabled:"bg-disabled duration-700 opacity-70"}},defaultVariants:{theme:"main",size:"default"}}),jM=b.forwardRef(function({className:t,icon:n,loading:r,theme:o,size:s,...i},a){return S.jsxs(hs,{...i,ref:a,"data-theme":o,as:i.as??"span",className:$t(RM({size:s,theme:o}),t),children:[i.children,n]})}),Ob=({children:e,title:t,container:n="",header:r=null,className:o="",...s})=>S.jsxs(hs,{...s,as:"div",className:$t("rounded-card flex flex-col gap-4 bg-card-background py-4 pb-8 border-card-border border shadow",n),children:[t?S.jsx("header",{className:"w-full px-8 pb-4 mb-2 border-b border-card-border font-medium text-xl",children:t}):r,S.jsx("div",{className:`min-w-full px-8 ${o}`,children:e})]}),BM=e=>S.jsxs("div",{className:"divide-y divide-card-border bg-card-background shadow border border-card-border rounded-card",children:[S.jsxs("header",{className:"p-6 items-start flex gap-4",children:[S.jsx("div",{className:$t("size-10 p-8 rounded-card flex items-center justify-center aspect-square bg-primary",e.iconContainer),children:S.jsx("div",{children:S.jsx(e.Icon,{className:"size-10 aspect-square text-primary-foreground"})})}),S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("header",{children:S.jsx("h3",{className:"text-base leading-none",children:e.title})}),S.jsx("p",{className:"text-4xl font-semibold",children:e.children})]})]}),e.footer?S.jsx("footer",{className:"px-6 py-2",children:e.footer}):null]}),kb=(e,t)=>{const[n,r]=b.useState(()=>t||e);return b.useEffect(()=>{r(e)},[e]),[n,r]},_b=b.createContext(""),zM=e=>{const[t,n]=kb(e.active),r=Io(0),o=Io(0),s=b.useRef(null),i=e.useHash?"a":"button";b.useEffect(()=>{const c=s.current;if(c===null)return;const u=p=>{if(!p)return;const m=p.getBoundingClientRect();o.set(m.width),r.set(p.offsetLeft)},f=()=>{const p=c.querySelector("li[data-active=true]");return void u(p)};window.addEventListener("resize",f);let d=c.querySelector("li[data-active=true]");const h=window.location.hash.replace(/^#/,"");if(e.active===""&&h!==""&&(d=c.querySelector(`li[data-id=${h}]`),n(h)),d===null){d=c.querySelector("li[data-id]");const p=d.getAttribute("data-id")||"";n(p)}return u(d),()=>window.removeEventListener("resize",f)},[]),b.useEffect(()=>{e.onChange&&e.onChange(t)},[e.onChange,t]);const a=b.Children.toArray(e.children),l=c=>{const u=c.currentTarget,f=u.getBoundingClientRect();o.set(f.width),r.set(u.offsetLeft),n(u.dataset.id||"")};return S.jsx(_b.Provider,{value:t,children:S.jsx(Ob,{container:"pt-0",header:S.jsxs("header",{ref:s,className:"border-b border-card-border relative mb-2",children:[S.jsx(Jt.div,{layout:!0,initial:!1,"aria-hidden":"true",style:{left:r,width:o},transition:{type:"tween",left:r,width:o},className:"w-28 h-0.5 bg-primary absolute bottom-0 duration-300 transition-all hidden md:block"}),S.jsx("nav",{children:S.jsx("ul",{className:"divide-x divide-card-border overflow-x-auto flex justify-between md:justify-start",children:a.map(c=>{const u=c.props;return S.jsx("li",{"data-id":u.id,"data-active":t===u.id,className:"data-[active=true]:text-primary w-full md:w-auto",children:S.jsx(i,{"data-id":u.id,onClick:l,"aria-current":"page",className:"px-10 py-4 block font-medium w-full whitespace-nowrap",href:e.useHash?`#${u.id}`:void 0,children:u.title})},`tab-header-${u.id}`)})})})]}),children:e.children})})},WM=()=>b.useContext(_b),HM=e=>{const t=WM();return S.jsx(b.Fragment,{children:e.id===t?e.children:null})},UM=({children:e,as:t,title:n,...r})=>{const[o,s]=b.useState(!1),i=b.useRef(null),a=t||"span",{refs:l,floatingStyles:c,context:u}=vi({open:o,onOpenChange:s,whileElementsMounted:ul,transform:!0,middleware:[fl(5),gd({fallbackAxisSideDirection:"start"}),md(),yd({element:i,padding:5})]}),f=Vw(u,{move:!0}),d=Jw(u),h=yi(u),p=xi(u,{role:"tooltip"}),{getReferenceProps:m,getFloatingProps:y}=bi([f,d,h,p]);return S.jsxs(b.Fragment,{children:[S.jsx(a,{ref:l.setReference,...m(r),children:n}),S.jsx(gi,{children:o&&S.jsxs(hs,{...y(),ref:l.setFloating,style:c,className:"bg-tooltip-background z-tooltip text-tooltip-foreground border border-tooltip-border p-3 rounded-lg",children:[S.jsx(Td,{ref:i,context:u,strokeWidth:.1,className:"fill-tooltip-background stroke-tooltip-border"}),e]})})]})};function GM(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function YM(...e){return t=>e.forEach(n=>GM(n,t))}var Ab=M.forwardRef((e,t)=>{const{children:n,...r}=e,o=M.Children.toArray(n),s=o.find(KM);if(s){const i=s.props.children,a=o.map(l=>l===s?M.Children.count(i)>1?M.Children.only(null):M.isValidElement(i)?i.props.children:null:l);return S.jsx(of,{...r,ref:t,children:M.isValidElement(i)?M.cloneElement(i,void 0,a):null})}return S.jsx(of,{...r,ref:t,children:n})});Ab.displayName="Slot";var of=M.forwardRef((e,t)=>{const{children:n,...r}=e;if(M.isValidElement(n)){const o=XM(n);return M.cloneElement(n,{...ZM(r,n.props),ref:t?YM(t,o):o})}return M.Children.count(n)>1?M.Children.only(null):null});of.displayName="SlotClone";var qM=({children:e})=>S.jsx(S.Fragment,{children:e});function KM(e){return M.isValidElement(e)&&e.type===qM}function ZM(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function XM(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const No="600ms",Ib=e=>({initial:{[e]:"-60%",opacity:.8,animationDuration:No},enter:{[e]:0,opacity:1,animationDuration:No},exit:{[e]:["-50%","-90%"],opacity:0,animationDuration:No}}),QM=Ib("left"),JM=Ib("right"),Db={drawer:e=>e==="left"?QM:JM,dialog:{initial:{opacity:0,scale:.95,animationDuration:No},enter:{opacity:1,scale:[1.05,1],animationDuration:No},exit:{opacity:0,scale:.97,animationDuration:No}}},eN=wc("isolate ring-0 outline-0 appearance-none flex flex-col gap-4 flex-nowrap min-w-xs bg-floating-background",{variants:{type:{drawer:"max-h-screen max-w-[90%] w-auto h-screen min-h-0",dialog:"max-h-[calc(100lvh-10%)] container h-[inherit] rounded-lg py-8"},position:{none:"",right:"py-4 absolute right-0 top-0 rounded-l-lg",left:"py-4 absolute left-0 top-0 rounded-r-lg"}},defaultVariants:{position:"right",type:"dialog"}}),tN={top:0,left:0,right:0,bottom:0},nN=e=>{const t=(n,r)=>{if(e.parent.current){const o=e.parent.current,s=e.value.get()||o.getBoundingClientRect().width,i=e.type==="right"?-r.delta.x:r.delta.x;e.value.set(Math.abs(s+i))}};return S.jsx(Jt.div,{drag:"x",dragElastic:0,dragMomentum:!1,onDrag:t,dragConstraints:tN,whileDrag:{cursor:"grabbing"},className:`absolute top-1/2 ${e.type==="left"?"right-5":"left-2"} rounded-lg cursor-grab h-10 w-2 bg-floating-border`})},rN=({type:e="dialog",resizer:t=!0,...n})=>{const r=e==="dialog",o=r?"none":n.position||"left",s=r?Db.dialog:Db.drawer(o),i=b.useId(),a=b.useId(),{refs:l,context:c}=vi({open:n.open,onOpenChange:n.onChange}),u=$d(c),f=xi(c),d=yi(c,{escapeKey:!0,referencePress:!0,outsidePress:!1}),{getReferenceProps:h,getFloatingProps:p}=bi([u,f,d]),m=n.trigger,y=Io(void 0);return S.jsxs(b.Fragment,{children:[n.trigger?S.jsx(b.Fragment,{children:n.asChild?S.jsx(Ab,{ref:l.setReference,...h(),children:m}):S.jsx("button",{ref:l.setReference,...h(),type:"button",children:m})}):null,S.jsx(gi,{children:S.jsx(Ea,{presenceAffectsLayout:!0,children:n.open&&S.jsx(Kw,{lockScroll:!0,className:`relative !overflow-clip h-[100dvh] z-floating bg-floating-overlay/70 ${e==="drawer"?"":"grid justify-center p-8"}`,children:S.jsx(vl,{modal:!0,closeOnFocusOut:!0,context:c,children:S.jsxs(Jt.div,{animate:"enter","aria-describedby":a,"aria-labelledby":i,className:eN({position:o,type:e}),exit:"exit",initial:"initial",ref:l.setFloating,variants:s,style:{width:y},...p(),children:[!r&&t?S.jsx(nN,{value:y,parent:l.floating,type:o}):null,n.title||n.closable?S.jsxs("header",{className:"w-full relative",children:[n.title?S.jsx("h2",{className:"px-8 pb-4 border-b border-floating-border text-3xl font-medium leading-relaxed",children:n.title}):null,n.closable!==!1?S.jsx("nav",{className:"absolute -top-1 right-8",children:S.jsx("button",{type:"button",onClick:()=>{var v;return(v=n.onChange)==null?void 0:v.call(n,!1)},className:"p-1 transition-colors hover:text-danger focus:text-danger",children:S.jsx(vx,{})})}):null]}):null,S.jsx("div",{className:"flex-1 px-8 overflow-y-auto",children:n.children}),n.footer?S.jsx("footer",{className:"px-8 border-t border-floating-border pt-4 w-full",children:n.footer}):null]})})})})})]})};var oN=Object.defineProperty,Mb=Object.getOwnPropertySymbols,sN=Object.prototype.hasOwnProperty,iN=Object.prototype.propertyIsEnumerable,Nb=(e,t,n)=>t in e?oN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aN=(e,t)=>{for(var n in t||(t={}))sN.call(t,n)&&Nb(e,n,t[n]);if(Mb)for(var n of Mb(t))iN.call(t,n)&&Nb(e,n,t[n]);return e},sf=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return!0;return!1},lN=(e,t,n,r)=>Oa(sf,e,t,n,r),Fo=e=>typeof e=="object",dr=(e,t)=>{if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||!Fo(e)&&!Fo(t))return e===t;if(e.prototype!==t.prototype)return!1;const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>dr(e[r],t[r]))},cN=(e,t)=>(Fo(e)||Array.isArray(e))&&t?e[t]:e,uN=e=>(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1,Pa=e=>/[0-9.]+/.test(e),Fb=e=>["string","number"].includes(typeof e),Lb=e=>e==null||(e==null?void 0:e.length)===0||e==="",Vb={eq:dr,is:Object.is,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"==":(e,t)=>e==t,"===":(e,t)=>e===t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,includes:(e,t)=>`${e}`.includes(t),notIncludes:(e,t)=>!`${e}`.includes(t),startsWith:(e,t)=>`${e}`.startsWith(t),endsWith:(e,t)=>`${e}`.endsWith(t),like:(e,t)=>new RegExp(`.*${t}.*`,"gi").test(`${e}`),alphabetical:(e,t)=>e.toString().localeCompare(t.toString()),empty:Lb,notEmpty:e=>!Lb(e),in:(e,t)=>sf(t,n=>dr(e,n)),notIn:(e,t)=>$b(t,n=>!dr(e,n))},fN=e=>{if(e in Vb)return Vb[e];throw new Error("Linq - Symbol not found")},Lo=(e,t)=>{const n=[],r=e.length;for(let o=0;o<r;o++)t(e[o],o,e)&&n.push(e[o]);return n},Oa=(e,t,n,r,o)=>{if(typeof n=="function")return e(t,n);const s=fN(r);return n&&r&&o!==void 0?e(t,i=>s(i[n],o)):e(t,i=>s(i,o))},dN=(e,t,n,r)=>Oa(Lo,e,t,n,r),$b=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},hN=(e,t,n,r)=>Oa($b,e,t,n,r),Rb=e=>{if(e===null)return null;const t=aN({},e);return Object.keys(t).forEach(n=>t[n]=Fo(e[n])?Rb(e[n]):e[n]),Array.isArray(e)&&e.length?(t.length=e.length)&&Array.from(t):Array.isArray(e)?Array.from(e):t},jb=(e,t)=>{if(Fo(t)){for(let n=0;n<e.length;n++){const r=e[n];if(dr(t,r))return!0}return!1}for(let n=0;n<e.length;n++){const r=e[n];if(dr(t,r))return!0}return!1},pN=(e,t)=>{const n=new Map(e.map(r=>[r[t],r]));return Object.fromEntries(n.entries())},mN=e=>Lo(e,(t,n,r)=>Fo(t)?n===r.findIndex(o=>dr(o,t)):n===r.indexOf(t)),gN=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return e[r]},Bb=(e,t)=>{const n=new Map;return e.forEach(r=>{const o=t(r),s=n.get(o)||[];s.push(r),n.set(o,s)}),Object.fromEntries(n.entries())},yN=(e,t)=>Bb(e,n=>n[t]),zb=(e,t)=>{const n=[];let r=0;const o=e.length;for(r;r<o;r++){const s=t(e[r],r,e);n.push(s)}return n},vN=(e,t)=>{let n=Number.parseInt(e,10),r=Number.parseInt(t,10);return n>r?[r,n]:[n,r]},bN=(e,t,n=1)=>{const r=[];let o=e.charCodeAt(0);const s=t.charCodeAt(0);for(;o<=s;o+=n)r.push(String.fromCharCode(o));return Pa(e)&&Pa(t)?r.map(i=>Number.parseInt(i)):r},af=(e,t,n=1)=>{let r=Math.abs(n);if((e.length>1||t.length>1)&&Pa(e)&&Pa(t)){const o=[],[s,i]=vN(e,t);for(let a=s;a<=i;a+=r)o.push(a);return o}return bN(e,t,r)},wN=(e,t,n=1)=>{if(t===void 0){const[r,o,s]=e.split("..");return s===void 0?af(r,o,1):af(r,s,Number.parseInt(o,10))}return Fb(e)&&Fb(t)?af(`${e}`,`${t}`,n):Array.from({length:e},(r,o)=>o*Math.abs(t))},lf=(e,t,n)=>{let r=t;const o=n.length;for(let s=0;s<o;s++){const i=n[s];r=e(r,i,s,n)}return r},Wb=e=>{const t=Array.from(e.values());let n=null,r=null,o=t.length;for(n=0;n<o/2;n+=1){r=o-1-n;let s=t[n];t[n]=t[r],t[r]=s}return t},xN=(e,t)=>{if(typeof t=="number")return e.slice(t);let n=e.length;for(let r=0;r<n;r++){const o=e[r];if(t(o,r,e))return e.slice(r)}return e.slice(0)},SN=(e,t,n,r)=>Oa(xN,e,t,n,r),Hb=(e,t)=>{const n=[...e];return t===void 0?n.sort():typeof t=="function"?n.toSorted(t):n.toSorted(uN(t))},TN=e=>(t,n)=>e.reduce((r,o)=>{const s=o.type==="desc"?-1:1,i=o.key,a=t[i]>n[i]?s:t[i]<n[i]?-s:0;return r!==0?r:a},0),EN=(e,t)=>e.sort(TN(t)),CN=(e,t)=>{if(t===void 0)return[...new Set(e).values()];const n=new Set;return Array.isArray(t)?[...new Set(t)]:Lo(e,r=>{const o=t?n.has(r[t]):n.has(t);return t&&(o||n.add(r[t])),!o})},PN=class jf{constructor(t=[]){this.array=t}static Range(...t){return wN(...t)}static New(t){return new jf(t)}Where(t,n,r){return this.array=dN(this.array,t,n,r),this}Some(t,n,r){return lN(this.array,t,n,r)}All(t,n,r){return hN(this.array,t,n,r)}Reverse(){return this.array=Wb(this.array),this}Add(t){return this.array=Array.isArray(t)?this.array.concat(t):this.array.concat([t]),this}Prepend(t){return this.array=Array.isArray(t)?t.concat(this.array):[t].concat(this.array),this}Select(t){return t===void 0?this.array:this.array.map(t)}Take(t,n){return n!==void 0?this.array=this.array.slice(t,Math.max(0,n)):this.array=this.array.slice(t),this}Head(){return this.array[0]}Tail(){return this.Skip(1)}Skip(t,n,r){return this.array=SN(this.array,t,n,r),this}Distinct(){return this.array=mN(this.array),this}First(t){return t===void 0?this.array[0]:gN(this.array,t)||null}Last(t){const n=this.array.length;if(t===void 0)return this.array[n-1];for(let r=n;r!==0;r--)if(t(this.array[r],r,this.array))return this.array[r]}Sum(t){return t===void 0?lf((n,r)=>n+r,0,this.array):lf((n,r)=>n+cN(r,t),0,this.array)}Average(t){return this.Sum(t)/this.array.length}GroupBy(t){return yN(this.array,t)}GroupWith(t){return Bb(this.array,t)}Except(t){return Lo(this.array,n=>!jb(t,n))}Intersect(t){return Lo(this.array,n=>jb(t,n))}OrderBy(t,n){let r;return r=t?Hb(this.array,t):this.array.toSorted(),this.array=n==="desc"?Wb(r):r,this}Includes(t){return sf(this.array,n=>dr(n,t))}In(t){const n=t.length;for(let r=0;r<n;r++){const o=t[r];if(this.Includes(o))return!0}return!1}Reduce(t,n){return lf(t,n??this.array[0],this.array)}Empty(){return this.array.length===0}ToMap(t){return new Map(zb(this.array,n=>[t,n]))}Zip(t,n){return zb(this.array,(r,o)=>n(r,t[o]))}Count(t){return t===void 0?this.array.length:Lo(this.array,t).length}Get(t){return this.array[t]}Clone(){return new jf(Rb(this.array))}ToObject(t){return pN(this.array,t)}Sort(t){return Array.isArray(t)?EN(this.array,t):Hb(this.array,t)}Unique(t){return CN(this.array,t)}},Ub=PN;const Gb=e=>{const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),t},ka=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)}),Yb=(e,t,n)=>e.split(t).filter(Boolean).reduce((r,o)=>r!=null?r[o]:r,n),qb={basic:/[,[\]]+?/,extend:/[,[\].]+?/},Kb=(e,t)=>{const n=Yb(t,qb.basic,e)||Yb(t,qb.extend,e);return n===void 0||n===e?void 0:n},cf=()=>typeof window>"u";var uf={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=(y,v)=>{try{Object.keys(y).forEach(v)}catch(w){window.console.log(w)}},n=y=>y==null,r=y=>{const v=typeof y;return v==="string"||v==="number"||v==="boolean"||n(y)},o=(y,v)=>{const w=v.getItem(y);try{return JSON.parse(w)}catch{return w??null}},s=y=>Object.keys(y).reduce((v,w)=>({...v,[w]:o(w,y)}),{}),i=y=>y instanceof Date?y:typeof y=="number"?new Date(new Date*1+y*864e5):y,a="1969-12-31T23:59:59.000Z",l=()=>document.cookie===""?{}:document.cookie.split("; ").map(y=>y.split("=")).reduce((y,v)=>(y[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim()),y),{}),c=new Set,u=()=>{const y=l();c.forEach(v=>v(y))},f=[{name:"expires",parse:y=>`expires=${i(y.expires??a)}`},{name:"maxAge",parse:y=>y.maxAge?`max-age=${i(y.expires??a)}`:""},{name:"path",parse:y=>`path=${y.path??"/"}`},{name:"sameSite",parse:y=>`samesite=${y.sameSite??"strict"}`},{name:"useSecure",parse:y=>`${y.useSecure??!0?"secure":""}`},{name:"domain",parse:y=>{const v=y.domain??"";return v===""?"":`domain=${y.multiDomain?".":""}${v}`}},{name:"partitioned",parse:y=>y.partitioned?"Partitioned":""}],d={json:l,listener:y=>(c.add(y),()=>c.delete(y)),clearListeners:()=>c.clear(),has:y=>document.cookie.split(";").some(v=>v.trim().startsWith(`${y}=`)),deleteAll:()=>{document.cookie.split(";").forEach(y=>{document.cookie=y.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),u()},get:y=>{const v=d.json()[y];if(n(v))return null;try{return JSON.parse(decodeURIComponent(v))}catch{return v}},delete:y=>{document.cookie=`${encodeURIComponent(y)}=;expires=${new Date().toUTCString()}`,u()},set:(y,v,w={})=>{const g=r(v)?v:encodeURIComponent(JSON.stringify(v)),T=f.reduce((x,E)=>{const C=E.parse(w);return C===""?x:x.concat(C)},[`${encodeURIComponent(y)}=${g}`]).join(";");document.cookie=T,u()}},h=y=>{const v=new Set,w=g=>{y().removeItem(g);const T=s(y());v.forEach(x=>x(T))};return{delete:w,listener:g=>(v.add(g),()=>v.delete(g)),clearListeners:()=>v.clear(),json:(g=!1)=>g?s(y()):y(),has:g=>{const T=y().getItem(g);return!n(T)},deleteAll:()=>{t(y(),w),v.forEach(g=>g(y()))},get:g=>o(g,y()),set:(g,T)=>{y().setItem(g,JSON.stringify(T)),v.forEach(x=>x(y()))}}},p=h(()=>window.sessionStorage),m=h(()=>window.localStorage);e.Cookie=d,e.LocalStorage=m,e.SessionStorage=p,e.createStorage=h})(uf);const Zb=e=>e.headerLabel??e.thead??e.id,ff=e=>e.map(t=>({value:t.id,label:t.thead??t.headerLabel??t.id}));var Vo=(e=>(e.Boolean="boolean",e.Number="number",e.Select="select",e.Text="text",e))(Vo||{});const df=e=>e.type==="number"?e.valueAsNumber:e.value,ON=e=>{let t=[];return e({add:(o,s,i)=>t.push({...i,id:o,thead:s}),remove:o=>t=t.filter(s=>s.id!==o)}),t},kN={},_N=(e,t=kN)=>{const n=cf()?null:uf.LocalStorage.get(`@unamed/table-${e}`)||null,[r,o]=ef({name:e,groups:t.groups||(n==null?void 0:n.groups)||[],sorters:t.sorters||(n==null?void 0:n.sorters)||[],filters:t.filters||(n==null?void 0:n.filters)||[],cols:t.cols||(n==null?void 0:n.cols)||[]},s=>{const i=a=>{const l=s.state(),c={...l,...a};return cf()||uf.LocalStorage.set(`@unamed/table-${l.name}`,c),c};return{set:a=>i(a)}});return{...r,...o,name:e}},Nt={contains:{value:"contains",label:"Contains",symbol:"includes"},is:{value:"is",label:"Is",symbol:"is"},isNot:{value:"isNot",label:"Is not",symbol:"!=="},notContains:{value:"notContains",label:"Does not contains",symbol:"notIncludes"},lessThan:{value:"lessThan",label:"Less Than",symbol:"<="},greaterThan:{value:"greaterThan",label:"Greater than",symbol:">="},startsWith:{value:"startsWith",label:"Starts with",symbol:"startsWith"},endsWith:{value:"endsWith",label:"Ends with",symbol:"endsWith"}},hf={[Vo.Text]:[Nt.is,Nt.isNot,Nt.contains,Nt.notContains,Nt.startsWith,Nt.endsWith],[Vo.Boolean]:[Nt.is,Nt.isNot],[Vo.Number]:[Nt.is,Nt.isNot,Nt.greaterThan,Nt.lessThan]},pf=(e,t={})=>{var i;const n=e.id,r=e.type??Vo.Text,o=(i=hf[r])==null?void 0:i[0].value,s=Nt[o];return{id:ka(),operation:s,label:Zb(e),name:n,type:r,value:"",...t}},AN=e=>{const t=()=>{const i=e.cols.at(0);e.set(a=>[...a,pf(i)])},n=i=>{const a=i.target.dataset.id||"",l=i.target.value;e.set(c=>c.map(u=>{if(a!==u.id)return u;const f=e.cols.find(d=>l===d.id);return pf(f,{value:""})}))},r=i=>{const a=i.target.dataset.id||"",l=i.target.value;e.set(c=>c.map(u=>u.id===a?{...u,operation:Nt[l]}:u))},o=i=>{const a=i.currentTarget.dataset.id||"";e.set(l=>l.filter(c=>c.id!==a))},s=i=>{const a=i.target.dataset.id||"",l=df(i.target);e.set(c=>c.map(u=>u.id===a?{...u,value:l}:u))};return S.jsx(b.Fragment,{children:S.jsx(Mo,{arrow:!1,title:"Filters",trigger:S.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[S.jsx(Kd,{size:14}),"Filtros ",e.filters.length===0?"":` (${e.filters.length})`]}),children:S.jsxs("ul",{className:"mt-4 space-y-2",children:[e.filters.map(i=>{const a=hf[i.type];return S.jsxs("li",{className:"flex flex-nowrap gap-3",children:[S.jsx(xr,{title:"Filter",options:e.options,placeholder:"Name...",value:i.name,"data-id":i.id,onChange:n}),S.jsx(xr,{title:"Filter type","data-id":i.id,onChange:r,value:i.operation.value,options:a,placeholder:"Operator..."}),S.jsx(us,{"data-id":i.id,onChange:s,placeholder:"Search...",title:"Value",type:i.type,value:i.value}),S.jsx("div",{className:"flex items-center justify-center mt-5",children:S.jsx("button",{"data-id":i.id,type:"button",onClick:o,children:S.jsx(eo,{className:"text-danger",size:16})})})]},`filter-select-${i.id}`)}),S.jsx("li",{children:S.jsxs("button",{type:"button",onClick:t,className:"text-primary flex items-center gap-1",children:[S.jsx(Tl,{size:14})," New filter"]})})]})})})},IN=({filter:e,onDelete:t,set:n})=>{const r=s=>{const i=s.target.value,a=s.target.dataset.id||"";n(l=>l.map(c=>c.id===a?{...c,operation:Nt[i]}:c))},o=s=>{const i=s.target.dataset.id||"",a=df(s.target);n(l=>l.map(c=>c.id===i?{...c,value:a}:c))};return S.jsxs("div",{className:"flex flex-nowrap items-center gap-4 py-2",children:[S.jsx(xr,{onChange:r,options:hf[e.type],placeholder:"Operation...",title:"Filter type",value:e.operation.value}),S.jsx(us,{"data-id":e.id,onChange:o,placeholder:"Looking for...",title:"Value",type:e.type,value:e.value}),S.jsx("button",{onClick:t,"data-id":e.id,type:"button",className:"mt-4",children:S.jsx(eo,{className:"text-danger",size:14})})]})},DN=({item:e,onPointerDown:t})=>{const n=Io(0);return S.jsxs(Ca.Item,{onPointerDown:t,id:e.groupId,className:"flex flex-row items-center gap-2",value:e,style:{y:n},children:[S.jsx("button",{type:"button",className:"cursor-grab",children:S.jsx(mx,{size:14})}),S.jsx("span",{children:e.groupName})]},e.groupId)},MN=e=>{var a;const t=ff(e.cols),n=gM(),[r,o]=b.useState(((a=e.groups[0])==null?void 0:a.thead)||""),s=l=>{var m;const c=l.target,u=c.value,f=c.options.selectedIndex,d=((m=c.options.item(f))==null?void 0:m.label)||"";o(d);const h=new Ub(e.rows).GroupBy(u),p=e.cols.find(y=>y.id===u);e.setGroups(ET(h).map((y,v)=>{const w=h[y];return{...p,groupId:ka(),groupKey:u,index:v,rows:w,groupName:y}}))},i=()=>e.setGroups([]);return S.jsx(b.Fragment,{children:S.jsxs(Mo,{arrow:!1,title:"Groups",trigger:S.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[S.jsx(gx,{size:14}),"Groups",e.groups.length>0?` - ${r}(${e.groups.length})`:""]}),children:[S.jsxs("div",{className:"flex flex-nowrap items-center",children:[S.jsx(xr,{value:r,title:"Tipo de agrupamento",onChange:s,options:t,placeholder:"Agrupar por..."}),S.jsx(ps,{className:"mt-4",onClick:i,theme:"raw","data-id":r,children:S.jsx(eo,{size:16,className:"text-danger"})})]}),e.groups.length>0?S.jsxs("section",{className:"my-4",children:[S.jsx("header",{children:S.jsx("h2",{className:"text-xl font-medium",children:"Order groups"})}),S.jsx(tM,{children:S.jsx(Ca.Group,{axis:"y",className:"relative space-y-2",drag:!0,dragControls:n,dragListener:!1,layoutScroll:!0,onReorder:e.setGroups,values:e.groups,children:e.groups.map(l=>S.jsx(DN,{item:l,onPointerDown:c=>{n.start(c),e.setGroups([...e.groups])}},l.groupId))})})]}):null]})})},NN=e=>(t,n)=>e.reduce((r,o)=>{const s=o.type==="desc"?-1:1,i=o.value,a=t[i]>n[i]?s:t[i]<n[i]?-s:0;return console.log({acc:r,p:a,a:t,b:n,property:i}),r!==0?r:a},0),FN=(e,t)=>e.sort(NN(t)),mf={asc:{label:"Ascending",value:"asc"},desc:{label:"Descending",value:"desc"}},LN=[mf.asc,mf.desc],gf=(e,t="asc")=>({id:ka(),type:t,value:e.id,label:mf.asc.label}),VN=e=>{const t=()=>{const s=e.cols[0];s&&e.set(i=>[...i,gf(s)])},n=s=>i=>{const a=i.target.value;e.set(l=>l.map(c=>c.id===s?{...c,value:a}:c))},r=s=>i=>{const a=i.target.value;e.set(l=>l.map(c=>c.id===s?{...c,type:a}:c))},o=s=>{const i=s.currentTarget.dataset.id||"";e.set(a=>a.filter(l=>l.id!==i))};return S.jsx(b.Fragment,{children:S.jsx(Mo,{arrow:!1,title:"Order By",trigger:S.jsxs("span",{className:"flex items-center gap-1 proportional-nums text-foreground-description",children:[S.jsx(Yd,{size:14}),"Order by ",e.sorters.length===0?"":` (${e.sorters.length})`]}),children:S.jsxs("ul",{className:"mt-4 space-y-2",children:[e.sorters.map(s=>S.jsxs("li",{className:"flex flex-nowrap gap-3",children:[S.jsx(xr,{onChange:n(s.id),options:e.options,title:"Field",placeholder:"Selecione um campo...",value:s.value}),S.jsx(xr,{title:"Sort type",onChange:r(s.id),value:s.type,options:LN,placeholder:"Operação..."}),S.jsx("button",{className:"mt-4","data-id":s.id,onClick:o,children:S.jsx(eo,{className:"text-danger",size:14})})]},`sorter-select-${s.id}`)),S.jsx("li",{children:S.jsxs("button",{type:"button",onClick:t,className:"text-primary flex items-center gap-1",children:[S.jsx(Tl,{size:14})," Add sort"]})})]})})})},$N=e=>{const t=e.sorters.find(s=>s.id===e.col.id),[n,r]=b.useState(t?t.type:"undefined"),o=()=>r(s=>s==="undefined"?"asc":s==="asc"?"desc":"undefined");return b.useEffect(()=>{e.setSorters(s=>{if(n==="undefined")return s.filter(a=>a.value!==e.col.id);const i=s.findIndex(a=>a.value===e.col.id);return i===-1?[...s,gf(e.col,n)]:(s[i]=gf(e.col,n),[...s])})},[n,e.col]),S.jsxs("button",{className:"isolate flex items-center",onClick:o,type:"button",children:[n==="asc"?S.jsx(Sl,{size:14}):null,n==="desc"?S.jsx(fx,{size:14}):null,n==="undefined"?S.jsx(Yd,{size:14}):null]})},RN=e=>S.jsx("header",{className:"min-w-full mb-1",children:S.jsxs("div",{className:"flex flex-wrap min-w-full items-center justify-between gap-x-4 gap-y-1",children:[S.jsxs("div",{className:"flex w-fit items-centeend gap-4 whitespace-nowrap py-2",children:[S.jsx("span",{children:S.jsx(AN,{cols:e.cols,options:e.options,filters:e.filters,set:e.setFilters})}),S.jsx("span",{children:S.jsx(VN,{options:e.options,cols:e.cols,sorters:e.sorters,set:e.setSorters})}),S.jsx("span",{children:S.jsx(MN,{rows:e.rows,groups:e.groups,setGroups:e.setGroups,options:e.options,cols:e.cols})})]}),S.jsx("ul",{className:"flex flex-wrap w-full flex-1 flex-grow flex-row items-center md:justify-end gap-4",children:e.filters.map(t=>S.jsxs("li",{className:"flex gap-1 items-center rounded-xl border border-card-border px-4 py-0.5",children:[S.jsxs("span",{children:[S.jsx("span",{className:"size-3 mr-2 aspect-square bg-primary inline-block rounded-full","aria-hidden":"true"}),t.label," ",t.operation.label.toLowerCase(),":"]}),S.jsxs("div",{className:"relative w-min min-w-[1ch]",children:[S.jsx("span",{"aria-hidden":"true",className:"invisible whitespace-pre p-0",children:t.value||" "}),S.jsx("input",{type:t.type,value:t.value,className:"absolute left-0 top-0 m-0 inline-block w-full bg-transparent p-0 placeholder-primary/70 outline-none [appearance:textfield] after:empty:text-primary/70 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",onChange:n=>{const r=df(n.target);e.setFilters(o=>o.map(s=>t.id===s.id?{...s,value:r}:s))}})]})]},`filter-table-${t.id}`))})]})}),jN={opacity:1},BN={opacity:.75,backgroundColor:"var(--table-border)"},zN={opacity:0,transition:{duration:.4,type:"spring"}},WN=e=>{var r;const t=e.filters.filter(o=>o.name===e.header.id),n=o=>{const s=o.currentTarget.dataset.id||"";return e.setFilters(i=>i.filter(a=>a.id!==s))};return S.jsx(Ca.Item,{...e.header.thProps,as:"th",exit:zN,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,value:e.header,whileDrag:BN,animate:jN,className:`hidden font-medium text-secondary px-2 py-4 first:table-cell md:table-cell ${((r=e.header.thProps)==null?void 0:r.className)??""}`,children:S.jsx("span",{className:"flex items-center justify-between",children:S.jsxs("span",{className:"flex items-center gap-1",children:[S.jsx(Mo,{title:`Filter by ${Zb(e.header)}`,arrow:!0,trigger:S.jsx(Kd,{size:14}),children:t.length===0===null?null:S.jsxs("ul",{className:"font-medium",children:[t.map(o=>S.jsx("li",{className:"my-1",children:S.jsx(IN,{onDelete:n,filter:o,set:e.setFilters})},`thead-filter-${o.id}`)),S.jsx("li",{children:S.jsxs("button",{onClick:()=>e.setFilters(o=>o.concat(pf(e.header))),className:"flex items-center",children:[S.jsx(Tl,{size:14})," Add"]})})]})}),S.jsx("span",{className:"pointer-events-auto text-balance text-base",children:e.header.thead}),S.jsx($N,{col:e.header,setSorters:e.setSorters,sorters:e.sorters})]})})})},HN=e=>S.jsx(Ca.Group,{as:"tr",axis:"x",drag:!0,layout:!0,layoutRoot:!0,layoutScroll:!0,initial:!1,values:e.headers,onReorder:e.setCols,className:"bg-table-background border-none text-lg",children:S.jsx(Ea,{children:e.headers.map(t=>S.jsx(WN,{setFilters:e.setFilters,filters:e.filters,setSorters:e.setSorters,sorters:e.sorters,header:t},`header-child-item-${t.id}`))})});function UN(e,t){if(!e||!t)return[];const n=[1];if(e===1&&t===1)return n;e>4&&n.push("-");let r=2,o=e-r,s=e+r;for(let a=o>2?o:2;a<=Math.min(t,s);a++)n.push(a);const i=t-2;return s+1!==i&&s+1<t&&n.push("_"),s<t&&(n.push(t-2),n.push(t-1),n.push(t)),Array.from(new Set(n))}const GN=b.forwardRef((e,t)=>S.jsx("tbody",{...e,className:`divide-y divide-table-border ${e.className??""}`,ref:t,children:S.jsx(Ea,{children:e.children})})),YN=b.forwardRef((e,t)=>S.jsx("table",{...e,ref:t,className:`table min-w-full divide-y divide-table-border table-auto text-left ${e.className??""}`})),qN=b.forwardRef((e,t)=>S.jsx("thead",{...e,className:"bg-card-background shadow-xs group:sticky top-0",ref:t})),KN=b.forwardRef((e,t)=>S.jsx("tr",{...e,ref:t,className:`table-row ${e.className??""}`})),ZN=b.forwardRef((e,t)=>e.context.loadingMore?S.jsx("tfoot",{...e,ref:t,className:"bg-card-background",children:S.jsx("tr",{className:"bg-card-background",children:S.jsx("td",{colSpan:999,className:"px-2 h-14 bg-card-background",children:S.jsx("span",{className:"block w-full h-2 bg-foreground rounded opacity-60 animate-pulse"})})})}):null),XN={TableHead:qN,Table:YN,TableBody:GN,TableRow:KN,TableFoot:ZN},QN=[0,0,0,0,0,0,0,0,0,0],JN=(e,t,n)=>{const r=n.cols,o=n.loading;return S.jsx(b.Fragment,{children:r.map((s,i)=>{const a=`${i},${e}`,l=Kb(t,s.id),c=s.Element;return b.createElement("td",{...s.cellProps,"data-matrix":a,key:`accessor-${e}-${i}`,className:"px-2 h-14 border-none first:table-cell hidden md:table-cell"},o?S.jsx("div",{className:"animate-pulse h-2 bg-table-border rounded"}):c?S.jsx(c,{row:t,matrix:a,col:s,rowIndex:e,value:l}):S.jsx(b.Fragment,{children:kn.nil(l)?"":l}))})})},eF=()=>S.jsx(b.Fragment,{}),tF=e=>{const t=e.asLink||"button",n=b.useMemo(()=>UN(e.current,e.pages),[e.current,e.pages]),r=e.current<e.pages;return S.jsxs("footer",{className:"flex px-1 py-2 items-center justify-between flex-nowrap",children:[S.jsxs("p",{children:[e.current," to ",e.pages," of ",e.totalItems," items.",e.onChangeSize&&Array.isArray(e.sizes)?S.jsxs(b.Fragment,{children:[S.jsx("select",{className:"cursor-pointer",onChange:o=>{var s;(s=e.onChangeSize)==null||s.call(e,Number(o.target.value))},children:e.sizes.map(o=>S.jsx("option",{value:o,children:o}))})," per page"]}):null]}),S.jsx("nav",{children:S.jsxs("ul",{className:"flex items-center gap-2",children:[e.current>1?S.jsx("li",{children:S.jsx(t,{href:"previous",className:"",children:"Previous"})}):null,n.map(o=>o===null?null:S.jsx(b.Fragment,{children:typeof o=="string"?S.jsx("li",{children:"..."}):S.jsx("li",{children:S.jsx(t,{href:o,className:`cursor-pointer px-3 py-1 transition-colors border-b-2 hover:text-primary-subtle hover:border-primary-subtle proportional-nums ${o===e.current?"text-primary border-primary":"border-transparent"}`,children:o})},`pagination-${o}`)})),r?S.jsx("li",{children:S.jsx(t,{href:"next",className:"",children:"Next"})}):null]})})]})},Xb=({filters:e,pagination:t=null,onScrollEnd:n,useControl:r=!1,setCols:o,setFilters:s,sorters:i,cols:a,setSorters:l,...c})=>{const u=b.useRef(null),[f,d]=b.useState(!1),h=Gb(n),p=Gb(c.loadingMore),m=b.useMemo(()=>{if(c.loading)return QN;if(r)return c.rows;const y=new Ub(c.rows);return e.length>0&&e.forEach(v=>v.value===""||Number.isNaN(v.value)?void 0:y.Where(v.name,v.operation.symbol,v.value)),i.length===0?y.Select():FN(y.Select(),i)},[c.rows,e,i,c.loading]);return b.useEffect(()=>{if(u.current===null)return()=>{};const y=u.current,v=new IntersectionObserver(w=>{var x;return w.forEach(E=>console.log(E.isIntersecting,E.target)),w[w.length-1].isIntersecting&&p.current?((x=h.current)==null||x.call(h),void d(!0)):d(!1)});return v.observe(y),()=>v.disconnect()},[]),S.jsxs("div",{className:"min-w-full",children:[S.jsxs("div",{className:"group border border-table-border rounded-lg px-1",children:[S.jsx(SP,{data:m,useWindowScroll:!0,components:XN,totalCount:m.length,itemContent:JN,context:{loading:c.loading,loadingMore:c.loadingMore,cols:a},fixedFooterContent:f?eF:null,fixedHeaderContent:()=>S.jsx(HN,{sorters:i,setSorters:l,filters:e,setFilters:s,headers:a,setCols:o})}),S.jsx("div",{"aria-hidden":"true",ref:u,className:"h-0.5 w-full"})]}),t!==null?S.jsx(tF,{...t}):null]})},nF=(e,t)=>typeof t=="function"?t(e):t,rF=e=>{const t=e.operations??!0,n=b.useMemo(()=>ff(e.cols),[e.cols]),[r,o]=ef({cols:e.cols,filters:e.filters??[],groups:e.groups??[],sorters:e.sorters??[]},s=>{const i=a=>l=>{const c=s.state();return{...c,[a]:nF(c[a],l)}};return{cols:i("cols"),filters:i("filters"),groups:i("groups"),sorters:i("sorters")}},{postMiddleware:[s=>{var i;return(i=e.set)==null||i.call(e,s),s}]});return S.jsxs("div",{className:"relative min-w-full",children:[t?S.jsx(RN,{setCols:o.cols,rows:e.rows,cols:r.cols,filters:r.filters,groups:r.groups,options:n,setFilters:o.filters,setGroups:o.groups,setSorters:o.sorters,sorters:r.sorters,pagination:e.pagination??null}):null,r.groups.length===0?S.jsx(Xb,{...e,onScrollEnd:e.onScrollEnd,cols:r.cols,filters:r.filters,groups:r.groups,index:0,optionCols:n,options:n,setCols:o.cols,setFilters:o.filters,setGroups:o.groups,setSorters:o.sorters,sorters:r.sorters,pagination:e.pagination??null}):S.jsx("div",{className:"flex flex-wrap gap-4",children:r.groups.map((s,i)=>S.jsx(Jt.div,{className:"min-w-full",children:S.jsx(Xb,{...e,pagination:null,onScrollEnd:e.onScrollEnd,cols:r.cols,filters:r.filters,group:s,groups:r.groups,index:i,optionCols:n,options:n,rows:s.rows,setCols:o.cols,setFilters:o.filters,setGroups:o.groups,setSorters:o.sorters,sorters:r.sorters})},`group-${s.groupId}`))})]})};var oF=String.prototype.replace,sF=/%20/g,yf={RFC1738:"RFC1738",RFC3986:"RFC3986"},vf={default:yf.RFC3986,formatters:{RFC1738:function(e){return oF.call(e,sF,"+")},RFC3986:function(e){return String(e)}},RFC1738:yf.RFC1738,RFC3986:yf.RFC3986},iF=vf,bf=Object.prototype.hasOwnProperty,Fr=Array.isArray,Tn=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),aF=function(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(Fr(r)){for(var o=[],s=0;s<r.length;++s)typeof r[s]<"u"&&o.push(r[s]);n.obj[n.prop]=o}}},Qb=function(t,n){for(var r=n&&n.plainObjects?Object.create(null):{},o=0;o<t.length;++o)typeof t[o]<"u"&&(r[o]=t[o]);return r},lF=function e(t,n,r){if(!n)return t;if(typeof n!="object"){if(Fr(t))t.push(n);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!bf.call(Object.prototype,n))&&(t[n]=!0);else return[t,n];return t}if(!t||typeof t!="object")return[t].concat(n);var o=t;return Fr(t)&&!Fr(n)&&(o=Qb(t,r)),Fr(t)&&Fr(n)?(n.forEach(function(s,i){if(bf.call(t,i)){var a=t[i];a&&typeof a=="object"&&s&&typeof s=="object"?t[i]=e(a,s,r):t.push(s)}else t[i]=s}),t):Object.keys(n).reduce(function(s,i){var a=n[i];return bf.call(s,i)?s[i]=e(s[i],a,r):s[i]=a,s},o)},cF=function(t,n){return Object.keys(n).reduce(function(r,o){return r[o]=n[o],r},t)},uF=function(e,t,n){var r=e.replace(/\+/g," ");if(n==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},wf=1024,fF=function(t,n,r,o,s){if(t.length===0)return t;var i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});for(var a="",l=0;l<i.length;l+=wf){for(var c=i.length>=wf?i.slice(l,l+wf):i,u=[],f=0;f<c.length;++f){var d=c.charCodeAt(f);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||s===iF.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(f);continue}if(d<128){u[u.length]=Tn[d];continue}if(d<2048){u[u.length]=Tn[192|d>>6]+Tn[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Tn[224|d>>12]+Tn[128|d>>6&63]+Tn[128|d&63];continue}f+=1,d=65536+((d&1023)<<10|c.charCodeAt(f)&1023),u[u.length]=Tn[240|d>>18]+Tn[128|d>>12&63]+Tn[128|d>>6&63]+Tn[128|d&63]}a+=u.join("")}return a},dF=function(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],o=0;o<n.length;++o)for(var s=n[o],i=s.obj[s.prop],a=Object.keys(i),l=0;l<a.length;++l){var c=a[l],u=i[c];typeof u=="object"&&u!==null&&r.indexOf(u)===-1&&(n.push({obj:i,prop:c}),r.push(u))}return aF(n),t},hF=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},pF=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},mF=function(t,n){return[].concat(t,n)},gF=function(t,n){if(Fr(t)){for(var r=[],o=0;o<t.length;o+=1)r.push(n(t[o]));return r}return n(t)},Jb={arrayToObject:Qb,assign:cF,combine:mF,compact:dF,decode:uF,encode:fF,isBuffer:pF,isRegExp:hF,maybeMap:gF,merge:lF},e0=rT,_a=Jb,Hs=vf,yF=Object.prototype.hasOwnProperty,t0={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,n){return t+"["+n+"]"},repeat:function(t){return t}},En=Array.isArray,vF=Array.prototype.push,n0=function(e,t){vF.apply(e,En(t)?t:[t])},bF=Date.prototype.toISOString,r0=Hs.default,ht={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_a.encode,encodeValuesOnly:!1,format:r0,formatter:Hs.formatters[r0],indices:!1,serializeDate:function(t){return bF.call(t)},skipNulls:!1,strictNullHandling:!1},wF=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},xf={},xF=function e(t,n,r,o,s,i,a,l,c,u,f,d,h,p,m,y,v,w){for(var g=t,T=w,x=0,E=!1;(T=T.get(xf))!==void 0&&!E;){var C=T.get(t);if(x+=1,typeof C<"u"){if(C===x)throw new RangeError("Cyclic object value");E=!0}typeof T.get(xf)>"u"&&(x=0)}if(typeof u=="function"?g=u(n,g):g instanceof Date?g=h(g):r==="comma"&&En(g)&&(g=_a.maybeMap(g,function(P){return P instanceof Date?h(P):P})),g===null){if(i)return c&&!y?c(n,ht.encoder,v,"key",p):n;g=""}if(wF(g)||_a.isBuffer(g)){if(c){var O=y?n:c(n,ht.encoder,v,"key",p);return[m(O)+"="+m(c(g,ht.encoder,v,"value",p))]}return[m(n)+"="+m(String(g))]}var I=[];if(typeof g>"u")return I;var N;if(r==="comma"&&En(g))y&&c&&(g=_a.maybeMap(g,c)),N=[{value:g.length>0?g.join(",")||null:void 0}];else if(En(u))N=u;else{var L=Object.keys(g);N=f?L.sort(f):L}var _=l?n.replace(/\./g,"%2E"):n,j=o&&En(g)&&g.length===1?_+"[]":_;if(s&&En(g)&&g.length===0)return j+"[]";for(var D=0;D<N.length;++D){var k=N[D],F=typeof k=="object"&&typeof k.value<"u"?k.value:g[k];if(!(a&&F===null)){var $=d&&l?k.replace(/\./g,"%2E"):k,z=En(g)?typeof r=="function"?r(j,$):j:j+(d?"."+$:"["+$+"]");w.set(t,x);var q=e0();q.set(xf,w),n0(I,e(F,z,r,o,s,i,a,l,r==="comma"&&y&&En(g)?null:c,u,f,d,h,p,m,y,v,q))}}return I},SF=function(t){if(!t)return ht;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var n=t.charset||ht.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=Hs.default;if(typeof t.format<"u"){if(!yF.call(Hs.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var o=Hs.formatters[r],s=ht.filter;(typeof t.filter=="function"||En(t.filter))&&(s=t.filter);var i;if(t.arrayFormat in t0?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=ht.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ht.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ht.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ht.allowEmptyArrays,arrayFormat:i,charset:n,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ht.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ht.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ht.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ht.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ht.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ht.encodeValuesOnly,filter:s,format:r,formatter:o,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ht.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ht.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ht.strictNullHandling}},TF=function(e,t){var n=e,r=SF(t),o,s;typeof r.filter=="function"?(s=r.filter,n=s("",n)):En(r.filter)&&(s=r.filter,o=s);var i=[];if(typeof n!="object"||n===null)return"";var a=t0[r.arrayFormat],l=a==="comma"&&r.commaRoundTrip;o||(o=Object.keys(n)),r.sort&&o.sort(r.sort);for(var c=e0(),u=0;u<o.length;++u){var f=o[u];r.skipNulls&&n[f]===null||n0(i,xF(n[f],f,a,l,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,c))}var d=i.join(r.delimiter),h=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),d.length>0?h+d:""},$o=Jb,Sf=Object.prototype.hasOwnProperty,EF=Array.isArray,ct={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:$o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},CF=function(e){return e.replace(/&#(\d+);/g,function(t,n){return String.fromCharCode(parseInt(n,10))})},o0=function(e,t){return e&&typeof e=="string"&&t.comma&&e.indexOf(",")>-1?e.split(","):e},PF="utf8=%26%2310003%3B",OF="utf8=%E2%9C%93",kF=function(t,n){var r={__proto__:null},o=n.ignoreQueryPrefix?t.replace(/^\?/,""):t;o=o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var s=n.parameterLimit===1/0?void 0:n.parameterLimit,i=o.split(n.delimiter,s),a=-1,l,c=n.charset;if(n.charsetSentinel)for(l=0;l<i.length;++l)i[l].indexOf("utf8=")===0&&(i[l]===OF?c="utf-8":i[l]===PF&&(c="iso-8859-1"),a=l,l=i.length);for(l=0;l<i.length;++l)if(l!==a){var u=i[l],f=u.indexOf("]="),d=f===-1?u.indexOf("="):f+1,h,p;d===-1?(h=n.decoder(u,ct.decoder,c,"key"),p=n.strictNullHandling?null:""):(h=n.decoder(u.slice(0,d),ct.decoder,c,"key"),p=$o.maybeMap(o0(u.slice(d+1),n),function(y){return n.decoder(y,ct.decoder,c,"value")})),p&&n.interpretNumericEntities&&c==="iso-8859-1"&&(p=CF(p)),u.indexOf("[]=")>-1&&(p=EF(p)?[p]:p);var m=Sf.call(r,h);m&&n.duplicates==="combine"?r[h]=$o.combine(r[h],p):(!m||n.duplicates==="last")&&(r[h]=p)}return r},_F=function(e,t,n,r){for(var o=r?t:o0(t,n),s=e.length-1;s>=0;--s){var i,a=e[s];if(a==="[]"&&n.parseArrays)i=n.allowEmptyArrays&&(o===""||n.strictNullHandling&&o===null)?[]:[].concat(o);else{i=n.plainObjects?Object.create(null):{};var l=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,c=n.decodeDotInKeys?l.replace(/%2E/g,"."):l,u=parseInt(c,10);!n.parseArrays&&c===""?i={0:o}:!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(i=[],i[u]=o):c!=="__proto__"&&(i[c]=o)}o=i}return o},AF=function(t,n,r,o){if(t){var s=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=r.depth>0&&i.exec(s),c=l?s.slice(0,l.index):s,u=[];if(c){if(!r.plainObjects&&Sf.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;r.depth>0&&(l=a.exec(s))!==null&&f<r.depth;){if(f+=1,!r.plainObjects&&Sf.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+s.slice(l.index)+"]"),_F(u,n,r,o)}},IF=function(t){if(!t)return ct;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=typeof t.charset>"u"?ct.charset:t.charset,r=typeof t.duplicates>"u"?ct.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var o=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:ct.allowDots:!!t.allowDots;return{allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ct.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:ct.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:ct.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:ct.arrayLimit,charset:n,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ct.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:ct.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:ct.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:ct.decoder,delimiter:typeof t.delimiter=="string"||$o.isRegExp(t.delimiter)?t.delimiter:ct.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:ct.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:ct.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:ct.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:ct.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ct.strictNullHandling}},DF=function(e,t){var n=IF(t);if(e===""||e===null||typeof e>"u")return n.plainObjects?Object.create(null):{};for(var r=typeof e=="string"?kF(e,n):e,o=n.plainObjects?Object.create(null):{},s=Object.keys(r),i=0;i<s.length;++i){var a=s[i],l=AF(a,r[a],n,typeof e=="string");o=$o.merge(o,l,n)}return n.allowSparse===!0?o:$o.compact(o)},MF=TF,NF=DF,FF=vf,LF={formats:FF,parse:NF,stringify:MF},Pe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Pe||(Pe={}));var s0;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(s0||(s0={}));const te=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lr=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}},G=Pe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class en extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof en))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}en.create=e=>new en(e);const Us=(e,t)=>{let n;switch(e.code){case G.invalid_type:e.received===te.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Pe.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pe.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pe.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Pe.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Pe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case G.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case G.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,Pe.assertNever(e)}return{message:n}};let VF=Us;function Tf(){return VF}const Ef=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function J(e,t){const n=Tf(),r=Ef({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Us?void 0:Us].filter(o=>!!o)});e.common.issues.push(r)}class Ft{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return me;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return Ft.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return me;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const me=Object.freeze({status:"aborted"}),Gs=e=>({status:"dirty",value:e}),zt=e=>({status:"valid",value:e}),i0=e=>e.status==="aborted",a0=e=>e.status==="dirty",Aa=e=>e.status==="valid",Ia=e=>typeof Promise<"u"&&e instanceof Promise;function Da(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function l0(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}typeof SuppressedError=="function"&&SuppressedError;var ae;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ae||(ae={}));var Ys,qs;class Cn{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const c0=(e,t)=>{if(Aa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new en(e.common.issues);return this._error=n,this._error}}};function ye(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{var l,c;const{message:u}=e;return i.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class xe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Lr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ft,ctx:{common:t.parent.common,data:t.data,parsedType:Lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ia(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lr(t)},s=this._parseSync({data:t,path:o.path,parent:o});return c0(o,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lr(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Ia(o)?o:Promise.resolve(o));return c0(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:G.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new $n({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Rn.create(this,this._def)}nullable(){return Rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ln.create(this,this._def)}promise(){return Xs.create(this,this._def)}or(t){return Fa.create([this,t],this._def)}and(t){return La.create(this,t,this._def)}transform(t){return new $n({...ye(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ba({...ye(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new h0({typeName:he.ZodBranded,type:this,...ye(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new za({...ye(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Wa.create(this,t)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $F=/^c[^\s-]{8,}$/i,RF=/^[0-9a-z]+$/,jF=/^[0-9A-HJKMNP-TV-Z]{26}$/,BF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zF=/^[a-z0-9_-]{21}$/i,WF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,HF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Cf;const GF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,YF=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,qF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,u0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",KF=new RegExp(`^${u0}$`);function f0(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function ZF(e){return new RegExp(`^${f0(e)}$`)}function XF(e){let t=`${u0}T${f0(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function QF(e,t){return!!((t==="v4"||!t)&&GF.test(e)||(t==="v6"||!t)&&YF.test(e))}class Fn extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.string,received:s.parsedType}),me}const r=new Ft;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?J(o,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&J(o,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")HF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"email",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Cf||(Cf=new RegExp(UF,"u")),Cf.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"emoji",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")BF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"uuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")zF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"nanoid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")$F.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")RF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid2",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")jF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ulid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),J(o,{validation:"url",code:G.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"regex",code:G.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?XF(s).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?KF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?ZF(s).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?WF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"duration",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?QF(t.data,s.version)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ip",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?qF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"base64",code:G.invalid_string,message:s.message}),r.dirty()):Pe.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:G.invalid_string,...ae.errToObj(r)})}_addCheck(t){return new Fn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ae.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ae.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ae.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ae.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ae.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ae.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ae.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ae.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ae.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ae.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ae.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ae.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ae.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ae.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ae.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ae.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ae.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ae.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ae.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ae.errToObj(n)})}nonempty(t){return this.min(1,ae.errToObj(t))}trim(){return new Fn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Fn.create=e=>{var t;return new Fn({checks:[],typeName:he.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ye(e)})};function JF(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(e.toFixed(o).replace(".","")),i=parseInt(t.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}class Vr extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.number,received:s.parsedType}),me}let r;const o=new Ft;for(const s of this._def.checks)s.kind==="int"?Pe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),J(r,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?JF(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),J(r,{code:G.not_finite,message:s.message}),o.dirty()):Pe.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ae.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ae.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ae.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ae.toString(n))}setLimit(t,n,r,o){return new Vr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ae.toString(o)}]})}_addCheck(t){return new Vr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ae.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ae.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Pe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Vr.create=e=>new Vr({checks:[],typeName:he.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ye(e)});class Ro extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==te.bigint){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.bigint,received:s.parsedType}),me}let r;const o=new Ft;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):Pe.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ae.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ae.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ae.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ae.toString(n))}setLimit(t,n,r,o){return new Ro({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ae.toString(o)}]})}_addCheck(t){return new Ro({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ro.create=e=>{var t;return new Ro({checks:[],typeName:he.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ye(e)})};class Pf extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.boolean,received:r.parsedType}),me}return zt(t.data)}}Pf.create=e=>new Pf({typeName:he.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ye(e)});class Ks extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.date,received:s.parsedType}),me}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_date}),me}const r=new Ft;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Pe.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ks({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ae.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ae.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Ks.create=e=>new Ks({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:he.ZodDate,...ye(e)});class Of extends xe{_parse(t){if(this._getType(t)!==te.symbol){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.symbol,received:r.parsedType}),me}return zt(t.data)}}Of.create=e=>new Of({typeName:he.ZodSymbol,...ye(e)});class Ma extends xe{_parse(t){if(this._getType(t)!==te.undefined){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.undefined,received:r.parsedType}),me}return zt(t.data)}}Ma.create=e=>new Ma({typeName:he.ZodUndefined,...ye(e)});class Na extends xe{_parse(t){if(this._getType(t)!==te.null){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.null,received:r.parsedType}),me}return zt(t.data)}}Na.create=e=>new Na({typeName:he.ZodNull,...ye(e)});class kf extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return zt(t.data)}}kf.create=e=>new kf({typeName:he.ZodAny,...ye(e)});class jo extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return zt(t.data)}}jo.create=e=>new jo({typeName:he.ZodUnknown,...ye(e)});class hr extends xe{_parse(t){const n=this._getOrReturnCtx(t);return J(n,{code:G.invalid_type,expected:te.never,received:n.parsedType}),me}}hr.create=e=>new hr({typeName:he.ZodNever,...ye(e)});class _f extends xe{_parse(t){if(this._getType(t)!==te.undefined){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.void,received:r.parsedType}),me}return zt(t.data)}}_f.create=e=>new _f({typeName:he.ZodVoid,...ye(e)});class ln extends xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==te.array)return J(n,{code:G.invalid_type,expected:te.array,received:n.parsedType}),me;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(J(n,{code:i?G.too_big:G.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(J(n,{code:G.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(J(n,{code:G.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Cn(n,i,n.path,a)))).then(i=>Ft.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new Cn(n,i,n.path,a)));return Ft.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ln({...this._def,minLength:{value:t,message:ae.toString(n)}})}max(t,n){return new ln({...this._def,maxLength:{value:t,message:ae.toString(n)}})}length(t,n){return new ln({...this._def,exactLength:{value:t,message:ae.toString(n)}})}nonempty(t){return this.min(1,t)}}ln.create=(e,t)=>new ln({type:e,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...ye(t)});function Bo(e){if(e instanceof nt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Rn.create(Bo(r))}return new nt({...e._def,shape:()=>t})}else return e instanceof ln?new ln({...e._def,type:Bo(e.element)}):e instanceof Rn?Rn.create(Bo(e.unwrap())):e instanceof Rr?Rr.create(Bo(e.unwrap())):e instanceof Vn?Vn.create(e.items.map(t=>Bo(t))):e}class nt extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Pe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==te.object){const c=this._getOrReturnCtx(t);return J(c,{code:G.invalid_type,expected:te.object,received:c.parsedType}),me}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof hr&&this._def.unknownKeys==="strip"))for(const c in o.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const u=s[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Cn(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof hr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(J(o,{code:G.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Cn(o,f,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,d=await u.value;c.push({key:f,value:d,alwaysSet:u.alwaysSet})}return c}).then(c=>Ft.mergeObjectSync(r,c)):Ft.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ae.errToObj,new nt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,s,i,a;const l=(i=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ae.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new nt({...this._def,unknownKeys:"strip"})}passthrough(){return new nt({...this._def,unknownKeys:"passthrough"})}extend(t){return new nt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new nt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:he.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new nt({...this._def,catchall:t})}pick(t){const n={};return Pe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new nt({...this._def,shape:()=>n})}omit(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new nt({...this._def,shape:()=>n})}deepPartial(){return Bo(this)}partial(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new nt({...this._def,shape:()=>n})}required(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Rn;)s=s._def.innerType;n[r]=s}}),new nt({...this._def,shape:()=>n})}keyof(){return d0(Pe.objectKeys(this.shape))}}nt.create=(e,t)=>new nt({shape:()=>e,unknownKeys:"strip",catchall:hr.create(),typeName:he.ZodObject,...ye(t)}),nt.strictCreate=(e,t)=>new nt({shape:()=>e,unknownKeys:"strict",catchall:hr.create(),typeName:he.ZodObject,...ye(t)}),nt.lazycreate=(e,t)=>new nt({shape:e,unknownKeys:"strip",catchall:hr.create(),typeName:he.ZodObject,...ye(t)});class Fa extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new en(a.ctx.common.issues));return J(n,{code:G.invalid_union,unionErrors:i}),me}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new en(l));return J(n,{code:G.invalid_union,unionErrors:a}),me}}get options(){return this._def.options}}Fa.create=(e,t)=>new Fa({options:e,typeName:he.ZodUnion,...ye(t)});const Ln=e=>e instanceof $a?Ln(e.schema):e instanceof $n?Ln(e.innerType()):e instanceof Ra?[e.value]:e instanceof $r?e.options:e instanceof ja?Pe.objectValues(e.enum):e instanceof Ba?Ln(e._def.innerType):e instanceof Ma?[void 0]:e instanceof Na?[null]:e instanceof Rn?[void 0,...Ln(e.unwrap())]:e instanceof Rr?[null,...Ln(e.unwrap())]:e instanceof h0||e instanceof Ha?Ln(e.unwrap()):e instanceof za?Ln(e._def.innerType):[];class Af extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return J(n,{code:G.invalid_type,expected:te.object,received:n.parsedType}),me;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(J(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),me)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const s of n){const i=Ln(s.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,s)}}return new Af({typeName:he.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ye(r)})}}function If(e,t){const n=Lr(e),r=Lr(t);if(e===t)return{valid:!0,data:e};if(n===te.object&&r===te.object){const o=Pe.objectKeys(t),s=Pe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=If(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===te.array&&r===te.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],l=If(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===te.date&&r===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class La extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(i0(s)||i0(i))return me;const a=If(s.value,i.value);return a.valid?((a0(s)||a0(i))&&n.dirty(),{status:n.value,value:a.data}):(J(r,{code:G.invalid_intersection_types}),me)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}La.create=(e,t,n)=>new La({left:e,right:t,typeName:he.ZodIntersection,...ye(n)});class Vn extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.array)return J(r,{code:G.invalid_type,expected:te.array,received:r.parsedType}),me;if(r.data.length<this._def.items.length)return J(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),me;!this._def.rest&&r.data.length>this._def.items.length&&(J(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Cn(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ft.mergeArray(n,i)):Ft.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Vn({...this._def,rest:t})}}Vn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vn({items:e,typeName:he.ZodTuple,rest:null,...ye(t)})};class Va extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return J(r,{code:G.invalid_type,expected:te.object,received:r.parsedType}),me;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new Cn(r,a,r.path,a)),value:i._parse(new Cn(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ft.mergeObjectAsync(n,o):Ft.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof xe?new Va({keyType:t,valueType:n,typeName:he.ZodRecord,...ye(r)}):new Va({keyType:Fn.create(),valueType:t,typeName:he.ZodRecord,...ye(n)})}}class Df extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.map)return J(r,{code:G.invalid_type,expected:te.map,received:r.parsedType}),me;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Cn(r,a,r.path,[c,"key"])),value:s._parse(new Cn(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return me;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return me;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Df.create=(e,t,n)=>new Df({valueType:t,keyType:e,typeName:he.ZodMap,...ye(n)});class zo extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.set)return J(r,{code:G.invalid_type,expected:te.set,received:r.parsedType}),me;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(J(r,{code:G.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(J(r,{code:G.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return me;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new Cn(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new zo({...this._def,minSize:{value:t,message:ae.toString(n)}})}max(t,n){return new zo({...this._def,maxSize:{value:t,message:ae.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}zo.create=(e,t)=>new zo({valueType:e,minSize:null,maxSize:null,typeName:he.ZodSet,...ye(t)});class Zs extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.function)return J(n,{code:G.invalid_type,expected:te.function,received:n.parsedType}),me;function r(a,l){return Ef({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Tf(),Us].filter(c=>!!c),issueData:{code:G.invalid_arguments,argumentsError:l}})}function o(a,l){return Ef({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Tf(),Us].filter(c=>!!c),issueData:{code:G.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Xs){const a=this;return zt(async function(...l){const c=new en([]),u=await a._def.args.parseAsync(l,s).catch(h=>{throw c.addIssue(r(l,h)),c}),f=await Reflect.apply(i,this,u);return await a._def.returns._def.type.parseAsync(f,s).catch(h=>{throw c.addIssue(o(f,h)),c})})}else{const a=this;return zt(function(...l){const c=a._def.args.safeParse(l,s);if(!c.success)throw new en([r(l,c.error)]);const u=Reflect.apply(i,this,c.data),f=a._def.returns.safeParse(u,s);if(!f.success)throw new en([o(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Zs({...this._def,args:Vn.create(t).rest(jo.create())})}returns(t){return new Zs({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Zs({args:t||Vn.create([]).rest(jo.create()),returns:n||jo.create(),typeName:he.ZodFunction,...ye(r)})}}class $a extends xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}$a.create=(e,t)=>new $a({getter:e,typeName:he.ZodLazy,...ye(t)});class Ra extends xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return J(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ra.create=(e,t)=>new Ra({value:e,typeName:he.ZodLiteral,...ye(t)});function d0(e,t){return new $r({values:e,typeName:he.ZodEnum,...ye(t)})}class $r extends xe{constructor(){super(...arguments),Ys.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return J(n,{expected:Pe.joinValues(r),received:n.parsedType,code:G.invalid_type}),me}if(Da(this,Ys)||l0(this,Ys,new Set(this._def.values)),!Da(this,Ys).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return J(n,{received:n.data,code:G.invalid_enum_value,options:r}),me}return zt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return $r.create(t,{...this._def,...n})}exclude(t,n=this._def){return $r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ys=new WeakMap,$r.create=d0;class ja extends xe{constructor(){super(...arguments),qs.set(this,void 0)}_parse(t){const n=Pe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==te.string&&r.parsedType!==te.number){const o=Pe.objectValues(n);return J(r,{expected:Pe.joinValues(o),received:r.parsedType,code:G.invalid_type}),me}if(Da(this,qs)||l0(this,qs,new Set(Pe.getValidEnumValues(this._def.values))),!Da(this,qs).has(t.data)){const o=Pe.objectValues(n);return J(r,{received:r.data,code:G.invalid_enum_value,options:o}),me}return zt(t.data)}get enum(){return this._def.values}}qs=new WeakMap,ja.create=(e,t)=>new ja({values:e,typeName:he.ZodNativeEnum,...ye(t)});class Xs extends xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.promise&&n.common.async===!1)return J(n,{code:G.invalid_type,expected:te.promise,received:n.parsedType}),me;const r=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return zt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Xs.create=(e,t)=>new Xs({type:e,typeName:he.ZodPromise,...ye(t)});class $n extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{J(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return me;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?me:l.status==="dirty"||n.value==="dirty"?Gs(l.value):l});{if(n.value==="aborted")return me;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?me:a.status==="dirty"||n.value==="dirty"?Gs(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?me:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?me:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Aa(i))return i;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Aa(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):i);Pe.assertNever(o)}}$n.create=(e,t,n)=>new $n({schema:e,typeName:he.ZodEffects,effect:t,...ye(n)}),$n.createWithPreprocess=(e,t,n)=>new $n({schema:t,effect:{type:"preprocess",transform:e},typeName:he.ZodEffects,...ye(n)});class Rn extends xe{_parse(t){return this._getType(t)===te.undefined?zt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rn.create=(e,t)=>new Rn({innerType:e,typeName:he.ZodOptional,...ye(t)});class Rr extends xe{_parse(t){return this._getType(t)===te.null?zt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rr.create=(e,t)=>new Rr({innerType:e,typeName:he.ZodNullable,...ye(t)});class Ba extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===te.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ba.create=(e,t)=>new Ba({innerType:e,typeName:he.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});class za extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ia(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new en(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new en(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}za.create=(e,t)=>new za({innerType:e,typeName:he.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});class Mf extends xe{_parse(t){if(this._getType(t)!==te.nan){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.nan,received:r.parsedType}),me}return{status:"valid",value:t.data}}}Mf.create=e=>new Mf({typeName:he.ZodNaN,...ye(e)});class h0 extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Wa extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?me:s.status==="dirty"?(n.dirty(),Gs(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?me:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Wa({in:t,out:n,typeName:he.ZodPipeline})}}class Ha extends xe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Aa(o)&&(o.value=Object.freeze(o.value)),o);return Ia(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Ha.create=(e,t)=>new Ha({innerType:e,typeName:he.ZodReadonly,...ye(t)}),nt.lazycreate;var he;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(he||(he={})),Fn.create,Vr.create,Mf.create,Ro.create,Pf.create,Ks.create,Of.create,Ma.create,Na.create,kf.create,jo.create,hr.create,_f.create,ln.create,nt.create,nt.strictCreate,Fa.create,Af.create,La.create,Vn.create,Va.create,Df.create,zo.create,Zs.create,$a.create,Ra.create,$r.create,ja.create,Xs.create,$n.create,Rn.create,Rr.create,$n.createWithPreprocess,Wa.create;const eL={sort:(e,t)=>e.localeCompare(t),allowDots:!0,charset:"utf-8",parseArrays:!0,plainObjects:!0,charsetSentinel:!0,allowPrototypes:!1,depth:Number.MAX_SAFE_INTEGER,arrayLimit:Number.MAX_SAFE_INTEGER,parameterLimit:Number.MAX_SAFE_INTEGER},p0=e=>{const t=new FormData(e),n=new URLSearchParams(t);return LF.parse(n.toString(),eL)},m0=e=>e.replace("[",".").replace("]","").split("."),Nf=(e,t)=>m0(e).reduce((n,r)=>{var s;if(r==="")return n;const o=((s=n.shape)==null?void 0:s[r])||n;return o instanceof ln?o.element:o},t),Ua=e=>e.type==="checkbox"?e.checked:e.type==="number"?e.valueAsNumber:e.value,tL=e=>{const[t,n]=b.useState(null),r=b.useRef({}),o=(l,c)=>{const u=Nf(l,e);return{...c,name:l,id:l,error:t==null?void 0:t[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}},s=(l,c)=>{const u=Nf(l,e);return{...c,name:l,id:l,type:kn.instance(u,Vr)?"number":(c==null?void 0:c.type)??"text",error:t==null?void 0:t[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}};b.useEffect(()=>{const l=Object.values(r.current).map(u=>{const f=u.schema.safeParse(Ua(u.element)),d=p=>{const m=u.schema.safeParse(Ua(p.target)),y=u.element,v=y.name;if(m.success)return y.setCustomValidity(""),n(w=>{const{[v]:g,...T}=w||{};return T===null||kn.empty(T)?null:T});if(y.required){const w=m.error.issues[0].message;y.setCustomValidity(w),n(g=>({...g,[v]:w}))}},h=u.element.tagName==="INPUT"?"blur":"change";return u.element.addEventListener(h,d),{input:u,hasInitialError:u.element.required?!f.success:!1,unsubscribe:()=>u.element.removeEventListener(h,d)}});return l.some(u=>u.hasInitialError)&&n(u=>u===null?{}:u),()=>l.forEach(u=>u.unsubscribe())});const i=b.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget,f=Object.values(r.current).reduce((h,p)=>{const m=p.element,y=p.schema.safeParse(Ua(m));if(y.success)return h;const v=y.error.issues[0].message;return m.setAttribute("data-initialized","true"),{...h,[m.name]:v}},{}),d=kn.empty(f)?null:{};n(d),l==null||l({form:u,errors:d||{}})},[]),a=b.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget;let f=p0(u);Array.from(u.elements).forEach(d=>{if(d.tagName==="SELECT"){const h=d;f=Wh(f,h.name,h.value)}if(d.tagName==="INPUT"){const h=d;f=Wh(f,h.name,Ua(h))}}),l({form:u,json:f,event:c,reset:()=>Xp(u)})},[]);return{input:s,select:o,onSubmit:a,errors:t,onInvalid:i,disabled:t!==null}},nL={name:"dark",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},rounded:{pill:"2rem",card:"0.75rem",full:"50%"},colors:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 9%)",accent:"hsla(199, 89%, 54%)",disabled:"hsla(240, 4%, 33%)",primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(199, 89%, 54%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{DEFAULT:"hsla(210, 20%, 80%)",subtle:"hsla(210, 27%, 88%)",hover:"hsla(210, 21%, 27%)",foreground:"hsla(210, 40%, 98%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 93%, 77%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 40%, 98%)"},warn:{DEFAULT:"hsla(27, 96%, 61%)",subtle:"hsla(45, 95%, 66%)",hover:"hsla(21, 90%, 48%)",foreground:"hsla(210, 40%, 98%)"},danger:{DEFAULT:"hsla(358, 75%, 59%)",subtle:"hsla(0, 94%, 81%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 40%, 98%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 75%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(210, 40%, 98%)"},input:{border:"hsla(240, 4%, 25%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 9%)",switch:"hsla(0, 0%, 100%)"},card:{background:"hsla(0, 0%, 15%)",border:"hsla(240, 7%, 27%)"},floating:{background:"hsla(0, 0%, 14%)",border:"hsla(240, 7%, 27%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 8%)",border:"hsla(0, 0%, 15%)"},table:{background:"hsla(0, 0%, 15%)",border:"hsla(240, 4%, 33%)"}}},rL={name:"light",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},rounded:{full:"50%",pill:"2rem",card:"0.75rem"},colors:{foreground:"hsla(217, 15%, 32%)",background:"hsla(210, 34%, 96%)",accent:"hsla(199, 89%, 54%)",disabled:"hsla(240, 10%, 75%)",primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(199, 89%, 54%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{DEFAULT:"hsla(210, 20%, 40%)",subtle:"hsla(210, 27%, 95%)",hover:"hsla(210, 21%, 27%)",foreground:"hsla(210, 40%, 98%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 70%, 90%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 34%, 96%)"},danger:{DEFAULT:"hsla(0, 82%, 63%)",subtle:"hsla(0, 96%, 95%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 34%, 96%)"},warn:{DEFAULT:"hsla(27, 100%, 70%)",subtle:"hsla(45, 95%, 80%)",hover:"hsla(29, 85%, 50%)",foreground:"hsla(210, 34%, 96%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 90%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(210, 34%, 96%)"},input:{border:"hsla(218, 22%, 80%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 9%)",switch:"hsla(0, 0%, 100%)"},card:{background:"hsla(0, 0%, 100%)",border:"hsla(210, 25%, 88%)"},floating:{background:"hsla(0, 0%, 100%)",border:"hsla(210, 25%, 88%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 8%)",border:"hsla(0, 0%, 15%)"},table:{background:"hsla(0, 0%, 100%)",border:"hsla(210, 25%, 88%)"}}},oL={cssVariable:(e,t,n)=>`var(--${n})`,rgba:e=>`rgba(${e})`,rgb:e=>`rgb(${e})`,hsl:e=>`hsl(${e})`,hsla:e=>`hsla(${e})`,hex:e=>e,raw:e=>e,formatWithVar:e=>(t,n,r)=>`${e}(var(--${r}), <alpha-value>)`},Qs=(e,t,n="",r="")=>Object.entries(e).reduce((o,[s,i])=>{const a=r===""?`${n}${s}`:`${r}-${s}`;if(typeof i=="string"){const l=r===""?`${n}${s}`:s;return o.concat(t(i,l,a))}return o.concat(Qs(i,t,n,a))},[]),g0=(e,t,n="",r="")=>Object.entries(e).reduce((o,[s,i])=>{const a=r===""?`${n}${s}`:`${r}-${s}`;if(typeof i=="string"){const l=r===""?`${n}${s}`:s;return{...o,[l]:t(i,s,a)}}return{...o,[s]:g0(i,t,n,a)}},{}),y0={default:e=>`:root { ${e} }`,dark:e=>`html.dark {${e}}`},Ff=(e,t)=>{const n=t.value||((o,s)=>s),r=e.map(o=>`${o.key}: ${n(o.key,o.value)}`).join(";");return t.result(r)},sL={default:e=>Ff(e,{result:y0.default}),dark:e=>Ff(e,{result:y0.dark})},iL=(e,t)=>{const n=(i,a,l)=>({key:`--${l}`,value:`${i}`}),r=Qs(e.colors,n),o=Qs(e.spacing,n),s=Qs(e.rounded,n);return Ff(r.concat(o,s),{result:i=>`html${t?`.${t}`:""} {${i}}`,value:(i,a)=>a.replace("hsla(","").replace(")","")})};re.Autocomplete=c1,re.Button=ps,re.ButtonGroup=FE,re.Calendar=Eb,re.Card=Ob,re.Checkbox=Hm,re.ColType=Vo,re.DatePicker=$M,re.Dropdown=Mo,re.FileUpload=BE,re.Form=WE,re.Input=us,re.InputFeedback=Xh,re.InputField=Di,re.Modal=rN,re.Option=Qh,re.Polymorph=hs,re.Select=xr,re.Stats=BM,re.Switch=HE,re.Tab=HM,re.Table=rF,re.Tabs=zM,re.Tag=jM,re.Tooltip=UM,re.TransferList=CP,re.convertPath=m0,re.createColumns=ON,re.createDesignTokens=g0,re.createOptionCols=ff,re.createStyles=sL,re.createTheme=iL,re.css=$t,re.defaultDarkTheme=nL,re.defaultLightTheme=rL,re.dispatchInput=Ql,re.formReset=Xp,re.formToJson=p0,re.getSchemaShape=Nf,re.isReactComponent=o1,re.isReactFC=s1,re.isSsr=cf,re.mergeRefs=Xl,re.parsers=oL,re.path=Kb,re.reduceTokens=Qs,re.useForm=tL,re.usePrevious=Zd,re.useReactive=kb,re.useTablePreferences=_N,re.uuid=ka,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
170
+ */var pb;function wM(){return pb||(pb=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=b,t=fb();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;function c(u,f,d,h,p){var m=s(null),y;m.current===null?(y={hasValue:!1,value:null},m.current=y):y=m.current;var v=a(function(){var x=!1,E,C,O=function(_){if(!x){x=!0,E=_;var j=h(_);if(p!==void 0&&y.hasValue){var D=y.value;if(p(D,j))return C=D,D}return C=j,j}var k=E,F=C;if(r(k,_))return F;var $=h(_);return p!==void 0&&p(F,$)?F:(E=_,C=$,$)},I=d===void 0?null:d,N=function(){return O(f())},L=I===null?void 0:function(){return O(I())};return[N,L]},[f,d,h,p]),w=v[0],g=v[1],T=o(u,w,g);return i(function(){y.hasValue=!0,y.value=T},[T]),l(T),T}hb.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),hb}process.env.NODE_ENV==="production"?bM():wM();const Do=e=>{const t=b.useRef(e??{});return b.useEffect(()=>void(t.current=e),[e]),t},xM=e=>{const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current},SM=e=>Object.entries(e),mb=e=>e instanceof Promise,gb=(e,t,n,r)=>t===e?n.reduce((o,s)=>s(o,t,r),e):e.constructor.name===Object.name?n.reduce((o,s)=>s(o,t,r),{...t,...e}):n.reduce((o,s)=>s(o,t,r),e),TM=(e,t,n,r,o,s)=>(...i)=>{const a=performance.now(),l=t(...i),c=(u,f)=>n(d=>gb(u,d,s,f));return mb(l)?l.then(u=>{o.current={method:e,props:r(),time:performance.now()-a},c(u,o.current)}):(o.current={method:e,props:r(),time:performance.now()-a},void c(l,o.current))},EM=(e,t,n,r,o,s)=>(...i)=>{o.current={method:e,time:0,props:r()};const a=t(...i),l=c=>n(u=>gb(c,u,s,o.current));return mb(a)?a.then(c=>l(c)):l(a)},ef=(e,t,n)=>{const[r,o]=b.useState(()=>e),s=Do(r),i=Do((n==null?void 0:n.props)??{}),a=Do(t),l=Do((n==null?void 0:n.postMiddleware)??[]),c=Do((n==null?void 0:n.interceptor)??[]),u=b.useRef(e),f=xM(r),d=Do(f),h=b.useRef(null);b.useEffect(()=>{if(h.current===null)return;const m=h.current;l.current.forEach(y=>{y(r,f,m)})},[r,l,f]);const[p]=b.useState(()=>{const m=()=>i.current,y=a.current({props:m,state:()=>s.current,initialState:u.current,previousState:()=>d.current});return SM(y).reduce((v,[w,g])=>({...v,[w]:n!=null&&n.debug?TM(w,g,o,m,h,c.current):EM(w,g,o,m,h,c.current)}),{})});return[r,p,i.current]},CM=(e,t=0)=>{let n;return function(...o){clearTimeout(n),n=setTimeout(()=>e(...o),t)}};function PM(e,t){return b.useRef(CM(e,t)).current}function tf(e,t,n){var r,o,s,i,a;t==null&&(t=100);function l(){var u=Date.now()-i;u<t&&u>=0?r=setTimeout(l,t-u):(r=null,n||(a=e.apply(s,o),s=o=null))}var c=function(){s=this,o=arguments,i=Date.now();var u=n&&!r;return r||(r=setTimeout(l,t)),u&&(a=e.apply(s,o),s=o=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=e.apply(s,o),s=o=null,clearTimeout(r),r=null)},c}tf.debounce=tf;var OM=tf;const yb=Jd(OM);function kM(e){let{debounce:t,scroll:n,polyfill:r,offsetSize:o}={debounce:0,scroll:!1,offsetSize:!1};const s=r||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[i,a]=b.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=b.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:i}),c=t?typeof t=="number"?t:t.scroll:null,u=t?typeof t=="number"?t:t.resize:null,f=b.useRef(!1);b.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[d,h,p]=b.useMemo(()=>{const w=()=>{if(!l.current.element)return;const{left:g,top:T,width:x,height:E,bottom:C,right:O,x:I,y:N}=l.current.element.getBoundingClientRect(),L={left:g,top:T,width:x,height:E,bottom:C,right:O,x:I,y:N};l.current.element instanceof HTMLElement&&o&&(L.height=l.current.element.offsetHeight,L.width=l.current.element.offsetWidth),Object.freeze(L),f.current&&!DM(l.current.lastBounds,L)&&a(l.current.lastBounds=L)};return[w,u?yb(w,u):w,c?yb(w,c):w]},[a,o,c,u]);function m(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",p,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function y(){l.current.element&&(l.current.resizeObserver=new s(p),l.current.resizeObserver.observe(l.current.element),n&&l.current.scrollContainers&&l.current.scrollContainers.forEach(w=>w.addEventListener("scroll",p,{capture:!0,passive:!0})))}const v=w=>{!w||w===l.current.element||(m(),l.current.element=w,l.current.scrollContainers=vb(w),y())};return AM(p,!!n),_M(h),b.useEffect(()=>{m(),y()},[n,p,h]),b.useEffect(()=>m,[]),[v,i,d]}function _M(e){b.useEffect(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function AM(e,t){b.useEffect(()=>{if(t){const n=e;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[e,t])}function vb(e){const t=[];if(!e||e===document.body)return t;const{overflow:n,overflowX:r,overflowY:o}=window.getComputedStyle(e);return[n,r,o].some(s=>s==="auto"||s==="scroll")&&t.push(e),[...t,...vb(e.parentElement)]}const IM=["x","y","top","bottom","left","right","width","height"],DM=(e,t)=>IM.every(n=>e[n]===t[n]),MM=({children:e})=>{const[t,n]=kM();return S.jsx(Jt.div,{animate:{height:n.height>0?n.height:"auto"},children:S.jsx("div",{ref:t,children:e})})},NM={type:"spring",bounce:.1,duration:.3},bb=e=>(t=1)=>({x:`${100*e*t}%`,opacity:.5}),wb={middle:{x:"0%",opacity:1},enter:bb(1),exit:bb(-1)},xb={exit:{visibility:"hidden"}},FM=e=>{const t=vn(Zm(e));return Km({start:t,end:yo(t,41)})},Sb=(e,t)=>e.toLocaleDateString(t,{month:"long"}),LM=(e,t)=>Array.from({length:12}).map((n,r)=>{const o=Zm(new Date(e).setMonth(r)),s=Sb(o,t);return S.jsx("option",{value:s,"data-index":r,children:s},s)}),nf={ArrowLeft:(e,t)=>t==="days"?kk(e,1):fg(e,1),ArrowRight:(e,t)=>t==="days"?yo(e,1):Ji(e,1),ArrowUp:(e,t)=>t==="days"?_k(e,1):Ak(e,1),ArrowDown:(e,t)=>t==="days"?Ym(e,1):qm(e,1)},Tb=(e,t=0)=>{const n=e.toISOString(),r=()=>{const o=document.querySelector(`button[data-date="${n}"]`);if(o)return o.focus({preventScroll:!1})};t===0&&r(),setTimeout(r,t)},Nr=e=>e.getFullYear().toString().padStart(4,"0"),Eb=({locale:e,disabledDate:t,markToday:n=!0,autoFocusToday:r=!0,date:o,onChange:s})=>{const i=o||new Date,[a,l]=ef({date:i,isAnimating:!1,year:Nr(i),direction:void 0,months:LM(i,e),week:Km({start:vn(i),end:$P(i)})},p=>({onChangeYear:m=>({year:m}),setToday:()=>({date:bo(new Date)}),onExitComplete:()=>(Tb(p.state().date,200),{isAnimating:!1}),date:m=>{const y=m(p.state().date);return{date:y,year:Nr(y)}},nextMonth:()=>{const m=p.state();if(m.isAnimating)return m;const y=Ji(m.date,1);return{date:y,isAnimating:!0,direction:1,year:Nr(y)}},previousMonth:()=>{const m=p.state();if(m.isAnimating)return m;const y=fg(m.date,1);return{date:y,isAnimating:!0,direction:-1,year:Nr(y)}},onSelectDate:m=>{const y=m.currentTarget.dataset.date||"",v=new Date(y);return{date:v,year:Nr(v)}},onChangeMonth:m=>{const y=m.target.value,w=Array.from(m.target.options).find(g=>g.value===y);if(w){const g=w.dataset.index||"",T=new Date(p.state().date);return T.setMonth(+g),{date:T,year:Nr(T)}}return p.state()},onKeyDown:m=>{const y=m.key;if(y in nf){(y==="ArrowUp"||y==="ArrowDown")&&m.preventDefault();const v=p.state().date,w=kn.keyof(nf,y)?nf[y](v,m.shiftKey?"month":"days"):null;if(w!==null)return Tb(w),{date:w,year:Nr(w)}}return p.state()}})),c=FM(a.date),u=a.date.toISOString(),f=Sb(a.date,e);b.useEffect(()=>s==null?void 0:s(a.date),[u]);const d=PM(p=>{l.date(m=>{const y=new Date(m);return y.setFullYear(+p),y})},700),h=p=>{const m=p.currentTarget.value;l.onChangeYear(m),d(m)};return S.jsx(XD,{transition:NM,children:S.jsxs("div",{className:"relative overflow-hidden",children:[S.jsx("div",{className:"flex flex-col justify-center rounded text-center",children:S.jsx(MM,{children:S.jsx(Ea,{presenceAffectsLayout:!0,mode:"popLayout",initial:!1,custom:a.direction,onExitComplete:l.onExitComplete,children:S.jsxs(Jt.div,{initial:"enter",animate:"middle",exit:"exit",children:[S.jsxs("header",{className:"relative flex justify-between",children:[S.jsx(Jt.button,{onClick:l.previousMonth,variants:xb,className:"z-calendar rounded-full p-1.5 hover:bg-primary-subtle",children:S.jsx(ux,{className:"h-4 w-4"})}),S.jsx(Jt.span,{variants:wb,custom:a.direction,className:"absolute z-normal isolate inset-0 flex items-center justify-center font-semibold",children:S.jsxs("span",{className:"w-fit flex items-center justify-center gap-0.5 py-1",children:[S.jsx("select",{style:{width:`${f.length}ch`},value:f,onChange:l.onChangeMonth,className:"appearance-none capitalize bg-transparent proportional-nums hover:text-primary cursor-pointer w-fit",children:a.months}),S.jsx(fp,{mask:"int",value:a.year,maxLength:4,placeholder:"YYYY",onChange:h,style:{width:`${a.year.length}ch`},className:"w-16 bg-transparent appearance-none hover:text-primary cursor-pointer"})]})}),S.jsx(Jt.button,{variants:xb,className:"z-calendar rounded-full p-1.5 hover:bg-primary-subtle",onClick:l.nextMonth,children:S.jsx(qd,{className:"h-4 w-4"})}),S.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"linear-gradient(to right, hsla(var(--card-background)) 15%, transparent 30%, transparent 70%, hsla(var(--card-background)) 85%)"}})]}),S.jsx("div",{className:"mt-4 grid grid-cols-7 gap-y-4",children:a.week.map(p=>S.jsx("span",{className:"font-medium capitalize text-sm",children:p.toLocaleDateString(e,{weekday:"short"})},p.toString()))}),S.jsx(Jt.ul,{onKeyDown:l.onKeyDown,variants:wb,custom:a.direction,className:"mt-4 pb-2 grid grid-cols-7 gap-y-4",children:c.map(p=>{const m=p.toISOString(),y=m===u,v=Ok(p)&&n,w=(t==null?void 0:t(p))||!1,g=!Pk(p,a.date)||w;return S.jsx("li",{className:"w-full flex items-center justify-center",children:S.jsx("button",{type:"button","data-date":m,disabled:w,onClick:l.onSelectDate,"data-view":a.date.getMonth().toString(),className:`size-8 disabled:cursor-not-allowed rounded-full font-semibold flex items-center justify-center proportional-nums ${v?"text-primary":""} ${g?"text-disabled":""} ${y?"bg-primary text-primary-foreground":""}`,children:p.getDate()})},m)})})]},f)})})}),S.jsx("footer",{className:"text-center text-primary mt-2",children:S.jsx("button",{className:"hover:scale-105 transition-transform duration-300",type:"button",onClick:l.setToday,children:"Today"})})]})})},Mo=e=>{const t=b.useId(),[n,r]=b.useState(e.open),o=b.useRef(null),s=b.useMemo(()=>[fl(10),gd({fallbackAxisSideDirection:"end"}),md(),yd({padding:5,element:o})],[e.arrow]),{refs:i,floatingStyles:a,context:l}=vi({open:n,middleware:s,transform:!0,whileElementsMounted:ul,onOpenChange:(p,m)=>{var v;const y=m==null?void 0:m.relatedTarget;y&&y.dataset.floating==="true"&&!p||(r(p),(v=e.onChange)==null||v.call(e,p))}}),c=$d(l),u=yi(l),f=xi(l),{getReferenceProps:d,getFloatingProps:h}=bi([c,u,f]);return S.jsxs(b.Fragment,{children:[S.jsx("button",{ref:i.setReference,...d(),type:"button",children:e.trigger}),n&&S.jsx(gi,{id:`${t}-portal`,children:S.jsx(vl,{returnFocus:!0,visuallyHiddenDismiss:!0,restoreFocus:!0,context:l,modal:!1,children:S.jsxs("div",{className:"bg-floating-background relative min-w-96 isolate z-floating border shadow-2xl p-6 border-floating-border rounded-lg",ref:i.setFloating,style:a,"aria-labelledby":t,...h(),children:[S.jsx(Td,{ref:o,context:l,strokeWidth:.1,className:"fill-floating-background stroke-floating-border"}),S.jsx("header",{className:"mb-2",children:S.jsx("h3",{className:"leading-snug font-medium text-2xl tracking-wide text-left",children:e.title})}),e.children]})})})]})},Cb=new Date(1970,11,31),rf={year:()=>[/\d/,/\d/,/\d/,/\d/],month:()=>[/\d/,/\d/],day:()=>[/\d/,/\d/],literal:e=>e.split("")},Pb={year:()=>"yyyy",month:()=>"MM",day:()=>"dd",literal:e=>e},VM={literal:(e,t)=>t,year:e=>e.getFullYear(),day:e=>e.getDate().toString().padStart(2,"0"),month:e=>(e.getMonth()+1).toString().padStart(2,"0")},$M=({date:e,locale:t,disabledDate:n,autoFocusToday:r,onChange:o,markToday:s,...i})=>{const a=b.useMemo(()=>new Intl.DateTimeFormat(t),[t]),[l,c]=b.useState(e||void 0),[u,f]=b.useState(!1),d=a.formatToParts(Cb).flatMap(w=>kn.keyof(rf,w.type)?rf[w.type](w.value):[]),h=a.formatToParts(Cb).reduce((w,g)=>w+(kn.keyof(Pb,g.type)?Pb[g.type](g.value):""),""),[p,m]=b.useState(l?a.formatToParts(l).reduce((w,g)=>w+(kn.keyof(rf,g.type)?VM[g.type](l,g.value):""),""):""),y=w=>{const g=w.target.value;if(m(g),d.length===g.length&&d.every((x,E)=>{const C=g.charAt(E);return typeof x=="string"?C===x:x.test(C)})){const x=bo(Ek(g,h,new Date));c(x),o==null||o(x)}},v=w=>{c(w),o==null||o(w),m(OO(w,h))};return S.jsx(us,{...i,mask:d,value:p,onChange:y,className:"uppercase",formNoValidate:!u,placeholder:h,required:i.required??!0,error:u?void 0:i.error,name:i.name?`${i.name}-picker`:i.name,right:S.jsxs(b.Fragment,{children:[S.jsx("input",{defaultValue:l==null?void 0:l.toISOString(),hidden:!0,type:"date",name:i.name}),S.jsx(Mo,{trigger:S.jsx(cx,{}),onChange:f,open:u,children:S.jsx(Eb,{...i,locale:t,date:l,onChange:v,markToday:s,disabledDate:n,autoFocusToday:r})})]})})},RM=wc("inline-flex rounded-pill gap-1.5 text-main-foreground border-2 border-transparent items-center justify-center align-middle whitespace-nowrap",{variants:{size:{icon:"p-1",big:"h-12 px-6 py-4",default:"h-8 px-4 py-2",small:"h-6 p-2 px-3 text-sm"},theme:{raw:"",main:"bg-primary-subtle text-primary-hover",warn:"bg-warn-subtle text-warn-hover",danger:"bg-danger-subtle text-danger-hover",secondary:"bg-secondary-subtle text-secondary-hover",success:"bg-success-subtle text-success-hover",info:"bg-info-subtle text-info-hover",loading:"animate-pulse bg-disabled duration-700 opacity-70",disabled:"bg-disabled duration-700 opacity-70"}},defaultVariants:{theme:"main",size:"default"}}),jM=b.forwardRef(function({className:t,icon:n,loading:r,theme:o,size:s,...i},a){return S.jsxs(hs,{...i,ref:a,"data-theme":o,as:i.as??"span",className:$t(RM({size:s,theme:o}),t),children:[i.children,n]})}),Ob=({children:e,title:t,container:n="",header:r=null,className:o="",...s})=>S.jsxs(hs,{...s,as:"div",className:$t("rounded-card flex flex-col gap-4 bg-card-background py-4 pb-8 border-card-border border shadow",n),children:[t?S.jsx("header",{className:"w-full px-8 pb-4 mb-2 border-b border-card-border font-medium text-xl",children:t}):r,S.jsx("div",{className:`min-w-full px-8 ${o}`,children:e})]}),BM=e=>S.jsxs("div",{className:"divide-y divide-card-border bg-card-background shadow border border-card-border rounded-card",children:[S.jsxs("header",{className:"p-6 items-start flex gap-4",children:[S.jsx("div",{className:$t("size-10 p-8 rounded-card flex items-center justify-center aspect-square bg-primary",e.iconContainer),children:S.jsx("div",{children:S.jsx(e.Icon,{className:"size-10 aspect-square text-primary-foreground"})})}),S.jsxs("div",{className:"flex flex-col gap-1",children:[S.jsx("header",{children:S.jsx("h3",{className:"text-base leading-none",children:e.title})}),S.jsx("p",{className:"text-4xl font-semibold",children:e.children})]})]}),e.footer?S.jsx("footer",{className:"px-6 py-2",children:e.footer}):null]}),kb=(e,t)=>{const[n,r]=b.useState(()=>t||e);return b.useEffect(()=>{r(e)},[e]),[n,r]},_b=b.createContext(""),zM=e=>{const[t,n]=kb(e.active),r=Io(0),o=Io(0),s=b.useRef(null),i=e.useHash?"a":"button";b.useEffect(()=>{const c=s.current;if(c===null)return;const u=p=>{if(!p)return;const m=p.getBoundingClientRect();o.set(m.width),r.set(p.offsetLeft)},f=()=>{const p=c.querySelector("li[data-active=true]");return void u(p)};window.addEventListener("resize",f);let d=c.querySelector("li[data-active=true]");const h=window.location.hash.replace(/^#/,"");if(e.active===""&&h!==""&&(d=c.querySelector(`li[data-id=${h}]`),n(h)),d===null){d=c.querySelector("li[data-id]");const p=d.getAttribute("data-id")||"";n(p)}return u(d),()=>window.removeEventListener("resize",f)},[]),b.useEffect(()=>{e.onChange&&e.onChange(t)},[e.onChange,t]);const a=b.Children.toArray(e.children),l=c=>{const u=c.currentTarget,f=u.getBoundingClientRect();o.set(f.width),r.set(u.offsetLeft),n(u.dataset.id||"")};return S.jsx(_b.Provider,{value:t,children:S.jsx(Ob,{container:"pt-0",header:S.jsxs("header",{ref:s,className:"border-b border-card-border relative mb-2",children:[S.jsx(Jt.div,{layout:!0,initial:!1,"aria-hidden":"true",style:{left:r,width:o},transition:{type:"tween",left:r,width:o},className:"w-28 h-0.5 bg-primary absolute bottom-0 duration-300 transition-all hidden md:block"}),S.jsx("nav",{children:S.jsx("ul",{className:"divide-x divide-card-border overflow-x-auto flex justify-between md:justify-start",children:a.map(c=>{const u=c.props;return S.jsx("li",{"data-id":u.id,"data-active":t===u.id,className:"data-[active=true]:text-primary w-full md:w-auto",children:S.jsx(i,{"data-id":u.id,onClick:l,"aria-current":"page",className:"px-10 py-4 block font-medium w-full whitespace-nowrap",href:e.useHash?`#${u.id}`:void 0,children:u.title})},`tab-header-${u.id}`)})})})]}),children:e.children})})},WM=()=>b.useContext(_b),HM=e=>{const t=WM();return S.jsx(b.Fragment,{children:e.id===t?e.children:null})},UM=({children:e,as:t,title:n,...r})=>{const[o,s]=b.useState(!1),i=b.useRef(null),a=t||"span",{refs:l,floatingStyles:c,context:u}=vi({open:o,onOpenChange:s,whileElementsMounted:ul,transform:!0,middleware:[fl(5),gd({fallbackAxisSideDirection:"start"}),md(),yd({element:i,padding:5})]}),f=Vw(u,{move:!0}),d=Jw(u),h=yi(u),p=xi(u,{role:"tooltip"}),{getReferenceProps:m,getFloatingProps:y}=bi([f,d,h,p]);return S.jsxs(b.Fragment,{children:[S.jsx(a,{ref:l.setReference,...m(r),children:n}),S.jsx(gi,{children:o&&S.jsxs(hs,{...y(),ref:l.setFloating,style:c,className:"bg-tooltip-background z-tooltip text-tooltip-foreground border border-tooltip-border p-3 rounded-lg",children:[S.jsx(Td,{ref:i,context:u,strokeWidth:.1,className:"fill-tooltip-background stroke-tooltip-border"}),e]})})]})};function GM(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function YM(...e){return t=>e.forEach(n=>GM(n,t))}var Ab=M.forwardRef((e,t)=>{const{children:n,...r}=e,o=M.Children.toArray(n),s=o.find(KM);if(s){const i=s.props.children,a=o.map(l=>l===s?M.Children.count(i)>1?M.Children.only(null):M.isValidElement(i)?i.props.children:null:l);return S.jsx(of,{...r,ref:t,children:M.isValidElement(i)?M.cloneElement(i,void 0,a):null})}return S.jsx(of,{...r,ref:t,children:n})});Ab.displayName="Slot";var of=M.forwardRef((e,t)=>{const{children:n,...r}=e;if(M.isValidElement(n)){const o=XM(n);return M.cloneElement(n,{...ZM(r,n.props),ref:t?YM(t,o):o})}return M.Children.count(n)>1?M.Children.only(null):null});of.displayName="SlotClone";var qM=({children:e})=>S.jsx(S.Fragment,{children:e});function KM(e){return M.isValidElement(e)&&e.type===qM}function ZM(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function XM(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const No="600ms",Ib=e=>({initial:{[e]:"-60%",opacity:.8,animationDuration:No},enter:{[e]:0,opacity:1,animationDuration:No},exit:{[e]:["-50%","-90%"],opacity:0,animationDuration:No}}),QM=Ib("left"),JM=Ib("right"),Db={drawer:e=>e==="left"?QM:JM,dialog:{initial:{opacity:0,scale:.95,animationDuration:No},enter:{opacity:1,scale:[1.05,1],animationDuration:No},exit:{opacity:0,scale:.97,animationDuration:No}}},eN=wc("isolate ring-0 outline-0 appearance-none flex flex-col gap-4 flex-nowrap min-w-xs bg-floating-background",{variants:{type:{drawer:"max-h-screen max-w-[90%] w-auto h-screen min-h-0",dialog:"max-h-[calc(100lvh-10%)] container h-[inherit] rounded-lg py-8"},position:{none:"",right:"py-4 absolute right-0 top-0 rounded-l-lg",left:"py-4 absolute left-0 top-0 rounded-r-lg"}},defaultVariants:{position:"right",type:"dialog"}}),tN={top:0,left:0,right:0,bottom:0},nN=e=>{const t=(n,r)=>{if(e.parent.current){const o=e.parent.current,s=e.value.get()||o.getBoundingClientRect().width,i=e.type==="right"?-r.delta.x:r.delta.x;e.value.set(Math.abs(s+i))}};return S.jsx(Jt.div,{drag:"x",dragElastic:0,dragMomentum:!1,onDrag:t,dragConstraints:tN,whileDrag:{cursor:"grabbing"},className:`absolute top-1/2 ${e.type==="left"?"right-5":"left-2"} rounded-lg cursor-grab h-10 w-2 bg-floating-border`})},rN=({type:e="dialog",resizer:t=!0,...n})=>{const r=e==="dialog",o=r?"none":n.position||"left",s=r?Db.dialog:Db.drawer(o),i=b.useId(),a=b.useId(),{refs:l,context:c}=vi({open:n.open,onOpenChange:n.onChange}),u=$d(c),f=xi(c),d=yi(c,{escapeKey:!0,referencePress:!0,outsidePress:!1}),{getReferenceProps:h,getFloatingProps:p}=bi([u,f,d]),m=n.trigger,y=Io(void 0);return S.jsxs(b.Fragment,{children:[n.trigger?S.jsx(b.Fragment,{children:n.asChild?S.jsx(Ab,{ref:l.setReference,...h(),children:m}):S.jsx("button",{ref:l.setReference,...h(),type:"button",children:m})}):null,S.jsx(gi,{children:S.jsx(Ea,{presenceAffectsLayout:!0,children:n.open&&S.jsx(Kw,{lockScroll:!0,className:`relative !overflow-clip h-[100dvh] z-floating bg-floating-overlay/70 ${e==="drawer"?"":"grid justify-center p-8"}`,children:S.jsx(vl,{modal:!0,closeOnFocusOut:!0,context:c,children:S.jsxs(Jt.div,{animate:"enter","aria-describedby":a,"aria-labelledby":i,className:eN({position:o,type:e}),exit:"exit",initial:"initial",ref:l.setFloating,variants:s,style:{width:y},...p(),children:[!r&&t?S.jsx(nN,{value:y,parent:l.floating,type:o}):null,n.title||n.closable?S.jsxs("header",{className:"w-full relative",children:[n.title?S.jsx("h2",{className:"px-8 pb-4 border-b border-floating-border text-3xl font-medium leading-relaxed",children:n.title}):null,n.closable!==!1?S.jsx("nav",{className:"absolute -top-1 right-8",children:S.jsx("button",{type:"button",onClick:()=>{var v;return(v=n.onChange)==null?void 0:v.call(n,!1)},className:"p-1 transition-colors hover:text-danger focus:text-danger",children:S.jsx(vx,{})})}):null]}):null,S.jsx("div",{className:"flex-1 px-8 overflow-y-auto",children:n.children}),n.footer?S.jsx("footer",{className:"px-8 border-t border-floating-border pt-4 w-full",children:n.footer}):null]})})})})})]})};var oN=Object.defineProperty,Mb=Object.getOwnPropertySymbols,sN=Object.prototype.hasOwnProperty,iN=Object.prototype.propertyIsEnumerable,Nb=(e,t,n)=>t in e?oN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aN=(e,t)=>{for(var n in t||(t={}))sN.call(t,n)&&Nb(e,n,t[n]);if(Mb)for(var n of Mb(t))iN.call(t,n)&&Nb(e,n,t[n]);return e},sf=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return!0;return!1},lN=(e,t,n,r)=>Oa(sf,e,t,n,r),Fo=e=>typeof e=="object",dr=(e,t)=>{if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||!Fo(e)&&!Fo(t))return e===t;if(e.prototype!==t.prototype)return!1;const n=Object.keys(e);return n.length!==Object.keys(t).length?!1:n.every(r=>dr(e[r],t[r]))},cN=(e,t)=>(Fo(e)||Array.isArray(e))&&t?e[t]:e,uN=e=>(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1,Pa=e=>/[0-9.]+/.test(e),Fb=e=>["string","number"].includes(typeof e),Lb=e=>e==null||(e==null?void 0:e.length)===0||e==="",Vb={eq:dr,is:Object.is,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"==":(e,t)=>e==t,"===":(e,t)=>e===t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,includes:(e,t)=>`${e}`.includes(t),notIncludes:(e,t)=>!`${e}`.includes(t),startsWith:(e,t)=>`${e}`.startsWith(t),endsWith:(e,t)=>`${e}`.endsWith(t),like:(e,t)=>new RegExp(`.*${t}.*`,"gi").test(`${e}`),alphabetical:(e,t)=>e.toString().localeCompare(t.toString()),empty:Lb,notEmpty:e=>!Lb(e),in:(e,t)=>sf(t,n=>dr(e,n)),notIn:(e,t)=>$b(t,n=>!dr(e,n))},fN=e=>{if(e in Vb)return Vb[e];throw new Error("Linq - Symbol not found")},Lo=(e,t)=>{const n=[],r=e.length;for(let o=0;o<r;o++)t(e[o],o,e)&&n.push(e[o]);return n},Oa=(e,t,n,r,o)=>{if(typeof n=="function")return e(t,n);const s=fN(r);return n&&r&&o!==void 0?e(t,i=>s(i[n],o)):e(t,i=>s(i,o))},dN=(e,t,n,r)=>Oa(Lo,e,t,n,r),$b=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},hN=(e,t,n,r)=>Oa($b,e,t,n,r),Rb=e=>{if(e===null)return null;const t=aN({},e);return Object.keys(t).forEach(n=>t[n]=Fo(e[n])?Rb(e[n]):e[n]),Array.isArray(e)&&e.length?(t.length=e.length)&&Array.from(t):Array.isArray(e)?Array.from(e):t},jb=(e,t)=>{if(Fo(t)){for(let n=0;n<e.length;n++){const r=e[n];if(dr(t,r))return!0}return!1}for(let n=0;n<e.length;n++){const r=e[n];if(dr(t,r))return!0}return!1},pN=(e,t)=>{const n=new Map(e.map(r=>[r[t],r]));return Object.fromEntries(n.entries())},mN=e=>Lo(e,(t,n,r)=>Fo(t)?n===r.findIndex(o=>dr(o,t)):n===r.indexOf(t)),gN=(e,t)=>{const n=e.length;for(let r=0;r<n;r++)if(t(e[r],r,e))return e[r]},Bb=(e,t)=>{const n=new Map;return e.forEach(r=>{const o=t(r),s=n.get(o)||[];s.push(r),n.set(o,s)}),Object.fromEntries(n.entries())},yN=(e,t)=>Bb(e,n=>n[t]),zb=(e,t)=>{const n=[];let r=0;const o=e.length;for(r;r<o;r++){const s=t(e[r],r,e);n.push(s)}return n},vN=(e,t)=>{let n=Number.parseInt(e,10),r=Number.parseInt(t,10);return n>r?[r,n]:[n,r]},bN=(e,t,n=1)=>{const r=[];let o=e.charCodeAt(0);const s=t.charCodeAt(0);for(;o<=s;o+=n)r.push(String.fromCharCode(o));return Pa(e)&&Pa(t)?r.map(i=>Number.parseInt(i)):r},af=(e,t,n=1)=>{let r=Math.abs(n);if((e.length>1||t.length>1)&&Pa(e)&&Pa(t)){const o=[],[s,i]=vN(e,t);for(let a=s;a<=i;a+=r)o.push(a);return o}return bN(e,t,r)},wN=(e,t,n=1)=>{if(t===void 0){const[r,o,s]=e.split("..");return s===void 0?af(r,o,1):af(r,s,Number.parseInt(o,10))}return Fb(e)&&Fb(t)?af(`${e}`,`${t}`,n):Array.from({length:e},(r,o)=>o*Math.abs(t))},lf=(e,t,n)=>{let r=t;const o=n.length;for(let s=0;s<o;s++){const i=n[s];r=e(r,i,s,n)}return r},Wb=e=>{const t=Array.from(e.values());let n=null,r=null,o=t.length;for(n=0;n<o/2;n+=1){r=o-1-n;let s=t[n];t[n]=t[r],t[r]=s}return t},xN=(e,t)=>{if(typeof t=="number")return e.slice(t);let n=e.length;for(let r=0;r<n;r++){const o=e[r];if(t(o,r,e))return e.slice(r)}return e.slice(0)},SN=(e,t,n,r)=>Oa(xN,e,t,n,r),Hb=(e,t)=>{const n=[...e];return t===void 0?n.sort():typeof t=="function"?n.toSorted(t):n.toSorted(uN(t))},TN=e=>(t,n)=>e.reduce((r,o)=>{const s=o.type==="desc"?-1:1,i=o.key,a=t[i]>n[i]?s:t[i]<n[i]?-s:0;return r!==0?r:a},0),EN=(e,t)=>e.sort(TN(t)),CN=(e,t)=>{if(t===void 0)return[...new Set(e).values()];const n=new Set;return Array.isArray(t)?[...new Set(t)]:Lo(e,r=>{const o=t?n.has(r[t]):n.has(t);return t&&(o||n.add(r[t])),!o})},PN=class jf{constructor(t=[]){this.array=t}static Range(...t){return wN(...t)}static New(t){return new jf(t)}Where(t,n,r){return this.array=dN(this.array,t,n,r),this}Some(t,n,r){return lN(this.array,t,n,r)}All(t,n,r){return hN(this.array,t,n,r)}Reverse(){return this.array=Wb(this.array),this}Add(t){return this.array=Array.isArray(t)?this.array.concat(t):this.array.concat([t]),this}Prepend(t){return this.array=Array.isArray(t)?t.concat(this.array):[t].concat(this.array),this}Select(t){return t===void 0?this.array:this.array.map(t)}Take(t,n){return n!==void 0?this.array=this.array.slice(t,Math.max(0,n)):this.array=this.array.slice(t),this}Head(){return this.array[0]}Tail(){return this.Skip(1)}Skip(t,n,r){return this.array=SN(this.array,t,n,r),this}Distinct(){return this.array=mN(this.array),this}First(t){return t===void 0?this.array[0]:gN(this.array,t)||null}Last(t){const n=this.array.length;if(t===void 0)return this.array[n-1];for(let r=n;r!==0;r--)if(t(this.array[r],r,this.array))return this.array[r]}Sum(t){return t===void 0?lf((n,r)=>n+r,0,this.array):lf((n,r)=>n+cN(r,t),0,this.array)}Average(t){return this.Sum(t)/this.array.length}GroupBy(t){return yN(this.array,t)}GroupWith(t){return Bb(this.array,t)}Except(t){return Lo(this.array,n=>!jb(t,n))}Intersect(t){return Lo(this.array,n=>jb(t,n))}OrderBy(t,n){let r;return r=t?Hb(this.array,t):this.array.toSorted(),this.array=n==="desc"?Wb(r):r,this}Includes(t){return sf(this.array,n=>dr(n,t))}In(t){const n=t.length;for(let r=0;r<n;r++){const o=t[r];if(this.Includes(o))return!0}return!1}Reduce(t,n){return lf(t,n??this.array[0],this.array)}Empty(){return this.array.length===0}ToMap(t){return new Map(zb(this.array,n=>[t,n]))}Zip(t,n){return zb(this.array,(r,o)=>n(r,t[o]))}Count(t){return t===void 0?this.array.length:Lo(this.array,t).length}Get(t){return this.array[t]}Clone(){return new jf(Rb(this.array))}ToObject(t){return pN(this.array,t)}Sort(t){return Array.isArray(t)?EN(this.array,t):Hb(this.array,t)}Unique(t){return CN(this.array,t)}},Ub=PN;const Gb=e=>{const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),t},ka=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)}),Yb=(e,t,n)=>e.split(t).filter(Boolean).reduce((r,o)=>r!=null?r[o]:r,n),qb={basic:/[,[\]]+?/,extend:/[,[\].]+?/},Kb=(e,t)=>{const n=Yb(t,qb.basic,e)||Yb(t,qb.extend,e);return n===void 0||n===e?void 0:n},cf=()=>typeof window>"u";var uf={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=(y,v)=>{try{Object.keys(y).forEach(v)}catch(w){window.console.log(w)}},n=y=>y==null,r=y=>{const v=typeof y;return v==="string"||v==="number"||v==="boolean"||n(y)},o=(y,v)=>{const w=v.getItem(y);try{return JSON.parse(w)}catch{return w??null}},s=y=>Object.keys(y).reduce((v,w)=>({...v,[w]:o(w,y)}),{}),i=y=>y instanceof Date?y:typeof y=="number"?new Date(new Date*1+y*864e5):y,a="1969-12-31T23:59:59.000Z",l=()=>document.cookie===""?{}:document.cookie.split("; ").map(y=>y.split("=")).reduce((y,v)=>(y[decodeURIComponent(v[0].trim())]=decodeURIComponent(v[1].trim()),y),{}),c=new Set,u=()=>{const y=l();c.forEach(v=>v(y))},f=[{name:"expires",parse:y=>`expires=${i(y.expires??a)}`},{name:"maxAge",parse:y=>y.maxAge?`max-age=${i(y.expires??a)}`:""},{name:"path",parse:y=>`path=${y.path??"/"}`},{name:"sameSite",parse:y=>`samesite=${y.sameSite??"strict"}`},{name:"useSecure",parse:y=>`${y.useSecure??!0?"secure":""}`},{name:"domain",parse:y=>{const v=y.domain??"";return v===""?"":`domain=${y.multiDomain?".":""}${v}`}},{name:"partitioned",parse:y=>y.partitioned?"Partitioned":""}],d={json:l,listener:y=>(c.add(y),()=>c.delete(y)),clearListeners:()=>c.clear(),has:y=>document.cookie.split(";").some(v=>v.trim().startsWith(`${y}=`)),deleteAll:()=>{document.cookie.split(";").forEach(y=>{document.cookie=y.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}),u()},get:y=>{const v=d.json()[y];if(n(v))return null;try{return JSON.parse(decodeURIComponent(v))}catch{return v}},delete:y=>{document.cookie=`${encodeURIComponent(y)}=;expires=${new Date().toUTCString()}`,u()},set:(y,v,w={})=>{const g=r(v)?v:encodeURIComponent(JSON.stringify(v)),T=f.reduce((x,E)=>{const C=E.parse(w);return C===""?x:x.concat(C)},[`${encodeURIComponent(y)}=${g}`]).join(";");document.cookie=T,u()}},h=y=>{const v=new Set,w=g=>{y().removeItem(g);const T=s(y());v.forEach(x=>x(T))};return{delete:w,listener:g=>(v.add(g),()=>v.delete(g)),clearListeners:()=>v.clear(),json:(g=!1)=>g?s(y()):y(),has:g=>{const T=y().getItem(g);return!n(T)},deleteAll:()=>{t(y(),w),v.forEach(g=>g(y()))},get:g=>o(g,y()),set:(g,T)=>{y().setItem(g,JSON.stringify(T)),v.forEach(x=>x(y()))}}},p=h(()=>window.sessionStorage),m=h(()=>window.localStorage);e.Cookie=d,e.LocalStorage=m,e.SessionStorage=p,e.createStorage=h})(uf);const Zb=e=>e.headerLabel??e.thead??e.id,ff=e=>e.map(t=>({value:t.id,label:t.thead??t.headerLabel??t.id}));var Vo=(e=>(e.Boolean="boolean",e.Number="number",e.Select="select",e.Text="text",e))(Vo||{});const df=e=>e.type==="number"?e.valueAsNumber:e.value,ON=e=>{let t=[];return e({add:(o,s,i)=>t.push({...i,id:o,thead:s}),remove:o=>t=t.filter(s=>s.id!==o)}),t},kN={},_N=(e,t=kN)=>{const n=cf()?null:uf.LocalStorage.get(`@unamed/table-${e}`)||null,[r,o]=ef({name:e,groups:t.groups||(n==null?void 0:n.groups)||[],sorters:t.sorters||(n==null?void 0:n.sorters)||[],filters:t.filters||(n==null?void 0:n.filters)||[],cols:t.cols||(n==null?void 0:n.cols)||[]},s=>{const i=a=>{const l=s.state(),c={...l,...a};return cf()||uf.LocalStorage.set(`@unamed/table-${l.name}`,c),c};return{set:a=>i(a)}});return{...r,...o,name:e}},Nt={contains:{value:"contains",label:"Contains",symbol:"includes"},is:{value:"is",label:"Is",symbol:"is"},isNot:{value:"isNot",label:"Is not",symbol:"!=="},notContains:{value:"notContains",label:"Does not contains",symbol:"notIncludes"},lessThan:{value:"lessThan",label:"Less Than",symbol:"<="},greaterThan:{value:"greaterThan",label:"Greater than",symbol:">="},startsWith:{value:"startsWith",label:"Starts with",symbol:"startsWith"},endsWith:{value:"endsWith",label:"Ends with",symbol:"endsWith"}},hf={[Vo.Text]:[Nt.is,Nt.isNot,Nt.contains,Nt.notContains,Nt.startsWith,Nt.endsWith],[Vo.Boolean]:[Nt.is,Nt.isNot],[Vo.Number]:[Nt.is,Nt.isNot,Nt.greaterThan,Nt.lessThan]},pf=(e,t={})=>{var i;const n=e.id,r=e.type??Vo.Text,o=(i=hf[r])==null?void 0:i[0].value,s=Nt[o];return{id:ka(),operation:s,label:Zb(e),name:n,type:r,value:"",...t}},AN=e=>{const t=()=>{const i=e.cols.at(0);e.set(a=>[...a,pf(i)])},n=i=>{const a=i.target.dataset.id||"",l=i.target.value;e.set(c=>c.map(u=>{if(a!==u.id)return u;const f=e.cols.find(d=>l===d.id);return pf(f,{value:""})}))},r=i=>{const a=i.target.dataset.id||"",l=i.target.value;e.set(c=>c.map(u=>u.id===a?{...u,operation:Nt[l]}:u))},o=i=>{const a=i.currentTarget.dataset.id||"";e.set(l=>l.filter(c=>c.id!==a))},s=i=>{const a=i.target.dataset.id||"",l=df(i.target);e.set(c=>c.map(u=>u.id===a?{...u,value:l}:u))};return S.jsx(b.Fragment,{children:S.jsx(Mo,{arrow:!1,title:"Filters",trigger:S.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[S.jsx(Kd,{size:14}),"Filtros ",e.filters.length===0?"":` (${e.filters.length})`]}),children:S.jsxs("ul",{className:"mt-4 space-y-2",children:[e.filters.map(i=>{const a=hf[i.type];return S.jsxs("li",{className:"flex flex-nowrap gap-3",children:[S.jsx(xr,{title:"Filter",options:e.options,placeholder:"Name...",value:i.name,"data-id":i.id,onChange:n}),S.jsx(xr,{title:"Filter type","data-id":i.id,onChange:r,value:i.operation.value,options:a,placeholder:"Operator..."}),S.jsx(us,{"data-id":i.id,onChange:s,placeholder:"Search...",title:"Value",type:i.type,value:i.value}),S.jsx("div",{className:"flex items-center justify-center mt-5",children:S.jsx("button",{"data-id":i.id,type:"button",onClick:o,children:S.jsx(eo,{className:"text-danger",size:16})})})]},`filter-select-${i.id}`)}),S.jsx("li",{children:S.jsxs("button",{type:"button",onClick:t,className:"text-primary flex items-center gap-1",children:[S.jsx(Tl,{size:14})," New filter"]})})]})})})},IN=({filter:e,onDelete:t,set:n})=>{const r=s=>{const i=s.target.value,a=s.target.dataset.id||"";n(l=>l.map(c=>c.id===a?{...c,operation:Nt[i]}:c))},o=s=>{const i=s.target.dataset.id||"",a=df(s.target);n(l=>l.map(c=>c.id===i?{...c,value:a}:c))};return S.jsxs("div",{className:"flex flex-nowrap items-center gap-4 py-2",children:[S.jsx(xr,{onChange:r,options:hf[e.type],placeholder:"Operation...",title:"Filter type",value:e.operation.value}),S.jsx(us,{"data-id":e.id,onChange:o,placeholder:"Looking for...",title:"Value",type:e.type,value:e.value}),S.jsx("button",{onClick:t,"data-id":e.id,type:"button",className:"mt-4",children:S.jsx(eo,{className:"text-danger",size:14})})]})},DN=({item:e,onPointerDown:t})=>{const n=Io(0);return S.jsxs(Ca.Item,{onPointerDown:t,id:e.groupId,className:"flex flex-row items-center gap-2",value:e,style:{y:n},children:[S.jsx("button",{type:"button",className:"cursor-grab",children:S.jsx(mx,{size:14})}),S.jsx("span",{children:e.groupName})]},e.groupId)},MN=e=>{var a;const t=ff(e.cols),n=gM(),[r,o]=b.useState(((a=e.groups[0])==null?void 0:a.thead)||""),s=l=>{var m;const c=l.target,u=c.value,f=c.options.selectedIndex,d=((m=c.options.item(f))==null?void 0:m.label)||"";o(d);const h=new Ub(e.rows).GroupBy(u),p=e.cols.find(y=>y.id===u);e.setGroups(ET(h).map((y,v)=>{const w=h[y];return{...p,groupId:ka(),groupKey:u,index:v,rows:w,groupName:y}}))},i=()=>e.setGroups([]);return S.jsx(b.Fragment,{children:S.jsxs(Mo,{arrow:!1,title:"Groups",trigger:S.jsxs("span",{className:"flex items-center gap-1 proportional-nums",children:[S.jsx(gx,{size:14}),"Groups",e.groups.length>0?` - ${r}(${e.groups.length})`:""]}),children:[S.jsxs("div",{className:"flex flex-nowrap items-center",children:[S.jsx(xr,{value:r,title:"Tipo de agrupamento",onChange:s,options:t,placeholder:"Agrupar por..."}),S.jsx(ps,{className:"mt-4",onClick:i,theme:"raw","data-id":r,children:S.jsx(eo,{size:16,className:"text-danger"})})]}),e.groups.length>0?S.jsxs("section",{className:"my-4",children:[S.jsx("header",{children:S.jsx("h2",{className:"text-xl font-medium",children:"Order groups"})}),S.jsx(tM,{children:S.jsx(Ca.Group,{axis:"y",className:"relative space-y-2",drag:!0,dragControls:n,dragListener:!1,layoutScroll:!0,onReorder:e.setGroups,values:e.groups,children:e.groups.map(l=>S.jsx(DN,{item:l,onPointerDown:c=>{n.start(c),e.setGroups([...e.groups])}},l.groupId))})})]}):null]})})},NN=e=>(t,n)=>e.reduce((r,o)=>{const s=o.type==="desc"?-1:1,i=o.value,a=t[i]>n[i]?s:t[i]<n[i]?-s:0;return console.log({acc:r,p:a,a:t,b:n,property:i}),r!==0?r:a},0),FN=(e,t)=>e.sort(NN(t)),mf={asc:{label:"Ascending",value:"asc"},desc:{label:"Descending",value:"desc"}},LN=[mf.asc,mf.desc],gf=(e,t="asc")=>({id:ka(),type:t,value:e.id,label:mf.asc.label}),VN=e=>{const t=()=>{const s=e.cols[0];s&&e.set(i=>[...i,gf(s)])},n=s=>i=>{const a=i.target.value;e.set(l=>l.map(c=>c.id===s?{...c,value:a}:c))},r=s=>i=>{const a=i.target.value;e.set(l=>l.map(c=>c.id===s?{...c,type:a}:c))},o=s=>{const i=s.currentTarget.dataset.id||"";e.set(a=>a.filter(l=>l.id!==i))};return S.jsx(b.Fragment,{children:S.jsx(Mo,{arrow:!1,title:"Order By",trigger:S.jsxs("span",{className:"flex items-center gap-1 proportional-nums text-foreground-description",children:[S.jsx(Yd,{size:14}),"Order by ",e.sorters.length===0?"":` (${e.sorters.length})`]}),children:S.jsxs("ul",{className:"mt-4 space-y-2",children:[e.sorters.map(s=>S.jsxs("li",{className:"flex flex-nowrap gap-3",children:[S.jsx(xr,{onChange:n(s.id),options:e.options,title:"Field",placeholder:"Selecione um campo...",value:s.value}),S.jsx(xr,{title:"Sort type",onChange:r(s.id),value:s.type,options:LN,placeholder:"Operação..."}),S.jsx("button",{className:"mt-4","data-id":s.id,onClick:o,children:S.jsx(eo,{className:"text-danger",size:14})})]},`sorter-select-${s.id}`)),S.jsx("li",{children:S.jsxs("button",{type:"button",onClick:t,className:"text-primary flex items-center gap-1",children:[S.jsx(Tl,{size:14})," Add sort"]})})]})})})},$N=e=>{const t=e.sorters.find(s=>s.id===e.col.id),[n,r]=b.useState(t?t.type:"undefined"),o=()=>r(s=>s==="undefined"?"asc":s==="asc"?"desc":"undefined");return b.useEffect(()=>{e.setSorters(s=>{if(n==="undefined")return s.filter(a=>a.value!==e.col.id);const i=s.findIndex(a=>a.value===e.col.id);return i===-1?[...s,gf(e.col,n)]:(s[i]=gf(e.col,n),[...s])})},[n,e.col]),S.jsxs("button",{className:"isolate flex items-center",onClick:o,type:"button",children:[n==="asc"?S.jsx(Sl,{size:14}):null,n==="desc"?S.jsx(fx,{size:14}):null,n==="undefined"?S.jsx(Yd,{size:14}):null]})},RN=e=>S.jsx("header",{className:"min-w-full mb-1",children:S.jsxs("div",{className:"flex flex-wrap min-w-full items-center justify-between gap-x-4 gap-y-1",children:[S.jsxs("div",{className:"flex w-fit items-centeend gap-4 whitespace-nowrap py-2",children:[S.jsx("span",{children:S.jsx(AN,{cols:e.cols,options:e.options,filters:e.filters,set:e.setFilters})}),S.jsx("span",{children:S.jsx(VN,{options:e.options,cols:e.cols,sorters:e.sorters,set:e.setSorters})}),S.jsx("span",{children:S.jsx(MN,{rows:e.rows,groups:e.groups,setGroups:e.setGroups,options:e.options,cols:e.cols})})]}),S.jsx("ul",{className:"flex flex-wrap w-full flex-1 flex-grow flex-row items-center md:justify-end gap-4",children:e.filters.map(t=>S.jsxs("li",{className:"flex gap-1 items-center rounded-xl border border-card-border px-4 py-0.5",children:[S.jsxs("span",{children:[S.jsx("span",{className:"size-3 mr-2 aspect-square bg-primary inline-block rounded-full","aria-hidden":"true"}),t.label," ",t.operation.label.toLowerCase(),":"]}),S.jsxs("div",{className:"relative w-min min-w-[1ch]",children:[S.jsx("span",{"aria-hidden":"true",className:"invisible whitespace-pre p-0",children:t.value||" "}),S.jsx("input",{type:t.type,value:t.value,className:"absolute left-0 top-0 m-0 inline-block w-full bg-transparent p-0 placeholder-primary/70 outline-none [appearance:textfield] after:empty:text-primary/70 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",onChange:n=>{const r=df(n.target);e.setFilters(o=>o.map(s=>t.id===s.id?{...s,value:r}:s))}})]})]},`filter-table-${t.id}`))})]})}),jN={opacity:1},BN={opacity:.75,backgroundColor:"var(--table-border)"},zN={opacity:0,transition:{duration:.4,type:"spring"}},WN=e=>{var r;const t=e.filters.filter(o=>o.name===e.header.id),n=o=>{const s=o.currentTarget.dataset.id||"";return e.setFilters(i=>i.filter(a=>a.id!==s))};return S.jsx(Ca.Item,{...e.header.thProps,as:"th",exit:zN,initial:!1,dragSnapToOrigin:!0,dragDirectionLock:!0,value:e.header,whileDrag:BN,animate:jN,className:`hidden font-medium text-secondary px-2 py-4 first:table-cell md:table-cell ${((r=e.header.thProps)==null?void 0:r.className)??""}`,children:S.jsx("span",{className:"flex items-center justify-between",children:S.jsxs("span",{className:"flex items-center gap-1",children:[S.jsx(Mo,{title:`Filter by ${Zb(e.header)}`,arrow:!0,trigger:S.jsx(Kd,{size:14}),children:t.length===0===null?null:S.jsxs("ul",{className:"font-medium",children:[t.map(o=>S.jsx("li",{className:"my-1",children:S.jsx(IN,{onDelete:n,filter:o,set:e.setFilters})},`thead-filter-${o.id}`)),S.jsx("li",{children:S.jsxs("button",{onClick:()=>e.setFilters(o=>o.concat(pf(e.header))),className:"flex items-center",children:[S.jsx(Tl,{size:14})," Add"]})})]})}),S.jsx("span",{className:"pointer-events-auto text-balance text-base",children:e.header.thead}),S.jsx($N,{col:e.header,setSorters:e.setSorters,sorters:e.sorters})]})})})},HN=e=>S.jsx(Ca.Group,{as:"tr",axis:"x",drag:!0,layout:!0,layoutRoot:!0,layoutScroll:!0,initial:!1,values:e.headers,onReorder:e.setCols,className:"bg-table-background border-none text-lg",children:S.jsx(Ea,{children:e.headers.map(t=>S.jsx(WN,{setFilters:e.setFilters,filters:e.filters,setSorters:e.setSorters,sorters:e.sorters,header:t},`header-child-item-${t.id}`))})});function UN(e,t){if(!e||!t)return[];const n=[1];if(e===1&&t===1)return n;e>4&&n.push("-");let r=2,o=e-r,s=e+r;for(let a=o>2?o:2;a<=Math.min(t,s);a++)n.push(a);const i=t-2;return s+1!==i&&s+1<t&&n.push("_"),s<t&&(n.push(t-2),n.push(t-1),n.push(t)),Array.from(new Set(n))}const GN=b.forwardRef((e,t)=>S.jsx("tbody",{...e,className:`divide-y divide-table-border ${e.className??""}`,ref:t,children:S.jsx(Ea,{children:e.children})})),YN=b.forwardRef((e,t)=>S.jsx("table",{...e,ref:t,className:`table min-w-full divide-y divide-table-border table-auto text-left ${e.className??""}`})),qN=b.forwardRef((e,t)=>S.jsx("thead",{...e,className:"bg-card-background shadow-xs group:sticky top-0",ref:t})),KN=b.forwardRef((e,t)=>S.jsx("tr",{...e,ref:t,className:`table-row ${e.className??""}`})),ZN=b.forwardRef((e,t)=>e.context.loadingMore?S.jsx("tfoot",{...e,ref:t,className:"bg-card-background",children:S.jsx("tr",{className:"bg-card-background",children:S.jsx("td",{colSpan:999,className:"px-2 h-14 bg-card-background",children:S.jsx("span",{className:"block w-full h-2 bg-foreground rounded opacity-60 animate-pulse"})})})}):null),XN={TableHead:qN,Table:YN,TableBody:GN,TableRow:KN,TableFoot:ZN},QN=[0,0,0,0,0,0,0,0,0,0],JN=(e,t,n)=>{const r=n.cols,o=n.loading;return S.jsx(b.Fragment,{children:r.map((s,i)=>{const a=`${i},${e}`,l=Kb(t,s.id),c=s.Element;return b.createElement("td",{...s.cellProps,"data-matrix":a,key:`accessor-${e}-${i}`,className:"px-2 h-14 border-none first:table-cell hidden md:table-cell"},o?S.jsx("div",{className:"animate-pulse h-2 bg-table-border rounded"}):c?S.jsx(c,{row:t,matrix:a,col:s,rowIndex:e,value:l}):S.jsx(b.Fragment,{children:kn.nil(l)?"":l}))})})},eF=()=>S.jsx(b.Fragment,{}),tF=e=>{const t=e.asLink||"button",n=b.useMemo(()=>UN(e.current,e.pages),[e.current,e.pages]),r=e.current<e.pages;return S.jsxs("footer",{className:"flex px-1 py-2 items-center justify-between flex-nowrap",children:[S.jsxs("p",{children:[e.current," to ",e.pages," of ",e.totalItems," items.",e.onChangeSize&&Array.isArray(e.sizes)?S.jsxs(b.Fragment,{children:[S.jsx("select",{value:e.size,className:"cursor-pointer",onChange:o=>{var s;(s=e.onChangeSize)==null||s.call(e,Number(o.target.value))},children:e.sizes.map(o=>S.jsx("option",{value:o,children:o}))})," per page"]}):null]}),S.jsx("nav",{children:S.jsxs("ul",{className:"flex items-center gap-2",children:[e.current>1?S.jsx("li",{children:S.jsx(t,{href:"previous",className:"",children:"Previous"})}):null,n.map(o=>o===null?null:S.jsx(b.Fragment,{children:typeof o=="string"?S.jsx("li",{children:"..."}):S.jsx("li",{children:S.jsx(t,{href:o,className:`cursor-pointer px-3 py-1 transition-colors border-b-2 hover:text-primary-subtle hover:border-primary-subtle proportional-nums ${o===e.current?"text-primary border-primary":"border-transparent"}`,children:o})},`pagination-${o}`)})),r?S.jsx("li",{children:S.jsx(t,{href:"next",className:"",children:"Next"})}):null]})})]})},Xb=({filters:e,pagination:t=null,onScrollEnd:n,useControl:r=!1,setCols:o,setFilters:s,sorters:i,cols:a,setSorters:l,...c})=>{const u=b.useRef(null),[f,d]=b.useState(!1),h=Gb(n),p=Gb(c.loadingMore),m=b.useMemo(()=>{if(c.loading)return QN;if(r)return c.rows;const y=new Ub(c.rows);return e.length>0&&e.forEach(v=>v.value===""||Number.isNaN(v.value)?void 0:y.Where(v.name,v.operation.symbol,v.value)),i.length===0?y.Select():FN(y.Select(),i)},[c.rows,e,i,c.loading]);return b.useEffect(()=>{if(u.current===null)return()=>{};const y=u.current,v=new IntersectionObserver(w=>{var x;return w.forEach(E=>console.log(E.isIntersecting,E.target)),w[w.length-1].isIntersecting&&p.current?((x=h.current)==null||x.call(h),void d(!0)):d(!1)});return v.observe(y),()=>v.disconnect()},[]),S.jsxs("div",{className:"min-w-full",children:[S.jsxs("div",{className:"group border border-table-border rounded-lg px-1",children:[S.jsx(SP,{data:m,useWindowScroll:!0,components:XN,totalCount:m.length,itemContent:JN,context:{loading:c.loading,loadingMore:c.loadingMore,cols:a},fixedFooterContent:f?eF:null,fixedHeaderContent:()=>S.jsx(HN,{sorters:i,setSorters:l,filters:e,setFilters:s,headers:a,setCols:o})}),S.jsx("div",{"aria-hidden":"true",ref:u,className:"h-0.5 w-full"})]}),t!==null?S.jsx(tF,{...t}):null]})},nF=(e,t)=>typeof t=="function"?t(e):t,rF=e=>{const t=e.operations??!0,n=b.useMemo(()=>ff(e.cols),[e.cols]),[r,o]=ef({cols:e.cols,filters:e.filters??[],groups:e.groups??[],sorters:e.sorters??[]},s=>{const i=a=>l=>{const c=s.state();return{...c,[a]:nF(c[a],l)}};return{cols:i("cols"),filters:i("filters"),groups:i("groups"),sorters:i("sorters")}},{postMiddleware:[s=>{var i;return(i=e.set)==null||i.call(e,s),s}]});return S.jsxs("div",{className:"relative min-w-full",children:[t?S.jsx(RN,{setCols:o.cols,rows:e.rows,cols:r.cols,filters:r.filters,groups:r.groups,options:n,setFilters:o.filters,setGroups:o.groups,setSorters:o.sorters,sorters:r.sorters,pagination:e.pagination??null}):null,r.groups.length===0?S.jsx(Xb,{...e,onScrollEnd:e.onScrollEnd,cols:r.cols,filters:r.filters,groups:r.groups,index:0,optionCols:n,options:n,setCols:o.cols,setFilters:o.filters,setGroups:o.groups,setSorters:o.sorters,sorters:r.sorters,pagination:e.pagination??null}):S.jsx("div",{className:"flex flex-wrap gap-4",children:r.groups.map((s,i)=>S.jsx(Jt.div,{className:"min-w-full",children:S.jsx(Xb,{...e,pagination:null,onScrollEnd:e.onScrollEnd,cols:r.cols,filters:r.filters,group:s,groups:r.groups,index:i,optionCols:n,options:n,rows:s.rows,setCols:o.cols,setFilters:o.filters,setGroups:o.groups,setSorters:o.sorters,sorters:r.sorters})},`group-${s.groupId}`))})]})};var oF=String.prototype.replace,sF=/%20/g,yf={RFC1738:"RFC1738",RFC3986:"RFC3986"},vf={default:yf.RFC3986,formatters:{RFC1738:function(e){return oF.call(e,sF,"+")},RFC3986:function(e){return String(e)}},RFC1738:yf.RFC1738,RFC3986:yf.RFC3986},iF=vf,bf=Object.prototype.hasOwnProperty,Fr=Array.isArray,Tn=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),aF=function(t){for(;t.length>1;){var n=t.pop(),r=n.obj[n.prop];if(Fr(r)){for(var o=[],s=0;s<r.length;++s)typeof r[s]<"u"&&o.push(r[s]);n.obj[n.prop]=o}}},Qb=function(t,n){for(var r=n&&n.plainObjects?Object.create(null):{},o=0;o<t.length;++o)typeof t[o]<"u"&&(r[o]=t[o]);return r},lF=function e(t,n,r){if(!n)return t;if(typeof n!="object"){if(Fr(t))t.push(n);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!bf.call(Object.prototype,n))&&(t[n]=!0);else return[t,n];return t}if(!t||typeof t!="object")return[t].concat(n);var o=t;return Fr(t)&&!Fr(n)&&(o=Qb(t,r)),Fr(t)&&Fr(n)?(n.forEach(function(s,i){if(bf.call(t,i)){var a=t[i];a&&typeof a=="object"&&s&&typeof s=="object"?t[i]=e(a,s,r):t.push(s)}else t[i]=s}),t):Object.keys(n).reduce(function(s,i){var a=n[i];return bf.call(s,i)?s[i]=e(s[i],a,r):s[i]=a,s},o)},cF=function(t,n){return Object.keys(n).reduce(function(r,o){return r[o]=n[o],r},t)},uF=function(e,t,n){var r=e.replace(/\+/g," ");if(n==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},wf=1024,fF=function(t,n,r,o,s){if(t.length===0)return t;var i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});for(var a="",l=0;l<i.length;l+=wf){for(var c=i.length>=wf?i.slice(l,l+wf):i,u=[],f=0;f<c.length;++f){var d=c.charCodeAt(f);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||s===iF.RFC1738&&(d===40||d===41)){u[u.length]=c.charAt(f);continue}if(d<128){u[u.length]=Tn[d];continue}if(d<2048){u[u.length]=Tn[192|d>>6]+Tn[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=Tn[224|d>>12]+Tn[128|d>>6&63]+Tn[128|d&63];continue}f+=1,d=65536+((d&1023)<<10|c.charCodeAt(f)&1023),u[u.length]=Tn[240|d>>18]+Tn[128|d>>12&63]+Tn[128|d>>6&63]+Tn[128|d&63]}a+=u.join("")}return a},dF=function(t){for(var n=[{obj:{o:t},prop:"o"}],r=[],o=0;o<n.length;++o)for(var s=n[o],i=s.obj[s.prop],a=Object.keys(i),l=0;l<a.length;++l){var c=a[l],u=i[c];typeof u=="object"&&u!==null&&r.indexOf(u)===-1&&(n.push({obj:i,prop:c}),r.push(u))}return aF(n),t},hF=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},pF=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},mF=function(t,n){return[].concat(t,n)},gF=function(t,n){if(Fr(t)){for(var r=[],o=0;o<t.length;o+=1)r.push(n(t[o]));return r}return n(t)},Jb={arrayToObject:Qb,assign:cF,combine:mF,compact:dF,decode:uF,encode:fF,isBuffer:pF,isRegExp:hF,maybeMap:gF,merge:lF},e0=rT,_a=Jb,Hs=vf,yF=Object.prototype.hasOwnProperty,t0={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,n){return t+"["+n+"]"},repeat:function(t){return t}},En=Array.isArray,vF=Array.prototype.push,n0=function(e,t){vF.apply(e,En(t)?t:[t])},bF=Date.prototype.toISOString,r0=Hs.default,ht={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_a.encode,encodeValuesOnly:!1,format:r0,formatter:Hs.formatters[r0],indices:!1,serializeDate:function(t){return bF.call(t)},skipNulls:!1,strictNullHandling:!1},wF=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},xf={},xF=function e(t,n,r,o,s,i,a,l,c,u,f,d,h,p,m,y,v,w){for(var g=t,T=w,x=0,E=!1;(T=T.get(xf))!==void 0&&!E;){var C=T.get(t);if(x+=1,typeof C<"u"){if(C===x)throw new RangeError("Cyclic object value");E=!0}typeof T.get(xf)>"u"&&(x=0)}if(typeof u=="function"?g=u(n,g):g instanceof Date?g=h(g):r==="comma"&&En(g)&&(g=_a.maybeMap(g,function(P){return P instanceof Date?h(P):P})),g===null){if(i)return c&&!y?c(n,ht.encoder,v,"key",p):n;g=""}if(wF(g)||_a.isBuffer(g)){if(c){var O=y?n:c(n,ht.encoder,v,"key",p);return[m(O)+"="+m(c(g,ht.encoder,v,"value",p))]}return[m(n)+"="+m(String(g))]}var I=[];if(typeof g>"u")return I;var N;if(r==="comma"&&En(g))y&&c&&(g=_a.maybeMap(g,c)),N=[{value:g.length>0?g.join(",")||null:void 0}];else if(En(u))N=u;else{var L=Object.keys(g);N=f?L.sort(f):L}var _=l?n.replace(/\./g,"%2E"):n,j=o&&En(g)&&g.length===1?_+"[]":_;if(s&&En(g)&&g.length===0)return j+"[]";for(var D=0;D<N.length;++D){var k=N[D],F=typeof k=="object"&&typeof k.value<"u"?k.value:g[k];if(!(a&&F===null)){var $=d&&l?k.replace(/\./g,"%2E"):k,z=En(g)?typeof r=="function"?r(j,$):j:j+(d?"."+$:"["+$+"]");w.set(t,x);var q=e0();q.set(xf,w),n0(I,e(F,z,r,o,s,i,a,l,r==="comma"&&y&&En(g)?null:c,u,f,d,h,p,m,y,v,q))}}return I},SF=function(t){if(!t)return ht;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var n=t.charset||ht.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=Hs.default;if(typeof t.format<"u"){if(!yF.call(Hs.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var o=Hs.formatters[r],s=ht.filter;(typeof t.filter=="function"||En(t.filter))&&(s=t.filter);var i;if(t.arrayFormat in t0?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=ht.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:ht.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ht.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ht.allowEmptyArrays,arrayFormat:i,charset:n,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ht.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ht.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ht.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ht.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ht.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ht.encodeValuesOnly,filter:s,format:r,formatter:o,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ht.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ht.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ht.strictNullHandling}},TF=function(e,t){var n=e,r=SF(t),o,s;typeof r.filter=="function"?(s=r.filter,n=s("",n)):En(r.filter)&&(s=r.filter,o=s);var i=[];if(typeof n!="object"||n===null)return"";var a=t0[r.arrayFormat],l=a==="comma"&&r.commaRoundTrip;o||(o=Object.keys(n)),r.sort&&o.sort(r.sort);for(var c=e0(),u=0;u<o.length;++u){var f=o[u];r.skipNulls&&n[f]===null||n0(i,xF(n[f],f,a,l,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,c))}var d=i.join(r.delimiter),h=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B&":h+="utf8=%E2%9C%93&"),d.length>0?h+d:""},$o=Jb,Sf=Object.prototype.hasOwnProperty,EF=Array.isArray,ct={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:$o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},CF=function(e){return e.replace(/&#(\d+);/g,function(t,n){return String.fromCharCode(parseInt(n,10))})},o0=function(e,t){return e&&typeof e=="string"&&t.comma&&e.indexOf(",")>-1?e.split(","):e},PF="utf8=%26%2310003%3B",OF="utf8=%E2%9C%93",kF=function(t,n){var r={__proto__:null},o=n.ignoreQueryPrefix?t.replace(/^\?/,""):t;o=o.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var s=n.parameterLimit===1/0?void 0:n.parameterLimit,i=o.split(n.delimiter,s),a=-1,l,c=n.charset;if(n.charsetSentinel)for(l=0;l<i.length;++l)i[l].indexOf("utf8=")===0&&(i[l]===OF?c="utf-8":i[l]===PF&&(c="iso-8859-1"),a=l,l=i.length);for(l=0;l<i.length;++l)if(l!==a){var u=i[l],f=u.indexOf("]="),d=f===-1?u.indexOf("="):f+1,h,p;d===-1?(h=n.decoder(u,ct.decoder,c,"key"),p=n.strictNullHandling?null:""):(h=n.decoder(u.slice(0,d),ct.decoder,c,"key"),p=$o.maybeMap(o0(u.slice(d+1),n),function(y){return n.decoder(y,ct.decoder,c,"value")})),p&&n.interpretNumericEntities&&c==="iso-8859-1"&&(p=CF(p)),u.indexOf("[]=")>-1&&(p=EF(p)?[p]:p);var m=Sf.call(r,h);m&&n.duplicates==="combine"?r[h]=$o.combine(r[h],p):(!m||n.duplicates==="last")&&(r[h]=p)}return r},_F=function(e,t,n,r){for(var o=r?t:o0(t,n),s=e.length-1;s>=0;--s){var i,a=e[s];if(a==="[]"&&n.parseArrays)i=n.allowEmptyArrays&&(o===""||n.strictNullHandling&&o===null)?[]:[].concat(o);else{i=n.plainObjects?Object.create(null):{};var l=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,c=n.decodeDotInKeys?l.replace(/%2E/g,"."):l,u=parseInt(c,10);!n.parseArrays&&c===""?i={0:o}:!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(i=[],i[u]=o):c!=="__proto__"&&(i[c]=o)}o=i}return o},AF=function(t,n,r,o){if(t){var s=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,l=r.depth>0&&i.exec(s),c=l?s.slice(0,l.index):s,u=[];if(c){if(!r.plainObjects&&Sf.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;r.depth>0&&(l=a.exec(s))!==null&&f<r.depth;){if(f+=1,!r.plainObjects&&Sf.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+s.slice(l.index)+"]"),_F(u,n,r,o)}},IF=function(t){if(!t)return ct;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=typeof t.charset>"u"?ct.charset:t.charset,r=typeof t.duplicates>"u"?ct.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var o=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:ct.allowDots:!!t.allowDots;return{allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ct.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:ct.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:ct.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:ct.arrayLimit,charset:n,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ct.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:ct.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:ct.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:ct.decoder,delimiter:typeof t.delimiter=="string"||$o.isRegExp(t.delimiter)?t.delimiter:ct.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:ct.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:ct.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:ct.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:ct.plainObjects,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ct.strictNullHandling}},DF=function(e,t){var n=IF(t);if(e===""||e===null||typeof e>"u")return n.plainObjects?Object.create(null):{};for(var r=typeof e=="string"?kF(e,n):e,o=n.plainObjects?Object.create(null):{},s=Object.keys(r),i=0;i<s.length;++i){var a=s[i],l=AF(a,r[a],n,typeof e=="string");o=$o.merge(o,l,n)}return n.allowSparse===!0?o:$o.compact(o)},MF=TF,NF=DF,FF=vf,LF={formats:FF,parse:NF,stringify:MF},Pe;(function(e){e.assertEqual=o=>o;function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Pe||(Pe={}));var s0;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(s0||(s0={}));const te=Pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lr=e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}},G=Pe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class en extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof en))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}en.create=e=>new en(e);const Us=(e,t)=>{let n;switch(e.code){case G.invalid_type:e.received===te.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Pe.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pe.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pe.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Pe.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Pe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case G.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case G.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,Pe.assertNever(e)}return{message:n}};let VF=Us;function Tf(){return VF}const Ef=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function J(e,t){const n=Tf(),r=Ef({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Us?void 0:Us].filter(o=>!!o)});e.common.issues.push(r)}class Ft{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return me;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return Ft.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return me;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const me=Object.freeze({status:"aborted"}),Gs=e=>({status:"dirty",value:e}),zt=e=>({status:"valid",value:e}),i0=e=>e.status==="aborted",a0=e=>e.status==="dirty",Aa=e=>e.status==="valid",Ia=e=>typeof Promise<"u"&&e instanceof Promise;function Da(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function l0(e,t,n,r,o){if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}typeof SuppressedError=="function"&&SuppressedError;var ae;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ae||(ae={}));var Ys,qs;class Cn{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const c0=(e,t)=>{if(Aa(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new en(e.common.issues);return this._error=n,this._error}}};function ye(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{var l,c;const{message:u}=e;return i.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:a.defaultError}},description:o}}class xe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Lr(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ft,ctx:{common:t.parent.common,data:t.data,parsedType:Lr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ia(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const o={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lr(t)},s=this._parseSync({data:t,path:o.path,parent:o});return c0(o,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lr(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(Ia(o)?o:Promise.resolve(o));return c0(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:G.custom,...r(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new $n({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Rn.create(this,this._def)}nullable(){return Rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ln.create(this,this._def)}promise(){return Xs.create(this,this._def)}or(t){return Fa.create([this,t],this._def)}and(t){return La.create(this,t,this._def)}transform(t){return new $n({...ye(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new Ba({...ye(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new h0({typeName:he.ZodBranded,type:this,...ye(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new za({...ye(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Wa.create(this,t)}readonly(){return Ha.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $F=/^c[^\s-]{8,}$/i,RF=/^[0-9a-z]+$/,jF=/^[0-9A-HJKMNP-TV-Z]{26}$/,BF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zF=/^[a-z0-9_-]{21}$/i,WF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,HF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Cf;const GF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,YF=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,qF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,u0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",KF=new RegExp(`^${u0}$`);function f0(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function ZF(e){return new RegExp(`^${f0(e)}$`)}function XF(e){let t=`${u0}T${f0(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function QF(e,t){return!!((t==="v4"||!t)&&GF.test(e)||(t==="v6"||!t)&&YF.test(e))}class Fn extends xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.string,received:s.parsedType}),me}const r=new Ft;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?J(o,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&J(o,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")HF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"email",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Cf||(Cf=new RegExp(UF,"u")),Cf.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"emoji",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")BF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"uuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")zF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"nanoid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")$F.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")RF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"cuid2",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")jF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ulid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),J(o,{validation:"url",code:G.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"regex",code:G.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?XF(s).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?KF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?ZF(s).test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{code:G.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?WF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"duration",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?QF(t.data,s.version)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"ip",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?qF.test(t.data)||(o=this._getOrReturnCtx(t,o),J(o,{validation:"base64",code:G.invalid_string,message:s.message}),r.dirty()):Pe.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:G.invalid_string,...ae.errToObj(r)})}_addCheck(t){return new Fn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ae.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ae.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ae.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ae.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ae.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ae.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ae.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ae.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ae.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ae.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...ae.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...ae.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...ae.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ae.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ae.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ae.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ae.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ae.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ae.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ae.errToObj(n)})}nonempty(t){return this.min(1,ae.errToObj(t))}trim(){return new Fn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Fn.create=e=>{var t;return new Fn({checks:[],typeName:he.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ye(e)})};function JF(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=parseInt(e.toFixed(o).replace(".","")),i=parseInt(t.toFixed(o).replace(".",""));return s%i/Math.pow(10,o)}class Vr extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.number,received:s.parsedType}),me}let r;const o=new Ft;for(const s of this._def.checks)s.kind==="int"?Pe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),J(r,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?JF(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),J(r,{code:G.not_finite,message:s.message}),o.dirty()):Pe.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ae.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ae.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ae.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ae.toString(n))}setLimit(t,n,r,o){return new Vr({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ae.toString(o)}]})}_addCheck(t){return new Vr({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ae.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ae.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Pe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Vr.create=e=>new Vr({checks:[],typeName:he.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...ye(e)});class Ro extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==te.bigint){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.bigint,received:s.parsedType}),me}let r;const o=new Ft;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),J(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):Pe.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ae.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ae.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ae.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ae.toString(n))}setLimit(t,n,r,o){return new Ro({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ae.toString(o)}]})}_addCheck(t){return new Ro({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ae.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ro.create=e=>{var t;return new Ro({checks:[],typeName:he.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...ye(e)})};class Pf extends xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.boolean,received:r.parsedType}),me}return zt(t.data)}}Pf.create=e=>new Pf({typeName:he.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...ye(e)});class Ks extends xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_type,expected:te.date,received:s.parsedType}),me}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return J(s,{code:G.invalid_date}),me}const r=new Ft;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),J(o,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Pe.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ks({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ae.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ae.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Ks.create=e=>new Ks({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:he.ZodDate,...ye(e)});class Of extends xe{_parse(t){if(this._getType(t)!==te.symbol){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.symbol,received:r.parsedType}),me}return zt(t.data)}}Of.create=e=>new Of({typeName:he.ZodSymbol,...ye(e)});class Ma extends xe{_parse(t){if(this._getType(t)!==te.undefined){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.undefined,received:r.parsedType}),me}return zt(t.data)}}Ma.create=e=>new Ma({typeName:he.ZodUndefined,...ye(e)});class Na extends xe{_parse(t){if(this._getType(t)!==te.null){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.null,received:r.parsedType}),me}return zt(t.data)}}Na.create=e=>new Na({typeName:he.ZodNull,...ye(e)});class kf extends xe{constructor(){super(...arguments),this._any=!0}_parse(t){return zt(t.data)}}kf.create=e=>new kf({typeName:he.ZodAny,...ye(e)});class jo extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return zt(t.data)}}jo.create=e=>new jo({typeName:he.ZodUnknown,...ye(e)});class hr extends xe{_parse(t){const n=this._getOrReturnCtx(t);return J(n,{code:G.invalid_type,expected:te.never,received:n.parsedType}),me}}hr.create=e=>new hr({typeName:he.ZodNever,...ye(e)});class _f extends xe{_parse(t){if(this._getType(t)!==te.undefined){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.void,received:r.parsedType}),me}return zt(t.data)}}_f.create=e=>new _f({typeName:he.ZodVoid,...ye(e)});class ln extends xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==te.array)return J(n,{code:G.invalid_type,expected:te.array,received:n.parsedType}),me;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(J(n,{code:i?G.too_big:G.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(J(n,{code:G.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(J(n,{code:G.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Cn(n,i,n.path,a)))).then(i=>Ft.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new Cn(n,i,n.path,a)));return Ft.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ln({...this._def,minLength:{value:t,message:ae.toString(n)}})}max(t,n){return new ln({...this._def,maxLength:{value:t,message:ae.toString(n)}})}length(t,n){return new ln({...this._def,exactLength:{value:t,message:ae.toString(n)}})}nonempty(t){return this.min(1,t)}}ln.create=(e,t)=>new ln({type:e,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...ye(t)});function Bo(e){if(e instanceof nt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Rn.create(Bo(r))}return new nt({...e._def,shape:()=>t})}else return e instanceof ln?new ln({...e._def,type:Bo(e.element)}):e instanceof Rn?Rn.create(Bo(e.unwrap())):e instanceof Rr?Rr.create(Bo(e.unwrap())):e instanceof Vn?Vn.create(e.items.map(t=>Bo(t))):e}class nt extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Pe.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==te.object){const c=this._getOrReturnCtx(t);return J(c,{code:G.invalid_type,expected:te.object,received:c.parsedType}),me}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof hr&&this._def.unknownKeys==="strip"))for(const c in o.data)i.includes(c)||a.push(c);const l=[];for(const c of i){const u=s[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Cn(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof hr){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict")a.length>0&&(J(o,{code:G.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const f=o.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Cn(o,f,o.path,u)),alwaysSet:u in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,d=await u.value;c.push({key:f,value:d,alwaysSet:u.alwaysSet})}return c}).then(c=>Ft.mergeObjectSync(r,c)):Ft.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ae.errToObj,new nt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,s,i,a;const l=(i=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=ae.errToObj(t).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new nt({...this._def,unknownKeys:"strip"})}passthrough(){return new nt({...this._def,unknownKeys:"passthrough"})}extend(t){return new nt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new nt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:he.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new nt({...this._def,catchall:t})}pick(t){const n={};return Pe.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new nt({...this._def,shape:()=>n})}omit(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new nt({...this._def,shape:()=>n})}deepPartial(){return Bo(this)}partial(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}),new nt({...this._def,shape:()=>n})}required(t){const n={};return Pe.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Rn;)s=s._def.innerType;n[r]=s}}),new nt({...this._def,shape:()=>n})}keyof(){return d0(Pe.objectKeys(this.shape))}}nt.create=(e,t)=>new nt({shape:()=>e,unknownKeys:"strip",catchall:hr.create(),typeName:he.ZodObject,...ye(t)}),nt.strictCreate=(e,t)=>new nt({shape:()=>e,unknownKeys:"strict",catchall:hr.create(),typeName:he.ZodObject,...ye(t)}),nt.lazycreate=(e,t)=>new nt({shape:e,unknownKeys:"strip",catchall:hr.create(),typeName:he.ZodObject,...ye(t)});class Fa extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new en(a.ctx.common.issues));return J(n,{code:G.invalid_union,unionErrors:i}),me}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(l=>new en(l));return J(n,{code:G.invalid_union,unionErrors:a}),me}}get options(){return this._def.options}}Fa.create=(e,t)=>new Fa({options:e,typeName:he.ZodUnion,...ye(t)});const Ln=e=>e instanceof $a?Ln(e.schema):e instanceof $n?Ln(e.innerType()):e instanceof Ra?[e.value]:e instanceof $r?e.options:e instanceof ja?Pe.objectValues(e.enum):e instanceof Ba?Ln(e._def.innerType):e instanceof Ma?[void 0]:e instanceof Na?[null]:e instanceof Rn?[void 0,...Ln(e.unwrap())]:e instanceof Rr?[null,...Ln(e.unwrap())]:e instanceof h0||e instanceof Ha?Ln(e.unwrap()):e instanceof za?Ln(e._def.innerType):[];class Af extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return J(n,{code:G.invalid_type,expected:te.object,received:n.parsedType}),me;const r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(J(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),me)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const o=new Map;for(const s of n){const i=Ln(s.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of i){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,s)}}return new Af({typeName:he.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:o,...ye(r)})}}function If(e,t){const n=Lr(e),r=Lr(t);if(e===t)return{valid:!0,data:e};if(n===te.object&&r===te.object){const o=Pe.objectKeys(t),s=Pe.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=If(e[a],t[a]);if(!l.valid)return{valid:!1};i[a]=l.data}return{valid:!0,data:i}}else if(n===te.array&&r===te.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],l=If(i,a);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===te.date&&r===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class La extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(i0(s)||i0(i))return me;const a=If(s.value,i.value);return a.valid?((a0(s)||a0(i))&&n.dirty(),{status:n.value,value:a.data}):(J(r,{code:G.invalid_intersection_types}),me)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}La.create=(e,t,n)=>new La({left:e,right:t,typeName:he.ZodIntersection,...ye(n)});class Vn extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.array)return J(r,{code:G.invalid_type,expected:te.array,received:r.parsedType}),me;if(r.data.length<this._def.items.length)return J(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),me;!this._def.rest&&r.data.length>this._def.items.length&&(J(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Cn(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Ft.mergeArray(n,i)):Ft.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Vn({...this._def,rest:t})}}Vn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vn({items:e,typeName:he.ZodTuple,rest:null,...ye(t)})};class Va extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.object)return J(r,{code:G.invalid_type,expected:te.object,received:r.parsedType}),me;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new Cn(r,a,r.path,a)),value:i._parse(new Cn(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Ft.mergeObjectAsync(n,o):Ft.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof xe?new Va({keyType:t,valueType:n,typeName:he.ZodRecord,...ye(r)}):new Va({keyType:Fn.create(),valueType:t,typeName:he.ZodRecord,...ye(n)})}}class Df extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.map)return J(r,{code:G.invalid_type,expected:te.map,received:r.parsedType}),me;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,l],c)=>({key:o._parse(new Cn(r,a,r.path,[c,"key"])),value:s._parse(new Cn(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return me;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return me;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Df.create=(e,t,n)=>new Df({valueType:t,keyType:e,typeName:he.ZodMap,...ye(n)});class zo extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==te.set)return J(r,{code:G.invalid_type,expected:te.set,received:r.parsedType}),me;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(J(r,{code:G.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(J(r,{code:G.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return me;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new Cn(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>i(l)):i(a)}min(t,n){return new zo({...this._def,minSize:{value:t,message:ae.toString(n)}})}max(t,n){return new zo({...this._def,maxSize:{value:t,message:ae.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}zo.create=(e,t)=>new zo({valueType:e,minSize:null,maxSize:null,typeName:he.ZodSet,...ye(t)});class Zs extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.function)return J(n,{code:G.invalid_type,expected:te.function,received:n.parsedType}),me;function r(a,l){return Ef({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Tf(),Us].filter(c=>!!c),issueData:{code:G.invalid_arguments,argumentsError:l}})}function o(a,l){return Ef({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Tf(),Us].filter(c=>!!c),issueData:{code:G.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Xs){const a=this;return zt(async function(...l){const c=new en([]),u=await a._def.args.parseAsync(l,s).catch(h=>{throw c.addIssue(r(l,h)),c}),f=await Reflect.apply(i,this,u);return await a._def.returns._def.type.parseAsync(f,s).catch(h=>{throw c.addIssue(o(f,h)),c})})}else{const a=this;return zt(function(...l){const c=a._def.args.safeParse(l,s);if(!c.success)throw new en([r(l,c.error)]);const u=Reflect.apply(i,this,c.data),f=a._def.returns.safeParse(u,s);if(!f.success)throw new en([o(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Zs({...this._def,args:Vn.create(t).rest(jo.create())})}returns(t){return new Zs({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Zs({args:t||Vn.create([]).rest(jo.create()),returns:n||jo.create(),typeName:he.ZodFunction,...ye(r)})}}class $a extends xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}$a.create=(e,t)=>new $a({getter:e,typeName:he.ZodLazy,...ye(t)});class Ra extends xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return J(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:t.data}}get value(){return this._def.value}}Ra.create=(e,t)=>new Ra({value:e,typeName:he.ZodLiteral,...ye(t)});function d0(e,t){return new $r({values:e,typeName:he.ZodEnum,...ye(t)})}class $r extends xe{constructor(){super(...arguments),Ys.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return J(n,{expected:Pe.joinValues(r),received:n.parsedType,code:G.invalid_type}),me}if(Da(this,Ys)||l0(this,Ys,new Set(this._def.values)),!Da(this,Ys).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return J(n,{received:n.data,code:G.invalid_enum_value,options:r}),me}return zt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return $r.create(t,{...this._def,...n})}exclude(t,n=this._def){return $r.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ys=new WeakMap,$r.create=d0;class ja extends xe{constructor(){super(...arguments),qs.set(this,void 0)}_parse(t){const n=Pe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==te.string&&r.parsedType!==te.number){const o=Pe.objectValues(n);return J(r,{expected:Pe.joinValues(o),received:r.parsedType,code:G.invalid_type}),me}if(Da(this,qs)||l0(this,qs,new Set(Pe.getValidEnumValues(this._def.values))),!Da(this,qs).has(t.data)){const o=Pe.objectValues(n);return J(r,{received:r.data,code:G.invalid_enum_value,options:o}),me}return zt(t.data)}get enum(){return this._def.values}}qs=new WeakMap,ja.create=(e,t)=>new ja({values:e,typeName:he.ZodNativeEnum,...ye(t)});class Xs extends xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.promise&&n.common.async===!1)return J(n,{code:G.invalid_type,expected:te.promise,received:n.parsedType}),me;const r=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return zt(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Xs.create=(e,t)=>new Xs({type:e,typeName:he.ZodPromise,...ye(t)});class $n extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{J(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return me;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?me:l.status==="dirty"||n.value==="dirty"?Gs(l.value):l});{if(n.value==="aborted")return me;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?me:a.status==="dirty"||n.value==="dirty"?Gs(a.value):a}}if(o.type==="refinement"){const i=a=>{const l=o.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?me:(a.status==="dirty"&&n.dirty(),i(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?me:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Aa(i))return i;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Aa(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):i);Pe.assertNever(o)}}$n.create=(e,t,n)=>new $n({schema:e,typeName:he.ZodEffects,effect:t,...ye(n)}),$n.createWithPreprocess=(e,t,n)=>new $n({schema:t,effect:{type:"preprocess",transform:e},typeName:he.ZodEffects,...ye(n)});class Rn extends xe{_parse(t){return this._getType(t)===te.undefined?zt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rn.create=(e,t)=>new Rn({innerType:e,typeName:he.ZodOptional,...ye(t)});class Rr extends xe{_parse(t){return this._getType(t)===te.null?zt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rr.create=(e,t)=>new Rr({innerType:e,typeName:he.ZodNullable,...ye(t)});class Ba extends xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===te.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ba.create=(e,t)=>new Ba({innerType:e,typeName:he.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...ye(t)});class za extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ia(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new en(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new en(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}za.create=(e,t)=>new za({innerType:e,typeName:he.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...ye(t)});class Mf extends xe{_parse(t){if(this._getType(t)!==te.nan){const r=this._getOrReturnCtx(t);return J(r,{code:G.invalid_type,expected:te.nan,received:r.parsedType}),me}return{status:"valid",value:t.data}}}Mf.create=e=>new Mf({typeName:he.ZodNaN,...ye(e)});class h0 extends xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Wa extends xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?me:s.status==="dirty"?(n.dirty(),Gs(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?me:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new Wa({in:t,out:n,typeName:he.ZodPipeline})}}class Ha extends xe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Aa(o)&&(o.value=Object.freeze(o.value)),o);return Ia(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Ha.create=(e,t)=>new Ha({innerType:e,typeName:he.ZodReadonly,...ye(t)}),nt.lazycreate;var he;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(he||(he={})),Fn.create,Vr.create,Mf.create,Ro.create,Pf.create,Ks.create,Of.create,Ma.create,Na.create,kf.create,jo.create,hr.create,_f.create,ln.create,nt.create,nt.strictCreate,Fa.create,Af.create,La.create,Vn.create,Va.create,Df.create,zo.create,Zs.create,$a.create,Ra.create,$r.create,ja.create,Xs.create,$n.create,Rn.create,Rr.create,$n.createWithPreprocess,Wa.create;const eL={sort:(e,t)=>e.localeCompare(t),allowDots:!0,charset:"utf-8",parseArrays:!0,plainObjects:!0,charsetSentinel:!0,allowPrototypes:!1,depth:Number.MAX_SAFE_INTEGER,arrayLimit:Number.MAX_SAFE_INTEGER,parameterLimit:Number.MAX_SAFE_INTEGER},p0=e=>{const t=new FormData(e),n=new URLSearchParams(t);return LF.parse(n.toString(),eL)},m0=e=>e.replace("[",".").replace("]","").split("."),Nf=(e,t)=>m0(e).reduce((n,r)=>{var s;if(r==="")return n;const o=((s=n.shape)==null?void 0:s[r])||n;return o instanceof ln?o.element:o},t),Ua=e=>e.type==="checkbox"?e.checked:e.type==="number"?e.valueAsNumber:e.value,tL=e=>{const[t,n]=b.useState(null),r=b.useRef({}),o=(l,c)=>{const u=Nf(l,e);return{...c,name:l,id:l,error:t==null?void 0:t[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}},s=(l,c)=>{const u=Nf(l,e);return{...c,name:l,id:l,type:kn.instance(u,Vr)?"number":(c==null?void 0:c.type)??"text",error:t==null?void 0:t[l],ref:f=>{f!==null&&(r.current[l]={element:f,schema:u})}}};b.useEffect(()=>{const l=Object.values(r.current).map(u=>{const f=u.schema.safeParse(Ua(u.element)),d=p=>{const m=u.schema.safeParse(Ua(p.target)),y=u.element,v=y.name;if(m.success)return y.setCustomValidity(""),n(w=>{const{[v]:g,...T}=w||{};return T===null||kn.empty(T)?null:T});if(y.required){const w=m.error.issues[0].message;y.setCustomValidity(w),n(g=>({...g,[v]:w}))}},h=u.element.tagName==="INPUT"?"blur":"change";return u.element.addEventListener(h,d),{input:u,hasInitialError:u.element.required?!f.success:!1,unsubscribe:()=>u.element.removeEventListener(h,d)}});return l.some(u=>u.hasInitialError)&&n(u=>u===null?{}:u),()=>l.forEach(u=>u.unsubscribe())});const i=b.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget,f=Object.values(r.current).reduce((h,p)=>{const m=p.element,y=p.schema.safeParse(Ua(m));if(y.success)return h;const v=y.error.issues[0].message;return m.setAttribute("data-initialized","true"),{...h,[m.name]:v}},{}),d=kn.empty(f)?null:{};n(d),l==null||l({form:u,errors:d||{}})},[]),a=b.useCallback(l=>c=>{c.preventDefault();const u=c.currentTarget;let f=p0(u);Array.from(u.elements).forEach(d=>{if(d.tagName==="SELECT"){const h=d;f=Wh(f,h.name,h.value)}if(d.tagName==="INPUT"){const h=d;f=Wh(f,h.name,Ua(h))}}),l({form:u,json:f,event:c,reset:()=>Xp(u)})},[]);return{input:s,select:o,onSubmit:a,errors:t,onInvalid:i,disabled:t!==null}},nL={name:"dark",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},rounded:{pill:"2rem",card:"0.75rem",full:"50%"},colors:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 9%)",accent:"hsla(199, 89%, 54%)",disabled:"hsla(240, 4%, 33%)",primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(199, 89%, 54%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{DEFAULT:"hsla(210, 20%, 80%)",subtle:"hsla(210, 27%, 88%)",hover:"hsla(210, 21%, 27%)",foreground:"hsla(210, 40%, 98%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 93%, 77%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 40%, 98%)"},warn:{DEFAULT:"hsla(27, 96%, 61%)",subtle:"hsla(45, 95%, 66%)",hover:"hsla(21, 90%, 48%)",foreground:"hsla(210, 40%, 98%)"},danger:{DEFAULT:"hsla(358, 75%, 59%)",subtle:"hsla(0, 94%, 81%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 40%, 98%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 75%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(210, 40%, 98%)"},input:{border:"hsla(240, 4%, 25%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 9%)",switch:"hsla(0, 0%, 100%)"},card:{background:"hsla(0, 0%, 15%)",border:"hsla(240, 7%, 27%)"},floating:{background:"hsla(0, 0%, 14%)",border:"hsla(240, 7%, 27%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 8%)",border:"hsla(0, 0%, 15%)"},table:{background:"hsla(0, 0%, 15%)",border:"hsla(240, 4%, 33%)"}}},rL={name:"light",spacing:{base:"1rem",lg:"1.5rem",sm:"0.75rem"},rounded:{full:"50%",pill:"2rem",card:"0.75rem"},colors:{foreground:"hsla(217, 15%, 32%)",background:"hsla(210, 34%, 96%)",accent:"hsla(199, 89%, 54%)",disabled:"hsla(240, 10%, 75%)",primary:{foreground:"hsla(210, 40%, 98%)",DEFAULT:"hsla(199, 89%, 54%)",subtle:"hsla(199, 95%, 87%)",hover:"hsla(199, 97%, 40%)"},secondary:{DEFAULT:"hsla(210, 20%, 40%)",subtle:"hsla(210, 27%, 95%)",hover:"hsla(210, 21%, 27%)",foreground:"hsla(210, 40%, 98%)"},info:{DEFAULT:"hsla(219, 91%, 59%)",subtle:"hsla(219, 70%, 90%)",hover:"hsla(219, 83%, 41%)",foreground:"hsla(210, 34%, 96%)"},danger:{DEFAULT:"hsla(0, 82%, 63%)",subtle:"hsla(0, 96%, 95%)",hover:"hsla(0, 82%, 47%)",foreground:"hsla(210, 34%, 96%)"},warn:{DEFAULT:"hsla(27, 100%, 70%)",subtle:"hsla(45, 95%, 80%)",hover:"hsla(29, 85%, 50%)",foreground:"hsla(210, 34%, 96%)"},success:{DEFAULT:"hsla(160, 73%, 36%)",subtle:"hsla(160, 75%, 90%)",hover:"hsla(160, 91%, 27%)",foreground:"hsla(210, 34%, 96%)"},input:{border:"hsla(218, 22%, 80%)",placeholder:"hsla(210, 24%, 71%)","mask-error":"hsla(0, 94%, 81%)","switch-bg":"hsla(0, 0%, 9%)",switch:"hsla(0, 0%, 100%)"},card:{background:"hsla(0, 0%, 100%)",border:"hsla(210, 25%, 88%)"},floating:{background:"hsla(0, 0%, 100%)",border:"hsla(210, 25%, 88%)",overlay:"hsla(0, 0%, 0%)"},tooltip:{foreground:"hsla(210, 40%, 98%)",background:"hsla(0, 0%, 8%)",border:"hsla(0, 0%, 15%)"},table:{background:"hsla(0, 0%, 100%)",border:"hsla(210, 25%, 88%)"}}},oL={cssVariable:(e,t,n)=>`var(--${n})`,rgba:e=>`rgba(${e})`,rgb:e=>`rgb(${e})`,hsl:e=>`hsl(${e})`,hsla:e=>`hsla(${e})`,hex:e=>e,raw:e=>e,formatWithVar:e=>(t,n,r)=>`${e}(var(--${r}), <alpha-value>)`},Qs=(e,t,n="",r="")=>Object.entries(e).reduce((o,[s,i])=>{const a=r===""?`${n}${s}`:`${r}-${s}`;if(typeof i=="string"){const l=r===""?`${n}${s}`:s;return o.concat(t(i,l,a))}return o.concat(Qs(i,t,n,a))},[]),g0=(e,t,n="",r="")=>Object.entries(e).reduce((o,[s,i])=>{const a=r===""?`${n}${s}`:`${r}-${s}`;if(typeof i=="string"){const l=r===""?`${n}${s}`:s;return{...o,[l]:t(i,s,a)}}return{...o,[s]:g0(i,t,n,a)}},{}),y0={default:e=>`:root { ${e} }`,dark:e=>`html.dark {${e}}`},Ff=(e,t)=>{const n=t.value||((o,s)=>s),r=e.map(o=>`${o.key}: ${n(o.key,o.value)}`).join(";");return t.result(r)},sL={default:e=>Ff(e,{result:y0.default}),dark:e=>Ff(e,{result:y0.dark})},iL=(e,t)=>{const n=(i,a,l)=>({key:`--${l}`,value:`${i}`}),r=Qs(e.colors,n),o=Qs(e.spacing,n),s=Qs(e.rounded,n);return Ff(r.concat(o,s),{result:i=>`html${t?`.${t}`:""} {${i}}`,value:(i,a)=>a.replace("hsla(","").replace(")","")})};re.Autocomplete=c1,re.Button=ps,re.ButtonGroup=FE,re.Calendar=Eb,re.Card=Ob,re.Checkbox=Hm,re.ColType=Vo,re.DatePicker=$M,re.Dropdown=Mo,re.FileUpload=BE,re.Form=WE,re.Input=us,re.InputFeedback=Xh,re.InputField=Di,re.Modal=rN,re.Option=Qh,re.Polymorph=hs,re.Select=xr,re.Stats=BM,re.Switch=HE,re.Tab=HM,re.Table=rF,re.Tabs=zM,re.Tag=jM,re.Tooltip=UM,re.TransferList=CP,re.convertPath=m0,re.createColumns=ON,re.createDesignTokens=g0,re.createOptionCols=ff,re.createStyles=sL,re.createTheme=iL,re.css=$t,re.defaultDarkTheme=nL,re.defaultLightTheme=rL,re.dispatchInput=Ql,re.formReset=Xp,re.formToJson=p0,re.getSchemaShape=Nf,re.isReactComponent=o1,re.isReactFC=s1,re.isSsr=cf,re.mergeRefs=Xl,re.parsers=oL,re.path=Kb,re.reduceTokens=Qs,re.useForm=tL,re.usePrevious=Zd,re.useReactive=kb,re.useTablePreferences=_N,re.uuid=ka,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
171
171
  //# sourceMappingURL=index.umd.js.map