@llmindset/hf-mcp-server 0.2.36 → 0.2.38

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 Nc,a as h,R as He,j as l,b as qi,g as Ac,c as Tc,d as jc}from"./inde
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 Cs;function Ic(){if(Cs)return Er;Cs=1;var e=Nc();function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(g,m){var f=m(),v=r({inst:{value:f,getSnapshot:m}}),p=v[0].inst,y=v[1];return s(function(){p.value=f,p.getSnapshot=m,c(p)&&y({inst:p})},[g,f,m]),o(function(){return c(p)&&y({inst:p}),g(function(){c(p)&&y({inst:p})})},[g]),i(f),f}function c(g){var m=g.getSnapshot;g=g.value;try{var f=m();return!n(g,f)}catch{return!0}}function u(g,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Er.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Er}var Rs;function Pc(){return Rs||(Rs=1,Rr.exports=Ic()),Rr.exports}var Oc=Pc();const Zi=0,Ki=1,Xi=2,Es=3;var ks=Object.prototype.hasOwnProperty;function ro(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--&&ro(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(ks.call(e,n)&&++r&&!ks.call(t,n)||!(n in t)||!ro(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const rt=new WeakMap,xt=()=>{},Re=xt(),oo=Object,ie=e=>e===Re,Ge=e=>typeof e=="function",St=(e,t)=>({...e,...t}),Yi=e=>Ge(e.then),kr={},An={},Go="undefined",Rn=typeof window!=Go,so=typeof document!=Go,Fc=Rn&&"Deno"in window,Dc=()=>Rn&&typeof window.requestAnimationFrame!=Go,Ji=(e,t)=>{const n=rt.get(e);return[()=>!ie(t)&&e.get(t)||kr,r=>{if(!ie(t)){const o=e.get(t);t in An||(An[t]=o),n[5](t,St(o,r),o||kr)}},n[6],()=>!ie(t)&&t in An?An[t]:!ie(t)&&e.get(t)||kr]};let io=!0;const $c=()=>io,[ao,lo]=Rn&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[xt,xt],Lc=()=>{const e=so&&document.visibilityState;return ie(e)||e!=="hidden"},Vc=e=>(so&&document.addEventListener("visibilitychange",e),ao("focus",e),()=>{so&&document.removeEventListener("visibilitychange",e),lo("focus",e)}),zc=e=>{const t=()=>{io=!0,e()},n=()=>{io=!1};return ao("online",t),ao("offline",n),()=>{lo("online",t),lo("offline",n)}},Hc={isOnline:$c,isVisible:Lc},Gc={initFocus:Vc,initReconnect:zc},Ms=!He.useId,hn=!Rn||Fc,Bc=e=>Dc()?window.requestAnimationFrame(e):setTimeout(e,1),Mr=hn?h.useEffect:h.useLayoutEffect,Nr=typeof navigator<"u"&&navigator.connection,Ns=!hn&&Nr&&(["slow-2g","2g"].includes(Nr.effectiveType)||Nr.saveData),Tn=new WeakMap,Uc=e=>oo.prototype.toString.call(e),Ar=(e,t)=>e===`[object ${t}]`;let Wc=0;const co=e=>{const t=typeof e,n=Uc(e),r=Ar(n,"Date"),o=Ar(n,"RegExp"),s=Ar(n,"Object");let i,a;if(oo(e)===e&&!r&&!o){if(i=Tn.get(e),i)return i;if(i=++Wc+"~",Tn.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=co(e[a])+",";Tn.set(e,i)}if(s){i="#";const c=oo.keys(e).sort();for(;!ie(a=c.pop());)ie(e[a])||(i+=a+":"+co(e[a])+",");Tn.set(e,i)}}else i=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},Bo=e=>{if(Ge(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?co(e):"",[e,t]};let qc=0;const uo=()=>++qc;async function Qi(...e){const[t,n,r,o]=e,s=St({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let i=s.populateCache;const a=s.rollbackOnError;let c=s.optimisticData;const u=m=>typeof a=="function"?a(m):a!==!1,d=s.throwOnError;if(Ge(n)){const m=n,f=[],v=t.keys();for(const p of v)!/^\$(inf|sub)\$/.test(p)&&m(t.get(p)._k)&&f.push(p);return Promise.all(f.map(g))}return g(n);async function g(m){const[f]=Bo(m);if(!f)return;const[v,p]=Ji(t,f),[y,x,b,w]=rt.get(t),_=()=>{const A=y[f];return(Ge(s.revalidate)?s.revalidate(v().data,m):s.revalidate!==!1)&&(delete b[f],delete w[f],A&&A[0])?A[0](Xi).then(()=>v().data):v().data};if(e.length<3)return _();let C=r,N,E=!1;const S=uo();x[f]=[S,0];const j=!ie(c),L=v(),K=L.data,U=L._c,Z=ie(U)?K:U;if(j&&(c=Ge(c)?c(Z,K):c,p({data:c,_c:Z})),Ge(C))try{C=C(Z)}catch(A){N=A,E=!0}if(C&&Yi(C))if(C=await C.catch(A=>{N=A,E=!0}),S!==x[f][0]){if(E)throw N;return C}else E&&j&&u(N)&&(i=!0,p({data:Z,_c:Re}));if(i&&!E)if(Ge(i)){const A=i(C,Z);p({data:A,error:Re,_c:Re})}else p({data:C,error:Re,_c:Re});if(x[f][1]=uo(),Promise.resolve(_()).then(()=>{p({_c:Re})}),E){if(d)throw N;return}return C}}const As=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Zc=(e,t)=>{if(!rt.has(e)){const n=St(Gc,t),r=Object.create(null),o=Qi.bind(Re,e);let s=xt;const i=Object.create(null),a=(d,g)=>{const m=i[d]||[];return i[d]=m,m.push(g),()=>m.splice(m.indexOf(g),1)},c=(d,g,m)=>{e.set(d,g);const f=i[d];if(f)for(const v of f)v(g,m)},u=()=>{if(!rt.has(e)&&(rt.set(e,[r,Object.create(null),Object.create(null),Object.create(null),o,c,a]),!hn)){const d=n.initFocus(setTimeout.bind(Re,As.bind(Re,r,Zi))),g=n.initReconnect(setTimeout.bind(Re,As.bind(Re,r,Ki)));s=()=>{d&&d(),g&&g(),rt.delete(e)}}};return u(),[e,o,u,s]}return[e,rt.get(e)[4]]},Kc=(e,t,n,r,o)=>{const s=n.errorRetryCount,i=o.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!ie(s)&&i>s||setTimeout(r,a,o)},Xc=ro,[ea,Un]=Zc(new Map),Yc=St({onLoadingSlow:xt,onSuccess:xt,onError:xt,onErrorRetry:Kc,onDiscarded:xt,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ns?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ns?5e3:3e3,compare:Xc,isPaused:()=>!1,cache:ea,mutate:Un,fallback:{}},Hc),Jc=(e,t)=>{const n=St(e,t);if(t){const{use:r,fallback:o}=e,{use:s,fallback:i}=t;r&&s&&(n.use=r.concat(s)),o&&i&&(n.fallback=St(o,i))}return n},Qc=h.createContext({}),eu="$inf$",ta=Rn&&window.__SWR_DEVTOOLS_USE__,tu=ta?window.__SWR_DEVTOOLS_USE__:[],nu=()=>{ta&&(window.__SWR_DEVTOOLS_REACT__=He)},ru=e=>Ge(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ou=()=>{const e=h.useContext(Qc);return h.useMemo(()=>St(Yc,e),[e])},su=e=>(t,n,r)=>e(t,n&&((...s)=>{const[i]=Bo(t),[,,,a]=rt.get(ea);if(i.startsWith(eu))return n(...s);const c=a[i];return ie(c)?n(...s):(delete a[i],c)}),r),iu=tu.concat(su),au=e=>function(...n){const r=ou(),[o,s,i]=ru(n),a=Jc(r,i);let c=e;const{use:u}=a,d=(u||[]).concat(iu);for(let g=d.length;g--;)c=d[g](c);return c(o,s||a.fetcher||null,a)},lu=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}};nu();const Tr=He.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}}),jr={dedupe:!0},Ts=Promise.resolve(Re),cu=(e,t,n)=>{const{cache:r,compare:o,suspense:s,fallbackData:i,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:d,refreshWhenOffline:g,keepPreviousData:m}=n,[f,v,p,y]=rt.get(r),[x,b]=Bo(e),w=h.useRef(!1),_=h.useRef(!1),C=h.useRef(x),N=h.useRef(t),E=h.useRef(n),S=()=>E.current,j=()=>S().isVisible()&&S().isOnline(),[L,K,U,Z]=Ji(r,x),A=h.useRef({}).current,te=ie(i)?ie(n.fallback)?Re:n.fallback[x]:i,I=(re,ue)=>{for(const he in A){const le=he;if(le==="data"){if(!o(re[le],ue[le])&&(!ie(re[le])||!o(be,ue[le])))return!1}else if(ue[le]!==re[le])return!1}return!0},Q=h.useMemo(()=>{const re=!x||!t?!1:ie(a)?S().isPaused()||s?!1:c!==!1:a,ue=ke=>{const Qe=St(ke);return delete Qe._k,re?{isValidating:!0,isLoading:!0,...Qe}:Qe},he=L(),le=Z(),Ae=ue(he),gt=he===le?Ae:ue(le);let ge=Ae;return[()=>{const ke=ue(L());return I(ke,ge)?(ge.data=ke.data,ge.isLoading=ke.isLoading,ge.isValidating=ke.isValidating,ge.error=ke.error,ge):(ge=ke,ke)},()=>gt]},[r,x]),R=Oc.useSyncExternalStore(h.useCallback(re=>U(x,(ue,he)=>{I(he,ue)||re()}),[r,x]),Q[0],Q[1]),k=!w.current,z=f[x]&&f[x].length>0,V=R.data,ee=ie(V)?te&&Yi(te)?Tr(te):te:V,se=R.error,ce=h.useRef(ee),be=m?ie(V)?ie(ce.current)?ee:ce.current:V:ee,Se=z&&!ie(se)?!1:k&&!ie(a)?a:S().isPaused()?!1:s?ie(ee)?!1:c:ie(ee)||c,ne=!!(x&&t&&k&&Se),ze=ie(R.isValidating)?ne:R.isValidating,xe=ie(R.isLoading)?ne:R.isLoading,_e=h.useCallback(async re=>{const ue=N.current;if(!x||!ue||_.current||S().isPaused())return!1;let he,le,Ae=!0;const gt=re||{},ge=!p[x]||!gt.dedupe,ke=()=>Ms?!_.current&&x===C.current&&w.current:x===C.current,Qe={isValidating:!1,isLoading:!1},bs=()=>{K(Qe)},Ss=()=>{const Pe=p[x];Pe&&Pe[1]===le&&delete p[x]},_s={isValidating:!0};ie(L().data)&&(_s.isLoading=!0);try{if(ge&&(K(_s),n.loadingTimeout&&ie(L().data)&&setTimeout(()=>{Ae&&ke()&&S().onLoadingSlow(x,n)},n.loadingTimeout),p[x]=[ue(b),uo()]),[he,le]=p[x],he=await he,ge&&setTimeout(Ss,n.dedupingInterval),!p[x]||p[x][1]!==le)return ge&&ke()&&S().onDiscarded(x),!1;Qe.error=Re;const Pe=v[x];if(!ie(Pe)&&(le<=Pe[0]||le<=Pe[1]||Pe[1]===0))return bs(),ge&&ke()&&S().onDiscarded(x),!1;const et=L().data;Qe.data=o(et,he)?et:he,ge&&ke()&&S().onSuccess(he,x,n)}catch(Pe){Ss();const et=S(),{shouldRetryOnError:_r}=et;et.isPaused()||(Qe.error=Pe,ge&&ke()&&(et.onError(Pe,x,et),(_r===!0||Ge(_r)&&_r(Pe))&&(!S().revalidateOnFocus||!S().revalidateOnReconnect||j())&&et.onErrorRetry(Pe,x,et,Mc=>{const Cr=f[x];Cr&&Cr[0]&&Cr[0](Es,Mc)},{retryCount:(gt.retryCount||0)+1,dedupe:!0})))}return Ae=!1,bs(),!0},[x,r]),Je=h.useCallback((...re)=>Qi(r,C.current,...re),[]);if(Mr(()=>{N.current=t,E.current=n,ie(V)||(ce.current=V)}),Mr(()=>{if(!x)return;const re=_e.bind(Re,jr);let ue=0;S().revalidateOnFocus&&(ue=Date.now()+S().focusThrottleInterval);const le=lu(x,f,(Ae,gt={})=>{if(Ae==Zi){const ge=Date.now();S().revalidateOnFocus&&ge>ue&&j()&&(ue=ge+S().focusThrottleInterval,re())}else if(Ae==Ki)S().revalidateOnReconnect&&j()&&re();else{if(Ae==Xi)return _e();if(Ae==Es)return _e(gt)}});return _.current=!1,C.current=x,w.current=!0,K({_k:b}),Se&&(p[x]||(ie(ee)||hn?re():Bc(re))),()=>{_.current=!0,le()}},[x]),Mr(()=>{let re;function ue(){const le=Ge(u)?u(L().data):u;le&&re!==-1&&(re=setTimeout(he,le))}function he(){!L().error&&(d||S().isVisible())&&(g||S().isOnline())?_e(jr).then(ue):ue()}return ue(),()=>{re&&(clearTimeout(re),re=-1)}},[u,d,g,x]),h.useDebugValue(be),s){const re=x&&ie(ee);if(!Ms&&hn&&re)throw new Error("Fallback data is required when using Suspense in SSR.");re&&(N.current=t,E.current=n,_.current=!1);const ue=y[x],he=!ie(ue)&&re?Je(ue):Ts;if(Tr(he),!ie(se)&&re)throw se;const le=re?_e(jr):Ts;!ie(be)&&re&&(le.status="fulfilled",le.value=!0),Tr(le)}return{mutate:Je,get data(){return A.data=!0,be},get error(){return A.error=!0,se},get isValidating(){return A.isValidating=!0,ze},get isLoading(){return A.isLoading=!0,xe}}},mn=au(cu);function na(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=na(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ra(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=na(e))&&(r&&(r+=" "),r+=t);return r}const Uo="-",uu=e=>{const t=fu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Uo);return a[0]===""&&a.length!==1&&a.shift(),oa(a,t)||du(i)},getConflictingClassGroupIds:(i,a)=>{const c=n[i]||[];return a&&r[i]?[...c,...r[i]]:c}}},oa=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?oa(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Uo);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},js=/^\[(.+)\]$/,du=e=>{if(js.test(e)){const t=js.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},fu=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)fo(n[o],r,o,t);return r},fo=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Is(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(mu(o)){fo(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{fo(i,Is(t,s),n,r)})})},Is=(e,t)=>{let n=e;return t.split(Uo).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},mu=e=>e.isThemeGetter,gu=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},mo="!",go=":",pu=go.length,hu=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,c=0,u;for(let v=0;v<o.length;v++){let p=o[v];if(i===0&&a===0){if(p===go){s.push(o.slice(c,v)),c=v+pu;continue}if(p==="/"){u=v;continue}}p==="["?i++:p==="]"?i--:p==="("?a++:p===")"&&a--}const d=s.length===0?o:o.substring(c),g=vu(d),m=g!==d,f=u&&u>c?u-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:f}};if(t){const o=t+go,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},vu=e=>e.endsWith(mo)?e.substring(0,e.length-1):e.startsWith(mo)?e.substring(1):e,xu=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},yu=e=>({cache:gu(e.cacheSize),parseClassName:hu(e),sortModifiers:xu(e),...uu(e)}),wu=/\s+/,bu=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(wu);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:g,modifiers:m,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:p}=n(d);if(g){c=d+(c.length>0?" "+c:c);continue}let y=!!p,x=r(y?v.substring(0,p):v);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=r(v),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const b=s(m).join(":"),w=f?b+mo:b,_=w+x;if(i.includes(_))continue;i.push(_);const C=o(x,y);for(let N=0;N<C.length;++N){const E=C[N];i.push(w+E)}c=d+(c.length>0?" "+c:c)}return c};function Su(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=sa(t))&&(r&&(r+=" "),r+=n);return r}const sa=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=sa(e[r]))&&(n&&(n+=" "),n+=t);return n};function _u(e,...t){let n,r,o,s=i;function i(c){const u=t.reduce((d,g)=>g(d),e());return n=yu(u),r=n.cache.get,o=n.cache.set,s=a,a(c)}function a(c){const u=r(c);if(u)return u;const d=bu(c,n);return o(c,d),d}return function(){return s(Su.apply(null,arguments))}}const ye=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},ia=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,aa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Cu=/^\d+\/\d+$/,Ru=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Eu=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ku=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Nu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zt=e=>Cu.test(e),Y=e=>!!e&&!Number.isNaN(Number(e)),pt=e=>!!e&&Number.isInteger(Number(e)),Ir=e=>e.endsWith("%")&&Y(e.slice(0,-1)),tt=e=>Ru.test(e),Au=()=>!0,Tu=e=>Eu.test(e)&&!ku.test(e),la=()=>!1,ju=e=>Mu.test(e),Iu=e=>Nu.test(e),Pu=e=>!P(e)&&!O(e),Ou=e=>rn(e,da,la),P=e=>ia.test(e),At=e=>rn(e,fa,Tu),Pr=e=>rn(e,Vu,Y),Ps=e=>rn(e,ca,la),Fu=e=>rn(e,ua,Iu),jn=e=>rn(e,ma,ju),O=e=>aa.test(e),cn=e=>on(e,fa),Du=e=>on(e,zu),Os=e=>on(e,ca),$u=e=>on(e,da),Lu=e=>on(e,ua),In=e=>on(e,ma,!0),rn=(e,t,n)=>{const r=ia.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},on=(e,t,n=!1)=>{const r=aa.exec(e);return r?r[1]?t(r[1]):n:!1},ca=e=>e==="position"||e==="percentage",ua=e=>e==="image"||e==="url",da=e=>e==="length"||e==="size"||e==="bg-size",fa=e=>e==="length",Vu=e=>e==="number",zu=e=>e==="family-name",ma=e=>e==="shadow",Hu=()=>{const e=ye("color"),t=ye("font"),n=ye("text"),r=ye("font-weight"),o=ye("tracking"),s=ye("leading"),i=ye("breakpoint"),a=ye("container"),c=ye("spacing"),u=ye("radius"),d=ye("shadow"),g=ye("inset-shadow"),m=ye("text-shadow"),f=ye("drop-shadow"),v=ye("blur"),p=ye("perspective"),y=ye("aspect"),x=ye("ease"),b=ye("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[..._(),O,P],N=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],S=()=>[O,P,c],j=()=>[zt,"full","auto",...S()],L=()=>[pt,"none","subgrid",O,P],K=()=>["auto",{span:["full",pt,O,P]},pt,O,P],U=()=>[pt,"auto",O,P],Z=()=>["auto","min","max","fr",O,P],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...S()],Q=()=>[zt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],R=()=>[e,O,P],k=()=>[..._(),Os,Ps,{position:[O,P]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",$u,Ou,{size:[O,P]}],ee=()=>[Ir,cn,At],se=()=>["","none","full",u,O,P],ce=()=>["",Y,cn,At],be=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[Y,Ir,Os,Ps],ze=()=>["","none",v,O,P],xe=()=>["none",Y,O,P],_e=()=>["none",Y,O,P],Je=()=>[Y,O,P],mt=()=>[zt,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tt],breakpoint:[tt],color:[Au],container:[tt],"drop-shadow":[tt],ease:["in","out","in-out"],font:[Pu],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tt],shadow:[tt],spacing:["px",Y],text:[tt],"text-shadow":[tt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zt,P,O,y]}],container:["container"],columns:[{columns:[Y,P,O,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:j()}],"inset-x":[{"inset-x":j()}],"inset-y":[{"inset-y":j()}],start:[{start:j()}],end:[{end:j()}],top:[{top:j()}],right:[{right:j()}],bottom:[{bottom:j()}],left:[{left:j()}],visibility:["visible","invisible","collapse"],z:[{z:[pt,"auto",O,P]}],basis:[{basis:[zt,"full","auto",a,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Y,zt,"auto","initial","none",P]}],grow:[{grow:["",Y,O,P]}],shrink:[{shrink:["",Y,O,P]}],order:[{order:[pt,"first","last","none",O,P]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Z()}],"auto-rows":[{"auto-rows":Z()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[a,"screen",...Q()]}],"min-w":[{"min-w":[a,"screen","none",...Q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,cn,At]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,O,Pr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ir,P]}],"font-family":[{font:[Du,P,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,O,P]}],"line-clamp":[{"line-clamp":[Y,"none",O,Pr]}],leading:[{leading:[s,...S()]}],"list-image":[{"list-image":["none",O,P]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",O,P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Y,"from-font","auto",O,At]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[Y,"auto",O,P]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",O,P]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",O,P]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pt,O,P],radial:["",O,P],conic:[pt,O,P]},Lu,Fu]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Y,O,P]}],"outline-w":[{outline:["",Y,cn,At]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",d,In,jn]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",g,In,jn]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[Y,At]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",m,In,jn]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[Y,O,P]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Y]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[O,P]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Y]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",O,P]}],filter:[{filter:["","none",O,P]}],blur:[{blur:ze()}],brightness:[{brightness:[Y,O,P]}],contrast:[{contrast:[Y,O,P]}],"drop-shadow":[{"drop-shadow":["","none",f,In,jn]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",Y,O,P]}],"hue-rotate":[{"hue-rotate":[Y,O,P]}],invert:[{invert:["",Y,O,P]}],saturate:[{saturate:[Y,O,P]}],sepia:[{sepia:["",Y,O,P]}],"backdrop-filter":[{"backdrop-filter":["","none",O,P]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[Y,O,P]}],"backdrop-contrast":[{"backdrop-contrast":[Y,O,P]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Y,O,P]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Y,O,P]}],"backdrop-invert":[{"backdrop-invert":["",Y,O,P]}],"backdrop-opacity":[{"backdrop-opacity":[Y,O,P]}],"backdrop-saturate":[{"backdrop-saturate":[Y,O,P]}],"backdrop-sepia":[{"backdrop-sepia":["",Y,O,P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",O,P]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Y,"initial",O,P]}],ease:[{ease:["linear","initial",x,O,P]}],delay:[{delay:[Y,O,P]}],animate:[{animate:["none",b,O,P]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,O,P]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Je()}],"skew-x":[{"skew-x":Je()}],"skew-y":[{"skew-y":Je()}],transform:[{transform:[O,P,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:mt()}],"translate-x":[{"translate-x":mt()}],"translate-y":[{"translate-y":mt()}],"translate-z":[{"translate-z":mt()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",O,P]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",O,P]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[Y,cn,At,Pr]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Gu=_u(Hu);function de(...e){return Gu(ra(e))}function st({className:e,...t}){return l.jsx("div",{"data-slot":"card",className:de("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function it({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:de("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function at({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:de("leading-none font-semibold",e),...t})}function Ft({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:de("text-muted-foreground text-sm",e),...t})}function lt({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:de("px-6",e),...t})}function Fs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function lr(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Fs(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Fs(e[o],null)}}}}function Ee(...e){return h.useCallback(lr(...e),e)}function Dt(e,t=[]){let n=[];function r(s,i){const a=h.createContext(i),c=n.length;n=[...n,i];const u=g=>{var x;const{scope:m,children:f,...v}=g,p=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,y=h.useMemo(()=>v,Object.values(v));return l.jsx(p.Provider,{value:y,children:f})};u.displayName=s+"Provider";function d(g,m){var p;const f=((p=m==null?void 0:m[e])==null?void 0:p[c])||a,v=h.useContext(f);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${g}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>h.createContext(i));return function(a){const c=(a==null?void 0:a[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Bu(o,...t)]}function Bu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:c,scopeName:u})=>{const g=c(s)[`__scope${u}`];return{...a,...g}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var _t=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},Uu=qi[" useInsertionEffect ".trim().toString()]||_t;function cr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Wu({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const g=d.current;g!==a&&console.warn(`${r} is changing from ${g?"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.`),d.current=a},[a,r])}const u=h.useCallback(d=>{var g;if(a){const m=qu(d)?d(e):d;m!==e&&((g=i.current)==null||g.call(i,m))}else s(d)},[a,e,s,i]);return[c,u]}function Wu({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),o=h.useRef(n),s=h.useRef(t);return Uu(()=>{s.current=t},[t]),h.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function qu(e){return typeof e=="function"}function Zu(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ga(e){const[t,n]=h.useState(void 0);return _t(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.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 Ku(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var $t=e=>{const{present:t,children:n}=e,r=Xu(t),o=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),s=Ee(r.ref,Yu(o));return typeof n=="function"||r.isPresent?h.cloneElement(o,{ref:s}):null};$t.displayName="Presence";function Xu(e){const[t,n]=h.useState(),r=h.useRef(null),o=h.useRef(e),s=h.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Ku(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=Pn(r.current);s.current=a==="mounted"?u:"none"},[a]),_t(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,f=Pn(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),_t(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,g=f=>{const p=Pn(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&p&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=f=>{f.target===t&&(s.current=Pn(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:h.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Pn(e){return(e==null?void 0:e.animationName)||"none"}function Yu(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wo=Tc();const Ju=Ac(Wo);function vn(e){const t=Qu(e),n=h.forwardRef((r,o)=>{const{children:s,...i}=r,a=h.Children.toArray(s),c=a.find(td);if(c){const u=c.props.children,d=a.map(g=>g===c?h.Children.count(u)>1?h.Children.only(null):h.isValidElement(u)?u.props.children:null:g);return l.jsx(t,{...i,ref:o,children:h.isValidElement(u)?h.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var pa=vn("Slot");function Qu(e){const t=h.forwardRef((n,r)=>{const{children:o,...s}=n;if(h.isValidElement(o)){const i=rd(o),a=nd(s,o.props);return o.type!==h.Fragment&&(a.ref=r?lr(r,i):i),h.cloneElement(o,a)}return h.Children.count(o)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ed=Symbol("radix.slottable");function td(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ed}function nd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function rd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var od=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fe=od.reduce((e,t)=>{const n=vn(`Primitive.${t}`),r=h.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ha(e,t){e&&Wo.flushSync(()=>e.dispatchEvent(t))}var ur="Checkbox",[sd]=Dt(ur),[id,qo]=sd(ur);function ad(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:s,form:i,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:g}=e,[m,f]=cr({prop:n,defaultProp:o??!1,onChange:c,caller:ur}),[v,p]=h.useState(null),[y,x]=h.useState(null),b=h.useRef(!1),w=v?!!i||!!v.closest("form"):!0,_={checked:m,disabled:s,setChecked:f,control:v,setControl:p,name:a,form:i,value:d,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:wt(o)?!1:o,isFormControl:w,bubbleInput:y,setBubbleInput:x};return l.jsx(id,{scope:t,..._,children:ld(g)?g(_):r})}var va="CheckboxTrigger",xa=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:s,value:i,disabled:a,checked:c,required:u,setControl:d,setChecked:g,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:v}=qo(va,e),p=Ee(o,d),y=h.useRef(c);return h.useEffect(()=>{const x=s==null?void 0:s.form;if(x){const b=()=>g(y.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[s,g]),l.jsx(fe.button,{type:"button",role:"checkbox","aria-checked":wt(c)?"mixed":c,"aria-required":u,"data-state":Ca(c),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:p,onKeyDown:J(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:J(n,x=>{g(b=>wt(b)?!0:!b),v&&f&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});xa.displayName=va;var ya=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:c,onCheckedChange:u,form:d,...g}=e;return l.jsx(ad,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:a,required:i,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(xa,{...g,ref:t,__scopeCheckbox:n}),m&&l.jsx(_a,{__scopeCheckbox:n})]})})});ya.displayName=ur;var wa="CheckboxIndicator",ba=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=qo(wa,n);return l.jsx($t,{present:r||wt(s.checked)||s.checked===!0,children:l.jsx(fe.span,{"data-state":Ca(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ba.displayName=wa;var Sa="CheckboxBubbleInput",_a=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:i,required:a,disabled:c,name:u,value:d,form:g,bubbleInput:m,setBubbleInput:f}=qo(Sa,e),v=Ee(n,f),p=Zu(s),y=ga(r);h.useEffect(()=>{const b=m;if(!b)return;const w=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(w,"checked").set,N=!o.current;if(p!==s&&C){const E=new Event("click",{bubbles:N});b.indeterminate=wt(s),C.call(b,wt(s)?!1:s),b.dispatchEvent(E)}},[m,p,s,o]);const x=h.useRef(wt(s)?!1:s);return l.jsx(fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:a,disabled:c,name:u,value:d,form:g,...t,tabIndex:-1,ref:v,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_a.displayName=Sa;function ld(e){return typeof e=="function"}function wt(e){return e==="indeterminate"}function Ca(e){return wt(e)?"indeterminate":e?"checked":"unchecked"}/**
9
+ */var Cs;function Ic(){if(Cs)return Er;Cs=1;var e=Nc();function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(g,m){var f=m(),v=r({inst:{value:f,getSnapshot:m}}),p=v[0].inst,y=v[1];return s(function(){p.value=f,p.getSnapshot=m,c(p)&&y({inst:p})},[g,f,m]),o(function(){return c(p)&&y({inst:p}),g(function(){c(p)&&y({inst:p})})},[g]),i(f),f}function c(g){var m=g.getSnapshot;g=g.value;try{var f=m();return!n(g,f)}catch{return!0}}function u(g,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return Er.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Er}var Rs;function Pc(){return Rs||(Rs=1,Rr.exports=Ic()),Rr.exports}var Oc=Pc();const Zi=0,Ki=1,Xi=2,Es=3;var ks=Object.prototype.hasOwnProperty;function ro(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--&&ro(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(ks.call(e,n)&&++r&&!ks.call(t,n)||!(n in t)||!ro(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const rt=new WeakMap,xt=()=>{},Re=xt(),oo=Object,ie=e=>e===Re,Ge=e=>typeof e=="function",St=(e,t)=>({...e,...t}),Yi=e=>Ge(e.then),kr={},An={},Go="undefined",Rn=typeof window!=Go,so=typeof document!=Go,Fc=Rn&&"Deno"in window,Dc=()=>Rn&&typeof window.requestAnimationFrame!=Go,Ji=(e,t)=>{const n=rt.get(e);return[()=>!ie(t)&&e.get(t)||kr,r=>{if(!ie(t)){const o=e.get(t);t in An||(An[t]=o),n[5](t,St(o,r),o||kr)}},n[6],()=>!ie(t)&&t in An?An[t]:!ie(t)&&e.get(t)||kr]};let io=!0;const $c=()=>io,[ao,lo]=Rn&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[xt,xt],Lc=()=>{const e=so&&document.visibilityState;return ie(e)||e!=="hidden"},Vc=e=>(so&&document.addEventListener("visibilitychange",e),ao("focus",e),()=>{so&&document.removeEventListener("visibilitychange",e),lo("focus",e)}),zc=e=>{const t=()=>{io=!0,e()},n=()=>{io=!1};return ao("online",t),ao("offline",n),()=>{lo("online",t),lo("offline",n)}},Hc={isOnline:$c,isVisible:Lc},Gc={initFocus:Vc,initReconnect:zc},Ms=!He.useId,hn=!Rn||Fc,Bc=e=>Dc()?window.requestAnimationFrame(e):setTimeout(e,1),Mr=hn?h.useEffect:h.useLayoutEffect,Nr=typeof navigator<"u"&&navigator.connection,Ns=!hn&&Nr&&(["slow-2g","2g"].includes(Nr.effectiveType)||Nr.saveData),Tn=new WeakMap,Uc=e=>oo.prototype.toString.call(e),Ar=(e,t)=>e===`[object ${t}]`;let Wc=0;const co=e=>{const t=typeof e,n=Uc(e),r=Ar(n,"Date"),o=Ar(n,"RegExp"),s=Ar(n,"Object");let i,a;if(oo(e)===e&&!r&&!o){if(i=Tn.get(e),i)return i;if(i=++Wc+"~",Tn.set(e,i),Array.isArray(e)){for(i="@",a=0;a<e.length;a++)i+=co(e[a])+",";Tn.set(e,i)}if(s){i="#";const c=oo.keys(e).sort();for(;!ie(a=c.pop());)ie(e[a])||(i+=a+":"+co(e[a])+",");Tn.set(e,i)}}else i=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return i},Bo=e=>{if(Ge(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?co(e):"",[e,t]};let qc=0;const uo=()=>++qc;async function Qi(...e){const[t,n,r,o]=e,s=St({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let i=s.populateCache;const a=s.rollbackOnError;let c=s.optimisticData;const u=m=>typeof a=="function"?a(m):a!==!1,d=s.throwOnError;if(Ge(n)){const m=n,f=[],v=t.keys();for(const p of v)!/^\$(inf|sub)\$/.test(p)&&m(t.get(p)._k)&&f.push(p);return Promise.all(f.map(g))}return g(n);async function g(m){const[f]=Bo(m);if(!f)return;const[v,p]=Ji(t,f),[y,x,b,w]=rt.get(t),_=()=>{const A=y[f];return(Ge(s.revalidate)?s.revalidate(v().data,m):s.revalidate!==!1)&&(delete b[f],delete w[f],A&&A[0])?A[0](Xi).then(()=>v().data):v().data};if(e.length<3)return _();let C=r,N,E=!1;const S=uo();x[f]=[S,0];const j=!ie(c),L=v(),K=L.data,B=L._c,Z=ie(B)?K:B;if(j&&(c=Ge(c)?c(Z,K):c,p({data:c,_c:Z})),Ge(C))try{C=C(Z)}catch(A){N=A,E=!0}if(C&&Yi(C))if(C=await C.catch(A=>{N=A,E=!0}),S!==x[f][0]){if(E)throw N;return C}else E&&j&&u(N)&&(i=!0,p({data:Z,_c:Re}));if(i&&!E)if(Ge(i)){const A=i(C,Z);p({data:A,error:Re,_c:Re})}else p({data:C,error:Re,_c:Re});if(x[f][1]=uo(),Promise.resolve(_()).then(()=>{p({_c:Re})}),E){if(d)throw N;return}return C}}const As=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Zc=(e,t)=>{if(!rt.has(e)){const n=St(Gc,t),r=Object.create(null),o=Qi.bind(Re,e);let s=xt;const i=Object.create(null),a=(d,g)=>{const m=i[d]||[];return i[d]=m,m.push(g),()=>m.splice(m.indexOf(g),1)},c=(d,g,m)=>{e.set(d,g);const f=i[d];if(f)for(const v of f)v(g,m)},u=()=>{if(!rt.has(e)&&(rt.set(e,[r,Object.create(null),Object.create(null),Object.create(null),o,c,a]),!hn)){const d=n.initFocus(setTimeout.bind(Re,As.bind(Re,r,Zi))),g=n.initReconnect(setTimeout.bind(Re,As.bind(Re,r,Ki)));s=()=>{d&&d(),g&&g(),rt.delete(e)}}};return u(),[e,o,u,s]}return[e,rt.get(e)[4]]},Kc=(e,t,n,r,o)=>{const s=n.errorRetryCount,i=o.retryCount,a=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!ie(s)&&i>s||setTimeout(r,a,o)},Xc=ro,[ea,Un]=Zc(new Map),Yc=St({onLoadingSlow:xt,onSuccess:xt,onError:xt,onErrorRetry:Kc,onDiscarded:xt,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ns?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ns?5e3:3e3,compare:Xc,isPaused:()=>!1,cache:ea,mutate:Un,fallback:{}},Hc),Jc=(e,t)=>{const n=St(e,t);if(t){const{use:r,fallback:o}=e,{use:s,fallback:i}=t;r&&s&&(n.use=r.concat(s)),o&&i&&(n.fallback=St(o,i))}return n},Qc=h.createContext({}),eu="$inf$",ta=Rn&&window.__SWR_DEVTOOLS_USE__,tu=ta?window.__SWR_DEVTOOLS_USE__:[],nu=()=>{ta&&(window.__SWR_DEVTOOLS_REACT__=He)},ru=e=>Ge(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],ou=()=>{const e=h.useContext(Qc);return h.useMemo(()=>St(Yc,e),[e])},su=e=>(t,n,r)=>e(t,n&&((...s)=>{const[i]=Bo(t),[,,,a]=rt.get(ea);if(i.startsWith(eu))return n(...s);const c=a[i];return ie(c)?n(...s):(delete a[i],c)}),r),iu=tu.concat(su),au=e=>function(...n){const r=ou(),[o,s,i]=ru(n),a=Jc(r,i);let c=e;const{use:u}=a,d=(u||[]).concat(iu);for(let g=d.length;g--;)c=d[g](c);return c(o,s||a.fetcher||null,a)},lu=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}};nu();const Tr=He.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}}),jr={dedupe:!0},Ts=Promise.resolve(Re),cu=(e,t,n)=>{const{cache:r,compare:o,suspense:s,fallbackData:i,revalidateOnMount:a,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:d,refreshWhenOffline:g,keepPreviousData:m}=n,[f,v,p,y]=rt.get(r),[x,b]=Bo(e),w=h.useRef(!1),_=h.useRef(!1),C=h.useRef(x),N=h.useRef(t),E=h.useRef(n),S=()=>E.current,j=()=>S().isVisible()&&S().isOnline(),[L,K,B,Z]=Ji(r,x),A=h.useRef({}).current,te=ie(i)?ie(n.fallback)?Re:n.fallback[x]:i,I=(re,ue)=>{for(const he in A){const le=he;if(le==="data"){if(!o(re[le],ue[le])&&(!ie(re[le])||!o(be,ue[le])))return!1}else if(ue[le]!==re[le])return!1}return!0},Q=h.useMemo(()=>{const re=!x||!t?!1:ie(a)?S().isPaused()||s?!1:c!==!1:a,ue=ke=>{const Qe=St(ke);return delete Qe._k,re?{isValidating:!0,isLoading:!0,...Qe}:Qe},he=L(),le=Z(),Ae=ue(he),gt=he===le?Ae:ue(le);let ge=Ae;return[()=>{const ke=ue(L());return I(ke,ge)?(ge.data=ke.data,ge.isLoading=ke.isLoading,ge.isValidating=ke.isValidating,ge.error=ke.error,ge):(ge=ke,ke)},()=>gt]},[r,x]),R=Oc.useSyncExternalStore(h.useCallback(re=>B(x,(ue,he)=>{I(he,ue)||re()}),[r,x]),Q[0],Q[1]),k=!w.current,z=f[x]&&f[x].length>0,V=R.data,ee=ie(V)?te&&Yi(te)?Tr(te):te:V,se=R.error,ce=h.useRef(ee),be=m?ie(V)?ie(ce.current)?ee:ce.current:V:ee,Se=z&&!ie(se)?!1:k&&!ie(a)?a:S().isPaused()?!1:s?ie(ee)?!1:c:ie(ee)||c,ne=!!(x&&t&&k&&Se),ze=ie(R.isValidating)?ne:R.isValidating,xe=ie(R.isLoading)?ne:R.isLoading,_e=h.useCallback(async re=>{const ue=N.current;if(!x||!ue||_.current||S().isPaused())return!1;let he,le,Ae=!0;const gt=re||{},ge=!p[x]||!gt.dedupe,ke=()=>Ms?!_.current&&x===C.current&&w.current:x===C.current,Qe={isValidating:!1,isLoading:!1},bs=()=>{K(Qe)},Ss=()=>{const Pe=p[x];Pe&&Pe[1]===le&&delete p[x]},_s={isValidating:!0};ie(L().data)&&(_s.isLoading=!0);try{if(ge&&(K(_s),n.loadingTimeout&&ie(L().data)&&setTimeout(()=>{Ae&&ke()&&S().onLoadingSlow(x,n)},n.loadingTimeout),p[x]=[ue(b),uo()]),[he,le]=p[x],he=await he,ge&&setTimeout(Ss,n.dedupingInterval),!p[x]||p[x][1]!==le)return ge&&ke()&&S().onDiscarded(x),!1;Qe.error=Re;const Pe=v[x];if(!ie(Pe)&&(le<=Pe[0]||le<=Pe[1]||Pe[1]===0))return bs(),ge&&ke()&&S().onDiscarded(x),!1;const et=L().data;Qe.data=o(et,he)?et:he,ge&&ke()&&S().onSuccess(he,x,n)}catch(Pe){Ss();const et=S(),{shouldRetryOnError:_r}=et;et.isPaused()||(Qe.error=Pe,ge&&ke()&&(et.onError(Pe,x,et),(_r===!0||Ge(_r)&&_r(Pe))&&(!S().revalidateOnFocus||!S().revalidateOnReconnect||j())&&et.onErrorRetry(Pe,x,et,Mc=>{const Cr=f[x];Cr&&Cr[0]&&Cr[0](Es,Mc)},{retryCount:(gt.retryCount||0)+1,dedupe:!0})))}return Ae=!1,bs(),!0},[x,r]),Je=h.useCallback((...re)=>Qi(r,C.current,...re),[]);if(Mr(()=>{N.current=t,E.current=n,ie(V)||(ce.current=V)}),Mr(()=>{if(!x)return;const re=_e.bind(Re,jr);let ue=0;S().revalidateOnFocus&&(ue=Date.now()+S().focusThrottleInterval);const le=lu(x,f,(Ae,gt={})=>{if(Ae==Zi){const ge=Date.now();S().revalidateOnFocus&&ge>ue&&j()&&(ue=ge+S().focusThrottleInterval,re())}else if(Ae==Ki)S().revalidateOnReconnect&&j()&&re();else{if(Ae==Xi)return _e();if(Ae==Es)return _e(gt)}});return _.current=!1,C.current=x,w.current=!0,K({_k:b}),Se&&(p[x]||(ie(ee)||hn?re():Bc(re))),()=>{_.current=!0,le()}},[x]),Mr(()=>{let re;function ue(){const le=Ge(u)?u(L().data):u;le&&re!==-1&&(re=setTimeout(he,le))}function he(){!L().error&&(d||S().isVisible())&&(g||S().isOnline())?_e(jr).then(ue):ue()}return ue(),()=>{re&&(clearTimeout(re),re=-1)}},[u,d,g,x]),h.useDebugValue(be),s){const re=x&&ie(ee);if(!Ms&&hn&&re)throw new Error("Fallback data is required when using Suspense in SSR.");re&&(N.current=t,E.current=n,_.current=!1);const ue=y[x],he=!ie(ue)&&re?Je(ue):Ts;if(Tr(he),!ie(se)&&re)throw se;const le=re?_e(jr):Ts;!ie(be)&&re&&(le.status="fulfilled",le.value=!0),Tr(le)}return{mutate:Je,get data(){return A.data=!0,be},get error(){return A.error=!0,se},get isValidating(){return A.isValidating=!0,ze},get isLoading(){return A.isLoading=!0,xe}}},mn=au(cu);function na(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=na(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function ra(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=na(e))&&(r&&(r+=" "),r+=t);return r}const Uo="-",uu=e=>{const t=fu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Uo);return a[0]===""&&a.length!==1&&a.shift(),oa(a,t)||du(i)},getConflictingClassGroupIds:(i,a)=>{const c=n[i]||[];return a&&r[i]?[...c,...r[i]]:c}}},oa=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?oa(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Uo);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},js=/^\[(.+)\]$/,du=e=>{if(js.test(e)){const t=js.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},fu=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)fo(n[o],r,o,t);return r},fo=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Is(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(mu(o)){fo(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{fo(i,Is(t,s),n,r)})})},Is=(e,t)=>{let n=e;return t.split(Uo).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},mu=e=>e.isThemeGetter,gu=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},mo="!",go=":",pu=go.length,hu=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,c=0,u;for(let v=0;v<o.length;v++){let p=o[v];if(i===0&&a===0){if(p===go){s.push(o.slice(c,v)),c=v+pu;continue}if(p==="/"){u=v;continue}}p==="["?i++:p==="]"?i--:p==="("?a++:p===")"&&a--}const d=s.length===0?o:o.substring(c),g=vu(d),m=g!==d,f=u&&u>c?u-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:f}};if(t){const o=t+go,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},vu=e=>e.endsWith(mo)?e.substring(0,e.length-1):e.startsWith(mo)?e.substring(1):e,xu=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},yu=e=>({cache:gu(e.cacheSize),parseClassName:hu(e),sortModifiers:xu(e),...uu(e)}),wu=/\s+/,bu=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(wu);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:g,modifiers:m,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:p}=n(d);if(g){c=d+(c.length>0?" "+c:c);continue}let y=!!p,x=r(y?v.substring(0,p):v);if(!x){if(!y){c=d+(c.length>0?" "+c:c);continue}if(x=r(v),!x){c=d+(c.length>0?" "+c:c);continue}y=!1}const b=s(m).join(":"),w=f?b+mo:b,_=w+x;if(i.includes(_))continue;i.push(_);const C=o(x,y);for(let N=0;N<C.length;++N){const E=C[N];i.push(w+E)}c=d+(c.length>0?" "+c:c)}return c};function Su(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=sa(t))&&(r&&(r+=" "),r+=n);return r}const sa=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=sa(e[r]))&&(n&&(n+=" "),n+=t);return n};function _u(e,...t){let n,r,o,s=i;function i(c){const u=t.reduce((d,g)=>g(d),e());return n=yu(u),r=n.cache.get,o=n.cache.set,s=a,a(c)}function a(c){const u=r(c);if(u)return u;const d=bu(c,n);return o(c,d),d}return function(){return s(Su.apply(null,arguments))}}const ye=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},ia=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,aa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Cu=/^\d+\/\d+$/,Ru=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Eu=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ku=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Mu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Nu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zt=e=>Cu.test(e),Y=e=>!!e&&!Number.isNaN(Number(e)),pt=e=>!!e&&Number.isInteger(Number(e)),Ir=e=>e.endsWith("%")&&Y(e.slice(0,-1)),tt=e=>Ru.test(e),Au=()=>!0,Tu=e=>Eu.test(e)&&!ku.test(e),la=()=>!1,ju=e=>Mu.test(e),Iu=e=>Nu.test(e),Pu=e=>!P(e)&&!O(e),Ou=e=>rn(e,da,la),P=e=>ia.test(e),At=e=>rn(e,fa,Tu),Pr=e=>rn(e,Vu,Y),Ps=e=>rn(e,ca,la),Fu=e=>rn(e,ua,Iu),jn=e=>rn(e,ma,ju),O=e=>aa.test(e),cn=e=>on(e,fa),Du=e=>on(e,zu),Os=e=>on(e,ca),$u=e=>on(e,da),Lu=e=>on(e,ua),In=e=>on(e,ma,!0),rn=(e,t,n)=>{const r=ia.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},on=(e,t,n=!1)=>{const r=aa.exec(e);return r?r[1]?t(r[1]):n:!1},ca=e=>e==="position"||e==="percentage",ua=e=>e==="image"||e==="url",da=e=>e==="length"||e==="size"||e==="bg-size",fa=e=>e==="length",Vu=e=>e==="number",zu=e=>e==="family-name",ma=e=>e==="shadow",Hu=()=>{const e=ye("color"),t=ye("font"),n=ye("text"),r=ye("font-weight"),o=ye("tracking"),s=ye("leading"),i=ye("breakpoint"),a=ye("container"),c=ye("spacing"),u=ye("radius"),d=ye("shadow"),g=ye("inset-shadow"),m=ye("text-shadow"),f=ye("drop-shadow"),v=ye("blur"),p=ye("perspective"),y=ye("aspect"),x=ye("ease"),b=ye("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[..._(),O,P],N=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],S=()=>[O,P,c],j=()=>[zt,"full","auto",...S()],L=()=>[pt,"none","subgrid",O,P],K=()=>["auto",{span:["full",pt,O,P]},pt,O,P],B=()=>[pt,"auto",O,P],Z=()=>["auto","min","max","fr",O,P],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],te=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...S()],Q=()=>[zt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],R=()=>[e,O,P],k=()=>[..._(),Os,Ps,{position:[O,P]}],z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",$u,Ou,{size:[O,P]}],ee=()=>[Ir,cn,At],se=()=>["","none","full",u,O,P],ce=()=>["",Y,cn,At],be=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[Y,Ir,Os,Ps],ze=()=>["","none",v,O,P],xe=()=>["none",Y,O,P],_e=()=>["none",Y,O,P],Je=()=>[Y,O,P],mt=()=>[zt,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tt],breakpoint:[tt],color:[Au],container:[tt],"drop-shadow":[tt],ease:["in","out","in-out"],font:[Pu],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tt],shadow:[tt],spacing:["px",Y],text:[tt],"text-shadow":[tt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",zt,P,O,y]}],container:["container"],columns:[{columns:[Y,P,O,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:j()}],"inset-x":[{"inset-x":j()}],"inset-y":[{"inset-y":j()}],start:[{start:j()}],end:[{end:j()}],top:[{top:j()}],right:[{right:j()}],bottom:[{bottom:j()}],left:[{left:j()}],visibility:["visible","invisible","collapse"],z:[{z:[pt,"auto",O,P]}],basis:[{basis:[zt,"full","auto",a,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Y,zt,"auto","initial","none",P]}],grow:[{grow:["",Y,O,P]}],shrink:[{shrink:["",Y,O,P]}],order:[{order:[pt,"first","last","none",O,P]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:K()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:K()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Z()}],"auto-rows":[{"auto-rows":Z()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...te(),"normal"]}],"justify-self":[{"justify-self":["auto",...te()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...te(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...te(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...te(),"baseline"]}],"place-self":[{"place-self":["auto",...te()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[a,"screen",...Q()]}],"min-w":[{"min-w":[a,"screen","none",...Q()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,cn,At]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,O,Pr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ir,P]}],"font-family":[{font:[Du,P,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,O,P]}],"line-clamp":[{"line-clamp":[Y,"none",O,Pr]}],leading:[{leading:[s,...S()]}],"list-image":[{"list-image":["none",O,P]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",O,P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Y,"from-font","auto",O,At]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[Y,"auto",O,P]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",O,P]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",O,P]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:k()}],"bg-repeat":[{bg:z()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pt,O,P],radial:["",O,P],conic:[pt,O,P]},Lu,Fu]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Y,O,P]}],"outline-w":[{outline:["",Y,cn,At]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",d,In,jn]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",g,In,jn]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[Y,At]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",m,In,jn]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[Y,O,P]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Y]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[O,P]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Y]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:k()}],"mask-repeat":[{mask:z()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",O,P]}],filter:[{filter:["","none",O,P]}],blur:[{blur:ze()}],brightness:[{brightness:[Y,O,P]}],contrast:[{contrast:[Y,O,P]}],"drop-shadow":[{"drop-shadow":["","none",f,In,jn]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",Y,O,P]}],"hue-rotate":[{"hue-rotate":[Y,O,P]}],invert:[{invert:["",Y,O,P]}],saturate:[{saturate:[Y,O,P]}],sepia:[{sepia:["",Y,O,P]}],"backdrop-filter":[{"backdrop-filter":["","none",O,P]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[Y,O,P]}],"backdrop-contrast":[{"backdrop-contrast":[Y,O,P]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Y,O,P]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Y,O,P]}],"backdrop-invert":[{"backdrop-invert":["",Y,O,P]}],"backdrop-opacity":[{"backdrop-opacity":[Y,O,P]}],"backdrop-saturate":[{"backdrop-saturate":[Y,O,P]}],"backdrop-sepia":[{"backdrop-sepia":["",Y,O,P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",O,P]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Y,"initial",O,P]}],ease:[{ease:["linear","initial",x,O,P]}],delay:[{delay:[Y,O,P]}],animate:[{animate:["none",b,O,P]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,O,P]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":["scale-3d"],skew:[{skew:Je()}],"skew-x":[{"skew-x":Je()}],"skew-y":[{"skew-y":Je()}],transform:[{transform:[O,P,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:mt()}],"translate-x":[{"translate-x":mt()}],"translate-y":[{"translate-y":mt()}],"translate-z":[{"translate-z":mt()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",O,P]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",O,P]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[Y,cn,At,Pr]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Gu=_u(Hu);function de(...e){return Gu(ra(e))}function st({className:e,...t}){return l.jsx("div",{"data-slot":"card",className:de("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function it({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:de("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function at({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:de("leading-none font-semibold",e),...t})}function Ft({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:de("text-muted-foreground text-sm",e),...t})}function lt({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:de("px-6",e),...t})}function Fs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function lr(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Fs(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Fs(e[o],null)}}}}function Ee(...e){return h.useCallback(lr(...e),e)}function Dt(e,t=[]){let n=[];function r(s,i){const a=h.createContext(i),c=n.length;n=[...n,i];const u=g=>{var x;const{scope:m,children:f,...v}=g,p=((x=m==null?void 0:m[e])==null?void 0:x[c])||a,y=h.useMemo(()=>v,Object.values(v));return l.jsx(p.Provider,{value:y,children:f})};u.displayName=s+"Provider";function d(g,m){var p;const f=((p=m==null?void 0:m[e])==null?void 0:p[c])||a,v=h.useContext(f);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${g}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>h.createContext(i));return function(a){const c=(a==null?void 0:a[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Bu(o,...t)]}function Bu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:c,scopeName:u})=>{const g=c(s)[`__scope${u}`];return{...a,...g}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var _t=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},Uu=qi[" useInsertionEffect ".trim().toString()]||_t;function cr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Wu({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=h.useRef(e!==void 0);h.useEffect(()=>{const g=d.current;g!==a&&console.warn(`${r} is changing from ${g?"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.`),d.current=a},[a,r])}const u=h.useCallback(d=>{var g;if(a){const m=qu(d)?d(e):d;m!==e&&((g=i.current)==null||g.call(i,m))}else s(d)},[a,e,s,i]);return[c,u]}function Wu({defaultProp:e,onChange:t}){const[n,r]=h.useState(e),o=h.useRef(n),s=h.useRef(t);return Uu(()=>{s.current=t},[t]),h.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function qu(e){return typeof e=="function"}function Zu(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ga(e){const[t,n]=h.useState(void 0);return _t(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.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 Ku(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var $t=e=>{const{present:t,children:n}=e,r=Xu(t),o=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),s=Ee(r.ref,Yu(o));return typeof n=="function"||r.isPresent?h.cloneElement(o,{ref:s}):null};$t.displayName="Presence";function Xu(e){const[t,n]=h.useState(),r=h.useRef(null),o=h.useRef(e),s=h.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Ku(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=Pn(r.current);s.current=a==="mounted"?u:"none"},[a]),_t(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,f=Pn(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),_t(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,g=f=>{const p=Pn(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&p&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=f=>{f.target===t&&(s.current=Pn(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:h.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Pn(e){return(e==null?void 0:e.animationName)||"none"}function Yu(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wo=Tc();const Ju=Ac(Wo);function vn(e){const t=Qu(e),n=h.forwardRef((r,o)=>{const{children:s,...i}=r,a=h.Children.toArray(s),c=a.find(td);if(c){const u=c.props.children,d=a.map(g=>g===c?h.Children.count(u)>1?h.Children.only(null):h.isValidElement(u)?u.props.children:null:g);return l.jsx(t,{...i,ref:o,children:h.isValidElement(u)?h.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var pa=vn("Slot");function Qu(e){const t=h.forwardRef((n,r)=>{const{children:o,...s}=n;if(h.isValidElement(o)){const i=rd(o),a=nd(s,o.props);return o.type!==h.Fragment&&(a.ref=r?lr(r,i):i),h.cloneElement(o,a)}return h.Children.count(o)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ed=Symbol("radix.slottable");function td(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ed}function nd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function rd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var od=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fe=od.reduce((e,t)=>{const n=vn(`Primitive.${t}`),r=h.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ha(e,t){e&&Wo.flushSync(()=>e.dispatchEvent(t))}var ur="Checkbox",[sd]=Dt(ur),[id,qo]=sd(ur);function ad(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:s,form:i,name:a,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:g}=e,[m,f]=cr({prop:n,defaultProp:o??!1,onChange:c,caller:ur}),[v,p]=h.useState(null),[y,x]=h.useState(null),b=h.useRef(!1),w=v?!!i||!!v.closest("form"):!0,_={checked:m,disabled:s,setChecked:f,control:v,setControl:p,name:a,form:i,value:d,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:wt(o)?!1:o,isFormControl:w,bubbleInput:y,setBubbleInput:x};return l.jsx(id,{scope:t,..._,children:ld(g)?g(_):r})}var va="CheckboxTrigger",xa=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:s,value:i,disabled:a,checked:c,required:u,setControl:d,setChecked:g,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:v}=qo(va,e),p=Ee(o,d),y=h.useRef(c);return h.useEffect(()=>{const x=s==null?void 0:s.form;if(x){const b=()=>g(y.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[s,g]),l.jsx(fe.button,{type:"button",role:"checkbox","aria-checked":wt(c)?"mixed":c,"aria-required":u,"data-state":Ca(c),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:p,onKeyDown:J(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:J(n,x=>{g(b=>wt(b)?!0:!b),v&&f&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})});xa.displayName=va;var ya=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:c,onCheckedChange:u,form:d,...g}=e;return l.jsx(ad,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:a,required:i,onCheckedChange:u,name:r,form:d,value:c,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(xa,{...g,ref:t,__scopeCheckbox:n}),m&&l.jsx(_a,{__scopeCheckbox:n})]})})});ya.displayName=ur;var wa="CheckboxIndicator",ba=h.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=qo(wa,n);return l.jsx($t,{present:r||wt(s.checked)||s.checked===!0,children:l.jsx(fe.span,{"data-state":Ca(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});ba.displayName=wa;var Sa="CheckboxBubbleInput",_a=h.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:i,required:a,disabled:c,name:u,value:d,form:g,bubbleInput:m,setBubbleInput:f}=qo(Sa,e),v=Ee(n,f),p=Zu(s),y=ga(r);h.useEffect(()=>{const b=m;if(!b)return;const w=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(w,"checked").set,N=!o.current;if(p!==s&&C){const E=new Event("click",{bubbles:N});b.indeterminate=wt(s),C.call(b,wt(s)?!1:s),b.dispatchEvent(E)}},[m,p,s,o]);const x=h.useRef(wt(s)?!1:s);return l.jsx(fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:a,disabled:c,name:u,value:d,form:g,...t,tabIndex:-1,ref:v,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});_a.displayName=Sa;function ld(e){return typeof e=="function"}function wt(e){return e==="indeterminate"}function Ca(e){return wt(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.
@@ -102,7 +102,7 @@ import{r as Nc,a as h,R as He,j as l,b as qi,g as Ac,c as Tc,d as jc}from"./inde
102
102
  * LICENSE.md file in the root directory of this source tree.
103
103
  *
104
104
  * @license MIT
105
- */function Bs(e,t){return e?Lf(e)?h.createElement(e,t):e:null}function Lf(e){return Vf(e)||typeof e=="function"||zf(e)}function Vf(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function zf(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Hf(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=h.useState(()=>({current:Af(t)})),[r,o]=h.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...e,state:{...r,...e.state},onStateChange:i=>{o(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}const Gf=Ko("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",xl:"h-12 rounded-md px-8 text-base",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),jt=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?pa:"button";return l.jsx(i,{className:de(Gf({variant:t,size:n,className:e})),ref:s,...o})});jt.displayName="Button";function Ha(e){const t=e+"CollectionProvider",[n,r]=Dt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:y,children:x}=p,b=He.useRef(null),w=He.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:w,collectionRef:b,children:x})};i.displayName=t;const a=e+"CollectionSlot",c=vn(a),u=He.forwardRef((p,y)=>{const{scope:x,children:b}=p,w=s(a,x),_=Ee(y,w.collectionRef);return l.jsx(c,{ref:_,children:b})});u.displayName=a;const d=e+"CollectionItemSlot",g="data-radix-collection-item",m=vn(d),f=He.forwardRef((p,y)=>{const{scope:x,children:b,...w}=p,_=He.useRef(null),C=Ee(y,_),N=s(d,x);return He.useEffect(()=>(N.itemMap.set(_,{ref:_,...w}),()=>void N.itemMap.delete(_))),l.jsx(m,{[g]:"",ref:C,children:b})});f.displayName=d;function v(p){const y=s(e+"CollectionConsumer",p);return He.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${g}]`));return Array.from(y.itemMap.values()).sort((N,E)=>w.indexOf(N.ref.current)-w.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:u,ItemSlot:f},v,r]}var Bf=h.createContext(void 0);function es(e){const t=h.useContext(Bf);return e||t||"ltr"}function ct(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Uf(e,t=globalThis==null?void 0:globalThis.document){const n=ct(e);h.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Wf="DismissableLayer",bo="dismissableLayer.update",qf="dismissableLayer.pointerDownOutside",Zf="dismissableLayer.focusOutside",Us,Ga=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ba=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=h.useContext(Ga),[d,g]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=h.useState({}),v=Ee(t,E=>g(E)),p=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=p.indexOf(y),b=d?p.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,_=b>=x,C=Yf(E=>{const S=E.target,j=[...u.branches].some(L=>L.contains(S));!_||j||(o==null||o(E),i==null||i(E),E.defaultPrevented||a==null||a())},m),N=Jf(E=>{const S=E.target;[...u.branches].some(L=>L.contains(S))||(s==null||s(E),i==null||i(E),E.defaultPrevented||a==null||a())},m);return Uf(E=>{b===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},m),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Us=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ws(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Us)}},[d,m,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ws())},[d,u]),h.useEffect(()=>{const E=()=>f({});return document.addEventListener(bo,E),()=>document.removeEventListener(bo,E)},[]),l.jsx(fe.div,{...c,ref:v,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:J(e.onFocusCapture,N.onFocusCapture),onBlurCapture:J(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,C.onPointerDownCapture)})});Ba.displayName=Wf;var Kf="DismissableLayerBranch",Xf=h.forwardRef((e,t)=>{const n=h.useContext(Ga),r=h.useRef(null),o=Ee(t,r);return h.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(fe.div,{...e,ref:o})});Xf.displayName=Kf;function Yf(e,t=globalThis==null?void 0:globalThis.document){const n=ct(e),r=h.useRef(!1),o=h.useRef(()=>{});return h.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Ua(qf,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Jf(e,t=globalThis==null?void 0:globalThis.document){const n=ct(e),r=h.useRef(!1);return h.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ua(Zf,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ws(){const e=new CustomEvent(bo);document.dispatchEvent(e)}function Ua(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ha(o,s):o.dispatchEvent(s)}var Hr=0;function Qf(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??qs()),document.body.insertAdjacentElement("beforeend",e[1]??qs()),Hr++,()=>{Hr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hr--}},[])}function qs(){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 Gr="focusScope.autoFocusOnMount",Br="focusScope.autoFocusOnUnmount",Zs={bubbles:!1,cancelable:!0},em="FocusScope",Wa=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=h.useState(null),u=ct(o),d=ct(s),g=h.useRef(null),m=Ee(t,p=>c(p)),f=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let p=function(w){if(f.paused||!a)return;const _=w.target;a.contains(_)?g.current=_:ht(g.current,{select:!0})},y=function(w){if(f.paused||!a)return;const _=w.relatedTarget;_!==null&&(a.contains(_)||ht(g.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&ht(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const b=new MutationObserver(x);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,f.paused]),h.useEffect(()=>{if(a){Xs.add(f);const p=document.activeElement;if(!a.contains(p)){const x=new CustomEvent(Gr,Zs);a.addEventListener(Gr,u),a.dispatchEvent(x),x.defaultPrevented||(tm(im(qa(a)),{select:!0}),document.activeElement===p&&ht(a))}return()=>{a.removeEventListener(Gr,u),setTimeout(()=>{const x=new CustomEvent(Br,Zs);a.addEventListener(Br,d),a.dispatchEvent(x),x.defaultPrevented||ht(p??document.body,{select:!0}),a.removeEventListener(Br,d),Xs.remove(f)},0)}}},[a,u,d,f]);const v=h.useCallback(p=>{if(!n&&!r||f.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(y&&x){const b=p.currentTarget,[w,_]=nm(b);w&&_?!p.shiftKey&&x===_?(p.preventDefault(),n&&ht(w,{select:!0})):p.shiftKey&&x===w&&(p.preventDefault(),n&&ht(_,{select:!0})):x===b&&p.preventDefault()}},[n,r,f.paused]);return l.jsx(fe.div,{tabIndex:-1,...i,ref:m,onKeyDown:v})});Wa.displayName=em;function tm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ht(r,{select:t}),document.activeElement!==n)return}function nm(e){const t=qa(e),n=Ks(t,e),r=Ks(t.reverse(),e);return[n,r]}function qa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ks(e,t){for(const n of e)if(!rm(n,{upTo:t}))return n}function rm(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 om(e){return e instanceof HTMLInputElement&&"select"in e}function ht(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&om(e)&&t&&e.select()}}var Xs=sm();function sm(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ys(e,t),e.unshift(t)},remove(t){var n;e=Ys(e,t),(n=e[0])==null||n.resume()}}}function Ys(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function im(e){return e.filter(t=>t.tagName!=="A")}var am=qi[" useId ".trim().toString()]||(()=>{}),lm=0;function Kn(e){const[t,n]=h.useState(am());return _t(()=>{n(r=>r??String(lm++))},[e]),e||(t?`radix-${t}`:"")}const cm=["top","right","bottom","left"],Rt=Math.min,Te=Math.max,Xn=Math.round,$n=Math.floor,We=e=>({x:e,y:e}),um={left:"right",right:"left",bottom:"top",top:"bottom"},dm={start:"end",end:"start"};function So(e,t,n){return Te(e,Rt(t,n))}function ut(e,t){return typeof e=="function"?e(t):e}function dt(e){return e.split("-")[0]}function sn(e){return e.split("-")[1]}function ts(e){return e==="x"?"y":"x"}function ns(e){return e==="y"?"height":"width"}const fm=new Set(["top","bottom"]);function Ue(e){return fm.has(dt(e))?"y":"x"}function rs(e){return ts(Ue(e))}function mm(e,t,n){n===void 0&&(n=!1);const r=sn(e),o=rs(e),s=ns(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Yn(i)),[i,Yn(i)]}function gm(e){const t=Yn(e);return[_o(e),t,_o(t)]}function _o(e){return e.replace(/start|end/g,t=>dm[t])}const Js=["left","right"],Qs=["right","left"],pm=["top","bottom"],hm=["bottom","top"];function vm(e,t,n){switch(e){case"top":case"bottom":return n?t?Qs:Js:t?Js:Qs;case"left":case"right":return t?pm:hm;default:return[]}}function xm(e,t,n,r){const o=sn(e);let s=vm(dt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(_o)))),s}function Yn(e){return e.replace(/left|right|bottom|top/g,t=>um[t])}function ym(e){return{top:0,right:0,bottom:0,left:0,...e}}function Za(e){return typeof e!="number"?ym(e):{top:e,right:e,bottom:e,left:e}}function Jn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ei(e,t,n){let{reference:r,floating:o}=e;const s=Ue(t),i=rs(t),a=ns(i),c=dt(t),u=s==="y",d=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:g};break;case"left":f={x:r.x-o.width,y:g};break;default:f={x:r.x,y:r.y}}switch(sn(t)){case"start":f[i]-=m*(n&&u?-1:1);break;case"end":f[i]+=m*(n&&u?-1:1);break}return f}const wm=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:g}=ei(u,r,c),m=r,f={},v=0;for(let p=0;p<a.length;p++){const{name:y,fn:x}=a[p],{x:b,y:w,data:_,reset:C}=await x({x:d,y:g,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:u,platform:i,elements:{reference:e,floating:t}});d=b??d,g=w??g,f={...f,[y]:{...f[y],..._}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:g}=ei(u,m,c)),p=-1)}return{x:d,y:g,placement:m,strategy:o,middlewareData:f}};async function xn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:g="floating",altBoundary:m=!1,padding:f=0}=ut(t,e),v=Za(f),y=a[m?g==="floating"?"reference":"floating":g],x=Jn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),b=g==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),_=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Jn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:c}):b);return{top:(x.top-C.top+v.top)/_.y,bottom:(C.bottom-x.bottom+v.bottom)/_.y,left:(x.left-C.left+v.left)/_.x,right:(C.right-x.right+v.right)/_.x}}const bm=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=ut(e,t)||{};if(u==null)return{};const g=Za(d),m={x:n,y:r},f=rs(o),v=ns(f),p=await i.getDimensions(u),y=f==="y",x=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",_=s.reference[v]+s.reference[f]-m[f]-s.floating[v],C=m[f]-s.reference[f],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=N?N[w]:0;(!E||!await(i.isElement==null?void 0:i.isElement(N)))&&(E=a.floating[w]||s.floating[v]);const S=_/2-C/2,j=E/2-p[v]/2-1,L=Rt(g[x],j),K=Rt(g[b],j),U=L,Z=E-p[v]-K,A=E/2-p[v]/2+S,te=So(U,A,Z),I=!c.arrow&&sn(o)!=null&&A!==te&&s.reference[v]/2-(A<U?L:K)-p[v]/2<0,Q=I?A<U?A-U:A-Z:0;return{[f]:m[f]+Q,data:{[f]:te,centerOffset:A-te-Q,...I&&{alignmentOffset:Q}},reset:I}}}),Sm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:p=!0,...y}=ut(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=dt(o),b=Ue(a),w=dt(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=m||(w||!p?[Yn(a)]:gm(a)),N=v!=="none";!m&&N&&C.push(...xm(a,p,v,_));const E=[a,...C],S=await xn(t,y),j=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&j.push(S[x]),g){const A=mm(o,i,_);j.push(S[A[0]],S[A[1]])}if(L=[...L,{placement:o,overflows:j}],!j.every(A=>A<=0)){var K,U;const A=(((K=s.flip)==null?void 0:K.index)||0)+1,te=E[A];if(te&&(!(g==="alignment"?b!==Ue(te):!1)||L.every(R=>Ue(R.placement)===b?R.overflows[0]>0:!0)))return{data:{index:A,overflows:L},reset:{placement:te}};let I=(U=L.filter(Q=>Q.overflows[0]<=0).sort((Q,R)=>Q.overflows[1]-R.overflows[1])[0])==null?void 0:U.placement;if(!I)switch(f){case"bestFit":{var Z;const Q=(Z=L.filter(R=>{if(N){const k=Ue(R.placement);return k===b||k==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(k=>k>0).reduce((k,z)=>k+z,0)]).sort((R,k)=>R[1]-k[1])[0])==null?void 0:Z[0];Q&&(I=Q);break}case"initialPlacement":I=a;break}if(o!==I)return{reset:{placement:I}}}return{}}}};function ti(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ni(e){return cm.some(t=>e[t]>=0)}const _m=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ut(e,t);switch(r){case"referenceHidden":{const s=await xn(t,{...o,elementContext:"reference"}),i=ti(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ni(i)}}}case"escaped":{const s=await xn(t,{...o,altBoundary:!0}),i=ti(s,n.floating);return{data:{escapedOffsets:i,escaped:ni(i)}}}default:return{}}}}},Ka=new Set(["left","top"]);async function Cm(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=dt(n),a=sn(n),c=Ue(n)==="y",u=Ka.has(i)?-1:1,d=s&&c?-1:1,g=ut(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const Rm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await Cm(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Em=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...c}=ut(e,t),u={x:n,y:r},d=await xn(t,c),g=Ue(dt(o)),m=ts(g);let f=u[m],v=u[g];if(s){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",b=f+d[y],w=f-d[x];f=So(b,f,w)}if(i){const y=g==="y"?"top":"left",x=g==="y"?"bottom":"right",b=v+d[y],w=v-d[x];v=So(b,v,w)}const p=a.fn({...t,[m]:f,[g]:v});return{...p,data:{x:p.x-n,y:p.y-r,enabled:{[m]:s,[g]:i}}}}}},km=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=ut(e,t),d={x:n,y:r},g=Ue(o),m=ts(g);let f=d[m],v=d[g];const p=ut(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const w=m==="y"?"height":"width",_=s.reference[m]-s.floating[w]+y.mainAxis,C=s.reference[m]+s.reference[w]-y.mainAxis;f<_?f=_:f>C&&(f=C)}if(u){var x,b;const w=m==="y"?"width":"height",_=Ka.has(dt(o)),C=s.reference[g]-s.floating[w]+(_&&((x=i.offset)==null?void 0:x[g])||0)+(_?0:y.crossAxis),N=s.reference[g]+s.reference[w]+(_?0:((b=i.offset)==null?void 0:b[g])||0)-(_?y.crossAxis:0);v<C?v=C:v>N&&(v=N)}return{[m]:f,[g]:v}}}},Mm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...u}=ut(e,t),d=await xn(t,u),g=dt(o),m=sn(o),f=Ue(o)==="y",{width:v,height:p}=s.floating;let y,x;g==="top"||g==="bottom"?(y=g,x=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(x=g,y=m==="end"?"top":"bottom");const b=p-d.top-d.bottom,w=v-d.left-d.right,_=Rt(p-d[y],b),C=Rt(v-d[x],w),N=!t.middlewareData.shift;let E=_,S=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),N&&!m){const L=Te(d.left,0),K=Te(d.right,0),U=Te(d.top,0),Z=Te(d.bottom,0);f?S=v-2*(L!==0||K!==0?L+K:Te(d.left,d.right)):E=p-2*(U!==0||Z!==0?U+Z:Te(d.top,d.bottom))}await c({...t,availableWidth:S,availableHeight:E});const j=await i.getDimensions(a.floating);return v!==j.width||p!==j.height?{reset:{rects:!0}}:{}}}};function fr(){return typeof window<"u"}function an(e){return Xa(e)?(e.nodeName||"").toLowerCase():"#document"}function je(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xe(e){var t;return(t=(Xa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xa(e){return fr()?e instanceof Node||e instanceof je(e).Node:!1}function $e(e){return fr()?e instanceof Element||e instanceof je(e).Element:!1}function Ze(e){return fr()?e instanceof HTMLElement||e instanceof je(e).HTMLElement:!1}function ri(e){return!fr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof je(e).ShadowRoot}const Nm=new Set(["inline","contents"]);function En(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Le(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Nm.has(o)}const Am=new Set(["table","td","th"]);function Tm(e){return Am.has(an(e))}const jm=[":popover-open",":modal"];function mr(e){return jm.some(t=>{try{return e.matches(t)}catch{return!1}})}const Im=["transform","translate","scale","rotate","perspective"],Pm=["transform","translate","scale","rotate","perspective","filter"],Om=["paint","layout","strict","content"];function os(e){const t=ss(),n=$e(e)?Le(e):e;return Im.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)||Pm.some(r=>(n.willChange||"").includes(r))||Om.some(r=>(n.contain||"").includes(r))}function Fm(e){let t=Et(e);for(;Ze(t)&&!Xt(t);){if(os(t))return t;if(mr(t))return null;t=Et(t)}return null}function ss(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Dm=new Set(["html","body","#document"]);function Xt(e){return Dm.has(an(e))}function Le(e){return je(e).getComputedStyle(e)}function gr(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Et(e){if(an(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ri(e)&&e.host||Xe(e);return ri(t)?t.host:t}function Ya(e){const t=Et(e);return Xt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ze(t)&&En(t)?t:Ya(t)}function yn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ya(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=je(o);if(s){const a=Co(i);return t.concat(i,i.visualViewport||[],En(o)?o:[],a&&n?yn(a):[])}return t.concat(o,yn(o,[],n))}function Co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ja(e){const t=Le(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Xn(n)!==s||Xn(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function is(e){return $e(e)?e:e.contextElement}function Zt(e){const t=is(e);if(!Ze(t))return We(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Ja(t);let i=(s?Xn(n.width):n.width)/r,a=(s?Xn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const $m=We(0);function Qa(e){const t=je(e);return!ss()||!t.visualViewport?$m:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==je(e)?!1:t}function Pt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=is(e);let i=We(1);t&&(r?$e(r)&&(i=Zt(r)):i=Zt(e));const a=Lm(s,n,r)?Qa(s):We(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,g=o.height/i.y;if(s){const m=je(s),f=r&&$e(r)?je(r):r;let v=m,p=Co(v);for(;p&&r&&f!==v;){const y=Zt(p),x=p.getBoundingClientRect(),b=Le(p),w=x.left+(p.clientLeft+parseFloat(b.paddingLeft))*y.x,_=x.top+(p.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,g*=y.y,c+=w,u+=_,v=je(p),p=Co(v)}}return Jn({width:d,height:g,x:c,y:u})}function pr(e,t){const n=gr(e).scrollLeft;return t?t.left+n:Pt(Xe(e)).left+n}function el(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-pr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vm(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Xe(r),a=t?mr(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=We(1);const d=We(0),g=Ze(r);if((g||!g&&!s)&&((an(r)!=="body"||En(i))&&(c=gr(r)),Ze(r))){const f=Pt(r);u=Zt(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const m=i&&!g&&!s?el(i,c):We(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function zm(e){return Array.from(e.getClientRects())}function Hm(e){const t=Xe(e),n=gr(e),r=e.ownerDocument.body,o=Te(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Te(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+pr(e);const a=-n.scrollTop;return Le(r).direction==="rtl"&&(i+=Te(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const oi=25;function Gm(e,t){const n=je(e),r=Xe(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=ss();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=pr(r);if(u<=0){const d=r.ownerDocument,g=d.body,m=getComputedStyle(g),f=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,v=Math.abs(r.clientWidth-g.clientWidth-f);v<=oi&&(s-=v)}else u<=oi&&(s+=u);return{width:s,height:i,x:a,y:c}}const Bm=new Set(["absolute","fixed"]);function Um(e,t){const n=Pt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ze(e)?Zt(e):We(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function si(e,t,n){let r;if(t==="viewport")r=Gm(e,n);else if(t==="document")r=Hm(Xe(e));else if($e(t))r=Um(t,n);else{const o=Qa(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Jn(r)}function tl(e,t){const n=Et(e);return n===t||!$e(n)||Xt(n)?!1:Le(n).position==="fixed"||tl(n,t)}function Wm(e,t){const n=t.get(e);if(n)return n;let r=yn(e,[],!1).filter(a=>$e(a)&&an(a)!=="body"),o=null;const s=Le(e).position==="fixed";let i=s?Et(e):e;for(;$e(i)&&!Xt(i);){const a=Le(i),c=os(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&Bm.has(o.position)||En(i)&&!c&&tl(e,i))?r=r.filter(d=>d!==i):o=a,i=Et(i)}return t.set(e,r),r}function qm(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?mr(t)?[]:Wm(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const g=si(t,d,o);return u.top=Te(g.top,u.top),u.right=Rt(g.right,u.right),u.bottom=Rt(g.bottom,u.bottom),u.left=Te(g.left,u.left),u},si(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Zm(e){const{width:t,height:n}=Ja(e);return{width:t,height:n}}function Km(e,t,n){const r=Ze(t),o=Xe(t),s=n==="fixed",i=Pt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=We(0);function u(){c.x=pr(o)}if(r||!r&&!s)if((an(t)!=="body"||En(o))&&(a=gr(t)),r){const f=Pt(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?el(o,a):We(0),g=i.left+a.scrollLeft-c.x-d.x,m=i.top+a.scrollTop-c.y-d.y;return{x:g,y:m,width:i.width,height:i.height}}function Ur(e){return Le(e).position==="static"}function ii(e,t){if(!Ze(e)||Le(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xe(e)===n&&(n=n.ownerDocument.body),n}function nl(e,t){const n=je(e);if(mr(e))return n;if(!Ze(e)){let o=Et(e);for(;o&&!Xt(o);){if($e(o)&&!Ur(o))return o;o=Et(o)}return n}let r=ii(e,t);for(;r&&Tm(r)&&Ur(r);)r=ii(r,t);return r&&Xt(r)&&Ur(r)&&!os(r)?n:r||Fm(e)||n}const Xm=async function(e){const t=this.getOffsetParent||nl,n=this.getDimensions,r=await n(e.floating);return{reference:Km(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ym(e){return Le(e).direction==="rtl"}const Jm={convertOffsetParentRelativeRectToViewportRelativeRect:Vm,getDocumentElement:Xe,getClippingRect:qm,getOffsetParent:nl,getElementRects:Xm,getClientRects:zm,getDimensions:Zm,getScale:Zt,isElement:$e,isRTL:Ym};function rl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qm(e,t){let n=null,r;const o=Xe(e);function s(){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),s();const u=e.getBoundingClientRect(),{left:d,top:g,width:m,height:f}=u;if(a||t(),!m||!f)return;const v=$n(g),p=$n(o.clientWidth-(d+m)),y=$n(o.clientHeight-(g+f)),x=$n(d),w={rootMargin:-v+"px "+-p+"px "+-y+"px "+-x+"px",threshold:Te(0,Rt(1,c))||1};let _=!0;function C(N){const E=N[0].intersectionRatio;if(E!==c){if(!_)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!rl(u,e.getBoundingClientRect())&&i(),_=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function eg(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=is(e),d=o||s?[...u?yn(u):[],...yn(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const g=u&&a?Qm(u,n):null;let m=-1,f=null;i&&(f=new ResizeObserver(x=>{let[b]=x;b&&b.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),u&&!c&&f.observe(u),f.observe(t));let v,p=c?Pt(e):null;c&&y();function y(){const x=Pt(e);p&&!rl(p,x)&&n(),p=x,v=requestAnimationFrame(y)}return n(),()=>{var x;d.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),g==null||g(),(x=f)==null||x.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const tg=Rm,ng=Em,rg=Sm,og=Mm,sg=_m,ai=bm,ig=km,ag=(e,t,n)=>{const r=new Map,o={platform:Jm,...n},s={...o.platform,_c:r};return wm(e,t,{...o,platform:s})};var lg=typeof document<"u",cg=function(){},Wn=lg?h.useLayoutEffect:cg;function Qn(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,o;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(!Qn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Qn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ol(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function li(e,t){const n=ol(e);return Math.round(t*n)/n}function Wr(e){const t=h.useRef(e);return Wn(()=>{t.current=e}),t}function ug(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,g]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=h.useState(r);Qn(m,r)||f(r);const[v,p]=h.useState(null),[y,x]=h.useState(null),b=h.useCallback(R=>{R!==N.current&&(N.current=R,p(R))},[]),w=h.useCallback(R=>{R!==E.current&&(E.current=R,x(R))},[]),_=s||v,C=i||y,N=h.useRef(null),E=h.useRef(null),S=h.useRef(d),j=c!=null,L=Wr(c),K=Wr(o),U=Wr(u),Z=h.useCallback(()=>{if(!N.current||!E.current)return;const R={placement:t,strategy:n,middleware:m};K.current&&(R.platform=K.current),ag(N.current,E.current,R).then(k=>{const z={...k,isPositioned:U.current!==!1};A.current&&!Qn(S.current,z)&&(S.current=z,Wo.flushSync(()=>{g(z)}))})},[m,t,n,K,U]);Wn(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,g(R=>({...R,isPositioned:!1})))},[u]);const A=h.useRef(!1);Wn(()=>(A.current=!0,()=>{A.current=!1}),[]),Wn(()=>{if(_&&(N.current=_),C&&(E.current=C),_&&C){if(L.current)return L.current(_,C,Z);Z()}},[_,C,Z,L,j]);const te=h.useMemo(()=>({reference:N,floating:E,setReference:b,setFloating:w}),[b,w]),I=h.useMemo(()=>({reference:_,floating:C}),[_,C]),Q=h.useMemo(()=>{const R={position:n,left:0,top:0};if(!I.floating)return R;const k=li(I.floating,d.x),z=li(I.floating,d.y);return a?{...R,transform:"translate("+k+"px, "+z+"px)",...ol(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:z}},[n,a,I.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:Z,refs:te,elements:I,floatingStyles:Q}),[d,Z,te,I,Q])}const dg=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ai({element:r.current,padding:o}).fn(n):{}:r?ai({element:r,padding:o}).fn(n):{}}}},fg=(e,t)=>({...tg(e),options:[e,t]}),mg=(e,t)=>({...ng(e),options:[e,t]}),gg=(e,t)=>({...ig(e),options:[e,t]}),pg=(e,t)=>({...rg(e),options:[e,t]}),hg=(e,t)=>({...og(e),options:[e,t]}),vg=(e,t)=>({...sg(e),options:[e,t]}),xg=(e,t)=>({...dg(e),options:[e,t]});var yg="Arrow",sl=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(fe.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});sl.displayName=yg;var wg=sl,as="Popper",[il,al]=Dt(as),[bg,ll]=il(as),cl=e=>{const{__scopePopper:t,children:n}=e,[r,o]=h.useState(null);return l.jsx(bg,{scope:t,anchor:r,onAnchorChange:o,children:n})};cl.displayName=as;var ul="PopperAnchor",dl=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=ll(ul,n),i=h.useRef(null),a=Ee(t,i),c=h.useRef(null);return h.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:l.jsx(fe.div,{...o,ref:a})});dl.displayName=ul;var ls="PopperContent",[Sg,_g]=il(ls),fl=h.forwardRef((e,t)=>{var ne,ze,xe,_e,Je,mt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:g="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:v,...p}=e,y=ll(ls,n),[x,b]=h.useState(null),w=Ee(t,re=>b(re)),[_,C]=h.useState(null),N=ga(_),E=(N==null?void 0:N.width)??0,S=(N==null?void 0:N.height)??0,j=r+(s!=="center"?"-"+s:""),L=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},K=Array.isArray(u)?u:[u],U=K.length>0,Z={padding:L,boundary:K.filter(Rg),altBoundary:U},{refs:A,floatingStyles:te,placement:I,isPositioned:Q,middlewareData:R}=ug({strategy:"fixed",placement:j,whileElementsMounted:(...re)=>eg(...re,{animationFrame:f==="always"}),elements:{reference:y.anchor},middleware:[fg({mainAxis:o+S,alignmentAxis:i}),c&&mg({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?gg():void 0,...Z}),c&&pg({...Z}),hg({...Z,apply:({elements:re,rects:ue,availableWidth:he,availableHeight:le})=>{const{width:Ae,height:gt}=ue.reference,ge=re.floating.style;ge.setProperty("--radix-popper-available-width",`${he}px`),ge.setProperty("--radix-popper-available-height",`${le}px`),ge.setProperty("--radix-popper-anchor-width",`${Ae}px`),ge.setProperty("--radix-popper-anchor-height",`${gt}px`)}}),_&&xg({element:_,padding:a}),Eg({arrowWidth:E,arrowHeight:S}),m&&vg({strategy:"referenceHidden",...Z})]}),[k,z]=pl(I),V=ct(v);_t(()=>{Q&&(V==null||V())},[Q,V]);const ee=(ne=R.arrow)==null?void 0:ne.x,se=(ze=R.arrow)==null?void 0:ze.y,ce=((xe=R.arrow)==null?void 0:xe.centerOffset)!==0,[be,Se]=h.useState();return _t(()=>{x&&Se(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:Q?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(_e=R.transformOrigin)==null?void 0:_e.x,(Je=R.transformOrigin)==null?void 0:Je.y].join(" "),...((mt=R.hide)==null?void 0:mt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Sg,{scope:n,placedSide:k,onArrowChange:C,arrowX:ee,arrowY:se,shouldHideArrow:ce,children:l.jsx(fe.div,{"data-side":k,"data-align":z,...p,ref:w,style:{...p.style,animation:Q?void 0:"none"}})})})});fl.displayName=ls;var ml="PopperArrow",Cg={top:"bottom",right:"left",bottom:"top",left:"right"},gl=h.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=_g(ml,r),i=Cg[s.placedSide];return l.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:l.jsx(wg,{...o,ref:n,style:{...o.style,display:"block"}})})});gl.displayName=ml;function Rg(e){return e!==null}var Eg=e=>({name:"transformOrigin",options:e,fn(t){var y,x,b;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=pl(n),g={start:"0%",center:"50%",end:"100%"}[d],m=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,f=(((b=o.arrow)==null?void 0:b.y)??0)+c/2;let v="",p="";return u==="bottom"?(v=i?g:`${m}px`,p=`${-c}px`):u==="top"?(v=i?g:`${m}px`,p=`${r.floating.height+c}px`):u==="right"?(v=`${-c}px`,p=i?g:`${f}px`):u==="left"&&(v=`${r.floating.width+c}px`,p=i?g:`${f}px`),{data:{x:v,y:p}}}});function pl(e){const[t,n="center"]=e.split("-");return[t,n]}var kg=cl,Mg=dl,Ng=fl,Ag=gl,Tg="Portal",hl=h.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=h.useState(!1);_t(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Ju.createPortal(l.jsx(fe.div,{...r,ref:t}),i):null});hl.displayName=Tg;var qr="rovingFocusGroup.onEntryFocus",jg={bubbles:!1,cancelable:!0},kn="RovingFocusGroup",[Ro,vl,Ig]=Ha(kn),[Pg,hr]=Dt(kn,[Ig]),[Og,Fg]=Pg(kn),xl=h.forwardRef((e,t)=>l.jsx(Ro.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ro.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Dg,{...e,ref:t})})}));xl.displayName=kn;var Dg=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...g}=e,m=h.useRef(null),f=Ee(t,m),v=es(s),[p,y]=cr({prop:i,defaultProp:a??null,onChange:c,caller:kn}),[x,b]=h.useState(!1),w=ct(u),_=vl(n),C=h.useRef(!1),[N,E]=h.useState(0);return h.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(qr,w),()=>S.removeEventListener(qr,w)},[w]),l.jsx(Og,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:p,onItemFocus:h.useCallback(S=>y(S),[y]),onItemShiftTab:h.useCallback(()=>b(!0),[]),onFocusableItemAdd:h.useCallback(()=>E(S=>S+1),[]),onFocusableItemRemove:h.useCallback(()=>E(S=>S-1),[]),children:l.jsx(fe.div,{tabIndex:x||N===0?-1:0,"data-orientation":r,...g,ref:f,style:{outline:"none",...e.style},onMouseDown:J(e.onMouseDown,()=>{C.current=!0}),onFocus:J(e.onFocus,S=>{const j=!C.current;if(S.target===S.currentTarget&&j&&!x){const L=new CustomEvent(qr,jg);if(S.currentTarget.dispatchEvent(L),!L.defaultPrevented){const K=_().filter(I=>I.focusable),U=K.find(I=>I.active),Z=K.find(I=>I.id===p),te=[U,Z,...K].filter(Boolean).map(I=>I.ref.current);bl(te,d)}}C.current=!1}),onBlur:J(e.onBlur,()=>b(!1))})})}),yl="RovingFocusGroupItem",wl=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Kn(),u=s||c,d=Fg(yl,n),g=d.currentTabStopId===u,m=vl(n),{onFocusableItemAdd:f,onFocusableItemRemove:v,currentTabStopId:p}=d;return h.useEffect(()=>{if(r)return f(),()=>v()},[r,f,v]),l.jsx(Ro.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(fe.span,{tabIndex:g?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:J(e.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:J(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:J(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=Vg(y,d.orientation,d.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=m().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const _=w.indexOf(y.currentTarget);w=d.loop?zg(w,_+1):w.slice(_+1)}setTimeout(()=>bl(w))}}),children:typeof i=="function"?i({isCurrentTabStop:g,hasTabStop:p!=null}):i})})});wl.displayName=yl;var $g={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lg(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vg(e,t,n){const r=Lg(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $g[r]}function bl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Sl=xl,_l=wl,Hg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ht=new WeakMap,Ln=new WeakMap,Vn={},Zr=0,Cl=function(e){return e&&(e.host||Cl(e.parentNode))},Gg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Cl(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})},Bg=function(e,t,n,r){var o=Gg(t,Array.isArray(e)?e:[e]);Vn[n]||(Vn[n]=new WeakMap);var s=Vn[n],i=[],a=new Set,c=new Set(o),u=function(g){!g||a.has(g)||(a.add(g),u(g.parentNode))};o.forEach(u);var d=function(g){!g||c.has(g)||Array.prototype.forEach.call(g.children,function(m){if(a.has(m))d(m);else try{var f=m.getAttribute(r),v=f!==null&&f!=="false",p=(Ht.get(m)||0)+1,y=(s.get(m)||0)+1;Ht.set(m,p),s.set(m,y),i.push(m),p===1&&v&&Ln.set(m,!0),y===1&&m.setAttribute(n,"true"),v||m.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return d(t),a.clear(),Zr++,function(){i.forEach(function(g){var m=Ht.get(g)-1,f=s.get(g)-1;Ht.set(g,m),s.set(g,f),m||(Ln.has(g)||g.removeAttribute(r),Ln.delete(g)),f||g.removeAttribute(n)}),Zr--,Zr||(Ht=new WeakMap,Ht=new WeakMap,Ln=new WeakMap,Vn={})}},Ug=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Hg(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Bg(r,o,n,"aria-hidden")):function(){return null}},Be=function(){return Be=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Be.apply(this,arguments)};function Rl(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Wg(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var qn="right-scroll-bar-position",Zn="width-before-scroll-bar",qg="with-scroll-bars-hidden",Zg="--removed-body-scroll-bar-size";function Kr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Kg(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Xg=typeof window<"u"?h.useLayoutEffect:h.useEffect,ci=new WeakMap;function Yg(e,t){var n=Kg(null,function(r){return e.forEach(function(o){return Kr(o,r)})});return Xg(function(){var r=ci.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||Kr(a,null)}),s.forEach(function(a){o.has(a)||Kr(a,i)})}ci.set(n,e)},[e]),n}function Jg(e){return e}function Qg(e,t){t===void 0&&(t=Jg);var n=[],r=!1,o={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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function ep(e){e===void 0&&(e={});var t=Qg(null);return t.options=Be({async:!0,ssr:!1},e),t}var El=function(e){var t=e.sideCar,n=Rl(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 h.createElement(r,Be({},n))};El.isSideCarExport=!0;function tp(e,t){return e.useMedium(t),El}var kl=ep(),Xr=function(){},vr=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:Xr,onWheelCapture:Xr,onTouchMoveCapture:Xr}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,g=e.shards,m=e.sideCar,f=e.noRelative,v=e.noIsolation,p=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,_=Rl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,N=Yg([n,t]),E=Be(Be({},_),o);return h.createElement(h.Fragment,null,d&&h.createElement(C,{sideCar:kl,removeScrollBar:u,shards:g,noRelative:f,noIsolation:v,inert:p,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),i?h.cloneElement(h.Children.only(a),Be(Be({},E),{ref:N})):h.createElement(b,Be({},E,{className:c,ref:N}),a))});vr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vr.classNames={fullWidth:Zn,zeroRight:qn};var np=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=np();return t&&e.setAttribute("nonce",t),e}function op(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sp(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ip=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rp())&&(op(t,n),sp(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ap=function(){var e=ip();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ml=function(){var e=ap(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},lp={left:0,top:0,right:0,gap:0},Yr=function(e){return parseInt(e||"",10)||0},cp=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Yr(n),Yr(r),Yr(o)]},up=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lp;var t=cp(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])}},dp=Ml(),Kt="data-scroll-locked",fp=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
105
+ */function Bs(e,t){return e?Lf(e)?h.createElement(e,t):e:null}function Lf(e){return Vf(e)||typeof e=="function"||zf(e)}function Vf(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function zf(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Hf(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=h.useState(()=>({current:Af(t)})),[r,o]=h.useState(()=>n.current.initialState);return n.current.setOptions(s=>({...s,...e,state:{...r,...e.state},onStateChange:i=>{o(i),e.onStateChange==null||e.onStateChange(i)}})),n.current}const Gf=Ko("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",xl:"h-12 rounded-md px-8 text-base",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),jt=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?pa:"button";return l.jsx(i,{className:de(Gf({variant:t,size:n,className:e})),ref:s,...o})});jt.displayName="Button";function Ha(e){const t=e+"CollectionProvider",[n,r]=Dt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:y,children:x}=p,b=He.useRef(null),w=He.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:w,collectionRef:b,children:x})};i.displayName=t;const a=e+"CollectionSlot",c=vn(a),u=He.forwardRef((p,y)=>{const{scope:x,children:b}=p,w=s(a,x),_=Ee(y,w.collectionRef);return l.jsx(c,{ref:_,children:b})});u.displayName=a;const d=e+"CollectionItemSlot",g="data-radix-collection-item",m=vn(d),f=He.forwardRef((p,y)=>{const{scope:x,children:b,...w}=p,_=He.useRef(null),C=Ee(y,_),N=s(d,x);return He.useEffect(()=>(N.itemMap.set(_,{ref:_,...w}),()=>void N.itemMap.delete(_))),l.jsx(m,{[g]:"",ref:C,children:b})});f.displayName=d;function v(p){const y=s(e+"CollectionConsumer",p);return He.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${g}]`));return Array.from(y.itemMap.values()).sort((N,E)=>w.indexOf(N.ref.current)-w.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:u,ItemSlot:f},v,r]}var Bf=h.createContext(void 0);function es(e){const t=h.useContext(Bf);return e||t||"ltr"}function ct(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Uf(e,t=globalThis==null?void 0:globalThis.document){const n=ct(e);h.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Wf="DismissableLayer",bo="dismissableLayer.update",qf="dismissableLayer.pointerDownOutside",Zf="dismissableLayer.focusOutside",Us,Ga=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ba=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=h.useContext(Ga),[d,g]=h.useState(null),m=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=h.useState({}),v=Ee(t,E=>g(E)),p=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=p.indexOf(y),b=d?p.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,_=b>=x,C=Yf(E=>{const S=E.target,j=[...u.branches].some(L=>L.contains(S));!_||j||(o==null||o(E),i==null||i(E),E.defaultPrevented||a==null||a())},m),N=Jf(E=>{const S=E.target;[...u.branches].some(L=>L.contains(S))||(s==null||s(E),i==null||i(E),E.defaultPrevented||a==null||a())},m);return Uf(E=>{b===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},m),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Us=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ws(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Us)}},[d,m,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ws())},[d,u]),h.useEffect(()=>{const E=()=>f({});return document.addEventListener(bo,E),()=>document.removeEventListener(bo,E)},[]),l.jsx(fe.div,{...c,ref:v,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:J(e.onFocusCapture,N.onFocusCapture),onBlurCapture:J(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,C.onPointerDownCapture)})});Ba.displayName=Wf;var Kf="DismissableLayerBranch",Xf=h.forwardRef((e,t)=>{const n=h.useContext(Ga),r=h.useRef(null),o=Ee(t,r);return h.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(fe.div,{...e,ref:o})});Xf.displayName=Kf;function Yf(e,t=globalThis==null?void 0:globalThis.document){const n=ct(e),r=h.useRef(!1),o=h.useRef(()=>{});return h.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Ua(qf,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Jf(e,t=globalThis==null?void 0:globalThis.document){const n=ct(e),r=h.useRef(!1);return h.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ua(Zf,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ws(){const e=new CustomEvent(bo);document.dispatchEvent(e)}function Ua(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ha(o,s):o.dispatchEvent(s)}var Hr=0;function Qf(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??qs()),document.body.insertAdjacentElement("beforeend",e[1]??qs()),Hr++,()=>{Hr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hr--}},[])}function qs(){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 Gr="focusScope.autoFocusOnMount",Br="focusScope.autoFocusOnUnmount",Zs={bubbles:!1,cancelable:!0},em="FocusScope",Wa=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=h.useState(null),u=ct(o),d=ct(s),g=h.useRef(null),m=Ee(t,p=>c(p)),f=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let p=function(w){if(f.paused||!a)return;const _=w.target;a.contains(_)?g.current=_:ht(g.current,{select:!0})},y=function(w){if(f.paused||!a)return;const _=w.relatedTarget;_!==null&&(a.contains(_)||ht(g.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&ht(a)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const b=new MutationObserver(x);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,f.paused]),h.useEffect(()=>{if(a){Xs.add(f);const p=document.activeElement;if(!a.contains(p)){const x=new CustomEvent(Gr,Zs);a.addEventListener(Gr,u),a.dispatchEvent(x),x.defaultPrevented||(tm(im(qa(a)),{select:!0}),document.activeElement===p&&ht(a))}return()=>{a.removeEventListener(Gr,u),setTimeout(()=>{const x=new CustomEvent(Br,Zs);a.addEventListener(Br,d),a.dispatchEvent(x),x.defaultPrevented||ht(p??document.body,{select:!0}),a.removeEventListener(Br,d),Xs.remove(f)},0)}}},[a,u,d,f]);const v=h.useCallback(p=>{if(!n&&!r||f.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,x=document.activeElement;if(y&&x){const b=p.currentTarget,[w,_]=nm(b);w&&_?!p.shiftKey&&x===_?(p.preventDefault(),n&&ht(w,{select:!0})):p.shiftKey&&x===w&&(p.preventDefault(),n&&ht(_,{select:!0})):x===b&&p.preventDefault()}},[n,r,f.paused]);return l.jsx(fe.div,{tabIndex:-1,...i,ref:m,onKeyDown:v})});Wa.displayName=em;function tm(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ht(r,{select:t}),document.activeElement!==n)return}function nm(e){const t=qa(e),n=Ks(t,e),r=Ks(t.reverse(),e);return[n,r]}function qa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ks(e,t){for(const n of e)if(!rm(n,{upTo:t}))return n}function rm(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 om(e){return e instanceof HTMLInputElement&&"select"in e}function ht(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&om(e)&&t&&e.select()}}var Xs=sm();function sm(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ys(e,t),e.unshift(t)},remove(t){var n;e=Ys(e,t),(n=e[0])==null||n.resume()}}}function Ys(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function im(e){return e.filter(t=>t.tagName!=="A")}var am=qi[" useId ".trim().toString()]||(()=>{}),lm=0;function Kn(e){const[t,n]=h.useState(am());return _t(()=>{n(r=>r??String(lm++))},[e]),e||(t?`radix-${t}`:"")}const cm=["top","right","bottom","left"],Rt=Math.min,Te=Math.max,Xn=Math.round,$n=Math.floor,We=e=>({x:e,y:e}),um={left:"right",right:"left",bottom:"top",top:"bottom"},dm={start:"end",end:"start"};function So(e,t,n){return Te(e,Rt(t,n))}function ut(e,t){return typeof e=="function"?e(t):e}function dt(e){return e.split("-")[0]}function sn(e){return e.split("-")[1]}function ts(e){return e==="x"?"y":"x"}function ns(e){return e==="y"?"height":"width"}const fm=new Set(["top","bottom"]);function Ue(e){return fm.has(dt(e))?"y":"x"}function rs(e){return ts(Ue(e))}function mm(e,t,n){n===void 0&&(n=!1);const r=sn(e),o=rs(e),s=ns(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Yn(i)),[i,Yn(i)]}function gm(e){const t=Yn(e);return[_o(e),t,_o(t)]}function _o(e){return e.replace(/start|end/g,t=>dm[t])}const Js=["left","right"],Qs=["right","left"],pm=["top","bottom"],hm=["bottom","top"];function vm(e,t,n){switch(e){case"top":case"bottom":return n?t?Qs:Js:t?Js:Qs;case"left":case"right":return t?pm:hm;default:return[]}}function xm(e,t,n,r){const o=sn(e);let s=vm(dt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(_o)))),s}function Yn(e){return e.replace(/left|right|bottom|top/g,t=>um[t])}function ym(e){return{top:0,right:0,bottom:0,left:0,...e}}function Za(e){return typeof e!="number"?ym(e):{top:e,right:e,bottom:e,left:e}}function Jn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ei(e,t,n){let{reference:r,floating:o}=e;const s=Ue(t),i=rs(t),a=ns(i),c=dt(t),u=s==="y",d=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:g};break;case"left":f={x:r.x-o.width,y:g};break;default:f={x:r.x,y:r.y}}switch(sn(t)){case"start":f[i]-=m*(n&&u?-1:1);break;case"end":f[i]+=m*(n&&u?-1:1);break}return f}const wm=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:g}=ei(u,r,c),m=r,f={},v=0;for(let p=0;p<a.length;p++){const{name:y,fn:x}=a[p],{x:b,y:w,data:_,reset:C}=await x({x:d,y:g,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:u,platform:i,elements:{reference:e,floating:t}});d=b??d,g=w??g,f={...f,[y]:{...f[y],..._}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:g}=ei(u,m,c)),p=-1)}return{x:d,y:g,placement:m,strategy:o,middlewareData:f}};async function xn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:g="floating",altBoundary:m=!1,padding:f=0}=ut(t,e),v=Za(f),y=a[m?g==="floating"?"reference":"floating":g],x=Jn(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),b=g==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),_=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=Jn(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:c}):b);return{top:(x.top-C.top+v.top)/_.y,bottom:(C.bottom-x.bottom+v.bottom)/_.y,left:(x.left-C.left+v.left)/_.x,right:(C.right-x.right+v.right)/_.x}}const bm=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=ut(e,t)||{};if(u==null)return{};const g=Za(d),m={x:n,y:r},f=rs(o),v=ns(f),p=await i.getDimensions(u),y=f==="y",x=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",_=s.reference[v]+s.reference[f]-m[f]-s.floating[v],C=m[f]-s.reference[f],N=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=N?N[w]:0;(!E||!await(i.isElement==null?void 0:i.isElement(N)))&&(E=a.floating[w]||s.floating[v]);const S=_/2-C/2,j=E/2-p[v]/2-1,L=Rt(g[x],j),K=Rt(g[b],j),B=L,Z=E-p[v]-K,A=E/2-p[v]/2+S,te=So(B,A,Z),I=!c.arrow&&sn(o)!=null&&A!==te&&s.reference[v]/2-(A<B?L:K)-p[v]/2<0,Q=I?A<B?A-B:A-Z:0;return{[f]:m[f]+Q,data:{[f]:te,centerOffset:A-te-Q,...I&&{alignmentOffset:Q}},reset:I}}}),Sm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:g=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:p=!0,...y}=ut(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=dt(o),b=Ue(a),w=dt(a)===a,_=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=m||(w||!p?[Yn(a)]:gm(a)),N=v!=="none";!m&&N&&C.push(...xm(a,p,v,_));const E=[a,...C],S=await xn(t,y),j=[];let L=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&j.push(S[x]),g){const A=mm(o,i,_);j.push(S[A[0]],S[A[1]])}if(L=[...L,{placement:o,overflows:j}],!j.every(A=>A<=0)){var K,B;const A=(((K=s.flip)==null?void 0:K.index)||0)+1,te=E[A];if(te&&(!(g==="alignment"?b!==Ue(te):!1)||L.every(R=>Ue(R.placement)===b?R.overflows[0]>0:!0)))return{data:{index:A,overflows:L},reset:{placement:te}};let I=(B=L.filter(Q=>Q.overflows[0]<=0).sort((Q,R)=>Q.overflows[1]-R.overflows[1])[0])==null?void 0:B.placement;if(!I)switch(f){case"bestFit":{var Z;const Q=(Z=L.filter(R=>{if(N){const k=Ue(R.placement);return k===b||k==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(k=>k>0).reduce((k,z)=>k+z,0)]).sort((R,k)=>R[1]-k[1])[0])==null?void 0:Z[0];Q&&(I=Q);break}case"initialPlacement":I=a;break}if(o!==I)return{reset:{placement:I}}}return{}}}};function ti(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ni(e){return cm.some(t=>e[t]>=0)}const _m=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ut(e,t);switch(r){case"referenceHidden":{const s=await xn(t,{...o,elementContext:"reference"}),i=ti(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ni(i)}}}case"escaped":{const s=await xn(t,{...o,altBoundary:!0}),i=ti(s,n.floating);return{data:{escapedOffsets:i,escaped:ni(i)}}}default:return{}}}}},Ka=new Set(["left","top"]);async function Cm(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=dt(n),a=sn(n),c=Ue(n)==="y",u=Ka.has(i)?-1:1,d=s&&c?-1:1,g=ut(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return a&&typeof v=="number"&&(f=a==="end"?v*-1:v),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const Rm=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await Cm(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Em=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x,y:b}=y;return{x,y:b}}},...c}=ut(e,t),u={x:n,y:r},d=await xn(t,c),g=Ue(dt(o)),m=ts(g);let f=u[m],v=u[g];if(s){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",b=f+d[y],w=f-d[x];f=So(b,f,w)}if(i){const y=g==="y"?"top":"left",x=g==="y"?"bottom":"right",b=v+d[y],w=v-d[x];v=So(b,v,w)}const p=a.fn({...t,[m]:f,[g]:v});return{...p,data:{x:p.x-n,y:p.y-r,enabled:{[m]:s,[g]:i}}}}}},km=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=ut(e,t),d={x:n,y:r},g=Ue(o),m=ts(g);let f=d[m],v=d[g];const p=ut(a,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const w=m==="y"?"height":"width",_=s.reference[m]-s.floating[w]+y.mainAxis,C=s.reference[m]+s.reference[w]-y.mainAxis;f<_?f=_:f>C&&(f=C)}if(u){var x,b;const w=m==="y"?"width":"height",_=Ka.has(dt(o)),C=s.reference[g]-s.floating[w]+(_&&((x=i.offset)==null?void 0:x[g])||0)+(_?0:y.crossAxis),N=s.reference[g]+s.reference[w]+(_?0:((b=i.offset)==null?void 0:b[g])||0)-(_?y.crossAxis:0);v<C?v=C:v>N&&(v=N)}return{[m]:f,[g]:v}}}},Mm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...u}=ut(e,t),d=await xn(t,u),g=dt(o),m=sn(o),f=Ue(o)==="y",{width:v,height:p}=s.floating;let y,x;g==="top"||g==="bottom"?(y=g,x=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(x=g,y=m==="end"?"top":"bottom");const b=p-d.top-d.bottom,w=v-d.left-d.right,_=Rt(p-d[y],b),C=Rt(v-d[x],w),N=!t.middlewareData.shift;let E=_,S=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),N&&!m){const L=Te(d.left,0),K=Te(d.right,0),B=Te(d.top,0),Z=Te(d.bottom,0);f?S=v-2*(L!==0||K!==0?L+K:Te(d.left,d.right)):E=p-2*(B!==0||Z!==0?B+Z:Te(d.top,d.bottom))}await c({...t,availableWidth:S,availableHeight:E});const j=await i.getDimensions(a.floating);return v!==j.width||p!==j.height?{reset:{rects:!0}}:{}}}};function fr(){return typeof window<"u"}function an(e){return Xa(e)?(e.nodeName||"").toLowerCase():"#document"}function je(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xe(e){var t;return(t=(Xa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xa(e){return fr()?e instanceof Node||e instanceof je(e).Node:!1}function $e(e){return fr()?e instanceof Element||e instanceof je(e).Element:!1}function Ze(e){return fr()?e instanceof HTMLElement||e instanceof je(e).HTMLElement:!1}function ri(e){return!fr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof je(e).ShadowRoot}const Nm=new Set(["inline","contents"]);function En(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Le(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Nm.has(o)}const Am=new Set(["table","td","th"]);function Tm(e){return Am.has(an(e))}const jm=[":popover-open",":modal"];function mr(e){return jm.some(t=>{try{return e.matches(t)}catch{return!1}})}const Im=["transform","translate","scale","rotate","perspective"],Pm=["transform","translate","scale","rotate","perspective","filter"],Om=["paint","layout","strict","content"];function os(e){const t=ss(),n=$e(e)?Le(e):e;return Im.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)||Pm.some(r=>(n.willChange||"").includes(r))||Om.some(r=>(n.contain||"").includes(r))}function Fm(e){let t=Et(e);for(;Ze(t)&&!Xt(t);){if(os(t))return t;if(mr(t))return null;t=Et(t)}return null}function ss(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Dm=new Set(["html","body","#document"]);function Xt(e){return Dm.has(an(e))}function Le(e){return je(e).getComputedStyle(e)}function gr(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Et(e){if(an(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ri(e)&&e.host||Xe(e);return ri(t)?t.host:t}function Ya(e){const t=Et(e);return Xt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ze(t)&&En(t)?t:Ya(t)}function yn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ya(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=je(o);if(s){const a=Co(i);return t.concat(i,i.visualViewport||[],En(o)?o:[],a&&n?yn(a):[])}return t.concat(o,yn(o,[],n))}function Co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ja(e){const t=Le(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ze(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Xn(n)!==s||Xn(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function is(e){return $e(e)?e:e.contextElement}function Zt(e){const t=is(e);if(!Ze(t))return We(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Ja(t);let i=(s?Xn(n.width):n.width)/r,a=(s?Xn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const $m=We(0);function Qa(e){const t=je(e);return!ss()||!t.visualViewport?$m:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==je(e)?!1:t}function Pt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=is(e);let i=We(1);t&&(r?$e(r)&&(i=Zt(r)):i=Zt(e));const a=Lm(s,n,r)?Qa(s):We(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,g=o.height/i.y;if(s){const m=je(s),f=r&&$e(r)?je(r):r;let v=m,p=Co(v);for(;p&&r&&f!==v;){const y=Zt(p),x=p.getBoundingClientRect(),b=Le(p),w=x.left+(p.clientLeft+parseFloat(b.paddingLeft))*y.x,_=x.top+(p.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,g*=y.y,c+=w,u+=_,v=je(p),p=Co(v)}}return Jn({width:d,height:g,x:c,y:u})}function pr(e,t){const n=gr(e).scrollLeft;return t?t.left+n:Pt(Xe(e)).left+n}function el(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-pr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vm(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Xe(r),a=t?mr(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=We(1);const d=We(0),g=Ze(r);if((g||!g&&!s)&&((an(r)!=="body"||En(i))&&(c=gr(r)),Ze(r))){const f=Pt(r);u=Zt(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const m=i&&!g&&!s?el(i,c):We(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function zm(e){return Array.from(e.getClientRects())}function Hm(e){const t=Xe(e),n=gr(e),r=e.ownerDocument.body,o=Te(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Te(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+pr(e);const a=-n.scrollTop;return Le(r).direction==="rtl"&&(i+=Te(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const oi=25;function Gm(e,t){const n=je(e),r=Xe(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=ss();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=pr(r);if(u<=0){const d=r.ownerDocument,g=d.body,m=getComputedStyle(g),f=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,v=Math.abs(r.clientWidth-g.clientWidth-f);v<=oi&&(s-=v)}else u<=oi&&(s+=u);return{width:s,height:i,x:a,y:c}}const Bm=new Set(["absolute","fixed"]);function Um(e,t){const n=Pt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ze(e)?Zt(e):We(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function si(e,t,n){let r;if(t==="viewport")r=Gm(e,n);else if(t==="document")r=Hm(Xe(e));else if($e(t))r=Um(t,n);else{const o=Qa(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Jn(r)}function tl(e,t){const n=Et(e);return n===t||!$e(n)||Xt(n)?!1:Le(n).position==="fixed"||tl(n,t)}function Wm(e,t){const n=t.get(e);if(n)return n;let r=yn(e,[],!1).filter(a=>$e(a)&&an(a)!=="body"),o=null;const s=Le(e).position==="fixed";let i=s?Et(e):e;for(;$e(i)&&!Xt(i);){const a=Le(i),c=os(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&Bm.has(o.position)||En(i)&&!c&&tl(e,i))?r=r.filter(d=>d!==i):o=a,i=Et(i)}return t.set(e,r),r}function qm(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?mr(t)?[]:Wm(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const g=si(t,d,o);return u.top=Te(g.top,u.top),u.right=Rt(g.right,u.right),u.bottom=Rt(g.bottom,u.bottom),u.left=Te(g.left,u.left),u},si(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Zm(e){const{width:t,height:n}=Ja(e);return{width:t,height:n}}function Km(e,t,n){const r=Ze(t),o=Xe(t),s=n==="fixed",i=Pt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=We(0);function u(){c.x=pr(o)}if(r||!r&&!s)if((an(t)!=="body"||En(o))&&(a=gr(t)),r){const f=Pt(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?el(o,a):We(0),g=i.left+a.scrollLeft-c.x-d.x,m=i.top+a.scrollTop-c.y-d.y;return{x:g,y:m,width:i.width,height:i.height}}function Ur(e){return Le(e).position==="static"}function ii(e,t){if(!Ze(e)||Le(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xe(e)===n&&(n=n.ownerDocument.body),n}function nl(e,t){const n=je(e);if(mr(e))return n;if(!Ze(e)){let o=Et(e);for(;o&&!Xt(o);){if($e(o)&&!Ur(o))return o;o=Et(o)}return n}let r=ii(e,t);for(;r&&Tm(r)&&Ur(r);)r=ii(r,t);return r&&Xt(r)&&Ur(r)&&!os(r)?n:r||Fm(e)||n}const Xm=async function(e){const t=this.getOffsetParent||nl,n=this.getDimensions,r=await n(e.floating);return{reference:Km(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ym(e){return Le(e).direction==="rtl"}const Jm={convertOffsetParentRelativeRectToViewportRelativeRect:Vm,getDocumentElement:Xe,getClippingRect:qm,getOffsetParent:nl,getElementRects:Xm,getClientRects:zm,getDimensions:Zm,getScale:Zt,isElement:$e,isRTL:Ym};function rl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qm(e,t){let n=null,r;const o=Xe(e);function s(){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),s();const u=e.getBoundingClientRect(),{left:d,top:g,width:m,height:f}=u;if(a||t(),!m||!f)return;const v=$n(g),p=$n(o.clientWidth-(d+m)),y=$n(o.clientHeight-(g+f)),x=$n(d),w={rootMargin:-v+"px "+-p+"px "+-y+"px "+-x+"px",threshold:Te(0,Rt(1,c))||1};let _=!0;function C(N){const E=N[0].intersectionRatio;if(E!==c){if(!_)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!rl(u,e.getBoundingClientRect())&&i(),_=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function eg(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=is(e),d=o||s?[...u?yn(u):[],...yn(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const g=u&&a?Qm(u,n):null;let m=-1,f=null;i&&(f=new ResizeObserver(x=>{let[b]=x;b&&b.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),u&&!c&&f.observe(u),f.observe(t));let v,p=c?Pt(e):null;c&&y();function y(){const x=Pt(e);p&&!rl(p,x)&&n(),p=x,v=requestAnimationFrame(y)}return n(),()=>{var x;d.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),g==null||g(),(x=f)==null||x.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const tg=Rm,ng=Em,rg=Sm,og=Mm,sg=_m,ai=bm,ig=km,ag=(e,t,n)=>{const r=new Map,o={platform:Jm,...n},s={...o.platform,_c:r};return wm(e,t,{...o,platform:s})};var lg=typeof document<"u",cg=function(){},Wn=lg?h.useLayoutEffect:cg;function Qn(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,o;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(!Qn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Qn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function ol(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function li(e,t){const n=ol(e);return Math.round(t*n)/n}function Wr(e){const t=h.useRef(e);return Wn(()=>{t.current=e}),t}function ug(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,g]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=h.useState(r);Qn(m,r)||f(r);const[v,p]=h.useState(null),[y,x]=h.useState(null),b=h.useCallback(R=>{R!==N.current&&(N.current=R,p(R))},[]),w=h.useCallback(R=>{R!==E.current&&(E.current=R,x(R))},[]),_=s||v,C=i||y,N=h.useRef(null),E=h.useRef(null),S=h.useRef(d),j=c!=null,L=Wr(c),K=Wr(o),B=Wr(u),Z=h.useCallback(()=>{if(!N.current||!E.current)return;const R={placement:t,strategy:n,middleware:m};K.current&&(R.platform=K.current),ag(N.current,E.current,R).then(k=>{const z={...k,isPositioned:B.current!==!1};A.current&&!Qn(S.current,z)&&(S.current=z,Wo.flushSync(()=>{g(z)}))})},[m,t,n,K,B]);Wn(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,g(R=>({...R,isPositioned:!1})))},[u]);const A=h.useRef(!1);Wn(()=>(A.current=!0,()=>{A.current=!1}),[]),Wn(()=>{if(_&&(N.current=_),C&&(E.current=C),_&&C){if(L.current)return L.current(_,C,Z);Z()}},[_,C,Z,L,j]);const te=h.useMemo(()=>({reference:N,floating:E,setReference:b,setFloating:w}),[b,w]),I=h.useMemo(()=>({reference:_,floating:C}),[_,C]),Q=h.useMemo(()=>{const R={position:n,left:0,top:0};if(!I.floating)return R;const k=li(I.floating,d.x),z=li(I.floating,d.y);return a?{...R,transform:"translate("+k+"px, "+z+"px)",...ol(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:z}},[n,a,I.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:Z,refs:te,elements:I,floatingStyles:Q}),[d,Z,te,I,Q])}const dg=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?ai({element:r.current,padding:o}).fn(n):{}:r?ai({element:r,padding:o}).fn(n):{}}}},fg=(e,t)=>({...tg(e),options:[e,t]}),mg=(e,t)=>({...ng(e),options:[e,t]}),gg=(e,t)=>({...ig(e),options:[e,t]}),pg=(e,t)=>({...rg(e),options:[e,t]}),hg=(e,t)=>({...og(e),options:[e,t]}),vg=(e,t)=>({...sg(e),options:[e,t]}),xg=(e,t)=>({...dg(e),options:[e,t]});var yg="Arrow",sl=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(fe.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});sl.displayName=yg;var wg=sl,as="Popper",[il,al]=Dt(as),[bg,ll]=il(as),cl=e=>{const{__scopePopper:t,children:n}=e,[r,o]=h.useState(null);return l.jsx(bg,{scope:t,anchor:r,onAnchorChange:o,children:n})};cl.displayName=as;var ul="PopperAnchor",dl=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=ll(ul,n),i=h.useRef(null),a=Ee(t,i),c=h.useRef(null);return h.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:l.jsx(fe.div,{...o,ref:a})});dl.displayName=ul;var ls="PopperContent",[Sg,_g]=il(ls),fl=h.forwardRef((e,t)=>{var ne,ze,xe,_e,Je,mt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:g="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:v,...p}=e,y=ll(ls,n),[x,b]=h.useState(null),w=Ee(t,re=>b(re)),[_,C]=h.useState(null),N=ga(_),E=(N==null?void 0:N.width)??0,S=(N==null?void 0:N.height)??0,j=r+(s!=="center"?"-"+s:""),L=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},K=Array.isArray(u)?u:[u],B=K.length>0,Z={padding:L,boundary:K.filter(Rg),altBoundary:B},{refs:A,floatingStyles:te,placement:I,isPositioned:Q,middlewareData:R}=ug({strategy:"fixed",placement:j,whileElementsMounted:(...re)=>eg(...re,{animationFrame:f==="always"}),elements:{reference:y.anchor},middleware:[fg({mainAxis:o+S,alignmentAxis:i}),c&&mg({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?gg():void 0,...Z}),c&&pg({...Z}),hg({...Z,apply:({elements:re,rects:ue,availableWidth:he,availableHeight:le})=>{const{width:Ae,height:gt}=ue.reference,ge=re.floating.style;ge.setProperty("--radix-popper-available-width",`${he}px`),ge.setProperty("--radix-popper-available-height",`${le}px`),ge.setProperty("--radix-popper-anchor-width",`${Ae}px`),ge.setProperty("--radix-popper-anchor-height",`${gt}px`)}}),_&&xg({element:_,padding:a}),Eg({arrowWidth:E,arrowHeight:S}),m&&vg({strategy:"referenceHidden",...Z})]}),[k,z]=pl(I),V=ct(v);_t(()=>{Q&&(V==null||V())},[Q,V]);const ee=(ne=R.arrow)==null?void 0:ne.x,se=(ze=R.arrow)==null?void 0:ze.y,ce=((xe=R.arrow)==null?void 0:xe.centerOffset)!==0,[be,Se]=h.useState();return _t(()=>{x&&Se(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...te,transform:Q?te.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(_e=R.transformOrigin)==null?void 0:_e.x,(Je=R.transformOrigin)==null?void 0:Je.y].join(" "),...((mt=R.hide)==null?void 0:mt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Sg,{scope:n,placedSide:k,onArrowChange:C,arrowX:ee,arrowY:se,shouldHideArrow:ce,children:l.jsx(fe.div,{"data-side":k,"data-align":z,...p,ref:w,style:{...p.style,animation:Q?void 0:"none"}})})})});fl.displayName=ls;var ml="PopperArrow",Cg={top:"bottom",right:"left",bottom:"top",left:"right"},gl=h.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=_g(ml,r),i=Cg[s.placedSide];return l.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:l.jsx(wg,{...o,ref:n,style:{...o.style,display:"block"}})})});gl.displayName=ml;function Rg(e){return e!==null}var Eg=e=>({name:"transformOrigin",options:e,fn(t){var y,x,b;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=pl(n),g={start:"0%",center:"50%",end:"100%"}[d],m=(((x=o.arrow)==null?void 0:x.x)??0)+a/2,f=(((b=o.arrow)==null?void 0:b.y)??0)+c/2;let v="",p="";return u==="bottom"?(v=i?g:`${m}px`,p=`${-c}px`):u==="top"?(v=i?g:`${m}px`,p=`${r.floating.height+c}px`):u==="right"?(v=`${-c}px`,p=i?g:`${f}px`):u==="left"&&(v=`${r.floating.width+c}px`,p=i?g:`${f}px`),{data:{x:v,y:p}}}});function pl(e){const[t,n="center"]=e.split("-");return[t,n]}var kg=cl,Mg=dl,Ng=fl,Ag=gl,Tg="Portal",hl=h.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=h.useState(!1);_t(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?Ju.createPortal(l.jsx(fe.div,{...r,ref:t}),i):null});hl.displayName=Tg;var qr="rovingFocusGroup.onEntryFocus",jg={bubbles:!1,cancelable:!0},kn="RovingFocusGroup",[Ro,vl,Ig]=Ha(kn),[Pg,hr]=Dt(kn,[Ig]),[Og,Fg]=Pg(kn),xl=h.forwardRef((e,t)=>l.jsx(Ro.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ro.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Dg,{...e,ref:t})})}));xl.displayName=kn;var Dg=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...g}=e,m=h.useRef(null),f=Ee(t,m),v=es(s),[p,y]=cr({prop:i,defaultProp:a??null,onChange:c,caller:kn}),[x,b]=h.useState(!1),w=ct(u),_=vl(n),C=h.useRef(!1),[N,E]=h.useState(0);return h.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(qr,w),()=>S.removeEventListener(qr,w)},[w]),l.jsx(Og,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:p,onItemFocus:h.useCallback(S=>y(S),[y]),onItemShiftTab:h.useCallback(()=>b(!0),[]),onFocusableItemAdd:h.useCallback(()=>E(S=>S+1),[]),onFocusableItemRemove:h.useCallback(()=>E(S=>S-1),[]),children:l.jsx(fe.div,{tabIndex:x||N===0?-1:0,"data-orientation":r,...g,ref:f,style:{outline:"none",...e.style},onMouseDown:J(e.onMouseDown,()=>{C.current=!0}),onFocus:J(e.onFocus,S=>{const j=!C.current;if(S.target===S.currentTarget&&j&&!x){const L=new CustomEvent(qr,jg);if(S.currentTarget.dispatchEvent(L),!L.defaultPrevented){const K=_().filter(I=>I.focusable),B=K.find(I=>I.active),Z=K.find(I=>I.id===p),te=[B,Z,...K].filter(Boolean).map(I=>I.ref.current);bl(te,d)}}C.current=!1}),onBlur:J(e.onBlur,()=>b(!1))})})}),yl="RovingFocusGroupItem",wl=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Kn(),u=s||c,d=Fg(yl,n),g=d.currentTabStopId===u,m=vl(n),{onFocusableItemAdd:f,onFocusableItemRemove:v,currentTabStopId:p}=d;return h.useEffect(()=>{if(r)return f(),()=>v()},[r,f,v]),l.jsx(Ro.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(fe.span,{tabIndex:g?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:J(e.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:J(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:J(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=Vg(y,d.orientation,d.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=m().filter(_=>_.focusable).map(_=>_.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const _=w.indexOf(y.currentTarget);w=d.loop?zg(w,_+1):w.slice(_+1)}setTimeout(()=>bl(w))}}),children:typeof i=="function"?i({isCurrentTabStop:g,hasTabStop:p!=null}):i})})});wl.displayName=yl;var $g={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lg(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vg(e,t,n){const r=Lg(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $g[r]}function bl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Sl=xl,_l=wl,Hg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ht=new WeakMap,Ln=new WeakMap,Vn={},Zr=0,Cl=function(e){return e&&(e.host||Cl(e.parentNode))},Gg=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Cl(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})},Bg=function(e,t,n,r){var o=Gg(t,Array.isArray(e)?e:[e]);Vn[n]||(Vn[n]=new WeakMap);var s=Vn[n],i=[],a=new Set,c=new Set(o),u=function(g){!g||a.has(g)||(a.add(g),u(g.parentNode))};o.forEach(u);var d=function(g){!g||c.has(g)||Array.prototype.forEach.call(g.children,function(m){if(a.has(m))d(m);else try{var f=m.getAttribute(r),v=f!==null&&f!=="false",p=(Ht.get(m)||0)+1,y=(s.get(m)||0)+1;Ht.set(m,p),s.set(m,y),i.push(m),p===1&&v&&Ln.set(m,!0),y===1&&m.setAttribute(n,"true"),v||m.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return d(t),a.clear(),Zr++,function(){i.forEach(function(g){var m=Ht.get(g)-1,f=s.get(g)-1;Ht.set(g,m),s.set(g,f),m||(Ln.has(g)||g.removeAttribute(r),Ln.delete(g)),f||g.removeAttribute(n)}),Zr--,Zr||(Ht=new WeakMap,Ht=new WeakMap,Ln=new WeakMap,Vn={})}},Ug=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Hg(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Bg(r,o,n,"aria-hidden")):function(){return null}},Be=function(){return Be=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Be.apply(this,arguments)};function Rl(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Wg(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var qn="right-scroll-bar-position",Zn="width-before-scroll-bar",qg="with-scroll-bars-hidden",Zg="--removed-body-scroll-bar-size";function Kr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Kg(e,t){var n=h.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Xg=typeof window<"u"?h.useLayoutEffect:h.useEffect,ci=new WeakMap;function Yg(e,t){var n=Kg(null,function(r){return e.forEach(function(o){return Kr(o,r)})});return Xg(function(){var r=ci.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||Kr(a,null)}),s.forEach(function(a){o.has(a)||Kr(a,i)})}ci.set(n,e)},[e]),n}function Jg(e){return e}function Qg(e,t){t===void 0&&(t=Jg);var n=[],r=!1,o={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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function ep(e){e===void 0&&(e={});var t=Qg(null);return t.options=Be({async:!0,ssr:!1},e),t}var El=function(e){var t=e.sideCar,n=Rl(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 h.createElement(r,Be({},n))};El.isSideCarExport=!0;function tp(e,t){return e.useMedium(t),El}var kl=ep(),Xr=function(){},vr=h.forwardRef(function(e,t){var n=h.useRef(null),r=h.useState({onScrollCapture:Xr,onWheelCapture:Xr,onTouchMoveCapture:Xr}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,g=e.shards,m=e.sideCar,f=e.noRelative,v=e.noIsolation,p=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,_=Rl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,N=Yg([n,t]),E=Be(Be({},_),o);return h.createElement(h.Fragment,null,d&&h.createElement(C,{sideCar:kl,removeScrollBar:u,shards:g,noRelative:f,noIsolation:v,inert:p,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),i?h.cloneElement(h.Children.only(a),Be(Be({},E),{ref:N})):h.createElement(b,Be({},E,{className:c,ref:N}),a))});vr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vr.classNames={fullWidth:Zn,zeroRight:qn};var np=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function rp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=np();return t&&e.setAttribute("nonce",t),e}function op(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function sp(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ip=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rp())&&(op(t,n),sp(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ap=function(){var e=ip();return function(t,n){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ml=function(){var e=ap(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},lp={left:0,top:0,right:0,gap:0},Yr=function(e){return parseInt(e||"",10)||0},cp=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Yr(n),Yr(r),Yr(o)]},up=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return lp;var t=cp(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])}},dp=Ml(),Kt="data-scroll-locked",fp=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
106
106
  .`.concat(qg,` {
107
107
  overflow: hidden `).concat(r,`;
108
108
  padding-right: `).concat(a,"px ").concat(r,`;
@@ -142,4 +142,4 @@ import{r as Nc,a as h,R as He,j as l,b as qi,g as Ac,c as Tc,d as jc}from"./inde
142
142
  `)},ui=function(){var e=parseInt(document.body.getAttribute(Kt)||"0",10);return isFinite(e)?e:0},mp=function(){h.useEffect(function(){return document.body.setAttribute(Kt,(ui()+1).toString()),function(){var e=ui()-1;e<=0?document.body.removeAttribute(Kt):document.body.setAttribute(Kt,e.toString())}},[])},gp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;mp();var s=h.useMemo(function(){return up(o)},[o]);return h.createElement(dp,{styles:fp(s,!t,o,n?"":"!important")})},Eo=!1;if(typeof window<"u")try{var zn=Object.defineProperty({},"passive",{get:function(){return Eo=!0,!0}});window.addEventListener("test",zn,zn),window.removeEventListener("test",zn,zn)}catch{Eo=!1}var Gt=Eo?{passive:!1}:!1,pp=function(e){return e.tagName==="TEXTAREA"},Nl=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!pp(e)&&n[t]==="visible")},hp=function(e){return Nl(e,"overflowY")},vp=function(e){return Nl(e,"overflowX")},di=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Al(e,r);if(o){var s=Tl(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},xp=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},yp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Al=function(e,t){return e==="v"?hp(t):vp(t)},Tl=function(e,t){return e==="v"?xp(t):yp(t)},wp=function(e,t){return e==="h"&&t==="rtl"?-1:1},bp=function(e,t,n,r,o){var s=wp(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,g=0,m=0;do{if(!a)break;var f=Tl(e,a),v=f[0],p=f[1],y=f[2],x=p-y-s*v;(v||x)&&Al(e,a)&&(g+=x,m+=v);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(g)<1||!d&&Math.abs(m)<1)&&(u=!0),u},Hn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},fi=function(e){return[e.deltaX,e.deltaY]},mi=function(e){return e&&"current"in e?e.current:e},Sp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_p=function(e){return`
143
143
  .block-interactivity-`.concat(e,` {pointer-events: none;}
144
144
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
145
- `)},Cp=0,Bt=[];function Rp(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(Cp++)[0],s=h.useState(Ml)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Wg([e.lockRef.current],(e.shards||[]).map(mi),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=Hn(p),b=n.current,w="deltaX"in p?p.deltaX:b[0]-x[0],_="deltaY"in p?p.deltaY:b[1]-x[1],C,N=p.target,E=Math.abs(w)>Math.abs(_)?"h":"v";if("touches"in p&&E==="h"&&N.type==="range")return!1;var S=di(E,N);if(!S)return!0;if(S?C=E:(C=E==="v"?"h":"v",S=di(E,N)),!S)return!1;if(!r.current&&"changedTouches"in p&&(w||_)&&(r.current=C),!C)return!0;var j=r.current||C;return bp(j,y,p,j==="h"?w:_)},[]),c=h.useCallback(function(p){var y=p;if(!(!Bt.length||Bt[Bt.length-1]!==s)){var x="deltaY"in y?fi(y):Hn(y),b=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&Sp(C.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(i.current.shards||[]).map(mi).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=w.length>0?a(y,w[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),u=h.useCallback(function(p,y,x,b){var w={name:p,delta:y,target:x,should:b,shadowParent:Ep(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(_){return _!==w})},1)},[]),d=h.useCallback(function(p){n.current=Hn(p),r.current=void 0},[]),g=h.useCallback(function(p){u(p.type,fi(p),p.target,a(p,e.lockRef.current))},[]),m=h.useCallback(function(p){u(p.type,Hn(p),p.target,a(p,e.lockRef.current))},[]);h.useEffect(function(){return Bt.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Gt),document.addEventListener("touchmove",c,Gt),document.addEventListener("touchstart",d,Gt),function(){Bt=Bt.filter(function(p){return p!==s}),document.removeEventListener("wheel",c,Gt),document.removeEventListener("touchmove",c,Gt),document.removeEventListener("touchstart",d,Gt)}},[]);var f=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:_p(o)}):null,f?h.createElement(gp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ep(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kp=tp(kl,Rp);var jl=h.forwardRef(function(e,t){return h.createElement(vr,Be({},e,{ref:t,sideCar:kp}))});jl.classNames=vr.classNames;var ko=["Enter"," "],Mp=["ArrowDown","PageUp","Home"],Il=["ArrowUp","PageDown","End"],Np=[...Mp,...Il],Ap={ltr:[...ko,"ArrowRight"],rtl:[...ko,"ArrowLeft"]},Tp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Mn="Menu",[wn,jp,Ip]=Ha(Mn),[Lt,Pl]=Dt(Mn,[Ip,al,hr]),xr=al(),Ol=hr(),[Pp,Vt]=Lt(Mn),[Op,Nn]=Lt(Mn),Fl=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=xr(t),[c,u]=h.useState(null),d=h.useRef(!1),g=ct(s),m=es(o);return h.useEffect(()=>{const f=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx(kg,{...a,children:l.jsx(Pp,{scope:t,open:n,onOpenChange:g,content:c,onContentChange:u,children:l.jsx(Op,{scope:t,onClose:h.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:d,dir:m,modal:i,children:r})})})};Fl.displayName=Mn;var Fp="MenuAnchor",cs=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=xr(n);return l.jsx(Mg,{...o,...r,ref:t})});cs.displayName=Fp;var us="MenuPortal",[Dp,Dl]=Lt(us,{forceMount:void 0}),$l=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Vt(us,t);return l.jsx(Dp,{scope:t,forceMount:n,children:l.jsx($t,{present:n||s.open,children:l.jsx(hl,{asChild:!0,container:o,children:r})})})};$l.displayName=us;var Oe="MenuContent",[$p,ds]=Lt(Oe),Ll=h.forwardRef((e,t)=>{const n=Dl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Vt(Oe,e.__scopeMenu),i=Nn(Oe,e.__scopeMenu);return l.jsx(wn.Provider,{scope:e.__scopeMenu,children:l.jsx($t,{present:r||s.open,children:l.jsx(wn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Lp,{...o,ref:t}):l.jsx(Vp,{...o,ref:t})})})})}),Lp=h.forwardRef((e,t)=>{const n=Vt(Oe,e.__scopeMenu),r=h.useRef(null),o=Ee(t,r);return h.useEffect(()=>{const s=r.current;if(s)return Ug(s)},[]),l.jsx(fs,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Vp=h.forwardRef((e,t)=>{const n=Vt(Oe,e.__scopeMenu);return l.jsx(fs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),zp=vn("MenuContent.ScrollLock"),fs=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,disableOutsideScroll:v,...p}=e,y=Vt(Oe,n),x=Nn(Oe,n),b=xr(n),w=Ol(n),_=jp(n),[C,N]=h.useState(null),E=h.useRef(null),S=Ee(t,E,y.onContentChange),j=h.useRef(0),L=h.useRef(""),K=h.useRef(0),U=h.useRef(null),Z=h.useRef("right"),A=h.useRef(0),te=v?jl:h.Fragment,I=v?{as:zp,allowPinchZoom:!0}:void 0,Q=k=>{var ne,ze;const z=L.current+k,V=_().filter(xe=>!xe.disabled),ee=document.activeElement,se=(ne=V.find(xe=>xe.ref.current===ee))==null?void 0:ne.textValue,ce=V.map(xe=>xe.textValue),be=Qp(ce,z,se),Se=(ze=V.find(xe=>xe.textValue===be))==null?void 0:ze.ref.current;(function xe(_e){L.current=_e,window.clearTimeout(j.current),_e!==""&&(j.current=window.setTimeout(()=>xe(""),1e3))})(z),Se&&setTimeout(()=>Se.focus())};h.useEffect(()=>()=>window.clearTimeout(j.current),[]),Qf();const R=h.useCallback(k=>{var V,ee;return Z.current===((V=U.current)==null?void 0:V.side)&&th(k,(ee=U.current)==null?void 0:ee.area)},[]);return l.jsx($p,{scope:n,searchRef:L,onItemEnter:h.useCallback(k=>{R(k)&&k.preventDefault()},[R]),onItemLeave:h.useCallback(k=>{var z;R(k)||((z=E.current)==null||z.focus(),N(null))},[R]),onTriggerLeave:h.useCallback(k=>{R(k)&&k.preventDefault()},[R]),pointerGraceTimerRef:K,onPointerGraceIntentChange:h.useCallback(k=>{U.current=k},[]),children:l.jsx(te,{...I,children:l.jsx(Wa,{asChild:!0,trapped:o,onMountAutoFocus:J(s,k=>{var z;k.preventDefault(),(z=E.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Ba,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,children:l.jsx(Sl,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:J(c,k=>{x.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Ng,{role:"menu","aria-orientation":"vertical","data-state":tc(y.open),"data-radix-menu-content":"",dir:x.dir,...b,...p,ref:S,style:{outline:"none",...p.style},onKeyDown:J(p.onKeyDown,k=>{const V=k.target.closest("[data-radix-menu-content]")===k.currentTarget,ee=k.ctrlKey||k.altKey||k.metaKey,se=k.key.length===1;V&&(k.key==="Tab"&&k.preventDefault(),!ee&&se&&Q(k.key));const ce=E.current;if(k.target!==ce||!Np.includes(k.key))return;k.preventDefault();const Se=_().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);Il.includes(k.key)&&Se.reverse(),Yp(Se)}),onBlur:J(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(j.current),L.current="")}),onPointerMove:J(e.onPointerMove,bn(k=>{const z=k.target,V=A.current!==k.clientX;if(k.currentTarget.contains(z)&&V){const ee=k.clientX>A.current?"right":"left";Z.current=ee,A.current=k.clientX}}))})})})})})})});Ll.displayName=Oe;var Hp="MenuGroup",ms=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"group",...r,ref:t})});ms.displayName=Hp;var Gp="MenuLabel",Vl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{...r,ref:t})});Vl.displayName=Gp;var er="MenuItem",gi="menu.itemSelect",yr=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=h.useRef(null),i=Nn(er,e.__scopeMenu),a=ds(er,e.__scopeMenu),c=Ee(t,s),u=h.useRef(!1),d=()=>{const g=s.current;if(!n&&g){const m=new CustomEvent(gi,{bubbles:!0,cancelable:!0});g.addEventListener(gi,f=>r==null?void 0:r(f),{once:!0}),ha(g,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(zl,{...o,ref:c,disabled:n,onClick:J(e.onClick,d),onPointerDown:g=>{var m;(m=e.onPointerDown)==null||m.call(e,g),u.current=!0},onPointerUp:J(e.onPointerUp,g=>{var m;u.current||(m=g.currentTarget)==null||m.click()}),onKeyDown:J(e.onKeyDown,g=>{const m=a.searchRef.current!=="";n||m&&g.key===" "||ko.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});yr.displayName=er;var zl=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=ds(er,n),a=Ol(n),c=h.useRef(null),u=Ee(t,c),[d,g]=h.useState(!1),[m,f]=h.useState("");return h.useEffect(()=>{const v=c.current;v&&f((v.textContent??"").trim())},[s.children]),l.jsx(wn.ItemSlot,{scope:n,disabled:r,textValue:o??m,children:l.jsx(_l,{asChild:!0,...a,focusable:!r,children:l.jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:J(e.onPointerMove,bn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,bn(v=>i.onItemLeave(v))),onFocus:J(e.onFocus,()=>g(!0)),onBlur:J(e.onBlur,()=>g(!1))})})})}),Bp="MenuCheckboxItem",Hl=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return l.jsx(ql,{scope:e.__scopeMenu,checked:n,children:l.jsx(yr,{role:"menuitemcheckbox","aria-checked":tr(n)?"mixed":n,...o,ref:t,"data-state":ps(n),onSelect:J(o.onSelect,()=>r==null?void 0:r(tr(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Hl.displayName=Bp;var Gl="MenuRadioGroup",[Up,Wp]=Lt(Gl,{value:void 0,onValueChange:()=>{}}),Bl=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=ct(r);return l.jsx(Up,{scope:e.__scopeMenu,value:n,onValueChange:s,children:l.jsx(ms,{...o,ref:t})})});Bl.displayName=Gl;var Ul="MenuRadioItem",Wl=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=Wp(Ul,e.__scopeMenu),s=n===o.value;return l.jsx(ql,{scope:e.__scopeMenu,checked:s,children:l.jsx(yr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":ps(s),onSelect:J(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Wl.displayName=Ul;var gs="MenuItemIndicator",[ql,qp]=Lt(gs,{checked:!1}),Zl=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=qp(gs,n);return l.jsx($t,{present:r||tr(s.checked)||s.checked===!0,children:l.jsx(fe.span,{...o,ref:t,"data-state":ps(s.checked)})})});Zl.displayName=gs;var Zp="MenuSeparator",Kl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Kl.displayName=Zp;var Kp="MenuArrow",Xl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=xr(n);return l.jsx(Ag,{...o,...r,ref:t})});Xl.displayName=Kp;var Xp="MenuSub",[hx,Yl]=Lt(Xp),dn="MenuSubTrigger",Jl=h.forwardRef((e,t)=>{const n=Vt(dn,e.__scopeMenu),r=Nn(dn,e.__scopeMenu),o=Yl(dn,e.__scopeMenu),s=ds(dn,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const g=a.current;return()=>{window.clearTimeout(g),c(null)}},[a,c]),l.jsx(cs,{asChild:!0,...u,children:l.jsx(zl,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":tc(n.open),...e,ref:lr(t,o.onTriggerChange),onClick:g=>{var m;(m=e.onClick)==null||m.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(e.onPointerMove,bn(g=>{s.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:J(e.onPointerLeave,bn(g=>{var f,v;d();const m=(f=n.content)==null?void 0:f.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,y=p==="right",x=y?-5:5,b=m[y?"left":"right"],w=m[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:b,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:b,y:m.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:J(e.onKeyDown,g=>{var f;const m=s.searchRef.current!=="";e.disabled||m&&g.key===" "||Ap[r.dir].includes(g.key)&&(n.onOpenChange(!0),(f=n.content)==null||f.focus(),g.preventDefault())})})})});Jl.displayName=dn;var Ql="MenuSubContent",ec=h.forwardRef((e,t)=>{const n=Dl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Vt(Oe,e.__scopeMenu),i=Nn(Oe,e.__scopeMenu),a=Yl(Ql,e.__scopeMenu),c=h.useRef(null),u=Ee(t,c);return l.jsx(wn.Provider,{scope:e.__scopeMenu,children:l.jsx($t,{present:r||s.open,children:l.jsx(wn.Slot,{scope:e.__scopeMenu,children:l.jsx(fs,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var g;i.isUsingKeyboardRef.current&&((g=c.current)==null||g.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:J(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:J(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:J(e.onKeyDown,d=>{var f;const g=d.currentTarget.contains(d.target),m=Tp[i.dir].includes(d.key);g&&m&&(s.onOpenChange(!1),(f=a.trigger)==null||f.focus(),d.preventDefault())})})})})})});ec.displayName=Ql;function tc(e){return e?"open":"closed"}function tr(e){return e==="indeterminate"}function ps(e){return tr(e)?"indeterminate":e?"checked":"unchecked"}function Yp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Jp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Qp(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Jp(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function eh(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],u=a.x,d=a.y,g=c.x,m=c.y;d>r!=m>r&&n<(g-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function th(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return eh(n,t)}function bn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var nh=Fl,rh=cs,oh=$l,sh=Ll,ih=ms,ah=Vl,lh=yr,ch=Hl,uh=Bl,dh=Wl,fh=Zl,mh=Kl,gh=Xl,ph=Jl,hh=ec,wr="DropdownMenu",[vh]=Dt(wr,[Pl]),Ne=Pl(),[xh,nc]=vh(wr),rc=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Ne(t),u=h.useRef(null),[d,g]=cr({prop:o,defaultProp:s??!1,onChange:i,caller:wr});return l.jsx(xh,{scope:t,triggerId:Kn(),triggerRef:u,contentId:Kn(),open:d,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),modal:a,children:l.jsx(nh,{...c,open:d,onOpenChange:g,dir:r,modal:a,children:n})})};rc.displayName=wr;var oc="DropdownMenuTrigger",sc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=nc(oc,n),i=Ne(n);return l.jsx(rh,{asChild:!0,...i,children:l.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:lr(t,s.triggerRef),onPointerDown:J(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:J(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});sc.displayName=oc;var yh="DropdownMenuPortal",ic=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ne(t);return l.jsx(oh,{...r,...n})};ic.displayName=yh;var ac="DropdownMenuContent",lc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=nc(ac,n),s=Ne(n),i=h.useRef(!1);return l.jsx(sh,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,a=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:J(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!o.modal||d)&&(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)"}})});lc.displayName=ac;var wh="DropdownMenuGroup",bh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ih,{...o,...r,ref:t})});bh.displayName=wh;var Sh="DropdownMenuLabel",_h=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ah,{...o,...r,ref:t})});_h.displayName=Sh;var Ch="DropdownMenuItem",Rh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(lh,{...o,...r,ref:t})});Rh.displayName=Ch;var Eh="DropdownMenuCheckboxItem",cc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ch,{...o,...r,ref:t})});cc.displayName=Eh;var kh="DropdownMenuRadioGroup",Mh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(uh,{...o,...r,ref:t})});Mh.displayName=kh;var Nh="DropdownMenuRadioItem",Ah=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(dh,{...o,...r,ref:t})});Ah.displayName=Nh;var Th="DropdownMenuItemIndicator",uc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(fh,{...o,...r,ref:t})});uc.displayName=Th;var jh="DropdownMenuSeparator",Ih=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(mh,{...o,...r,ref:t})});Ih.displayName=jh;var Ph="DropdownMenuArrow",Oh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(gh,{...o,...r,ref:t})});Oh.displayName=Ph;var Fh="DropdownMenuSubTrigger",Dh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ph,{...o,...r,ref:t})});Dh.displayName=Fh;var $h="DropdownMenuSubContent",Lh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(hh,{...o,...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)"}})});Lh.displayName=$h;var Vh=rc,zh=sc,Hh=ic,Gh=lc,Bh=cc,Uh=uc;function Wh({...e}){return l.jsx(Vh,{"data-slot":"dropdown-menu",...e})}function qh({...e}){return l.jsx(zh,{"data-slot":"dropdown-menu-trigger",...e})}function Zh({className:e,sideOffset:t=4,...n}){return l.jsx(Hh,{children:l.jsx(Gh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:de("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 Kh({className:e,children:t,checked:n,...r}){return l.jsxs(Bh,{"data-slot":"dropdown-menu-checkbox-item",className:de("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(Uh,{children:l.jsx(Ea,{className:"size-4"})})}),t]})}function hs({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:de("w-full caption-bottom text-sm",e),...t})})}function Xh({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:de("[&_tr]:border-b",e),...t})}function vs({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:de("[&_tr:last-child]:border-0",e),...t})}function we({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:de("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Yh({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:de("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 $({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:de("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function br({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:o={},pageSize:s=25,defaultSorting:i=[]}){var y,x;const[a,c]=h.useState(i),[u,d]=h.useState([]),[g,m]=h.useState(o),[f,v]=h.useState({}),p=Hf({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:d,getCoreRowModel:Tf(),getPaginationRowModel:Df(),getSortedRowModel:$f(),getFilteredRowModel:Ff(),onColumnVisibilityChange:m,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:a,columnFilters:u,columnVisibility:g,rowSelection:f}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(po,{placeholder:r,value:((y=p.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:b=>{var w;return(w=p.getColumn(n))==null?void 0:w.setFilterValue(b.target.value)},className:"max-w-sm"}),l.jsxs(Wh,{children:[l.jsx(qh,{asChild:!0,children:l.jsxs(jt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(ka,{className:"ml-2 h-4 w-4"})]})}),l.jsx(Zh,{align:"end",children:p.getAllColumns().filter(b=>b.getCanHide()).map(b=>l.jsx(Kh,{className:"capitalize",checked:b.getIsVisible(),onCheckedChange:w=>b.toggleVisibility(!!w),children:b.id},b.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(hs,{children:[l.jsx(Xh,{children:p.getHeaderGroups().map(b=>l.jsx(we,{children:b.headers.map(w=>l.jsx(Yh,{children:w.isPlaceholder?null:Bs(w.column.columnDef.header,w.getContext())},w.id))},b.id))}),l.jsx(vs,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(b=>l.jsx(we,{"data-state":b.getIsSelected()&&"selected",children:b.getVisibleCells().map(w=>l.jsx($,{children:Bs(w.column.columnDef.cell,w.getContext())},w.id))},b.id)):l.jsx(we,{children:l.jsx($,{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:[p.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(jt,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),l.jsx(jt,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function me(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",o=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(jt,{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,o==="asc"&&l.jsx(yd,{className:"ml-1 h-3 w-3 text-muted-foreground"}),o==="desc"&&l.jsx(ka,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Jh=300*1e3;function dc(e){const[t,n]=h.useState(new Map),r=h.useRef();return h.useEffect(()=>{const s=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:s,disconnectedAt:void 0})}),c.forEach((u,d)=>{!i.has(d)&&!u.disconnectedAt&&c.set(d,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:u.lastActivity||s})}),c})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,d)=>{if(u.disconnectedAt){const g=new Date(u.disconnectedAt).getTime();i-g>Jh&&c.delete(d)}}),c})};return s(),r.current=setInterval(s,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((s,i)=>s.isConnected!==i.isConnected?s.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(s.lastActivity).getTime())}function pi(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Qh(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 ev(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function tv(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function nv({metrics:e}){const t=e.sessions||[],n=dc(t),r=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:o})=>{const s=o.original,i=s.clientInfo?`${tv(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:me("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:ev(o.getValue("id"))})},{accessorKey:"isConnected",header:me("Status"),cell:({row:o})=>{const s=o.original;return l.jsxs(Tt,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?l.jsx(Aa,{className:"h-3 w-3"}):l.jsx(Na,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:pi(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:pi(o.getValue("lastActivity"))})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"📊 Transport Metrics"}),l.jsx(Ft,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(lt,{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:Qh(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(It,{}),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(br,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function hi(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function rv(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 Gn(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function ov(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function sv(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function iv({metrics:e}){const t=e.sessions||[],n=dc(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},o=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:s})=>{const i=s.original,a=i.clientInfo?`${sv(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:me("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:ov(s.getValue("id"))})},{accessorKey:"connectionStatus",header:me("Status"),cell:({row:s})=>{const i=s.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(Tt,{variant:"success",className:"gap-1",children:[l.jsx(Aa,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(Tt,{variant:"destructive",className:"gap-1",children:[l.jsx(Ma,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[l.jsx(Na,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:hi(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:hi(s.getValue("lastActivity"))})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"📊 Transport Metrics"}),l.jsxs(Ft,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(lt,{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:rv(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 ",Gn(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Gn(e.configuration.staleCheckInterval),", removed after"," ",Gn(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Gn(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(It,{}),l.jsx("div",{children:l.jsx(hs,{children:l.jsxs(vs,{children:[l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.active}),l.jsx($,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.total}),l.jsx($,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs($,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs($,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx($,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx($,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx($,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx($,{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(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx($,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx($,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx($,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx($,{className:"font-medium text-sm",children:"-"}),l.jsx($,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(It,{}),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(br,{columns:o(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function vi(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function av(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 lv(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function cv(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function uv({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:me("Client"),cell:({row:r})=>{const o=r.original,s=`${cv(o.name)}@${o.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${o.name}@${o.version}`,children:s}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",vi(o.firstSeen)]})]})}},{accessorKey:"requestCount",header:me("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:me("Status"),cell:({row:r})=>{const o=r.original;return l.jsx("div",{children:lv(o.lastSeen)?l.jsxs(Tt,{variant:"success",className:"gap-1",children:[l.jsx(pd,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[l.jsx(bd,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:me("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:vi(r.getValue("lastSeen"))})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"📊 Transport Metrics"}),l.jsx(Ft,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(lt,{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(Tt,{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:av(e.uptimeSeconds)})]})]}),l.jsx(It,{}),l.jsx("div",{children:l.jsx(hs,{children:l.jsxs(vs,{children:[l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.total}),l.jsx($,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs($,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx($,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Rd,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs($,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx($,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs($,{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(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx($,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx($,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx($,{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($,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs($,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx($,{className:"font-medium text-sm",children:"-"}),l.jsx($,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(It,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(br,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const dv=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function fv(){const{data:e,error:t}=mn("/api/transport-metrics",dv,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(st,{children:[l.jsx(it,{children:l.jsx(at,{children:"📊 Transport Metrics"})}),l.jsx(lt,{children:l.jsxs(Dd,{variant:"destructive",children:[l.jsx(Ma,{className:"h-4 w-4"}),l.jsx($d,{children:"Error Loading Metrics"}),l.jsxs(Ld,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(nv,{metrics:e}):e.isStateless?l.jsx(uv,{metrics:e}):l.jsx(iv,{metrics:e}):l.jsxs(st,{children:[l.jsx(it,{children:l.jsx(at,{children:"📊 Transport Metrics"})}),l.jsx(lt,{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 mv=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function gv(){const[e,t]=h.useState(!1),{data:n,error:r}=mn("/api/transport-metrics",mv,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),o=!n&&!r,s=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(m=>{let f=m.errors,v,p;if(m.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const b=m.method.replace("tools/call:",""),w=n.gradioMetrics.byTool;w[b]&&(v=w[b].success,p=w[b].failure,f+=p)}const y=m.count>0?f/m.count*100:0;return{method:m.method,count:m.count,errors:f,errorRate:y,averageResponseTime:m.averageResponseTime,lastCalled:m.lastCalled,gradioSuccess:v,gradioFailure:p}}),a=e?i.filter(m=>m.method.startsWith("tools/call")||m.method.startsWith("prompts/get")):i,c=i.reduce((m,f)=>m+f.count,0),u=i.filter(m=>m.method.startsWith("tools/call")).reduce((m,f)=>m+f.count,0),d=i.filter(m=>m.method.startsWith("prompts/get")).reduce((m,f)=>m+f.count,0),g=[{accessorKey:"method",header:me("Method"),cell:({row:m})=>{const f=m.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:f==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):f.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:f.replace("tools/call:","")})]}):f==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):f.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:f.replace("prompts/get:","")})]}):f})}},{accessorKey:"count",header:me("Calls","right"),cell:({row:m})=>l.jsx("div",{className:"text-right font-mono",children:m.getValue("count").toLocaleString()})},{accessorKey:"errors",header:me("Errors","right"),cell:({row:m})=>{const f=m.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f}):"0"})}},{accessorKey:"gradioMetrics",header:me("Success/Failure","right"),cell:({row:m})=>{const f=m.original;return f.gradioSuccess!==void 0&&f.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:f.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:me("Error Rate","right"),cell:({row:m})=>{const f=m.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[f.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:me("Avg Response","right"),cell:({row:m})=>{const f=m.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:f?`${f.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:me("Last Called","right"),cell:({row:m})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(m.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"HTTP JSON Transport Statistics"}),l.jsxs(Ft,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(lt,{children:[o&&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]})}),s&&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&&!s&&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:d.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Zo,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:m=>t(!!m)}),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(br,{columns:g,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 xi(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 pv({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"}},o=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},s=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>s()?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:o()}),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 ${xi(n).isWarning?"text-red-500":""}`,children:xi(n).text})]})]})})}var Sr="Tabs",[hv]=Dt(Sr,[hr]),fc=hr(),[vv,xs]=hv(Sr),mc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=es(a),[g,m]=cr({prop:r,onChange:o,defaultProp:s??"",caller:Sr});return l.jsx(vv,{scope:n,baseId:Kn(),value:g,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(fe.div,{dir:d,"data-orientation":i,...u,ref:t})})});mc.displayName=Sr;var gc="TabsList",pc=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=xs(gc,n),i=fc(n);return l.jsx(Sl,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(fe.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});pc.displayName=gc;var hc="TabsTrigger",vc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=xs(hc,n),a=fc(n),c=wc(i.baseId,r),u=bc(i.baseId,r),d=r===i.value;return l.jsx(_l,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(fe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:J(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?i.onValueChange(r):g.preventDefault()}),onKeyDown:J(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(r)}),onFocus:J(e.onFocus,()=>{const g=i.activationMode!=="manual";!d&&!o&&g&&i.onValueChange(r)})})})});vc.displayName=hc;var xc="TabsContent",yc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=xs(xc,n),c=wc(a.baseId,r),u=bc(a.baseId,r),d=r===a.value,g=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx($t,{present:o||d,children:({present:m})=>l.jsx(fe.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});yc.displayName=xc;function wc(e,t){return`${e}-trigger-${t}`}function bc(e,t){return`${e}-content-${t}`}var xv=mc,yv=pc,wv=vc,bv=yc;function Sv({className:e,...t}){return l.jsx(xv,{"data-slot":"tabs",className:de("flex flex-col gap-2",e),...t})}function _v({className:e,...t}){return l.jsx(yv,{"data-slot":"tabs-list",className:de("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Ut({className:e,...t}){return l.jsx(wv,{"data-slot":"tabs-trigger",className:de("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 Wt({className:e,...t}){return l.jsx(bv,{"data-slot":"tabs-content",className:de("flex-1 outline-none",e),...t})}const yi="ALLOW_README_INCLUDE",wi="NO_GRADIO_IMAGE_CONTENT";var ae;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ae||(ae={}));var bi;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(bi||(bi={}));const F=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vt=e=>{switch(typeof e){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(e)?F.nan:F.number;case"boolean":return F.boolean;case"function":return F.function;case"bigint":return F.bigint;case"symbol":return F.symbol;case"object":return Array.isArray(e)?F.array:e===null?F.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?F.promise:typeof Map<"u"&&e instanceof Map?F.map:typeof Set<"u"&&e instanceof Set?F.set:typeof Date<"u"&&e instanceof Date?F.date:F.object;default:return F.unknown}},M=ae.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 ft 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(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,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 o(this),r}static assert(t){if(!(t instanceof ft))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ft.create=e=>new ft(e);const Mo=(e,t)=>{let n;switch(e.code){case M.invalid_type:e.received===F.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case M.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ae.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:n=`Unrecognized key(s) in object: ${ae.joinValues(e.keys,", ")}`;break;case M.invalid_union:n="Invalid input";break;case M.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ae.joinValues(e.options)}`;break;case M.invalid_enum_value:n=`Invalid enum value. Expected ${ae.joinValues(e.options)}, received '${e.received}'`;break;case M.invalid_arguments:n="Invalid function arguments";break;case M.invalid_return_type:n="Invalid function return type";break;case M.invalid_date:n="Invalid date";break;case M.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}"`:ae.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case M.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 M.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 M.custom:n="Invalid input";break;case M.invalid_intersection_types:n="Intersection results could not be merged";break;case M.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case M.not_finite:n="Number must be finite";break;default:n=t.defaultError,ae.assertNever(e)}return{message:n}};let Cv=Mo;function Rv(){return Cv}const Ev=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function T(e,t){const n=Rv(),r=Ev({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Mo?void 0:Mo].filter(o=>!!o)});e.common.issues.push(r)}class Me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return q;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return Me.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return q;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const q=Object.freeze({status:"aborted"}),fn=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),Si=e=>e.status==="aborted",_i=e=>e.status==="dirty",Yt=e=>e.status==="valid",nr=e=>typeof Promise<"u"&&e instanceof Promise;var D;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(D||(D={}));class Ke{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ci=(e,t)=>{if(Yt(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 ft(e.common.issues);return this._error=n,this._error}}};function X(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{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:o}}class oe{get description(){return this._def.description}_getType(t){return vt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:vt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Me,ctx:{common:t.parent.common,data:t.data,parsedType:vt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(nr(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:vt(t)},o=this._parseSync({data:t,path:r.path,parent:r});return Ci(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:vt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Yt(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(o=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>Yt(s)?{value:s.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:vt(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(nr(o)?o:Promise.resolve(o));return Ci(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:M.custom,...r(o)});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,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new en({schema:this,typeName:W.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 bt.create(this,this._def)}nullable(){return tn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return ar.create(this,this._def)}or(t){return or.create([this,t],this._def)}and(t){return sr.create(this,t,this._def)}transform(t){return new en({...X(this._def),schema:this,typeName:W.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new jo({...X(this._def),innerType:this,defaultValue:n,typeName:W.ZodDefault})}brand(){return new Kv({typeName:W.ZodBranded,type:this,...X(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Io({...X(this._def),innerType:this,catchValue:n,typeName:W.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ys.create(this,t)}readonly(){return Po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const kv=/^c[^\s-]{8,}$/i,Mv=/^[0-9a-z]+$/,Nv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Av=/^[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,Tv=/^[a-z0-9_-]{21}$/i,jv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Iv=/^[-+]?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)?)??$/,Pv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ov="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Jr;const Fv=/^(?:(?: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])$/,Dv=/^(?:(?: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])$/,$v=/^(([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]))$/,Lv=/^(([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])$/,Vv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sc="((\\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])))",Hv=new RegExp(`^${Sc}$`);function _c(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 Gv(e){return new RegExp(`^${_c(e)}$`)}function Bv(e){let t=`${Sc}T${_c(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 Uv(e,t){return!!((t==="v4"||!t)&&Fv.test(e)||(t==="v6"||!t)&&$v.test(e))}function Wv(e,t){if(!jv.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,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function qv(e,t){return!!((t==="v4"||!t)&&Dv.test(e)||(t==="v6"||!t)&&Lv.test(e))}class ot extends oe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==F.string){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_type,expected:F.string,received:s.parsedType}),q}const r=new Me;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?T(o,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&T(o,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Pv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"email",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Jr||(Jr=new RegExp(Ov,"u")),Jr.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"emoji",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Av.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"uuid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Tv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"nanoid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")kv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cuid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Mv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cuid2",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Nv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"ulid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),T(o,{validation:"url",code:M.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"regex",code:M.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Bv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Hv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Gv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Iv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"duration",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Uv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"ip",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Wv(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"jwt",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?qv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cidr",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Vv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"base64",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?zv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"base64url",code:M.invalid_string,message:s.message}),r.dirty()):ae.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:M.invalid_string,...D.errToObj(r)})}_addCheck(t){return new ot({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...D.errToObj(t)})}url(t){return this._addCheck({kind:"url",...D.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...D.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...D.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...D.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...D.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...D.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...D.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...D.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...D.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...D.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...D.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...D.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,...D.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,...D.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...D.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...D.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...D.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...D.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...D.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...D.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...D.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...D.errToObj(n)})}nonempty(t){return this.min(1,D.errToObj(t))}trim(){return new ot({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ot({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ot({...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}}ot.create=e=>new ot({checks:[],typeName:W.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...X(e)});function Zv(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Jt extends oe{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)!==F.number){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_type,expected:F.number,received:s.parsedType}),q}let r;const o=new Me;for(const s of this._def.checks)s.kind==="int"?ae.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:M.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Zv(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:M.not_finite,message:s.message}),o.dirty()):ae.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,D.toString(n))}gt(t,n){return this.setLimit("min",t,!1,D.toString(n))}lte(t,n){return this.setLimit("max",t,!0,D.toString(n))}lt(t,n){return this.setLimit("max",t,!1,D.toString(n))}setLimit(t,n,r,o){return new Jt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:D.toString(o)}]})}_addCheck(t){return new Jt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:D.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:D.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:D.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.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"&&ae.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)}}Jt.create=e=>new Jt({checks:[],typeName:W.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...X(e)});class Sn extends oe{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)!==F.bigint)return this._getInvalidInput(t);let r;const o=new Me;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ae.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return T(n,{code:M.invalid_type,expected:F.bigint,received:n.parsedType}),q}gte(t,n){return this.setLimit("min",t,!0,D.toString(n))}gt(t,n){return this.setLimit("min",t,!1,D.toString(n))}lte(t,n){return this.setLimit("max",t,!0,D.toString(n))}lt(t,n){return this.setLimit("max",t,!1,D.toString(n))}setLimit(t,n,r,o){return new Sn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:D.toString(o)}]})}_addCheck(t){return new Sn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:D.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}}Sn.create=e=>new Sn({checks:[],typeName:W.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...X(e)});class No extends oe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==F.boolean){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.boolean,received:r.parsedType}),q}return Fe(t.data)}}No.create=e=>new No({typeName:W.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...X(e)});class rr extends oe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==F.date){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_type,expected:F.date,received:s.parsedType}),q}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_date}),q}const r=new Me;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ae.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new rr({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:D.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:D.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}}rr.create=e=>new rr({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:W.ZodDate,...X(e)});class Ri extends oe{_parse(t){if(this._getType(t)!==F.symbol){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.symbol,received:r.parsedType}),q}return Fe(t.data)}}Ri.create=e=>new Ri({typeName:W.ZodSymbol,...X(e)});class Ei extends oe{_parse(t){if(this._getType(t)!==F.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.undefined,received:r.parsedType}),q}return Fe(t.data)}}Ei.create=e=>new Ei({typeName:W.ZodUndefined,...X(e)});class ki extends oe{_parse(t){if(this._getType(t)!==F.null){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.null,received:r.parsedType}),q}return Fe(t.data)}}ki.create=e=>new ki({typeName:W.ZodNull,...X(e)});class Ao extends oe{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}}Ao.create=e=>new Ao({typeName:W.ZodAny,...X(e)});class Mi extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}}Mi.create=e=>new Mi({typeName:W.ZodUnknown,...X(e)});class kt extends oe{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:M.invalid_type,expected:F.never,received:n.parsedType}),q}}kt.create=e=>new kt({typeName:W.ZodNever,...X(e)});class Ni extends oe{_parse(t){if(this._getType(t)!==F.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.void,received:r.parsedType}),q}return Fe(t.data)}}Ni.create=e=>new Ni({typeName:W.ZodVoid,...X(e)});class qe extends oe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==F.array)return T(n,{code:M.invalid_type,expected:F.array,received:n.parsedType}),q;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(T(n,{code:i?M.too_big:M.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(T(n,{code:M.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(T(n,{code:M.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Ke(n,i,n.path,a)))).then(i=>Me.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new Ke(n,i,n.path,a)));return Me.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new qe({...this._def,minLength:{value:t,message:D.toString(n)}})}max(t,n){return new qe({...this._def,maxLength:{value:t,message:D.toString(n)}})}length(t,n){return new qe({...this._def,exactLength:{value:t,message:D.toString(n)}})}nonempty(t){return this.min(1,t)}}qe.create=(e,t)=>new qe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:W.ZodArray,...X(t)});function qt(e){if(e instanceof ve){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=bt.create(qt(r))}return new ve({...e._def,shape:()=>t})}else return e instanceof qe?new qe({...e._def,type:qt(e.element)}):e instanceof bt?bt.create(qt(e.unwrap())):e instanceof tn?tn.create(qt(e.unwrap())):e instanceof Ot?Ot.create(e.items.map(t=>qt(t))):e}class ve extends oe{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=ae.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==F.object){const u=this._getOrReturnCtx(t);return T(u,{code:M.invalid_type,expected:F.object,received:u.parsedType}),q}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof kt&&this._def.unknownKeys==="strip"))for(const u in o.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=s[u],g=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Ke(o,g,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof kt){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(T(o,{code:M.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 d of a){const g=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Ke(o,g,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const g=await d.key,m=await d.value;u.push({key:g,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>Me.mergeObjectSync(r,u)):Me.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return D.errToObj,new ve({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i;const o=((i=(s=this._def).errorMap)==null?void 0:i.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:D.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new ve({...this._def,unknownKeys:"strip"})}passthrough(){return new ve({...this._def,unknownKeys:"passthrough"})}extend(t){return new ve({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ve({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:W.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ve({...this._def,catchall:t})}pick(t){const n={};for(const r of ae.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ve({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ae.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new ve({...this._def,shape:()=>n})}deepPartial(){return qt(this)}partial(t){const n={};for(const r of ae.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new ve({...this._def,shape:()=>n})}required(t){const n={};for(const r of ae.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof bt;)s=s._def.innerType;n[r]=s}return new ve({...this._def,shape:()=>n})}keyof(){return Cc(ae.objectKeys(this.shape))}}ve.create=(e,t)=>new ve({shape:()=>e,unknownKeys:"strip",catchall:kt.create(),typeName:W.ZodObject,...X(t)});ve.strictCreate=(e,t)=>new ve({shape:()=>e,unknownKeys:"strict",catchall:kt.create(),typeName:W.ZodObject,...X(t)});ve.lazycreate=(e,t)=>new ve({shape:e,unknownKeys:"strip",catchall:kt.create(),typeName:W.ZodObject,...X(t)});class or extends oe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new ft(a.ctx.common.issues));return T(n,{code:M.invalid_union,unionErrors:i}),q}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(c=>new ft(c));return T(n,{code:M.invalid_union,unionErrors:a}),q}}get options(){return this._def.options}}or.create=(e,t)=>new or({options:e,typeName:W.ZodUnion,...X(t)});function To(e,t){const n=vt(e),r=vt(t);if(e===t)return{valid:!0,data:e};if(n===F.object&&r===F.object){const o=ae.objectKeys(t),s=ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const c=To(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===F.array&&r===F.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],c=To(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===F.date&&r===F.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class sr extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(Si(s)||Si(i))return q;const a=To(s.value,i.value);return a.valid?((_i(s)||_i(i))&&n.dirty(),{status:n.value,value:a.data}):(T(r,{code:M.invalid_intersection_types}),q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}sr.create=(e,t,n)=>new sr({left:e,right:t,typeName:W.ZodIntersection,...X(n)});class Ot extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==F.array)return T(r,{code:M.invalid_type,expected:F.array,received:r.parsedType}),q;if(r.data.length<this._def.items.length)return T(r,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Ke(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Me.mergeArray(n,i)):Me.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Ot({...this._def,rest:t})}}Ot.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ot({items:e,typeName:W.ZodTuple,rest:null,...X(t)})};class ir extends oe{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!==F.object)return T(r,{code:M.invalid_type,expected:F.object,received:r.parsedType}),q;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new Ke(r,a,r.path,a)),value:i._parse(new Ke(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Me.mergeObjectAsync(n,o):Me.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof oe?new ir({keyType:t,valueType:n,typeName:W.ZodRecord,...X(r)}):new ir({keyType:ot.create(),valueType:t,typeName:W.ZodRecord,...X(n)})}}class Ai extends oe{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!==F.map)return T(r,{code:M.invalid_type,expected:F.map,received:r.parsedType}),q;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:o._parse(new Ke(r,a,r.path,[u,"key"])),value:s._parse(new Ke(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,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return q;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return q;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}Ai.create=(e,t,n)=>new Ai({valueType:t,keyType:e,typeName:W.ZodMap,...X(n)});class _n extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==F.set)return T(r,{code:M.invalid_type,expected:F.set,received:r.parsedType}),q;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(T(r,{code:M.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(T(r,{code:M.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return q;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>s._parse(new Ke(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new _n({...this._def,minSize:{value:t,message:D.toString(n)}})}max(t,n){return new _n({...this._def,maxSize:{value:t,message:D.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:W.ZodSet,...X(t)});class Ti extends oe{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})}}Ti.create=(e,t)=>new Ti({getter:e,typeName:W.ZodLazy,...X(t)});class ji extends oe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return T(n,{received:n.data,code:M.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:t.data}}get value(){return this._def.value}}ji.create=(e,t)=>new ji({value:e,typeName:W.ZodLiteral,...X(t)});function Cc(e,t){return new Qt({values:e,typeName:W.ZodEnum,...X(t)})}class Qt extends oe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{expected:ae.joinValues(r),received:n.parsedType,code:M.invalid_type}),q}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:M.invalid_enum_value,options:r}),q}return Fe(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 Qt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Qt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Qt.create=Cc;class Ii extends oe{_parse(t){const n=ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==F.string&&r.parsedType!==F.number){const o=ae.objectValues(n);return T(r,{expected:ae.joinValues(o),received:r.parsedType,code:M.invalid_type}),q}if(this._cache||(this._cache=new Set(ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=ae.objectValues(n);return T(r,{received:r.data,code:M.invalid_enum_value,options:o}),q}return Fe(t.data)}get enum(){return this._def.values}}Ii.create=(e,t)=>new Ii({values:e,typeName:W.ZodNativeEnum,...X(t)});class ar extends oe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==F.promise&&n.common.async===!1)return T(n,{code:M.invalid_type,expected:F.promise,received:n.parsedType}),q;const r=n.parsedType===F.promise?n.data:Promise.resolve(n.data);return Fe(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ar.create=(e,t)=>new ar({type:e,typeName:W.ZodPromise,...X(t)});class en extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===W.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{T(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return q;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?q:c.status==="dirty"||n.value==="dirty"?fn(c.value):c});{if(n.value==="aborted")return q;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?q:a.status==="dirty"||n.value==="dirty"?fn(a.value):a}}if(o.type==="refinement"){const i=a=>{const c=o.refinement(a,s);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"?q:(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"?q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Yt(i))return q;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Yt(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):q);ae.assertNever(o)}}en.create=(e,t,n)=>new en({schema:e,typeName:W.ZodEffects,effect:t,...X(n)});en.createWithPreprocess=(e,t,n)=>new en({schema:t,effect:{type:"preprocess",transform:e},typeName:W.ZodEffects,...X(n)});class bt extends oe{_parse(t){return this._getType(t)===F.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}bt.create=(e,t)=>new bt({innerType:e,typeName:W.ZodOptional,...X(t)});class tn extends oe{_parse(t){return this._getType(t)===F.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tn.create=(e,t)=>new tn({innerType:e,typeName:W.ZodNullable,...X(t)});class jo extends oe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===F.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jo.create=(e,t)=>new jo({innerType:e,typeName:W.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});class Io extends oe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return nr(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Io.create=(e,t)=>new Io({innerType:e,typeName:W.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});class Pi extends oe{_parse(t){if(this._getType(t)!==F.nan){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.nan,received:r.parsedType}),q}return{status:"valid",value:t.data}}}Pi.create=e=>new Pi({typeName:W.ZodNaN,...X(e)});class Kv extends oe{_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 ys extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?q:s.status==="dirty"?(n.dirty(),fn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new ys({in:t,out:n,typeName:W.ZodPipeline})}}class Po extends oe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Yt(o)&&(o.value=Object.freeze(o.value)),o);return nr(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Po.create=(e,t)=>new Po({innerType:e,typeName:W.ZodReadonly,...X(t)});var W;(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"})(W||(W={}));const B=ot.create,ln=Jt.create,Ye=No.create,Xv=Ao.create;kt.create;const nn=qe.create,pe=ve.create,Rc=or.create;sr.create;Ot.create;const Cn=ir.create,Mt=Qt.create;ar.create;bt.create;tn.create;const Yv=10,Oo={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:pe({query:B().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:ln().optional().default(Yv).describe("Number of results to return"),mcp:Ye().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},Fo={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:pe({query:B().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:B().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:B().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:B().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:Mt(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:ln().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var Qr=65536;Jv();function Jv(){try{return new Uint32Array(Qr)}catch{const t=new Array(Qr);for(let n=0;n<Qr;n++)t[n]=0;return t}}const Qv={name:"model_details",schema:pe({model_id:B().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")})};pe({model_id:B().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const Do={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:pe({query:B().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:ln().optional().default(12).describe("Number of results to return"),concise_only:Ye().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"}},$o={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:pe({query:B().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:B().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:nn(B()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:Mt(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:ln().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},ex={name:"dataset_details",schema:pe({dataset_id:B().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")})};pe({dataset_id:B().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const Lo={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified.",schema:pe({repo_ids:nn(B().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:Mt(["model","dataset","space"]).optional().describe("Specify lookup type; otherwise auto-detects"),include_readme:Ye().default(!1).describe("Include README from the repo")}),annotations:{title:"Hub Repo Details"}},Ec={name:"duplicate_space",schema:pe({sourceSpaceId:B().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:B().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:Mt(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:Ye().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}};pe({username:B().optional().describe("Username to get spaces for (defaults to authenticated user)")});const kc={name:"space_files",schema:pe({spaceName:B().optional().describe('Space identifier in format "username/spacename"'),fileType:Mt(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};pe({fileType:Mt(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});pe({});pe({user_id:B().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")});pe({paper_id:B().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 ws=typeof window<"u"?window:{};function tx(){var e=ws.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function nx(){var e=function(){};return rx()?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 rx(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{ws.ActiveXObject&&(e=!0)}return e}tx()?ws.DOMParser:nx();const Vo={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:pe({doc_url:B().max(200,"Query too long").describe("Documentation URL (Hugging Face or Gradio)"),offset:ln().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"}},zo={name:"hf_doc_search",description:"Search and Discover Hugging Face Product and Library documentation. Send an empty query to discover structure and navigation instructions. You MUST consult this tool for the most up-to-date information when using Hugging Face libraries. Combine with the Product filter to focus results.",schema:pe({query:B().max(200,"Query too long").superRefine((e,t)=>{const n=e.trim();n.length!==0&&n.length<3&&t.addIssue({code:M.too_small,type:"string",minimum:3,inclusive:!0,message:"Supply at least one search term"})}).describe("Start with an empty query for structure, endpoint discovery and navigation tips. Use semantic queries for targetted searches."),product:B().optional().describe("Filter by Product. Supply when known for focused results")}),annotations:{title:"Hugging Face Documentation Search"}};pe({space_id:B().min(1).describe("Space ID in 'username/repo' format")});var Bn={},eo,Oi;function ox(){return Oi||(Oi=1,eo=function(t){return t.map(function(n){return n===""?"''":n&&typeof n=="object"?n.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(n)&&!/'/.test(n)?"'"+n.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(n)?'"'+n.replace(/(["\\$`!])/g,"\\$1")+'"':String(n).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}),eo}var to,Fi;function sx(){if(Fi)return to;Fi=1;for(var e="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",t=new RegExp("^"+e+"$"),n="|&;()<> \\t",r='"((\\\\"|[^"])*?)"',o="'((\\\\'|[^'])*?)'",s=/^#$/,i="'",a='"',c="$",u="",d=4294967296,g=0;g<4;g++)u+=(d*Math.random()).toString(16);var m=new RegExp("^"+u);function f(y,x){for(var b=x.lastIndex,w=[],_;_=x.exec(y);)w.push(_),x.lastIndex===_.index&&(x.lastIndex+=1);return x.lastIndex=b,w}function v(y,x,b){var w=typeof y=="function"?y(b):y[b];return typeof w>"u"&&b!=""?w="":typeof w>"u"&&(w="$"),typeof w=="object"?x+u+JSON.stringify(w)+u:x+w}function p(y,x,b){b||(b={});var w=b.escape||"\\",_="(\\"+w+`['"`+n+`]|[^\\s'"`+n+"])+",C=new RegExp(["("+e+")","("+_+"|"+r+"|"+o+")+"].join("|"),"g"),N=f(y,C);if(N.length===0)return[];x||(x={});var E=!1;return N.map(function(S){var j=S[0];if(!j||E)return;if(t.test(j))return{op:j};var L=!1,K=!1,U="",Z=!1,A;function te(){A+=1;var R,k,z=j.charAt(A);if(z==="{"){if(A+=1,j.charAt(A)==="}")throw new Error("Bad substitution: "+j.slice(A-2,A+1));if(R=j.indexOf("}",A),R<0)throw new Error("Bad substitution: "+j.slice(A));k=j.slice(A,R),A=R}else if(/[*@#?$!_-]/.test(z))k=z,A+=1;else{var V=j.slice(A);R=V.match(/[^\w\d_]/),R?(k=V.slice(0,R.index),A+=R.index-1):(k=V,A=j.length)}return v(x,"",k)}for(A=0;A<j.length;A++){var I=j.charAt(A);if(Z=Z||!L&&(I==="*"||I==="?"),K)U+=I,K=!1;else if(L)I===L?L=!1:L==i?U+=I:I===w?(A+=1,I=j.charAt(A),I===a||I===w||I===c?U+=I:U+=w+I):I===c?U+=te():U+=I;else if(I===a||I===i)L=I;else{if(t.test(I))return{op:j};if(s.test(I)){E=!0;var Q={comment:y.slice(S.index+A+1)};return U.length?[U,Q]:[Q]}else I===w?K=!0:I===c?U+=te():U+=I}}return Z?{op:"glob",pattern:U}:U}).reduce(function(S,j){return typeof j>"u"?S:S.concat(j)},[])}return to=function(x,b,w){var _=p(x,b,w);return typeof b!="function"?_:_.reduce(function(C,N){if(typeof N=="object")return C.concat(N);var E=N.split(RegExp("("+u+".*?"+u+")","g"));return E.length===1?C.concat(E[0]):C.concat(E.filter(Boolean).map(function(S){return m.test(S)?JSON.parse(S.split(u)[1]):S}))},[])},to}var Di;function ix(){return Di||(Di=1,Bn.quote=ox(),Bn.parse=sx()),Bn}ix();const ax=["cpu-basic","cpu-upgrade","cpu-performance","cpu-xl"],lx=["sprx8","zero-a10g","t4-small","t4-medium","l4x1","l4x4","l40sx1","l40sx4","l40sx8","a10g-small","a10g-large","a10g-largex2","a10g-largex4","a100-large","h100","h100x8"],cx=["inf2x6"],Ho=[...ax,...lx,...cx],Nt=pe({namespace:B().optional().describe("Target namespace (username or organization). Defaults to current user.")}),ux=Nt.extend({image:B().describe('Docker image or HF Space URL (e.g., "python:3.12" or "hf.co/spaces/user/space")'),command:Rc([B(),nn(B())]).describe('Command to execute. Array format recommended (e.g., ["python", "script.py"]). String format is parsed with POSIX shell semantics (quotes, escaping). For multiline scripts, use array with newlines in arguments.'),flavor:Mt(Ho).optional().default("cpu-basic").describe(`Hardware flavor. Options: ${Ho.join(", ")}`),env:Cn(B()).optional().describe("Environment variables as key-value pairs"),secrets:Cn(B()).optional().describe("Secret environment variables (encrypted server-side)"),timeout:B().optional().describe('Max duration (e.g., "5m", "2h", "30s"). Default: 30m').default("30m"),detach:Ye().optional().default(!0).describe("Run in background and return immediately (default: true)")}),dx=Nt.extend({script:B().describe("Python script: local file path, URL, or inline code. UV will handle dependencies automatically."),repo:B().optional().describe("Persistent repository name for script storage"),with_deps:nn(B()).optional().describe("Additional package dependencies"),script_args:nn(B()).optional().describe("Arguments to pass to the script"),python:B().optional().describe('Python interpreter version (e.g., "3.12")'),flavor:Mt(Ho).optional().default("cpu-basic").describe("Hardware flavor"),env:Cn(B()).optional().describe("Environment variables"),secrets:Cn(B()).optional().describe("Secret environment variables"),timeout:B().optional().default("30m").describe("Max duration"),detach:Ye().optional().default(!0).describe("Run in background")});Nt.extend({all:Ye().optional().default(!1).describe("Show all jobs (default: only running)"),status:B().optional().describe('Filter by status (e.g., "RUNNING", "COMPLETED")')});Nt.extend({job_id:B().describe("Job ID to fetch logs from"),tail:ln().optional().default(20).describe("Number of lines to return (default: 20)")});Nt.extend({job_id:Rc([B(),nn(B())]).describe("Job ID(s) to inspect")});Nt.extend({job_id:B().describe("Job ID to cancel")});ux.extend({schedule:B().describe("Schedule: cron expression or shorthand (@hourly, @daily, @weekly, @monthly, @yearly)"),suspend:Ye().optional().default(!1).describe("Create in suspended state")});dx.extend({schedule:B().describe("Schedule: cron expression or shorthand"),suspend:Ye().optional().default(!1).describe("Create in suspended state")});Nt.extend({all:Ye().optional().default(!1).describe("Show all scheduled jobs (default: hide suspended)")});Nt.extend({scheduled_job_id:B().describe("Scheduled job ID")});pe({command:B().optional().describe('Command to execute: "run", "uv", "ps", "logs", "inspect", "cancel", "scheduled run", "scheduled uv", "scheduled ps", "scheduled inspect", "scheduled delete", "scheduled suspend", "scheduled resume"'),args:Cn(Xv()).optional().describe("Command-specific arguments as a JSON object")});const $i=Oo.name,Li=Fo.name,fx=Qv.name,Vi=Do.name,zi=$o.name,mx=ex.name,pn=Lo.name,Hi=Ec.name,Gi=kc.name,Bi=zo.name,Ui=Vo.name;function Wi(e){const t=new Set,n=[];let r=!1;for(const o of e){if(o===fx||o===mx){r=!0;continue}t.has(o)||(t.add(o),n.push(o))}return r&&!t.has(pn)&&(t.add(pn),n.push(pn)),n}const no=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function gx(){var S,j,L,K,U,Z,A,te,I,Q,R;const{data:e,error:t}=mn("/api/transport",no,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});mn("/api/sessions",no,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=mn("/api/settings",no),r=((S=n==null?void 0:n.builtInTools)==null?void 0:S.includes(yi))??!1,o=((j=n==null?void 0:n.builtInTools)==null?void 0:j.includes(wi))??!1,[s,i]=h.useState(["","",""]),[a,c]=h.useState(["","",""]),[u,d]=h.useState([!1,!1,!1]),[g,m]=h.useState(!1);h.useEffect(()=>{if(n!=null&&n.spaceTools&&!g){const k=["","",""],z=["","",""],V=[!1,!1,!1];n.spaceTools.forEach((ee,se)=>{se<3&&(k[se]=ee.name,z[se]=ee.subdomain,V[se]=!0)}),i(k),c(z),d(V),m(!0)}},[n,g]);const f=!e&&!t,v=t?t.message:null,p=async(k,z)=>{try{const V=n||{builtInTools:[]},ee=Wi(V.builtInTools),se=z?[...ee.filter(ne=>ne!==k),k]:ee.filter(ne=>ne!==k),ce=Wi(se),be={...V,builtInTools:ce};Un("/api/settings",be,!1);const Se=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:ce})});if(!Se.ok)throw new Error(`Failed to update tool settings: ${Se.status}`);Un("/api/settings"),console.log(`${k} is now ${z?"enabled":"disabled"}`)}catch(V){console.error("Error updating tool settings:",V),alert(`Error updating ${k}: ${V instanceof Error?V.message:"Unknown error"}`),Un("/api/settings")}},y=async(k,z)=>{const V=[...u];V[k]=z,d(V),await w(V)},x=async(k,z)=>{const V=[...s];V[k]=z,i(V),u[k]&&await w(u)},b=async(k,z)=>{const V=[...a];V[k]=z,c(V),u[k]&&await w(u)},w=async k=>{try{const z=[];for(let ee=0;ee<3;ee++)k[ee]&&s[ee]&&a[ee]&&z.push({_id:`space-${ee}`,name:s[ee],subdomain:a[ee],emoji:"🔧"});const V=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:z})});if(!V.ok)throw new Error(`Failed to update space tools: ${V.status}`)}catch(z){console.error("Error updating space tools:",z)}},_=async()=>{const k="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(k)}catch(z){console.error("Failed to copy URL:",z)}},C=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},N={paper_search:{id:Vi,label:Do.annotations.title,description:Do.description,settings:{enabled:((L=n==null?void 0:n.builtInTools)==null?void 0:L.includes(Vi))??!0}},space_search:{id:$i,label:Oo.annotations.title,description:Oo.description,settings:{enabled:((K=n==null?void 0:n.builtInTools)==null?void 0:K.includes($i))??!0}},model_search:{id:Li,label:Fo.annotations.title,description:Fo.description,settings:{enabled:((U=n==null?void 0:n.builtInTools)==null?void 0:U.includes(Li))??!0}},dataset_search:{id:zi,label:$o.annotations.title,description:$o.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(zi))??!0}},hub_repo_details:{id:pn,label:Lo.annotations.title,description:Lo.description,settings:{enabled:((A=n==null?void 0:n.builtInTools)==null?void 0:A.includes(pn))??!0}},include_readme:{id:yi,label:"Allow README Include (flag)",description:"Allows hub_repo_details to attach README content when the tool request explicitly opts in. Requires reconnect to take effect.",settings:{enabled:r}},doc_semantic_search:{id:Bi,label:zo.annotations.title,description:zo.description,settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Bi))??!0}},doc_fetch:{id:Ui,label:Vo.annotations.title,description:Vo.description,settings:{enabled:((I=n==null?void 0:n.builtInTools)==null?void 0:I.includes(Ui))??!0}}},E={duplicate_space:{id:Hi,label:Ec.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((Q=n==null?void 0:n.builtInTools)==null?void 0:Q.includes(Hi))??!0}},space_files:{id:Gi,label:kc.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((R=n==null?void 0:n.builtInTools)==null?void 0:R.includes(Gi))??!0}},no_gradio_images:{id:wi,label:"Disable Gradio Images (flag)",description:"Strips image responses from Gradio spaces. Mirrors the 'no_image_content' URL parameter and requires reconnect to take effect.",settings:{enabled:o}}};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(Sv,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(_v,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(Ut,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(Ut,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ut,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ut,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ut,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(Ut,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(Wt,{value:"metrics",className:"mt-0",children:l.jsx(fv,{})}),l.jsx(Wt,{value:"mcp",className:"mt-0",children:l.jsx(gv,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(Wt,{value:"search",className:"mt-0",children:l.jsx($s,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:N,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Wt,{value:"spaces",className:"mt-0",children:l.jsx($s,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:E,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Wt,{value:"gradio",className:"mt-0",children:l.jsx(Od,{spaceNames:s,spaceSubdomains:a,enabledSpaces:u,onSpaceToolToggle:y,onSpaceToolNameChange:x,onSpaceToolSubdomainChange:b})}),l.jsx(Wt,{value:"home",className:"mt-0",children:l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"🤗 HF MCP Server"}),l.jsx(Ft,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(lt,{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(It,{}),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(It,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(jt,{size:"xl",onClick:_,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx(_d,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(jt,{size:"xl",variant:"outline",onClick:C,className:"w-full touch-manipulation",children:[l.jsx(kd,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(pv,{isLoading:f,error:v,transportInfo:e||{transport:"unknown"}})]})}jc.createRoot(document.getElementById("root")).render(l.jsx(h.StrictMode,{children:l.jsx(gx,{})}));
145
+ `)},Cp=0,Bt=[];function Rp(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(Cp++)[0],s=h.useState(Ml)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=Wg([e.lockRef.current],(e.shards||[]).map(mi),!0).filter(Boolean);return p.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(p,y){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var x=Hn(p),b=n.current,w="deltaX"in p?p.deltaX:b[0]-x[0],_="deltaY"in p?p.deltaY:b[1]-x[1],C,N=p.target,E=Math.abs(w)>Math.abs(_)?"h":"v";if("touches"in p&&E==="h"&&N.type==="range")return!1;var S=di(E,N);if(!S)return!0;if(S?C=E:(C=E==="v"?"h":"v",S=di(E,N)),!S)return!1;if(!r.current&&"changedTouches"in p&&(w||_)&&(r.current=C),!C)return!0;var j=r.current||C;return bp(j,y,p,j==="h"?w:_)},[]),c=h.useCallback(function(p){var y=p;if(!(!Bt.length||Bt[Bt.length-1]!==s)){var x="deltaY"in y?fi(y):Hn(y),b=t.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&Sp(C.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(i.current.shards||[]).map(mi).filter(Boolean).filter(function(C){return C.contains(y.target)}),_=w.length>0?a(y,w[0]):!i.current.noIsolation;_&&y.cancelable&&y.preventDefault()}}},[]),u=h.useCallback(function(p,y,x,b){var w={name:p,delta:y,target:x,should:b,shadowParent:Ep(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(_){return _!==w})},1)},[]),d=h.useCallback(function(p){n.current=Hn(p),r.current=void 0},[]),g=h.useCallback(function(p){u(p.type,fi(p),p.target,a(p,e.lockRef.current))},[]),m=h.useCallback(function(p){u(p.type,Hn(p),p.target,a(p,e.lockRef.current))},[]);h.useEffect(function(){return Bt.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Gt),document.addEventListener("touchmove",c,Gt),document.addEventListener("touchstart",d,Gt),function(){Bt=Bt.filter(function(p){return p!==s}),document.removeEventListener("wheel",c,Gt),document.removeEventListener("touchmove",c,Gt),document.removeEventListener("touchstart",d,Gt)}},[]);var f=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(s,{styles:_p(o)}):null,f?h.createElement(gp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Ep(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kp=tp(kl,Rp);var jl=h.forwardRef(function(e,t){return h.createElement(vr,Be({},e,{ref:t,sideCar:kp}))});jl.classNames=vr.classNames;var ko=["Enter"," "],Mp=["ArrowDown","PageUp","Home"],Il=["ArrowUp","PageDown","End"],Np=[...Mp,...Il],Ap={ltr:[...ko,"ArrowRight"],rtl:[...ko,"ArrowLeft"]},Tp={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Mn="Menu",[wn,jp,Ip]=Ha(Mn),[Lt,Pl]=Dt(Mn,[Ip,al,hr]),xr=al(),Ol=hr(),[Pp,Vt]=Lt(Mn),[Op,Nn]=Lt(Mn),Fl=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=xr(t),[c,u]=h.useState(null),d=h.useRef(!1),g=ct(s),m=es(o);return h.useEffect(()=>{const f=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),l.jsx(kg,{...a,children:l.jsx(Pp,{scope:t,open:n,onOpenChange:g,content:c,onContentChange:u,children:l.jsx(Op,{scope:t,onClose:h.useCallback(()=>g(!1),[g]),isUsingKeyboardRef:d,dir:m,modal:i,children:r})})})};Fl.displayName=Mn;var Fp="MenuAnchor",cs=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=xr(n);return l.jsx(Mg,{...o,...r,ref:t})});cs.displayName=Fp;var us="MenuPortal",[Dp,Dl]=Lt(us,{forceMount:void 0}),$l=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Vt(us,t);return l.jsx(Dp,{scope:t,forceMount:n,children:l.jsx($t,{present:n||s.open,children:l.jsx(hl,{asChild:!0,container:o,children:r})})})};$l.displayName=us;var Oe="MenuContent",[$p,ds]=Lt(Oe),Ll=h.forwardRef((e,t)=>{const n=Dl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Vt(Oe,e.__scopeMenu),i=Nn(Oe,e.__scopeMenu);return l.jsx(wn.Provider,{scope:e.__scopeMenu,children:l.jsx($t,{present:r||s.open,children:l.jsx(wn.Slot,{scope:e.__scopeMenu,children:i.modal?l.jsx(Lp,{...o,ref:t}):l.jsx(Vp,{...o,ref:t})})})})}),Lp=h.forwardRef((e,t)=>{const n=Vt(Oe,e.__scopeMenu),r=h.useRef(null),o=Ee(t,r);return h.useEffect(()=>{const s=r.current;if(s)return Ug(s)},[]),l.jsx(fs,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Vp=h.forwardRef((e,t)=>{const n=Vt(Oe,e.__scopeMenu);return l.jsx(fs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),zp=vn("MenuContent.ScrollLock"),fs=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,disableOutsideScroll:v,...p}=e,y=Vt(Oe,n),x=Nn(Oe,n),b=xr(n),w=Ol(n),_=jp(n),[C,N]=h.useState(null),E=h.useRef(null),S=Ee(t,E,y.onContentChange),j=h.useRef(0),L=h.useRef(""),K=h.useRef(0),B=h.useRef(null),Z=h.useRef("right"),A=h.useRef(0),te=v?jl:h.Fragment,I=v?{as:zp,allowPinchZoom:!0}:void 0,Q=k=>{var ne,ze;const z=L.current+k,V=_().filter(xe=>!xe.disabled),ee=document.activeElement,se=(ne=V.find(xe=>xe.ref.current===ee))==null?void 0:ne.textValue,ce=V.map(xe=>xe.textValue),be=Qp(ce,z,se),Se=(ze=V.find(xe=>xe.textValue===be))==null?void 0:ze.ref.current;(function xe(_e){L.current=_e,window.clearTimeout(j.current),_e!==""&&(j.current=window.setTimeout(()=>xe(""),1e3))})(z),Se&&setTimeout(()=>Se.focus())};h.useEffect(()=>()=>window.clearTimeout(j.current),[]),Qf();const R=h.useCallback(k=>{var V,ee;return Z.current===((V=B.current)==null?void 0:V.side)&&th(k,(ee=B.current)==null?void 0:ee.area)},[]);return l.jsx($p,{scope:n,searchRef:L,onItemEnter:h.useCallback(k=>{R(k)&&k.preventDefault()},[R]),onItemLeave:h.useCallback(k=>{var z;R(k)||((z=E.current)==null||z.focus(),N(null))},[R]),onTriggerLeave:h.useCallback(k=>{R(k)&&k.preventDefault()},[R]),pointerGraceTimerRef:K,onPointerGraceIntentChange:h.useCallback(k=>{B.current=k},[]),children:l.jsx(te,{...I,children:l.jsx(Wa,{asChild:!0,trapped:o,onMountAutoFocus:J(s,k=>{var z;k.preventDefault(),(z=E.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:l.jsx(Ba,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:g,onInteractOutside:m,onDismiss:f,children:l.jsx(Sl,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:J(c,k=>{x.isUsingKeyboardRef.current||k.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Ng,{role:"menu","aria-orientation":"vertical","data-state":tc(y.open),"data-radix-menu-content":"",dir:x.dir,...b,...p,ref:S,style:{outline:"none",...p.style},onKeyDown:J(p.onKeyDown,k=>{const V=k.target.closest("[data-radix-menu-content]")===k.currentTarget,ee=k.ctrlKey||k.altKey||k.metaKey,se=k.key.length===1;V&&(k.key==="Tab"&&k.preventDefault(),!ee&&se&&Q(k.key));const ce=E.current;if(k.target!==ce||!Np.includes(k.key))return;k.preventDefault();const Se=_().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);Il.includes(k.key)&&Se.reverse(),Yp(Se)}),onBlur:J(e.onBlur,k=>{k.currentTarget.contains(k.target)||(window.clearTimeout(j.current),L.current="")}),onPointerMove:J(e.onPointerMove,bn(k=>{const z=k.target,V=A.current!==k.clientX;if(k.currentTarget.contains(z)&&V){const ee=k.clientX>A.current?"right":"left";Z.current=ee,A.current=k.clientX}}))})})})})})})});Ll.displayName=Oe;var Hp="MenuGroup",ms=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"group",...r,ref:t})});ms.displayName=Hp;var Gp="MenuLabel",Vl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{...r,ref:t})});Vl.displayName=Gp;var er="MenuItem",gi="menu.itemSelect",yr=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=h.useRef(null),i=Nn(er,e.__scopeMenu),a=ds(er,e.__scopeMenu),c=Ee(t,s),u=h.useRef(!1),d=()=>{const g=s.current;if(!n&&g){const m=new CustomEvent(gi,{bubbles:!0,cancelable:!0});g.addEventListener(gi,f=>r==null?void 0:r(f),{once:!0}),ha(g,m),m.defaultPrevented?u.current=!1:i.onClose()}};return l.jsx(zl,{...o,ref:c,disabled:n,onClick:J(e.onClick,d),onPointerDown:g=>{var m;(m=e.onPointerDown)==null||m.call(e,g),u.current=!0},onPointerUp:J(e.onPointerUp,g=>{var m;u.current||(m=g.currentTarget)==null||m.click()}),onKeyDown:J(e.onKeyDown,g=>{const m=a.searchRef.current!=="";n||m&&g.key===" "||ko.includes(g.key)&&(g.currentTarget.click(),g.preventDefault())})})});yr.displayName=er;var zl=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=ds(er,n),a=Ol(n),c=h.useRef(null),u=Ee(t,c),[d,g]=h.useState(!1),[m,f]=h.useState("");return h.useEffect(()=>{const v=c.current;v&&f((v.textContent??"").trim())},[s.children]),l.jsx(wn.ItemSlot,{scope:n,disabled:r,textValue:o??m,children:l.jsx(_l,{asChild:!0,...a,focusable:!r,children:l.jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:J(e.onPointerMove,bn(v=>{r?i.onItemLeave(v):(i.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,bn(v=>i.onItemLeave(v))),onFocus:J(e.onFocus,()=>g(!0)),onBlur:J(e.onBlur,()=>g(!1))})})})}),Bp="MenuCheckboxItem",Hl=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return l.jsx(ql,{scope:e.__scopeMenu,checked:n,children:l.jsx(yr,{role:"menuitemcheckbox","aria-checked":tr(n)?"mixed":n,...o,ref:t,"data-state":ps(n),onSelect:J(o.onSelect,()=>r==null?void 0:r(tr(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Hl.displayName=Bp;var Gl="MenuRadioGroup",[Up,Wp]=Lt(Gl,{value:void 0,onValueChange:()=>{}}),Bl=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=ct(r);return l.jsx(Up,{scope:e.__scopeMenu,value:n,onValueChange:s,children:l.jsx(ms,{...o,ref:t})})});Bl.displayName=Gl;var Ul="MenuRadioItem",Wl=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=Wp(Ul,e.__scopeMenu),s=n===o.value;return l.jsx(ql,{scope:e.__scopeMenu,checked:s,children:l.jsx(yr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":ps(s),onSelect:J(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Wl.displayName=Ul;var gs="MenuItemIndicator",[ql,qp]=Lt(gs,{checked:!1}),Zl=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=qp(gs,n);return l.jsx($t,{present:r||tr(s.checked)||s.checked===!0,children:l.jsx(fe.span,{...o,ref:t,"data-state":ps(s.checked)})})});Zl.displayName=gs;var Zp="MenuSeparator",Kl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return l.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Kl.displayName=Zp;var Kp="MenuArrow",Xl=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=xr(n);return l.jsx(Ag,{...o,...r,ref:t})});Xl.displayName=Kp;var Xp="MenuSub",[hx,Yl]=Lt(Xp),dn="MenuSubTrigger",Jl=h.forwardRef((e,t)=>{const n=Vt(dn,e.__scopeMenu),r=Nn(dn,e.__scopeMenu),o=Yl(dn,e.__scopeMenu),s=ds(dn,e.__scopeMenu),i=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const g=a.current;return()=>{window.clearTimeout(g),c(null)}},[a,c]),l.jsx(cs,{asChild:!0,...u,children:l.jsx(zl,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":tc(n.open),...e,ref:lr(t,o.onTriggerChange),onClick:g=>{var m;(m=e.onClick)==null||m.call(e,g),!(e.disabled||g.defaultPrevented)&&(g.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:J(e.onPointerMove,bn(g=>{s.onItemEnter(g),!g.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:J(e.onPointerLeave,bn(g=>{var f,v;d();const m=(f=n.content)==null?void 0:f.getBoundingClientRect();if(m){const p=(v=n.content)==null?void 0:v.dataset.side,y=p==="right",x=y?-5:5,b=m[y?"left":"right"],w=m[y?"right":"left"];s.onPointerGraceIntentChange({area:[{x:g.clientX+x,y:g.clientY},{x:b,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:b,y:m.bottom}],side:p}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(g),g.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:J(e.onKeyDown,g=>{var f;const m=s.searchRef.current!=="";e.disabled||m&&g.key===" "||Ap[r.dir].includes(g.key)&&(n.onOpenChange(!0),(f=n.content)==null||f.focus(),g.preventDefault())})})})});Jl.displayName=dn;var Ql="MenuSubContent",ec=h.forwardRef((e,t)=>{const n=Dl(Oe,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Vt(Oe,e.__scopeMenu),i=Nn(Oe,e.__scopeMenu),a=Yl(Ql,e.__scopeMenu),c=h.useRef(null),u=Ee(t,c);return l.jsx(wn.Provider,{scope:e.__scopeMenu,children:l.jsx($t,{present:r||s.open,children:l.jsx(wn.Slot,{scope:e.__scopeMenu,children:l.jsx(fs,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var g;i.isUsingKeyboardRef.current&&((g=c.current)==null||g.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:J(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:J(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:J(e.onKeyDown,d=>{var f;const g=d.currentTarget.contains(d.target),m=Tp[i.dir].includes(d.key);g&&m&&(s.onOpenChange(!1),(f=a.trigger)==null||f.focus(),d.preventDefault())})})})})})});ec.displayName=Ql;function tc(e){return e?"open":"closed"}function tr(e){return e==="indeterminate"}function ps(e){return tr(e)?"indeterminate":e?"checked":"unchecked"}function Yp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Jp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Qp(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Jp(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function eh(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],u=a.x,d=a.y,g=c.x,m=c.y;d>r!=m>r&&n<(g-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function th(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return eh(n,t)}function bn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var nh=Fl,rh=cs,oh=$l,sh=Ll,ih=ms,ah=Vl,lh=yr,ch=Hl,uh=Bl,dh=Wl,fh=Zl,mh=Kl,gh=Xl,ph=Jl,hh=ec,wr="DropdownMenu",[vh]=Dt(wr,[Pl]),Ne=Pl(),[xh,nc]=vh(wr),rc=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=Ne(t),u=h.useRef(null),[d,g]=cr({prop:o,defaultProp:s??!1,onChange:i,caller:wr});return l.jsx(xh,{scope:t,triggerId:Kn(),triggerRef:u,contentId:Kn(),open:d,onOpenChange:g,onOpenToggle:h.useCallback(()=>g(m=>!m),[g]),modal:a,children:l.jsx(nh,{...c,open:d,onOpenChange:g,dir:r,modal:a,children:n})})};rc.displayName=wr;var oc="DropdownMenuTrigger",sc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=nc(oc,n),i=Ne(n);return l.jsx(rh,{asChild:!0,...i,children:l.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:lr(t,s.triggerRef),onPointerDown:J(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:J(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});sc.displayName=oc;var yh="DropdownMenuPortal",ic=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ne(t);return l.jsx(oh,{...r,...n})};ic.displayName=yh;var ac="DropdownMenuContent",lc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=nc(ac,n),s=Ne(n),i=h.useRef(!1);return l.jsx(sh,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,a=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:J(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!o.modal||d)&&(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)"}})});lc.displayName=ac;var wh="DropdownMenuGroup",bh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ih,{...o,...r,ref:t})});bh.displayName=wh;var Sh="DropdownMenuLabel",_h=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ah,{...o,...r,ref:t})});_h.displayName=Sh;var Ch="DropdownMenuItem",Rh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(lh,{...o,...r,ref:t})});Rh.displayName=Ch;var Eh="DropdownMenuCheckboxItem",cc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ch,{...o,...r,ref:t})});cc.displayName=Eh;var kh="DropdownMenuRadioGroup",Mh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(uh,{...o,...r,ref:t})});Mh.displayName=kh;var Nh="DropdownMenuRadioItem",Ah=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(dh,{...o,...r,ref:t})});Ah.displayName=Nh;var Th="DropdownMenuItemIndicator",uc=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(fh,{...o,...r,ref:t})});uc.displayName=Th;var jh="DropdownMenuSeparator",Ih=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(mh,{...o,...r,ref:t})});Ih.displayName=jh;var Ph="DropdownMenuArrow",Oh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(gh,{...o,...r,ref:t})});Oh.displayName=Ph;var Fh="DropdownMenuSubTrigger",Dh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(ph,{...o,...r,ref:t})});Dh.displayName=Fh;var $h="DropdownMenuSubContent",Lh=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return l.jsx(hh,{...o,...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)"}})});Lh.displayName=$h;var Vh=rc,zh=sc,Hh=ic,Gh=lc,Bh=cc,Uh=uc;function Wh({...e}){return l.jsx(Vh,{"data-slot":"dropdown-menu",...e})}function qh({...e}){return l.jsx(zh,{"data-slot":"dropdown-menu-trigger",...e})}function Zh({className:e,sideOffset:t=4,...n}){return l.jsx(Hh,{children:l.jsx(Gh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:de("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 Kh({className:e,children:t,checked:n,...r}){return l.jsxs(Bh,{"data-slot":"dropdown-menu-checkbox-item",className:de("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(Uh,{children:l.jsx(Ea,{className:"size-4"})})}),t]})}function hs({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:de("w-full caption-bottom text-sm",e),...t})})}function Xh({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:de("[&_tr]:border-b",e),...t})}function vs({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:de("[&_tr:last-child]:border-0",e),...t})}function we({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:de("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Yh({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:de("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 $({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:de("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function br({columns:e,data:t,searchColumn:n,searchPlaceholder:r="Filter...",defaultColumnVisibility:o={},pageSize:s=25,defaultSorting:i=[]}){var y,x;const[a,c]=h.useState(i),[u,d]=h.useState([]),[g,m]=h.useState(o),[f,v]=h.useState({}),p=Hf({data:t,columns:e,onSortingChange:c,onColumnFiltersChange:d,getCoreRowModel:Tf(),getPaginationRowModel:Df(),getSortedRowModel:$f(),getFilteredRowModel:Ff(),onColumnVisibilityChange:m,onRowSelectionChange:v,initialState:{pagination:{pageSize:s}},state:{sorting:a,columnFilters:u,columnVisibility:g,rowSelection:f}});return l.jsxs("div",{className:"w-full",children:[l.jsxs("div",{className:"flex items-center py-4",children:[n&&l.jsx(po,{placeholder:r,value:((y=p.getColumn(n))==null?void 0:y.getFilterValue())??"",onChange:b=>{var w;return(w=p.getColumn(n))==null?void 0:w.setFilterValue(b.target.value)},className:"max-w-sm"}),l.jsxs(Wh,{children:[l.jsx(qh,{asChild:!0,children:l.jsxs(jt,{variant:"outline",className:"ml-auto",children:["Columns ",l.jsx(ka,{className:"ml-2 h-4 w-4"})]})}),l.jsx(Zh,{align:"end",children:p.getAllColumns().filter(b=>b.getCanHide()).map(b=>l.jsx(Kh,{className:"capitalize",checked:b.getIsVisible(),onCheckedChange:w=>b.toggleVisibility(!!w),children:b.id},b.id))})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(hs,{children:[l.jsx(Xh,{children:p.getHeaderGroups().map(b=>l.jsx(we,{children:b.headers.map(w=>l.jsx(Yh,{children:w.isPlaceholder?null:Bs(w.column.columnDef.header,w.getContext())},w.id))},b.id))}),l.jsx(vs,{children:(x=p.getRowModel().rows)!=null&&x.length?p.getRowModel().rows.map(b=>l.jsx(we,{"data-state":b.getIsSelected()&&"selected",children:b.getVisibleCells().map(w=>l.jsx($,{children:Bs(w.column.columnDef.cell,w.getContext())},w.id))},b.id)):l.jsx(we,{children:l.jsx($,{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:[p.getFilteredRowModel().rows.length," row(s) total."]}),l.jsxs("div",{className:"space-x-2",children:[l.jsx(jt,{variant:"outline",size:"sm",onClick:()=>p.previousPage(),disabled:!p.getCanPreviousPage(),children:"Previous"}),l.jsx(jt,{variant:"outline",size:"sm",onClick:()=>p.nextPage(),disabled:!p.getCanNextPage(),children:"Next"})]})]})]})}function me(e,t="left"){return({column:n})=>{const r=t==="right"?"justify-end":t==="center"?"justify-center":"justify-start",o=n.getIsSorted();return l.jsx("div",{className:`flex ${r}`,children:l.jsxs(jt,{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,o==="asc"&&l.jsx(yd,{className:"ml-1 h-3 w-3 text-muted-foreground"}),o==="desc"&&l.jsx(ka,{className:"ml-1 h-3 w-3 text-muted-foreground"})]})})}}const Jh=300*1e3;function dc(e){const[t,n]=h.useState(new Map),r=h.useRef();return h.useEffect(()=>{const s=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:s,disconnectedAt:void 0})}),c.forEach((u,d)=>{!i.has(d)&&!u.disconnectedAt&&c.set(d,{...u,isConnected:!1,connectionStatus:"Disconnected",disconnectedAt:s,lastActivity:u.lastActivity||s})}),c})},[e]),h.useEffect(()=>{const s=()=>{const i=Date.now();n(a=>{const c=new Map(a);return c.forEach((u,d)=>{if(u.disconnectedAt){const g=new Date(u.disconnectedAt).getTime();i-g>Jh&&c.delete(d)}}),c})};return s(),r.current=setInterval(s,3e4),()=>{r.current&&clearInterval(r.current)}},[]),Array.from(t.values()).sort((s,i)=>s.isConnected!==i.isConnected?s.isConnected?-1:1:new Date(i.lastActivity).getTime()-new Date(s.lastActivity).getTime())}function pi(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function Qh(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 ev(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function tv(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function nv({metrics:e}){const t=e.sessions||[],n=dc(t),r=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:o})=>{const s=o.original,i=s.clientInfo?`${tv(s.clientInfo.name)}@${s.clientInfo.version}`:"unknown";return l.jsx("div",{className:"font-mono text-sm",title:s.clientInfo?`${s.clientInfo.name}@${s.clientInfo.version}`:"unknown",children:i})}},{accessorKey:"id",header:me("Session ID"),cell:({row:o})=>l.jsx("div",{className:"font-mono text-sm",title:o.getValue("id"),children:ev(o.getValue("id"))})},{accessorKey:"isConnected",header:me("Status"),cell:({row:o})=>{const s=o.original;return l.jsxs(Tt,{variant:s.isConnected?"success":"secondary",className:"gap-1",children:[s.isConnected?l.jsx(Aa,{className:"h-3 w-3"}):l.jsx(Na,{className:"h-3 w-3"}),s.isConnected?"Connected":"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:pi(o.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:o})=>l.jsx("div",{className:"text-right font-mono text-sm",children:o.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:o})=>l.jsx("div",{className:"text-sm",children:pi(o.getValue("lastActivity"))})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"📊 Transport Metrics"}),l.jsx(Ft,{children:"Real-time connection and performance metrics for STDIO transport"})]}),l.jsxs(lt,{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:Qh(e.uptimeSeconds)})]})]}),l.jsxs(l.Fragment,{children:[l.jsx(It,{}),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(br,{columns:r(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function hi(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function rv(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 Gn(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function ov(e){return e.length<=12?e:`${e.slice(0,5)}...${e.slice(-5)}`}function sv(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function iv({metrics:e}){const t=e.sessions||[],n=dc(t),r={sse:"Server-Sent Events",streamableHttp:"Streamable HTTP"},o=()=>[{accessorKey:"clientInfo",header:me("Client"),cell:({row:s})=>{const i=s.original,a=i.clientInfo?`${sv(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:me("Session ID"),cell:({row:s})=>l.jsx("div",{className:"font-mono text-sm",title:s.getValue("id"),children:ov(s.getValue("id"))})},{accessorKey:"connectionStatus",header:me("Status"),cell:({row:s})=>{const i=s.original,a=i.connectionStatus||(i.isConnected?"Connected":"Disconnected");return a==="Connected"?l.jsxs(Tt,{variant:"success",className:"gap-1",children:[l.jsx(Aa,{className:"h-3 w-3"}),"Connected"]}):a==="Distressed"?l.jsxs(Tt,{variant:"destructive",className:"gap-1",children:[l.jsx(Ma,{className:"h-3 w-3"}),"Distressed ",i.pingFailures?`(${i.pingFailures} failed)`:""]}):l.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[l.jsx(Na,{className:"h-3 w-3"}),"Disconnected"]})}},{accessorKey:"connectedAt",header:me("Connected"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:hi(s.getValue("connectedAt"))})},{accessorKey:"requestCount",header:me("Requests","right"),cell:({row:s})=>l.jsx("div",{className:"text-right font-mono text-sm",children:s.getValue("requestCount")})},{accessorKey:"lastActivity",header:me("Last Activity"),cell:({row:s})=>l.jsx("div",{className:"text-sm",children:hi(s.getValue("lastActivity"))})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"📊 Transport Metrics"}),l.jsxs(Ft,{children:["Real-time connection and performance metrics for"," ",r[e.transport]||e.transport," transport"]})]}),l.jsxs(lt,{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:rv(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 ",Gn(e.configuration.heartbeatInterval||3e4),", sessions swept every ",Gn(e.configuration.staleCheckInterval),", removed after"," ",Gn(e.configuration.staleTimeout)," inactive",e.configuration.pingEnabled&&e.configuration.pingInterval&&`, pings sent every ${Gn(e.configuration.pingInterval)}`,e.configuration.pingEnabled&&`, marked distressed after ${e.configuration.pingFailureThreshold||1} failed ping${(e.configuration.pingFailureThreshold||1)!==1?"s":""}`]})]})}),l.jsx(It,{}),l.jsx("div",{children:l.jsx(hs,{children:l.jsxs(vs,{children:[l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Active Connections"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.active}),l.jsx($,{className:"font-medium text-sm",children:"Cleaned Sessions"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.cleaned??0})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Total Connections"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.total}),l.jsx($,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs($,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),e.sessionLifecycle&&l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs($,{className:"text-sm font-mono",colSpan:3,children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx($,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.unexpected})]}),e.pings&&l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Pings Sent"}),l.jsx($,{className:"text-sm font-mono",children:e.pings.sent}),l.jsx($,{className:"font-medium text-sm",children:"Ping Success Rate"}),l.jsx($,{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(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Anonymous Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx($,{className:"font-medium text-sm",children:"Authenticated Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"401 Unauthorized Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx($,{className:"font-medium text-sm",children:"403 Forbidden Users"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx($,{className:"text-sm font-mono",children:e.gradioMetrics?`${e.gradioMetrics.success}/${e.gradioMetrics.failure}`:"0/0"}),l.jsx($,{className:"font-medium text-sm",children:"-"}),l.jsx($,{className:"text-sm font-mono",children:"-"})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(It,{}),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(br,{columns:o(),data:n,searchColumn:"id",searchPlaceholder:"Filter sessions...",pageSize:10,defaultSorting:[{id:"lastActivity",desc:!0}]})]})]})]})]})}function vi(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime(),o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function av(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 lv(e){const t=new Date,n=new Date(e),r=t.getTime()-n.getTime();return Math.floor(r/6e4)<5}function cv(e){return e.length<=42?e:`${e.slice(0,35)}.....${e.slice(-5)}`}function uv({metrics:e}){const t=e.clients,n=()=>[{accessorKey:"name",header:me("Client"),cell:({row:r})=>{const o=r.original,s=`${cv(o.name)}@${o.version}`;return l.jsxs("div",{children:[l.jsx("p",{className:"font-medium font-mono text-sm",title:`${o.name}@${o.version}`,children:s}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["First seen ",vi(o.firstSeen)]})]})}},{accessorKey:"requestCount",header:me("Initializations","right"),cell:({row:r})=>l.jsx("div",{className:"text-right font-mono text-sm",children:r.getValue("requestCount")})},{accessorKey:"isConnected",header:me("Status"),cell:({row:r})=>{const o=r.original;return l.jsx("div",{children:lv(o.lastSeen)?l.jsxs(Tt,{variant:"success",className:"gap-1",children:[l.jsx(pd,{className:"h-3 w-3"}),"Recent"]}):l.jsxs(Tt,{variant:"secondary",className:"gap-1",children:[l.jsx(bd,{className:"h-3 w-3"}),"Idle"]})})}},{accessorKey:"lastSeen",header:me("Last Seen","right"),cell:({row:r})=>l.jsx("div",{className:"text-right text-sm",children:vi(r.getValue("lastSeen"))})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"📊 Transport Metrics"}),l.jsx(Ft,{children:"Real-time connection and performance metrics for Stateless HTTP JSON transport"})]}),l.jsxs(lt,{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(Tt,{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:av(e.uptimeSeconds)})]})]}),l.jsx(It,{}),l.jsx("div",{children:l.jsx(hs,{children:l.jsxs(vs,{children:[l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Request Count (MCP)"}),l.jsx($,{className:"text-sm font-mono",children:e.connections.total}),l.jsx($,{className:"font-medium text-sm",children:"Requests per Minute (tot/3hr/hr)"}),l.jsxs($,{className:"text-sm font-mono",children:[e.requests.averagePerMinute,"/",e.requests.last3Hours,"/",e.requests.lastHour]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Client Errors (4xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.expected}),l.jsx($,{className:"font-medium text-sm",children:"Server Errors (5xx)"}),l.jsx($,{className:"text-sm font-mono",children:e.errors.unexpected})]}),(e.staticPageHits200!==void 0||e.staticPageHits405!==void 0)&&l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Rd,{className:"h-3 w-3"}),"hf.co/mcp (200/405)"]})}),l.jsxs($,{className:"text-sm font-mono",children:[e.staticPageHits200||0,"/",e.staticPageHits405||0]}),l.jsx($,{className:"font-medium text-sm",children:l.jsx("div",{className:"flex items-center gap-1",children:"Auth Status (Anon/Auth/401)"})}),l.jsxs($,{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(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Tool API - Anonymous"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.anonymous}),l.jsx($,{className:"font-medium text-sm",children:"Tool API - Authenticated"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.authenticated})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Tool API - 401 Unauthorized"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.unauthorized}),l.jsx($,{className:"font-medium text-sm",children:"Tool API - 403 Forbidden"}),l.jsx($,{className:"text-sm font-mono",children:e.apiMetrics.forbidden})]})]}),l.jsxs(we,{children:[l.jsx($,{className:"font-medium text-sm",children:"Gradio Success/Fail"}),l.jsx($,{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($,{className:"font-medium text-sm",children:"Sessions New/Res-fail/Del"}),l.jsxs($,{className:"text-sm font-mono",children:[e.sessionLifecycle.created,"/",e.sessionLifecycle.resumedFailed,"/",e.sessionLifecycle.deleted]})]}):l.jsxs(l.Fragment,{children:[l.jsx($,{className:"font-medium text-sm",children:"-"}),l.jsx($,{className:"text-sm font-mono",children:"-"})]})]})]})})}),l.jsxs(l.Fragment,{children:[l.jsx(It,{}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Client Identities"}),l.jsx(br,{columns:n(),data:t,searchColumn:"name",searchPlaceholder:"Filter clients...",pageSize:50,defaultSorting:[{id:"lastSeen",desc:!0}]})]})]})]})]})}const dv=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function fv(){const{data:e,error:t}=mn("/api/transport-metrics",dv,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});return t?l.jsxs(st,{children:[l.jsx(it,{children:l.jsx(at,{children:"📊 Transport Metrics"})}),l.jsx(lt,{children:l.jsxs(Dd,{variant:"destructive",children:[l.jsx(Ma,{className:"h-4 w-4"}),l.jsx($d,{children:"Error Loading Metrics"}),l.jsxs(Ld,{children:["Failed to load transport metrics: ",t.message]})]})})]}):e?e.transport==="stdio"?l.jsx(nv,{metrics:e}):e.isStateless?l.jsx(uv,{metrics:e}):l.jsx(iv,{metrics:e}):l.jsxs(st,{children:[l.jsx(it,{children:l.jsx(at,{children:"📊 Transport Metrics"})}),l.jsx(lt,{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 mv=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function gv(){const[e,t]=h.useState(!1),{data:n,error:r}=mn("/api/transport-metrics",mv,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0}),o=!n&&!r,s=(n==null?void 0:n.transport)==="stdio",i=((n==null?void 0:n.methods)||[]).map(m=>{let f=m.errors,v,p;if(m.method.startsWith("tools/call:")&&(n!=null&&n.gradioMetrics)){const b=m.method.replace("tools/call:",""),w=n.gradioMetrics.byTool;w[b]&&(v=w[b].success,p=w[b].failure,f+=p)}const y=m.count>0?f/m.count*100:0;return{method:m.method,count:m.count,errors:f,errorRate:y,averageResponseTime:m.averageResponseTime,lastCalled:m.lastCalled,gradioSuccess:v,gradioFailure:p}}),a=e?i.filter(m=>m.method.startsWith("tools/call")||m.method.startsWith("prompts/get")):i,c=i.reduce((m,f)=>m+f.count,0),u=i.filter(m=>m.method.startsWith("tools/call")).reduce((m,f)=>m+f.count,0),d=i.filter(m=>m.method.startsWith("prompts/get")).reduce((m,f)=>m+f.count,0),g=[{accessorKey:"method",header:me("Method"),cell:({row:m})=>{const f=m.getValue("method");return l.jsx("div",{className:"font-mono text-sm",children:f==="tools/call"?l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"tools/call"}):f.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:f.replace("tools/call:","")})]}):f==="prompts/get"?l.jsx("span",{className:"text-purple-600 dark:text-purple-400",children:"prompts/get"}):f.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:f.replace("prompts/get:","")})]}):f})}},{accessorKey:"count",header:me("Calls","right"),cell:({row:m})=>l.jsx("div",{className:"text-right font-mono",children:m.getValue("count").toLocaleString()})},{accessorKey:"errors",header:me("Errors","right"),cell:({row:m})=>{const f=m.getValue("errors");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f}):"0"})}},{accessorKey:"gradioMetrics",header:me("Success/Failure","right"),cell:({row:m})=>{const f=m.original;return f.gradioSuccess!==void 0&&f.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:f.gradioSuccess}),l.jsx("span",{className:"text-muted-foreground",children:"/"}),l.jsx("span",{className:"text-red-600 dark:text-red-400",children:f.gradioFailure})]}):l.jsx("div",{className:"text-right text-muted-foreground",children:"—"})}},{accessorKey:"errorRate",header:me("Error Rate","right"),cell:({row:m})=>{const f=m.getValue("errorRate");return l.jsx("div",{className:"text-right font-mono",children:f>0?l.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[f.toFixed(1),"%"]}):"0%"})}},{accessorKey:"averageResponseTime",header:me("Avg Response","right"),cell:({row:m})=>{const f=m.getValue("averageResponseTime");return l.jsx("div",{className:"text-right font-mono",children:f?`${f.toFixed(0)}ms`:"—"})}},{accessorKey:"lastCalled",header:me("Last Called","right"),cell:({row:m})=>l.jsx("div",{className:"text-right text-sm text-muted-foreground",children:new Date(m.getValue("lastCalled")).toLocaleTimeString()})}];return l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"HTTP JSON Transport Statistics"}),l.jsxs(Ft,{children:["MCP method call statistics and performance metrics",s?" (Empty in STDIO mode)":n!=null&&n.isStateless?"":" (Response times not available in stateful modes)"]})]}),l.jsxs(lt,{children:[o&&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]})}),s&&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&&!s&&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:d.toLocaleString()})]})]})]}),i.length>0&&l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Zo,{id:"tool-prompt-calls-filter",checked:e,onCheckedChange:m=>t(!!m)}),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(br,{columns:g,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 xi(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 pv({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"}},o=()=>{switch(n.transport){case"sse":return"/sse";case"streamableHttp":case"streamableHttpJson":return"/mcp";case"stdio":return"stdin/stdout";default:return"unknown"}},s=()=>n.transport==="streamableHttpJson"||n.transport==="streamableHttp"&&n.jsonResponseEnabled===!0,i=()=>s()?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:o()}),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 ${xi(n).isWarning?"text-red-500":""}`,children:xi(n).text})]})]})})}var Sr="Tabs",[hv]=Dt(Sr,[hr]),fc=hr(),[vv,xs]=hv(Sr),mc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=es(a),[g,m]=cr({prop:r,onChange:o,defaultProp:s??"",caller:Sr});return l.jsx(vv,{scope:n,baseId:Kn(),value:g,onValueChange:m,orientation:i,dir:d,activationMode:c,children:l.jsx(fe.div,{dir:d,"data-orientation":i,...u,ref:t})})});mc.displayName=Sr;var gc="TabsList",pc=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=xs(gc,n),i=fc(n);return l.jsx(Sl,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(fe.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});pc.displayName=gc;var hc="TabsTrigger",vc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=xs(hc,n),a=fc(n),c=wc(i.baseId,r),u=bc(i.baseId,r),d=r===i.value;return l.jsx(_l,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(fe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:J(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?i.onValueChange(r):g.preventDefault()}),onKeyDown:J(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&i.onValueChange(r)}),onFocus:J(e.onFocus,()=>{const g=i.activationMode!=="manual";!d&&!o&&g&&i.onValueChange(r)})})})});vc.displayName=hc;var xc="TabsContent",yc=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=xs(xc,n),c=wc(a.baseId,r),u=bc(a.baseId,r),d=r===a.value,g=h.useRef(d);return h.useEffect(()=>{const m=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx($t,{present:o||d,children:({present:m})=>l.jsx(fe.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:m&&s})})});yc.displayName=xc;function wc(e,t){return`${e}-trigger-${t}`}function bc(e,t){return`${e}-content-${t}`}var xv=mc,yv=pc,wv=vc,bv=yc;function Sv({className:e,...t}){return l.jsx(xv,{"data-slot":"tabs",className:de("flex flex-col gap-2",e),...t})}function _v({className:e,...t}){return l.jsx(yv,{"data-slot":"tabs-list",className:de("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Ut({className:e,...t}){return l.jsx(wv,{"data-slot":"tabs-trigger",className:de("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 Wt({className:e,...t}){return l.jsx(bv,{"data-slot":"tabs-content",className:de("flex-1 outline-none",e),...t})}const yi="ALLOW_README_INCLUDE",wi="NO_GRADIO_IMAGE_CONTENT";var ae;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const s={};for(const i of o)s[i]=i;return s},e.getValidEnumValues=o=>{const s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(const a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const s=[];for(const i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(const i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(ae||(ae={}));var bi;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(bi||(bi={}));const F=ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vt=e=>{switch(typeof e){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(e)?F.nan:F.number;case"boolean":return F.boolean;case"function":return F.function;case"bigint":return F.bigint;case"symbol":return F.symbol;case"object":return Array.isArray(e)?F.array:e===null?F.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?F.promise:typeof Map<"u"&&e instanceof Map?F.map:typeof Set<"u"&&e instanceof Set?F.set:typeof Date<"u"&&e instanceof Date?F.date:F.object;default:return F.unknown}},M=ae.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 ft 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(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let a=r,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 o(this),r}static assert(t){if(!(t instanceof ft))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const s=o.path[0];n[s]=n[s]||[],n[s].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ft.create=e=>new ft(e);const Mo=(e,t)=>{let n;switch(e.code){case M.invalid_type:e.received===F.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case M.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ae.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:n=`Unrecognized key(s) in object: ${ae.joinValues(e.keys,", ")}`;break;case M.invalid_union:n="Invalid input";break;case M.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ae.joinValues(e.options)}`;break;case M.invalid_enum_value:n=`Invalid enum value. Expected ${ae.joinValues(e.options)}, received '${e.received}'`;break;case M.invalid_arguments:n="Invalid function arguments";break;case M.invalid_return_type:n="Invalid function return type";break;case M.invalid_date:n="Invalid date";break;case M.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}"`:ae.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case M.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 M.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 M.custom:n="Invalid input";break;case M.invalid_intersection_types:n="Intersection results could not be merged";break;case M.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case M.not_finite:n="Number must be finite";break;default:n=t.defaultError,ae.assertNever(e)}return{message:n}};let Cv=Mo;function Rv(){return Cv}const Ev=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,s=[...n,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function T(e,t){const n=Rv(),r=Ev({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Mo?void 0:Mo].filter(o=>!!o)});e.common.issues.push(r)}class Me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return q;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const s=await o.key,i=await o.value;r.push({key:s,value:i})}return Me.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return q;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(r[s.value]=i.value)}return{status:t.value,value:r}}}const q=Object.freeze({status:"aborted"}),fn=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),Si=e=>e.status==="aborted",_i=e=>e.status==="dirty",Yt=e=>e.status==="valid",nr=e=>typeof Promise<"u"&&e instanceof Promise;var D;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(D||(D={}));class Ke{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ci=(e,t)=>{if(Yt(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 ft(e.common.issues);return this._error=n,this._error}}};function X(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{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:o}}class oe{get description(){return this._def.description}_getType(t){return vt(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:vt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Me,ctx:{common:t.parent.common,data:t.data,parsedType:vt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(nr(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:vt(t)},o=this._parseSync({data:t,path:r.path,parent:r});return Ci(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:vt(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Yt(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(o=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>Yt(s)?{value:s.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:vt(t)},o=this._parse({data:t,path:r.path,parent:r}),s=await(nr(o)?o:Promise.resolve(o));return Ci(r,s)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,s)=>{const i=t(o),a=()=>s.addIssue({code:M.custom,...r(o)});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,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new en({schema:this,typeName:W.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 bt.create(this,this._def)}nullable(){return tn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qe.create(this)}promise(){return ar.create(this,this._def)}or(t){return or.create([this,t],this._def)}and(t){return sr.create(this,t,this._def)}transform(t){return new en({...X(this._def),schema:this,typeName:W.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new jo({...X(this._def),innerType:this,defaultValue:n,typeName:W.ZodDefault})}brand(){return new Kv({typeName:W.ZodBranded,type:this,...X(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new Io({...X(this._def),innerType:this,catchValue:n,typeName:W.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ys.create(this,t)}readonly(){return Po.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const kv=/^c[^\s-]{8,}$/i,Mv=/^[0-9a-z]+$/,Nv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Av=/^[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,Tv=/^[a-z0-9_-]{21}$/i,jv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Iv=/^[-+]?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)?)??$/,Pv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ov="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Jr;const Fv=/^(?:(?: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])$/,Dv=/^(?:(?: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])$/,$v=/^(([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]))$/,Lv=/^(([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])$/,Vv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sc="((\\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])))",Hv=new RegExp(`^${Sc}$`);function _c(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 Gv(e){return new RegExp(`^${_c(e)}$`)}function Bv(e){let t=`${Sc}T${_c(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 Uv(e,t){return!!((t==="v4"||!t)&&Fv.test(e)||(t==="v6"||!t)&&$v.test(e))}function Wv(e,t){if(!jv.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,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function qv(e,t){return!!((t==="v4"||!t)&&Dv.test(e)||(t==="v6"||!t)&&Lv.test(e))}class ot extends oe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==F.string){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_type,expected:F.string,received:s.parsedType}),q}const r=new Me;let o;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?T(o,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&T(o,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Pv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"email",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Jr||(Jr=new RegExp(Ov,"u")),Jr.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"emoji",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Av.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"uuid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Tv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"nanoid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")kv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cuid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Mv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cuid2",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Nv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"ulid",code:M.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),T(o,{validation:"url",code:M.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"regex",code:M.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Bv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Hv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Gv(s).test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:M.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Iv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"duration",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?Uv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"ip",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Wv(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"jwt",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?qv(t.data,s.version)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cidr",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Vv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"base64",code:M.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?zv.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"base64url",code:M.invalid_string,message:s.message}),r.dirty()):ae.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:M.invalid_string,...D.errToObj(r)})}_addCheck(t){return new ot({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...D.errToObj(t)})}url(t){return this._addCheck({kind:"url",...D.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...D.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...D.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...D.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...D.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...D.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...D.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...D.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...D.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...D.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...D.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...D.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,...D.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,...D.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...D.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...D.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...D.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...D.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...D.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...D.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...D.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...D.errToObj(n)})}nonempty(t){return this.min(1,D.errToObj(t))}trim(){return new ot({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ot({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ot({...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}}ot.create=e=>new ot({checks:[],typeName:W.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...X(e)});function Zv(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class Jt extends oe{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)!==F.number){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_type,expected:F.number,received:s.parsedType}),q}let r;const o=new Me;for(const s of this._def.checks)s.kind==="int"?ae.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:M.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Zv(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),T(r,{code:M.not_finite,message:s.message}),o.dirty()):ae.assertNever(s);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,D.toString(n))}gt(t,n){return this.setLimit("min",t,!1,D.toString(n))}lte(t,n){return this.setLimit("max",t,!0,D.toString(n))}lt(t,n){return this.setLimit("max",t,!1,D.toString(n))}setLimit(t,n,r,o){return new Jt({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:D.toString(o)}]})}_addCheck(t){return new Jt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:D.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:D.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:D.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.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"&&ae.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)}}Jt.create=e=>new Jt({checks:[],typeName:W.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...X(e)});class Sn extends oe{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)!==F.bigint)return this._getInvalidInput(t);let r;const o=new Me;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),T(r,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):ae.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return T(n,{code:M.invalid_type,expected:F.bigint,received:n.parsedType}),q}gte(t,n){return this.setLimit("min",t,!0,D.toString(n))}gt(t,n){return this.setLimit("min",t,!1,D.toString(n))}lte(t,n){return this.setLimit("max",t,!0,D.toString(n))}lt(t,n){return this.setLimit("max",t,!1,D.toString(n))}setLimit(t,n,r,o){return new Sn({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:D.toString(o)}]})}_addCheck(t){return new Sn({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:D.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}}Sn.create=e=>new Sn({checks:[],typeName:W.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...X(e)});class No extends oe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==F.boolean){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.boolean,received:r.parsedType}),q}return Fe(t.data)}}No.create=e=>new No({typeName:W.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...X(e)});class rr extends oe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==F.date){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_type,expected:F.date,received:s.parsedType}),q}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return T(s,{code:M.invalid_date}),q}const r=new Me;let o;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:M.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ae.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new rr({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:D.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:D.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}}rr.create=e=>new rr({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:W.ZodDate,...X(e)});class Ri extends oe{_parse(t){if(this._getType(t)!==F.symbol){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.symbol,received:r.parsedType}),q}return Fe(t.data)}}Ri.create=e=>new Ri({typeName:W.ZodSymbol,...X(e)});class Ei extends oe{_parse(t){if(this._getType(t)!==F.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.undefined,received:r.parsedType}),q}return Fe(t.data)}}Ei.create=e=>new Ei({typeName:W.ZodUndefined,...X(e)});class ki extends oe{_parse(t){if(this._getType(t)!==F.null){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.null,received:r.parsedType}),q}return Fe(t.data)}}ki.create=e=>new ki({typeName:W.ZodNull,...X(e)});class Ao extends oe{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}}Ao.create=e=>new Ao({typeName:W.ZodAny,...X(e)});class Mi extends oe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}}Mi.create=e=>new Mi({typeName:W.ZodUnknown,...X(e)});class kt extends oe{_parse(t){const n=this._getOrReturnCtx(t);return T(n,{code:M.invalid_type,expected:F.never,received:n.parsedType}),q}}kt.create=e=>new kt({typeName:W.ZodNever,...X(e)});class Ni extends oe{_parse(t){if(this._getType(t)!==F.undefined){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.void,received:r.parsedType}),q}return Fe(t.data)}}Ni.create=e=>new Ni({typeName:W.ZodVoid,...X(e)});class qe extends oe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==F.array)return T(n,{code:M.invalid_type,expected:F.array,received:n.parsedType}),q;if(o.exactLength!==null){const i=n.data.length>o.exactLength.value,a=n.data.length<o.exactLength.value;(i||a)&&(T(n,{code:i?M.too_big:M.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(T(n,{code:M.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(T(n,{code:M.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,a)=>o.type._parseAsync(new Ke(n,i,n.path,a)))).then(i=>Me.mergeArray(r,i));const s=[...n.data].map((i,a)=>o.type._parseSync(new Ke(n,i,n.path,a)));return Me.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new qe({...this._def,minLength:{value:t,message:D.toString(n)}})}max(t,n){return new qe({...this._def,maxLength:{value:t,message:D.toString(n)}})}length(t,n){return new qe({...this._def,exactLength:{value:t,message:D.toString(n)}})}nonempty(t){return this.min(1,t)}}qe.create=(e,t)=>new qe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:W.ZodArray,...X(t)});function qt(e){if(e instanceof ve){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=bt.create(qt(r))}return new ve({...e._def,shape:()=>t})}else return e instanceof qe?new qe({...e._def,type:qt(e.element)}):e instanceof bt?bt.create(qt(e.unwrap())):e instanceof tn?tn.create(qt(e.unwrap())):e instanceof Ot?Ot.create(e.items.map(t=>qt(t))):e}class ve extends oe{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=ae.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==F.object){const u=this._getOrReturnCtx(t);return T(u,{code:M.invalid_type,expected:F.object,received:u.parsedType}),q}const{status:r,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof kt&&this._def.unknownKeys==="strip"))for(const u in o.data)i.includes(u)||a.push(u);const c=[];for(const u of i){const d=s[u],g=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Ke(o,g,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof kt){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(T(o,{code:M.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 d of a){const g=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Ke(o,g,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const g=await d.key,m=await d.value;u.push({key:g,value:m,alwaysSet:d.alwaysSet})}return u}).then(u=>Me.mergeObjectSync(r,u)):Me.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return D.errToObj,new ve({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i;const o=((i=(s=this._def).errorMap)==null?void 0:i.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:D.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new ve({...this._def,unknownKeys:"strip"})}passthrough(){return new ve({...this._def,unknownKeys:"passthrough"})}extend(t){return new ve({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ve({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:W.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new ve({...this._def,catchall:t})}pick(t){const n={};for(const r of ae.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ve({...this._def,shape:()=>n})}omit(t){const n={};for(const r of ae.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new ve({...this._def,shape:()=>n})}deepPartial(){return qt(this)}partial(t){const n={};for(const r of ae.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new ve({...this._def,shape:()=>n})}required(t){const n={};for(const r of ae.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof bt;)s=s._def.innerType;n[r]=s}return new ve({...this._def,shape:()=>n})}keyof(){return Cc(ae.objectKeys(this.shape))}}ve.create=(e,t)=>new ve({shape:()=>e,unknownKeys:"strip",catchall:kt.create(),typeName:W.ZodObject,...X(t)});ve.strictCreate=(e,t)=>new ve({shape:()=>e,unknownKeys:"strict",catchall:kt.create(),typeName:W.ZodObject,...X(t)});ve.lazycreate=(e,t)=>new ve({shape:e,unknownKeys:"strip",catchall:kt.create(),typeName:W.ZodObject,...X(t)});class or extends oe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const i=s.map(a=>new ft(a.ctx.common.issues));return T(n,{code:M.invalid_union,unionErrors:i}),q}if(n.common.async)return Promise.all(r.map(async s=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(o);{let s;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(c=>new ft(c));return T(n,{code:M.invalid_union,unionErrors:a}),q}}get options(){return this._def.options}}or.create=(e,t)=>new or({options:e,typeName:W.ZodUnion,...X(t)});function To(e,t){const n=vt(e),r=vt(t);if(e===t)return{valid:!0,data:e};if(n===F.object&&r===F.object){const o=ae.objectKeys(t),s=ae.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(const a of s){const c=To(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(n===F.array&&r===F.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],c=To(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return n===F.date&&r===F.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class sr extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(s,i)=>{if(Si(s)||Si(i))return q;const a=To(s.value,i.value);return a.valid?((_i(s)||_i(i))&&n.dirty(),{status:n.value,value:a.data}):(T(r,{code:M.invalid_intersection_types}),q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}sr.create=(e,t,n)=>new sr({left:e,right:t,typeName:W.ZodIntersection,...X(n)});class Ot extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==F.array)return T(r,{code:M.invalid_type,expected:F.array,received:r.parsedType}),q;if(r.data.length<this._def.items.length)return T(r,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&r.data.length>this._def.items.length&&(T(r,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((i,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new Ke(r,i,r.path,a)):null}).filter(i=>!!i);return r.common.async?Promise.all(s).then(i=>Me.mergeArray(n,i)):Me.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Ot({...this._def,rest:t})}}Ot.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ot({items:e,typeName:W.ZodTuple,rest:null,...X(t)})};class ir extends oe{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!==F.object)return T(r,{code:M.invalid_type,expected:F.object,received:r.parsedType}),q;const o=[],s=this._def.keyType,i=this._def.valueType;for(const a in r.data)o.push({key:s._parse(new Ke(r,a,r.path,a)),value:i._parse(new Ke(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Me.mergeObjectAsync(n,o):Me.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof oe?new ir({keyType:t,valueType:n,typeName:W.ZodRecord,...X(r)}):new ir({keyType:ot.create(),valueType:t,typeName:W.ZodRecord,...X(n)})}}class Ai extends oe{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!==F.map)return T(r,{code:M.invalid_type,expected:F.map,received:r.parsedType}),q;const o=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([a,c],u)=>({key:o._parse(new Ke(r,a,r.path,[u,"key"])),value:s._parse(new Ke(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,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return q;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return q;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}Ai.create=(e,t,n)=>new Ai({valueType:t,keyType:e,typeName:W.ZodMap,...X(n)});class _n extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==F.set)return T(r,{code:M.invalid_type,expected:F.set,received:r.parsedType}),q;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(T(r,{code:M.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(T(r,{code:M.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const s=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return q;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>s._parse(new Ke(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,n){return new _n({...this._def,minSize:{value:t,message:D.toString(n)}})}max(t,n){return new _n({...this._def,maxSize:{value:t,message:D.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}_n.create=(e,t)=>new _n({valueType:e,minSize:null,maxSize:null,typeName:W.ZodSet,...X(t)});class Ti extends oe{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})}}Ti.create=(e,t)=>new Ti({getter:e,typeName:W.ZodLazy,...X(t)});class ji extends oe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return T(n,{received:n.data,code:M.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:t.data}}get value(){return this._def.value}}ji.create=(e,t)=>new ji({value:e,typeName:W.ZodLiteral,...X(t)});function Cc(e,t){return new Qt({values:e,typeName:W.ZodEnum,...X(t)})}class Qt extends oe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return T(n,{expected:ae.joinValues(r),received:n.parsedType,code:M.invalid_type}),q}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:M.invalid_enum_value,options:r}),q}return Fe(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 Qt.create(t,{...this._def,...n})}exclude(t,n=this._def){return Qt.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Qt.create=Cc;class Ii extends oe{_parse(t){const n=ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==F.string&&r.parsedType!==F.number){const o=ae.objectValues(n);return T(r,{expected:ae.joinValues(o),received:r.parsedType,code:M.invalid_type}),q}if(this._cache||(this._cache=new Set(ae.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=ae.objectValues(n);return T(r,{received:r.data,code:M.invalid_enum_value,options:o}),q}return Fe(t.data)}get enum(){return this._def.values}}Ii.create=(e,t)=>new Ii({values:e,typeName:W.ZodNativeEnum,...X(t)});class ar extends oe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==F.promise&&n.common.async===!1)return T(n,{code:M.invalid_type,expected:F.promise,received:n.parsedType}),q;const r=n.parsedType===F.promise?n.data:Promise.resolve(n.data);return Fe(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ar.create=(e,t)=>new ar({type:e,typeName:W.ZodPromise,...X(t)});class en extends oe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===W.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{T(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){const i=o.transform(r.data,s);if(r.common.async)return Promise.resolve(i).then(async a=>{if(n.value==="aborted")return q;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?q:c.status==="dirty"||n.value==="dirty"?fn(c.value):c});{if(n.value==="aborted")return q;const a=this._def.schema._parseSync({data:i,path:r.path,parent:r});return a.status==="aborted"?q:a.status==="dirty"||n.value==="dirty"?fn(a.value):a}}if(o.type==="refinement"){const i=a=>{const c=o.refinement(a,s);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"?q:(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"?q:(a.status==="dirty"&&n.dirty(),i(a.value).then(()=>({status:n.value,value:a.value}))))}if(o.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Yt(i))return q;const a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Yt(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:n.value,value:a})):q);ae.assertNever(o)}}en.create=(e,t,n)=>new en({schema:e,typeName:W.ZodEffects,effect:t,...X(n)});en.createWithPreprocess=(e,t,n)=>new en({schema:t,effect:{type:"preprocess",transform:e},typeName:W.ZodEffects,...X(n)});class bt extends oe{_parse(t){return this._getType(t)===F.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}bt.create=(e,t)=>new bt({innerType:e,typeName:W.ZodOptional,...X(t)});class tn extends oe{_parse(t){return this._getType(t)===F.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tn.create=(e,t)=>new tn({innerType:e,typeName:W.ZodNullable,...X(t)});class jo extends oe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===F.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}jo.create=(e,t)=>new jo({innerType:e,typeName:W.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});class Io extends oe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return nr(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Io.create=(e,t)=>new Io({innerType:e,typeName:W.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});class Pi extends oe{_parse(t){if(this._getType(t)!==F.nan){const r=this._getOrReturnCtx(t);return T(r,{code:M.invalid_type,expected:F.nan,received:r.parsedType}),q}return{status:"valid",value:t.data}}}Pi.create=e=>new Pi({typeName:W.ZodNaN,...X(e)});class Kv extends oe{_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 ys extends oe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?q:s.status==="dirty"?(n.dirty(),fn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?q:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new ys({in:t,out:n,typeName:W.ZodPipeline})}}class Po extends oe{_parse(t){const n=this._def.innerType._parse(t),r=o=>(Yt(o)&&(o.value=Object.freeze(o.value)),o);return nr(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}Po.create=(e,t)=>new Po({innerType:e,typeName:W.ZodReadonly,...X(t)});var W;(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"})(W||(W={}));const U=ot.create,ln=Jt.create,Ye=No.create,Xv=Ao.create;kt.create;const nn=qe.create,pe=ve.create,Rc=or.create;sr.create;Ot.create;const Cn=ir.create,Mt=Qt.create;ar.create;bt.create;tn.create;const Yv=10,Oo={name:"space_search",description:"Find Hugging Face Spaces using semantic search. Include links to the Space when presenting the results.",schema:pe({query:U().min(1,"Query is required").max(100,"Query too long").describe("Semantic Search Query"),limit:ln().optional().default(Yv).describe("Number of results to return"),mcp:Ye().optional().default(!1).describe("Only return MCP Server enabled Spaces")}),annotations:{title:"Hugging Face Space Search"}},Fo={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:pe({query:U().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:U().optional().describe("Organization or user who created the model (e.g., 'google', 'meta-llama', 'microsoft')"),task:U().optional().describe("Model task type (e.g., 'text-generation', 'image-classification', 'translation')"),library:U().optional().describe("Framework the model uses (e.g., 'transformers', 'diffusers', 'timm')"),sort:Mt(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads , likes, createdAt, lastModified"),limit:ln().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Model Search"}};new Promise(e=>{});var Qr=65536;Jv();function Jv(){try{return new Uint32Array(Qr)}catch{const t=new Array(Qr);for(let n=0;n<Qr;n++)t[n]=0;return t}}const Qv={name:"model_details",schema:pe({model_id:U().min(1,"Model ID is required").describe("The Model ID in author/model format (e.g., microsoft/DialoGPT-large)")})};pe({model_id:U().min(5,"Model ID is required").max(50).describe("The Model ID in author/model format (e.g. 'openai/gpt-oss-120b')")});const Do={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:pe({query:U().min(3,"Supply at least one search term").max(200,"Query too long").describe("Semantic Search query"),results_limit:ln().optional().default(12).describe("Number of results to return"),concise_only:Ye().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"}},$o={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:pe({query:U().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:U().optional().describe("Organization or user who created the dataset (e.g., 'google', 'facebook', 'allenai')"),tags:nn(U()).optional().describe("Tags to filter datasets (e.g., ['language:en', 'size_categories:1M<n<10M', 'task_categories:text-classification'])"),sort:Mt(["trendingScore","downloads","likes","createdAt","lastModified"]).optional().describe("Sort order: trendingScore, downloads, likes, createdAt, lastModified"),limit:ln().min(1).max(100).optional().default(20).describe("Maximum number of results to return")}),annotations:{title:"Dataset Search"}},ex={name:"dataset_details",schema:pe({dataset_id:U().min(5,"Dataset ID is required").describe("The Dataset ID (e.g. Anthropic/hh-rlhf, squad)")})};pe({dataset_id:U().min(3,"Dataset ID is required").max(100).describe("The Dataset ID (e.g. 'Anthropic/hh-rlhf', 'squad')")});const Lo={name:"hub_repo_details",description:"Get details for one or more Hugging Face repos (model, dataset, or space). Auto-detects type unless specified.",schema:pe({repo_ids:nn(U().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:Mt(["model","dataset","space"]).optional().describe("Specify lookup type; otherwise auto-detects"),include_readme:Ye().default(!1).describe("Include README from the repo")}),annotations:{title:"Hub Repo Details"}},Ec={name:"duplicate_space",schema:pe({sourceSpaceId:U().min(1).describe("Space ID to copy (e.g., 'username/space-name')"),newSpaceId:U().optional().describe("Name for the new space (optional, defaults to source space-name)"),hardware:Mt(["freecpu","zerogpu"]).optional().describe('Either "freecpu" or "zerogpu" (defaults based on source). Both options are in the free tier.'),private:Ye().optional().default(!0).describe("Check with User whether the new space should be public or private.")}),annotations:{title:"Duplicate Hugging Face Space"}};pe({username:U().optional().describe("Username to get spaces for (defaults to authenticated user)")});const kc={name:"space_files",schema:pe({spaceName:U().optional().describe('Space identifier in format "username/spacename"'),fileType:Mt(["all","image","audio"]).optional().default("all").describe("Filter files by type: all (default), image, or audio files only")}),annotations:{title:"Space Files List"}};pe({fileType:Mt(["all","image","audio","text"]).optional().default("all").describe("Filter by type")});pe({});pe({user_id:U().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")});pe({paper_id:U().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 ws=typeof window<"u"?window:{};function tx(){var e=ws.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function nx(){var e=function(){};return rx()?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 rx(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{ws.ActiveXObject&&(e=!0)}return e}tx()?ws.DOMParser:nx();const Vo={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:pe({doc_url:U().max(200,"Query too long").describe("Documentation URL (Hugging Face or Gradio)"),offset:ln().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"}},zo={name:"hf_doc_search",description:"Search and Discover Hugging Face Product and Library documentation. Send an empty query to discover structure and navigation instructions. You MUST consult this tool for the most up-to-date information when using Hugging Face libraries. Combine with the Product filter to focus results.",schema:pe({query:U().max(200,"Query too long").superRefine((e,t)=>{const n=e.trim();n.length!==0&&n.length<3&&t.addIssue({code:M.too_small,type:"string",minimum:3,inclusive:!0,message:"Supply at least one search term"})}).describe("Start with an empty query for structure, endpoint discovery and navigation tips. Use semantic queries for targetted searches."),product:U().optional().describe("Filter by Product. Supply when known for focused results")}),annotations:{title:"Hugging Face Documentation Search"}};pe({space_id:U().min(1).describe("Space ID in 'username/repo' format")});var Bn={},eo,Oi;function ox(){return Oi||(Oi=1,eo=function(t){return t.map(function(n){return n===""?"''":n&&typeof n=="object"?n.op.replace(/(.)/g,"\\$1"):/["\s\\]/.test(n)&&!/'/.test(n)?"'"+n.replace(/(['])/g,"\\$1")+"'":/["'\s]/.test(n)?'"'+n.replace(/(["\\$`!])/g,"\\$1")+'"':String(n).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}),eo}var to,Fi;function sx(){if(Fi)return to;Fi=1;for(var e="(?:"+["\\|\\|","\\&\\&",";;","\\|\\&","\\<\\(","\\<\\<\\<",">>",">\\&","<\\&","[&;()|<>]"].join("|")+")",t=new RegExp("^"+e+"$"),n="|&;()<> \\t",r='"((\\\\"|[^"])*?)"',o="'((\\\\'|[^'])*?)'",s=/^#$/,i="'",a='"',c="$",u="",d=4294967296,g=0;g<4;g++)u+=(d*Math.random()).toString(16);var m=new RegExp("^"+u);function f(y,x){for(var b=x.lastIndex,w=[],_;_=x.exec(y);)w.push(_),x.lastIndex===_.index&&(x.lastIndex+=1);return x.lastIndex=b,w}function v(y,x,b){var w=typeof y=="function"?y(b):y[b];return typeof w>"u"&&b!=""?w="":typeof w>"u"&&(w="$"),typeof w=="object"?x+u+JSON.stringify(w)+u:x+w}function p(y,x,b){b||(b={});var w=b.escape||"\\",_="(\\"+w+`['"`+n+`]|[^\\s'"`+n+"])+",C=new RegExp(["("+e+")","("+_+"|"+r+"|"+o+")+"].join("|"),"g"),N=f(y,C);if(N.length===0)return[];x||(x={});var E=!1;return N.map(function(S){var j=S[0];if(!j||E)return;if(t.test(j))return{op:j};var L=!1,K=!1,B="",Z=!1,A;function te(){A+=1;var R,k,z=j.charAt(A);if(z==="{"){if(A+=1,j.charAt(A)==="}")throw new Error("Bad substitution: "+j.slice(A-2,A+1));if(R=j.indexOf("}",A),R<0)throw new Error("Bad substitution: "+j.slice(A));k=j.slice(A,R),A=R}else if(/[*@#?$!_-]/.test(z))k=z,A+=1;else{var V=j.slice(A);R=V.match(/[^\w\d_]/),R?(k=V.slice(0,R.index),A+=R.index-1):(k=V,A=j.length)}return v(x,"",k)}for(A=0;A<j.length;A++){var I=j.charAt(A);if(Z=Z||!L&&(I==="*"||I==="?"),K)B+=I,K=!1;else if(L)I===L?L=!1:L==i?B+=I:I===w?(A+=1,I=j.charAt(A),I===a||I===w||I===c?B+=I:B+=w+I):I===c?B+=te():B+=I;else if(I===a||I===i)L=I;else{if(t.test(I))return{op:j};if(s.test(I)){E=!0;var Q={comment:y.slice(S.index+A+1)};return B.length?[B,Q]:[Q]}else I===w?K=!0:I===c?B+=te():B+=I}}return Z?{op:"glob",pattern:B}:B}).reduce(function(S,j){return typeof j>"u"?S:S.concat(j)},[])}return to=function(x,b,w){var _=p(x,b,w);return typeof b!="function"?_:_.reduce(function(C,N){if(typeof N=="object")return C.concat(N);var E=N.split(RegExp("("+u+".*?"+u+")","g"));return E.length===1?C.concat(E[0]):C.concat(E.filter(Boolean).map(function(S){return m.test(S)?JSON.parse(S.split(u)[1]):S}))},[])},to}var Di;function ix(){return Di||(Di=1,Bn.quote=ox(),Bn.parse=sx()),Bn}ix();const ax=["cpu-basic","cpu-upgrade","cpu-performance","cpu-xl"],lx=["sprx8","zero-a10g","t4-small","t4-medium","l4x1","l4x4","l40sx1","l40sx4","l40sx8","a10g-small","a10g-large","a10g-largex2","a10g-largex4","a100-large","h100","h100x8"],cx=["inf2x6"],Ho=[...ax,...lx,...cx],Nt=pe({namespace:U().optional().describe("Target namespace (username or organization). Defaults to current user.")}),ux=Nt.extend({image:U().describe('Docker image or HF Space URL (e.g., "python:3.12" or "hf.co/spaces/user/space")'),command:Rc([U(),nn(U())]).describe('Command to execute. Array format recommended (e.g., ["python", "script.py"]). String format is parsed with POSIX shell semantics (quotes, escaping). For multiline scripts, use array with newlines in arguments.'),flavor:Mt(Ho).optional().default("cpu-basic").describe(`Hardware flavor. Options: ${Ho.join(", ")}`),env:Cn(U()).optional().describe("Environment variables as key-value pairs"),secrets:Cn(U()).optional().describe("Secrets as key-value pairs. Use HF_TOKEN=$HF_TOKEN to include your token"),timeout:U().optional().describe('Max duration (e.g., "5m", "2h", "30s"). Default: 30m').default("30m"),detach:Ye().optional().default(!0).describe("Run in background and return after 10 seconds (default: true)")}),dx=Nt.extend({script:U().describe("Python script: local file path, URL, or inline code. UV will handle dependencies automatically."),with_deps:nn(U()).optional().describe("Additional package dependencies"),script_args:nn(U()).optional().describe("Arguments to pass to the script"),python:U().optional().describe('Python interpreter version (e.g., "3.12")'),flavor:Mt(Ho).optional().default("cpu-basic").describe("Hardware flavor"),env:Cn(U()).optional().describe("Environment variables as key-value pairs"),secrets:Cn(U()).optional().describe("Secrets as key-value pairs. Use HF_TOKEN=$HF_TOKEN to include your token"),timeout:U().optional().default("30m").describe("Max duration"),detach:Ye().optional().default(!0).describe("Run in background and return after 10 seconds")});Nt.extend({all:Ye().optional().default(!1).describe("Show all jobs (default: only running)"),status:U().optional().describe('Filter by status ("RUNNING", "COMPLETED", "CANCELED", "ERROR", "DELETED")')});Nt.extend({job_id:U().describe("Job ID to fetch logs from"),tail:ln().optional().default(20).describe("Number of lines to return (default: 20)")});Nt.extend({job_id:Rc([U(),nn(U())]).describe("Job ID(s) to inspect")});Nt.extend({job_id:U().describe("Job ID to cancel")});ux.extend({schedule:U().describe("Schedule: cron expression or shorthand (@hourly, @daily, @weekly, @monthly, @yearly)"),suspend:Ye().optional().default(!1).describe("Create in suspended state")});dx.extend({schedule:U().describe("Schedule: cron expression or shorthand"),suspend:Ye().optional().default(!1).describe("Create in suspended state")});Nt.extend({all:Ye().optional().default(!1).describe("Show all scheduled jobs (default: hide suspended)")});Nt.extend({scheduled_job_id:U().describe("Scheduled job ID")});pe({command:U().optional().describe('Command to execute: "run", "uv", "ps", "logs", "inspect", "cancel", "scheduled run", "scheduled uv", "scheduled ps", "scheduled inspect", "scheduled delete", "scheduled suspend", "scheduled resume"'),args:Cn(Xv()).optional().describe("Command-specific arguments as a JSON object")});const $i=Oo.name,Li=Fo.name,fx=Qv.name,Vi=Do.name,zi=$o.name,mx=ex.name,pn=Lo.name,Hi=Ec.name,Gi=kc.name,Bi=zo.name,Ui=Vo.name;function Wi(e){const t=new Set,n=[];let r=!1;for(const o of e){if(o===fx||o===mx){r=!0;continue}t.has(o)||(t.add(o),n.push(o))}return r&&!t.has(pn)&&(t.add(pn),n.push(pn)),n}const no=e=>fetch(e).then(t=>{if(!t.ok)throw new Error(`Failed to fetch: ${t.status}`);return t.json()});function gx(){var S,j,L,K,B,Z,A,te,I,Q,R;const{data:e,error:t}=mn("/api/transport",no,{refreshInterval:3e3,revalidateOnFocus:!0,revalidateOnReconnect:!0});mn("/api/sessions",no,{refreshInterval:3e3,revalidateOnFocus:!0});const{data:n}=mn("/api/settings",no),r=((S=n==null?void 0:n.builtInTools)==null?void 0:S.includes(yi))??!1,o=((j=n==null?void 0:n.builtInTools)==null?void 0:j.includes(wi))??!1,[s,i]=h.useState(["","",""]),[a,c]=h.useState(["","",""]),[u,d]=h.useState([!1,!1,!1]),[g,m]=h.useState(!1);h.useEffect(()=>{if(n!=null&&n.spaceTools&&!g){const k=["","",""],z=["","",""],V=[!1,!1,!1];n.spaceTools.forEach((ee,se)=>{se<3&&(k[se]=ee.name,z[se]=ee.subdomain,V[se]=!0)}),i(k),c(z),d(V),m(!0)}},[n,g]);const f=!e&&!t,v=t?t.message:null,p=async(k,z)=>{try{const V=n||{builtInTools:[]},ee=Wi(V.builtInTools),se=z?[...ee.filter(ne=>ne!==k),k]:ee.filter(ne=>ne!==k),ce=Wi(se),be={...V,builtInTools:ce};Un("/api/settings",be,!1);const Se=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({builtInTools:ce})});if(!Se.ok)throw new Error(`Failed to update tool settings: ${Se.status}`);Un("/api/settings"),console.log(`${k} is now ${z?"enabled":"disabled"}`)}catch(V){console.error("Error updating tool settings:",V),alert(`Error updating ${k}: ${V instanceof Error?V.message:"Unknown error"}`),Un("/api/settings")}},y=async(k,z)=>{const V=[...u];V[k]=z,d(V),await w(V)},x=async(k,z)=>{const V=[...s];V[k]=z,i(V),u[k]&&await w(u)},b=async(k,z)=>{const V=[...a];V[k]=z,c(V),u[k]&&await w(u)},w=async k=>{try{const z=[];for(let ee=0;ee<3;ee++)k[ee]&&s[ee]&&a[ee]&&z.push({_id:`space-${ee}`,name:s[ee],subdomain:a[ee],emoji:"🔧"});const V=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spaceTools:z})});if(!V.ok)throw new Error(`Failed to update space tools: ${V.status}`)}catch(z){console.error("Error updating space tools:",z)}},_=async()=>{const k="https://huggingface.co/mcp";try{await navigator.clipboard.writeText(k)}catch(z){console.error("Failed to copy URL:",z)}},C=()=>{window.open("https://huggingface.co/settings/mcp","_blank")},N={paper_search:{id:Vi,label:Do.annotations.title,description:Do.description,settings:{enabled:((L=n==null?void 0:n.builtInTools)==null?void 0:L.includes(Vi))??!0}},space_search:{id:$i,label:Oo.annotations.title,description:Oo.description,settings:{enabled:((K=n==null?void 0:n.builtInTools)==null?void 0:K.includes($i))??!0}},model_search:{id:Li,label:Fo.annotations.title,description:Fo.description,settings:{enabled:((B=n==null?void 0:n.builtInTools)==null?void 0:B.includes(Li))??!0}},dataset_search:{id:zi,label:$o.annotations.title,description:$o.description,settings:{enabled:((Z=n==null?void 0:n.builtInTools)==null?void 0:Z.includes(zi))??!0}},hub_repo_details:{id:pn,label:Lo.annotations.title,description:Lo.description,settings:{enabled:((A=n==null?void 0:n.builtInTools)==null?void 0:A.includes(pn))??!0}},include_readme:{id:yi,label:"Allow README Include (flag)",description:"Allows hub_repo_details to attach README content when the tool request explicitly opts in. Requires reconnect to take effect.",settings:{enabled:r}},doc_semantic_search:{id:Bi,label:zo.annotations.title,description:zo.description,settings:{enabled:((te=n==null?void 0:n.builtInTools)==null?void 0:te.includes(Bi))??!0}},doc_fetch:{id:Ui,label:Vo.annotations.title,description:Vo.description,settings:{enabled:((I=n==null?void 0:n.builtInTools)==null?void 0:I.includes(Ui))??!0}}},E={duplicate_space:{id:Hi,label:Ec.annotations.title,description:"Duplicate a Hugging Face Space to your account.",settings:{enabled:((Q=n==null?void 0:n.builtInTools)==null?void 0:Q.includes(Hi))??!0}},space_files:{id:Gi,label:kc.annotations.title,description:"List all files in a static Hugging Face Space with download URLs.",settings:{enabled:((R=n==null?void 0:n.builtInTools)==null?void 0:R.includes(Gi))??!0}},no_gradio_images:{id:wi,label:"Disable Gradio Images (flag)",description:"Strips image responses from Gradio spaces. Mirrors the 'no_image_content' URL parameter and requires reconnect to take effect.",settings:{enabled:o}}};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(Sv,{defaultValue:"metrics",className:"w-full",children:[l.jsxs(_v,{className:"mb-6 w-full overflow-x-auto flex-nowrap",children:[l.jsx(Ut,{value:"metrics",className:"whitespace-nowrap",children:"📊 Metrics"}),l.jsx(Ut,{value:"mcp",className:"whitespace-nowrap",children:"🔧 MCP"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ut,{value:"search",className:"whitespace-nowrap",children:"🔍 Search"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ut,{value:"spaces",className:"whitespace-nowrap",children:"🚀 Spaces"}),!(e!=null&&e.externalApiMode)&&l.jsx(Ut,{value:"gradio",className:"whitespace-nowrap",children:"🚀 Gradio"}),l.jsx(Ut,{value:"home",className:"whitespace-nowrap",children:"🏠 Home"})]}),l.jsx(Wt,{value:"metrics",className:"mt-0",children:l.jsx(fv,{})}),l.jsx(Wt,{value:"mcp",className:"mt-0",children:l.jsx(gv,{})}),!(e!=null&&e.externalApiMode)&&l.jsx(Wt,{value:"search",className:"mt-0",children:l.jsx($s,{title:"🤗 Hugging Face Search Tools (MCP)",description:"Find and use Hugging Face and Community content.",tools:N,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Wt,{value:"spaces",className:"mt-0",children:l.jsx($s,{title:"🤗 Hugging Face Space Tools (MCP)",description:"Manage and duplicate Hugging Face Spaces.",tools:E,onToolToggle:p})}),!(e!=null&&e.externalApiMode)&&l.jsx(Wt,{value:"gradio",className:"mt-0",children:l.jsx(Od,{spaceNames:s,spaceSubdomains:a,enabledSpaces:u,onSpaceToolToggle:y,onSpaceToolNameChange:x,onSpaceToolSubdomainChange:b})}),l.jsx(Wt,{value:"home",className:"mt-0",children:l.jsxs(st,{children:[l.jsxs(it,{children:[l.jsx(at,{children:"🤗 HF MCP Server"}),l.jsx(Ft,{children:"Connect with AI assistants through the Model Context Protocol"})]}),l.jsxs(lt,{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(It,{}),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(It,{}),l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs(jt,{size:"xl",onClick:_,className:"w-full transition-all duration-200 active:bg-green-500 active:border-green-500 touch-manipulation",children:[l.jsx(_d,{className:"mr-2 h-5 w-5"}),"Copy MCP URL"]}),l.jsxs(jt,{size:"xl",variant:"outline",onClick:C,className:"w-full touch-manipulation",children:[l.jsx(kd,{className:"mr-2 h-5 w-5"}),"Go to Settings"]})]})]})]})})]})})}),l.jsx(pv,{isLoading:f,error:v,transportInfo:e||{transport:"unknown"}})]})}jc.createRoot(document.getElementById("root")).render(l.jsx(h.StrictMode,{children:l.jsx(gx,{})}));