@llmindset/hf-mcp-server 0.2.25 → 0.2.26

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.
@@ -6,7 +6,7 @@ import{r as Pl,a as p,R as Fe,j as l,b as ci,u as pe,g as Ol,c as Fl,d as Nn,e a
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Zs;function Hl(){if(Zs)return ir;Zs=1;var e=Pl();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(m,g){var d=g(),v=r({inst:{value:d,getSnapshot:g}}),h=v[0].inst,y=v[1];return o(function(){h.value=d,h.getSnapshot=g,c(h)&&y({inst:h})},[m,d,g]),s(function(){return c(h)&&y({inst:h}),m(function(){c(h)&&y({inst:h})})},[m]),i(d),d}function c(m){var g=m.getSnapshot;m=m.value;try{var d=g();return!n(m,d)}catch{return!0}}function u(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return ir.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,ir}var Ks;function zl(){return Ks||(Ks=1,or.exports=Hl()),or.exports}var Gl=zl();const mi=0,hi=1,pi=2,Xs=3;var Ys=Object.prototype.hasOwnProperty;function Ir(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Ir(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(Ys.call(e,n)&&++r&&!Ys.call(t,n)||!(n in t)||!Ir(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const qe=new WeakMap,ot=()=>{},he=ot(),Pr=Object,X=e=>e===he,De=e=>typeof e=="function",ut=(e,t)=>({...e,...t}),vi=e=>De(e.then),ar={},fn={},hs="undefined",on=typeof window!=hs,Or=typeof document!=hs,Bl=on&&"Deno"in window,Ul=()=>on&&typeof window.requestAnimationFrame!=hs,xi=(e,t)=>{const n=qe.get(e);return[()=>!X(t)&&e.get(t)||ar,r=>{if(!X(t)){const s=e.get(t);t in fn||(fn[t]=s),n[5](t,ut(s,r),s||ar)}},n[6],()=>!X(t)&&t in fn?fn[t]:!X(t)&&e.get(t)||ar]};let Fr=!0;const Wl=()=>Fr,[Dr,$r]=on&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ot,ot],ql=()=>{const e=Or&&document.visibilityState;return X(e)||e!=="hidden"},Zl=e=>(Or&&document.addEventListener("visibilitychange",e),Dr("focus",e),()=>{Or&&document.removeEventListener("visibilitychange",e),$r("focus",e)}),Kl=e=>{const t=()=>{Fr=!0,e()},n=()=>{Fr=!1};return Dr("online",t),Dr("offline",n),()=>{$r("online",t),$r("offline",n)}},Xl={isOnline:Wl,isVisible:ql},Yl={initFocus:Zl,initReconnect:Kl},Js=!Fe.useId,Jt=!on||Bl,Jl=e=>Ul()?window.requestAnimationFrame(e):setTimeout(e,1),lr=Jt?p.useEffect:p.useLayoutEffect,cr=typeof navigator<"u"&&navigator.connection,Qs=!Jt&&cr&&(["slow-2g","2g"].includes(cr.effectiveType)||cr.saveData),gn=new WeakMap,Ql=e=>Pr.prototype.toString.call(e),ur=(e,t)=>e===`[object ${t}]`;let ec=0;const Lr=e=>{const t=typeof e,n=Ql(e),r=ur(n,"Date"),s=ur(n,"RegExp"),o=ur(n,"Object");let i,a;if(Pr(e)===e&&!r&&!s){if(i=gn.get(e),i)return i;if(i=++ec+"~",gn.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=Lr(e[a])+",";gn.set(e,i)}if(o){i="#";const c=Pr.keys(e).sort();for(;!X(a=c.pop());)X(e[a])||(i+=a+":"+Lr(e[a])+",");gn.set(e,i)}}else i=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},ps=e=>{if(De(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Lr(e):"",[e,t]};let tc=0;const Vr=()=>++tc;async function yi(...e){const[t,n,r,s]=e,o=ut({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=o.populateCache;const a=o.rollbackOnError;let c=o.optimisticData;const u=g=>typeof a=="function"?a(g):a!==!1,f=o.throwOnError;if(De(n)){const g=n,d=[],v=t.keys();for(const h of v)!/^\$(inf|sub)\$/.test(h)&&g(t.get(h)._k)&&d.push(h);return Promise.all(d.map(m))}return m(n);async function m(g){const[d]=ps(g);if(!d)return;const[v,h]=xi(t,d),[y,x,w,_]=qe.get(t),S=()=>{const D=y[d];return(De(o.revalidate)?o.revalidate(v().data,g):o.revalidate!==!1)&&(delete w[d],delete _[d],D&&D[0])?D[0](pi).then(()=>v().data):v().data};if(e.length<3)return S();let C=r,N,R=!1;const M=Vr();x[d]=[M,0];const z=!X(c),F=v(),Z=F.data,Q=F._c,U=X(Q)?Z:Q;if(z&&(c=De(c)?c(U,Z):c,h({data:c,_c:U})),De(C))try{C=C(U)}catch(D){N=D,R=!0}if(C&&vi(C))if(C=await C.catch(D=>{N=D,R=!0}),M!==x[d][0]){if(R)throw N;return C}else R&&z&&u(N)&&(i=!0,h({data:U,_c:he}));if(i&&!R)if(De(i)){const D=i(C,U);h({data:D,error:he,_c:he})}else h({data:C,error:he,_c:he});if(x[d][1]=Vr(),Promise.resolve(S()).then(()=>{h({_c:he})}),R){if(f)throw N;return}return C}}const eo=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},nc=(e,t)=>{if(!qe.has(e)){const n=ut(Yl,t),r=Object.create(null),s=yi.bind(he,e);let o=ot;const i=Object.create(null),a=(f,m)=>{const g=i[f]||[];return i[f]=g,g.push(m),()=>g.splice(g.indexOf(m),1)},c=(f,m,g)=>{e.set(f,m);const d=i[f];if(d)for(const v of d)v(m,g)},u=()=>{if(!qe.has(e)&&(qe.set(e,[r,Object.create(null),Object.create(null),Object.create(null),s,c,a]),!Jt)){const f=n.initFocus(setTimeout.bind(he,eo.bind(he,r,mi))),m=n.initReconnect(setTimeout.bind(he,eo.bind(he,r,hi)));o=()=>{f&&f(),m&&m(),qe.delete(e)}}};return u(),[e,s,u,o]}return[e,qe.get(e)[4]]},rc=(e,t,n,r,s)=>{const o=n.errorRetryCount,i=s.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!X(o)&&i>o||setTimeout(r,a,s)},sc=Ir,[wi,bn]=nc(new Map),oc=ut({onLoadingSlow:ot,onSuccess:ot,onError:ot,onErrorRetry:rc,onDiscarded:ot,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Qs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Qs?5e3:3e3,compare:sc,isPaused:()=>!1,cache:wi,mutate:bn,fallback:{}},Xl),ic=(e,t)=>{const n=ut(e,t);if(t){const{use:r,fallback:s}=e,{use:o,fallback:i}=t;r&&o&&(n.use=r.concat(o)),s&&i&&(n.fallback=ut(s,i))}return n},ac=p.createContext({}),lc="$inf$",_i=on&&window.__SWR_DEVTOOLS_USE__,cc=_i?window.__SWR_DEVTOOLS_USE__:[],uc=()=>{_i&&(window.__SWR_DEVTOOLS_REACT__=Fe)},dc=e=>De(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],fc=()=>{const e=p.useContext(ac);return p.useMemo(()=>ut(oc,e),[e])},gc=e=>(t,n,r)=>e(t,n&&((...o)=>{const[i]=ps(t),[,,,a]=qe.get(wi);if(i.startsWith(lc))return n(...o);const c=a[i];return X(c)?n(...o):(delete a[i],c)}),r),mc=cc.concat(gc),hc=e=>function(...n){const r=fc(),[s,o,i]=dc(n),a=ic(r,i);let c=e;const{use:u}=a,f=(u||[]).concat(mc);for(let m=f.length;m--;)c=f[m](c);return c(s,o||a.fetcher||null,a)},pc=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};uc();const dr=Fe.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),fr={dedupe:!0},to=Promise.resolve(he),vc=(e,t,n)=>{const{cache:r,compare:s,suspense:o,fallbackData:i,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:m,keepPreviousData:g}=n,[d,v,h,y]=qe.get(r),[x,w]=ps(e),_=p.useRef(!1),S=p.useRef(!1),C=p.useRef(x),N=p.useRef(t),R=p.useRef(n),M=()=>R.current,z=()=>M().isVisible()&&M().isOnline(),[F,Z,Q,U]=xi(r,x),D=p.useRef({}).current,ne=X(i)?X(n.fallback)?he:n.fallback[x]:i,W=(q,re)=>{for(const le in D){const te=le;if(te==="data"){if(!s(q[te],re[te])&&(!X(q[te])||!s(Ee,re[te])))return!1}else if(re[te]!==q[te])return!1}return!0},ee=p.useMemo(()=>{const q=!x||!t?!1:X(a)?M().isPaused()||o?!1:c!==!1:a,re=ve=>{const Be=ut(ve);return delete Be._k,q?{isValidating:!0,isLoading:!0,...Be}:Be},le=F(),te=U(),_e=re(le),nt=le===te?_e:re(te);let ae=_e;return[()=>{const ve=re(F());return W(ve,ae)?(ae.data=ve.data,ae.isLoading=ve.isLoading,ae.isValidating=ve.isValidating,ae.error=ve.error,ae):(ae=ve,ve)},()=>nt]},[r,x]),I=Gl.useSyncExternalStore(p.useCallback(q=>Q(x,(re,le)=>{W(le,re)||q()}),[r,x]),ee[0],ee[1]),E=!_.current,L=d[x]&&d[x].length>0,$=I.data,K=X($)?ne&&vi(ne)?dr(ne):ne:$,de=I.error,je=p.useRef(K),Ee=g?X($)?X(je.current)?K:je.current:$:K,ye=L&&!X(de)?!1:E&&!X(a)?a:M().isPaused()?!1:o?X(K)?!1:c:X(K)||c,Me=!!(x&&t&&E&&ye),vt=X(I.isValidating)?Me:I.isValidating,we=X(I.isLoading)?Me:I.isLoading,ke=p.useCallback(async q=>{const re=N.current;if(!x||!re||S.current||M().isPaused())return!1;let le,te,_e=!0;const nt=q||{},ae=!h[x]||!nt.dedupe,ve=()=>Js?!S.current&&x===C.current&&_.current:x===C.current,Be={isValidating:!1,isLoading:!1},Us=()=>{Z(Be)},Ws=()=>{const Ne=h[x];Ne&&Ne[1]===te&&delete h[x]},qs={isValidating:!0};X(F().data)&&(qs.isLoading=!0);try{if(ae&&(Z(qs),n.loadingTimeout&&X(F().data)&&setTimeout(()=>{_e&&ve()&&M().onLoadingSlow(x,n)},n.loadingTimeout),h[x]=[re(w),Vr()]),[le,te]=h[x],le=await le,ae&&setTimeout(Ws,n.dedupingInterval),!h[x]||h[x][1]!==te)return ae&&ve()&&M().onDiscarded(x),!1;Be.error=he;const Ne=v[x];if(!X(Ne)&&(te<=Ne[0]||te<=Ne[1]||Ne[1]===0))return Us(),ae&&ve()&&M().onDiscarded(x),!1;const Ue=F().data;Be.data=s(Ue,le)?Ue:le,ae&&ve()&&M().onSuccess(le,x,n)}catch(Ne){Ws();const Ue=M(),{shouldRetryOnError:rr}=Ue;Ue.isPaused()||(Be.error=Ne,ae&&ve()&&(Ue.onError(Ne,x,Ue),(rr===!0||De(rr)&&rr(Ne))&&(!M().revalidateOnFocus||!M().revalidateOnReconnect||z())&&Ue.onErrorRetry(Ne,x,Ue,Il=>{const sr=d[x];sr&&sr[0]&&sr[0](Xs,Il)},{retryCount:(nt.retryCount||0)+1,dedupe:!0})))}return _e=!1,Us(),!0},[x,r]),Wt=p.useCallback((...q)=>yi(r,C.current,...q),[]);if(lr(()=>{N.current=t,R.current=n,X($)||(je.current=$)}),lr(()=>{if(!x)return;const q=ke.bind(he,fr);let re=0;M().revalidateOnFocus&&(re=Date.now()+M().focusThrottleInterval);const te=pc(x,d,(_e,nt={})=>{if(_e==mi){const ae=Date.now();M().revalidateOnFocus&&ae>re&&z()&&(re=ae+M().focusThrottleInterval,q())}else if(_e==hi)M().revalidateOnReconnect&&z()&&q();else{if(_e==pi)return ke();if(_e==Xs)return ke(nt)}});return S.current=!1,C.current=x,_.current=!0,Z({_k:w}),ye&&(h[x]||(X(K)||Jt?q():Jl(q))),()=>{S.current=!0,te()}},[x]),lr(()=>{let q;function re(){const te=De(u)?u(F().data):u;te&&q!==-1&&(q=setTimeout(le,te))}function le(){!F().error&&(f||M().isVisible())&&(m||M().isOnline())?ke(fr).then(re):re()}return re(),()=>{q&&(clearTimeout(q),q=-1)}},[u,f,m,x]),p.useDebugValue(Ee),o){const q=x&&X(K);if(!Js&&Jt&&q)throw new Error("Fallback data is required when using Suspense in SSR.");q&&(N.current=t,R.current=n,S.current=!1);const re=y[x],le=!X(re)&&q?Wt(re):to;if(dr(le),!X(de)&&q)throw de;const te=q?ke(fr):to;!X(Ee)&&q&&(te.status="fulfilled",te.value=!0),dr(te)}return{mutate:Wt,get data(){return D.data=!0,Ee},get error(){return D.error=!0,de},get isValidating(){return D.isValidating=!0,vt},get isLoading(){return D.isLoading=!0,we}}},Xt=hc(vc);function bt(e,t=[]){let n=[];function r(o,i){const a=p.createContext(i),c=n.length;n=[...n,i];const u=m=>{var x;const{scope:g,children:d,...v}=m,h=((x=g==null?void 0:g[e])==null?void 0:x[c])||a,y=p.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:d})};u.displayName=o+"Provider";function f(m,g){var h;const d=((h=g==null?void 0:g[e])==null?void 0:h[c])||a,v=p.useContext(d);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[u,f]}const s=()=>{const o=n.map(i=>p.createContext(i));return function(a){const c=(a==null?void 0:a[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,xc(s,...t)]}function xc(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((a,{useScope:c,scopeName:u})=>{const m=c(o)[`__scope${u}`];return{...a,...m}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function G(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}var dt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},yc=ci[" useInsertionEffect ".trim().toString()]||dt;function Hn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=wc({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const f=p.useRef(e!==void 0);p.useEffect(()=>{const m=f.current;m!==a&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const u=p.useCallback(f=>{var m;if(a){const g=_c(f)?f(e):f;g!==e&&((m=i.current)==null||m.call(i,g))}else o(f)},[a,e,o,i]);return[c,u]}function wc({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return yc(()=>{o.current=t},[t]),p.useEffect(()=>{var i;s.current!==n&&((i=o.current)==null||i.call(o,n),s.current=n)},[n,s]),[n,r,o]}function _c(e){return typeof e=="function"}function Sc(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Si(e){const[t,n]=p.useState(void 0);return dt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Cc(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Rt=e=>{const{present:t,children:n}=e,r=bc(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=pe(r.ref,Rc(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Rt.displayName="Presence";function bc(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Cc(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=mn(r.current);o.current=a==="mounted"?u:"none"},[a]),dt(()=>{const u=r.current,f=s.current;if(f!==e){const g=o.current,d=mn(u);e?c("MOUNT"):d==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&g!==d?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),dt(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,m=d=>{const h=mn(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&h&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},g=d=>{d.target===t&&(o.current=mn(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:p.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function mn(e){return(e==null?void 0:e.animationName)||"none"}function Rc(e){var r,s;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=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vs=Fl();const Ec=Ol(vs);var Mc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],se=Mc.reduce((e,t)=>{const n=Nn(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ci(e,t){e&&vs.flushSync(()=>e.dispatchEvent(t))}var zn="Checkbox",[Nc,mp]=bt(zn),[Tc,xs]=Nc(zn);function Ac(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:a,onCheckedChange:c,required:u,value:f="on",internal_do_not_use_render:m}=e,[g,d]=Hn({prop:n,defaultProp:s??!1,onChange:c,caller:zn}),[v,h]=p.useState(null),[y,x]=p.useState(null),w=p.useRef(!1),_=v?!!i||!!v.closest("form"):!0,S={checked:g,disabled:o,setChecked:d,control:v,setControl:h,name:a,form:i,value:f,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:lt(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:x};return l.jsx(Tc,{scope:t,...S,children:jc(m)?m(S):r})}var bi="CheckboxTrigger",Ri=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:a,checked:c,required:u,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:g,isFormControl:d,bubbleInput:v}=xs(bi,e),h=pe(s,f),y=p.useRef(c);return p.useEffect(()=>{const x=o==null?void 0:o.form;if(x){const w=()=>m(y.current);return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[o,m]),l.jsx(se.button,{type:"button",role:"checkbox","aria-checked":lt(c)?"mixed":c,"aria-required":u,"data-state":ji(c),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:h,onKeyDown:G(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:G(n,x=>{m(w=>lt(w)?!0:!w),v&&d&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})})});Ri.displayName=bi;var Ei=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:a,value:c,onCheckedChange:u,form:f,...m}=e;return l.jsx(Ac,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:a,required:i,onCheckedChange:u,name:r,form:f,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Ri,{...m,ref:t,__scopeCheckbox:n}),g&&l.jsx(Ai,{__scopeCheckbox:n})]})})});Ei.displayName=zn;var Mi="CheckboxIndicator",Ni=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=xs(Mi,n);return l.jsx(Rt,{present:r||lt(o.checked)||o.checked===!0,children:l.jsx(se.span,{"data-state":ji(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});Ni.displayName=Mi;var Ti="CheckboxBubbleInput",Ai=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:a,disabled:c,name:u,value:f,form:m,bubbleInput:g,setBubbleInput:d}=xs(Ti,e),v=pe(n,d),h=Sc(o),y=Si(r);p.useEffect(()=>{const w=g;if(!w)return;const _=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(_,"checked").set,N=!s.current;if(h!==o&&C){const R=new Event("click",{bubbles:N});w.indeterminate=lt(o),C.call(w,lt(o)?!1:o),w.dispatchEvent(R)}},[g,h,o,s]);const x=p.useRef(lt(o)?!1:o);return l.jsx(se.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:a,disabled:c,name:u,value:f,form:m,...t,tabIndex:-1,ref:v,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ai.displayName=Ti;function jc(e){return typeof e=="function"}function lt(e){return e==="indeterminate"}function ji(e){return lt(e)?"indeterminate":e?"checked":"unchecked"}/**
9
+ */var Zs;function Hl(){if(Zs)return ir;Zs=1;var e=Pl();function t(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(m,g){var d=g(),v=r({inst:{value:d,getSnapshot:g}}),h=v[0].inst,y=v[1];return o(function(){h.value=d,h.getSnapshot=g,c(h)&&y({inst:h})},[m,d,g]),s(function(){return c(h)&&y({inst:h}),m(function(){c(h)&&y({inst:h})})},[m]),i(d),d}function c(m){var g=m.getSnapshot;m=m.value;try{var d=g();return!n(m,d)}catch{return!0}}function u(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return ir.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,ir}var Ks;function zl(){return Ks||(Ks=1,or.exports=Hl()),or.exports}var Gl=zl();const mi=0,hi=1,pi=2,Xs=3;var Ys=Object.prototype.hasOwnProperty;function Ir(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Ir(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(Ys.call(e,n)&&++r&&!Ys.call(t,n)||!(n in t)||!Ir(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const qe=new WeakMap,ot=()=>{},he=ot(),Pr=Object,X=e=>e===he,De=e=>typeof e=="function",ut=(e,t)=>({...e,...t}),vi=e=>De(e.then),ar={},fn={},hs="undefined",on=typeof window!=hs,Or=typeof document!=hs,Bl=on&&"Deno"in window,Ul=()=>on&&typeof window.requestAnimationFrame!=hs,xi=(e,t)=>{const n=qe.get(e);return[()=>!X(t)&&e.get(t)||ar,r=>{if(!X(t)){const s=e.get(t);t in fn||(fn[t]=s),n[5](t,ut(s,r),s||ar)}},n[6],()=>!X(t)&&t in fn?fn[t]:!X(t)&&e.get(t)||ar]};let Fr=!0;const Wl=()=>Fr,[Dr,$r]=on&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ot,ot],ql=()=>{const e=Or&&document.visibilityState;return X(e)||e!=="hidden"},Zl=e=>(Or&&document.addEventListener("visibilitychange",e),Dr("focus",e),()=>{Or&&document.removeEventListener("visibilitychange",e),$r("focus",e)}),Kl=e=>{const t=()=>{Fr=!0,e()},n=()=>{Fr=!1};return Dr("online",t),Dr("offline",n),()=>{$r("online",t),$r("offline",n)}},Xl={isOnline:Wl,isVisible:ql},Yl={initFocus:Zl,initReconnect:Kl},Js=!Fe.useId,Jt=!on||Bl,Jl=e=>Ul()?window.requestAnimationFrame(e):setTimeout(e,1),lr=Jt?p.useEffect:p.useLayoutEffect,cr=typeof navigator<"u"&&navigator.connection,Qs=!Jt&&cr&&(["slow-2g","2g"].includes(cr.effectiveType)||cr.saveData),gn=new WeakMap,Ql=e=>Pr.prototype.toString.call(e),ur=(e,t)=>e===`[object ${t}]`;let ec=0;const Lr=e=>{const t=typeof e,n=Ql(e),r=ur(n,"Date"),s=ur(n,"RegExp"),o=ur(n,"Object");let i,a;if(Pr(e)===e&&!r&&!s){if(i=gn.get(e),i)return i;if(i=++ec+"~",gn.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=Lr(e[a])+",";gn.set(e,i)}if(o){i="#";const c=Pr.keys(e).sort();for(;!X(a=c.pop());)X(e[a])||(i+=a+":"+Lr(e[a])+",");gn.set(e,i)}}else i=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},ps=e=>{if(De(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Lr(e):"",[e,t]};let tc=0;const Vr=()=>++tc;async function yi(...e){const[t,n,r,s]=e,o=ut({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=o.populateCache;const a=o.rollbackOnError;let c=o.optimisticData;const u=g=>typeof a=="function"?a(g):a!==!1,f=o.throwOnError;if(De(n)){const g=n,d=[],v=t.keys();for(const h of v)!/^\$(inf|sub)\$/.test(h)&&g(t.get(h)._k)&&d.push(h);return Promise.all(d.map(m))}return m(n);async function m(g){const[d]=ps(g);if(!d)return;const[v,h]=xi(t,d),[y,x,w,_]=qe.get(t),S=()=>{const D=y[d];return(De(o.revalidate)?o.revalidate(v().data,g):o.revalidate!==!1)&&(delete w[d],delete _[d],D&&D[0])?D[0](pi).then(()=>v().data):v().data};if(e.length<3)return S();let C=r,N,R=!1;const M=Vr();x[d]=[M,0];const z=!X(c),F=v(),Z=F.data,Q=F._c,U=X(Q)?Z:Q;if(z&&(c=De(c)?c(U,Z):c,h({data:c,_c:U})),De(C))try{C=C(U)}catch(D){N=D,R=!0}if(C&&vi(C))if(C=await C.catch(D=>{N=D,R=!0}),M!==x[d][0]){if(R)throw N;return C}else R&&z&&u(N)&&(i=!0,h({data:U,_c:he}));if(i&&!R)if(De(i)){const D=i(C,U);h({data:D,error:he,_c:he})}else h({data:C,error:he,_c:he});if(x[d][1]=Vr(),Promise.resolve(S()).then(()=>{h({_c:he})}),R){if(f)throw N;return}return C}}const eo=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},nc=(e,t)=>{if(!qe.has(e)){const n=ut(Yl,t),r=Object.create(null),s=yi.bind(he,e);let o=ot;const i=Object.create(null),a=(f,m)=>{const g=i[f]||[];return i[f]=g,g.push(m),()=>g.splice(g.indexOf(m),1)},c=(f,m,g)=>{e.set(f,m);const d=i[f];if(d)for(const v of d)v(m,g)},u=()=>{if(!qe.has(e)&&(qe.set(e,[r,Object.create(null),Object.create(null),Object.create(null),s,c,a]),!Jt)){const f=n.initFocus(setTimeout.bind(he,eo.bind(he,r,mi))),m=n.initReconnect(setTimeout.bind(he,eo.bind(he,r,hi)));o=()=>{f&&f(),m&&m(),qe.delete(e)}}};return u(),[e,s,u,o]}return[e,qe.get(e)[4]]},rc=(e,t,n,r,s)=>{const o=n.errorRetryCount,i=s.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!X(o)&&i>o||setTimeout(r,a,s)},sc=Ir,[wi,bn]=nc(new Map),oc=ut({onLoadingSlow:ot,onSuccess:ot,onError:ot,onErrorRetry:rc,onDiscarded:ot,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Qs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Qs?5e3:3e3,compare:sc,isPaused:()=>!1,cache:wi,mutate:bn,fallback:{}},Xl),ic=(e,t)=>{const n=ut(e,t);if(t){const{use:r,fallback:s}=e,{use:o,fallback:i}=t;r&&o&&(n.use=r.concat(o)),s&&i&&(n.fallback=ut(s,i))}return n},ac=p.createContext({}),lc="$inf$",_i=on&&window.__SWR_DEVTOOLS_USE__,cc=_i?window.__SWR_DEVTOOLS_USE__:[],uc=()=>{_i&&(window.__SWR_DEVTOOLS_REACT__=Fe)},dc=e=>De(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],fc=()=>{const e=p.useContext(ac);return p.useMemo(()=>ut(oc,e),[e])},gc=e=>(t,n,r)=>e(t,n&&((...o)=>{const[i]=ps(t),[,,,a]=qe.get(wi);if(i.startsWith(lc))return n(...o);const c=a[i];return X(c)?n(...o):(delete a[i],c)}),r),mc=cc.concat(gc),hc=e=>function(...n){const r=fc(),[s,o,i]=dc(n),a=ic(r,i);let c=e;const{use:u}=a,f=(u||[]).concat(mc);for(let m=f.length;m--;)c=f[m](c);return c(s,o||a.fetcher||null,a)},pc=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};uc();const dr=Fe.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),fr={dedupe:!0},to=Promise.resolve(he),vc=(e,t,n)=>{const{cache:r,compare:s,suspense:o,fallbackData:i,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:m,keepPreviousData:g}=n,[d,v,h,y]=qe.get(r),[x,w]=ps(e),_=p.useRef(!1),S=p.useRef(!1),C=p.useRef(x),N=p.useRef(t),R=p.useRef(n),M=()=>R.current,z=()=>M().isVisible()&&M().isOnline(),[F,Z,Q,U]=xi(r,x),D=p.useRef({}).current,ne=X(i)?X(n.fallback)?he:n.fallback[x]:i,W=(q,re)=>{for(const le in D){const te=le;if(te==="data"){if(!s(q[te],re[te])&&(!X(q[te])||!s(Ee,re[te])))return!1}else if(re[te]!==q[te])return!1}return!0},ee=p.useMemo(()=>{const q=!x||!t?!1:X(a)?M().isPaused()||o?!1:c!==!1:a,re=ve=>{const Be=ut(ve);return delete Be._k,q?{isValidating:!0,isLoading:!0,...Be}:Be},le=F(),te=U(),_e=re(le),nt=le===te?_e:re(te);let ae=_e;return[()=>{const ve=re(F());return W(ve,ae)?(ae.data=ve.data,ae.isLoading=ve.isLoading,ae.isValidating=ve.isValidating,ae.error=ve.error,ae):(ae=ve,ve)},()=>nt]},[r,x]),I=Gl.useSyncExternalStore(p.useCallback(q=>Q(x,(re,le)=>{W(le,re)||q()}),[r,x]),ee[0],ee[1]),E=!_.current,L=d[x]&&d[x].length>0,$=I.data,K=X($)?ne&&vi(ne)?dr(ne):ne:$,fe=I.error,je=p.useRef(K),Ee=g?X($)?X(je.current)?K:je.current:$:K,ye=L&&!X(fe)?!1:E&&!X(a)?a:M().isPaused()?!1:o?X(K)?!1:c:X(K)||c,Me=!!(x&&t&&E&&ye),vt=X(I.isValidating)?Me:I.isValidating,we=X(I.isLoading)?Me:I.isLoading,ke=p.useCallback(async q=>{const re=N.current;if(!x||!re||S.current||M().isPaused())return!1;let le,te,_e=!0;const nt=q||{},ae=!h[x]||!nt.dedupe,ve=()=>Js?!S.current&&x===C.current&&_.current:x===C.current,Be={isValidating:!1,isLoading:!1},Us=()=>{Z(Be)},Ws=()=>{const Ne=h[x];Ne&&Ne[1]===te&&delete h[x]},qs={isValidating:!0};X(F().data)&&(qs.isLoading=!0);try{if(ae&&(Z(qs),n.loadingTimeout&&X(F().data)&&setTimeout(()=>{_e&&ve()&&M().onLoadingSlow(x,n)},n.loadingTimeout),h[x]=[re(w),Vr()]),[le,te]=h[x],le=await le,ae&&setTimeout(Ws,n.dedupingInterval),!h[x]||h[x][1]!==te)return ae&&ve()&&M().onDiscarded(x),!1;Be.error=he;const Ne=v[x];if(!X(Ne)&&(te<=Ne[0]||te<=Ne[1]||Ne[1]===0))return Us(),ae&&ve()&&M().onDiscarded(x),!1;const Ue=F().data;Be.data=s(Ue,le)?Ue:le,ae&&ve()&&M().onSuccess(le,x,n)}catch(Ne){Ws();const Ue=M(),{shouldRetryOnError:rr}=Ue;Ue.isPaused()||(Be.error=Ne,ae&&ve()&&(Ue.onError(Ne,x,Ue),(rr===!0||De(rr)&&rr(Ne))&&(!M().revalidateOnFocus||!M().revalidateOnReconnect||z())&&Ue.onErrorRetry(Ne,x,Ue,Il=>{const sr=d[x];sr&&sr[0]&&sr[0](Xs,Il)},{retryCount:(nt.retryCount||0)+1,dedupe:!0})))}return _e=!1,Us(),!0},[x,r]),Wt=p.useCallback((...q)=>yi(r,C.current,...q),[]);if(lr(()=>{N.current=t,R.current=n,X($)||(je.current=$)}),lr(()=>{if(!x)return;const q=ke.bind(he,fr);let re=0;M().revalidateOnFocus&&(re=Date.now()+M().focusThrottleInterval);const te=pc(x,d,(_e,nt={})=>{if(_e==mi){const ae=Date.now();M().revalidateOnFocus&&ae>re&&z()&&(re=ae+M().focusThrottleInterval,q())}else if(_e==hi)M().revalidateOnReconnect&&z()&&q();else{if(_e==pi)return ke();if(_e==Xs)return ke(nt)}});return S.current=!1,C.current=x,_.current=!0,Z({_k:w}),ye&&(h[x]||(X(K)||Jt?q():Jl(q))),()=>{S.current=!0,te()}},[x]),lr(()=>{let q;function re(){const te=De(u)?u(F().data):u;te&&q!==-1&&(q=setTimeout(le,te))}function le(){!F().error&&(f||M().isVisible())&&(m||M().isOnline())?ke(fr).then(re):re()}return re(),()=>{q&&(clearTimeout(q),q=-1)}},[u,f,m,x]),p.useDebugValue(Ee),o){const q=x&&X(K);if(!Js&&Jt&&q)throw new Error("Fallback data is required when using Suspense in SSR.");q&&(N.current=t,R.current=n,S.current=!1);const re=y[x],le=!X(re)&&q?Wt(re):to;if(dr(le),!X(fe)&&q)throw fe;const te=q?ke(fr):to;!X(Ee)&&q&&(te.status="fulfilled",te.value=!0),dr(te)}return{mutate:Wt,get data(){return D.data=!0,Ee},get error(){return D.error=!0,fe},get isValidating(){return D.isValidating=!0,vt},get isLoading(){return D.isLoading=!0,we}}},Xt=hc(vc);function bt(e,t=[]){let n=[];function r(o,i){const a=p.createContext(i),c=n.length;n=[...n,i];const u=m=>{var x;const{scope:g,children:d,...v}=m,h=((x=g==null?void 0:g[e])==null?void 0:x[c])||a,y=p.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:d})};u.displayName=o+"Provider";function f(m,g){var h;const d=((h=g==null?void 0:g[e])==null?void 0:h[c])||a,v=p.useContext(d);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[u,f]}const s=()=>{const o=n.map(i=>p.createContext(i));return function(a){const c=(a==null?void 0:a[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return s.scopeName=e,[r,xc(s,...t)]}function xc(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((a,{useScope:c,scopeName:u})=>{const m=c(o)[`__scope${u}`];return{...a,...m}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function G(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}var dt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},yc=ci[" useInsertionEffect ".trim().toString()]||dt;function Hn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=wc({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:s;{const f=p.useRef(e!==void 0);p.useEffect(()=>{const m=f.current;m!==a&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=a},[a,r])}const u=p.useCallback(f=>{var m;if(a){const g=_c(f)?f(e):f;g!==e&&((m=i.current)==null||m.call(i,g))}else o(f)},[a,e,o,i]);return[c,u]}function wc({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return yc(()=>{o.current=t},[t]),p.useEffect(()=>{var i;s.current!==n&&((i=o.current)==null||i.call(o,n),s.current=n)},[n,s]),[n,r,o]}function _c(e){return typeof e=="function"}function Sc(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Si(e){const[t,n]=p.useState(void 0);return dt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let i,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Cc(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Rt=e=>{const{present:t,children:n}=e,r=bc(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=pe(r.ref,Rc(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Rt.displayName="Presence";function bc(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Cc(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=mn(r.current);o.current=a==="mounted"?u:"none"},[a]),dt(()=>{const u=r.current,f=s.current;if(f!==e){const g=o.current,d=mn(u);e?c("MOUNT"):d==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&g!==d?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),dt(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,m=d=>{const h=mn(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&h&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},g=d=>{d.target===t&&(o.current=mn(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:p.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function mn(e){return(e==null?void 0:e.animationName)||"none"}function Rc(e){var r,s;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=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vs=Fl();const Ec=Ol(vs);var Mc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oe=Mc.reduce((e,t)=>{const n=Nn(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:i,...a}=s,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ci(e,t){e&&vs.flushSync(()=>e.dispatchEvent(t))}var zn="Checkbox",[Nc,mp]=bt(zn),[Tc,xs]=Nc(zn);function Ac(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:s,disabled:o,form:i,name:a,onCheckedChange:c,required:u,value:f="on",internal_do_not_use_render:m}=e,[g,d]=Hn({prop:n,defaultProp:s??!1,onChange:c,caller:zn}),[v,h]=p.useState(null),[y,x]=p.useState(null),w=p.useRef(!1),_=v?!!i||!!v.closest("form"):!0,S={checked:g,disabled:o,setChecked:d,control:v,setControl:h,name:a,form:i,value:f,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:lt(s)?!1:s,isFormControl:_,bubbleInput:y,setBubbleInput:x};return l.jsx(Tc,{scope:t,...S,children:jc(m)?m(S):r})}var bi="CheckboxTrigger",Ri=p.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},s)=>{const{control:o,value:i,disabled:a,checked:c,required:u,setControl:f,setChecked:m,hasConsumerStoppedPropagationRef:g,isFormControl:d,bubbleInput:v}=xs(bi,e),h=pe(s,f),y=p.useRef(c);return p.useEffect(()=>{const x=o==null?void 0:o.form;if(x){const w=()=>m(y.current);return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[o,m]),l.jsx(oe.button,{type:"button",role:"checkbox","aria-checked":lt(c)?"mixed":c,"aria-required":u,"data-state":ji(c),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:h,onKeyDown:G(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:G(n,x=>{m(w=>lt(w)?!0:!w),v&&d&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})})});Ri.displayName=bi;var Ei=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:o,required:i,disabled:a,value:c,onCheckedChange:u,form:f,...m}=e;return l.jsx(Ac,{__scopeCheckbox:n,checked:s,defaultChecked:o,disabled:a,required:i,onCheckedChange:u,name:r,form:f,value:c,internal_do_not_use_render:({isFormControl:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Ri,{...m,ref:t,__scopeCheckbox:n}),g&&l.jsx(Ai,{__scopeCheckbox:n})]})})});Ei.displayName=zn;var Mi="CheckboxIndicator",Ni=p.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,o=xs(Mi,n);return l.jsx(Rt,{present:r||lt(o.checked)||o.checked===!0,children:l.jsx(oe.span,{"data-state":ji(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});Ni.displayName=Mi;var Ti="CheckboxBubbleInput",Ai=p.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:o,defaultChecked:i,required:a,disabled:c,name:u,value:f,form:m,bubbleInput:g,setBubbleInput:d}=xs(Ti,e),v=pe(n,d),h=Sc(o),y=Si(r);p.useEffect(()=>{const w=g;if(!w)return;const _=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(_,"checked").set,N=!s.current;if(h!==o&&C){const R=new Event("click",{bubbles:N});w.indeterminate=lt(o),C.call(w,lt(o)?!1:o),w.dispatchEvent(R)}},[g,h,o,s]);const x=p.useRef(lt(o)?!1:o);return l.jsx(oe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:a,disabled:c,name:u,value:f,form:m,...t,tabIndex:-1,ref:v,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ai.displayName=Ti;function jc(e){return typeof e=="function"}function lt(e){return e==="indeterminate"}function ji(e){return lt(e)?"indeterminate":e?"checked":"unchecked"}/**
10
10
  * @license lucide-react v0.507.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
@@ -41,7 +41,7 @@ import{r as Pl,a as p,R as Fe,j as l,b as ci,u as pe,g as Ol,c as Fl,d as Nn,e a
41
41
  *
42
42
  * This source code is licensed under the ISC license.
43
43
  * See the LICENSE file in the root directory of this source tree.
44
- */const zc=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Pi=St("wifi",zc);function ys({className:e,...t}){return l.jsx(Ei,{"data-slot":"checkbox",className:ue("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:l.jsx(Ni,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:l.jsx(ki,{className:"size-3.5"})})})}function Gc({id:e,label:t,description:n,isEnabled:r,onToggle:s}){return l.jsx("div",{children:l.jsxs("div",{className:"items-top flex space-x-2",children:[l.jsx(ys,{id:e,checked:r,onCheckedChange:o=>s(o===!0)}),l.jsxs("div",{className:"grid gap-1.5 leading-none",children:[l.jsx("label",{htmlFor:e,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})]})})}function no({title:e,description:t,tools:n,onToolToggle:r}){return l.jsxs(Ze,{className:"w-full",children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:e}),l.jsx(Ct,{children:t})]}),l.jsx(Ye,{children:l.jsx("div",{className:"grid grid-cols-2 gap-6 mb-6",children:Object.entries(n).map(([s,o])=>l.jsx(Gc,{id:o.id,label:o.label,description:o.description,isEnabled:o.settings.enabled,onToggle:i=>{r(o.id,i)}},s))})})]})}function Hr({className:e,type:t,...n}){return l.jsx("input",{type:t,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}var Bc="Label",Oi=p.forwardRef((e,t)=>l.jsx(se.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Oi.displayName=Bc;var Uc=Oi;function Wc({className:e,...t}){return l.jsx(Uc,{"data-slot":"label",className:ue("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function qc({spaceNames:e,spaceSubdomains:t,enabledSpaces:n,onSpaceToolToggle:r,onSpaceToolNameChange:s,onSpaceToolSubdomainChange:o}){const i=[0,1,2];return l.jsxs(Ze,{className:"w-full",children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"🚀 Gradio Spaces"}),l.jsxs(Ct,{children:["Configure up to 3 Gradio spaces for remote tool access. Edit the name and subdomain fields.",l.jsx("span",{className:"font-semibold",children:" Note: Changes may require reconnecting your MCP client."})]})]}),l.jsx(Ye,{children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center space-x-3 pb-2 border-b",children:[l.jsx("div",{className:"w-6"})," ",l.jsx("div",{className:"text-sm font-medium min-w-[80px]",children:"Space"}),l.jsx("div",{className:"flex-1 text-sm font-medium",children:"Name"}),l.jsx("div",{className:"flex-1 text-sm font-medium",children:"Subdomain"})]}),i.map(a=>l.jsxs("div",{className:"flex items-center space-x-3",children:[l.jsx(ys,{id:`space-tool-${a}`,checked:n[a]||!1,onCheckedChange:c=>r(a,c===!0)}),l.jsx(Wc,{htmlFor:`space-tool-${a}`,className:"text-sm font-medium min-w-[80px]",children:a+1}),l.jsx(Hr,{placeholder:"username/space-name",value:e[a]||"",onChange:c=>s(a,c.target.value),className:"flex-1 text-sm"}),l.jsx(Hr,{placeholder:"username-space-name",value:t[a]||"",onChange:c=>o(a,c.target.value),className:"flex-1 text-sm"})]},a))]})})]})}const Zc=ui("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Kc({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:ue(Zc({variant:t}),e),...n})}function Xc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:ue("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Yc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:ue("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}const Jc=ui("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",success:"border-transparent bg-green-100 text-green-800 [a&]:hover:bg-green-100/90"}},defaultVariants:{variant:"default"}});function xt({className:e,variant:t,asChild:n=!1,...r}){const s=n?Dl:"span";return l.jsx(s,{"data-slot":"badge",className:ue(Jc({variant:t}),e),...r})}var Qc="Separator",ro="horizontal",eu=["horizontal","vertical"],Fi=p.forwardRef((e,t)=>{const{decorative:n,orientation:r=ro,...s}=e,o=tu(r)?r:ro,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(se.div,{"data-orientation":o,...a,...s,ref:t})});Fi.displayName=Qc;function tu(e){return eu.includes(e)}var nu=Fi;function yt({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(nu,{"data-slot":"separator",decorative:n,orientation:t,className:ue("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}/**
44
+ */const zc=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Pi=St("wifi",zc);function ys({className:e,...t}){return l.jsx(Ei,{"data-slot":"checkbox",className:ue("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:l.jsx(Ni,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:l.jsx(ki,{className:"size-3.5"})})})}function Gc({id:e,label:t,description:n,isEnabled:r,onToggle:s}){return l.jsx("div",{children:l.jsxs("div",{className:"items-top flex space-x-2",children:[l.jsx(ys,{id:e,checked:r,onCheckedChange:o=>s(o===!0)}),l.jsxs("div",{className:"grid gap-1.5 leading-none",children:[l.jsx("label",{htmlFor:e,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:t}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})]})})}function no({title:e,description:t,tools:n,onToolToggle:r}){return l.jsxs(Ze,{className:"w-full",children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:e}),l.jsx(Ct,{children:t})]}),l.jsx(Ye,{children:l.jsx("div",{className:"grid grid-cols-2 gap-6 mb-6",children:Object.entries(n).map(([s,o])=>l.jsx(Gc,{id:o.id,label:o.label,description:o.description,isEnabled:o.settings.enabled,onToggle:i=>{r(o.id,i)}},s))})})]})}function Hr({className:e,type:t,...n}){return l.jsx("input",{type:t,"data-slot":"input",className:ue("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...n})}var Bc="Label",Oi=p.forwardRef((e,t)=>l.jsx(oe.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Oi.displayName=Bc;var Uc=Oi;function Wc({className:e,...t}){return l.jsx(Uc,{"data-slot":"label",className:ue("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function qc({spaceNames:e,spaceSubdomains:t,enabledSpaces:n,onSpaceToolToggle:r,onSpaceToolNameChange:s,onSpaceToolSubdomainChange:o}){const i=[0,1,2];return l.jsxs(Ze,{className:"w-full",children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"🚀 Gradio Spaces"}),l.jsxs(Ct,{children:["Configure up to 3 Gradio spaces for remote tool access. Edit the name and subdomain fields.",l.jsx("span",{className:"font-semibold",children:" Note: Changes may require reconnecting your MCP client."})]})]}),l.jsx(Ye,{children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center space-x-3 pb-2 border-b",children:[l.jsx("div",{className:"w-6"})," ",l.jsx("div",{className:"text-sm font-medium min-w-[80px]",children:"Space"}),l.jsx("div",{className:"flex-1 text-sm font-medium",children:"Name"}),l.jsx("div",{className:"flex-1 text-sm font-medium",children:"Subdomain"})]}),i.map(a=>l.jsxs("div",{className:"flex items-center space-x-3",children:[l.jsx(ys,{id:`space-tool-${a}`,checked:n[a]||!1,onCheckedChange:c=>r(a,c===!0)}),l.jsx(Wc,{htmlFor:`space-tool-${a}`,className:"text-sm font-medium min-w-[80px]",children:a+1}),l.jsx(Hr,{placeholder:"username/space-name",value:e[a]||"",onChange:c=>s(a,c.target.value),className:"flex-1 text-sm"}),l.jsx(Hr,{placeholder:"username-space-name",value:t[a]||"",onChange:c=>o(a,c.target.value),className:"flex-1 text-sm"})]},a))]})})]})}const Zc=ui("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Kc({className:e,variant:t,...n}){return l.jsx("div",{"data-slot":"alert",role:"alert",className:ue(Zc({variant:t}),e),...n})}function Xc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-title",className:ue("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function Yc({className:e,...t}){return l.jsx("div",{"data-slot":"alert-description",className:ue("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}const Jc=ui("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",success:"border-transparent bg-green-100 text-green-800 [a&]:hover:bg-green-100/90"}},defaultVariants:{variant:"default"}});function xt({className:e,variant:t,asChild:n=!1,...r}){const s=n?Dl:"span";return l.jsx(s,{"data-slot":"badge",className:ue(Jc({variant:t}),e),...r})}var Qc="Separator",ro="horizontal",eu=["horizontal","vertical"],Fi=p.forwardRef((e,t)=>{const{decorative:n,orientation:r=ro,...s}=e,o=tu(r)?r:ro,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return l.jsx(oe.div,{"data-orientation":o,...a,...s,ref:t})});Fi.displayName=Qc;function tu(e){return eu.includes(e)}var nu=Fi;function yt({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(nu,{"data-slot":"separator",decorative:n,orientation:t,className:ue("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}/**
45
45
  * table-core
46
46
  *
47
47
  * Copyright (c) TanStack
@@ -62,7 +62,7 @@ import{r as Pl,a as p,R as Fe,j as l,b as ci,u as pe,g as Ol,c as Fl,d as Nn,e a
62
62
  * LICENSE.md file in the root directory of this source tree.
63
63
  *
64
64
  * @license MIT
65
- */function io(e,t){return e?Xu(e)?p.createElement(e,t):e:null}function Xu(e){return Yu(e)||typeof e=="function"||Ju(e)}function Yu(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Ju(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Qu(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=p.useState(()=>({current:Hu(t)})),[r,s]=p.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:i=>{s(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}function Wi(e){const t=e+"CollectionProvider",[n,r]=bt(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:y,children:x}=h,w=Fe.useRef(null),_=Fe.useRef(new Map).current;return l.jsx(s,{scope:y,itemMap:_,collectionRef:w,children:x})};i.displayName=t;const a=e+"CollectionSlot",c=Nn(a),u=Fe.forwardRef((h,y)=>{const{scope:x,children:w}=h,_=o(a,x),S=pe(y,_.collectionRef);return l.jsx(c,{ref:S,children:w})});u.displayName=a;const f=e+"CollectionItemSlot",m="data-radix-collection-item",g=Nn(f),d=Fe.forwardRef((h,y)=>{const{scope:x,children:w,..._}=h,S=Fe.useRef(null),C=pe(y,S),N=o(f,x);return Fe.useEffect(()=>(N.itemMap.set(S,{ref:S,..._}),()=>void N.itemMap.delete(S))),l.jsx(g,{[m]:"",ref:C,children:w})});d.displayName=f;function v(h){const y=o(e+"CollectionConsumer",h);return Fe.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const _=Array.from(w.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((N,R)=>_.indexOf(N.ref.current)-_.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:u,ItemSlot:d},v,r]}var ed=p.createContext(void 0);function bs(e){const t=p.useContext(ed);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function td(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var nd="DismissableLayer",qr="dismissableLayer.update",rd="dismissableLayer.pointerDownOutside",sd="dismissableLayer.focusOutside",ao,qi=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zi=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=p.useContext(qi),[f,m]=p.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=p.useState({}),v=pe(t,R=>m(R)),h=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=h.indexOf(y),w=f?h.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=x,C=ad(R=>{const M=R.target,z=[...u.branches].some(F=>F.contains(M));!S||z||(s==null||s(R),i==null||i(R),R.defaultPrevented||a==null||a())},g),N=ld(R=>{const M=R.target;[...u.branches].some(F=>F.contains(M))||(o==null||o(R),i==null||i(R),R.defaultPrevented||a==null||a())},g);return td(R=>{w===u.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},g),p.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ao=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),lo(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=ao)}},[f,g,n,u]),p.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),lo())},[f,u]),p.useEffect(()=>{const R=()=>d({});return document.addEventListener(qr,R),()=>document.removeEventListener(qr,R)},[]),l.jsx(se.div,{...c,ref:v,style:{pointerEvents:_?S?"auto":"none":void 0,...e.style},onFocusCapture:G(e.onFocusCapture,N.onFocusCapture),onBlurCapture:G(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,C.onPointerDownCapture)})});Zi.displayName=nd;var od="DismissableLayerBranch",id=p.forwardRef((e,t)=>{const n=p.useContext(qi),r=p.useRef(null),s=pe(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(se.div,{...e,ref:s})});id.displayName=od;function ad(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){Ki(rd,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ld(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1);return p.useEffect(()=>{const s=o=>{o.target&&!r.current&&Ki(sd,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function lo(){const e=new CustomEvent(qr);document.dispatchEvent(e)}function Ki(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Ci(s,o):s.dispatchEvent(o)}var wr=0;function cd(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??co()),document.body.insertAdjacentElement("beforeend",e[1]??co()),wr++,()=>{wr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),wr--}},[])}function co(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var _r="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",uo={bubbles:!1,cancelable:!0},ud="FocusScope",Xi=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=p.useState(null),u=Je(s),f=Je(o),m=p.useRef(null),g=pe(t,h=>c(h)),d=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let h=function(_){if(d.paused||!a)return;const S=_.target;a.contains(S)?m.current=S:rt(m.current,{select:!0})},y=function(_){if(d.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||rt(m.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&rt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const w=new MutationObserver(x);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),w.disconnect()}}},[r,a,d.paused]),p.useEffect(()=>{if(a){go.add(d);const h=document.activeElement;if(!a.contains(h)){const x=new CustomEvent(_r,uo);a.addEventListener(_r,u),a.dispatchEvent(x),x.defaultPrevented||(dd(pd(Yi(a)),{select:!0}),document.activeElement===h&&rt(a))}return()=>{a.removeEventListener(_r,u),setTimeout(()=>{const x=new CustomEvent(Sr,uo);a.addEventListener(Sr,f),a.dispatchEvent(x),x.defaultPrevented||rt(h??document.body,{select:!0}),a.removeEventListener(Sr,f),go.remove(d)},0)}}},[a,u,f,d]);const v=p.useCallback(h=>{if(!n&&!r||d.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,x=document.activeElement;if(y&&x){const w=h.currentTarget,[_,S]=fd(w);_&&S?!h.shiftKey&&x===S?(h.preventDefault(),n&&rt(_,{select:!0})):h.shiftKey&&x===_&&(h.preventDefault(),n&&rt(S,{select:!0})):x===w&&h.preventDefault()}},[n,r,d.paused]);return l.jsx(se.div,{tabIndex:-1,...i,ref:g,onKeyDown:v})});Xi.displayName=ud;function dd(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(rt(r,{select:t}),document.activeElement!==n)return}function fd(e){const t=Yi(e),n=fo(t,e),r=fo(t.reverse(),e);return[n,r]}function Yi(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fo(e,t){for(const n of e)if(!gd(n,{upTo:t}))return n}function gd(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function md(e){return e instanceof HTMLInputElement&&"select"in e}function rt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&md(e)&&t&&e.select()}}var go=hd();function hd(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=mo(e,t),e.unshift(t)},remove(t){var n;e=mo(e,t),(n=e[0])==null||n.resume()}}}function mo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pd(e){return e.filter(t=>t.tagName!=="A")}var vd=ci[" useId ".trim().toString()]||(()=>{}),xd=0;function Tn(e){const[t,n]=p.useState(vd());return dt(()=>{n(r=>r??String(xd++))},[e]),e||(t?`radix-${t}`:"")}const yd=["top","right","bottom","left"],gt=Math.min,Se=Math.max,An=Math.round,xn=Math.floor,Ve=e=>({x:e,y:e}),wd={left:"right",right:"left",bottom:"top",top:"bottom"},_d={start:"end",end:"start"};function Zr(e,t,n){return Se(e,gt(t,n))}function Qe(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function Gt(e){return e.split("-")[1]}function Rs(e){return e==="x"?"y":"x"}function Es(e){return e==="y"?"height":"width"}const Sd=new Set(["top","bottom"]);function Le(e){return Sd.has(et(e))?"y":"x"}function Ms(e){return Rs(Le(e))}function Cd(e,t,n){n===void 0&&(n=!1);const r=Gt(e),s=Ms(e),o=Es(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=jn(i)),[i,jn(i)]}function bd(e){const t=jn(e);return[Kr(e),t,Kr(t)]}function Kr(e){return e.replace(/start|end/g,t=>_d[t])}const ho=["left","right"],po=["right","left"],Rd=["top","bottom"],Ed=["bottom","top"];function Md(e,t,n){switch(e){case"top":case"bottom":return n?t?po:ho:t?ho:po;case"left":case"right":return t?Rd:Ed;default:return[]}}function Nd(e,t,n,r){const s=Gt(e);let o=Md(et(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Kr)))),o}function jn(e){return e.replace(/left|right|bottom|top/g,t=>wd[t])}function Td(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ji(e){return typeof e!="number"?Td(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function vo(e,t,n){let{reference:r,floating:s}=e;const o=Le(t),i=Ms(t),a=Es(i),c=et(t),u=o==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let d;switch(c){case"top":d={x:f,y:r.y-s.height};break;case"bottom":d={x:f,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:m};break;case"left":d={x:r.x-s.width,y:m};break;default:d={x:r.x,y:r.y}}switch(Gt(t)){case"start":d[i]-=g*(n&&u?-1:1);break;case"end":d[i]+=g*(n&&u?-1:1);break}return d}const Ad=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:m}=vo(u,r,c),g=r,d={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:x}=a[h],{x:w,y:_,data:S,reset:C}=await x({x:f,y:m,initialPlacement:r,placement:g,strategy:s,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});f=w??f,m=_??m,d={...d,[y]:{...d[y],...S}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:m}=vo(u,g,c)),h=-1)}return{x:f,y:m,placement:g,strategy:s,middlewareData:d}};async function Qt(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:d=0}=Qe(t,e),v=Ji(d),y=a[g?m==="floating"?"reference":"floating":m],x=kn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),w=m==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),S=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},C=kn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:_,strategy:c}):w);return{top:(x.top-C.top+v.top)/S.y,bottom:(C.bottom-x.bottom+v.bottom)/S.y,left:(x.left-C.left+v.left)/S.x,right:(C.right-x.right+v.right)/S.x}}const jd=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:f=0}=Qe(e,t)||{};if(u==null)return{};const m=Ji(f),g={x:n,y:r},d=Ms(s),v=Es(d),h=await i.getDimensions(u),y=d==="y",x=y?"top":"left",w=y?"bottom":"right",_=y?"clientHeight":"clientWidth",S=o.reference[v]+o.reference[d]-g[d]-o.floating[v],C=g[d]-o.reference[d],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let R=N?N[_]:0;(!R||!await(i.isElement==null?void 0:i.isElement(N)))&&(R=a.floating[_]||o.floating[v]);const M=S/2-C/2,z=R/2-h[v]/2-1,F=gt(m[x],z),Z=gt(m[w],z),Q=F,U=R-h[v]-Z,D=R/2-h[v]/2+M,ne=Zr(Q,D,U),W=!c.arrow&&Gt(s)!=null&&D!==ne&&o.reference[v]/2-(D<Q?F:Z)-h[v]/2<0,ee=W?D<Q?D-Q:D-U:0;return{[d]:g[d]+ee,data:{[d]:ne,centerOffset:D-ne-ee,...W&&{alignmentOffset:ee}},reset:W}}}),kd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=Qe(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const x=et(s),w=Le(a),_=et(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=g||(_||!h?[jn(a)]:bd(a)),N=v!=="none";!g&&N&&C.push(...Nd(a,h,v,S));const R=[a,...C],M=await Qt(t,y),z=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&z.push(M[x]),m){const D=Cd(s,i,S);z.push(M[D[0]],M[D[1]])}if(F=[...F,{placement:s,overflows:z}],!z.every(D=>D<=0)){var Z,Q;const D=(((Z=o.flip)==null?void 0:Z.index)||0)+1,ne=R[D];if(ne&&(!(m==="alignment"?w!==Le(ne):!1)||F.every(I=>Le(I.placement)===w?I.overflows[0]>0:!0)))return{data:{index:D,overflows:F},reset:{placement:ne}};let W=(Q=F.filter(ee=>ee.overflows[0]<=0).sort((ee,I)=>ee.overflows[1]-I.overflows[1])[0])==null?void 0:Q.placement;if(!W)switch(d){case"bestFit":{var U;const ee=(U=F.filter(I=>{if(N){const E=Le(I.placement);return E===w||E==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(E=>E>0).reduce((E,L)=>E+L,0)]).sort((I,E)=>I[1]-E[1])[0])==null?void 0:U[0];ee&&(W=ee);break}case"initialPlacement":W=a;break}if(s!==W)return{reset:{placement:W}}}return{}}}};function xo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function yo(e){return yd.some(t=>e[t]>=0)}const Id=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Qe(e,t);switch(r){case"referenceHidden":{const o=await Qt(t,{...s,elementContext:"reference"}),i=xo(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:yo(i)}}}case"escaped":{const o=await Qt(t,{...s,altBoundary:!0}),i=xo(o,n.floating);return{data:{escapedOffsets:i,escaped:yo(i)}}}default:return{}}}}},Qi=new Set(["left","top"]);async function Pd(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=et(n),a=Gt(n),c=Le(n)==="y",u=Qi.has(i)?-1:1,f=o&&c?-1:1,m=Qe(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return a&&typeof v=="number"&&(d=a==="end"?v*-1:v),c?{x:d*f,y:g*u}:{x:g*u,y:d*f}}const Od=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await Pd(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},Fd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x,y:w}=y;return{x,y:w}}},...c}=Qe(e,t),u={x:n,y:r},f=await Qt(t,c),m=Le(et(s)),g=Rs(m);let d=u[g],v=u[m];if(o){const y=g==="y"?"top":"left",x=g==="y"?"bottom":"right",w=d+f[y],_=d-f[x];d=Zr(w,d,_)}if(i){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",w=v+f[y],_=v-f[x];v=Zr(w,v,_)}const h=a.fn({...t,[g]:d,[m]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[g]:o,[m]:i}}}}}},Dd=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Qe(e,t),f={x:n,y:r},m=Le(s),g=Rs(m);let d=f[g],v=f[m];const h=Qe(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const _=g==="y"?"height":"width",S=o.reference[g]-o.floating[_]+y.mainAxis,C=o.reference[g]+o.reference[_]-y.mainAxis;d<S?d=S:d>C&&(d=C)}if(u){var x,w;const _=g==="y"?"width":"height",S=Qi.has(et(s)),C=o.reference[m]-o.floating[_]+(S&&((x=i.offset)==null?void 0:x[m])||0)+(S?0:y.crossAxis),N=o.reference[m]+o.reference[_]+(S?0:((w=i.offset)==null?void 0:w[m])||0)-(S?y.crossAxis:0);v<C?v=C:v>N&&(v=N)}return{[g]:d,[m]:v}}}},$d=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:c=()=>{},...u}=Qe(e,t),f=await Qt(t,u),m=et(s),g=Gt(s),d=Le(s)==="y",{width:v,height:h}=o.floating;let y,x;m==="top"||m==="bottom"?(y=m,x=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(x=m,y=g==="end"?"top":"bottom");const w=h-f.top-f.bottom,_=v-f.left-f.right,S=gt(h-f[y],w),C=gt(v-f[x],_),N=!t.middlewareData.shift;let R=S,M=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=w),N&&!g){const F=Se(f.left,0),Z=Se(f.right,0),Q=Se(f.top,0),U=Se(f.bottom,0);d?M=v-2*(F!==0||Z!==0?F+Z:Se(f.left,f.right)):R=h-2*(Q!==0||U!==0?Q+U:Se(f.top,f.bottom))}await c({...t,availableWidth:M,availableHeight:R});const z=await i.getDimensions(a.floating);return v!==z.width||h!==z.height?{reset:{rects:!0}}:{}}}};function Bn(){return typeof window<"u"}function Bt(e){return ea(e)?(e.nodeName||"").toLowerCase():"#document"}function Ce(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ge(e){var t;return(t=(ea(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ea(e){return Bn()?e instanceof Node||e instanceof Ce(e).Node:!1}function Pe(e){return Bn()?e instanceof Element||e instanceof Ce(e).Element:!1}function ze(e){return Bn()?e instanceof HTMLElement||e instanceof Ce(e).HTMLElement:!1}function wo(e){return!Bn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ce(e).ShadowRoot}const Ld=new Set(["inline","contents"]);function an(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ld.has(s)}const Vd=new Set(["table","td","th"]);function Hd(e){return Vd.has(Bt(e))}const zd=[":popover-open",":modal"];function Un(e){return zd.some(t=>{try{return e.matches(t)}catch{return!1}})}const Gd=["transform","translate","scale","rotate","perspective"],Bd=["transform","translate","scale","rotate","perspective","filter"],Ud=["paint","layout","strict","content"];function Ns(e){const t=Ts(),n=Pe(e)?Oe(e):e;return Gd.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Bd.some(r=>(n.willChange||"").includes(r))||Ud.some(r=>(n.contain||"").includes(r))}function Wd(e){let t=mt(e);for(;ze(t)&&!Dt(t);){if(Ns(t))return t;if(Un(t))return null;t=mt(t)}return null}function Ts(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const qd=new Set(["html","body","#document"]);function Dt(e){return qd.has(Bt(e))}function Oe(e){return Ce(e).getComputedStyle(e)}function Wn(e){return Pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mt(e){if(Bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wo(e)&&e.host||Ge(e);return wo(t)?t.host:t}function ta(e){const t=mt(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ze(t)&&an(t)?t:ta(t)}function en(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ta(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ce(s);if(o){const a=Xr(i);return t.concat(i,i.visualViewport||[],an(s)?s:[],a&&n?en(a):[])}return t.concat(s,en(s,[],n))}function Xr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function na(e){const t=Oe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=ze(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=An(n)!==o||An(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function As(e){return Pe(e)?e:e.contextElement}function Ot(e){const t=As(e);if(!ze(t))return Ve(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=na(t);let i=(o?An(n.width):n.width)/r,a=(o?An(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Zd=Ve(0);function ra(e){const t=Ce(e);return!Ts()||!t.visualViewport?Zd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Kd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ce(e)?!1:t}function wt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=As(e);let i=Ve(1);t&&(r?Pe(r)&&(i=Ot(r)):i=Ot(e));const a=Kd(o,n,r)?ra(o):Ve(0);let c=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,f=s.width/i.x,m=s.height/i.y;if(o){const g=Ce(o),d=r&&Pe(r)?Ce(r):r;let v=g,h=Xr(v);for(;h&&r&&d!==v;){const y=Ot(h),x=h.getBoundingClientRect(),w=Oe(h),_=x.left+(h.clientLeft+parseFloat(w.paddingLeft))*y.x,S=x.top+(h.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,u*=y.y,f*=y.x,m*=y.y,c+=_,u+=S,v=Ce(h),h=Xr(v)}}return kn({width:f,height:m,x:c,y:u})}function qn(e,t){const n=Wn(e).scrollLeft;return t?t.left+n:wt(Ge(e)).left+n}function sa(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-qn(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Xd(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=Ge(r),a=t?Un(t.floating):!1;if(r===i||a&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Ve(1);const f=Ve(0),m=ze(r);if((m||!m&&!o)&&((Bt(r)!=="body"||an(i))&&(c=Wn(r)),ze(r))){const d=wt(r);u=Ot(r),f.x=d.x+r.clientLeft,f.y=d.y+r.clientTop}const g=i&&!m&&!o?sa(i,c):Ve(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-c.scrollTop*u.y+f.y+g.y}}function Yd(e){return Array.from(e.getClientRects())}function Jd(e){const t=Ge(e),n=Wn(e),r=e.ownerDocument.body,s=Se(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Se(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+qn(e);const a=-n.scrollTop;return Oe(r).direction==="rtl"&&(i+=Se(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const _o=25;function Qd(e,t){const n=Ce(e),r=Ge(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const f=Ts();(!f||f&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const u=qn(r);if(u<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),d=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-d);v<=_o&&(o-=v)}else u<=_o&&(o+=u);return{width:o,height:i,x:a,y:c}}const ef=new Set(["absolute","fixed"]);function tf(e,t){const n=wt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=ze(e)?Ot(e):Ve(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:i,height:a,x:c,y:u}}function So(e,t,n){let r;if(t==="viewport")r=Qd(e,n);else if(t==="document")r=Jd(Ge(e));else if(Pe(t))r=tf(t,n);else{const s=ra(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return kn(r)}function oa(e,t){const n=mt(e);return n===t||!Pe(n)||Dt(n)?!1:Oe(n).position==="fixed"||oa(n,t)}function nf(e,t){const n=t.get(e);if(n)return n;let r=en(e,[],!1).filter(a=>Pe(a)&&Bt(a)!=="body"),s=null;const o=Oe(e).position==="fixed";let i=o?mt(e):e;for(;Pe(i)&&!Dt(i);){const a=Oe(i),c=Ns(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&ef.has(s.position)||an(i)&&!c&&oa(e,i))?r=r.filter(f=>f!==i):s=a,i=mt(i)}return t.set(e,r),r}function rf(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Un(t)?[]:nf(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,f)=>{const m=So(t,f,s);return u.top=Se(m.top,u.top),u.right=gt(m.right,u.right),u.bottom=gt(m.bottom,u.bottom),u.left=Se(m.left,u.left),u},So(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sf(e){const{width:t,height:n}=na(e);return{width:t,height:n}}function of(e,t,n){const r=ze(t),s=Ge(t),o=n==="fixed",i=wt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Ve(0);function u(){c.x=qn(s)}if(r||!r&&!o)if((Bt(t)!=="body"||an(s))&&(a=Wn(t)),r){const d=wt(t,!0,o,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else s&&u();o&&!r&&s&&u();const f=s&&!r&&!o?sa(s,a):Ve(0),m=i.left+a.scrollLeft-c.x-f.x,g=i.top+a.scrollTop-c.y-f.y;return{x:m,y:g,width:i.width,height:i.height}}function Cr(e){return Oe(e).position==="static"}function Co(e,t){if(!ze(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ge(e)===n&&(n=n.ownerDocument.body),n}function ia(e,t){const n=Ce(e);if(Un(e))return n;if(!ze(e)){let s=mt(e);for(;s&&!Dt(s);){if(Pe(s)&&!Cr(s))return s;s=mt(s)}return n}let r=Co(e,t);for(;r&&Hd(r)&&Cr(r);)r=Co(r,t);return r&&Dt(r)&&Cr(r)&&!Ns(r)?n:r||Wd(e)||n}const af=async function(e){const t=this.getOffsetParent||ia,n=this.getDimensions,r=await n(e.floating);return{reference:of(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lf(e){return Oe(e).direction==="rtl"}const cf={convertOffsetParentRelativeRectToViewportRelativeRect:Xd,getDocumentElement:Ge,getClippingRect:rf,getOffsetParent:ia,getElementRects:af,getClientRects:Yd,getDimensions:sf,getScale:Ot,isElement:Pe,isRTL:lf};function aa(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uf(e,t){let n=null,r;const s=Ge(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:f,top:m,width:g,height:d}=u;if(a||t(),!g||!d)return;const v=xn(m),h=xn(s.clientWidth-(f+g)),y=xn(s.clientHeight-(m+d)),x=xn(f),_={rootMargin:-v+"px "+-h+"px "+-y+"px "+-x+"px",threshold:Se(0,gt(1,c))||1};let S=!0;function C(N){const R=N[0].intersectionRatio;if(R!==c){if(!S)return i();R?i(!1,R):r=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!aa(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,_)}n.observe(e)}return i(!0),o}function df(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=As(e),f=s||o?[...u?en(u):[],...en(t)]:[];f.forEach(x=>{s&&x.addEventListener("scroll",n,{passive:!0}),o&&x.addEventListener("resize",n)});const m=u&&a?uf(u,n):null;let g=-1,d=null;i&&(d=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=d)==null||_.observe(t)})),n()}),u&&!c&&d.observe(u),d.observe(t));let v,h=c?wt(e):null;c&&y();function y(){const x=wt(e);h&&!aa(h,x)&&n(),h=x,v=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(w=>{s&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),m==null||m(),(x=d)==null||x.disconnect(),d=null,c&&cancelAnimationFrame(v)}}const ff=Od,gf=Fd,mf=kd,hf=$d,pf=Id,bo=jd,vf=Dd,xf=(e,t,n)=>{const r=new Map,s={platform:cf,...n},o={...s.platform,_c:r};return Ad(e,t,{...s,platform:o})};var yf=typeof document<"u",wf=function(){},Rn=yf?p.useLayoutEffect:wf;function In(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!In(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!In(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function la(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ro(e,t){const n=la(e);return Math.round(t*n)/n}function br(e){const t=p.useRef(e);return Rn(()=>{t.current=e}),t}function _f(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,m]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=p.useState(r);In(g,r)||d(r);const[v,h]=p.useState(null),[y,x]=p.useState(null),w=p.useCallback(I=>{I!==N.current&&(N.current=I,h(I))},[]),_=p.useCallback(I=>{I!==R.current&&(R.current=I,x(I))},[]),S=o||v,C=i||y,N=p.useRef(null),R=p.useRef(null),M=p.useRef(f),z=c!=null,F=br(c),Z=br(s),Q=br(u),U=p.useCallback(()=>{if(!N.current||!R.current)return;const I={placement:t,strategy:n,middleware:g};Z.current&&(I.platform=Z.current),xf(N.current,R.current,I).then(E=>{const L={...E,isPositioned:Q.current!==!1};D.current&&!In(M.current,L)&&(M.current=L,vs.flushSync(()=>{m(L)}))})},[g,t,n,Z,Q]);Rn(()=>{u===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,m(I=>({...I,isPositioned:!1})))},[u]);const D=p.useRef(!1);Rn(()=>(D.current=!0,()=>{D.current=!1}),[]),Rn(()=>{if(S&&(N.current=S),C&&(R.current=C),S&&C){if(F.current)return F.current(S,C,U);U()}},[S,C,U,F,z]);const ne=p.useMemo(()=>({reference:N,floating:R,setReference:w,setFloating:_}),[w,_]),W=p.useMemo(()=>({reference:S,floating:C}),[S,C]),ee=p.useMemo(()=>{const I={position:n,left:0,top:0};if(!W.floating)return I;const E=Ro(W.floating,f.x),L=Ro(W.floating,f.y);return a?{...I,transform:"translate("+E+"px, "+L+"px)",...la(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:E,top:L}},[n,a,W.floating,f.x,f.y]);return p.useMemo(()=>({...f,update:U,refs:ne,elements:W,floatingStyles:ee}),[f,U,ne,W,ee])}const Sf=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?bo({element:r.current,padding:s}).fn(n):{}:r?bo({element:r,padding:s}).fn(n):{}}}},Cf=(e,t)=>({...ff(e),options:[e,t]}),bf=(e,t)=>({...gf(e),options:[e,t]}),Rf=(e,t)=>({...vf(e),options:[e,t]}),Ef=(e,t)=>({...mf(e),options:[e,t]}),Mf=(e,t)=>({...hf(e),options:[e,t]}),Nf=(e,t)=>({...pf(e),options:[e,t]}),Tf=(e,t)=>({...Sf(e),options:[e,t]});var Af="Arrow",ca=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return l.jsx(se.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});ca.displayName=Af;var jf=ca,js="Popper",[ua,da]=bt(js),[kf,fa]=ua(js),ga=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return l.jsx(kf,{scope:t,anchor:r,onAnchorChange:s,children:n})};ga.displayName=js;var ma="PopperAnchor",ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=fa(ma,n),i=p.useRef(null),a=pe(t,i),c=p.useRef(null);return p.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&o.onAnchorChange(c.current)}),r?null:l.jsx(se.div,{...s,ref:a})});ha.displayName=ma;var ks="PopperContent",[If,Pf]=ua(ks),pa=p.forwardRef((e,t)=>{var Me,vt,we,ke,Wt,nr;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:d="optimized",onPlaced:v,...h}=e,y=fa(ks,n),[x,w]=p.useState(null),_=pe(t,q=>w(q)),[S,C]=p.useState(null),N=Si(S),R=(N==null?void 0:N.width)??0,M=(N==null?void 0:N.height)??0,z=r+(o!=="center"?"-"+o:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Z=Array.isArray(u)?u:[u],Q=Z.length>0,U={padding:F,boundary:Z.filter(Ff),altBoundary:Q},{refs:D,floatingStyles:ne,placement:W,isPositioned:ee,middlewareData:I}=_f({strategy:"fixed",placement:z,whileElementsMounted:(...q)=>df(...q,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[Cf({mainAxis:s+M,alignmentAxis:i}),c&&bf({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Rf():void 0,...U}),c&&Ef({...U}),Mf({...U,apply:({elements:q,rects:re,availableWidth:le,availableHeight:te})=>{const{width:_e,height:nt}=re.reference,ae=q.floating.style;ae.setProperty("--radix-popper-available-width",`${le}px`),ae.setProperty("--radix-popper-available-height",`${te}px`),ae.setProperty("--radix-popper-anchor-width",`${_e}px`),ae.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),S&&Tf({element:S,padding:a}),Df({arrowWidth:R,arrowHeight:M}),g&&Nf({strategy:"referenceHidden",...U})]}),[E,L]=ya(W),$=Je(v);dt(()=>{ee&&($==null||$())},[ee,$]);const K=(Me=I.arrow)==null?void 0:Me.x,de=(vt=I.arrow)==null?void 0:vt.y,je=((we=I.arrow)==null?void 0:we.centerOffset)!==0,[Ee,ye]=p.useState();return dt(()=>{x&&ye(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:ee?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ee,"--radix-popper-transform-origin":[(ke=I.transformOrigin)==null?void 0:ke.x,(Wt=I.transformOrigin)==null?void 0:Wt.y].join(" "),...((nr=I.hide)==null?void 0:nr.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(If,{scope:n,placedSide:E,onArrowChange:C,arrowX:K,arrowY:de,shouldHideArrow:je,children:l.jsx(se.div,{"data-side":E,"data-align":L,...h,ref:_,style:{...h.style,animation:ee?void 0:"none"}})})})});pa.displayName=ks;var va="PopperArrow",Of={top:"bottom",right:"left",bottom:"top",left:"right"},xa=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=Pf(va,r),i=Of[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(jf,{...s,ref:n,style:{...s.style,display:"block"}})})});xa.displayName=va;function Ff(e){return e!==null}var Df=e=>({name:"transformOrigin",options:e,fn(t){var y,x,w;const{placement:n,rects:r,middlewareData:s}=t,i=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,f]=ya(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((x=s.arrow)==null?void 0:x.x)??0)+a/2,d=(((w=s.arrow)==null?void 0:w.y)??0)+c/2;let v="",h="";return u==="bottom"?(v=i?m:`${g}px`,h=`${-c}px`):u==="top"?(v=i?m:`${g}px`,h=`${r.floating.height+c}px`):u==="right"?(v=`${-c}px`,h=i?m:`${d}px`):u==="left"&&(v=`${r.floating.width+c}px`,h=i?m:`${d}px`),{data:{x:v,y:h}}}});function ya(e){const[t,n="center"]=e.split("-");return[t,n]}var $f=ga,Lf=ha,Vf=pa,Hf=xa,zf="Portal",wa=p.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,o]=p.useState(!1);dt(()=>o(!0),[]);const i=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Ec.createPortal(l.jsx(se.div,{...r,ref:t}),i):null});wa.displayName=zf;var Rr="rovingFocusGroup.onEntryFocus",Gf={bubbles:!1,cancelable:!0},ln="RovingFocusGroup",[Yr,_a,Bf]=Wi(ln),[Uf,Zn]=bt(ln,[Bf]),[Wf,qf]=Uf(ln),Sa=p.forwardRef((e,t)=>l.jsx(Yr.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Yr.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Zf,{...e,ref:t})})}));Sa.displayName=ln;var Zf=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...m}=e,g=p.useRef(null),d=pe(t,g),v=bs(o),[h,y]=Hn({prop:i,defaultProp:a??null,onChange:c,caller:ln}),[x,w]=p.useState(!1),_=Je(u),S=_a(n),C=p.useRef(!1),[N,R]=p.useState(0);return p.useEffect(()=>{const M=g.current;if(M)return M.addEventListener(Rr,_),()=>M.removeEventListener(Rr,_)},[_]),l.jsx(Wf,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:h,onItemFocus:p.useCallback(M=>y(M),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>R(M=>M+1),[]),onFocusableItemRemove:p.useCallback(()=>R(M=>M-1),[]),children:l.jsx(se.div,{tabIndex:x||N===0?-1:0,"data-orientation":r,...m,ref:d,style:{outline:"none",...e.style},onMouseDown:G(e.onMouseDown,()=>{C.current=!0}),onFocus:G(e.onFocus,M=>{const z=!C.current;if(M.target===M.currentTarget&&z&&!x){const F=new CustomEvent(Rr,Gf);if(M.currentTarget.dispatchEvent(F),!F.defaultPrevented){const Z=S().filter(W=>W.focusable),Q=Z.find(W=>W.active),U=Z.find(W=>W.id===h),ne=[Q,U,...Z].filter(Boolean).map(W=>W.ref.current);Ra(ne,f)}}C.current=!1}),onBlur:G(e.onBlur,()=>w(!1))})})}),Ca="RovingFocusGroupItem",ba=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Tn(),u=o||c,f=qf(Ca,n),m=f.currentTabStopId===u,g=_a(n),{onFocusableItemAdd:d,onFocusableItemRemove:v,currentTabStopId:h}=f;return p.useEffect(()=>{if(r)return d(),()=>v()},[r,d,v]),l.jsx(Yr.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:l.jsx(se.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:G(e.onMouseDown,y=>{r?f.onItemFocus(u):y.preventDefault()}),onFocus:G(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:G(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=Yf(y,f.orientation,f.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=g().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")_.reverse();else if(x==="prev"||x==="next"){x==="prev"&&_.reverse();const S=_.indexOf(y.currentTarget);_=f.loop?Jf(_,S+1):_.slice(S+1)}setTimeout(()=>Ra(_))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});ba.displayName=Ca;var Kf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Yf(e,t,n){const r=Xf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Kf[r]}function Ra(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Jf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ea=Sa,Ma=ba,Qf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nt=new WeakMap,yn=new WeakMap,wn={},Er=0,Na=function(e){return e&&(e.host||Na(e.parentNode))},eg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Na(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},tg=function(e,t,n,r){var s=eg(t,Array.isArray(e)?e:[e]);wn[n]||(wn[n]=new WeakMap);var o=wn[n],i=[],a=new Set,c=new Set(s),u=function(m){!m||a.has(m)||(a.add(m),u(m.parentNode))};s.forEach(u);var f=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(g){if(a.has(g))f(g);else try{var d=g.getAttribute(r),v=d!==null&&d!=="false",h=(Nt.get(g)||0)+1,y=(o.get(g)||0)+1;Nt.set(g,h),o.set(g,y),i.push(g),h===1&&v&&yn.set(g,!0),y===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",g,x)}})};return f(t),a.clear(),Er++,function(){i.forEach(function(m){var g=Nt.get(m)-1,d=o.get(m)-1;Nt.set(m,g),o.set(m,d),g||(yn.has(m)||m.removeAttribute(r),yn.delete(m)),d||m.removeAttribute(n)}),Er--,Er||(Nt=new WeakMap,Nt=new WeakMap,yn=new WeakMap,wn={})}},ng=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Qf(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),tg(r,s,n,"aria-hidden")):function(){return null}},$e=function(){return $e=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},$e.apply(this,arguments)};function Ta(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function rg(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var En="right-scroll-bar-position",Mn="width-before-scroll-bar",sg="with-scroll-bars-hidden",og="--removed-body-scroll-bar-size";function Mr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ig(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var ag=typeof window<"u"?p.useLayoutEffect:p.useEffect,Eo=new WeakMap;function lg(e,t){var n=ig(null,function(r){return e.forEach(function(s){return Mr(s,r)})});return ag(function(){var r=Eo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||Mr(a,null)}),o.forEach(function(a){s.has(a)||Mr(a,i)})}Eo.set(n,e)},[e]),n}function cg(e){return e}function ug(e,t){t===void 0&&(t=cg);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(o),i=n}var c=function(){var f=i;i=[],f.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),n}}}};return s}function dg(e){e===void 0&&(e={});var t=ug(null);return t.options=$e({async:!0,ssr:!1},e),t}var Aa=function(e){var t=e.sideCar,n=Ta(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return p.createElement(r,$e({},n))};Aa.isSideCarExport=!0;function fg(e,t){return e.useMedium(t),Aa}var ja=dg(),Nr=function(){},Kn=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Nr,onWheelCapture:Nr,onTouchMoveCapture:Nr}),s=r[0],o=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,m=e.shards,g=e.sideCar,d=e.noRelative,v=e.noIsolation,h=e.inert,y=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,_=e.gapMode,S=Ta(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,N=lg([n,t]),R=$e($e({},S),s);return p.createElement(p.Fragment,null,f&&p.createElement(C,{sideCar:ja,removeScrollBar:u,shards:m,noRelative:d,noIsolation:v,inert:h,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:_}),i?p.cloneElement(p.Children.only(a),$e($e({},R),{ref:N})):p.createElement(w,$e({},R,{className:c,ref:N}),a))});Kn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Kn.classNames={fullWidth:Mn,zeroRight:En};var gg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gg();return t&&e.setAttribute("nonce",t),e}function hg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function pg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var vg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=mg())&&(hg(t,n),pg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xg=function(){var e=vg();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ka=function(){var e=xg(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},yg={left:0,top:0,right:0,gap:0},Tr=function(e){return parseInt(e||"",10)||0},wg=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Tr(n),Tr(r),Tr(s)]},_g=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return yg;var t=wg(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Sg=ka(),Ft="data-scroll-locked",Cg=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
65
+ */function io(e,t){return e?Xu(e)?p.createElement(e,t):e:null}function Xu(e){return Yu(e)||typeof e=="function"||Ju(e)}function Yu(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Ju(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Qu(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=p.useState(()=>({current:Hu(t)})),[r,s]=p.useState(()=>n.current.initialState);return n.current.setOptions(o=>({...o,...e,state:{...r,...e.state},onStateChange:i=>{s(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}function Wi(e){const t=e+"CollectionProvider",[n,r]=bt(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:y,children:x}=h,w=Fe.useRef(null),_=Fe.useRef(new Map).current;return l.jsx(s,{scope:y,itemMap:_,collectionRef:w,children:x})};i.displayName=t;const a=e+"CollectionSlot",c=Nn(a),u=Fe.forwardRef((h,y)=>{const{scope:x,children:w}=h,_=o(a,x),S=pe(y,_.collectionRef);return l.jsx(c,{ref:S,children:w})});u.displayName=a;const f=e+"CollectionItemSlot",m="data-radix-collection-item",g=Nn(f),d=Fe.forwardRef((h,y)=>{const{scope:x,children:w,..._}=h,S=Fe.useRef(null),C=pe(y,S),N=o(f,x);return Fe.useEffect(()=>(N.itemMap.set(S,{ref:S,..._}),()=>void N.itemMap.delete(S))),l.jsx(g,{[m]:"",ref:C,children:w})});d.displayName=f;function v(h){const y=o(e+"CollectionConsumer",h);return Fe.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const _=Array.from(w.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((N,R)=>_.indexOf(N.ref.current)-_.indexOf(R.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:u,ItemSlot:d},v,r]}var ed=p.createContext(void 0);function bs(e){const t=p.useContext(ed);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function td(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var nd="DismissableLayer",qr="dismissableLayer.update",rd="dismissableLayer.pointerDownOutside",sd="dismissableLayer.focusOutside",ao,qi=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zi=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:i,onDismiss:a,...c}=e,u=p.useContext(qi),[f,m]=p.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,d]=p.useState({}),v=pe(t,R=>m(R)),h=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=h.indexOf(y),w=f?h.indexOf(f):-1,_=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=x,C=ad(R=>{const M=R.target,z=[...u.branches].some(F=>F.contains(M));!S||z||(s==null||s(R),i==null||i(R),R.defaultPrevented||a==null||a())},g),N=ld(R=>{const M=R.target;[...u.branches].some(F=>F.contains(M))||(o==null||o(R),i==null||i(R),R.defaultPrevented||a==null||a())},g);return td(R=>{w===u.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&a&&(R.preventDefault(),a()))},g),p.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ao=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),lo(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=ao)}},[f,g,n,u]),p.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),lo())},[f,u]),p.useEffect(()=>{const R=()=>d({});return document.addEventListener(qr,R),()=>document.removeEventListener(qr,R)},[]),l.jsx(oe.div,{...c,ref:v,style:{pointerEvents:_?S?"auto":"none":void 0,...e.style},onFocusCapture:G(e.onFocusCapture,N.onFocusCapture),onBlurCapture:G(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,C.onPointerDownCapture)})});Zi.displayName=nd;var od="DismissableLayerBranch",id=p.forwardRef((e,t)=>{const n=p.useContext(qi),r=p.useRef(null),s=pe(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(oe.div,{...e,ref:s})});id.displayName=od;function ad(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){Ki(rd,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ld(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1);return p.useEffect(()=>{const s=o=>{o.target&&!r.current&&Ki(sd,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function lo(){const e=new CustomEvent(qr);document.dispatchEvent(e)}function Ki(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Ci(s,o):s.dispatchEvent(o)}var wr=0;function cd(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??co()),document.body.insertAdjacentElement("beforeend",e[1]??co()),wr++,()=>{wr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),wr--}},[])}function co(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var _r="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",uo={bubbles:!1,cancelable:!0},ud="FocusScope",Xi=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[a,c]=p.useState(null),u=Je(s),f=Je(o),m=p.useRef(null),g=pe(t,h=>c(h)),d=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let h=function(_){if(d.paused||!a)return;const S=_.target;a.contains(S)?m.current=S:rt(m.current,{select:!0})},y=function(_){if(d.paused||!a)return;const S=_.relatedTarget;S!==null&&(a.contains(S)||rt(m.current,{select:!0}))},x=function(_){if(document.activeElement===document.body)for(const C of _)C.removedNodes.length>0&&rt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const w=new MutationObserver(x);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),w.disconnect()}}},[r,a,d.paused]),p.useEffect(()=>{if(a){go.add(d);const h=document.activeElement;if(!a.contains(h)){const x=new CustomEvent(_r,uo);a.addEventListener(_r,u),a.dispatchEvent(x),x.defaultPrevented||(dd(pd(Yi(a)),{select:!0}),document.activeElement===h&&rt(a))}return()=>{a.removeEventListener(_r,u),setTimeout(()=>{const x=new CustomEvent(Sr,uo);a.addEventListener(Sr,f),a.dispatchEvent(x),x.defaultPrevented||rt(h??document.body,{select:!0}),a.removeEventListener(Sr,f),go.remove(d)},0)}}},[a,u,f,d]);const v=p.useCallback(h=>{if(!n&&!r||d.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,x=document.activeElement;if(y&&x){const w=h.currentTarget,[_,S]=fd(w);_&&S?!h.shiftKey&&x===S?(h.preventDefault(),n&&rt(_,{select:!0})):h.shiftKey&&x===_&&(h.preventDefault(),n&&rt(S,{select:!0})):x===w&&h.preventDefault()}},[n,r,d.paused]);return l.jsx(oe.div,{tabIndex:-1,...i,ref:g,onKeyDown:v})});Xi.displayName=ud;function dd(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(rt(r,{select:t}),document.activeElement!==n)return}function fd(e){const t=Yi(e),n=fo(t,e),r=fo(t.reverse(),e);return[n,r]}function Yi(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fo(e,t){for(const n of e)if(!gd(n,{upTo:t}))return n}function gd(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function md(e){return e instanceof HTMLInputElement&&"select"in e}function rt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&md(e)&&t&&e.select()}}var go=hd();function hd(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=mo(e,t),e.unshift(t)},remove(t){var n;e=mo(e,t),(n=e[0])==null||n.resume()}}}function mo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pd(e){return e.filter(t=>t.tagName!=="A")}var vd=ci[" useId ".trim().toString()]||(()=>{}),xd=0;function Tn(e){const[t,n]=p.useState(vd());return dt(()=>{n(r=>r??String(xd++))},[e]),e||(t?`radix-${t}`:"")}const yd=["top","right","bottom","left"],gt=Math.min,Se=Math.max,An=Math.round,xn=Math.floor,Ve=e=>({x:e,y:e}),wd={left:"right",right:"left",bottom:"top",top:"bottom"},_d={start:"end",end:"start"};function Zr(e,t,n){return Se(e,gt(t,n))}function Qe(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function Gt(e){return e.split("-")[1]}function Rs(e){return e==="x"?"y":"x"}function Es(e){return e==="y"?"height":"width"}const Sd=new Set(["top","bottom"]);function Le(e){return Sd.has(et(e))?"y":"x"}function Ms(e){return Rs(Le(e))}function Cd(e,t,n){n===void 0&&(n=!1);const r=Gt(e),s=Ms(e),o=Es(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=jn(i)),[i,jn(i)]}function bd(e){const t=jn(e);return[Kr(e),t,Kr(t)]}function Kr(e){return e.replace(/start|end/g,t=>_d[t])}const ho=["left","right"],po=["right","left"],Rd=["top","bottom"],Ed=["bottom","top"];function Md(e,t,n){switch(e){case"top":case"bottom":return n?t?po:ho:t?ho:po;case"left":case"right":return t?Rd:Ed;default:return[]}}function Nd(e,t,n,r){const s=Gt(e);let o=Md(et(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(Kr)))),o}function jn(e){return e.replace(/left|right|bottom|top/g,t=>wd[t])}function Td(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ji(e){return typeof e!="number"?Td(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function vo(e,t,n){let{reference:r,floating:s}=e;const o=Le(t),i=Ms(t),a=Es(i),c=et(t),u=o==="y",f=r.x+r.width/2-s.width/2,m=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let d;switch(c){case"top":d={x:f,y:r.y-s.height};break;case"bottom":d={x:f,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:m};break;case"left":d={x:r.x-s.width,y:m};break;default:d={x:r.x,y:r.y}}switch(Gt(t)){case"start":d[i]-=g*(n&&u?-1:1);break;case"end":d[i]+=g*(n&&u?-1:1);break}return d}const Ad=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:m}=vo(u,r,c),g=r,d={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:x}=a[h],{x:w,y:_,data:S,reset:C}=await x({x:f,y:m,initialPlacement:r,placement:g,strategy:s,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});f=w??f,m=_??m,d={...d,[y]:{...d[y],...S}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(g=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:m}=vo(u,g,c)),h=-1)}return{x:f,y:m,placement:g,strategy:s,middlewareData:d}};async function Qt(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:d=0}=Qe(t,e),v=Ji(d),y=a[g?m==="floating"?"reference":"floating":m],x=kn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:c})),w=m==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),S=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},C=kn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:_,strategy:c}):w);return{top:(x.top-C.top+v.top)/S.y,bottom:(C.bottom-x.bottom+v.bottom)/S.y,left:(x.left-C.left+v.left)/S.x,right:(C.right-x.right+v.right)/S.x}}const jd=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:f=0}=Qe(e,t)||{};if(u==null)return{};const m=Ji(f),g={x:n,y:r},d=Ms(s),v=Es(d),h=await i.getDimensions(u),y=d==="y",x=y?"top":"left",w=y?"bottom":"right",_=y?"clientHeight":"clientWidth",S=o.reference[v]+o.reference[d]-g[d]-o.floating[v],C=g[d]-o.reference[d],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let R=N?N[_]:0;(!R||!await(i.isElement==null?void 0:i.isElement(N)))&&(R=a.floating[_]||o.floating[v]);const M=S/2-C/2,z=R/2-h[v]/2-1,F=gt(m[x],z),Z=gt(m[w],z),Q=F,U=R-h[v]-Z,D=R/2-h[v]/2+M,ne=Zr(Q,D,U),W=!c.arrow&&Gt(s)!=null&&D!==ne&&o.reference[v]/2-(D<Q?F:Z)-h[v]/2<0,ee=W?D<Q?D-Q:D-U:0;return{[d]:g[d]+ee,data:{[d]:ne,centerOffset:D-ne-ee,...W&&{alignmentOffset:ee}},reset:W}}}),kd=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=Qe(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const x=et(s),w=Le(a),_=et(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=g||(_||!h?[jn(a)]:bd(a)),N=v!=="none";!g&&N&&C.push(...Nd(a,h,v,S));const R=[a,...C],M=await Qt(t,y),z=[];let F=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&z.push(M[x]),m){const D=Cd(s,i,S);z.push(M[D[0]],M[D[1]])}if(F=[...F,{placement:s,overflows:z}],!z.every(D=>D<=0)){var Z,Q;const D=(((Z=o.flip)==null?void 0:Z.index)||0)+1,ne=R[D];if(ne&&(!(m==="alignment"?w!==Le(ne):!1)||F.every(I=>Le(I.placement)===w?I.overflows[0]>0:!0)))return{data:{index:D,overflows:F},reset:{placement:ne}};let W=(Q=F.filter(ee=>ee.overflows[0]<=0).sort((ee,I)=>ee.overflows[1]-I.overflows[1])[0])==null?void 0:Q.placement;if(!W)switch(d){case"bestFit":{var U;const ee=(U=F.filter(I=>{if(N){const E=Le(I.placement);return E===w||E==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(E=>E>0).reduce((E,L)=>E+L,0)]).sort((I,E)=>I[1]-E[1])[0])==null?void 0:U[0];ee&&(W=ee);break}case"initialPlacement":W=a;break}if(s!==W)return{reset:{placement:W}}}return{}}}};function xo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function yo(e){return yd.some(t=>e[t]>=0)}const Id=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Qe(e,t);switch(r){case"referenceHidden":{const o=await Qt(t,{...s,elementContext:"reference"}),i=xo(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:yo(i)}}}case"escaped":{const o=await Qt(t,{...s,altBoundary:!0}),i=xo(o,n.floating);return{data:{escapedOffsets:i,escaped:yo(i)}}}default:return{}}}}},Qi=new Set(["left","top"]);async function Pd(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=et(n),a=Gt(n),c=Le(n)==="y",u=Qi.has(i)?-1:1,f=o&&c?-1:1,m=Qe(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return a&&typeof v=="number"&&(d=a==="end"?v*-1:v),c?{x:d*f,y:g*u}:{x:g*u,y:d*f}}const Od=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,c=await Pd(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:i}}}}},Fd=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x,y:w}=y;return{x,y:w}}},...c}=Qe(e,t),u={x:n,y:r},f=await Qt(t,c),m=Le(et(s)),g=Rs(m);let d=u[g],v=u[m];if(o){const y=g==="y"?"top":"left",x=g==="y"?"bottom":"right",w=d+f[y],_=d-f[x];d=Zr(w,d,_)}if(i){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",w=v+f[y],_=v-f[x];v=Zr(w,v,_)}const h=a.fn({...t,[g]:d,[m]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[g]:o,[m]:i}}}}}},Dd=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Qe(e,t),f={x:n,y:r},m=Le(s),g=Rs(m);let d=f[g],v=f[m];const h=Qe(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const _=g==="y"?"height":"width",S=o.reference[g]-o.floating[_]+y.mainAxis,C=o.reference[g]+o.reference[_]-y.mainAxis;d<S?d=S:d>C&&(d=C)}if(u){var x,w;const _=g==="y"?"width":"height",S=Qi.has(et(s)),C=o.reference[m]-o.floating[_]+(S&&((x=i.offset)==null?void 0:x[m])||0)+(S?0:y.crossAxis),N=o.reference[m]+o.reference[_]+(S?0:((w=i.offset)==null?void 0:w[m])||0)-(S?y.crossAxis:0);v<C?v=C:v>N&&(v=N)}return{[g]:d,[m]:v}}}},$d=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:c=()=>{},...u}=Qe(e,t),f=await Qt(t,u),m=et(s),g=Gt(s),d=Le(s)==="y",{width:v,height:h}=o.floating;let y,x;m==="top"||m==="bottom"?(y=m,x=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(x=m,y=g==="end"?"top":"bottom");const w=h-f.top-f.bottom,_=v-f.left-f.right,S=gt(h-f[y],w),C=gt(v-f[x],_),N=!t.middlewareData.shift;let R=S,M=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=w),N&&!g){const F=Se(f.left,0),Z=Se(f.right,0),Q=Se(f.top,0),U=Se(f.bottom,0);d?M=v-2*(F!==0||Z!==0?F+Z:Se(f.left,f.right)):R=h-2*(Q!==0||U!==0?Q+U:Se(f.top,f.bottom))}await c({...t,availableWidth:M,availableHeight:R});const z=await i.getDimensions(a.floating);return v!==z.width||h!==z.height?{reset:{rects:!0}}:{}}}};function Bn(){return typeof window<"u"}function Bt(e){return ea(e)?(e.nodeName||"").toLowerCase():"#document"}function Ce(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ge(e){var t;return(t=(ea(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ea(e){return Bn()?e instanceof Node||e instanceof Ce(e).Node:!1}function Pe(e){return Bn()?e instanceof Element||e instanceof Ce(e).Element:!1}function ze(e){return Bn()?e instanceof HTMLElement||e instanceof Ce(e).HTMLElement:!1}function wo(e){return!Bn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ce(e).ShadowRoot}const Ld=new Set(["inline","contents"]);function an(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ld.has(s)}const Vd=new Set(["table","td","th"]);function Hd(e){return Vd.has(Bt(e))}const zd=[":popover-open",":modal"];function Un(e){return zd.some(t=>{try{return e.matches(t)}catch{return!1}})}const Gd=["transform","translate","scale","rotate","perspective"],Bd=["transform","translate","scale","rotate","perspective","filter"],Ud=["paint","layout","strict","content"];function Ns(e){const t=Ts(),n=Pe(e)?Oe(e):e;return Gd.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Bd.some(r=>(n.willChange||"").includes(r))||Ud.some(r=>(n.contain||"").includes(r))}function Wd(e){let t=mt(e);for(;ze(t)&&!Dt(t);){if(Ns(t))return t;if(Un(t))return null;t=mt(t)}return null}function Ts(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const qd=new Set(["html","body","#document"]);function Dt(e){return qd.has(Bt(e))}function Oe(e){return Ce(e).getComputedStyle(e)}function Wn(e){return Pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mt(e){if(Bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wo(e)&&e.host||Ge(e);return wo(t)?t.host:t}function ta(e){const t=mt(e);return Dt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ze(t)&&an(t)?t:ta(t)}function en(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=ta(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Ce(s);if(o){const a=Xr(i);return t.concat(i,i.visualViewport||[],an(s)?s:[],a&&n?en(a):[])}return t.concat(s,en(s,[],n))}function Xr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function na(e){const t=Oe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=ze(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=An(n)!==o||An(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function As(e){return Pe(e)?e:e.contextElement}function Ot(e){const t=As(e);if(!ze(t))return Ve(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=na(t);let i=(o?An(n.width):n.width)/r,a=(o?An(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Zd=Ve(0);function ra(e){const t=Ce(e);return!Ts()||!t.visualViewport?Zd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Kd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ce(e)?!1:t}function wt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=As(e);let i=Ve(1);t&&(r?Pe(r)&&(i=Ot(r)):i=Ot(e));const a=Kd(o,n,r)?ra(o):Ve(0);let c=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,f=s.width/i.x,m=s.height/i.y;if(o){const g=Ce(o),d=r&&Pe(r)?Ce(r):r;let v=g,h=Xr(v);for(;h&&r&&d!==v;){const y=Ot(h),x=h.getBoundingClientRect(),w=Oe(h),_=x.left+(h.clientLeft+parseFloat(w.paddingLeft))*y.x,S=x.top+(h.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,u*=y.y,f*=y.x,m*=y.y,c+=_,u+=S,v=Ce(h),h=Xr(v)}}return kn({width:f,height:m,x:c,y:u})}function qn(e,t){const n=Wn(e).scrollLeft;return t?t.left+n:wt(Ge(e)).left+n}function sa(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-qn(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Xd(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=Ge(r),a=t?Un(t.floating):!1;if(r===i||a&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Ve(1);const f=Ve(0),m=ze(r);if((m||!m&&!o)&&((Bt(r)!=="body"||an(i))&&(c=Wn(r)),ze(r))){const d=wt(r);u=Ot(r),f.x=d.x+r.clientLeft,f.y=d.y+r.clientTop}const g=i&&!m&&!o?sa(i,c):Ve(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+g.x,y:n.y*u.y-c.scrollTop*u.y+f.y+g.y}}function Yd(e){return Array.from(e.getClientRects())}function Jd(e){const t=Ge(e),n=Wn(e),r=e.ownerDocument.body,s=Se(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Se(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+qn(e);const a=-n.scrollTop;return Oe(r).direction==="rtl"&&(i+=Se(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const _o=25;function Qd(e,t){const n=Ce(e),r=Ge(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,c=0;if(s){o=s.width,i=s.height;const f=Ts();(!f||f&&t==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}const u=qn(r);if(u<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),d=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-d);v<=_o&&(o-=v)}else u<=_o&&(o+=u);return{width:o,height:i,x:a,y:c}}const ef=new Set(["absolute","fixed"]);function tf(e,t){const n=wt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=ze(e)?Ot(e):Ve(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:i,height:a,x:c,y:u}}function So(e,t,n){let r;if(t==="viewport")r=Qd(e,n);else if(t==="document")r=Jd(Ge(e));else if(Pe(t))r=tf(t,n);else{const s=ra(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return kn(r)}function oa(e,t){const n=mt(e);return n===t||!Pe(n)||Dt(n)?!1:Oe(n).position==="fixed"||oa(n,t)}function nf(e,t){const n=t.get(e);if(n)return n;let r=en(e,[],!1).filter(a=>Pe(a)&&Bt(a)!=="body"),s=null;const o=Oe(e).position==="fixed";let i=o?mt(e):e;for(;Pe(i)&&!Dt(i);){const a=Oe(i),c=Ns(i);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&!!s&&ef.has(s.position)||an(i)&&!c&&oa(e,i))?r=r.filter(f=>f!==i):s=a,i=mt(i)}return t.set(e,r),r}function rf(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Un(t)?[]:nf(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,f)=>{const m=So(t,f,s);return u.top=Se(m.top,u.top),u.right=gt(m.right,u.right),u.bottom=gt(m.bottom,u.bottom),u.left=Se(m.left,u.left),u},So(t,a,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sf(e){const{width:t,height:n}=na(e);return{width:t,height:n}}function of(e,t,n){const r=ze(t),s=Ge(t),o=n==="fixed",i=wt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Ve(0);function u(){c.x=qn(s)}if(r||!r&&!o)if((Bt(t)!=="body"||an(s))&&(a=Wn(t)),r){const d=wt(t,!0,o,t);c.x=d.x+t.clientLeft,c.y=d.y+t.clientTop}else s&&u();o&&!r&&s&&u();const f=s&&!r&&!o?sa(s,a):Ve(0),m=i.left+a.scrollLeft-c.x-f.x,g=i.top+a.scrollTop-c.y-f.y;return{x:m,y:g,width:i.width,height:i.height}}function Cr(e){return Oe(e).position==="static"}function Co(e,t){if(!ze(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ge(e)===n&&(n=n.ownerDocument.body),n}function ia(e,t){const n=Ce(e);if(Un(e))return n;if(!ze(e)){let s=mt(e);for(;s&&!Dt(s);){if(Pe(s)&&!Cr(s))return s;s=mt(s)}return n}let r=Co(e,t);for(;r&&Hd(r)&&Cr(r);)r=Co(r,t);return r&&Dt(r)&&Cr(r)&&!Ns(r)?n:r||Wd(e)||n}const af=async function(e){const t=this.getOffsetParent||ia,n=this.getDimensions,r=await n(e.floating);return{reference:of(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lf(e){return Oe(e).direction==="rtl"}const cf={convertOffsetParentRelativeRectToViewportRelativeRect:Xd,getDocumentElement:Ge,getClippingRect:rf,getOffsetParent:ia,getElementRects:af,getClientRects:Yd,getDimensions:sf,getScale:Ot,isElement:Pe,isRTL:lf};function aa(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uf(e,t){let n=null,r;const s=Ge(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const u=e.getBoundingClientRect(),{left:f,top:m,width:g,height:d}=u;if(a||t(),!g||!d)return;const v=xn(m),h=xn(s.clientWidth-(f+g)),y=xn(s.clientHeight-(m+d)),x=xn(f),_={rootMargin:-v+"px "+-h+"px "+-y+"px "+-x+"px",threshold:Se(0,gt(1,c))||1};let S=!0;function C(N){const R=N[0].intersectionRatio;if(R!==c){if(!S)return i();R?i(!1,R):r=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!aa(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,_)}n.observe(e)}return i(!0),o}function df(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=As(e),f=s||o?[...u?en(u):[],...en(t)]:[];f.forEach(x=>{s&&x.addEventListener("scroll",n,{passive:!0}),o&&x.addEventListener("resize",n)});const m=u&&a?uf(u,n):null;let g=-1,d=null;i&&(d=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=d)==null||_.observe(t)})),n()}),u&&!c&&d.observe(u),d.observe(t));let v,h=c?wt(e):null;c&&y();function y(){const x=wt(e);h&&!aa(h,x)&&n(),h=x,v=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(w=>{s&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),m==null||m(),(x=d)==null||x.disconnect(),d=null,c&&cancelAnimationFrame(v)}}const ff=Od,gf=Fd,mf=kd,hf=$d,pf=Id,bo=jd,vf=Dd,xf=(e,t,n)=>{const r=new Map,s={platform:cf,...n},o={...s.platform,_c:r};return Ad(e,t,{...s,platform:o})};var yf=typeof document<"u",wf=function(){},Rn=yf?p.useLayoutEffect:wf;function In(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!In(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!In(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function la(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ro(e,t){const n=la(e);return Math.round(t*n)/n}function br(e){const t=p.useRef(e);return Rn(()=>{t.current=e}),t}function _f(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[f,m]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=p.useState(r);In(g,r)||d(r);const[v,h]=p.useState(null),[y,x]=p.useState(null),w=p.useCallback(I=>{I!==N.current&&(N.current=I,h(I))},[]),_=p.useCallback(I=>{I!==R.current&&(R.current=I,x(I))},[]),S=o||v,C=i||y,N=p.useRef(null),R=p.useRef(null),M=p.useRef(f),z=c!=null,F=br(c),Z=br(s),Q=br(u),U=p.useCallback(()=>{if(!N.current||!R.current)return;const I={placement:t,strategy:n,middleware:g};Z.current&&(I.platform=Z.current),xf(N.current,R.current,I).then(E=>{const L={...E,isPositioned:Q.current!==!1};D.current&&!In(M.current,L)&&(M.current=L,vs.flushSync(()=>{m(L)}))})},[g,t,n,Z,Q]);Rn(()=>{u===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,m(I=>({...I,isPositioned:!1})))},[u]);const D=p.useRef(!1);Rn(()=>(D.current=!0,()=>{D.current=!1}),[]),Rn(()=>{if(S&&(N.current=S),C&&(R.current=C),S&&C){if(F.current)return F.current(S,C,U);U()}},[S,C,U,F,z]);const ne=p.useMemo(()=>({reference:N,floating:R,setReference:w,setFloating:_}),[w,_]),W=p.useMemo(()=>({reference:S,floating:C}),[S,C]),ee=p.useMemo(()=>{const I={position:n,left:0,top:0};if(!W.floating)return I;const E=Ro(W.floating,f.x),L=Ro(W.floating,f.y);return a?{...I,transform:"translate("+E+"px, "+L+"px)",...la(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:E,top:L}},[n,a,W.floating,f.x,f.y]);return p.useMemo(()=>({...f,update:U,refs:ne,elements:W,floatingStyles:ee}),[f,U,ne,W,ee])}const Sf=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?bo({element:r.current,padding:s}).fn(n):{}:r?bo({element:r,padding:s}).fn(n):{}}}},Cf=(e,t)=>({...ff(e),options:[e,t]}),bf=(e,t)=>({...gf(e),options:[e,t]}),Rf=(e,t)=>({...vf(e),options:[e,t]}),Ef=(e,t)=>({...mf(e),options:[e,t]}),Mf=(e,t)=>({...hf(e),options:[e,t]}),Nf=(e,t)=>({...pf(e),options:[e,t]}),Tf=(e,t)=>({...Sf(e),options:[e,t]});var Af="Arrow",ca=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return l.jsx(oe.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});ca.displayName=Af;var jf=ca,js="Popper",[ua,da]=bt(js),[kf,fa]=ua(js),ga=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return l.jsx(kf,{scope:t,anchor:r,onAnchorChange:s,children:n})};ga.displayName=js;var ma="PopperAnchor",ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=fa(ma,n),i=p.useRef(null),a=pe(t,i),c=p.useRef(null);return p.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&o.onAnchorChange(c.current)}),r?null:l.jsx(oe.div,{...s,ref:a})});ha.displayName=ma;var ks="PopperContent",[If,Pf]=ua(ks),pa=p.forwardRef((e,t)=>{var Me,vt,we,ke,Wt,nr;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:d="optimized",onPlaced:v,...h}=e,y=fa(ks,n),[x,w]=p.useState(null),_=pe(t,q=>w(q)),[S,C]=p.useState(null),N=Si(S),R=(N==null?void 0:N.width)??0,M=(N==null?void 0:N.height)??0,z=r+(o!=="center"?"-"+o:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Z=Array.isArray(u)?u:[u],Q=Z.length>0,U={padding:F,boundary:Z.filter(Ff),altBoundary:Q},{refs:D,floatingStyles:ne,placement:W,isPositioned:ee,middlewareData:I}=_f({strategy:"fixed",placement:z,whileElementsMounted:(...q)=>df(...q,{animationFrame:d==="always"}),elements:{reference:y.anchor},middleware:[Cf({mainAxis:s+M,alignmentAxis:i}),c&&bf({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Rf():void 0,...U}),c&&Ef({...U}),Mf({...U,apply:({elements:q,rects:re,availableWidth:le,availableHeight:te})=>{const{width:_e,height:nt}=re.reference,ae=q.floating.style;ae.setProperty("--radix-popper-available-width",`${le}px`),ae.setProperty("--radix-popper-available-height",`${te}px`),ae.setProperty("--radix-popper-anchor-width",`${_e}px`),ae.setProperty("--radix-popper-anchor-height",`${nt}px`)}}),S&&Tf({element:S,padding:a}),Df({arrowWidth:R,arrowHeight:M}),g&&Nf({strategy:"referenceHidden",...U})]}),[E,L]=ya(W),$=Je(v);dt(()=>{ee&&($==null||$())},[ee,$]);const K=(Me=I.arrow)==null?void 0:Me.x,fe=(vt=I.arrow)==null?void 0:vt.y,je=((we=I.arrow)==null?void 0:we.centerOffset)!==0,[Ee,ye]=p.useState();return dt(()=>{x&&ye(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:ee?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ee,"--radix-popper-transform-origin":[(ke=I.transformOrigin)==null?void 0:ke.x,(Wt=I.transformOrigin)==null?void 0:Wt.y].join(" "),...((nr=I.hide)==null?void 0:nr.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(If,{scope:n,placedSide:E,onArrowChange:C,arrowX:K,arrowY:fe,shouldHideArrow:je,children:l.jsx(oe.div,{"data-side":E,"data-align":L,...h,ref:_,style:{...h.style,animation:ee?void 0:"none"}})})})});pa.displayName=ks;var va="PopperArrow",Of={top:"bottom",right:"left",bottom:"top",left:"right"},xa=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=Pf(va,r),i=Of[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(jf,{...s,ref:n,style:{...s.style,display:"block"}})})});xa.displayName=va;function Ff(e){return e!==null}var Df=e=>({name:"transformOrigin",options:e,fn(t){var y,x,w;const{placement:n,rects:r,middlewareData:s}=t,i=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,f]=ya(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((x=s.arrow)==null?void 0:x.x)??0)+a/2,d=(((w=s.arrow)==null?void 0:w.y)??0)+c/2;let v="",h="";return u==="bottom"?(v=i?m:`${g}px`,h=`${-c}px`):u==="top"?(v=i?m:`${g}px`,h=`${r.floating.height+c}px`):u==="right"?(v=`${-c}px`,h=i?m:`${d}px`):u==="left"&&(v=`${r.floating.width+c}px`,h=i?m:`${d}px`),{data:{x:v,y:h}}}});function ya(e){const[t,n="center"]=e.split("-");return[t,n]}var $f=ga,Lf=ha,Vf=pa,Hf=xa,zf="Portal",wa=p.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,o]=p.useState(!1);dt(()=>o(!0),[]);const i=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Ec.createPortal(l.jsx(oe.div,{...r,ref:t}),i):null});wa.displayName=zf;var Rr="rovingFocusGroup.onEntryFocus",Gf={bubbles:!1,cancelable:!0},ln="RovingFocusGroup",[Yr,_a,Bf]=Wi(ln),[Uf,Zn]=bt(ln,[Bf]),[Wf,qf]=Uf(ln),Sa=p.forwardRef((e,t)=>l.jsx(Yr.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Yr.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Zf,{...e,ref:t})})}));Sa.displayName=ln;var Zf=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...m}=e,g=p.useRef(null),d=pe(t,g),v=bs(o),[h,y]=Hn({prop:i,defaultProp:a??null,onChange:c,caller:ln}),[x,w]=p.useState(!1),_=Je(u),S=_a(n),C=p.useRef(!1),[N,R]=p.useState(0);return p.useEffect(()=>{const M=g.current;if(M)return M.addEventListener(Rr,_),()=>M.removeEventListener(Rr,_)},[_]),l.jsx(Wf,{scope:n,orientation:r,dir:v,loop:s,currentTabStopId:h,onItemFocus:p.useCallback(M=>y(M),[y]),onItemShiftTab:p.useCallback(()=>w(!0),[]),onFocusableItemAdd:p.useCallback(()=>R(M=>M+1),[]),onFocusableItemRemove:p.useCallback(()=>R(M=>M-1),[]),children:l.jsx(oe.div,{tabIndex:x||N===0?-1:0,"data-orientation":r,...m,ref:d,style:{outline:"none",...e.style},onMouseDown:G(e.onMouseDown,()=>{C.current=!0}),onFocus:G(e.onFocus,M=>{const z=!C.current;if(M.target===M.currentTarget&&z&&!x){const F=new CustomEvent(Rr,Gf);if(M.currentTarget.dispatchEvent(F),!F.defaultPrevented){const Z=S().filter(W=>W.focusable),Q=Z.find(W=>W.active),U=Z.find(W=>W.id===h),ne=[Q,U,...Z].filter(Boolean).map(W=>W.ref.current);Ra(ne,f)}}C.current=!1}),onBlur:G(e.onBlur,()=>w(!1))})})}),Ca="RovingFocusGroupItem",ba=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:i,...a}=e,c=Tn(),u=o||c,f=qf(Ca,n),m=f.currentTabStopId===u,g=_a(n),{onFocusableItemAdd:d,onFocusableItemRemove:v,currentTabStopId:h}=f;return p.useEffect(()=>{if(r)return d(),()=>v()},[r,d,v]),l.jsx(Yr.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:l.jsx(oe.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:G(e.onMouseDown,y=>{r?f.onItemFocus(u):y.preventDefault()}),onFocus:G(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:G(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=Yf(y,f.orientation,f.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=g().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")_.reverse();else if(x==="prev"||x==="next"){x==="prev"&&_.reverse();const S=_.indexOf(y.currentTarget);_=f.loop?Jf(_,S+1):_.slice(S+1)}setTimeout(()=>Ra(_))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});ba.displayName=Ca;var Kf={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xf(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Yf(e,t,n){const r=Xf(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Kf[r]}function Ra(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Jf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Ea=Sa,Ma=ba,Qf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nt=new WeakMap,yn=new WeakMap,wn={},Er=0,Na=function(e){return e&&(e.host||Na(e.parentNode))},eg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Na(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},tg=function(e,t,n,r){var s=eg(t,Array.isArray(e)?e:[e]);wn[n]||(wn[n]=new WeakMap);var o=wn[n],i=[],a=new Set,c=new Set(s),u=function(m){!m||a.has(m)||(a.add(m),u(m.parentNode))};s.forEach(u);var f=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(g){if(a.has(g))f(g);else try{var d=g.getAttribute(r),v=d!==null&&d!=="false",h=(Nt.get(g)||0)+1,y=(o.get(g)||0)+1;Nt.set(g,h),o.set(g,y),i.push(g),h===1&&v&&yn.set(g,!0),y===1&&g.setAttribute(n,"true"),v||g.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",g,x)}})};return f(t),a.clear(),Er++,function(){i.forEach(function(m){var g=Nt.get(m)-1,d=o.get(m)-1;Nt.set(m,g),o.set(m,d),g||(yn.has(m)||m.removeAttribute(r),yn.delete(m)),d||m.removeAttribute(n)}),Er--,Er||(Nt=new WeakMap,Nt=new WeakMap,yn=new WeakMap,wn={})}},ng=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Qf(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),tg(r,s,n,"aria-hidden")):function(){return null}},$e=function(){return $e=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},$e.apply(this,arguments)};function Ta(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function rg(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var En="right-scroll-bar-position",Mn="width-before-scroll-bar",sg="with-scroll-bars-hidden",og="--removed-body-scroll-bar-size";function Mr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ig(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var ag=typeof window<"u"?p.useLayoutEffect:p.useEffect,Eo=new WeakMap;function lg(e,t){var n=ig(null,function(r){return e.forEach(function(s){return Mr(s,r)})});return ag(function(){var r=Eo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(a){o.has(a)||Mr(a,null)}),o.forEach(function(a){s.has(a)||Mr(a,i)})}Eo.set(n,e)},[e]),n}function cg(e){return e}function ug(e,t){t===void 0&&(t=cg);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(o),i=n}var c=function(){var f=i;i=[],f.forEach(o)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),n}}}};return s}function dg(e){e===void 0&&(e={});var t=ug(null);return t.options=$e({async:!0,ssr:!1},e),t}var Aa=function(e){var t=e.sideCar,n=Ta(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return p.createElement(r,$e({},n))};Aa.isSideCarExport=!0;function fg(e,t){return e.useMedium(t),Aa}var ja=dg(),Nr=function(){},Kn=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:Nr,onWheelCapture:Nr,onTouchMoveCapture:Nr}),s=r[0],o=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,m=e.shards,g=e.sideCar,d=e.noRelative,v=e.noIsolation,h=e.inert,y=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,_=e.gapMode,S=Ta(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=g,N=lg([n,t]),R=$e($e({},S),s);return p.createElement(p.Fragment,null,f&&p.createElement(C,{sideCar:ja,removeScrollBar:u,shards:m,noRelative:d,noIsolation:v,inert:h,setCallbacks:o,allowPinchZoom:!!y,lockRef:n,gapMode:_}),i?p.cloneElement(p.Children.only(a),$e($e({},R),{ref:N})):p.createElement(w,$e({},R,{className:c,ref:N}),a))});Kn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Kn.classNames={fullWidth:Mn,zeroRight:En};var gg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=gg();return t&&e.setAttribute("nonce",t),e}function hg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function pg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var vg=function(){var e=0,t=null;return{add:function(n){e==0&&(t=mg())&&(hg(t,n),pg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xg=function(){var e=vg();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ka=function(){var e=xg(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},yg={left:0,top:0,right:0,gap:0},Tr=function(e){return parseInt(e||"",10)||0},wg=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Tr(n),Tr(r),Tr(s)]},_g=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return yg;var t=wg(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Sg=ka(),Ft="data-scroll-locked",Cg=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
66
66
  .`.concat(sg,` {
67
67
  overflow: hidden `).concat(r,`;
68
68
  padding-right: `).concat(a,"px ").concat(r,`;
@@ -102,4 +102,4 @@ import{r as Pl,a as p,R as Fe,j as l,b as ci,u as pe,g as Ol,c as Fl,d as Nn,e a
102
102
  `)},Mo=function(){var e=parseInt(document.body.getAttribute(Ft)||"0",10);return isFinite(e)?e:0},bg=function(){p.useEffect(function(){return document.body.setAttribute(Ft,(Mo()+1).toString()),function(){var e=Mo()-1;e<=0?document.body.removeAttribute(Ft):document.body.setAttribute(Ft,e.toString())}},[])},Rg=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;bg();var o=p.useMemo(function(){return _g(s)},[s]);return p.createElement(Sg,{styles:Cg(o,!t,s,n?"":"!important")})},Jr=!1;if(typeof window<"u")try{var _n=Object.defineProperty({},"passive",{get:function(){return Jr=!0,!0}});window.addEventListener("test",_n,_n),window.removeEventListener("test",_n,_n)}catch{Jr=!1}var Tt=Jr?{passive:!1}:!1,Eg=function(e){return e.tagName==="TEXTAREA"},Ia=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Eg(e)&&n[t]==="visible")},Mg=function(e){return Ia(e,"overflowY")},Ng=function(e){return Ia(e,"overflowX")},No=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Pa(e,r);if(s){var o=Oa(e,r),i=o[1],a=o[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Tg=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Ag=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Pa=function(e,t){return e==="v"?Mg(t):Ng(t)},Oa=function(e,t){return e==="v"?Tg(t):Ag(t)},jg=function(e,t){return e==="h"&&t==="rtl"?-1:1},kg=function(e,t,n,r,s){var o=jg(e,window.getComputedStyle(t).direction),i=o*r,a=n.target,c=t.contains(a),u=!1,f=i>0,m=0,g=0;do{if(!a)break;var d=Oa(e,a),v=d[0],h=d[1],y=d[2],x=h-y-o*v;(v||x)&&Pa(e,a)&&(m+=x,g+=v);var w=a.parentNode;a=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(u=!0),u},Sn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},To=function(e){return[e.deltaX,e.deltaY]},Ao=function(e){return e&&"current"in e?e.current:e},Ig=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pg=function(e){return`
103
103
  .block-interactivity-`.concat(e,` {pointer-events: none;}
104
104
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
105
- `)},Og=0,At=[];function Fg(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),s=p.useState(Og++)[0],o=p.useState(ka)[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=rg([e.lockRef.current],(e.shards||[]).map(Ao),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=p.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var x=Sn(h),w=n.current,_="deltaX"in h?h.deltaX:w[0]-x[0],S="deltaY"in h?h.deltaY:w[1]-x[1],C,N=h.target,R=Math.abs(_)>Math.abs(S)?"h":"v";if("touches"in h&&R==="h"&&N.type==="range")return!1;var M=No(R,N);if(!M)return!0;if(M?C=R:(C=R==="v"?"h":"v",M=No(R,N)),!M)return!1;if(!r.current&&"changedTouches"in h&&(_||S)&&(r.current=C),!C)return!0;var z=r.current||C;return kg(z,y,h,z==="h"?_:S)},[]),c=p.useCallback(function(h){var y=h;if(!(!At.length||At[At.length-1]!==o)){var x="deltaY"in y?To(y):Sn(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&Ig(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var _=(i.current.shards||[]).map(Ao).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=_.length>0?a(y,_[0]):!i.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=p.useCallback(function(h,y,x,w){var _={name:h,delta:y,target:x,should:w,shadowParent:Dg(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(S){return S!==_})},1)},[]),f=p.useCallback(function(h){n.current=Sn(h),r.current=void 0},[]),m=p.useCallback(function(h){u(h.type,To(h),h.target,a(h,e.lockRef.current))},[]),g=p.useCallback(function(h){u(h.type,Sn(h),h.target,a(h,e.lockRef.current))},[]);p.useEffect(function(){return At.push(o),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",c,Tt),document.addEventListener("touchmove",c,Tt),document.addEventListener("touchstart",f,Tt),function(){At=At.filter(function(h){return h!==o}),document.removeEventListener("wheel",c,Tt),document.removeEventListener("touchmove",c,Tt),document.removeEventListener("touchstart",f,Tt)}},[]);var d=e.removeScrollBar,v=e.inert;return p.createElement(p.Fragment,null,v?p.createElement(o,{styles:Pg(s)}):null,d?p.createElement(Rg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Dg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $g=fg(ja,Fg);var Fa=p.forwardRef(function(e,t){return p.createElement(Kn,$e({},e,{ref:t,sideCar:$g}))});Fa.classNames=Kn.classNames;var Qr=["Enter"," "],Lg=["ArrowDown","PageUp","Home"],Da=["ArrowUp","PageDown","End"],Vg=[...Lg,...Da],Hg={ltr:[...Qr,"ArrowRight"],rtl:[...Qr,"ArrowLeft"]},zg={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cn="Menu",[tn,Gg,Bg]=Wi(cn),[Et,$a]=bt(cn,[Bg,da,Zn]),Xn=da(),La=Zn(),[Ug,Mt]=Et(cn),[Wg,un]=Et(cn),Va=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,a=Xn(t),[c,u]=p.useState(null),f=p.useRef(!1),m=Je(o),g=bs(s);return p.useEffect(()=>{const d=()=>{f.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>f.current=!1;return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx($f,{...a,children:l.jsx(Ug,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:u,children:l.jsx(Wg,{scope:t,onClose:p.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:i,children:r})})})};Va.displayName=cn;var qg="MenuAnchor",Is=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xn(n);return l.jsx(Lf,{...s,...r,ref:t})});Is.displayName=qg;var Ps="MenuPortal",[Zg,Ha]=Et(Ps,{forceMount:void 0}),za=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Mt(Ps,t);return l.jsx(Zg,{scope:t,forceMount:n,children:l.jsx(Rt,{present:n||o.open,children:l.jsx(wa,{asChild:!0,container:s,children:r})})})};za.displayName=Ps;var Te="MenuContent",[Kg,Os]=Et(Te),Ga=p.forwardRef((e,t)=>{const n=Ha(Te,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Te,e.__scopeMenu),i=un(Te,e.__scopeMenu);return l.jsx(tn.Provider,{scope:e.__scopeMenu,children:l.jsx(Rt,{present:r||o.open,children:l.jsx(tn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Xg,{...s,ref:t}):l.jsx(Yg,{...s,ref:t})})})})}),Xg=p.forwardRef((e,t)=>{const n=Mt(Te,e.__scopeMenu),r=p.useRef(null),s=pe(t,r);return p.useEffect(()=>{const o=r.current;if(o)return ng(o)},[]),l.jsx(Fs,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Yg=p.forwardRef((e,t)=>{const n=Mt(Te,e.__scopeMenu);return l.jsx(Fs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Jg=Nn("MenuContent.ScrollLock"),Fs=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,disableOutsideScroll:v,...h}=e,y=Mt(Te,n),x=un(Te,n),w=Xn(n),_=La(n),S=Gg(n),[C,N]=p.useState(null),R=p.useRef(null),M=pe(t,R,y.onContentChange),z=p.useRef(0),F=p.useRef(""),Z=p.useRef(0),Q=p.useRef(null),U=p.useRef("right"),D=p.useRef(0),ne=v?Fa:p.Fragment,W=v?{as:Jg,allowPinchZoom:!0}:void 0,ee=E=>{var Me,vt;const L=F.current+E,$=S().filter(we=>!we.disabled),K=document.activeElement,de=(Me=$.find(we=>we.ref.current===K))==null?void 0:Me.textValue,je=$.map(we=>we.textValue),Ee=um(je,L,de),ye=(vt=$.find(we=>we.textValue===Ee))==null?void 0:vt.ref.current;(function we(ke){F.current=ke,window.clearTimeout(z.current),ke!==""&&(z.current=window.setTimeout(()=>we(""),1e3))})(L),ye&&setTimeout(()=>ye.focus())};p.useEffect(()=>()=>window.clearTimeout(z.current),[]),cd();const I=p.useCallback(E=>{var $,K;return U.current===(($=Q.current)==null?void 0:$.side)&&fm(E,(K=Q.current)==null?void 0:K.area)},[]);return l.jsx(Kg,{scope:n,searchRef:F,onItemEnter:p.useCallback(E=>{I(E)&&E.preventDefault()},[I]),onItemLeave:p.useCallback(E=>{var L;I(E)||((L=R.current)==null||L.focus(),N(null))},[I]),onTriggerLeave:p.useCallback(E=>{I(E)&&E.preventDefault()},[I]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:p.useCallback(E=>{Q.current=E},[]),children:l.jsx(ne,{...W,children:l.jsx(Xi,{asChild:!0,trapped:s,onMountAutoFocus:G(o,E=>{var L;E.preventDefault(),(L=R.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Zi,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,children:l.jsx(Ea,{asChild:!0,..._,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:G(c,E=>{x.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Vf,{role:"menu","aria-orientation":"vertical","data-state":ol(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...h,ref:M,style:{outline:"none",...h.style},onKeyDown:G(h.onKeyDown,E=>{const $=E.target.closest("[data-radix-menu-content]")===E.currentTarget,K=E.ctrlKey||E.altKey||E.metaKey,de=E.key.length===1;$&&(E.key==="Tab"&&E.preventDefault(),!K&&de&&ee(E.key));const je=R.current;if(E.target!==je||!Vg.includes(E.key))return;E.preventDefault();const ye=S().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);Da.includes(E.key)&&ye.reverse(),lm(ye)}),onBlur:G(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(z.current),F.current="")}),onPointerMove:G(e.onPointerMove,nn(E=>{const L=E.target,$=D.current!==E.clientX;if(E.currentTarget.contains(L)&&$){const K=E.clientX>D.current?"right":"left";U.current=K,D.current=E.clientX}}))})})})})})})});Ga.displayName=Te;var Qg="MenuGroup",Ds=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{role:"group",...r,ref:t})});Ds.displayName=Qg;var em="MenuLabel",Ba=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{...r,ref:t})});Ba.displayName=em;var Pn="MenuItem",jo="menu.itemSelect",Yn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),i=un(Pn,e.__scopeMenu),a=Os(Pn,e.__scopeMenu),c=pe(t,o),u=p.useRef(!1),f=()=>{const m=o.current;if(!n&&m){const g=new CustomEvent(jo,{bubbles:!0,cancelable:!0});m.addEventListener(jo,d=>r==null?void 0:r(d),{once:!0}),Ci(m,g),g.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(Ua,{...s,ref:c,disabled:n,onClick:G(e.onClick,f),onPointerDown:m=>{var g;(g=e.onPointerDown)==null||g.call(e,m),u.current=!0},onPointerUp:G(e.onPointerUp,m=>{var g;u.current||(g=m.currentTarget)==null||g.click()}),onKeyDown:G(e.onKeyDown,m=>{const g=a.searchRef.current!=="";n||g&&m.key===" "||Qr.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Yn.displayName=Pn;var Ua=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=Os(Pn,n),a=La(n),c=p.useRef(null),u=pe(t,c),[f,m]=p.useState(!1),[g,d]=p.useState("");return p.useEffect(()=>{const v=c.current;v&&d((v.textContent??"").trim())},[o.children]),l.jsx(tn.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(Ma,{asChild:!0,...a,focusable:!r,children:l.jsx(se.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:G(e.onPointerMove,nn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,nn(v=>i.onItemLeave(v))),onFocus:G(e.onFocus,()=>m(!0)),onBlur:G(e.onBlur,()=>m(!1))})})})}),tm="MenuCheckboxItem",Wa=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return l.jsx(Ya,{scope:e.__scopeMenu,checked:n,children:l.jsx(Yn,{role:"menuitemcheckbox","aria-checked":On(n)?"mixed":n,...s,ref:t,"data-state":Ls(n),onSelect:G(s.onSelect,()=>r==null?void 0:r(On(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wa.displayName=tm;var qa="MenuRadioGroup",[nm,rm]=Et(qa,{value:void 0,onValueChange:()=>{}}),Za=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Je(r);return l.jsx(nm,{scope:e.__scopeMenu,value:n,onValueChange:o,children:l.jsx(Ds,{...s,ref:t})})});Za.displayName=qa;var Ka="MenuRadioItem",Xa=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=rm(Ka,e.__scopeMenu),o=n===s.value;return l.jsx(Ya,{scope:e.__scopeMenu,checked:o,children:l.jsx(Yn,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Ls(o),onSelect:G(r.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,n)},{checkForDefaultPrevented:!1})})})});Xa.displayName=Ka;var $s="MenuItemIndicator",[Ya,sm]=Et($s,{checked:!1}),Ja=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=sm($s,n);return l.jsx(Rt,{present:r||On(o.checked)||o.checked===!0,children:l.jsx(se.span,{...s,ref:t,"data-state":Ls(o.checked)})})});Ja.displayName=$s;var om="MenuSeparator",Qa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(se.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Qa.displayName=om;var im="MenuArrow",el=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xn(n);return l.jsx(Hf,{...s,...r,ref:t})});el.displayName=im;var am="MenuSub",[hp,tl]=Et(am),Zt="MenuSubTrigger",nl=p.forwardRef((e,t)=>{const n=Mt(Zt,e.__scopeMenu),r=un(Zt,e.__scopeMenu),s=tl(Zt,e.__scopeMenu),o=Os(Zt,e.__scopeMenu),i=p.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},f=p.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),c(null)}},[a,c]),l.jsx(Is,{asChild:!0,...u,children:l.jsx(Ua,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":ol(n.open),...e,ref:di(t,s.onTriggerChange),onClick:m=>{var g;(g=e.onClick)==null||g.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,nn(m=>{o.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:G(e.onPointerLeave,nn(m=>{var d,v;f();const g=(d=n.content)==null?void 0:d.getBoundingClientRect();if(g){const h=(v=n.content)==null?void 0:v.dataset.side,y=h==="right",x=y?-5:5,w=g[y?"left":"right"],_=g[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:m.clientX+x,y:m.clientY},{x:w,y:g.top},{x:_,y:g.top},{x:_,y:g.bottom},{x:w,y:g.bottom}],side:h}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(m),m.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,m=>{var d;const g=o.searchRef.current!=="";e.disabled||g&&m.key===" "||Hg[r.dir].includes(m.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),m.preventDefault())})})})});nl.displayName=Zt;var rl="MenuSubContent",sl=p.forwardRef((e,t)=>{const n=Ha(Te,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Te,e.__scopeMenu),i=un(Te,e.__scopeMenu),a=tl(rl,e.__scopeMenu),c=p.useRef(null),u=pe(t,c);return l.jsx(tn.Provider,{scope:e.__scopeMenu,children:l.jsx(Rt,{present:r||o.open,children:l.jsx(tn.Slot,{scope:e.__scopeMenu,children:l.jsx(Fs,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var m;i.isUsingKeyboardRef.current&&((m=c.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:G(e.onFocusOutside,f=>{f.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:G(e.onKeyDown,f=>{var d;const m=f.currentTarget.contains(f.target),g=zg[i.dir].includes(f.key);m&&g&&(o.onOpenChange(!1),(d=a.trigger)==null||d.focus(),f.preventDefault())})})})})})});sl.displayName=rl;function ol(e){return e?"open":"closed"}function On(e){return e==="indeterminate"}function Ls(e){return On(e)?"indeterminate":e?"checked":"unchecked"}function lm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function um(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=cm(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function dm(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],u=a.x,f=a.y,m=c.x,g=c.y;f>r!=g>r&&n<(m-u)*(r-f)/(g-f)+u&&(s=!s)}return s}function fm(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return dm(n,t)}function nn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var gm=Va,mm=Is,hm=za,pm=Ga,vm=Ds,xm=Ba,ym=Yn,wm=Wa,_m=Za,Sm=Xa,Cm=Ja,bm=Qa,Rm=el,Em=nl,Mm=sl,Jn="DropdownMenu",[Nm,pp]=bt(Jn,[$a]),xe=$a(),[Tm,il]=Nm(Jn),al=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=xe(t),u=p.useRef(null),[f,m]=Hn({prop:s,defaultProp:o??!1,onChange:i,caller:Jn});return l.jsx(Tm,{scope:t,triggerId:Tn(),triggerRef:u,contentId:Tn(),open:f,onOpenChange:m,onOpenToggle:p.useCallback(()=>m(g=>!g),[m]),modal:a,children:l.jsx(gm,{...c,open:f,onOpenChange:m,dir:r,modal:a,children:n})})};al.displayName=Jn;var ll="DropdownMenuTrigger",cl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=il(ll,n),i=xe(n);return l.jsx(mm,{asChild:!0,...i,children:l.jsx(se.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:di(t,o.triggerRef),onPointerDown:G(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:G(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});cl.displayName=ll;var Am="DropdownMenuPortal",ul=e=>{const{__scopeDropdownMenu:t,...n}=e,r=xe(t);return l.jsx(hm,{...r,...n})};ul.displayName=Am;var dl="DropdownMenuContent",fl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=il(dl,n),o=xe(n),i=p.useRef(!1);return l.jsx(pm,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:G(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,f=c.button===2||u;(!s.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fl.displayName=dl;var jm="DropdownMenuGroup",km=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(vm,{...s,...r,ref:t})});km.displayName=jm;var Im="DropdownMenuLabel",Pm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(xm,{...s,...r,ref:t})});Pm.displayName=Im;var Om="DropdownMenuItem",Fm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(ym,{...s,...r,ref:t})});Fm.displayName=Om;var Dm="DropdownMenuCheckboxItem",gl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(wm,{...s,...r,ref:t})});gl.displayName=Dm;var $m="DropdownMenuRadioGroup",Lm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(_m,{...s,...r,ref:t})});Lm.displayName=$m;var Vm="DropdownMenuRadioItem",Hm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Sm,{...s,...r,ref:t})});Hm.displayName=Vm;var zm="DropdownMenuItemIndicator",ml=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Cm,{...s,...r,ref:t})});ml.displayName=zm;var Gm="DropdownMenuSeparator",Bm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(bm,{...s,...r,ref:t})});Bm.displayName=Gm;var Um="DropdownMenuArrow",Wm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Rm,{...s,...r,ref:t})});Wm.displayName=Um;var qm="DropdownMenuSubTrigger",Zm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Em,{...s,...r,ref:t})});Zm.displayName=qm;var Km="DropdownMenuSubContent",Xm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Mm,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Xm.displayName=Km;var Ym=al,Jm=cl,Qm=ul,eh=fl,th=gl,nh=ml;function rh({...e}){return l.jsx(Ym,{"data-slot":"dropdown-menu",...e})}function sh({...e}){return l.jsx(Jm,{"data-slot":"dropdown-menu-trigger",...e})}function oh({className:e,sideOffset:t=4,...n}){return l.jsx(Qm,{children:l.jsx(eh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function ih({className:e,children:t,checked:n,...r}){return l.jsxs(th,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...r,children:[l.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:l.jsx(nh,{children:l.jsx(ki,{className:"size-4"})})}),t]})}function Vs({className:e,...t}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:ue("w-full caption-bottom text-sm",e),...t})})}function ah({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ue("[&_tr]:border-b",e),...t})}function Hs({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:ue("[&_tr:last-child]:border-0",e),...t})}function ge({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:ue("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function lh({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:ue("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function k({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:ue("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Qn({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:s={},pageSize:o=25,defaultSorting:i=[]}){var y,x;const[a,c]=p.useState(i),[u,f]=p.useState([]),[m,g]=p.useState(s),[d,v]=p.useState({}),h=Qu({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:zu(),getPaginationRowModel:Zu(),getSortedRowModel:Ku(),getFilteredRowModel:qu(),onColumnVisibilityChange:g,onRowSelectionChange:v,initialState:{pagination:{pageSize:o}},state:{sorting:a,columnFilters:u,columnVisibility:m,rowSelection:d}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(Hr,{placeholder:r,value:((y=h.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:w=>{var _;return(_=h.getColumn(n))==null?void 0:_.setFilterValue(w.target.value)},className:"max-w-sm"}),l.jsxs(rh,{children:[l.jsx(sh,{asChild:!0,children:l.jsxs(Pt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(fi,{className:"ml-2 h-4 w-4"})]})}),l.jsx(oh,{align:"end",children:h.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx(ih,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:_=>w.toggleVisibility(!!_),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(Vs,{children:[l.jsx(ah,{children:h.getHeaderGroups().map(w=>l.jsx(ge,{children:w.headers.map(_=>l.jsx(lh,{children:_.isPlaceholder?null:io(_.column.columnDef.header,_.getContext())},_.id))},w.id))}),l.jsx(Hs,{children:(x=h.getRowModel().rows)!=null&&x.length?h.getRowModel().rows.map(w=>l.jsx(ge,{"data-state":w.getIsSelected()&&"selected",children:w.getVisibleCells().map(_=>l.jsx(k,{children:io(_.column.columnDef.cell,_.getContext())},_.id))},w.id)):l.jsx(ge,{children:l.jsx(k,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),l.jsxs("div",{className:"flex items-center justify-end space-x-2 py-4",children:[l.jsxs("div",{className:"text-muted-foreground flex-1 text-sm",children:[h.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(Pt,{variant:"outline",size:"sm",onClick:()=>h.previousPage(),disabled:!h.getCanPreviousPage(),children:"Previous"}),l.jsx(Pt,{variant:"outline",size:"sm",onClick:()=>h.nextPage(),disabled:!h.getCanNextPage(),children:"Next"})]})]})]})}function oe(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",s=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(Pt,{variant:"ghost",onClick:()=>n.toggleSorting(n.getIsSorted()==="asc"),className:`${t==="right"?"ml-auto":""} hover:bg-muted/50 h-auto p-0 font-medium text-sm`,children:[e,s==="asc"&&l.jsx(Fc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),s==="desc"&&l.jsx(fi,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const ch=300*1e3;function hl(e){const[t,n]=p.useState(new Map),r=p.useRef();return p.useEffect(()=>{const o=new Date().toISOString(),i=new Set(e.map(a=>a.id));n(a=>{const c=new Map(a);return e.forEach(u=>{c.set(u.id,{...u,lastSeenAt:o,disconnectedAt:void 0})}),c.forEach((u,f)=>{!i.has(f)&&!u.disconnectedAt&&c.set(f,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:o,lastActivity:u.lastActivity||o})}),c})},[e]),p.useEffect(()=>{const o=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,f)=>{if(u.disconnectedAt){const m=new Date(u.disconnectedAt).getTime();i-m>ch&&c.delete(f)}}),c})};return o(),r.current=setInterval(o,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((o,i)=>o.isConnected!==i.isConnected?o.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(o.lastActivity).getTime())}function ko(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function uh(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function dh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function fh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function gh({metrics:e}){const t=e.sessions||[],n=hl(t),r=()=>[{accessorKey:"clientInfo",header:oe("Client"),cell:({row:s})=>{const o=s.original,i=o.clientInfo?`${fh(o.clientInfo.name)}@${o.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:o.clientInfo?`${o.clientInfo.name}@${o.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:oe("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:dh(s.getValue("id"))})},{accessorKey:"isConnected",header:oe("Status"),cell:({row:s})=>{const o=s.original;return l.jsxs(xt,{variant:o.isConnected?"success":"secondary",className:"gap-1",children:[o.isConnected?l.jsx(Pi,{className:"h-3 w-3"}):l.jsx(Ii,{className:"h-3 w-3"}),o.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:oe("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ko(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:oe("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:oe("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ko(s.getValue("lastActivity"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsx(Ct,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsx("p",{className:"text-sm font-mono",children:"STDIO"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:uh(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(s=>s.isConnected).length," active,"," ",n.filter(s=>!s.isConnected).length," disconnected)"]}),l.jsx(Qn,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Io(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function mh(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function Cn(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function hh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function ph(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function vh({metrics:e}){const t=e.sessions||[],n=hl(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},s=()=>[{accessorKey:"clientInfo",header:oe("Client"),cell:({row:o})=>{const i=o.original,a=i.clientInfo?`${ph(i.clientInfo.name)}@${i.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:i.clientInfo?`${i.clientInfo.name}@${i.clientInfo.version}`:"unknown",children:a})}},{accessorKey:"id",header:oe("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:hh(o.getValue("id"))})},{accessorKey:"connectionStatus",header:oe("Status"),cell:({row:o})=>{const i=o.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(xt,{variant:"success",className:"gap-1",children:[l.jsx(Pi,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(xt,{variant:"destructive",className:"gap-1",children:[l.jsx(gi,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(xt,{variant:"secondary",className:"gap-1",children:[l.jsx(Ii,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:oe("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Io(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:oe("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:oe("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Io(o.getValue("lastActivity"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsxs(Ct,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsx("p",{className:"text-sm font-mono",children:r[e.transport]||e.transport})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:mh(e.uptimeSeconds)})]})]}),e.configuration&&l.jsx(l.Fragment,{children:l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Configuration"}),l.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.pings&&l.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 p-2 rounded",children:e.pings.sent>0&&l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Ping Status:"})," ",e.pings.successful,"/",e.pings.sent," successful (",e.pings.sent>0?Math.round(e.pings.successful/e.pings.sent*100):0,"%)"]})})}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["SSE connections checked every ",Cn(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Cn(e.configuration.staleCheckInterval),", removed after"," ",Cn(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Cn(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(yt,{}),l.jsx("div",{children:l.jsx(Vs,{children:l.jsxs(Hs,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.active}),l.jsx(k,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(k,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(k,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(k,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(k,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx(k,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx(k,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx(k,{className:"text-sm font-mono",children:e.pings.sent>0?`${Math.round(e.pings.successful/e.pings.sent*100)}%`:"-"})]}),e.apiMetrics&&l.jsxs(l.Fragment,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(k,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(k,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(k,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx(k,{className:"font-medium text-sm",children:"-"}),l.jsx(k,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(o=>o.isConnected).length," active,"," ",n.filter(o=>!o.isConnected).length," disconnected)"]}),l.jsx(Qn,{columns:s(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Po(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function xh(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function yh(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function wh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function _h({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:oe("Client"),cell:({row:r})=>{const s=r.original,o=`${wh(s.name)}@${s.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${s.name}@${s.version}`,children:o}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",Po(s.firstSeen)]})]})}},{accessorKey:"requestCount",header:oe("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:oe("Status"),cell:({row:r})=>{const s=r.original;return l.jsx("div",{children:yh(s.lastSeen)?l.jsxs(xt,{variant:"success",className:"gap-1",children:[l.jsx(Ic,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(xt,{variant:"secondary",className:"gap-1",children:[l.jsx($c,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:oe("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:Po(r.getValue("lastSeen"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsx(Ct,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:"text-sm font-mono",children:"Stateless HTTP JSON"}),l.jsx(xt,{variant:"secondary",children:e.sessionLifecycle?"analytics":"stateless"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:xh(e.uptimeSeconds)})]})]}),l.jsx(yt,{}),l.jsx("div",{children:l.jsx(Vs,{children:l.jsxs(Hs,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(k,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(k,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(k,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Vc,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs(k,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx(k,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs(k,{className:"text-sm font-mono",children:[e.connections.anonymous,"/",e.connections.authenticated,"/",e.connections.unauthorized||0]})]}),e.apiMetrics&&l.jsxs(l.Fragment,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(k,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(k,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(k,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),e.sessionLifecycle?l.jsxs(l.Fragment,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(k,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx(k,{className:"font-medium text-sm",children:"-"}),l.jsx(k,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(Qn,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const Sh=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Ch(){const{data:e,error:t}=Xt("/api/transport-metrics",Sh,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(Ze,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs(Kc,{variant:"destructive",children:[l.jsx(gi,{className:"h-4 w-4"}),l.jsx(Xc,{children:"Error Loading Metrics"}),l.jsxs(Yc,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(gh,{metrics:e}):e.isStateless?l.jsx(_h,{metrics:e}):l.jsx(vh,{metrics:e}):l.jsxs(Ze,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs("div",{className:"animate-pulse space-y-2",children:[l.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),l.jsx("div",{className:"h-4 bg-gray-200 rounded w-2/3"})]})})]})}const bh=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Rh(){const[e,t]=p.useState(!1),{data:n,error:r}=Xt("/api/transport-metrics",bh,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),s=!n&&!r,o=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(g=>{let d=g.errors,v,h;if(g.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const w=g.method.replace("tools/call:",""),_=n.gradioMetrics.byTool;_[w]&&(v=_[w].success,h=_[w].failure,d+=h)}const y=g.count>0?d/g.count*100:0;return{method:g.method,count:g.count,errors:d,errorRate:y,averageResponseTime:g.averageResponseTime,lastCalled:g.lastCalled,gradioSuccess:v,gradioFailure:h}}),a=e?i.filter(g=>g.method.startsWith("tools/call")||g.method.startsWith("prompts/get")):i,c=i.reduce((g,d)=>g+d.count,0),u=i.filter(g=>g.method.startsWith("tools/call")).reduce((g,d)=>g+d.count,0),f=i.filter(g=>g.method.startsWith("prompts/get")).reduce((g,d)=>g+d.count,0),m=[{accessorKey:"method",header:oe("Method"),cell:({row:g})=>{const d=g.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:d==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):d.startsWith("tools/call:")?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call:"}),l.jsx("span",{className:"text-green-600 dark:text-green-400",children:d.replace("tools/call:","")})]}):d==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):d.startsWith("prompts/get:")?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get:"}),l.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:d.replace("prompts/get:","")})]}):d})}},{accessorKey:"count",header:oe("Calls","right"),cell:({row:g})=>l.jsx("div",{className:"text-right font-mono",children:g.getValue("count").toLocaleString()})},{accessorKey:"errors",header:oe("Errors","right"),cell:({row:g})=>{const d=g.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:d>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:d}):"0"})}},{accessorKey:"gradioMetrics",header:oe("Success/Failure","right"),cell:({row:g})=>{const d=g.original;return d.gradioSuccess!==void 0&&d.gradioFailure!==void 0?l.jsxs("div",{className:"text-right font-mono text-sm",children:[l.jsx("span",{className:"text-green-600 dark:text-green-400",children:d.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:d.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:oe("Error Rate","right"),cell:({row:g})=>{const d=g.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:d>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[d.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:oe("Avg Response","right"),cell:({row:g})=>{const d=g.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:d?`${d.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:oe("Last Called","right"),cell:({row:g})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(g.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"HTTP JSON Transport Statistics"}),l.jsxs(Ct,{children:["MCP method call statistics and performance metrics",o?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(Ye,{children:[s&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading metrics..."})}),r&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsxs("div",{className:"text-sm text-destructive",children:["Error loading metrics: ",r.message]})}),o&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:"Method tracking is not available in STDIO mode. This data is only collected for HTTP-based transports."})}),n&&!o&&l.jsxs("div",{className:"space-y-4",children:[i.length>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",a.length," method",a.length!==1?"s":""," tracked since"," ",new Date(n.startupTime).toLocaleString()]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"text-sm font-medium",children:["Total MCP Calls: ",l.jsx("span",{className:"font-mono",children:c.toLocaleString()})]}),l.jsxs("div",{className:"text-sm font-medium",children:["Tool Calls: ",l.jsx("span",{className:"font-mono",children:u.toLocaleString()})]}),l.jsxs("div",{className:"text-sm font-medium",children:["Prompt Calls: ",l.jsx("span",{className:"font-mono",children:f.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ys,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:g=>t(!!g)}),l.jsx("label",{htmlFor:"tool-prompt-calls-filter",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Show only Tools/Prompts"})]}),a.length===0?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:e?"No tool or prompt calls recorded yet.":"No method calls recorded yet."})}):l.jsx(Qn,{columns:m,data:a,searchColumn:"method",searchPlaceholder:"Filter methods...",pageSize:50,defaultColumnVisibility:{method:!0,count:!0,errors:!1,gradioMetrics:!1,errorRate:!0,averageResponseTime:n.transport==="streamableHttpJson",lastCalled:!0},defaultSorting:[{id:"count",desc:!0}]})]})]})]})}function Oo(e){return e.transport==="stdio"?e.defaultHfTokenSet&&e.hfTokenMasked?{text:e.hfTokenMasked,isWarning:!1}:{text:"Warning: No token set",isWarning:!0}:e.defaultHfTokenSet?{text:`⚠️ Using ${e.hfTokenMasked||"token"} as default`,isWarning:!0}:{text:"Using Authorization Headers",isWarning:!1}}function Eh({isLoading:e,error:t,transportInfo:n}){const r=()=>{switch(n.transport){case"stdio":return"STDIO";case"sse":return"SSE";case"streamableHttp":case"streamableHttpJson":return"Streamable HTTP";default:return"Unknown"}},s=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},o=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>o()?l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-green-100 text-green-800 text-[10px] rounded-sm whitespace-nowrap",children:"JSON (stateless)"}):n.transport==="streamableHttp"?l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-blue-100 text-blue-800 text-[10px] rounded-sm whitespace-nowrap",children:"Session Based"}):n.transport==="sse"?l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-purple-100 text-purple-800 text-[10px] rounded-sm whitespace-nowrap",children:"Event Stream"}):null;if(e)return l.jsx("div",{className:"text-center text-xs text-muted-foreground py-2",children:"Loading connection information..."});if(t)return l.jsxs("div",{className:"text-center text-xs text-destructive py-2",children:["Error: ",t]});const a=n.port||3e3,c=n.transport!=="stdio";return l.jsx("div",{className:"fixed bottom-0 left-0 w-full bg-muted/50 border-t border-border py-2 px-4",children:l.jsxs("div",{className:"max-w-[700px] mx-auto flex justify-between items-center text-xs",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:"Using"}),l.jsx("span",{className:"font-medium text-primary",children:r()}),n.transport==="stdio"&&l.jsxs("span",{className:"text-muted-foreground flex items-center",children:["Client Info :",n.stdioClient?l.jsx("span",{className:"ml-2 flex items-center",children:l.jsxs("span",{className:"ml-1 font-medium text-green-700",children:[n.stdioClient.name," ",n.stdioClient.version]})}):l.jsx("span",{className:"ml-2 text-muted-foreground",children:" (disconnected) "})]}),c&&l.jsxs("span",{className:"text-muted-foreground flex items-center",children:["on port ",l.jsx("span",{className:"font-mono mx-1",children:a}),"at ",l.jsx("span",{className:"font-mono mx-1",children:s()}),i()]})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:" Default HF Token:"}),l.jsx("span",{className:`font-mono ${Oo(n).isWarning?"text-red-500":""}`,children:Oo(n).text})]})]})})}var er="Tabs",[Mh,vp]=bt(er,[Zn]),pl=Zn(),[Nh,zs]=Mh(er),vl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,f=bs(a),[m,g]=Hn({prop:r,onChange:s,defaultProp:o??"",caller:er});return l.jsx(Nh,{scope:n,baseId:Tn(),value:m,onValueChange:g,orientation:i,dir:f,activationMode:c,children:l.jsx(se.div,{dir:f,"data-orientation":i,...u,ref:t})})});vl.displayName=er;var xl="TabsList",yl=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=zs(xl,n),i=pl(n);return l.jsx(Ea,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(se.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});yl.displayName=xl;var wl="TabsTrigger",_l=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=zs(wl,n),a=pl(n),c=bl(i.baseId,r),u=Rl(i.baseId,r),f=r===i.value;return l.jsx(Ma,{asChild:!0,...a,focusable:!s,active:f,children:l.jsx(se.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:G(e.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?i.onValueChange(r):m.preventDefault()}),onKeyDown:G(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&i.onValueChange(r)}),onFocus:G(e.onFocus,()=>{const m=i.activationMode!=="manual";!f&&!s&&m&&i.onValueChange(r)})})})});_l.displayName=wl;var Sl="TabsContent",Cl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=zs(Sl,n),c=bl(a.baseId,r),u=Rl(a.baseId,r),f=r===a.value,m=p.useRef(f);return p.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Rt,{present:s||f,children:({present:g})=>l.jsx(se.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:g&&o})})});Cl.displayName=Sl;function bl(e,t){return`${e}-trigger-${t}`}function Rl(e,t){return`${e}-content-${t}`}var Th=vl,Ah=yl,jh=_l,kh=Cl;function Ih({className:e,...t}){return l.jsx(Th,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function Ph({className:e,...t}){return l.jsx(Ah,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function jt({className:e,...t}){return l.jsx(jh,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function kt({className:e,...t}){return l.jsx(kh,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}var J;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(J||(J={}));var Fo;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Fo||(Fo={}));const A=J.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),st=e=>{switch(typeof e){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(e)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":return Array.isArray(e)?A.array:e===null?A.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?A.promise:typeof Map<"u"&&e instanceof Map?A.map:typeof Set<"u"&&e instanceof Set?A.set:typeof Date<"u"&&e instanceof Date?A.date:A.object;default:return A.unknown}},b=J.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 tt extends Error{get errors(){return this.issues}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}format(t){const n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),r}static assert(t){if(!(t instanceof tt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,J.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];n[o]=n[o]||[],n[o].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}tt.create=e=>new tt(e);const es=(e,t)=>{let n;switch(e.code){case b.invalid_type:e.received===A.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,J.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:n=`Unrecognized key(s) in object: ${J.joinValues(e.keys,", ")}`;break;case b.invalid_union:n="Invalid input";break;case b.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${J.joinValues(e.options)}`;break;case b.invalid_enum_value:n=`Invalid enum value. Expected ${J.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:n="Invalid function arguments";break;case b.invalid_return_type:n="Invalid function return type";break;case b.invalid_date:n="Invalid date";break;case b.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}"`:J.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case b.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==="bigint"?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 b.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 b.custom:n="Invalid input";break;case b.invalid_intersection_types:n="Intersection results could not be merged";break;case b.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:n="Number must be finite";break;default:n=t.defaultError,J.assertNever(e)}return{message:n}};let Oh=es;function Fh(){return Oh}const Dh=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}};function T(e,t){const n=Fh(),r=Dh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===es?void 0:es].filter(s=>!!s)});e.common.issues.push(r)}class Re{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 s of n){if(s.status==="aborted")return V;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const o=await s.key,i=await s.value;r.push({key:o,value:i})}return Re.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return V;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const V=Object.freeze({status:"aborted"}),Kt=e=>({status:"dirty",value:e}),Ae=e=>({status:"valid",value:e}),Do=e=>e.status==="aborted",$o=e=>e.status==="dirty",$t=e=>e.status==="valid",Fn=e=>typeof Promise<"u"&&e instanceof Promise;var j;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(j||(j={}));class ht{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lo=(e,t)=>{if($t(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 tt(e.common.issues);return this._error=n,this._error}}};function B(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=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:s}:{errorMap:(i,a)=>{const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}class Y{get description(){return this._def.description}_getType(t){return st(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:st(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Re,ctx:{common:t.parent.common,data:t.data,parsedType:st(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Fn(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){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Lo(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return $t(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(s=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>$t(o)?{value:o.value}:{issues:n.common.issues})}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:st(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(Fn(s)?s:Promise.resolve(s));return Lo(r,o)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:b.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ht({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}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),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ct.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return He.create(this)}promise(){return Vn.create(this,this._def)}or(t){return $n.create([this,t],this._def)}and(t){return Ln.create(this,t,this._def)}transform(t){return new Ht({...B(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new rs({...B(this._def),innerType:this,defaultValue:n,typeName:H.ZodDefault})}brand(){return new ip({typeName:H.ZodBranded,type:this,...B(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ss({...B(this._def),innerType:this,catchValue:n,typeName:H.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Gs.create(this,t)}readonly(){return os.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $h=/^c[^\s-]{8,}$/i,Lh=/^[0-9a-z]+$/,Vh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hh=/^[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,zh=/^[a-z0-9_-]{21}$/i,Gh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Bh=/^[-+]?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)?)??$/,Uh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ar;const qh=/^(?:(?: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])$/,Zh=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Kh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Xh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,El="((\\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])))",Qh=new RegExp(`^${El}$`);function Ml(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ep(e){return new RegExp(`^${Ml(e)}$`)}function tp(e){let t=`${El}T${Ml(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 np(e,t){return!!((t==="v4"||!t)&&qh.test(e)||(t==="v6"||!t)&&Kh.test(e))}function rp(e,t){if(!Gh.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function sp(e,t){return!!((t==="v4"||!t)&&Zh.test(e)||(t==="v6"||!t)&&Xh.test(e))}class at extends Y{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==A.string){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.string,received:o.parsedType}),V}const r=new Re;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?T(s,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&T(s,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Uh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Ar||(Ar=new RegExp(Wh,"u")),Ar.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Hh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")zh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")$h.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Lh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Vh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),T(s,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?tp(o).test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Qh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ep(o).test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Bh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?np(t.data,o.version)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?rp(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?sp(t.data,o.version)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Yh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Jh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):J.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:b.invalid_string,...j.errToObj(r)})}_addCheck(t){return new at({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...j.errToObj(t)})}url(t){return this._addCheck({kind:"url",...j.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...j.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...j.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...j.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...j.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...j.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...j.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...j.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...j.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...j.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...j.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...j.errToObj(t)})}datetime(t){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:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...j.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,...j.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...j.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...j.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...j.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...j.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...j.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...j.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...j.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...j.errToObj(n)})}nonempty(t){return this.min(1,j.errToObj(t))}trim(){return new at({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new at({...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 isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}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}}at.create=e=>new at({checks:[],typeName:H.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});function op(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}class Lt extends Y{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)!==A.number){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.number,received:o.parsedType}),V}let r;const s=new Re;for(const o of this._def.checks)o.kind==="int"?J.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?op(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_finite,message:o.message}),s.dirty()):J.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,j.toString(n))}gt(t,n){return this.setLimit("min",t,!1,j.toString(n))}lte(t,n){return this.setLimit("max",t,!0,j.toString(n))}lt(t,n){return this.setLimit("max",t,!1,j.toString(n))}setLimit(t,n,r,s){return new Lt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:j.toString(s)}]})}_addCheck(t){return new Lt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:j.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:j.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:j.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.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"&&J.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)}}Lt.create=e=>new Lt({checks:[],typeName:H.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...B(e)});class rn extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==A.bigint)return this._getInvalidInput(t);let r;const s=new Re;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):J.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.bigint,received:n.parsedType}),V}gte(t,n){return this.setLimit("min",t,!0,j.toString(n))}gt(t,n){return this.setLimit("min",t,!1,j.toString(n))}lte(t,n){return this.setLimit("max",t,!0,j.toString(n))}lt(t,n){return this.setLimit("max",t,!1,j.toString(n))}setLimit(t,n,r,s){return new rn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:j.toString(s)}]})}_addCheck(t){return new rn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:j.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}}rn.create=e=>new rn({checks:[],typeName:H.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});class ts extends Y{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==A.boolean){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.boolean,received:r.parsedType}),V}return Ae(t.data)}}ts.create=e=>new ts({typeName:H.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...B(e)});class Dn extends Y{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==A.date){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.date,received:o.parsedType}),V}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_date}),V}const r=new Re;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):J.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Dn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:j.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:j.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}}Dn.create=e=>new Dn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:H.ZodDate,...B(e)});class Vo extends Y{_parse(t){if(this._getType(t)!==A.symbol){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.symbol,received:r.parsedType}),V}return Ae(t.data)}}Vo.create=e=>new Vo({typeName:H.ZodSymbol,...B(e)});class Ho extends Y{_parse(t){if(this._getType(t)!==A.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.undefined,received:r.parsedType}),V}return Ae(t.data)}}Ho.create=e=>new Ho({typeName:H.ZodUndefined,...B(e)});class zo extends Y{_parse(t){if(this._getType(t)!==A.null){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.null,received:r.parsedType}),V}return Ae(t.data)}}zo.create=e=>new zo({typeName:H.ZodNull,...B(e)});class Go extends Y{constructor(){super(...arguments),this._any=!0}_parse(t){return Ae(t.data)}}Go.create=e=>new Go({typeName:H.ZodAny,...B(e)});class Bo extends Y{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ae(t.data)}}Bo.create=e=>new Bo({typeName:H.ZodUnknown,...B(e)});class pt extends Y{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.never,received:n.parsedType}),V}}pt.create=e=>new pt({typeName:H.ZodNever,...B(e)});class Uo extends Y{_parse(t){if(this._getType(t)!==A.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.void,received:r.parsedType}),V}return Ae(t.data)}}Uo.create=e=>new Uo({typeName:H.ZodVoid,...B(e)});class He extends Y{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==A.array)return T(n,{code:b.invalid_type,expected:A.array,received:n.parsedType}),V;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(i||a)&&(T(n,{code:i?b.too_big:b.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(T(n,{code:b.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(T(n,{code:b.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new ht(n,i,n.path,a)))).then(i=>Re.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new ht(n,i,n.path,a)));return Re.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new He({...this._def,minLength:{value:t,message:j.toString(n)}})}max(t,n){return new He({...this._def,maxLength:{value:t,message:j.toString(n)}})}length(t,n){return new He({...this._def,exactLength:{value:t,message:j.toString(n)}})}nonempty(t){return this.min(1,t)}}He.create=(e,t)=>new He({type:e,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...B(t)});function It(e){if(e instanceof ce){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ct.create(It(r))}return new ce({...e._def,shape:()=>t})}else return e instanceof He?new He({...e._def,type:It(e.element)}):e instanceof ct?ct.create(It(e.unwrap())):e instanceof zt?zt.create(It(e.unwrap())):e instanceof _t?_t.create(e.items.map(t=>It(t))):e}class ce extends Y{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=J.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==A.object){const u=this._getOrReturnCtx(t);return T(u,{code:b.invalid_type,expected:A.object,received:u.parsedType}),V}const{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof pt&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const f=o[u],m=s.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new ht(s,m,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof pt){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")a.length>0&&(T(s,{code:b.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of a){const m=s.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new ht(s,m,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of c){const m=await f.key,g=await f.value;u.push({key:m,value:g,alwaysSet:f.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(r,u)):Re.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return j.errToObj,new ce({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i;const s=((i=(o=this._def).errorMap)==null?void 0:i.call(o,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new ce({...this._def,unknownKeys:"strip"})}passthrough(){return new ce({...this._def,unknownKeys:"passthrough"})}extend(t){return new ce({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ce({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:H.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ce({...this._def,catchall:t})}pick(t){const n={};for(const r of J.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ce({...this._def,shape:()=>n})}omit(t){const n={};for(const r of J.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new ce({...this._def,shape:()=>n})}deepPartial(){return It(this)}partial(t){const n={};for(const r of J.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new ce({...this._def,shape:()=>n})}required(t){const n={};for(const r of J.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ct;)o=o._def.innerType;n[r]=o}return new ce({...this._def,shape:()=>n})}keyof(){return Nl(J.objectKeys(this.shape))}}ce.create=(e,t)=>new ce({shape:()=>e,unknownKeys:"strip",catchall:pt.create(),typeName:H.ZodObject,...B(t)});ce.strictCreate=(e,t)=>new ce({shape:()=>e,unknownKeys:"strict",catchall:pt.create(),typeName:H.ZodObject,...B(t)});ce.lazycreate=(e,t)=>new ce({shape:e,unknownKeys:"strip",catchall:pt.create(),typeName:H.ZodObject,...B(t)});class $n extends Y{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new tt(a.ctx.common.issues));return T(n,{code:b.invalid_union,unionErrors:i}),V}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},f=c._parseSync({data:n.data,path:n.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new tt(c));return T(n,{code:b.invalid_union,unionErrors:a}),V}}get options(){return this._def.options}}$n.create=(e,t)=>new $n({options:e,typeName:H.ZodUnion,...B(t)});function ns(e,t){const n=st(e),r=st(t);if(e===t)return{valid:!0,data:e};if(n===A.object&&r===A.object){const s=J.objectKeys(t),o=J.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=ns(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===A.array&&r===A.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const i=e[o],a=t[o],c=ns(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===A.date&&r===A.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ln extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(o,i)=>{if(Do(o)||Do(i))return V;const a=ns(o.value,i.value);return a.valid?(($o(o)||$o(i))&&n.dirty(),{status:n.value,value:a.data}):(T(r,{code:b.invalid_intersection_types}),V)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ln.create=(e,t,n)=>new Ln({left:e,right:t,typeName:H.ZodIntersection,...B(n)});class _t extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.array)return T(r,{code:b.invalid_type,expected:A.array,received:r.parsedType}),V;if(r.data.length<this._def.items.length)return T(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),V;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ht(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>Re.mergeArray(n,i)):Re.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new _t({...this._def,rest:t})}}_t.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _t({items:e,typeName:H.ZodTuple,rest:null,...B(t)})};class Wo extends Y{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!==A.map)return T(r,{code:b.invalid_type,expected:A.map,received:r.parsedType}),V;const s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:s._parse(new ht(r,a,r.path,[u,"key"])),value:o._parse(new ht(r,c,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return V;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(u.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return V;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(u.value,f.value)}return{status:n.value,value:a}}}}Wo.create=(e,t,n)=>new Wo({valueType:t,keyType:e,typeName:H.ZodMap,...B(n)});class sn extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.set)return T(r,{code:b.invalid_type,expected:A.set,received:r.parsedType}),V;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(T(r,{code:b.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(T(r,{code:b.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const f of c){if(f.status==="aborted")return V;f.status==="dirty"&&n.dirty(),u.add(f.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>o._parse(new ht(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new sn({...this._def,minSize:{value:t,message:j.toString(n)}})}max(t,n){return new sn({...this._def,maxSize:{value:t,message:j.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}sn.create=(e,t)=>new sn({valueType:e,minSize:null,maxSize:null,typeName:H.ZodSet,...B(t)});class qo extends Y{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})}}qo.create=(e,t)=>new qo({getter:e,typeName:H.ZodLazy,...B(t)});class Zo extends Y{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return T(n,{received:n.data,code:b.invalid_literal,expected:this._def.value}),V}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zo.create=(e,t)=>new Zo({value:e,typeName:H.ZodLiteral,...B(t)});function Nl(e,t){return new Vt({values:e,typeName:H.ZodEnum,...B(t)})}class Vt extends Y{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{expected:J.joinValues(r),received:n.parsedType,code:b.invalid_type}),V}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{received:n.data,code:b.invalid_enum_value,options:r}),V}return Ae(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 Vt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Vt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Vt.create=Nl;class Ko extends Y{_parse(t){const n=J.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==A.string&&r.parsedType!==A.number){const s=J.objectValues(n);return T(r,{expected:J.joinValues(s),received:r.parsedType,code:b.invalid_type}),V}if(this._cache||(this._cache=new Set(J.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=J.objectValues(n);return T(r,{received:r.data,code:b.invalid_enum_value,options:s}),V}return Ae(t.data)}get enum(){return this._def.values}}Ko.create=(e,t)=>new Ko({values:e,typeName:H.ZodNativeEnum,...B(t)});class Vn extends Y{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==A.promise&&n.common.async===!1)return T(n,{code:b.invalid_type,expected:A.promise,received:n.parsedType}),V;const r=n.parsedType===A.promise?n.data:Promise.resolve(n.data);return Ae(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Vn.create=(e,t)=>new Vn({type:e,typeName:H.ZodPromise,...B(t)});class Ht extends Y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{T(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return V;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?V:c.status==="dirty"||n.value==="dirty"?Kt(c.value):c});{if(n.value==="aborted")return V;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?V:a.status==="dirty"||n.value==="dirty"?Kt(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c 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"?V:(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"?V:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$t(i))return V;const a=s.transform(i.value,o);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=>$t(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:n.value,value:a})):V);J.assertNever(s)}}Ht.create=(e,t,n)=>new Ht({schema:e,typeName:H.ZodEffects,effect:t,...B(n)});Ht.createWithPreprocess=(e,t,n)=>new Ht({schema:t,effect:{type:"preprocess",transform:e},typeName:H.ZodEffects,...B(n)});class ct extends Y{_parse(t){return this._getType(t)===A.undefined?Ae(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ct.create=(e,t)=>new ct({innerType:e,typeName:H.ZodOptional,...B(t)});class zt extends Y{_parse(t){return this._getType(t)===A.null?Ae(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}zt.create=(e,t)=>new zt({innerType:e,typeName:H.ZodNullable,...B(t)});class rs extends Y{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===A.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:H.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...B(t)});class ss extends Y{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Fn(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ss.create=(e,t)=>new ss({innerType:e,typeName:H.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...B(t)});class Xo extends Y{_parse(t){if(this._getType(t)!==A.nan){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.nan,received:r.parsedType}),V}return{status:"valid",value:t.data}}}Xo.create=e=>new Xo({typeName:H.ZodNaN,...B(e)});class ip extends Y{_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 Gs extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?V:o.status==="dirty"?(n.dirty(),Kt(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?V:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Gs({in:t,out:n,typeName:H.ZodPipeline})}}class os extends Y{_parse(t){const n=this._def.innerType._parse(t),r=s=>($t(s)&&(s.value=Object.freeze(s.value)),s);return Fn(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}os.create=(e,t)=>new os({innerType:e,typeName:H.ZodReadonly,...B(t)});var H;(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"})(H||(H={}));const ie=at.create,dn=Lt.create,tr=ts.create;pt.create;const Tl=He.create,fe=ce.create;$n.create;Ln.create;_t.create;const Ut=Vt.create;Vn.create;ct.create;zt.create;const ap=10,is={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:fe({query:ie().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:dn().optional().default(ap).describe("Number of results to return"),mcp:tr().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},as={name:"model_search",description:"Find Machine Learning models hosted on Hugging Face. Returns comprehensive information about matching models including downloads, likes, tags, and direct links. Include links to the models in your response",schema:fe({query:ie().optional().describe('Search term. Leave blank and specify "sort" and "limit" to get e.g. "Top 20 trending models", "Top 10 most recent models" etc" '),author:ie().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:ie().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:ie().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:Ut(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:dn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var jr=65536;lp();function lp(){try{return new Uint32Array(jr)}catch{const t=new Array(jr);for(let n=0;n<jr;n++)t[n]=0;return t}}const ls={name:"model_details",description:"Get detailed information about a model from the Hugging Face Hub. Include relevant links in result summaries.",schema:fe({model_id:ie().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")}),annotations:{title:"Model Details"}};fe({model_id:ie().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const cs={name:"paper_search",description:"Find Machine Learning research papers on the Hugging Face hub. Include 'Link to paper' When presenting the results. Consider whether tabulating results matches user intent.",schema:fe({query:ie().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:dn().optional().default(12).describe("Number of results to return"),concise_only:tr().optional().default(!1).describe("Return a 2 sentence summary of the abstract. Use for broad search terms which may return a lot of results. Check with User if unsure.")}),annotations:{title:"Paper Search"}},us={name:"dataset_search",description:"Find Datasets hosted on the Hugging Face hub. Returns comprehensive information about matching datasets including downloads, likes, tags, and direct links. Include links to the datasets in your response",schema:fe({query:ie().optional().describe('Search term. Leave blank and specify "sort" and "limit" to get e.g. "Top 20 trending datasets", "Top 10 most recent datasets" etc" '),author:ie().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:Tl(ie()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:Ut(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:dn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},ds={name:"dataset_details",description:"Get detailed information about a specific dataset on Hugging Face Hub.",schema:fe({dataset_id:ie().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")}),annotations:{title:"Dataset Details"}};fe({dataset_id:ie().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const fs={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified.",schema:fe({repo_ids:Tl(ie().min(1)).min(1,"Provide at least one id").max(10,"Provide at most 10 repo ids").describe("Repo IDs for (models|dataset/space) - usually in author/name format (e.g. openai/gpt-oss-120b)"),repo_type:Ut(["model","dataset","space"]).optional().describe("Specify lookup type; otherwise auto-detects"),include_readme:tr().default(!1).describe("Include README from the repo")}),annotations:{title:"Hub Repo Details"}},Al={name:"duplicate_space",schema:fe({sourceSpaceId:ie().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:ie().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:Ut(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:tr().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}},jl={name:"space_info",schema:fe({username:ie().optional().describe("Username to get spaces for (defaults to authenticated user)")}),annotations:{title:"Hugging Face Spaces Information"}},kl={name:"space_files",schema:fe({spaceName:ie().optional().describe('Space identifier in format "username/spacename"'),fileType:Ut(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};fe({fileType:Ut(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});fe({});fe({user_id:ie().min(3,"User ID must be at least 3 characters long").describe('Hugging Face user ID or URL (e.g., "evalstate" or "hf.co/evalstate")').max(60).describe("Maximum length is 30 characters")});fe({paper_id:ie().min(1,"Paper ID is required").describe('arXiv paper ID in various formats (e.g., "2502.16161", "arxiv:2502.16161", or full URL)').max(60).describe("Maximum length is 100 characters")});var Bs=typeof window<"u"?window:{};function cp(){var e=Bs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function up(){var e=function(){};return dp()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function dp(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Bs.ActiveXObject&&(e=!0)}return e}cp()?Bs.DOMParser:up();const gs={name:"hf_doc_fetch",description:"Fetch a document from the Hugging Face or Gradio documentation library. For large documents, use offset to get subsequent chunks.",schema:fe({doc_url:ie().max(200,"Query too long").describe("Documentation URL (Hugging Face or Gradio)"),offset:dn().min(0).optional().describe("Token offset for large documents (use the offset from truncation message)")}),annotations:{title:"Fetch a document from the Hugging Face documentation library"}},ms={name:"hf_doc_search",description:"Search documentation about all of Hugging Face products and libraries (Transformers, Datasets, Diffusers, Gradio, Hub, and more). Use this for the most up-to-date information Returns excerpts grouped by Product and Document.",schema:fe({query:ie().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic search query"),product:ie().optional().describe('Filter by Product (e.g., "hub", "dataset-viewer", "transformers"). Supply when known for focused results')}),annotations:{title:"Hugging Face Documentation Library Search"}},Yo=is.name,Jo=as.name,Qo=ls.name,ei=cs.name,ti=us.name,ni=ds.name,ri=fs.name,si=Al.name,oi=jl.name,ii=kl.name,ai=ms.name,li=gs.name,kr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function fp(){var N,R,M,z,F,Z,Q,U,D,ne,W,ee,I;const{data:e,error:t}=Xt("/api/transport",kr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});Xt("/api/sessions",kr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=Xt("/api/settings",kr),[r,s]=p.useState(["","",""]),[o,i]=p.useState(["","",""]),[a,c]=p.useState([!1,!1,!1]),[u,f]=p.useState(!1);p.useEffect(()=>{if(n!=null&&n.spaceTools&&!u){const E=["","",""],L=["","",""],$=[!1,!1,!1];n.spaceTools.forEach((K,de)=>{de<3&&(E[de]=K.name,L[de]=K.subdomain,$[de]=!0)}),s(E),i(L),c($),f(!0)}},[n,u]);const m=!e&&!t,g=t?t.message:null,d=async(E,L)=>{try{const $=n||{builtInTools:[]},K=$.builtInTools,de=L?[...K.filter(ye=>ye!==E),E]:K.filter(ye=>ye!==E),je={...$,builtInTools:de};bn("/api/settings",je,!1);const Ee=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:de})});if(!Ee.ok)throw new Error(`Failed to update tool settings: ${Ee.status}`);bn("/api/settings"),console.log(`${E} is now ${L?"enabled":"disabled"}`)}catch($){console.error("Error updating tool settings:",$),alert(`Error updating ${E}: ${$ instanceof Error?$.message:"Unknown error"}`),bn("/api/settings")}},v=async(E,L)=>{const $=[...a];$[E]=L,c($),await x($)},h=async(E,L)=>{const $=[...r];$[E]=L,s($),a[E]&&await x(a)},y=async(E,L)=>{const $=[...o];$[E]=L,i($),a[E]&&await x(a)},x=async E=>{try{const L=[];for(let K=0;K<3;K++)E[K]&&r[K]&&o[K]&&L.push({_id:`space-${K}`,name:r[K],subdomain:o[K],emoji:"🔧"});const $=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:L})});if(!$.ok)throw new Error(`Failed to update space tools: ${$.status}`)}catch(L){console.error("Error updating space tools:",L)}},w=async()=>{const E="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(E)}catch(L){console.error("Failed to copy URL:",L)}},_=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},S={paper_search:{id:ei,label:cs.annotations.title,description:cs.description,settings:{enabled:((N=n==null?void 0:n.builtInTools)==null?void 0:N.includes(ei))??!0}},space_search:{id:Yo,label:is.annotations.title,description:is.description,settings:{enabled:((R=n==null?void 0:n.builtInTools)==null?void 0:R.includes(Yo))??!0}},model_search:{id:Jo,label:as.annotations.title,description:as.description,settings:{enabled:((M=n==null?void 0:n.builtInTools)==null?void 0:M.includes(Jo))??!0}},model_details:{id:Qo,label:ls.annotations.title,description:ls.description,settings:{enabled:((z=n==null?void 0:n.builtInTools)==null?void 0:z.includes(Qo))??!0}},dataset_search:{id:ti,label:us.annotations.title,description:us.description,settings:{enabled:((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(ti))??!0}},dataset_details:{id:ni,label:ds.annotations.title,description:ds.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(ni))??!0}},hub_repo_details:{id:ri,label:fs.annotations.title,description:fs.description,settings:{enabled:((Q=n==null?void 0:n.builtInTools)==null?void 0:Q.includes(ri))??!0}},include_readme:{id:"INCLUDE_README",label:"Include README (flag)",description:"Adds README content to hub_repo_details output when enabled. This is a behavior flag, not a tool. Requires reconnect to take effect",settings:{enabled:((U=n==null?void 0:n.builtInTools)==null?void 0:U.includes("INCLUDE_README"))??!1}},doc_semantic_search:{id:ai,label:ms.annotations.title,description:ms.description,settings:{enabled:((D=n==null?void 0:n.builtInTools)==null?void 0:D.includes(ai))??!0}},doc_fetch:{id:li,label:gs.annotations.title,description:gs.description,settings:{enabled:((ne=n==null?void 0:n.builtInTools)==null?void 0:ne.includes(li))??!0}}},C={duplicate_space:{id:si,label:Al.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((W=n==null?void 0:n.builtInTools)==null?void 0:W.includes(si))??!0}},space_info:{id:oi,label:jl.annotations.title,description:"Get detailed information about Hugging Face Spaces.",settings:{enabled:((ee=n==null?void 0:n.builtInTools)==null?void 0:ee.includes(oi))??!0}},space_files:{id:ii,label:kl.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((I=n==null?void 0:n.builtInTools)==null?void 0:I.includes(ii))??!0}}};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"min-h-screen p-4 sm:p-8 pb-20",children:l.jsx("div",{className:"max-w-4xl mx-auto",children:l.jsxs(Ih,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(Ph,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(jt,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(jt,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(jt,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(jt,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(jt,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(jt,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(kt,{value:"metrics",className:"mt-0",children:l.jsx(Ch,{})}),l.jsx(kt,{value:"mcp",className:"mt-0",children:l.jsx(Rh,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"search",className:"mt-0",children:l.jsx(no,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:S,onToolToggle:d})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"spaces",className:"mt-0",children:l.jsx(no,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:C,onToolToggle:d})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"gradio",className:"mt-0",children:l.jsx(qc,{spaceNames:r,spaceSubdomains:o,enabledSpaces:a,onSpaceToolToggle:v,onSpaceToolNameChange:h,onSpaceToolSubdomainChange:y})}),l.jsx(kt,{value:"home",className:"mt-0",children:l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"🤗 HF MCP Server"}),l.jsx(Ct,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(Ye,{className:"space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What's MCP?"}),l.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This HF MCP Server provides access to Hugging Face's ecosystem of models, datasets, and Spaces, allowing AI assistants to search, analyze, and interact with ML resources directly."})]}),l.jsx(yt,{}),l.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:l.jsxs("div",{className:"flex items-start space-x-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"Tool Management Scope"}),((e==null?void 0:e.externalApiMode)||(e==null?void 0:e.transport)!=="stdio"&&!(e!=null&&e.externalApiMode))&&l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 leading-relaxed",children:e!=null&&e.externalApiMode?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"External API Mode:"})," Tools are managed by an external API. Tool Selection Tabs are not available."]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"Shared Mode:"})," Tool toggles in this interface affect"," ",l.jsx("strong",{children:"all connected MCP server instances"})," and control tool availability for all connected Hosts."]})})]})]})}),l.jsx(yt,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(Pt,{size:"xl",onClick:w,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx($l,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(Pt,{size:"xl",variant:"outline",onClick:_,className:"w-full touch-manipulation",children:[l.jsx(Ll,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(Eh,{isLoading:m,error:g,transportInfo:e||{transport:"unknown"}})]})}Vl.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(fp,{})}));
105
+ `)},Og=0,At=[];function Fg(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),s=p.useState(Og++)[0],o=p.useState(ka)[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=rg([e.lockRef.current],(e.shards||[]).map(Ao),!0).filter(Boolean);return h.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=p.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var x=Sn(h),w=n.current,_="deltaX"in h?h.deltaX:w[0]-x[0],S="deltaY"in h?h.deltaY:w[1]-x[1],C,N=h.target,R=Math.abs(_)>Math.abs(S)?"h":"v";if("touches"in h&&R==="h"&&N.type==="range")return!1;var M=No(R,N);if(!M)return!0;if(M?C=R:(C=R==="v"?"h":"v",M=No(R,N)),!M)return!1;if(!r.current&&"changedTouches"in h&&(_||S)&&(r.current=C),!C)return!0;var z=r.current||C;return kg(z,y,h,z==="h"?_:S)},[]),c=p.useCallback(function(h){var y=h;if(!(!At.length||At[At.length-1]!==o)){var x="deltaY"in y?To(y):Sn(y),w=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&Ig(C.delta,x)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var _=(i.current.shards||[]).map(Ao).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=_.length>0?a(y,_[0]):!i.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=p.useCallback(function(h,y,x,w){var _={name:h,delta:y,target:x,should:w,shadowParent:Dg(x)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(S){return S!==_})},1)},[]),f=p.useCallback(function(h){n.current=Sn(h),r.current=void 0},[]),m=p.useCallback(function(h){u(h.type,To(h),h.target,a(h,e.lockRef.current))},[]),g=p.useCallback(function(h){u(h.type,Sn(h),h.target,a(h,e.lockRef.current))},[]);p.useEffect(function(){return At.push(o),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",c,Tt),document.addEventListener("touchmove",c,Tt),document.addEventListener("touchstart",f,Tt),function(){At=At.filter(function(h){return h!==o}),document.removeEventListener("wheel",c,Tt),document.removeEventListener("touchmove",c,Tt),document.removeEventListener("touchstart",f,Tt)}},[]);var d=e.removeScrollBar,v=e.inert;return p.createElement(p.Fragment,null,v?p.createElement(o,{styles:Pg(s)}):null,d?p.createElement(Rg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Dg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $g=fg(ja,Fg);var Fa=p.forwardRef(function(e,t){return p.createElement(Kn,$e({},e,{ref:t,sideCar:$g}))});Fa.classNames=Kn.classNames;var Qr=["Enter"," "],Lg=["ArrowDown","PageUp","Home"],Da=["ArrowUp","PageDown","End"],Vg=[...Lg,...Da],Hg={ltr:[...Qr,"ArrowRight"],rtl:[...Qr,"ArrowLeft"]},zg={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cn="Menu",[tn,Gg,Bg]=Wi(cn),[Et,$a]=bt(cn,[Bg,da,Zn]),Xn=da(),La=Zn(),[Ug,Mt]=Et(cn),[Wg,un]=Et(cn),Va=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:i=!0}=e,a=Xn(t),[c,u]=p.useState(null),f=p.useRef(!1),m=Je(o),g=bs(s);return p.useEffect(()=>{const d=()=>{f.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>f.current=!1;return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx($f,{...a,children:l.jsx(Ug,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:u,children:l.jsx(Wg,{scope:t,onClose:p.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:i,children:r})})})};Va.displayName=cn;var qg="MenuAnchor",Is=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xn(n);return l.jsx(Lf,{...s,...r,ref:t})});Is.displayName=qg;var Ps="MenuPortal",[Zg,Ha]=Et(Ps,{forceMount:void 0}),za=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Mt(Ps,t);return l.jsx(Zg,{scope:t,forceMount:n,children:l.jsx(Rt,{present:n||o.open,children:l.jsx(wa,{asChild:!0,container:s,children:r})})})};za.displayName=Ps;var Te="MenuContent",[Kg,Os]=Et(Te),Ga=p.forwardRef((e,t)=>{const n=Ha(Te,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Te,e.__scopeMenu),i=un(Te,e.__scopeMenu);return l.jsx(tn.Provider,{scope:e.__scopeMenu,children:l.jsx(Rt,{present:r||o.open,children:l.jsx(tn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Xg,{...s,ref:t}):l.jsx(Yg,{...s,ref:t})})})})}),Xg=p.forwardRef((e,t)=>{const n=Mt(Te,e.__scopeMenu),r=p.useRef(null),s=pe(t,r);return p.useEffect(()=>{const o=r.current;if(o)return ng(o)},[]),l.jsx(Fs,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Yg=p.forwardRef((e,t)=>{const n=Mt(Te,e.__scopeMenu);return l.jsx(Fs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Jg=Nn("MenuContent.ScrollLock"),Fs=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,disableOutsideScroll:v,...h}=e,y=Mt(Te,n),x=un(Te,n),w=Xn(n),_=La(n),S=Gg(n),[C,N]=p.useState(null),R=p.useRef(null),M=pe(t,R,y.onContentChange),z=p.useRef(0),F=p.useRef(""),Z=p.useRef(0),Q=p.useRef(null),U=p.useRef("right"),D=p.useRef(0),ne=v?Fa:p.Fragment,W=v?{as:Jg,allowPinchZoom:!0}:void 0,ee=E=>{var Me,vt;const L=F.current+E,$=S().filter(we=>!we.disabled),K=document.activeElement,fe=(Me=$.find(we=>we.ref.current===K))==null?void 0:Me.textValue,je=$.map(we=>we.textValue),Ee=um(je,L,fe),ye=(vt=$.find(we=>we.textValue===Ee))==null?void 0:vt.ref.current;(function we(ke){F.current=ke,window.clearTimeout(z.current),ke!==""&&(z.current=window.setTimeout(()=>we(""),1e3))})(L),ye&&setTimeout(()=>ye.focus())};p.useEffect(()=>()=>window.clearTimeout(z.current),[]),cd();const I=p.useCallback(E=>{var $,K;return U.current===(($=Q.current)==null?void 0:$.side)&&fm(E,(K=Q.current)==null?void 0:K.area)},[]);return l.jsx(Kg,{scope:n,searchRef:F,onItemEnter:p.useCallback(E=>{I(E)&&E.preventDefault()},[I]),onItemLeave:p.useCallback(E=>{var L;I(E)||((L=R.current)==null||L.focus(),N(null))},[I]),onTriggerLeave:p.useCallback(E=>{I(E)&&E.preventDefault()},[I]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:p.useCallback(E=>{Q.current=E},[]),children:l.jsx(ne,{...W,children:l.jsx(Xi,{asChild:!0,trapped:s,onMountAutoFocus:G(o,E=>{var L;E.preventDefault(),(L=R.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Zi,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:d,children:l.jsx(Ea,{asChild:!0,..._,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:G(c,E=>{x.isUsingKeyboardRef.current||E.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Vf,{role:"menu","aria-orientation":"vertical","data-state":ol(y.open),"data-radix-menu-content":"",dir:x.dir,...w,...h,ref:M,style:{outline:"none",...h.style},onKeyDown:G(h.onKeyDown,E=>{const $=E.target.closest("[data-radix-menu-content]")===E.currentTarget,K=E.ctrlKey||E.altKey||E.metaKey,fe=E.key.length===1;$&&(E.key==="Tab"&&E.preventDefault(),!K&&fe&&ee(E.key));const je=R.current;if(E.target!==je||!Vg.includes(E.key))return;E.preventDefault();const ye=S().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);Da.includes(E.key)&&ye.reverse(),lm(ye)}),onBlur:G(e.onBlur,E=>{E.currentTarget.contains(E.target)||(window.clearTimeout(z.current),F.current="")}),onPointerMove:G(e.onPointerMove,nn(E=>{const L=E.target,$=D.current!==E.clientX;if(E.currentTarget.contains(L)&&$){const K=E.clientX>D.current?"right":"left";U.current=K,D.current=E.clientX}}))})})})})})})});Ga.displayName=Te;var Qg="MenuGroup",Ds=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(oe.div,{role:"group",...r,ref:t})});Ds.displayName=Qg;var em="MenuLabel",Ba=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(oe.div,{...r,ref:t})});Ba.displayName=em;var Pn="MenuItem",jo="menu.itemSelect",Yn=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),i=un(Pn,e.__scopeMenu),a=Os(Pn,e.__scopeMenu),c=pe(t,o),u=p.useRef(!1),f=()=>{const m=o.current;if(!n&&m){const g=new CustomEvent(jo,{bubbles:!0,cancelable:!0});m.addEventListener(jo,d=>r==null?void 0:r(d),{once:!0}),Ci(m,g),g.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(Ua,{...s,ref:c,disabled:n,onClick:G(e.onClick,f),onPointerDown:m=>{var g;(g=e.onPointerDown)==null||g.call(e,m),u.current=!0},onPointerUp:G(e.onPointerUp,m=>{var g;u.current||(g=m.currentTarget)==null||g.click()}),onKeyDown:G(e.onKeyDown,m=>{const g=a.searchRef.current!=="";n||g&&m.key===" "||Qr.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Yn.displayName=Pn;var Ua=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,i=Os(Pn,n),a=La(n),c=p.useRef(null),u=pe(t,c),[f,m]=p.useState(!1),[g,d]=p.useState("");return p.useEffect(()=>{const v=c.current;v&&d((v.textContent??"").trim())},[o.children]),l.jsx(tn.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(Ma,{asChild:!0,...a,focusable:!r,children:l.jsx(oe.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:G(e.onPointerMove,nn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,nn(v=>i.onItemLeave(v))),onFocus:G(e.onFocus,()=>m(!0)),onBlur:G(e.onBlur,()=>m(!1))})})})}),tm="MenuCheckboxItem",Wa=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return l.jsx(Ya,{scope:e.__scopeMenu,checked:n,children:l.jsx(Yn,{role:"menuitemcheckbox","aria-checked":On(n)?"mixed":n,...s,ref:t,"data-state":Ls(n),onSelect:G(s.onSelect,()=>r==null?void 0:r(On(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Wa.displayName=tm;var qa="MenuRadioGroup",[nm,rm]=Et(qa,{value:void 0,onValueChange:()=>{}}),Za=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=Je(r);return l.jsx(nm,{scope:e.__scopeMenu,value:n,onValueChange:o,children:l.jsx(Ds,{...s,ref:t})})});Za.displayName=qa;var Ka="MenuRadioItem",Xa=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=rm(Ka,e.__scopeMenu),o=n===s.value;return l.jsx(Ya,{scope:e.__scopeMenu,checked:o,children:l.jsx(Yn,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Ls(o),onSelect:G(r.onSelect,()=>{var i;return(i=s.onValueChange)==null?void 0:i.call(s,n)},{checkForDefaultPrevented:!1})})})});Xa.displayName=Ka;var $s="MenuItemIndicator",[Ya,sm]=Et($s,{checked:!1}),Ja=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=sm($s,n);return l.jsx(Rt,{present:r||On(o.checked)||o.checked===!0,children:l.jsx(oe.span,{...s,ref:t,"data-state":Ls(o.checked)})})});Ja.displayName=$s;var om="MenuSeparator",Qa=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(oe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Qa.displayName=om;var im="MenuArrow",el=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Xn(n);return l.jsx(Hf,{...s,...r,ref:t})});el.displayName=im;var am="MenuSub",[hp,tl]=Et(am),Zt="MenuSubTrigger",nl=p.forwardRef((e,t)=>{const n=Mt(Zt,e.__scopeMenu),r=un(Zt,e.__scopeMenu),s=tl(Zt,e.__scopeMenu),o=Os(Zt,e.__scopeMenu),i=p.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=o,u={__scopeMenu:e.__scopeMenu},f=p.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),c(null)}},[a,c]),l.jsx(Is,{asChild:!0,...u,children:l.jsx(Ua,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":ol(n.open),...e,ref:di(t,s.onTriggerChange),onClick:m=>{var g;(g=e.onClick)==null||g.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,nn(m=>{o.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:G(e.onPointerLeave,nn(m=>{var d,v;f();const g=(d=n.content)==null?void 0:d.getBoundingClientRect();if(g){const h=(v=n.content)==null?void 0:v.dataset.side,y=h==="right",x=y?-5:5,w=g[y?"left":"right"],_=g[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:m.clientX+x,y:m.clientY},{x:w,y:g.top},{x:_,y:g.top},{x:_,y:g.bottom},{x:w,y:g.bottom}],side:h}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(m),m.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,m=>{var d;const g=o.searchRef.current!=="";e.disabled||g&&m.key===" "||Hg[r.dir].includes(m.key)&&(n.onOpenChange(!0),(d=n.content)==null||d.focus(),m.preventDefault())})})})});nl.displayName=Zt;var rl="MenuSubContent",sl=p.forwardRef((e,t)=>{const n=Ha(Te,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Mt(Te,e.__scopeMenu),i=un(Te,e.__scopeMenu),a=tl(rl,e.__scopeMenu),c=p.useRef(null),u=pe(t,c);return l.jsx(tn.Provider,{scope:e.__scopeMenu,children:l.jsx(Rt,{present:r||o.open,children:l.jsx(tn.Slot,{scope:e.__scopeMenu,children:l.jsx(Fs,{id:a.contentId,"aria-labelledby":a.triggerId,...s,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var m;i.isUsingKeyboardRef.current&&((m=c.current)==null||m.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:G(e.onFocusOutside,f=>{f.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:G(e.onKeyDown,f=>{var d;const m=f.currentTarget.contains(f.target),g=zg[i.dir].includes(f.key);m&&g&&(o.onOpenChange(!1),(d=a.trigger)==null||d.focus(),f.preventDefault())})})})})})});sl.displayName=rl;function ol(e){return e?"open":"closed"}function On(e){return e==="indeterminate"}function Ls(e){return On(e)?"indeterminate":e?"checked":"unchecked"}function lm(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function um(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=cm(e,Math.max(o,0));s.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function dm(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,i=t.length-1;o<t.length;i=o++){const a=t[o],c=t[i],u=a.x,f=a.y,m=c.x,g=c.y;f>r!=g>r&&n<(m-u)*(r-f)/(g-f)+u&&(s=!s)}return s}function fm(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return dm(n,t)}function nn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var gm=Va,mm=Is,hm=za,pm=Ga,vm=Ds,xm=Ba,ym=Yn,wm=Wa,_m=Za,Sm=Xa,Cm=Ja,bm=Qa,Rm=el,Em=nl,Mm=sl,Jn="DropdownMenu",[Nm,pp]=bt(Jn,[$a]),xe=$a(),[Tm,il]=Nm(Jn),al=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,c=xe(t),u=p.useRef(null),[f,m]=Hn({prop:s,defaultProp:o??!1,onChange:i,caller:Jn});return l.jsx(Tm,{scope:t,triggerId:Tn(),triggerRef:u,contentId:Tn(),open:f,onOpenChange:m,onOpenToggle:p.useCallback(()=>m(g=>!g),[m]),modal:a,children:l.jsx(gm,{...c,open:f,onOpenChange:m,dir:r,modal:a,children:n})})};al.displayName=Jn;var ll="DropdownMenuTrigger",cl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=il(ll,n),i=xe(n);return l.jsx(mm,{asChild:!0,...i,children:l.jsx(oe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:di(t,o.triggerRef),onPointerDown:G(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:G(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});cl.displayName=ll;var Am="DropdownMenuPortal",ul=e=>{const{__scopeDropdownMenu:t,...n}=e,r=xe(t);return l.jsx(hm,{...r,...n})};ul.displayName=Am;var dl="DropdownMenuContent",fl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=il(dl,n),o=xe(n),i=p.useRef(!1);return l.jsx(pm,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,a=>{var c;i.current||(c=s.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:G(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,f=c.button===2||u;(!s.modal||f)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});fl.displayName=dl;var jm="DropdownMenuGroup",km=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(vm,{...s,...r,ref:t})});km.displayName=jm;var Im="DropdownMenuLabel",Pm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(xm,{...s,...r,ref:t})});Pm.displayName=Im;var Om="DropdownMenuItem",Fm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(ym,{...s,...r,ref:t})});Fm.displayName=Om;var Dm="DropdownMenuCheckboxItem",gl=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(wm,{...s,...r,ref:t})});gl.displayName=Dm;var $m="DropdownMenuRadioGroup",Lm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(_m,{...s,...r,ref:t})});Lm.displayName=$m;var Vm="DropdownMenuRadioItem",Hm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Sm,{...s,...r,ref:t})});Hm.displayName=Vm;var zm="DropdownMenuItemIndicator",ml=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Cm,{...s,...r,ref:t})});ml.displayName=zm;var Gm="DropdownMenuSeparator",Bm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(bm,{...s,...r,ref:t})});Bm.displayName=Gm;var Um="DropdownMenuArrow",Wm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Rm,{...s,...r,ref:t})});Wm.displayName=Um;var qm="DropdownMenuSubTrigger",Zm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Em,{...s,...r,ref:t})});Zm.displayName=qm;var Km="DropdownMenuSubContent",Xm=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=xe(n);return l.jsx(Mm,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Xm.displayName=Km;var Ym=al,Jm=cl,Qm=ul,eh=fl,th=gl,nh=ml;function rh({...e}){return l.jsx(Ym,{"data-slot":"dropdown-menu",...e})}function sh({...e}){return l.jsx(Jm,{"data-slot":"dropdown-menu-trigger",...e})}function oh({className:e,sideOffset:t=4,...n}){return l.jsx(Qm,{children:l.jsx(eh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ue("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function ih({className:e,children:t,checked:n,...r}){return l.jsxs(th,{"data-slot":"dropdown-menu-checkbox-item",className:ue("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...r,children:[l.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:l.jsx(nh,{children:l.jsx(ki,{className:"size-4"})})}),t]})}function Vs({className:e,...t}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:ue("w-full caption-bottom text-sm",e),...t})})}function ah({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:ue("[&_tr]:border-b",e),...t})}function Hs({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:ue("[&_tr:last-child]:border-0",e),...t})}function ge({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:ue("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function lh({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:ue("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function k({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:ue("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Qn({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:s={},pageSize:o=25,defaultSorting:i=[]}){var y,x;const[a,c]=p.useState(i),[u,f]=p.useState([]),[m,g]=p.useState(s),[d,v]=p.useState({}),h=Qu({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:f,getCoreRowModel:zu(),getPaginationRowModel:Zu(),getSortedRowModel:Ku(),getFilteredRowModel:qu(),onColumnVisibilityChange:g,onRowSelectionChange:v,initialState:{pagination:{pageSize:o}},state:{sorting:a,columnFilters:u,columnVisibility:m,rowSelection:d}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(Hr,{placeholder:r,value:((y=h.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:w=>{var _;return(_=h.getColumn(n))==null?void 0:_.setFilterValue(w.target.value)},className:"max-w-sm"}),l.jsxs(rh,{children:[l.jsx(sh,{asChild:!0,children:l.jsxs(Pt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(fi,{className:"ml-2 h-4 w-4"})]})}),l.jsx(oh,{align:"end",children:h.getAllColumns().filter(w=>w.getCanHide()).map(w=>l.jsx(ih,{className:"capitalize",checked:w.getIsVisible(),onCheckedChange:_=>w.toggleVisibility(!!_),children:w.id},w.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(Vs,{children:[l.jsx(ah,{children:h.getHeaderGroups().map(w=>l.jsx(ge,{children:w.headers.map(_=>l.jsx(lh,{children:_.isPlaceholder?null:io(_.column.columnDef.header,_.getContext())},_.id))},w.id))}),l.jsx(Hs,{children:(x=h.getRowModel().rows)!=null&&x.length?h.getRowModel().rows.map(w=>l.jsx(ge,{"data-state":w.getIsSelected()&&"selected",children:w.getVisibleCells().map(_=>l.jsx(k,{children:io(_.column.columnDef.cell,_.getContext())},_.id))},w.id)):l.jsx(ge,{children:l.jsx(k,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})}),l.jsxs("div",{className:"flex items-center justify-end space-x-2 py-4",children:[l.jsxs("div",{className:"text-muted-foreground flex-1 text-sm",children:[h.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(Pt,{variant:"outline",size:"sm",onClick:()=>h.previousPage(),disabled:!h.getCanPreviousPage(),children:"Previous"}),l.jsx(Pt,{variant:"outline",size:"sm",onClick:()=>h.nextPage(),disabled:!h.getCanNextPage(),children:"Next"})]})]})]})}function ie(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",s=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(Pt,{variant:"ghost",onClick:()=>n.toggleSorting(n.getIsSorted()==="asc"),className:`${t==="right"?"ml-auto":""} hover:bg-muted/50 h-auto p-0 font-medium text-sm`,children:[e,s==="asc"&&l.jsx(Fc,{className:"ml-1 h-3 w-3 text-muted-foreground"}),s==="desc"&&l.jsx(fi,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const ch=300*1e3;function hl(e){const[t,n]=p.useState(new Map),r=p.useRef();return p.useEffect(()=>{const o=new Date().toISOString(),i=new Set(e.map(a=>a.id));n(a=>{const c=new Map(a);return e.forEach(u=>{c.set(u.id,{...u,lastSeenAt:o,disconnectedAt:void 0})}),c.forEach((u,f)=>{!i.has(f)&&!u.disconnectedAt&&c.set(f,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:o,lastActivity:u.lastActivity||o})}),c})},[e]),p.useEffect(()=>{const o=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,f)=>{if(u.disconnectedAt){const m=new Date(u.disconnectedAt).getTime();i-m>ch&&c.delete(f)}}),c})};return o(),r.current=setInterval(o,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((o,i)=>o.isConnected!==i.isConnected?o.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(o.lastActivity).getTime())}function ko(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function uh(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function dh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function fh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function gh({metrics:e}){const t=e.sessions||[],n=hl(t),r=()=>[{accessorKey:"clientInfo",header:ie("Client"),cell:({row:s})=>{const o=s.original,i=o.clientInfo?`${fh(o.clientInfo.name)}@${o.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:o.clientInfo?`${o.clientInfo.name}@${o.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:ie("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:dh(s.getValue("id"))})},{accessorKey:"isConnected",header:ie("Status"),cell:({row:s})=>{const o=s.original;return l.jsxs(xt,{variant:o.isConnected?"success":"secondary",className:"gap-1",children:[o.isConnected?l.jsx(Pi,{className:"h-3 w-3"}):l.jsx(Ii,{className:"h-3 w-3"}),o.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:ie("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ko(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:ie("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:ie("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:ko(s.getValue("lastActivity"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsx(Ct,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsx("p",{className:"text-sm font-mono",children:"STDIO"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:uh(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(s=>s.isConnected).length," active,"," ",n.filter(s=>!s.isConnected).length," disconnected)"]}),l.jsx(Qn,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Io(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function mh(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function Cn(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function hh(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function ph(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function vh({metrics:e}){const t=e.sessions||[],n=hl(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},s=()=>[{accessorKey:"clientInfo",header:ie("Client"),cell:({row:o})=>{const i=o.original,a=i.clientInfo?`${ph(i.clientInfo.name)}@${i.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:i.clientInfo?`${i.clientInfo.name}@${i.clientInfo.version}`:"unknown",children:a})}},{accessorKey:"id",header:ie("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:hh(o.getValue("id"))})},{accessorKey:"connectionStatus",header:ie("Status"),cell:({row:o})=>{const i=o.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(xt,{variant:"success",className:"gap-1",children:[l.jsx(Pi,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(xt,{variant:"destructive",className:"gap-1",children:[l.jsx(gi,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(xt,{variant:"secondary",className:"gap-1",children:[l.jsx(Ii,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:ie("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Io(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:ie("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:ie("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:Io(o.getValue("lastActivity"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsxs(Ct,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsx("p",{className:"text-sm font-mono",children:r[e.transport]||e.transport})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:mh(e.uptimeSeconds)})]})]}),e.configuration&&l.jsx(l.Fragment,{children:l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Configuration"}),l.jsx("div",{className:"grid grid-cols-1 gap-2",children:e.pings&&l.jsx("div",{className:"text-xs text-muted-foreground bg-muted/30 p-2 rounded",children:e.pings.sent>0&&l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Ping Status:"})," ",e.pings.successful,"/",e.pings.sent," successful (",e.pings.sent>0?Math.round(e.pings.successful/e.pings.sent*100):0,"%)"]})})}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["SSE connections checked every ",Cn(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Cn(e.configuration.staleCheckInterval),", removed after"," ",Cn(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Cn(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(yt,{}),l.jsx("div",{children:l.jsx(Vs,{children:l.jsxs(Hs,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.active}),l.jsx(k,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(k,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(k,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(k,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(k,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx(k,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx(k,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx(k,{className:"text-sm font-mono",children:e.pings.sent>0?`${Math.round(e.pings.successful/e.pings.sent*100)}%`:"-"})]}),e.apiMetrics&&l.jsxs(l.Fragment,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(k,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(k,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(k,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx(k,{className:"font-medium text-sm",children:"-"}),l.jsx(k,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3",children:["Sessions (",n.filter(o=>o.isConnected).length," active,"," ",n.filter(o=>!o.isConnected).length," disconnected)"]}),l.jsx(Qn,{columns:s(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function Po(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),s=Math.floor(r/1e3);if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const i=Math.floor(o/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function xh(e){const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return t>0?`${t}d ${n}h ${r}m`:n>0?`${n}h ${r}m`:`${r}m`}function yh(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function wh(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function _h({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:ie("Client"),cell:({row:r})=>{const s=r.original,o=`${wh(s.name)}@${s.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${s.name}@${s.version}`,children:o}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",Po(s.firstSeen)]})]})}},{accessorKey:"requestCount",header:ie("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:ie("Status"),cell:({row:r})=>{const s=r.original;return l.jsx("div",{children:yh(s.lastSeen)?l.jsxs(xt,{variant:"success",className:"gap-1",children:[l.jsx(Ic,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(xt,{variant:"secondary",className:"gap-1",children:[l.jsx($c,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:ie("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:Po(r.getValue("lastSeen"))})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"📊 Transport Metrics"}),l.jsx(Ct,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(Ye,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Transport Type"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("p",{className:"text-sm font-mono",children:"Stateless HTTP JSON"}),l.jsx(xt,{variant:"secondary",children:e.sessionLifecycle?"analytics":"stateless"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Uptime"}),l.jsx("p",{className:"text-sm font-mono",children:xh(e.uptimeSeconds)})]})]}),l.jsx(yt,{}),l.jsx("div",{children:l.jsx(Vs,{children:l.jsxs(Hs,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx(k,{className:"text-sm font-mono",children:e.connections.total}),l.jsx(k,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs(k,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx(k,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx(k,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Vc,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs(k,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx(k,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs(k,{className:"text-sm font-mono",children:[e.connections.anonymous,"/",e.connections.authenticated,"/",e.connections.unauthorized||0]})]}),e.apiMetrics&&l.jsxs(l.Fragment,{children:[l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx(k,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx(k,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx(k,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(ge,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx(k,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),e.sessionLifecycle?l.jsxs(l.Fragment,{children:[l.jsx(k,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs(k,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx(k,{className:"font-medium text-sm",children:"-"}),l.jsx(k,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(yt,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(Qn,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const Sh=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Ch(){const{data:e,error:t}=Xt("/api/transport-metrics",Sh,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(Ze,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs(Kc,{variant:"destructive",children:[l.jsx(gi,{className:"h-4 w-4"}),l.jsx(Xc,{children:"Error Loading Metrics"}),l.jsxs(Yc,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(gh,{metrics:e}):e.isStateless?l.jsx(_h,{metrics:e}):l.jsx(vh,{metrics:e}):l.jsxs(Ze,{children:[l.jsx(Ke,{children:l.jsx(Xe,{children:"📊 Transport Metrics"})}),l.jsx(Ye,{children:l.jsxs("div",{className:"animate-pulse space-y-2",children:[l.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),l.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),l.jsx("div",{className:"h-4 bg-gray-200 rounded w-2/3"})]})})]})}const bh=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function Rh(){const[e,t]=p.useState(!1),{data:n,error:r}=Xt("/api/transport-metrics",bh,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),s=!n&&!r,o=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(g=>{let d=g.errors,v,h;if(g.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const w=g.method.replace("tools/call:",""),_=n.gradioMetrics.byTool;_[w]&&(v=_[w].success,h=_[w].failure,d+=h)}const y=g.count>0?d/g.count*100:0;return{method:g.method,count:g.count,errors:d,errorRate:y,averageResponseTime:g.averageResponseTime,lastCalled:g.lastCalled,gradioSuccess:v,gradioFailure:h}}),a=e?i.filter(g=>g.method.startsWith("tools/call")||g.method.startsWith("prompts/get")):i,c=i.reduce((g,d)=>g+d.count,0),u=i.filter(g=>g.method.startsWith("tools/call")).reduce((g,d)=>g+d.count,0),f=i.filter(g=>g.method.startsWith("prompts/get")).reduce((g,d)=>g+d.count,0),m=[{accessorKey:"method",header:ie("Method"),cell:({row:g})=>{const d=g.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:d==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):d.startsWith("tools/call:")?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call:"}),l.jsx("span",{className:"text-green-600 dark:text-green-400",children:d.replace("tools/call:","")})]}):d==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):d.startsWith("prompts/get:")?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get:"}),l.jsx("span",{className:"text-orange-600 dark:text-orange-400",children:d.replace("prompts/get:","")})]}):d})}},{accessorKey:"count",header:ie("Calls","right"),cell:({row:g})=>l.jsx("div",{className:"text-right font-mono",children:g.getValue("count").toLocaleString()})},{accessorKey:"errors",header:ie("Errors","right"),cell:({row:g})=>{const d=g.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:d>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:d}):"0"})}},{accessorKey:"gradioMetrics",header:ie("Success/Failure","right"),cell:({row:g})=>{const d=g.original;return d.gradioSuccess!==void 0&&d.gradioFailure!==void 0?l.jsxs("div",{className:"text-right font-mono text-sm",children:[l.jsx("span",{className:"text-green-600 dark:text-green-400",children:d.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:d.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:ie("Error Rate","right"),cell:({row:g})=>{const d=g.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:d>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[d.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:ie("Avg Response","right"),cell:({row:g})=>{const d=g.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:d?`${d.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:ie("Last Called","right"),cell:({row:g})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(g.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"HTTP JSON Transport Statistics"}),l.jsxs(Ct,{children:["MCP method call statistics and performance metrics",o?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(Ye,{children:[s&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading metrics..."})}),r&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsxs("div",{className:"text-sm text-destructive",children:["Error loading metrics: ",r.message]})}),o&&l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:"Method tracking is not available in STDIO mode. This data is only collected for HTTP-based transports."})}),n&&!o&&l.jsxs("div",{className:"space-y-4",children:[i.length>0&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",a.length," method",a.length!==1?"s":""," tracked since"," ",new Date(n.startupTime).toLocaleString()]}),l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"text-sm font-medium",children:["Total MCP Calls: ",l.jsx("span",{className:"font-mono",children:c.toLocaleString()})]}),l.jsxs("div",{className:"text-sm font-medium",children:["Tool Calls: ",l.jsx("span",{className:"font-mono",children:u.toLocaleString()})]}),l.jsxs("div",{className:"text-sm font-medium",children:["Prompt Calls: ",l.jsx("span",{className:"font-mono",children:f.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ys,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:g=>t(!!g)}),l.jsx("label",{htmlFor:"tool-prompt-calls-filter",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Show only Tools/Prompts"})]}),a.length===0?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("div",{className:"text-sm text-muted-foreground",children:e?"No tool or prompt calls recorded yet.":"No method calls recorded yet."})}):l.jsx(Qn,{columns:m,data:a,searchColumn:"method",searchPlaceholder:"Filter methods...",pageSize:50,defaultColumnVisibility:{method:!0,count:!0,errors:!1,gradioMetrics:!1,errorRate:!0,averageResponseTime:n.transport==="streamableHttpJson",lastCalled:!0},defaultSorting:[{id:"count",desc:!0}]})]})]})]})}function Oo(e){return e.transport==="stdio"?e.defaultHfTokenSet&&e.hfTokenMasked?{text:e.hfTokenMasked,isWarning:!1}:{text:"Warning: No token set",isWarning:!0}:e.defaultHfTokenSet?{text:`⚠️ Using ${e.hfTokenMasked||"token"} as default`,isWarning:!0}:{text:"Using Authorization Headers",isWarning:!1}}function Eh({isLoading:e,error:t,transportInfo:n}){const r=()=>{switch(n.transport){case"stdio":return"STDIO";case"sse":return"SSE";case"streamableHttp":case"streamableHttpJson":return"Streamable HTTP";default:return"Unknown"}},s=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},o=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>o()?l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-green-100 text-green-800 text-[10px] rounded-sm whitespace-nowrap",children:"JSON (stateless)"}):n.transport==="streamableHttp"?l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-blue-100 text-blue-800 text-[10px] rounded-sm whitespace-nowrap",children:"Session Based"}):n.transport==="sse"?l.jsx("span",{className:"ml-1.5 px-1.5 py-0.5 bg-purple-100 text-purple-800 text-[10px] rounded-sm whitespace-nowrap",children:"Event Stream"}):null;if(e)return l.jsx("div",{className:"text-center text-xs text-muted-foreground py-2",children:"Loading connection information..."});if(t)return l.jsxs("div",{className:"text-center text-xs text-destructive py-2",children:["Error: ",t]});const a=n.port||3e3,c=n.transport!=="stdio";return l.jsx("div",{className:"fixed bottom-0 left-0 w-full bg-muted/50 border-t border-border py-2 px-4",children:l.jsxs("div",{className:"max-w-[700px] mx-auto flex justify-between items-center text-xs",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:"Using"}),l.jsx("span",{className:"font-medium text-primary",children:r()}),n.transport==="stdio"&&l.jsxs("span",{className:"text-muted-foreground flex items-center",children:["Client Info :",n.stdioClient?l.jsx("span",{className:"ml-2 flex items-center",children:l.jsxs("span",{className:"ml-1 font-medium text-green-700",children:[n.stdioClient.name," ",n.stdioClient.version]})}):l.jsx("span",{className:"ml-2 text-muted-foreground",children:" (disconnected) "})]}),c&&l.jsxs("span",{className:"text-muted-foreground flex items-center",children:["on port ",l.jsx("span",{className:"font-mono mx-1",children:a}),"at ",l.jsx("span",{className:"font-mono mx-1",children:s()}),i()]})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-muted-foreground",children:" Default HF Token:"}),l.jsx("span",{className:`font-mono ${Oo(n).isWarning?"text-red-500":""}`,children:Oo(n).text})]})]})})}var er="Tabs",[Mh,vp]=bt(er,[Zn]),pl=Zn(),[Nh,zs]=Mh(er),vl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:o,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,f=bs(a),[m,g]=Hn({prop:r,onChange:s,defaultProp:o??"",caller:er});return l.jsx(Nh,{scope:n,baseId:Tn(),value:m,onValueChange:g,orientation:i,dir:f,activationMode:c,children:l.jsx(oe.div,{dir:f,"data-orientation":i,...u,ref:t})})});vl.displayName=er;var xl="TabsList",yl=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,o=zs(xl,n),i=pl(n);return l.jsx(Ea,{asChild:!0,...i,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(oe.div,{role:"tablist","aria-orientation":o.orientation,...s,ref:t})})});yl.displayName=xl;var wl="TabsTrigger",_l=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...o}=e,i=zs(wl,n),a=pl(n),c=bl(i.baseId,r),u=Rl(i.baseId,r),f=r===i.value;return l.jsx(Ma,{asChild:!0,...a,focusable:!s,active:f,children:l.jsx(oe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...o,ref:t,onMouseDown:G(e.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?i.onValueChange(r):m.preventDefault()}),onKeyDown:G(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&i.onValueChange(r)}),onFocus:G(e.onFocus,()=>{const m=i.activationMode!=="manual";!f&&!s&&m&&i.onValueChange(r)})})})});_l.displayName=wl;var Sl="TabsContent",Cl=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:o,...i}=e,a=zs(Sl,n),c=bl(a.baseId,r),u=Rl(a.baseId,r),f=r===a.value,m=p.useRef(f);return p.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Rt,{present:s||f,children:({present:g})=>l.jsx(oe.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:g&&o})})});Cl.displayName=Sl;function bl(e,t){return`${e}-trigger-${t}`}function Rl(e,t){return`${e}-content-${t}`}var Th=vl,Ah=yl,jh=_l,kh=Cl;function Ih({className:e,...t}){return l.jsx(Th,{"data-slot":"tabs",className:ue("flex flex-col gap-2",e),...t})}function Ph({className:e,...t}){return l.jsx(Ah,{"data-slot":"tabs-list",className:ue("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function jt({className:e,...t}){return l.jsx(jh,{"data-slot":"tabs-trigger",className:ue("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function kt({className:e,...t}){return l.jsx(kh,{"data-slot":"tabs-content",className:ue("flex-1 outline-none",e),...t})}var J;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(const a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(J||(J={}));var Fo;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Fo||(Fo={}));const A=J.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),st=e=>{switch(typeof e){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(e)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":return Array.isArray(e)?A.array:e===null?A.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?A.promise:typeof Map<"u"&&e instanceof Map?A.map:typeof Set<"u"&&e instanceof Set?A.set:typeof Date<"u"&&e instanceof Date?A.date:A.object;default:return A.unknown}},b=J.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 tt extends Error{get errors(){return this.issues}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}format(t){const n=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),r}static assert(t){if(!(t instanceof tt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,J.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];n[o]=n[o]||[],n[o].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}tt.create=e=>new tt(e);const es=(e,t)=>{let n;switch(e.code){case b.invalid_type:e.received===A.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,J.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:n=`Unrecognized key(s) in object: ${J.joinValues(e.keys,", ")}`;break;case b.invalid_union:n="Invalid input";break;case b.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${J.joinValues(e.options)}`;break;case b.invalid_enum_value:n=`Invalid enum value. Expected ${J.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:n="Invalid function arguments";break;case b.invalid_return_type:n="Invalid function return type";break;case b.invalid_date:n="Invalid date";break;case b.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}"`:J.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case b.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==="bigint"?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 b.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 b.custom:n="Invalid input";break;case b.invalid_intersection_types:n="Intersection results could not be merged";break;case b.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:n="Number must be finite";break;default:n=t.defaultError,J.assertNever(e)}return{message:n}};let Oh=es;function Fh(){return Oh}const Dh=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,o=[...n,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}};function T(e,t){const n=Fh(),r=Dh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===es?void 0:es].filter(s=>!!s)});e.common.issues.push(r)}class Re{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 s of n){if(s.status==="aborted")return V;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const o=await s.key,i=await s.value;r.push({key:o,value:i})}return Re.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return V;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const V=Object.freeze({status:"aborted"}),Kt=e=>({status:"dirty",value:e}),Ae=e=>({status:"valid",value:e}),Do=e=>e.status==="aborted",$o=e=>e.status==="dirty",$t=e=>e.status==="valid",Fn=e=>typeof Promise<"u"&&e instanceof Promise;var j;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(j||(j={}));class ht{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Lo=(e,t)=>{if($t(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 tt(e.common.issues);return this._error=n,this._error}}};function B(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=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:s}:{errorMap:(i,a)=>{const{message:c}=e;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}class Y{get description(){return this._def.description}_getType(t){return st(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:st(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Re,ctx:{common:t.parent.common,data:t.data,parsedType:st(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Fn(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){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)},s=this._parseSync({data:t,path:r.path,parent:r});return Lo(r,s)}"~validate"(t){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:st(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return $t(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(s=(r=o==null?void 0:o.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>$t(o)?{value:o.value}:{issues:n.common.issues})}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:st(t)},s=this._parse({data:t,path:r.path,parent:r}),o=await(Fn(s)?s:Promise.resolve(s));return Lo(r,o)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,o)=>{const i=t(s),a=()=>o.addIssue({code:b.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new Ht({schema:this,typeName:H.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}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),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ct.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return He.create(this)}promise(){return Vn.create(this,this._def)}or(t){return $n.create([this,t],this._def)}and(t){return Ln.create(this,t,this._def)}transform(t){return new Ht({...B(this._def),schema:this,typeName:H.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new rs({...B(this._def),innerType:this,defaultValue:n,typeName:H.ZodDefault})}brand(){return new ip({typeName:H.ZodBranded,type:this,...B(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ss({...B(this._def),innerType:this,catchValue:n,typeName:H.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Gs.create(this,t)}readonly(){return os.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const $h=/^c[^\s-]{8,}$/i,Lh=/^[0-9a-z]+$/,Vh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Hh=/^[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,zh=/^[a-z0-9_-]{21}$/i,Gh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Bh=/^[-+]?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)?)??$/,Uh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ar;const qh=/^(?:(?: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])$/,Zh=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Kh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Xh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,El="((\\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])))",Qh=new RegExp(`^${El}$`);function Ml(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ep(e){return new RegExp(`^${Ml(e)}$`)}function tp(e){let t=`${El}T${Ml(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 np(e,t){return!!((t==="v4"||!t)&&qh.test(e)||(t==="v6"||!t)&&Kh.test(e))}function rp(e,t){if(!Gh.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function sp(e,t){return!!((t==="v4"||!t)&&Zh.test(e)||(t==="v6"||!t)&&Xh.test(e))}class at extends Y{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==A.string){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.string,received:o.parsedType}),V}const r=new Re;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,a=t.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(t,s),i?T(s,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&T(s,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")Uh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"email",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")Ar||(Ar=new RegExp(Wh,"u")),Ar.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"emoji",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")Hh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"uuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")zh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"nanoid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")$h.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cuid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")Lh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cuid2",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")Vh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"ulid",code:b.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),T(s,{validation:"url",code:b.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"regex",code:b.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?tp(o).test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?Qh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?ep(o).test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{code:b.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?Bh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"duration",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?np(t.data,o.version)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"ip",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?rp(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"jwt",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?sp(t.data,o.version)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"cidr",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?Yh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64",code:b.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?Jh.test(t.data)||(s=this._getOrReturnCtx(t,s),T(s,{validation:"base64url",code:b.invalid_string,message:o.message}),r.dirty()):J.assertNever(o);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:b.invalid_string,...j.errToObj(r)})}_addCheck(t){return new at({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...j.errToObj(t)})}url(t){return this._addCheck({kind:"url",...j.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...j.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...j.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...j.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...j.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...j.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...j.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...j.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...j.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...j.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...j.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...j.errToObj(t)})}datetime(t){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:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...j.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,...j.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...j.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...j.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...j.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...j.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...j.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...j.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...j.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...j.errToObj(n)})}nonempty(t){return this.min(1,j.errToObj(t))}trim(){return new at({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new at({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new at({...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 isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}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}}at.create=e=>new at({checks:[],typeName:H.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});function op(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}class Lt extends Y{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)!==A.number){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.number,received:o.parsedType}),V}let r;const s=new Re;for(const o of this._def.checks)o.kind==="int"?J.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?op(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_finite,message:o.message}),s.dirty()):J.assertNever(o);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,j.toString(n))}gt(t,n){return this.setLimit("min",t,!1,j.toString(n))}lte(t,n){return this.setLimit("max",t,!0,j.toString(n))}lt(t,n){return this.setLimit("max",t,!1,j.toString(n))}setLimit(t,n,r,s){return new Lt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:j.toString(s)}]})}_addCheck(t){return new Lt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:j.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:j.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:j.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.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"&&J.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)}}Lt.create=e=>new Lt({checks:[],typeName:H.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...B(e)});class rn extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==A.bigint)return this._getInvalidInput(t);let r;const s=new Re;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),T(r,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):J.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.bigint,received:n.parsedType}),V}gte(t,n){return this.setLimit("min",t,!0,j.toString(n))}gt(t,n){return this.setLimit("min",t,!1,j.toString(n))}lte(t,n){return this.setLimit("max",t,!0,j.toString(n))}lt(t,n){return this.setLimit("max",t,!1,j.toString(n))}setLimit(t,n,r,s){return new rn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:j.toString(s)}]})}_addCheck(t){return new rn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:j.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}}rn.create=e=>new rn({checks:[],typeName:H.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...B(e)});class ts extends Y{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==A.boolean){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.boolean,received:r.parsedType}),V}return Ae(t.data)}}ts.create=e=>new ts({typeName:H.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...B(e)});class Dn extends Y{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==A.date){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_type,expected:A.date,received:o.parsedType}),V}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return T(o,{code:b.invalid_date}),V}const r=new Re;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),T(s,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):J.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Dn({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:j.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:j.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}}Dn.create=e=>new Dn({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:H.ZodDate,...B(e)});class Vo extends Y{_parse(t){if(this._getType(t)!==A.symbol){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.symbol,received:r.parsedType}),V}return Ae(t.data)}}Vo.create=e=>new Vo({typeName:H.ZodSymbol,...B(e)});class Ho extends Y{_parse(t){if(this._getType(t)!==A.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.undefined,received:r.parsedType}),V}return Ae(t.data)}}Ho.create=e=>new Ho({typeName:H.ZodUndefined,...B(e)});class zo extends Y{_parse(t){if(this._getType(t)!==A.null){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.null,received:r.parsedType}),V}return Ae(t.data)}}zo.create=e=>new zo({typeName:H.ZodNull,...B(e)});class Go extends Y{constructor(){super(...arguments),this._any=!0}_parse(t){return Ae(t.data)}}Go.create=e=>new Go({typeName:H.ZodAny,...B(e)});class Bo extends Y{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ae(t.data)}}Bo.create=e=>new Bo({typeName:H.ZodUnknown,...B(e)});class pt extends Y{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:b.invalid_type,expected:A.never,received:n.parsedType}),V}}pt.create=e=>new pt({typeName:H.ZodNever,...B(e)});class Uo extends Y{_parse(t){if(this._getType(t)!==A.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.void,received:r.parsedType}),V}return Ae(t.data)}}Uo.create=e=>new Uo({typeName:H.ZodVoid,...B(e)});class He extends Y{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==A.array)return T(n,{code:b.invalid_type,expected:A.array,received:n.parsedType}),V;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(i||a)&&(T(n,{code:i?b.too_big:b.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(T(n,{code:b.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(T(n,{code:b.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>s.type._parseAsync(new ht(n,i,n.path,a)))).then(i=>Re.mergeArray(r,i));const o=[...n.data].map((i,a)=>s.type._parseSync(new ht(n,i,n.path,a)));return Re.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new He({...this._def,minLength:{value:t,message:j.toString(n)}})}max(t,n){return new He({...this._def,maxLength:{value:t,message:j.toString(n)}})}length(t,n){return new He({...this._def,exactLength:{value:t,message:j.toString(n)}})}nonempty(t){return this.min(1,t)}}He.create=(e,t)=>new He({type:e,minLength:null,maxLength:null,exactLength:null,typeName:H.ZodArray,...B(t)});function It(e){if(e instanceof ce){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ct.create(It(r))}return new ce({...e._def,shape:()=>t})}else return e instanceof He?new He({...e._def,type:It(e.element)}):e instanceof ct?ct.create(It(e.unwrap())):e instanceof zt?zt.create(It(e.unwrap())):e instanceof _t?_t.create(e.items.map(t=>It(t))):e}class ce extends Y{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=J.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==A.object){const u=this._getOrReturnCtx(t);return T(u,{code:b.invalid_type,expected:A.object,received:u.parsedType}),V}const{status:r,ctx:s}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof pt&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const f=o[u],m=s.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new ht(s,m,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof pt){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")a.length>0&&(T(s,{code:b.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of a){const m=s.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new ht(s,m,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of c){const m=await f.key,g=await f.value;u.push({key:m,value:g,alwaysSet:f.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(r,u)):Re.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return j.errToObj,new ce({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var o,i;const s=((i=(o=this._def).errorMap)==null?void 0:i.call(o,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:j.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new ce({...this._def,unknownKeys:"strip"})}passthrough(){return new ce({...this._def,unknownKeys:"passthrough"})}extend(t){return new ce({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ce({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:H.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ce({...this._def,catchall:t})}pick(t){const n={};for(const r of J.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ce({...this._def,shape:()=>n})}omit(t){const n={};for(const r of J.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new ce({...this._def,shape:()=>n})}deepPartial(){return It(this)}partial(t){const n={};for(const r of J.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new ce({...this._def,shape:()=>n})}required(t){const n={};for(const r of J.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ct;)o=o._def.innerType;n[r]=o}return new ce({...this._def,shape:()=>n})}keyof(){return Nl(J.objectKeys(this.shape))}}ce.create=(e,t)=>new ce({shape:()=>e,unknownKeys:"strip",catchall:pt.create(),typeName:H.ZodObject,...B(t)});ce.strictCreate=(e,t)=>new ce({shape:()=>e,unknownKeys:"strict",catchall:pt.create(),typeName:H.ZodObject,...B(t)});ce.lazycreate=(e,t)=>new ce({shape:e,unknownKeys:"strip",catchall:pt.create(),typeName:H.ZodObject,...B(t)});class $n extends Y{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=o.map(a=>new tt(a.ctx.common.issues));return T(n,{code:b.invalid_union,unionErrors:i}),V}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let o;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},f=c._parseSync({data:n.data,path:n.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!o&&(o={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(c=>new tt(c));return T(n,{code:b.invalid_union,unionErrors:a}),V}}get options(){return this._def.options}}$n.create=(e,t)=>new $n({options:e,typeName:H.ZodUnion,...B(t)});function ns(e,t){const n=st(e),r=st(t);if(e===t)return{valid:!0,data:e};if(n===A.object&&r===A.object){const s=J.objectKeys(t),o=J.objectKeys(e).filter(a=>s.indexOf(a)!==-1),i={...e,...t};for(const a of o){const c=ns(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===A.array&&r===A.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const i=e[o],a=t[o],c=ns(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===A.date&&r===A.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ln extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(o,i)=>{if(Do(o)||Do(i))return V;const a=ns(o.value,i.value);return a.valid?(($o(o)||$o(i))&&n.dirty(),{status:n.value,value:a.data}):(T(r,{code:b.invalid_intersection_types}),V)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ln.create=(e,t,n)=>new Ln({left:e,right:t,typeName:H.ZodIntersection,...B(n)});class _t extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.array)return T(r,{code:b.invalid_type,expected:A.array,received:r.parsedType}),V;if(r.data.length<this._def.items.length)return T(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),V;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new ht(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>Re.mergeArray(n,i)):Re.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new _t({...this._def,rest:t})}}_t.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new _t({items:e,typeName:H.ZodTuple,rest:null,...B(t)})};class Wo extends Y{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!==A.map)return T(r,{code:b.invalid_type,expected:A.map,received:r.parsedType}),V;const s=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:s._parse(new ht(r,a,r.path,[u,"key"])),value:o._parse(new ht(r,c,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return V;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(u.value,f.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return V;(u.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(u.value,f.value)}return{status:n.value,value:a}}}}Wo.create=(e,t,n)=>new Wo({valueType:t,keyType:e,typeName:H.ZodMap,...B(n)});class sn extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==A.set)return T(r,{code:b.invalid_type,expected:A.set,received:r.parsedType}),V;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(T(r,{code:b.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(T(r,{code:b.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const o=this._def.valueType;function i(c){const u=new Set;for(const f of c){if(f.status==="aborted")return V;f.status==="dirty"&&n.dirty(),u.add(f.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>o._parse(new ht(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new sn({...this._def,minSize:{value:t,message:j.toString(n)}})}max(t,n){return new sn({...this._def,maxSize:{value:t,message:j.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}sn.create=(e,t)=>new sn({valueType:e,minSize:null,maxSize:null,typeName:H.ZodSet,...B(t)});class qo extends Y{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})}}qo.create=(e,t)=>new qo({getter:e,typeName:H.ZodLazy,...B(t)});class Zo extends Y{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return T(n,{received:n.data,code:b.invalid_literal,expected:this._def.value}),V}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zo.create=(e,t)=>new Zo({value:e,typeName:H.ZodLiteral,...B(t)});function Nl(e,t){return new Vt({values:e,typeName:H.ZodEnum,...B(t)})}class Vt extends Y{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{expected:J.joinValues(r),received:n.parsedType,code:b.invalid_type}),V}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{received:n.data,code:b.invalid_enum_value,options:r}),V}return Ae(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 Vt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Vt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Vt.create=Nl;class Ko extends Y{_parse(t){const n=J.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==A.string&&r.parsedType!==A.number){const s=J.objectValues(n);return T(r,{expected:J.joinValues(s),received:r.parsedType,code:b.invalid_type}),V}if(this._cache||(this._cache=new Set(J.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=J.objectValues(n);return T(r,{received:r.data,code:b.invalid_enum_value,options:s}),V}return Ae(t.data)}get enum(){return this._def.values}}Ko.create=(e,t)=>new Ko({values:e,typeName:H.ZodNativeEnum,...B(t)});class Vn extends Y{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==A.promise&&n.common.async===!1)return T(n,{code:b.invalid_type,expected:A.promise,received:n.parsedType}),V;const r=n.parsedType===A.promise?n.data:Promise.resolve(n.data);return Ae(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Vn.create=(e,t)=>new Vn({type:e,typeName:H.ZodPromise,...B(t)});class Ht extends Y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===H.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:i=>{T(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const i=s.transform(r.data,o);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return V;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?V:c.status==="dirty"||n.value==="dirty"?Kt(c.value):c});{if(n.value==="aborted")return V;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?V:a.status==="dirty"||n.value==="dirty"?Kt(a.value):a}}if(s.type==="refinement"){const i=a=>{const c=s.refinement(a,o);if(r.common.async)return Promise.resolve(c);if(c 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"?V:(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"?V:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$t(i))return V;const a=s.transform(i.value,o);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=>$t(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:n.value,value:a})):V);J.assertNever(s)}}Ht.create=(e,t,n)=>new Ht({schema:e,typeName:H.ZodEffects,effect:t,...B(n)});Ht.createWithPreprocess=(e,t,n)=>new Ht({schema:t,effect:{type:"preprocess",transform:e},typeName:H.ZodEffects,...B(n)});class ct extends Y{_parse(t){return this._getType(t)===A.undefined?Ae(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ct.create=(e,t)=>new ct({innerType:e,typeName:H.ZodOptional,...B(t)});class zt extends Y{_parse(t){return this._getType(t)===A.null?Ae(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}zt.create=(e,t)=>new zt({innerType:e,typeName:H.ZodNullable,...B(t)});class rs extends Y{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===A.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:H.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...B(t)});class ss extends Y{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Fn(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ss.create=(e,t)=>new ss({innerType:e,typeName:H.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...B(t)});class Xo extends Y{_parse(t){if(this._getType(t)!==A.nan){const r=this._getOrReturnCtx(t);return T(r,{code:b.invalid_type,expected:A.nan,received:r.parsedType}),V}return{status:"valid",value:t.data}}}Xo.create=e=>new Xo({typeName:H.ZodNaN,...B(e)});class ip extends Y{_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 Gs extends Y{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?V:o.status==="dirty"?(n.dirty(),Kt(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?V:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Gs({in:t,out:n,typeName:H.ZodPipeline})}}class os extends Y{_parse(t){const n=this._def.innerType._parse(t),r=s=>($t(s)&&(s.value=Object.freeze(s.value)),s);return Fn(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}os.create=(e,t)=>new os({innerType:e,typeName:H.ZodReadonly,...B(t)});var H;(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"})(H||(H={}));const se=at.create,dn=Lt.create,tr=ts.create;pt.create;const Tl=He.create,de=ce.create;$n.create;Ln.create;_t.create;const Ut=Vt.create;Vn.create;ct.create;zt.create;const ap=10,is={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:de({query:se().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:dn().optional().default(ap).describe("Number of results to return"),mcp:tr().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},as={name:"model_search",description:"Find Machine Learning models hosted on Hugging Face. Returns comprehensive information about matching models including downloads, likes, tags, and direct links. Include links to the models in your response",schema:de({query:se().optional().describe('Search term. Leave blank and specify "sort" and "limit" to get e.g. "Top 20 trending models", "Top 10 most recent models" etc" '),author:se().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:se().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:se().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:Ut(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:dn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var jr=65536;lp();function lp(){try{return new Uint32Array(jr)}catch{const t=new Array(jr);for(let n=0;n<jr;n++)t[n]=0;return t}}const ls={name:"model_details",description:"Get detailed information about a model from the Hugging Face Hub. Include relevant links in result summaries.",schema:de({model_id:se().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")}),annotations:{title:"Model Details"}};de({model_id:se().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const cs={name:"paper_search",description:"Find Machine Learning research papers on the Hugging Face hub. Include 'Link to paper' When presenting the results. Consider whether tabulating results matches user intent.",schema:de({query:se().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:dn().optional().default(12).describe("Number of results to return"),concise_only:tr().optional().default(!1).describe("Return a 2 sentence summary of the abstract. Use for broad search terms which may return a lot of results. Check with User if unsure.")}),annotations:{title:"Paper Search"}},us={name:"dataset_search",description:"Find Datasets hosted on the Hugging Face hub. Returns comprehensive information about matching datasets including downloads, likes, tags, and direct links. Include links to the datasets in your response",schema:de({query:se().optional().describe('Search term. Leave blank and specify "sort" and "limit" to get e.g. "Top 20 trending datasets", "Top 10 most recent datasets" etc" '),author:se().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:Tl(se()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:Ut(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:dn().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},ds={name:"dataset_details",description:"Get detailed information about a specific dataset on Hugging Face Hub.",schema:de({dataset_id:se().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")}),annotations:{title:"Dataset Details"}};de({dataset_id:se().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const fs={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified.",schema:de({repo_ids:Tl(se().min(1)).min(1,"Provide at least one id").max(10,"Provide at most 10 repo ids").describe("Repo IDs for (models|dataset/space) - usually in author/name format (e.g. openai/gpt-oss-120b)"),repo_type:Ut(["model","dataset","space"]).optional().describe("Specify lookup type; otherwise auto-detects"),include_readme:tr().default(!1).describe("Include README from the repo")}),annotations:{title:"Hub Repo Details"}},Al={name:"duplicate_space",schema:de({sourceSpaceId:se().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:se().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:Ut(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:tr().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}},jl={name:"space_info",schema:de({username:se().optional().describe("Username to get spaces for (defaults to authenticated user)")}),annotations:{title:"Hugging Face Spaces Information"}},kl={name:"space_files",schema:de({spaceName:se().optional().describe('Space identifier in format "username/spacename"'),fileType:Ut(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};de({fileType:Ut(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});de({});de({user_id:se().min(3,"User ID must be at least 3 characters long").describe('Hugging Face user ID or URL (e.g., "evalstate" or "hf.co/evalstate")').max(60).describe("Maximum length is 30 characters")});de({paper_id:se().min(1,"Paper ID is required").describe('arXiv paper ID in various formats (e.g., "2502.16161", "arxiv:2502.16161", or full URL)').max(60).describe("Maximum length is 100 characters")});var Bs=typeof window<"u"?window:{};function cp(){var e=Bs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function up(){var e=function(){};return dp()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function dp(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Bs.ActiveXObject&&(e=!0)}return e}cp()?Bs.DOMParser:up();const gs={name:"hf_doc_fetch",description:"Fetch a document from the Hugging Face or Gradio documentation library. For large documents, use offset to get subsequent chunks.",schema:de({doc_url:se().max(200,"Query too long").describe("Documentation URL (Hugging Face or Gradio)"),offset:dn().min(0).optional().describe("Token offset for large documents (use the offset from truncation message)")}),annotations:{title:"Fetch a document from the Hugging Face documentation library"}},ms={name:"hf_doc_search",description:"Search documentation about all of Hugging Face products and libraries (Transformers, Datasets, Diffusers, Gradio, Hub, and more). Use this for the most up-to-date information Returns excerpts grouped by Product and Document.",schema:de({query:se().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic search query"),product:se().optional().describe('Filter by Product (e.g., "hub", "dataset-viewer", "transformers"). Supply when known for focused results')}),annotations:{title:"Hugging Face Documentation Library Search"}};de({space_id:se().min(1).describe("Space ID in 'username/repo' format")});const Yo=is.name,Jo=as.name,Qo=ls.name,ei=cs.name,ti=us.name,ni=ds.name,ri=fs.name,si=Al.name,oi=jl.name,ii=kl.name,ai=ms.name,li=gs.name,kr=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function fp(){var N,R,M,z,F,Z,Q,U,D,ne,W,ee,I;const{data:e,error:t}=Xt("/api/transport",kr,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});Xt("/api/sessions",kr,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=Xt("/api/settings",kr),[r,s]=p.useState(["","",""]),[o,i]=p.useState(["","",""]),[a,c]=p.useState([!1,!1,!1]),[u,f]=p.useState(!1);p.useEffect(()=>{if(n!=null&&n.spaceTools&&!u){const E=["","",""],L=["","",""],$=[!1,!1,!1];n.spaceTools.forEach((K,fe)=>{fe<3&&(E[fe]=K.name,L[fe]=K.subdomain,$[fe]=!0)}),s(E),i(L),c($),f(!0)}},[n,u]);const m=!e&&!t,g=t?t.message:null,d=async(E,L)=>{try{const $=n||{builtInTools:[]},K=$.builtInTools,fe=L?[...K.filter(ye=>ye!==E),E]:K.filter(ye=>ye!==E),je={...$,builtInTools:fe};bn("/api/settings",je,!1);const Ee=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:fe})});if(!Ee.ok)throw new Error(`Failed to update tool settings: ${Ee.status}`);bn("/api/settings"),console.log(`${E} is now ${L?"enabled":"disabled"}`)}catch($){console.error("Error updating tool settings:",$),alert(`Error updating ${E}: ${$ instanceof Error?$.message:"Unknown error"}`),bn("/api/settings")}},v=async(E,L)=>{const $=[...a];$[E]=L,c($),await x($)},h=async(E,L)=>{const $=[...r];$[E]=L,s($),a[E]&&await x(a)},y=async(E,L)=>{const $=[...o];$[E]=L,i($),a[E]&&await x(a)},x=async E=>{try{const L=[];for(let K=0;K<3;K++)E[K]&&r[K]&&o[K]&&L.push({_id:`space-${K}`,name:r[K],subdomain:o[K],emoji:"🔧"});const $=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:L})});if(!$.ok)throw new Error(`Failed to update space tools: ${$.status}`)}catch(L){console.error("Error updating space tools:",L)}},w=async()=>{const E="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(E)}catch(L){console.error("Failed to copy URL:",L)}},_=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},S={paper_search:{id:ei,label:cs.annotations.title,description:cs.description,settings:{enabled:((N=n==null?void 0:n.builtInTools)==null?void 0:N.includes(ei))??!0}},space_search:{id:Yo,label:is.annotations.title,description:is.description,settings:{enabled:((R=n==null?void 0:n.builtInTools)==null?void 0:R.includes(Yo))??!0}},model_search:{id:Jo,label:as.annotations.title,description:as.description,settings:{enabled:((M=n==null?void 0:n.builtInTools)==null?void 0:M.includes(Jo))??!0}},model_details:{id:Qo,label:ls.annotations.title,description:ls.description,settings:{enabled:((z=n==null?void 0:n.builtInTools)==null?void 0:z.includes(Qo))??!0}},dataset_search:{id:ti,label:us.annotations.title,description:us.description,settings:{enabled:((F=n==null?void 0:n.builtInTools)==null?void 0:F.includes(ti))??!0}},dataset_details:{id:ni,label:ds.annotations.title,description:ds.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(ni))??!0}},hub_repo_details:{id:ri,label:fs.annotations.title,description:fs.description,settings:{enabled:((Q=n==null?void 0:n.builtInTools)==null?void 0:Q.includes(ri))??!0}},include_readme:{id:"INCLUDE_README",label:"Include README (flag)",description:"Adds README content to hub_repo_details output when enabled. This is a behavior flag, not a tool. Requires reconnect to take effect",settings:{enabled:((U=n==null?void 0:n.builtInTools)==null?void 0:U.includes("INCLUDE_README"))??!1}},doc_semantic_search:{id:ai,label:ms.annotations.title,description:ms.description,settings:{enabled:((D=n==null?void 0:n.builtInTools)==null?void 0:D.includes(ai))??!0}},doc_fetch:{id:li,label:gs.annotations.title,description:gs.description,settings:{enabled:((ne=n==null?void 0:n.builtInTools)==null?void 0:ne.includes(li))??!0}}},C={duplicate_space:{id:si,label:Al.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((W=n==null?void 0:n.builtInTools)==null?void 0:W.includes(si))??!0}},space_info:{id:oi,label:jl.annotations.title,description:"Get detailed information about Hugging Face Spaces.",settings:{enabled:((ee=n==null?void 0:n.builtInTools)==null?void 0:ee.includes(oi))??!0}},space_files:{id:ii,label:kl.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((I=n==null?void 0:n.builtInTools)==null?void 0:I.includes(ii))??!0}}};return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"min-h-screen p-4 sm:p-8 pb-20",children:l.jsx("div",{className:"max-w-4xl mx-auto",children:l.jsxs(Ih,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(Ph,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(jt,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(jt,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(jt,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(jt,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(jt,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(jt,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(kt,{value:"metrics",className:"mt-0",children:l.jsx(Ch,{})}),l.jsx(kt,{value:"mcp",className:"mt-0",children:l.jsx(Rh,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"search",className:"mt-0",children:l.jsx(no,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:S,onToolToggle:d})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"spaces",className:"mt-0",children:l.jsx(no,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:C,onToolToggle:d})}),!(e!=null&&e.externalApiMode)&&l.jsx(kt,{value:"gradio",className:"mt-0",children:l.jsx(qc,{spaceNames:r,spaceSubdomains:o,enabledSpaces:a,onSpaceToolToggle:v,onSpaceToolNameChange:h,onSpaceToolSubdomainChange:y})}),l.jsx(kt,{value:"home",className:"mt-0",children:l.jsxs(Ze,{children:[l.jsxs(Ke,{children:[l.jsx(Xe,{children:"🤗 HF MCP Server"}),l.jsx(Ct,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(Ye,{className:"space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What's MCP?"}),l.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:"The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This HF MCP Server provides access to Hugging Face's ecosystem of models, datasets, and Spaces, allowing AI assistants to search, analyze, and interact with ML resources directly."})]}),l.jsx(yt,{}),l.jsx("div",{className:"bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:l.jsxs("div",{className:"flex items-start space-x-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:l.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"Tool Management Scope"}),((e==null?void 0:e.externalApiMode)||(e==null?void 0:e.transport)!=="stdio"&&!(e!=null&&e.externalApiMode))&&l.jsx("p",{className:"text-sm text-blue-700 dark:text-blue-300 leading-relaxed",children:e!=null&&e.externalApiMode?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"External API Mode:"})," Tools are managed by an external API. Tool Selection Tabs are not available."]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"Shared Mode:"})," Tool toggles in this interface affect"," ",l.jsx("strong",{children:"all connected MCP server instances"})," and control tool availability for all connected Hosts."]})})]})]})}),l.jsx(yt,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(Pt,{size:"xl",onClick:w,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx($l,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(Pt,{size:"xl",variant:"outline",onClick:_,className:"w-full touch-manipulation",children:[l.jsx(Ll,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(Eh,{isLoading:m,error:g,transportInfo:e||{transport:"unknown"}})]})}Vl.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(fp,{})}));