@elizaos/cli 1.0.0-alpha.49 → 1.0.0-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-C4DT2qHP.js → index-Dra3V-XG.js} +1 -1
- package/dist/assets/index-Dra3V-XG.js.br +0 -0
- package/dist/{chunk-D3MPK7XQ.js → chunk-4XKIS5JH.js} +1 -1
- package/dist/{chunk-3BFAUOCQ.js → chunk-5JFYVRED.js} +5 -5
- package/dist/{chunk-HHC2KMC3.js → chunk-5XSBQKPW.js} +3 -3
- package/dist/{chunk-TS7BM3KR.js → chunk-6W4G44JY.js} +3 -3
- package/dist/{chunk-BDG7SPMI.js → chunk-6WZG3KG6.js} +1 -1
- package/dist/{chunk-7MLQBJLA.js → chunk-ICHWHYSM.js} +2 -2
- package/dist/{chunk-E74D5PNV.js → chunk-N2T3K45I.js} +4 -4
- package/dist/{chunk-EHSPD767.js → chunk-NVQQWG3K.js} +2 -2
- package/dist/{chunk-UU7U4MNQ.js → chunk-O2MLOJBX.js} +3 -3
- package/dist/{chunk-4UOC2V7B.js → chunk-QPS5KL3F.js} +2 -2
- package/dist/{chunk-IQTVSIUV.js → chunk-RVBPTBUZ.js} +18 -24
- package/dist/{chunk-6IF7U6NO.js → chunk-S6CX6KK5.js} +3 -3
- package/dist/{chunk-DHHB27Q2.js → chunk-SFXDW43I.js} +2 -2
- package/dist/{chunk-NEXIZV3X.js → chunk-VISBGAXE.js} +1 -1
- package/dist/{chunk-74W4ZVZF.js → chunk-WBHGFAXQ.js} +8 -8
- package/dist/{chunk-UJDX2T3J.js → chunk-XNNCG3QR.js} +3 -3
- package/dist/commands/agent.js +3 -3
- package/dist/commands/create.js +4 -4
- package/dist/commands/dev.js +4 -4
- package/dist/commands/env.js +3 -3
- package/dist/commands/plugin.js +4 -4
- package/dist/commands/project.js +5 -5
- package/dist/commands/start.js +8 -8
- package/dist/commands/test.js +5 -5
- package/dist/commands/update.js +4 -4
- package/dist/{eliza-VEOFHONC.js → eliza-HN55JE67.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +16 -16
- package/dist/{registry-EZFHO56C.js → registry-J6VK6F7F.js} +2 -2
- package/package.json +6 -6
- package/templates/plugin-starter/package.json +1 -1
- package/templates/project-starter/package.json +6 -6
- package/templates/project-starter/src/index.ts +1 -1
- package/dist/assets/index-C4DT2qHP.js.br +0 -0
|
@@ -266,6 +266,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${r.do
|
|
|
266
266
|
* @license MIT
|
|
267
267
|
*/var T0="popstate";function YM(t={}){function r(i,o){let{pathname:c,search:f,hash:d}=i.location;return Dm("",{pathname:c,search:f,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function a(i,o){return typeof o=="string"?o:Yl(o)}return FM(r,a,null,t)}function Ke(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}function $n(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function GM(){return Math.random().toString(36).substring(2,10)}function C0(t,r){return{usr:t.state,key:t.key,idx:r}}function Dm(t,r,a=null,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof r=="string"?Ai(r):r,state:a,key:r&&r.key||i||GM()}}function Yl({pathname:t="/",search:r="",hash:a=""}){return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(t+=a.charAt(0)==="#"?a:"#"+a),t}function Ai(t){let r={};if(t){let a=t.indexOf("#");a>=0&&(r.hash=t.substring(a),t=t.substring(0,a));let i=t.indexOf("?");i>=0&&(r.search=t.substring(i),t=t.substring(0,i)),t&&(r.pathname=t)}return r}function FM(t,r,a,i={}){let{window:o=document.defaultView,v5Compat:c=!1}=i,f=o.history,d="POP",h=null,p=g();p==null&&(p=0,f.replaceState({...f.state,idx:p},""));function g(){return(f.state||{idx:null}).idx}function b(){d="POP";let w=g(),C=w==null?null:w-p;p=w,h&&h({action:d,location:S.location,delta:C})}function x(w,C){d="PUSH";let A=Dm(S.location,w,C);p=g()+1;let N=C0(A,p),L=S.createHref(A);try{f.pushState(N,"",L)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;o.location.assign(L)}c&&h&&h({action:d,location:S.location,delta:1})}function E(w,C){d="REPLACE";let A=Dm(S.location,w,C);p=g();let N=C0(A,p),L=S.createHref(A);f.replaceState(N,"",L),c&&h&&h({action:d,location:S.location,delta:0})}function R(w){let C=o.location.origin!=="null"?o.location.origin:o.location.href,A=typeof w=="string"?w:Yl(w);return A=A.replace(/ $/,"%20"),Ke(C,`No window.location.(origin|href) available to create URL for href: ${A}`),new URL(A,C)}let S={get action(){return d},get location(){return t(o,f)},listen(w){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(T0,b),h=w,()=>{o.removeEventListener(T0,b),h=null}},createHref(w){return r(o,w)},createURL:R,encodeLocation(w){let C=R(w);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:x,replace:E,go(w){return f.go(w)}};return S}function ZS(t,r,a="/"){return QM(t,r,a,!1)}function QM(t,r,a,i){let o=typeof r=="string"?Ai(r):r,c=Tr(o.pathname||"/",a);if(c==null)return null;let f=JS(t);XM(f);let d=null;for(let h=0;d==null&&h<f.length;++h){let p=iD(c);d=aD(f[h],p,i)}return d}function JS(t,r=[],a=[],i=""){let o=(c,f,d)=>{let h={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};h.relativePath.startsWith("/")&&(Ke(h.relativePath.startsWith(i),`Absolute route path "${h.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(i.length));let p=wr([i,h.relativePath]),g=a.concat(h);c.children&&c.children.length>0&&(Ke(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),JS(c.children,r,g,p)),!(c.path==null&&!c.index)&&r.push({path:p,score:nD(p,c.index),routesMeta:g})};return t.forEach((c,f)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,f);else for(let h of eE(c.path))o(c,f,h)}),r}function eE(t){let r=t.split("/");if(r.length===0)return[];let[a,...i]=r,o=a.endsWith("?"),c=a.replace(/\?$/,"");if(i.length===0)return o?[c,""]:[c];let f=eE(i.join("/")),d=[];return d.push(...f.map(h=>h===""?c:[c,h].join("/"))),o&&d.push(...f),d.map(h=>t.startsWith("/")&&h===""?"/":h)}function XM(t){t.sort((r,a)=>r.score!==a.score?a.score-r.score:rD(r.routesMeta.map(i=>i.childrenIndex),a.routesMeta.map(i=>i.childrenIndex)))}var WM=/^:[\w-]+$/,KM=3,ZM=2,JM=1,eD=10,tD=-2,A0=t=>t==="*";function nD(t,r){let a=t.split("/"),i=a.length;return a.some(A0)&&(i+=tD),r&&(i+=ZM),a.filter(o=>!A0(o)).reduce((o,c)=>o+(WM.test(c)?KM:c===""?JM:eD),i)}function rD(t,r){return t.length===r.length&&t.slice(0,-1).every((i,o)=>i===r[o])?t[t.length-1]-r[r.length-1]:0}function aD(t,r,a=!1){let{routesMeta:i}=t,o={},c="/",f=[];for(let d=0;d<i.length;++d){let h=i[d],p=d===i.length-1,g=c==="/"?r:r.slice(c.length)||"/",b=Jc({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},g),x=h.route;if(!b&&p&&a&&!i[i.length-1].route.index&&(b=Jc({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},g)),!b)return null;Object.assign(o,b.params),f.push({params:o,pathname:wr([c,b.pathname]),pathnameBase:uD(wr([c,b.pathnameBase])),route:x}),b.pathnameBase!=="/"&&(c=wr([c,b.pathnameBase]))}return f}function Jc(t,r){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[a,i]=sD(t.path,t.caseSensitive,t.end),o=r.match(a);if(!o)return null;let c=o[0],f=c.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:i.reduce((p,{paramName:g,isOptional:b},x)=>{if(g==="*"){let R=d[x]||"";f=c.slice(0,c.length-R.length).replace(/(.)\/+$/,"$1")}const E=d[x];return b&&!E?p[g]=void 0:p[g]=(E||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:f,pattern:t}}function sD(t,r=!1,a=!0){$n(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let i=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,d,h)=>(i.push({paramName:d,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(i.push({paramName:"*"}),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,r?void 0:"i"),i]}function iD(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return $n(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),t}}function Tr(t,r){if(r==="/")return t;if(!t.toLowerCase().startsWith(r.toLowerCase()))return null;let a=r.endsWith("/")?r.length-1:r.length,i=t.charAt(a);return i&&i!=="/"?null:t.slice(a)||"/"}function lD(t,r="/"){let{pathname:a,search:i="",hash:o=""}=typeof t=="string"?Ai(t):t;return{pathname:a?a.startsWith("/")?a:oD(a,r):r,search:fD(i),hash:dD(o)}}function oD(t,r){let a=r.replace(/\/+$/,"").split("/");return t.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function uh(t,r,a,i){return`Cannot include a '${t}' character in a manually specified \`to.${r}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function cD(t){return t.filter((r,a)=>a===0||r.route.path&&r.route.path.length>0)}function tE(t){let r=cD(t);return r.map((a,i)=>i===r.length-1?a.pathname:a.pathnameBase)}function nE(t,r,a,i=!1){let o;typeof t=="string"?o=Ai(t):(o={...t},Ke(!o.pathname||!o.pathname.includes("?"),uh("?","pathname","search",o)),Ke(!o.pathname||!o.pathname.includes("#"),uh("#","pathname","hash",o)),Ke(!o.search||!o.search.includes("#"),uh("#","search","hash",o)));let c=t===""||o.pathname==="",f=c?"/":o.pathname,d;if(f==null)d=a;else{let b=r.length-1;if(!i&&f.startsWith("..")){let x=f.split("/");for(;x[0]==="..";)x.shift(),b-=1;o.pathname=x.join("/")}d=b>=0?r[b]:"/"}let h=lD(o,d),p=f&&f!=="/"&&f.endsWith("/"),g=(c||f===".")&&a.endsWith("/");return!h.pathname.endsWith("/")&&(p||g)&&(h.pathname+="/"),h}var wr=t=>t.join("/").replace(/\/\/+/g,"/"),uD=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),fD=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,dD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function hD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var rE=["POST","PUT","PATCH","DELETE"];new Set(rE);var mD=["GET",...rE];new Set(mD);var Ni=y.createContext(null);Ni.displayName="DataRouter";var bu=y.createContext(null);bu.displayName="DataRouterState";var aE=y.createContext({isTransitioning:!1});aE.displayName="ViewTransition";var pD=y.createContext(new Map);pD.displayName="Fetchers";var vD=y.createContext(null);vD.displayName="Await";var In=y.createContext(null);In.displayName="Navigation";var ro=y.createContext(null);ro.displayName="Location";var Vn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Vn.displayName="Route";var Sp=y.createContext(null);Sp.displayName="RouteError";function gD(t,{relative:r}={}){Ke(ao(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:i}=y.useContext(In),{hash:o,pathname:c,search:f}=so(t,{relative:r}),d=c;return a!=="/"&&(d=c==="/"?a:wr([a,c])),i.createHref({pathname:d,search:f,hash:o})}function ao(){return y.useContext(ro)!=null}function va(){return Ke(ao(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(ro).location}var sE="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function iE(t){y.useContext(In).static||y.useLayoutEffect(t)}function Oi(){let{isDataRoute:t}=y.useContext(Vn);return t?jD():yD()}function yD(){Ke(ao(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Ni),{basename:r,navigator:a}=y.useContext(In),{matches:i}=y.useContext(Vn),{pathname:o}=va(),c=JSON.stringify(tE(i)),f=y.useRef(!1);return iE(()=>{f.current=!0}),y.useCallback((h,p={})=>{if($n(f.current,sE),!f.current)return;if(typeof h=="number"){a.go(h);return}let g=nE(h,JSON.parse(c),o,p.relative==="path");t==null&&r!=="/"&&(g.pathname=g.pathname==="/"?r:wr([r,g.pathname])),(p.replace?a.replace:a.push)(g,p.state,p)},[r,a,c,o,t])}y.createContext(null);function lE(){let{matches:t}=y.useContext(Vn),r=t[t.length-1];return r?r.params:{}}function so(t,{relative:r}={}){let{matches:a}=y.useContext(Vn),{pathname:i}=va(),o=JSON.stringify(tE(a));return y.useMemo(()=>nE(t,JSON.parse(o),i,r==="path"),[t,o,i,r])}function bD(t,r){return oE(t,r)}function oE(t,r,a,i){var A;Ke(ao(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o,static:c}=y.useContext(In),{matches:f}=y.useContext(Vn),d=f[f.length-1],h=d?d.params:{},p=d?d.pathname:"/",g=d?d.pathnameBase:"/",b=d&&d.route;{let N=b&&b.path||"";cE(p,!b||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${N}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
268
268
|
|
|
269
|
-
Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let x=va(),E;if(r){let N=typeof r=="string"?Ai(r):r;Ke(g==="/"||((A=N.pathname)==null?void 0:A.startsWith(g)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${g}" but pathname "${N.pathname}" was given in the \`location\` prop.`),E=N}else E=x;let R=E.pathname||"/",S=R;if(g!=="/"){let N=g.replace(/^\//,"").split("/");S="/"+R.replace(/^\//,"").split("/").slice(N.length).join("/")}let w=!c&&a&&a.matches&&a.matches.length>0?a.matches:ZS(t,{pathname:S});$n(b||w!=null,`No routes matched location "${E.pathname}${E.search}${E.hash}" `),$n(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${E.pathname}${E.search}${E.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=RD(w&&w.map(N=>Object.assign({},N,{params:Object.assign({},h,N.params),pathname:wr([g,o.encodeLocation?o.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?g:wr([g,o.encodeLocation?o.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),f,a,i);return r&&C?y.createElement(ro.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...E},navigationType:"POP"}},C):C}function xD(){let t=OD(),r=hD(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:i},c={padding:"2px 4px",backgroundColor:i},f=null;return console.error("Error handled by React Router default ErrorBoundary:",t),f=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:c},"ErrorBoundary")," or"," ",y.createElement("code",{style:c},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},r),a?y.createElement("pre",{style:o},a):null,f)}var wD=y.createElement(xD,null),SD=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?y.createElement(Vn.Provider,{value:this.props.routeContext},y.createElement(Sp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function ED({routeContext:t,match:r,children:a}){let i=y.useContext(Ni);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(Vn.Provider,{value:t},a)}function RD(t,r=[],a=null,i=null){if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let o=t,c=a==null?void 0:a.errors;if(c!=null){let h=o.findIndex(p=>p.route.id&&(c==null?void 0:c[p.route.id])!==void 0);Ke(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let f=!1,d=-1;if(a)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=h),p.route.id){let{loaderData:g,errors:b}=a,x=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||x){f=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((h,p,g)=>{let b,x=!1,E=null,R=null;a&&(b=c&&p.route.id?c[p.route.id]:void 0,E=p.route.errorElement||wD,f&&(d<0&&g===0?(cE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,R=null):d===g&&(x=!0,R=p.route.hydrateFallbackElement||null)));let S=r.concat(o.slice(0,g+1)),w=()=>{let C;return b?C=E:x?C=R:p.route.Component?C=y.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=h,y.createElement(ED,{match:p,routeContext:{outlet:h,matches:S,isDataRoute:a!=null},children:C})};return a&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?y.createElement(SD,{location:a.location,revalidation:a.revalidation,component:E,error:b,children:w(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):w()},null)}function Ep(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TD(t){let r=y.useContext(Ni);return Ke(r,Ep(t)),r}function CD(t){let r=y.useContext(bu);return Ke(r,Ep(t)),r}function AD(t){let r=y.useContext(Vn);return Ke(r,Ep(t)),r}function Rp(t){let r=AD(t),a=r.matches[r.matches.length-1];return Ke(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function ND(){return Rp("useRouteId")}function OD(){var i;let t=y.useContext(Sp),r=CD("useRouteError"),a=Rp("useRouteError");return t!==void 0?t:(i=r.errors)==null?void 0:i[a]}function jD(){let{router:t}=TD("useNavigate"),r=Rp("useNavigate"),a=y.useRef(!1);return iE(()=>{a.current=!0}),y.useCallback(async(o,c={})=>{$n(a.current,sE),a.current&&(typeof o=="number"?t.navigate(o):await t.navigate(o,{fromRouteId:r,...c}))},[t,r])}var N0={};function cE(t,r,a){!r&&!N0[t]&&(N0[t]=!0,$n(!1,a))}y.memo(MD);function MD({routes:t,future:r,state:a}){return oE(t,void 0,a,r)}function Ba(t){Ke(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function DD({basename:t="/",children:r=null,location:a,navigationType:i="POP",navigator:o,static:c=!1}){Ke(!ao(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=t.replace(/^\/*/,"/"),d=y.useMemo(()=>({basename:f,navigator:o,static:c,future:{}}),[f,o,c]);typeof a=="string"&&(a=Ai(a));let{pathname:h="/",search:p="",hash:g="",state:b=null,key:x="default"}=a,E=y.useMemo(()=>{let R=Tr(h,f);return R==null?null:{location:{pathname:R,search:p,hash:g,state:b,key:x},navigationType:i}},[f,h,p,g,b,x,i]);return $n(E!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:y.createElement(In.Provider,{value:d},y.createElement(ro.Provider,{children:r,value:E}))}function _D({children:t,location:r}){return bD(_m(t),r)}function _m(t,r=[]){let a=[];return y.Children.forEach(t,(i,o)=>{if(!y.isValidElement(i))return;let c=[...r,o];if(i.type===y.Fragment){a.push.apply(a,_m(i.props.children,c));return}Ke(i.type===Ba,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ke(!i.props.index||!i.props.children,"An index route cannot have child routes.");let f={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(f.children=_m(i.props.children,c)),a.push(f)}),a}var Hc="get",qc="application/x-www-form-urlencoded";function xu(t){return t!=null&&typeof t.tagName=="string"}function LD(t){return xu(t)&&t.tagName.toLowerCase()==="button"}function zD(t){return xu(t)&&t.tagName.toLowerCase()==="form"}function PD(t){return xu(t)&&t.tagName.toLowerCase()==="input"}function kD(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function UD(t,r){return t.button===0&&(!r||r==="_self")&&!kD(t)}var Oc=null;function $D(){if(Oc===null)try{new FormData(document.createElement("form"),0),Oc=!1}catch{Oc=!0}return Oc}var HD=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fh(t){return t!=null&&!HD.has(t)?($n(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qc}"`),null):t}function qD(t,r){let a,i,o,c,f;if(zD(t)){let d=t.getAttribute("action");i=d?Tr(d,r):null,a=t.getAttribute("method")||Hc,o=fh(t.getAttribute("enctype"))||qc,c=new FormData(t)}else if(LD(t)||PD(t)&&(t.type==="submit"||t.type==="image")){let d=t.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=t.getAttribute("formaction")||d.getAttribute("action");if(i=h?Tr(h,r):null,a=t.getAttribute("formmethod")||d.getAttribute("method")||Hc,o=fh(t.getAttribute("formenctype"))||fh(d.getAttribute("enctype"))||qc,c=new FormData(d,t),!$D()){let{name:p,type:g,value:b}=t;if(g==="image"){let x=p?`${p}.`:"";c.append(`${x}x`,"0"),c.append(`${x}y`,"0")}else p&&c.append(p,b)}}else{if(xu(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Hc,i=null,o=qc,f=t}return c&&o==="text/plain"&&(f=c,c=void 0),{action:i,method:a.toLowerCase(),encType:o,formData:c,body:f}}function Tp(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}async function BD(t,r){if(t.id in r)return r[t.id];try{let a=await import(t.module);return r[t.id]=a,a}catch(a){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ID(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function VD(t,r,a){let i=await Promise.all(t.map(async o=>{let c=r.routes[o.route.id];if(c){let f=await BD(c,a);return f.links?f.links():[]}return[]}));return QD(i.flat(1).filter(ID).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function O0(t,r,a,i,o,c){let f=(h,p)=>a[p]?h.route.id!==a[p].route.id:!0,d=(h,p)=>{var g;return a[p].pathname!==h.pathname||((g=a[p].route.path)==null?void 0:g.endsWith("*"))&&a[p].params["*"]!==h.params["*"]};return c==="assets"?r.filter((h,p)=>f(h,p)||d(h,p)):c==="data"?r.filter((h,p)=>{var b;let g=i.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(f(h,p)||d(h,p))return!0;if(h.route.shouldRevalidate){let x=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((b=a[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function YD(t,r,{includeHydrateFallback:a}={}){return GD(t.map(i=>{let o=r.routes[i.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function GD(t){return[...new Set(t)]}function FD(t){let r={},a=Object.keys(t).sort();for(let i of a)r[i]=t[i];return r}function QD(t,r){let a=new Set;return new Set(r),t.reduce((i,o)=>{let c=JSON.stringify(FD(o));return a.has(c)||(a.add(c),i.push({key:c,link:o})),i},[])}function XD(t,r){let a=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return a.pathname==="/"?a.pathname="_root.data":r&&Tr(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.data`:a.pathname=`${a.pathname.replace(/\/$/,"")}.data`,a}function uE(){let t=y.useContext(Ni);return Tp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function WD(){let t=y.useContext(bu);return Tp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Cp=y.createContext(void 0);Cp.displayName="FrameworkContext";function fE(){let t=y.useContext(Cp);return Tp(t,"You must render this element inside a <HydratedRouter> element"),t}function KD(t,r){let a=y.useContext(Cp),[i,o]=y.useState(!1),[c,f]=y.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:p,onMouseLeave:g,onTouchStart:b}=r,x=y.useRef(null);y.useEffect(()=>{if(t==="render"&&f(!0),t==="viewport"){let S=C=>{C.forEach(A=>{f(A.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return x.current&&w.observe(x.current),()=>{w.disconnect()}}},[t]),y.useEffect(()=>{if(i){let S=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(S)}}},[i]);let E=()=>{o(!0)},R=()=>{o(!1),f(!1)};return a?t!=="intent"?[c,x,{}]:[c,x,{onFocus:Ll(d,E),onBlur:Ll(h,R),onMouseEnter:Ll(p,E),onMouseLeave:Ll(g,R),onTouchStart:Ll(b,E)}]:[!1,x,{}]}function Ll(t,r){return a=>{t&&t(a),a.defaultPrevented||r(a)}}function ZD({page:t,...r}){let{router:a}=uE(),i=y.useMemo(()=>ZS(a.routes,t,a.basename),[a.routes,t,a.basename]);return i?y.createElement(e_,{page:t,matches:i,...r}):null}function JD(t){let{manifest:r,routeModules:a}=fE(),[i,o]=y.useState([]);return y.useEffect(()=>{let c=!1;return VD(t,r,a).then(f=>{c||o(f)}),()=>{c=!0}},[t,r,a]),i}function e_({page:t,matches:r,...a}){let i=va(),{manifest:o,routeModules:c}=fE(),{basename:f}=uE(),{loaderData:d,matches:h}=WD(),p=y.useMemo(()=>O0(t,r,h,o,i,"data"),[t,r,h,o,i]),g=y.useMemo(()=>O0(t,r,h,o,i,"assets"),[t,r,h,o,i]),b=y.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let R=new Set,S=!1;if(r.forEach(C=>{var N;let A=o.routes[C.route.id];!A||!A.hasLoader||(!p.some(L=>L.route.id===C.route.id)&&C.route.id in d&&((N=c[C.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?S=!0:R.add(C.route.id))}),R.size===0)return[];let w=XD(t,f);return S&&R.size>0&&w.searchParams.set("_routes",r.filter(C=>R.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[f,d,i,o,p,r,t,c]),x=y.useMemo(()=>YD(g,o),[g,o]),E=JD(g);return y.createElement(y.Fragment,null,b.map(R=>y.createElement("link",{key:R,rel:"prefetch",as:"fetch",href:R,...a})),x.map(R=>y.createElement("link",{key:R,rel:"modulepreload",href:R,...a})),E.map(({key:R,link:S})=>y.createElement("link",{key:R,...S})))}function t_(...t){return r=>{t.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var dE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{dE&&(window.__reactRouterVersion="7.3.0")}catch{}function n_({basename:t,children:r,window:a}){let i=y.useRef();i.current==null&&(i.current=YM({window:a,v5Compat:!0}));let o=i.current,[c,f]=y.useState({action:o.action,location:o.location}),d=y.useCallback(h=>{y.startTransition(()=>f(h))},[f]);return y.useLayoutEffect(()=>o.listen(d),[o,d]),y.createElement(DD,{basename:t,children:r,location:c.location,navigationType:c.action,navigator:o})}var hE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mE=y.forwardRef(function({onClick:r,discover:a="render",prefetch:i="none",relative:o,reloadDocument:c,replace:f,state:d,target:h,to:p,preventScrollReset:g,viewTransition:b,...x},E){let{basename:R}=y.useContext(In),S=typeof p=="string"&&hE.test(p),w,C=!1;if(typeof p=="string"&&S&&(w=p,dE))try{let H=new URL(window.location.href),K=p.startsWith("//")?new URL(H.protocol+p):new URL(p),Z=Tr(K.pathname,R);K.origin===H.origin&&Z!=null?p=Z+K.search+K.hash:C=!0}catch{$n(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let A=gD(p,{relative:o}),[N,L,_]=KD(i,x),k=s_(p,{replace:f,state:d,target:h,preventScrollReset:g,relative:o,viewTransition:b});function I(H){r&&r(H),H.defaultPrevented||k(H)}let Y=y.createElement("a",{...x,..._,href:w||A,onClick:C||c?r:I,ref:t_(E,L),target:h,"data-discover":!S&&a==="render"?"true":void 0});return N&&!S?y.createElement(y.Fragment,null,Y,y.createElement(ZD,{page:A})):Y});mE.displayName="Link";var Ya=y.forwardRef(function({"aria-current":r="page",caseSensitive:a=!1,className:i="",end:o=!1,style:c,to:f,viewTransition:d,children:h,...p},g){let b=so(f,{relative:p.relative}),x=va(),E=y.useContext(bu),{navigator:R,basename:S}=y.useContext(In),w=E!=null&&u_(b)&&d===!0,C=R.encodeLocation?R.encodeLocation(b).pathname:b.pathname,A=x.pathname,N=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;a||(A=A.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&S&&(N=Tr(N,S)||N);const L=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let _=A===C||!o&&A.startsWith(C)&&A.charAt(L)==="/",k=N!=null&&(N===C||!o&&N.startsWith(C)&&N.charAt(C.length)==="/"),I={isActive:_,isPending:k,isTransitioning:w},Y=_?r:void 0,H;typeof i=="function"?H=i(I):H=[i,_?"active":null,k?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let K=typeof c=="function"?c(I):c;return y.createElement(mE,{...p,"aria-current":Y,className:H,ref:g,style:K,to:f,viewTransition:d},typeof h=="function"?h(I):h)});Ya.displayName="NavLink";var r_=y.forwardRef(({discover:t="render",fetcherKey:r,navigate:a,reloadDocument:i,replace:o,state:c,method:f=Hc,action:d,onSubmit:h,relative:p,preventScrollReset:g,viewTransition:b,...x},E)=>{let R=o_(),S=c_(d,{relative:p}),w=f.toLowerCase()==="get"?"get":"post",C=typeof d=="string"&&hE.test(d),A=N=>{if(h&&h(N),N.defaultPrevented)return;N.preventDefault();let L=N.nativeEvent.submitter,_=(L==null?void 0:L.getAttribute("formmethod"))||f;R(L||N.currentTarget,{fetcherKey:r,method:_,navigate:a,replace:o,state:c,relative:p,preventScrollReset:g,viewTransition:b})};return y.createElement("form",{ref:E,method:w,action:S,onSubmit:i?h:A,...x,"data-discover":!C&&t==="render"?"true":void 0})});r_.displayName="Form";function a_(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pE(t){let r=y.useContext(Ni);return Ke(r,a_(t)),r}function s_(t,{target:r,replace:a,state:i,preventScrollReset:o,relative:c,viewTransition:f}={}){let d=Oi(),h=va(),p=so(t,{relative:c});return y.useCallback(g=>{if(UD(g,r)){g.preventDefault();let b=a!==void 0?a:Yl(h)===Yl(p);d(t,{replace:b,state:i,preventScrollReset:o,relative:c,viewTransition:f})}},[h,d,p,a,i,r,t,o,c,f])}var i_=0,l_=()=>`__${String(++i_)}__`;function o_(){let{router:t}=pE("useSubmit"),{basename:r}=y.useContext(In),a=ND();return y.useCallback(async(i,o={})=>{let{action:c,method:f,encType:d,formData:h,body:p}=qD(i,r);if(o.navigate===!1){let g=o.fetcherKey||l_();await t.fetch(g,a,o.action||c,{preventScrollReset:o.preventScrollReset,formData:h,body:p,formMethod:o.method||f,formEncType:o.encType||d,flushSync:o.flushSync})}else await t.navigate(o.action||c,{preventScrollReset:o.preventScrollReset,formData:h,body:p,formMethod:o.method||f,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:a,flushSync:o.flushSync,viewTransition:o.viewTransition})},[t,r,a])}function c_(t,{relative:r}={}){let{basename:a}=y.useContext(In),i=y.useContext(Vn);Ke(i,"useFormAction must be used inside a RouteContext");let[o]=i.matches.slice(-1),c={...so(t||".",{relative:r})},f=va();if(t==null){c.search=f.search;let d=new URLSearchParams(c.search),h=d.getAll("index");if(h.some(g=>g==="")){d.delete("index"),h.filter(b=>b).forEach(b=>d.append("index",b));let g=d.toString();c.search=g?`?${g}`:""}}return(!t||t===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:wr([a,c.pathname])),Yl(c)}function u_(t,r={}){let a=y.useContext(aE);Ke(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=pE("useViewTransitionState"),o=so(t,{relative:r.relative});if(!a.isTransitioning)return!1;let c=Tr(a.currentLocation.pathname,i)||a.currentLocation.pathname,f=Tr(a.nextLocation.pathname,i)||a.nextLocation.pathname;return Jc(o.pathname,f)!=null||Jc(o.pathname,c)!=null}new TextEncoder;const f_=pa("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Lm({className:t,variant:r,...a}){return v.jsx("div",{className:le(f_({variant:r}),t),...a})}var d_="Label",vE=y.forwardRef((t,r)=>v.jsx(Se.label,{...t,ref:r,onMouseDown:a=>{var o;a.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));vE.displayName=d_;var gE=vE;const h_=pa("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),eu=y.forwardRef(({className:t,...r},a)=>v.jsx(gE,{ref:a,className:le(h_(),t),...r}));eu.displayName=gE.displayName;const m_=({tag:t,onRemove:r})=>v.jsxs(Lm,{variant:"outline",className:"flex items-center gap-1.5 pr-1.5 text-sm py-1 px-2 transition-colors hover:bg-white hover:text-black dark:hover:text-black",children:[t,v.jsxs(Ie,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(t),className:"hover:bg-muted/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[v.jsx(us,{className:"h-3 w-3"}),v.jsxs("span",{className:"sr-only",children:["Remove ",t]})]})]}),p_=({tags:t,onRemove:r})=>v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(a=>v.jsx(m_,{tag:a,onRemove:r},a))}),v_=({value:t,onChange:r,onKeyDown:a})=>v.jsx(gr,{value:t,onChange:r,onKeyDown:a,placeholder:"Type and press Enter to add...",className:le("bg-background",!t&&"text-muted-foreground")});function g_({title:t,data:r,onChange:a}){const[i,o]=y.useState(""),c=d=>{if(d.key==="Enter"){d.preventDefault();const h=i.trim();h&&!r.includes(h)&&(a([...r,h]),o(""))}},f=d=>{a(r.filter(h=>h!==d))};return v.jsxs("div",{className:"space-y-2",children:[v.jsx(eu,{children:t}),v.jsxs("div",{className:"p-2 bg-card rounded-md border",children:[v.jsx(p_,{tags:r,onRemove:f}),v.jsx(v_,{value:i,onChange:d=>o(d.target.value),onKeyDown:c})]})]})}const io=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("rounded-xl border bg-card text-card-foreground shadow",t),...r}));io.displayName="Card";const yE=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("flex flex-col space-y-1.5 p-6",t),...r}));yE.displayName="CardHeader";const bE=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("font-semibold leading-none tracking-tight",t),...r}));bE.displayName="CardTitle";const y_=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("text-sm text-muted-foreground",t),...r}));y_.displayName="CardDescription";const wu=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("p-6 pt-0",t),...r}));wu.displayName="CardContent";const xE=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("flex items-center p-6 pt-0",t),...r}));xE.displayName="CardFooter";function Ap(t){const r=t+"CollectionProvider",[a,i]=Hn(r),[o,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),f=E=>{const{scope:R,children:S}=E,w=hr.useRef(null),C=hr.useRef(new Map).current;return v.jsx(o,{scope:R,itemMap:C,collectionRef:w,children:S})};f.displayName=r;const d=t+"CollectionSlot",h=hr.forwardRef((E,R)=>{const{scope:S,children:w}=E,C=c(d,S),A=ke(R,C.collectionRef);return v.jsx(sn,{ref:A,children:w})});h.displayName=d;const p=t+"CollectionItemSlot",g="data-radix-collection-item",b=hr.forwardRef((E,R)=>{const{scope:S,children:w,...C}=E,A=hr.useRef(null),N=ke(R,A),L=c(p,S);return hr.useEffect(()=>(L.itemMap.set(A,{ref:A,...C}),()=>void L.itemMap.delete(A))),v.jsx(sn,{[g]:"",ref:N,children:w})});b.displayName=p;function x(E){const R=c(t+"CollectionConsumer",E);return hr.useCallback(()=>{const w=R.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${g}]`));return Array.from(R.itemMap.values()).sort((L,_)=>C.indexOf(L.ref.current)-C.indexOf(_.ref.current))},[R.collectionRef,R.itemMap])}return[{Provider:f,Slot:h,ItemSlot:b},x,i]}var b_=y.createContext(void 0);function Su(t){const r=y.useContext(b_);return t||r||"ltr"}var dh="rovingFocusGroup.onEntryFocus",x_={bubbles:!1,cancelable:!0},Eu="RovingFocusGroup",[zm,wE,w_]=Ap(Eu),[S_,SE]=Hn(Eu,[w_]),[E_,R_]=S_(Eu),EE=y.forwardRef((t,r)=>v.jsx(zm.Provider,{scope:t.__scopeRovingFocusGroup,children:v.jsx(zm.Slot,{scope:t.__scopeRovingFocusGroup,children:v.jsx(T_,{...t,ref:r})})}));EE.displayName=Eu;var T_=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,orientation:i,loop:o=!1,dir:c,currentTabStopId:f,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:g=!1,...b}=t,x=y.useRef(null),E=ke(r,x),R=Su(c),[S=null,w]=rs({prop:f,defaultProp:d,onChange:h}),[C,A]=y.useState(!1),N=nt(p),L=wE(a),_=y.useRef(!1),[k,I]=y.useState(0);return y.useEffect(()=>{const Y=x.current;if(Y)return Y.addEventListener(dh,N),()=>Y.removeEventListener(dh,N)},[N]),v.jsx(E_,{scope:a,orientation:i,dir:R,loop:o,currentTabStopId:S,onItemFocus:y.useCallback(Y=>w(Y),[w]),onItemShiftTab:y.useCallback(()=>A(!0),[]),onFocusableItemAdd:y.useCallback(()=>I(Y=>Y+1),[]),onFocusableItemRemove:y.useCallback(()=>I(Y=>Y-1),[]),children:v.jsx(Se.div,{tabIndex:C||k===0?-1:0,"data-orientation":i,...b,ref:E,style:{outline:"none",...t.style},onMouseDown:ge(t.onMouseDown,()=>{_.current=!0}),onFocus:ge(t.onFocus,Y=>{const H=!_.current;if(Y.target===Y.currentTarget&&H&&!C){const K=new CustomEvent(dh,x_);if(Y.currentTarget.dispatchEvent(K),!K.defaultPrevented){const Z=L().filter(M=>M.focusable),ne=Z.find(M=>M.active),ce=Z.find(M=>M.id===S),U=[ne,ce,...Z].filter(Boolean).map(M=>M.ref.current);CE(U,g)}}_.current=!1}),onBlur:ge(t.onBlur,()=>A(!1))})})}),RE="RovingFocusGroupItem",TE=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,focusable:i=!0,active:o=!1,tabStopId:c,...f}=t,d=yr(),h=c||d,p=R_(RE,a),g=p.currentTabStopId===h,b=wE(a),{onFocusableItemAdd:x,onFocusableItemRemove:E}=p;return y.useEffect(()=>{if(i)return x(),()=>E()},[i,x,E]),v.jsx(zm.ItemSlot,{scope:a,id:h,focusable:i,active:o,children:v.jsx(Se.span,{tabIndex:g?0:-1,"data-orientation":p.orientation,...f,ref:r,onMouseDown:ge(t.onMouseDown,R=>{i?p.onItemFocus(h):R.preventDefault()}),onFocus:ge(t.onFocus,()=>p.onItemFocus(h)),onKeyDown:ge(t.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){p.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const S=N_(R,p.orientation,p.dir);if(S!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let C=b().filter(A=>A.focusable).map(A=>A.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const A=C.indexOf(R.currentTarget);C=p.loop?O_(C,A+1):C.slice(A+1)}setTimeout(()=>CE(C))}})})})});TE.displayName=RE;var C_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A_(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function N_(t,r,a){const i=A_(t.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return C_[i]}function CE(t,r=!1){const a=document.activeElement;for(const i of t)if(i===a||(i.focus({preventScroll:r}),document.activeElement!==a))return}function O_(t,r){return t.map((a,i)=>t[(r+i)%t.length])}var j_=EE,M_=TE,Np="Tabs",[D_,Lz]=Hn(Np,[SE]),AE=SE(),[__,Op]=D_(Np),NE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:i,onValueChange:o,defaultValue:c,orientation:f="horizontal",dir:d,activationMode:h="automatic",...p}=t,g=Su(d),[b,x]=rs({prop:i,onChange:o,defaultProp:c});return v.jsx(__,{scope:a,baseId:yr(),value:b,onValueChange:x,orientation:f,dir:g,activationMode:h,children:v.jsx(Se.div,{dir:g,"data-orientation":f,...p,ref:r})})});NE.displayName=Np;var OE="TabsList",jE=y.forwardRef((t,r)=>{const{__scopeTabs:a,loop:i=!0,...o}=t,c=Op(OE,a),f=AE(a);return v.jsx(j_,{asChild:!0,...f,orientation:c.orientation,dir:c.dir,loop:i,children:v.jsx(Se.div,{role:"tablist","aria-orientation":c.orientation,...o,ref:r})})});jE.displayName=OE;var ME="TabsTrigger",DE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:i,disabled:o=!1,...c}=t,f=Op(ME,a),d=AE(a),h=zE(f.baseId,i),p=PE(f.baseId,i),g=i===f.value;return v.jsx(M_,{asChild:!0,...d,focusable:!o,active:g,children:v.jsx(Se.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":p,"data-state":g?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:h,...c,ref:r,onMouseDown:ge(t.onMouseDown,b=>{!o&&b.button===0&&b.ctrlKey===!1?f.onValueChange(i):b.preventDefault()}),onKeyDown:ge(t.onKeyDown,b=>{[" ","Enter"].includes(b.key)&&f.onValueChange(i)}),onFocus:ge(t.onFocus,()=>{const b=f.activationMode!=="manual";!g&&!o&&b&&f.onValueChange(i)})})})});DE.displayName=ME;var _E="TabsContent",LE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:i,forceMount:o,children:c,...f}=t,d=Op(_E,a),h=zE(d.baseId,i),p=PE(d.baseId,i),g=i===d.value,b=y.useRef(g);return y.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),v.jsx(ln,{present:o||g,children:({present:x})=>v.jsx(Se.div,{"data-state":g?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!x,id:p,tabIndex:0,...f,ref:r,style:{...t.style,animationDuration:b.current?"0s":void 0},children:x&&c})})});LE.displayName=_E;function zE(t,r){return`${t}-trigger-${r}`}function PE(t,r){return`${t}-content-${r}`}var L_=NE,kE=jE,UE=DE,$E=LE;const z_=L_,HE=y.forwardRef(({className:t,...r},a)=>v.jsx(kE,{ref:a,className:le("inline-flex h-9 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));HE.displayName=kE.displayName;const Pm=y.forwardRef(({className:t,...r},a)=>v.jsx(UE,{ref:a,className:le("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...r}));Pm.displayName=UE.displayName;const km=y.forwardRef(({className:t,...r},a)=>v.jsx($E,{ref:a,className:le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));km.displayName=$E.displayName;const jp=y.forwardRef(({className:t,...r},a)=>v.jsx("textarea",{className:le("flex min-h-[60px] select-none w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...r}));jp.displayName="Textarea";const P_=1,k_=1e6;let hh=0;function U_(){return hh=(hh+1)%Number.MAX_SAFE_INTEGER,hh.toString()}const mh=new Map,j0=t=>{if(mh.has(t))return;const r=setTimeout(()=>{mh.delete(t),ql({type:"REMOVE_TOAST",toastId:t})},k_);mh.set(t,r)},$_=(t,r)=>{switch(r.type){case"ADD_TOAST":return{...t,toasts:[r.toast,...t.toasts].slice(0,P_)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===r.toast.id?{...a,...r.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=r;if(a)j0(a);else for(const i of t.toasts)j0(i.id);return{...t,toasts:t.toasts.map(i=>i.id===a||a===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return r.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==r.toastId)}}},Bc=[];let Ic={toasts:[]};function ql(t){Ic=$_(Ic,t);for(const r of Bc)r(Ic)}function H_({...t}){const r=U_(),a=o=>ql({type:"UPDATE_TOAST",toast:{...o,id:r}}),i=()=>ql({type:"DISMISS_TOAST",toastId:r});return ql({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:o=>{o||i()}}}),{id:r,dismiss:i,update:a}}function Yn(){const[t,r]=y.useState(Ic);return y.useEffect(()=>(Bc.push(r),()=>{const a=Bc.indexOf(r);a>-1&&Bc.splice(a,1)}),[]),{...t,toast:H_,dismiss:a=>ql({type:"DISMISS_TOAST",toastId:a})}}const M0=[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The display name of your character",fieldType:"text",getValue:t=>t.name||""},{title:"Username",name:"username",description:"Unique identifier for your character",fieldType:"text",getValue:t=>t.username||""},{title:"System",name:"system",description:"System prompt for character behavior",fieldType:"textarea",getValue:t=>t.system||""},{title:"Voice Model",name:"settings.voice.model",description:"Voice model used for speech synthesis",fieldType:"text",getValue:t=>{var r,a;return((a=(r=t.settings)==null?void 0:r.voice)==null?void 0:a.model)||""}}]},{sectionTitle:"Content",sectionValue:"content",sectionType:"array",fields:[{title:"Bio",description:"Key information about your character",path:"bio",getData:t=>Array.isArray(t.bio)?t.bio:[]},{title:"Topics",description:"Topics your character is knowledgeable about",path:"topics",getData:t=>t.topics||[]},{title:"Adjectives",description:"Words that describe your character's personality",path:"adjectives",getData:t=>t.adjectives||[]}]},{sectionTitle:"Style",sectionValue:"style",sectionType:"array",fields:[{title:"All",description:"Style rules applied to all interactions",path:"style.all",getData:t=>{var r;return((r=t.style)==null?void 0:r.all)||[]}},{title:"Chat",description:"Style rules for chat interactions",path:"style.chat",getData:t=>{var r;return((r=t.style)==null?void 0:r.chat)||[]}},{title:"Post",description:"Style rules for social media posts",path:"style.post",getData:t=>{var r;return((r=t.style)==null?void 0:r.post)||[]}}]}];function qE({characterValue:t,setCharacterValue:r,title:a,description:i,onSubmit:o,onDelete:c,onReset:f,customComponents:d=[]}){const{toast:h}=Yn(),[p,g]=y.useState(!1),b=w=>{const{name:C,value:A,type:N}=w.target,L=w.target.checked;if(C.includes(".")){const _=C.split(".");r(k=>{const I={...k};let Y=I;for(let H=0;H<_.length-1;H++)Y[_[H]]||(Y[_[H]]={}),Y=Y[_[H]];return Y[_[_.length-1]]=N==="checkbox"?L:A,I})}else r(_=>({..._,[C]:N==="checkbox"?L:A}))},x=(w,C)=>{r(A=>{const N={...A},L=w.split(".");let _=N;for(let k=0;k<L.length-1;k++){const I=L[k];(!_[I]||typeof _[I]!="object")&&(_[I]={}),_=_[I]}return _[L[L.length-1]]=C,N})},E=async w=>{w.preventDefault(),g(!0);try{await o(t)}catch(C){h({title:"Error",description:C instanceof Error?C.message:"Failed to update",variant:"destructive"})}finally{g(!1)}},R=w=>v.jsxs("div",{className:"space-y-2",children:[v.jsx(eu,{htmlFor:w.name,children:w.title}),w.description&&v.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),w.fieldType==="textarea"?v.jsx(jp,{id:w.name,name:w.name,value:w.getValue(t),onChange:b,className:"min-h-[120px] resize-y"}):w.fieldType==="checkbox"?v.jsx(gr,{id:w.name,name:w.name,type:"checkbox",checked:t[w.name]==="true",onChange:b}):v.jsx(gr,{id:w.name,name:w.name,type:w.fieldType,value:w.getValue(t),onChange:b})]},w.name),S=w=>v.jsxs("div",{className:"space-y-2",children:[v.jsx(eu,{htmlFor:w.path,children:w.title}),w.description&&v.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),v.jsx(g_,{data:w.getData(t),onChange:C=>x(w.path,C)})]},w.path);return v.jsxs("div",{className:"container max-w-4xl mx-auto p-6",children:[v.jsx("div",{className:"flex items-center justify-between mb-6",children:v.jsxs("div",{children:[v.jsx("h1",{className:"text-3xl font-bold",children:a}),v.jsx("p",{className:"text-muted-foreground mt-1",children:i})]})}),v.jsxs("form",{onSubmit:E,children:[v.jsxs(z_,{defaultValue:"basic",className:"w-full",children:[v.jsxs(HE,{className:"grid w-full mb-6",style:{gridTemplateColumns:`repeat(${d.length+3}, minmax(0, 1fr))`},children:[M0.map(w=>v.jsx(Pm,{value:w.sectionValue,children:w.sectionTitle},w.sectionValue)),d.map(w=>v.jsx(Pm,{value:`custom-${w.name}`,children:w.name},`custom-${w.name}`))]}),v.jsx(io,{children:v.jsxs(wu,{className:"p-6",children:[M0.map(w=>v.jsx(km,{value:w.sectionValue,className:"space-y-6",children:w.sectionType==="input"?w.fields.map(R):w.fields.map(S)},w.sectionValue)),d.map(w=>v.jsx(km,{value:`custom-${w.name}`,children:w.component},`custom-${w.name}`))]})})]}),v.jsxs("div",{className:"flex justify-between gap-4 mt-6",children:[v.jsx("div",{className:"flex gap-4 text-red-500",children:v.jsx(Ie,{type:"button",variant:"outline",onClick:()=>{c==null||c()},children:"Delete Character"})}),v.jsxs("div",{className:"flex gap-4",children:[v.jsx(Ie,{type:"button",variant:"outline",onClick:()=>{f==null||f()},children:"Reset Changes"}),v.jsx(Ie,{type:"submit",disabled:p,children:p?"Saving...":"Save Changes"})]})]})]})]})}const ph="elizaos-world-id",ts={getWorldId:()=>{const t=localStorage.getItem(ph);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(ph,r),r},resetWorldId:()=>{const t=crypto.randomUUID();return localStorage.setItem(ph,t),t},getRoomStorageKey:t=>`room-${ts.getWorldId()}-${t}`},q_="http://localhost:3000",ct=async({url:t,method:r,body:a,headers:i})=>{const o={method:r??"GET",headers:i||{Accept:"application/json","Content-Type":"application/json"}};return(r==="POST"||r==="PUT"||r==="PATCH")&&(a instanceof FormData?(o.headers&&typeof o.headers=="object"&&(o.headers=Object.fromEntries(Object.entries(o.headers).filter(([c])=>c!=="Content-Type"))),o.body=a):o.body=JSON.stringify(a)),fetch(`${q_}${t}`,o).then(async c=>{if(c.headers.get("Content-Type")==="audio/mpeg")return await c.blob();if(!c.ok){const d=await c.text();console.error("Error: ",d);let h="An error occurred.";try{h=JSON.parse(d).message||h}catch{h=d||h}throw new Error(h)}try{return await c.json()}catch(d){return console.error("JSON Parse Error:",d),null}})},Et={getAgents:()=>ct({url:"/agents"}),getAgent:t=>ct({url:`/agents/${t}`}),tts:(t,r)=>ct({url:`/agents/${t}/speech/generate`,method:"POST",body:{text:r},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),whisper:async(t,r)=>{const a=new FormData;return a.append("file",r,"recording.wav"),ct({url:`/agents/${t}/transcriptions`,method:"POST",body:a})},sendAudioMessage:async(t,r,a)=>{const i=new FormData;if(i.append("file",r,"recording.wav"),a)for(const[o,c]of Object.entries(a))c&&i.append(o,c);return ct({url:`/agents/${t}/audio-messages`,method:"POST",body:i})},speechConversation:async(t,r,a)=>ct({url:`/agents/${t}/speech/conversation`,method:"POST",body:{text:r,...a},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),deleteAgent:t=>ct({url:`/agents/${t}`,method:"DELETE"}),updateAgent:(t,r)=>ct({url:`/agents/${t}`,method:"PATCH",body:r}),createAgent:t=>ct({url:"/agents/",method:"POST",body:t}),startAgent:t=>ct({url:`/agents/${t}`,method:"POST",body:{start:!0}}),stopAgent:t=>ct({url:`/agents/${t}`,method:"PUT"}),getMemories:(t,r,a)=>{const o={worldId:ts.getWorldId()};return a!=null&&a.limit&&(o.limit=a.limit),a!=null&&a.before&&(o.end=a.before),ct({url:`/agents/${t}/rooms/${r}/memories`,method:"GET",body:o})},getRooms:t=>{const r=ts.getWorldId();return ct({url:`/agents/${t}/rooms`,method:"GET",body:{worldId:r}})},createRoom:(t,r)=>{const a=ts.getWorldId();return ct({url:`/agents/${t}/rooms`,method:"POST",body:{name:r,worldId:a}})},getRoom:(t,r)=>ct({url:`/agents/${t}/rooms/${r}`,method:"GET"}),updateRoom:(t,r,a)=>ct({url:`/agents/${t}/rooms/${r}`,method:"PATCH",body:a}),deleteRoom:(t,r)=>ct({url:`/agents/${t}/rooms/${r}`,method:"DELETE"}),getLogs:t=>ct({url:`/logs?level=${t}`,method:"GET"}),getAgentCompletion:(t,r,a,i,o)=>ct({url:`/agents/${t}/message`,method:"POST",body:{text:a,roomId:i,senderId:r,source:o}})};function BE({characterValue:t,setCharacterValue:r}){var f;const[a,i]=y.useState(((f=t==null?void 0:t.settings)==null?void 0:f.avatar)||null),o=y.useRef(null),c=d=>{var p;const h=(p=d.target.files)==null?void 0:p[0];if(h){const g=new FileReader;g.onload=b=>{var x;if((x=b.target)!=null&&x.result){const E=new Image;E.src=b.target.result,E.onload=()=>{const R=document.createElement("canvas"),S=300;let w=E.width,C=E.height;w>C?w>S&&(C*=S/w,w=S):C>S&&(w*=S/C,C=S),R.width=w,R.height=C;const A=R.getContext("2d");A==null||A.drawImage(E,0,0,w,C);const N=R.toDataURL("image/jpeg",.8);i(N)}}},g.readAsDataURL(h)}};return y.useEffect(()=>{r(d=>({...d,settings:{...d.settings,avatar:a}}))},[a,r]),v.jsxs("div",{className:"rounded-lg w-full",children:[v.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Avatar Settings"}),v.jsxs("div",{className:"flex flex-col items-center gap-4 pb-4",children:[a?v.jsxs("div",{className:"relative w-64 h-64",children:[v.jsx("img",{src:a,alt:"Character Avatar",className:"object-cover rounded-lg border"}),v.jsx("button",{className:"absolute -top-2 -right-2 bg-white p-1 rounded-full shadow-md",onClick:()=>i(null),type:"button",children:v.jsx(us,{className:"w-5 h-5 text-card"})})]}):v.jsx("div",{className:"w-64 h-64 flex items-center justify-center border border-dashed rounded-lg text-gray-500",children:v.jsx(a2,{className:"w-10 h-10"})}),v.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:o,onChange:c}),v.jsxs(Ie,{className:"flex items-center gap-2",onClick:()=>{var d;return(d=o.current)==null?void 0:d.click()},children:[v.jsx(p2,{className:"w-5 h-5"})," Upload Avatar"]})]})]})}const B_=Hw,I_=YO,V_=qw,IE=y.forwardRef(({className:t,...r},a)=>v.jsx(iu,{ref:a,className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));IE.displayName=iu.displayName;const VE=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(V_,{children:[v.jsx(IE,{}),v.jsxs(lu,{ref:i,className:le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[r,v.jsxs(Bw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsx(us,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));VE.displayName=lu.displayName;const YE=({className:t,...r})=>v.jsx("div",{className:le("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});YE.displayName="DialogHeader";const GE=y.forwardRef(({className:t,...r},a)=>v.jsx(ou,{ref:a,className:le("text-lg font-semibold leading-none tracking-tight",t),...r}));GE.displayName=ou.displayName;const Y_=y.forwardRef(({className:t,...r},a)=>v.jsx(cu,{ref:a,className:le("text-sm text-muted-foreground",t),...r}));Y_.displayName=cu.displayName;function G_(){return fs({queryKey:["plugins"],queryFn:async()=>(await fetch("https://raw.githubusercontent.com/elizaos/registry/refs/heads/main/index.json")).json()})}function FE({characterValue:t,setCharacterValue:r}){const{data:a,error:i}=G_(),[o,c]=y.useState(""),[f,d]=y.useState(!1),h=y.useMemo(()=>a?Object.keys(a).map(x=>x.replace(/^@elizaos-plugins\//,"@elizaos/")):[],[a]),p=y.useMemo(()=>Array.isArray(t==null?void 0:t.plugins)?t.plugins:[],[t==null?void 0:t.plugins]),g=y.useMemo(()=>h.filter(x=>!p.includes(x)).filter(x=>x.toLowerCase().includes(o.toLowerCase())),[h,p,o]),b=x=>{r(E=>{const R=Array.isArray(E.plugins)?E.plugins:[],S=R.includes(x)?R.filter(w=>w!==x):[...R,x];return{...E,plugins:S}})};return v.jsx("div",{className:"space-y-6",children:v.jsx("div",{className:"space-y-4",children:v.jsxs("div",{children:[v.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),i?v.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",i.message]}):v.jsxs("div",{className:"space-y-4",children:[p.length>0&&v.jsxs("div",{className:"rounded-md bg-muted p-4",children:[v.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(x=>v.jsxs(Ie,{type:"button",variant:"ghost",size:"sm",className:"inline-flex items-center rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20 h-auto",onClick:()=>b(x),children:[x," ×"]},x))})]}),v.jsx("div",{className:"space-y-2",children:v.jsxs(B_,{open:f,onOpenChange:d,children:[v.jsx(I_,{asChild:!0,children:v.jsx(Ie,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),v.jsxs(VE,{className:"max-w-[400px]",children:[v.jsx(YE,{children:v.jsx(GE,{children:"Add Plugins"})}),v.jsxs("div",{className:"space-y-4 py-4",children:[v.jsx("div",{className:"space-y-2",children:v.jsx(gr,{type:"search",placeholder:"Search plugins...",value:o,onChange:x=>c(x.target.value)})}),v.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:g.length===0?v.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):g.map(x=>v.jsx(Ie,{variant:"ghost",className:"w-full justify-start font-normal",onClick:()=>{b(x),c(""),d(!1)},children:x},x))})]})]})]})})]})]})})})}function QE({characterValue:t,setCharacterValue:r}){var _;const[a,i]=y.useState(Object.entries(((_=t==null?void 0:t.settings)==null?void 0:_.secrets)||{}).map(([k,I])=>({name:k,value:String(I)}))),[o,c]=y.useState(""),[f,d]=y.useState(""),[h,p]=y.useState(!1),[g,b]=y.useState(null),[x,E]=y.useState(null),[R,S]=y.useState(""),w=y.useRef(null),C=()=>{o&&f&&(i([...a,{name:o,value:f}]),c(""),d(""))},A=k=>{E(k),S(a[k].value),b(null)},N=k=>{const I=[...a];I[k].value=R,i(I),E(null)},L=k=>{i(a.filter((I,Y)=>Y!==k)),b(null),E(null)};return y.useEffect(()=>{const k=I=>{w.current&&!w.current.contains(I.target)&&b(null)};return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[]),y.useEffect(()=>{r(k=>({...k,settings:{...k.settings,secrets:Object.fromEntries(a.map(({name:I,value:Y})=>[I,Y]))}}))},[a,r]),v.jsxs("div",{className:"rounded-lg w-full",children:[v.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Environment Settings"}),v.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-end w-full pb-4",children:[v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx("label",{htmlFor:"secret-name",className:"ml-2 text-xs font-medium text-gray-400",children:"NAME"}),v.jsx(gr,{id:"secret-name",placeholder:"VARIABLE_NAME",value:o,onChange:k=>c(k.target.value)})]}),v.jsxs("div",{className:"flex flex-col gap-1 relative",children:[v.jsx("label",{htmlFor:"secret-value",className:"ml-2 text-xs font-medium text-gray-400",children:"VALUE"}),v.jsxs("div",{className:"relative",children:[v.jsx(gr,{id:"secret-value",type:h?"text":"password",placeholder:"i9ju23nfsdf56",value:f,onChange:k=>d(k.target.value),className:"pr-10"}),v.jsx("div",{className:"absolute inset-y-0 right-3 flex items-center cursor-pointer text-gray-500",onClick:()=>p(!h),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&p(!h)},children:h?v.jsx(n2,{}):v.jsx(r2,{})})]})]}),v.jsx(Ie,{className:"shrink-0",onClick:C,children:"Add"})]}),a.length>0&&v.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 mt-6 font-medium text-gray-400 border-b pb-2 ml-1",children:[v.jsx("div",{children:"Name"}),v.jsx("div",{children:"Value"}),v.jsx("div",{children:"Action"})]}),v.jsx("div",{className:"mt-2",children:a.map((k,I)=>v.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-center border-b py-2 ml-1 relative",children:[v.jsx("div",{children:k.name}),v.jsx("div",{children:x===I?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(gr,{value:R,onChange:Y=>S(Y.target.value),className:"w-full"}),v.jsx(Ie,{variant:"ghost",onClick:()=>N(I),children:v.jsx(ap,{className:"w-5 h-5 text-green-500"})}),v.jsx(Ie,{variant:"ghost",onClick:()=>E(null),children:v.jsx(us,{className:"w-5 h-5 text-red-500"})})]}):v.jsx("div",{className:"truncate text-gray-500",children:"Encrypted"})}),v.jsxs("div",{className:"relative",children:[v.jsx(Ie,{variant:"ghost",className:"p-2 text-gray-500",onClick:()=>b(g===I?null:I),children:v.jsx(t2,{className:"w-5 h-5"})}),g===I&&v.jsxs("div",{className:"absolute right-0 -top-2 mt-2 w-24 bg-muted border rounded shadow-md z-10",ref:w,children:[v.jsx("button",{className:"w-full px-4 py-2 text-left hover:opacity-50",onClick:()=>A(I),type:"button",children:"Edit"}),v.jsx("div",{className:"w-full px-4 py-2 text-left text-red-500 hover:opacity-50 cursor-pointer",onClick:()=>L(I),children:"Remove"})]})]})]},I))})]})}const D0={name:"",username:"",system:"",bio:[],topics:[],adjectives:[]};function XE(){const t=Oi(),{toast:r}=Yn(),a=Bn(),[i,o]=y.useState({...D0}),c=d=>{var h,p,g;return{...d,bio:d.bio??[],messageExamples:d.messageExamples??[],postExamples:d.postExamples??[],topics:d.topics??[],adjectives:d.adjectives??[],plugins:d.plugins??[],style:{all:((h=d.style)==null?void 0:h.all)??[],chat:((p=d.style)==null?void 0:p.chat)??[],post:((g=d.style)==null?void 0:g.post)??[]}}},f=async d=>{try{const h=c(d);await Et.createAgent({characterJson:h}),a.invalidateQueries({queryKey:["characters"]}),r({title:"Success",description:"Character created successfully!"}),a.invalidateQueries({queryKey:["agents"]}),t("/")}catch(h){r({title:"Error",description:h instanceof Error?h.message:"Failed to create character",variant:"destructive"})}};return v.jsx(qE,{characterValue:i,setCharacterValue:o,title:"Character Settings",description:"Configure your AI character's behavior and capabilities",onSubmit:f,onReset:()=>o(D0),onDelete:()=>{t("/")},isAgent:!0,customComponents:[{name:"Plugins",component:v.jsx(FE,{characterValue:i,setCharacterValue:o})},{name:"Secret",component:v.jsx(QE,{characterValue:i,setCharacterValue:o})},{name:"Avatar",component:v.jsx(BE,{characterValue:i,setCharacterValue:o})}]})}const ns="user",gn={FREQUENT:30*1e3,STANDARD:2*60*1e3,RARE:10*60*1e3,NEVER:Number.POSITIVE_INFINITY},WE=()=>{const t=typeof navigator<"u"&&"connection"in navigator?navigator.connection:null;return{isOffline:typeof navigator<"u"&&!navigator.onLine,effectiveType:(t==null?void 0:t.effectiveType)||"unknown",saveData:(t==null?void 0:t.saveData)||!1}};function KE(t={}){const r=WE();return fs({queryKey:["agents"],queryFn:()=>Et.getAgents(),staleTime:gn.FREQUENT,refetchInterval:r.isOffline?!1:gn.FREQUENT,refetchIntervalInBackground:!1,...!r.isOffline&&r.effectiveType==="slow-2g"&&{refetchInterval:gn.STANDARD},...t})}function F_(t,r={}){const a=WE();return fs({queryKey:["agent",t],queryFn:()=>Et.getAgent(t||""),staleTime:gn.FREQUENT,enabled:!!t,refetchInterval:!a.isOffline&&t?gn.FREQUENT:!1,refetchIntervalInBackground:!1,...!a.isOffline&&a.effectiveType==="slow-2g"&&{refetchInterval:gn.STANDARD},...r})}function Q_(){const t=Bn(),{toast:r}=Yn();return yu({mutationFn:async a=>{try{return await Et.startAgent(a)}catch(i){if(i instanceof Error){if(i.message.includes("network"))throw new Error("Network error: Please check your connection and try again.");if(i.message.includes("already running"))throw new Error("Agent is already running.")}throw i}},onMutate:async a=>(r({title:"Starting Agent",description:"Initializing agent..."}),{agentId:a}),onSuccess:a=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["active-agents"]}),a!=null&&a.id&&t.invalidateQueries({queryKey:["agent",a.id]}),r({title:"Agent Started",description:`${(a==null?void 0:a.name)||"Agent"} is now running`})},onError:a=>{const i=a instanceof Error?a.message:"Failed to start agent";r({title:"Error Starting Agent",description:`${i}. Please try again.`,variant:"destructive"})}})}function X_(){const t=Bn(),{toast:r}=Yn();return yu({mutationFn:a=>Et.stopAgent(a),onMutate:async a=>{const i=t.getQueryData(["agent",a]);i&&r({title:"Stopping Agent",description:`Stopping ${i.name}...`})},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),r({title:"Agent Stopped",description:"The agent has been successfully stopped"})},onError:(a,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),r({title:"Error",description:a instanceof Error?a.message:"Failed to stop agent",variant:"destructive"})}})}function W_(t,r){const a=Bn(),i=ts.getWorldId(),[o,c]=y.useState(null),[f,d]=y.useState(!0),[h,p]=y.useState(!1);return{...fs({queryKey:["messages",t,r,i],queryFn:async()=>(await Et.getMemories(t,r)).data.memories.map(E=>({text:E.content.text,user:E.entityId===t?"agent":ns,name:E.entityId===t?"agent":ns,createdAt:E.createdAt,attachments:E.content.attachments,source:E.content.source,worldId:E.worldId||i,id:E.id})).sort((E,R)=>E.createdAt-R.createdAt),enabled:!!(t&&r),staleTime:gn.FREQUENT}),loadOlderMessages:async()=>{if(!o||!f||h)return!1;try{p(!0);const x=await Et.getMemories(t,r,{before:o,limit:20});if(x!=null&&x.memories&&x.memories.length>0){const E=x.memories.map(A=>A.createdAt),R=Math.min(...E);c(R);const S=a.getQueryData(["messages",t,r,i])||[],w=new Map;S.forEach(A=>{w.set(A.id,A)}),x.memories.forEach(A=>{w.set(A.id,A)});const C=Array.from(w.values());return C.sort((A,N)=>A.createdAt-N.createdAt),a.setQueryData(["messages",t,r,i],C),d(x.memories.length>=20),!0}return d(!1),!1}catch(x){return console.error("Error loading older messages:",x),!1}finally{p(!1)}},hasOlderMessages:f,isLoadingMore:h}}const K_="1.0.0-alpha.48",si={version:K_};var Vc=(t=>(t[t.ROOM_JOINING=1]="ROOM_JOINING",t[t.SEND_MESSAGE=2]="SEND_MESSAGE",t))(Vc||{}),ta=(t=>(t.ACTIVE="active",t.INACTIVE="inactive",t))(ta||{});function Z_(){const[t,r]=y.useState(null),[a,i]=y.useState(!0),[o,c]=y.useState(typeof navigator<"u"?navigator.onLine:!0),[f,d]=y.useState(!1),h=Bn(),[p,g]=y.useState(Date.now()),b=y.useRef(0),x=y.useRef(Date.now());y.useEffect(()=>{const k=()=>{i(document.visibilityState==="visible"),document.visibilityState==="visible"&&(b.current=0,Date.now()-p>1e4&&h.invalidateQueries({queryKey:["status"]}))},I=()=>{c(navigator.onLine),navigator.onLine&&(b.current=0,h.invalidateQueries({queryKey:["status"]}))};return document.addEventListener("visibilitychange",k),window.addEventListener("online",I),window.addEventListener("offline",I),i(document.visibilityState==="visible"),()=>{document.removeEventListener("visibilitychange",k),window.removeEventListener("online",I),window.removeEventListener("offline",I)}},[h,p]);const R=fs({queryKey:["status"],queryFn:async()=>{try{const k=performance.now(),I=await Et.getAgents(),Y=performance.now();return b.current=0,x.current=Date.now(),r(Y-k),g(Date.now()),I}catch(k){throw b.current+=1,console.error("Connection check failed:",k),k}},refetchInterval:o?b.current>0?Math.min(5e3*2**(b.current-1),6e4):a?3e3:15e3:!1,retry:3,retryDelay:k=>Math.min(1e3*1.5**k,1e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0,staleTime:500,gcTime:gn.STANDARD}),S=(R==null?void 0:R.isSuccess)&&!(R!=null&&R.isError),w=(R==null?void 0:R.isRefetching)||(R==null?void 0:R.isPending),C=S===!1&&b.current>5&&Date.now()-x.current>6e4,A=()=>o?C?"bg-yellow-600":w?"bg-muted-foreground":S?"bg-green-600":"bg-red-600":"bg-orange-600",N=()=>o?C?"Reconnecting...":w?"Connecting...":S?"Connected":"Disconnected":"Offline",L=()=>o?C?"text-yellow-600":w?"text-muted-foreground":S?"text-green-600":"text-red-600":"text-orange-600",_=()=>{b.current=0,h.invalidateQueries({queryKey:["agents"]}),h.invalidateQueries({queryKey:["status"]})};return v.jsx(mr,{children:v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx(Va,{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:_,children:v.jsx("div",{className:"flex flex-col gap-1 select-none transition-all duration-200",children:v.jsxs("div",{className:"flex items-center gap-1",children:[f?v.jsx(f2,{className:"h-3.5 w-3.5 text-muted-foreground animate-pulse"}):v.jsx("div",{className:le(["h-2.5 w-2.5 rounded-full",A()])}),v.jsx("span",{className:le(["text-xs",f?"text-muted-foreground":L()]),children:f?"Refresh":N()})]})})})}),S&&!f?v.jsx(kn,{side:"top",children:v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(XO,{className:"size-4"}),v.jsxs("span",{children:[t==null?void 0:t.toFixed(2)," ms"]})]})}):null]})})}function J_(){const t=va(),{data:{data:r}={},isPending:a}=KE();return v.jsxs(jS,{className:"bg-background",children:[v.jsx(DS,{className:"pb-4",children:v.jsx(Uc,{children:v.jsx(mr,{children:v.jsx(Va,{size:"lg",asChild:!0,children:v.jsxs(Ya,{to:"/",className:"px-6 py-4",children:[v.jsx("img",{alt:"elizaos-icon",src:"/elizaos-icon.png",width:"100%",height:"100%",className:"size-9"}),v.jsxs("div",{className:"flex flex-col leading-none ",children:[v.jsx("span",{className:"font-semibold text-lg",children:"ElizaOS"}),v.jsxs("span",{className:"text-sm -mt-0.5 text-muted-foreground",children:["v",si==null?void 0:si.version]})]})]})})})})}),v.jsx(LS,{children:v.jsxs(zS,{children:[v.jsx(PS,{className:"px-6 py-2 text-sm font-medium text-muted-foreground",children:v.jsx(Ya,{to:"/",children:"AGENTS"})}),v.jsx(kS,{className:"px-2",children:v.jsx(Uc,{children:a?v.jsx("div",{children:Array.from({length:5}).map((i,o)=>v.jsx(mr,{children:v.jsx(US,{})},`skeleton-item-${o}`))}):v.jsx("div",{children:(()=>{const i=[...(r==null?void 0:r.agents)||[]].sort((f,d)=>f.status===ta.ACTIVE&&d.status!==ta.ACTIVE?-1:f.status!==ta.ACTIVE&&d.status===ta.ACTIVE?1:f.name.localeCompare(d.name)),o=i.filter(f=>f.status===ta.ACTIVE),c=i.filter(f=>f.status===ta.INACTIVE);return v.jsxs(v.Fragment,{children:[o.length>0&&v.jsx("div",{className:"px-4 py-1 mt-4",children:v.jsxs("div",{className:"flex items-center space-x-2",children:[v.jsx("div",{className:"size-2.5 rounded-full bg-green-500"}),v.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Online"})]})}),o.map(f=>{var d,h;return v.jsx(mr,{children:v.jsx(Ya,{to:`/chat/${f.id}`,children:v.jsx(Va,{isActive:t.pathname.includes(f.id),className:"transition-colors px-4 my-4 rounded-md",children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-8 h-8 flex justify-center items-center",children:v.jsx("div",{className:"relative bg-muted rounded-full w-full h-full",children:f&&v.jsxs("div",{className:"text-sm rounded-full h-full w-full flex justify-center items-center overflow-hidden",children:[(d=f.settings)!=null&&d.avatar?v.jsx("img",{src:(h=f.settings)==null?void 0:h.avatar,alt:"Agent Avatar",className:"w-full h-full object-contain"}):Yc(f.name),v.jsx("div",{className:"absolute bottom-0 right-0 w-2 h-2 rounded-full border-[1px] border-white bg-green-500"})]})})}),v.jsx("span",{className:"text-base",children:f.name})]})})})},f.id)}),c.length>0&&v.jsx("div",{className:"px-4 py-1 mt-12",children:v.jsxs("div",{className:"flex items-center space-x-2",children:[v.jsx("div",{className:"size-2.5 rounded-full bg-muted-foreground/50"}),v.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Offline"})]})}),c.map(f=>{var d;return v.jsx(mr,{children:v.jsx("div",{className:"transition-colors px-4 my-4 rounded-md",children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-8 h-8 flex justify-center items-center",children:v.jsx("div",{className:"relative bg-muted rounded-full w-full h-full",children:f&&v.jsxs("div",{className:"text-sm rounded-full h-full w-full flex justify-center items-center overflow-hidden",children:[(d=f.settings)!=null&&d.avatar?v.jsx("img",{src:f.settings.avatar,alt:"Agent Avatar",className:"w-full h-full object-contain"}):Yc(f.name),v.jsx("div",{className:"absolute bottom-0 right-0 w-2 h-2 rounded-full border-[1px] border-white bg-muted-foreground"})]})})}),v.jsx("span",{className:"text-base truncate max-w-24",children:f.name})]})})},f.id)})]})})()})})})]})}),v.jsx(_S,{className:"px-4 py-4",children:v.jsxs(Uc,{children:[v.jsx(mr,{children:v.jsx(Ya,{to:"https://elizaos.github.io/eliza/docs/intro/",target:"_blank",children:v.jsxs(Va,{className:"text-muted-foreground rounded-md",children:[v.jsx(KO,{className:"size-5"}),v.jsx("span",{children:"Documentation"})]})})}),v.jsx(mr,{children:v.jsx(Ya,{to:"/logs",children:v.jsxs(Va,{className:"text-muted-foreground rounded-md",children:[v.jsx(d2,{className:"size-5"}),v.jsx("span",{children:"Logs"})]})})}),v.jsx(mr,{children:v.jsxs(Va,{disabled:!0,className:"text-muted-foreground/50 rounded-md",children:[v.jsx(sp,{className:"size-5"}),v.jsx("span",{children:"Settings"})]})}),v.jsx(Z_,{})]})})]})}const ZE=6048e5,eL=864e5,_0=Symbol.for("constructDateFrom");function ma(t,r){return typeof t=="function"?t(r):t&&typeof t=="object"&&_0 in t?t[_0](r):t instanceof Date?new t.constructor(r):new Date(r)}function wn(t,r){return ma(r||t,t)}let tL={};function Ru(){return tL}function Gl(t,r){var d,h,p,g;const a=Ru(),i=(r==null?void 0:r.weekStartsOn)??((h=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??a.weekStartsOn??((g=(p=a.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??0,o=wn(t,r==null?void 0:r.in),c=o.getDay(),f=(c<i?7:0)+c-i;return o.setDate(o.getDate()-f),o.setHours(0,0,0,0),o}function tu(t,r){return Gl(t,{...r,weekStartsOn:1})}function JE(t,r){const a=wn(t,r==null?void 0:r.in),i=a.getFullYear(),o=ma(a,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=tu(o),f=ma(a,0);f.setFullYear(i,0,4),f.setHours(0,0,0,0);const d=tu(f);return a.getTime()>=c.getTime()?i+1:a.getTime()>=d.getTime()?i:i-1}function L0(t){const r=wn(t),a=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return a.setUTCFullYear(r.getFullYear()),+t-+a}function nL(t,...r){const a=ma.bind(null,r.find(i=>typeof i=="object"));return r.map(a)}function z0(t,r){const a=wn(t,r==null?void 0:r.in);return a.setHours(0,0,0,0),a}function rL(t,r,a){const[i,o]=nL(a==null?void 0:a.in,t,r),c=z0(i),f=z0(o),d=+c-L0(c),h=+f-L0(f);return Math.round((d-h)/eL)}function aL(t,r){const a=JE(t,r),i=ma(t,0);return i.setFullYear(a,0,4),i.setHours(0,0,0,0),tu(i)}function sL(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function iL(t){return!(!sL(t)&&typeof t!="number"||isNaN(+wn(t)))}function lL(t,r){const a=wn(t,r==null?void 0:r.in);return a.setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a}const oL={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},cL=(t,r,a)=>{let i;const o=oL[t];return typeof o=="string"?i=o:r===1?i=o.one:i=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+i:i+" ago":i};function vh(t){return(r={})=>{const a=r.width?String(r.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const uL={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},fL={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},dL={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},hL={date:vh({formats:uL,defaultWidth:"full"}),time:vh({formats:fL,defaultWidth:"full"}),dateTime:vh({formats:dL,defaultWidth:"full"})},mL={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pL=(t,r,a,i)=>mL[t];function zl(t){return(r,a)=>{const i=a!=null&&a.context?String(a.context):"standalone";let o;if(i==="formatting"&&t.formattingValues){const f=t.defaultFormattingWidth||t.defaultWidth,d=a!=null&&a.width?String(a.width):f;o=t.formattingValues[d]||t.formattingValues[f]}else{const f=t.defaultWidth,d=a!=null&&a.width?String(a.width):t.defaultWidth;o=t.values[d]||t.values[f]}const c=t.argumentCallback?t.argumentCallback(r):r;return o[c]}}const vL={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gL={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yL={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},bL={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},xL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},SL=(t,r)=>{const a=Number(t),i=a%100;if(i>20||i<10)switch(i%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},EL={ordinalNumber:SL,era:zl({values:vL,defaultWidth:"wide"}),quarter:zl({values:gL,defaultWidth:"wide",argumentCallback:t=>t-1}),month:zl({values:yL,defaultWidth:"wide"}),day:zl({values:bL,defaultWidth:"wide"}),dayPeriod:zl({values:xL,defaultWidth:"wide",formattingValues:wL,defaultFormattingWidth:"wide"})};function Pl(t){return(r,a={})=>{const i=a.width,o=i&&t.matchPatterns[i]||t.matchPatterns[t.defaultMatchWidth],c=r.match(o);if(!c)return null;const f=c[0],d=i&&t.parsePatterns[i]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(d)?TL(d,b=>b.test(f)):RL(d,b=>b.test(f));let p;p=t.valueCallback?t.valueCallback(h):h,p=a.valueCallback?a.valueCallback(p):p;const g=r.slice(f.length);return{value:p,rest:g}}}function RL(t,r){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r(t[a]))return a}function TL(t,r){for(let a=0;a<t.length;a++)if(r(t[a]))return a}function CL(t){return(r,a={})=>{const i=r.match(t.matchPattern);if(!i)return null;const o=i[0],c=r.match(t.parsePattern);if(!c)return null;let f=t.valueCallback?t.valueCallback(c[0]):c[0];f=a.valueCallback?a.valueCallback(f):f;const d=r.slice(o.length);return{value:f,rest:d}}}const AL=/^(\d+)(th|st|nd|rd)?/i,NL=/\d+/i,OL={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},jL={any:[/^b/i,/^(a|c)/i]},ML={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},DL={any:[/1/i,/2/i,/3/i,/4/i]},_L={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},LL={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zL={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},PL={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},kL={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},UL={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},$L={ordinalNumber:CL({matchPattern:AL,parsePattern:NL,valueCallback:t=>parseInt(t,10)}),era:Pl({matchPatterns:OL,defaultMatchWidth:"wide",parsePatterns:jL,defaultParseWidth:"any"}),quarter:Pl({matchPatterns:ML,defaultMatchWidth:"wide",parsePatterns:DL,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Pl({matchPatterns:_L,defaultMatchWidth:"wide",parsePatterns:LL,defaultParseWidth:"any"}),day:Pl({matchPatterns:zL,defaultMatchWidth:"wide",parsePatterns:PL,defaultParseWidth:"any"}),dayPeriod:Pl({matchPatterns:kL,defaultMatchWidth:"any",parsePatterns:UL,defaultParseWidth:"any"})},HL={code:"en-US",formatDistance:cL,formatLong:hL,formatRelative:pL,localize:EL,match:$L,options:{weekStartsOn:0,firstWeekContainsDate:1}};function qL(t,r){const a=wn(t,r==null?void 0:r.in);return rL(a,lL(a))+1}function BL(t,r){const a=wn(t,r==null?void 0:r.in),i=+tu(a)-+aL(a);return Math.round(i/ZE)+1}function e1(t,r){var g,b,x,E;const a=wn(t,r==null?void 0:r.in),i=a.getFullYear(),o=Ru(),c=(r==null?void 0:r.firstWeekContainsDate)??((b=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((E=(x=o.locale)==null?void 0:x.options)==null?void 0:E.firstWeekContainsDate)??1,f=ma((r==null?void 0:r.in)||t,0);f.setFullYear(i+1,0,c),f.setHours(0,0,0,0);const d=Gl(f,r),h=ma((r==null?void 0:r.in)||t,0);h.setFullYear(i,0,c),h.setHours(0,0,0,0);const p=Gl(h,r);return+a>=+d?i+1:+a>=+p?i:i-1}function IL(t,r){var d,h,p,g;const a=Ru(),i=(r==null?void 0:r.firstWeekContainsDate)??((h=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??a.firstWeekContainsDate??((g=(p=a.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??1,o=e1(t,r),c=ma((r==null?void 0:r.in)||t,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Gl(c,r)}function VL(t,r){const a=wn(t,r==null?void 0:r.in),i=+Gl(a,r)-+IL(a,r);return Math.round(i/ZE)+1}function $e(t,r){const a=t<0?"-":"",i=Math.abs(t).toString().padStart(r,"0");return a+i}const Zr={y(t,r){const a=t.getFullYear(),i=a>0?a:1-a;return $e(r==="yy"?i%100:i,r.length)},M(t,r){const a=t.getMonth();return r==="M"?String(a+1):$e(a+1,2)},d(t,r){return $e(t.getDate(),r.length)},a(t,r){const a=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h(t,r){return $e(t.getHours()%12||12,r.length)},H(t,r){return $e(t.getHours(),r.length)},m(t,r){return $e(t.getMinutes(),r.length)},s(t,r){return $e(t.getSeconds(),r.length)},S(t,r){const a=r.length,i=t.getMilliseconds(),o=Math.trunc(i*Math.pow(10,a-3));return $e(o,r.length)}},Ks={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},P0={G:function(t,r,a){const i=t.getFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(i,{width:"abbreviated"});case"GGGGG":return a.era(i,{width:"narrow"});case"GGGG":default:return a.era(i,{width:"wide"})}},y:function(t,r,a){if(r==="yo"){const i=t.getFullYear(),o=i>0?i:1-i;return a.ordinalNumber(o,{unit:"year"})}return Zr.y(t,r)},Y:function(t,r,a,i){const o=e1(t,i),c=o>0?o:1-o;if(r==="YY"){const f=c%100;return $e(f,2)}return r==="Yo"?a.ordinalNumber(c,{unit:"year"}):$e(c,r.length)},R:function(t,r){const a=JE(t);return $e(a,r.length)},u:function(t,r){const a=t.getFullYear();return $e(a,r.length)},Q:function(t,r,a){const i=Math.ceil((t.getMonth()+1)/3);switch(r){case"Q":return String(i);case"QQ":return $e(i,2);case"Qo":return a.ordinalNumber(i,{unit:"quarter"});case"QQQ":return a.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,r,a){const i=Math.ceil((t.getMonth()+1)/3);switch(r){case"q":return String(i);case"qq":return $e(i,2);case"qo":return a.ordinalNumber(i,{unit:"quarter"});case"qqq":return a.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,r,a){const i=t.getMonth();switch(r){case"M":case"MM":return Zr.M(t,r);case"Mo":return a.ordinalNumber(i+1,{unit:"month"});case"MMM":return a.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(i,{width:"wide",context:"formatting"})}},L:function(t,r,a){const i=t.getMonth();switch(r){case"L":return String(i+1);case"LL":return $e(i+1,2);case"Lo":return a.ordinalNumber(i+1,{unit:"month"});case"LLL":return a.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(i,{width:"wide",context:"standalone"})}},w:function(t,r,a,i){const o=VL(t,i);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):$e(o,r.length)},I:function(t,r,a){const i=BL(t);return r==="Io"?a.ordinalNumber(i,{unit:"week"}):$e(i,r.length)},d:function(t,r,a){return r==="do"?a.ordinalNumber(t.getDate(),{unit:"date"}):Zr.d(t,r)},D:function(t,r,a){const i=qL(t);return r==="Do"?a.ordinalNumber(i,{unit:"dayOfYear"}):$e(i,r.length)},E:function(t,r,a){const i=t.getDay();switch(r){case"E":case"EE":case"EEE":return a.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(i,{width:"short",context:"formatting"});case"EEEE":default:return a.day(i,{width:"wide",context:"formatting"})}},e:function(t,r,a,i){const o=t.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(r){case"e":return String(c);case"ee":return $e(c,2);case"eo":return a.ordinalNumber(c,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(t,r,a,i){const o=t.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(r){case"c":return String(c);case"cc":return $e(c,r.length);case"co":return a.ordinalNumber(c,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(t,r,a){const i=t.getDay(),o=i===0?7:i;switch(r){case"i":return String(o);case"ii":return $e(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(i,{width:"short",context:"formatting"});case"iiii":default:return a.day(i,{width:"wide",context:"formatting"})}},a:function(t,r,a){const o=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,r,a){const i=t.getHours();let o;switch(i===12?o=Ks.noon:i===0?o=Ks.midnight:o=i/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,r,a){const i=t.getHours();let o;switch(i>=17?o=Ks.evening:i>=12?o=Ks.afternoon:i>=4?o=Ks.morning:o=Ks.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,r,a){if(r==="ho"){let i=t.getHours()%12;return i===0&&(i=12),a.ordinalNumber(i,{unit:"hour"})}return Zr.h(t,r)},H:function(t,r,a){return r==="Ho"?a.ordinalNumber(t.getHours(),{unit:"hour"}):Zr.H(t,r)},K:function(t,r,a){const i=t.getHours()%12;return r==="Ko"?a.ordinalNumber(i,{unit:"hour"}):$e(i,r.length)},k:function(t,r,a){let i=t.getHours();return i===0&&(i=24),r==="ko"?a.ordinalNumber(i,{unit:"hour"}):$e(i,r.length)},m:function(t,r,a){return r==="mo"?a.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zr.m(t,r)},s:function(t,r,a){return r==="so"?a.ordinalNumber(t.getSeconds(),{unit:"second"}):Zr.s(t,r)},S:function(t,r){return Zr.S(t,r)},X:function(t,r,a){const i=t.getTimezoneOffset();if(i===0)return"Z";switch(r){case"X":return U0(i);case"XXXX":case"XX":return Ia(i);case"XXXXX":case"XXX":default:return Ia(i,":")}},x:function(t,r,a){const i=t.getTimezoneOffset();switch(r){case"x":return U0(i);case"xxxx":case"xx":return Ia(i);case"xxxxx":case"xxx":default:return Ia(i,":")}},O:function(t,r,a){const i=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+k0(i,":");case"OOOO":default:return"GMT"+Ia(i,":")}},z:function(t,r,a){const i=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+k0(i,":");case"zzzz":default:return"GMT"+Ia(i,":")}},t:function(t,r,a){const i=Math.trunc(+t/1e3);return $e(i,r.length)},T:function(t,r,a){return $e(+t,r.length)}};function k0(t,r=""){const a=t>0?"-":"+",i=Math.abs(t),o=Math.trunc(i/60),c=i%60;return c===0?a+String(o):a+String(o)+r+$e(c,2)}function U0(t,r){return t%60===0?(t>0?"-":"+")+$e(Math.abs(t)/60,2):Ia(t,r)}function Ia(t,r=""){const a=t>0?"-":"+",i=Math.abs(t),o=$e(Math.trunc(i/60),2),c=$e(i%60,2);return a+o+r+c}const $0=(t,r)=>{switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},t1=(t,r)=>{switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},YL=(t,r)=>{const a=t.match(/(P+)(p+)?/)||[],i=a[1],o=a[2];if(!o)return $0(t,r);let c;switch(i){case"P":c=r.dateTime({width:"short"});break;case"PP":c=r.dateTime({width:"medium"});break;case"PPP":c=r.dateTime({width:"long"});break;case"PPPP":default:c=r.dateTime({width:"full"});break}return c.replace("{{date}}",$0(i,r)).replace("{{time}}",t1(o,r))},GL={p:t1,P:YL},FL=/^D+$/,QL=/^Y+$/,XL=["D","DD","YY","YYYY"];function WL(t){return FL.test(t)}function KL(t){return QL.test(t)}function ZL(t,r,a){const i=JL(t,r,a);if(console.warn(i),XL.includes(t))throw new RangeError(i)}function JL(t,r,a){const i=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${i} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const e4=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,t4=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,n4=/^'([^]*?)'?$/,r4=/''/g,a4=/[a-zA-Z]/;function s4(t,r,a){var g,b,x,E;const i=Ru(),o=i.locale??HL,c=i.firstWeekContainsDate??((b=(g=i.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??1,f=i.weekStartsOn??((E=(x=i.locale)==null?void 0:x.options)==null?void 0:E.weekStartsOn)??0,d=wn(t,a==null?void 0:a.in);if(!iL(d))throw new RangeError("Invalid time value");let h=r.match(t4).map(R=>{const S=R[0];if(S==="p"||S==="P"){const w=GL[S];return w(R,o.formatLong)}return R}).join("").match(e4).map(R=>{if(R==="''")return{isToken:!1,value:"'"};const S=R[0];if(S==="'")return{isToken:!1,value:i4(R)};if(P0[S])return{isToken:!0,value:R};if(S.match(a4))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:R}});o.localize.preprocessor&&(h=o.localize.preprocessor(d,h));const p={firstWeekContainsDate:c,weekStartsOn:f,locale:o};return h.map(R=>{if(!R.isToken)return R.value;const S=R.value;(KL(S)||WL(S))&&ZL(S,r,String(t));const w=P0[S[0]];return w(d,S,o.localize,p)}).join("")}function i4(t){const r=t.match(n4);return r?r[1].replace(r4,"'"):t}function n1({title:t,subtitle:r}){return v.jsxs("div",{className:"space-y-0.5",children:[v.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:t}),r?v.jsx("p",{className:"text-muted-foreground",children:r}):null]})}function Um(t,[r,a]){return Math.min(a,Math.max(r,t))}function l4(t,r){return y.useReducer((a,i)=>r[a][i]??a,t)}var Mp="ScrollArea",[r1,zz]=Hn(Mp),[o4,on]=r1(Mp),a1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,type:i="hover",dir:o,scrollHideDelay:c=600,...f}=t,[d,h]=y.useState(null),[p,g]=y.useState(null),[b,x]=y.useState(null),[E,R]=y.useState(null),[S,w]=y.useState(null),[C,A]=y.useState(0),[N,L]=y.useState(0),[_,k]=y.useState(!1),[I,Y]=y.useState(!1),H=ke(r,Z=>h(Z)),K=Su(o);return v.jsx(o4,{scope:a,type:i,dir:K,scrollHideDelay:c,scrollArea:d,viewport:p,onViewportChange:g,content:b,onContentChange:x,scrollbarX:E,onScrollbarXChange:R,scrollbarXEnabled:_,onScrollbarXEnabledChange:k,scrollbarY:S,onScrollbarYChange:w,scrollbarYEnabled:I,onScrollbarYEnabledChange:Y,onCornerWidthChange:A,onCornerHeightChange:L,children:v.jsx(Se.div,{dir:K,...f,ref:H,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})});a1.displayName=Mp;var s1="ScrollAreaViewport",i1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,children:i,nonce:o,...c}=t,f=on(s1,a),d=y.useRef(null),h=ke(r,d,f.onViewportChange);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),v.jsx(Se.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...t.style},children:v.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})});i1.displayName=s1;var Gn="ScrollAreaScrollbar",Dp=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=on(Gn,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:f}=o,d=t.orientation==="horizontal";return y.useEffect(()=>(d?c(!0):f(!0),()=>{d?c(!1):f(!1)}),[d,c,f]),o.type==="hover"?v.jsx(c4,{...i,ref:r,forceMount:a}):o.type==="scroll"?v.jsx(u4,{...i,ref:r,forceMount:a}):o.type==="auto"?v.jsx(l1,{...i,ref:r,forceMount:a}):o.type==="always"?v.jsx(_p,{...i,ref:r}):null});Dp.displayName=Gn;var c4=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=on(Gn,t.__scopeScrollArea),[c,f]=y.useState(!1);return y.useEffect(()=>{const d=o.scrollArea;let h=0;if(d){const p=()=>{window.clearTimeout(h),f(!0)},g=()=>{h=window.setTimeout(()=>f(!1),o.scrollHideDelay)};return d.addEventListener("pointerenter",p),d.addEventListener("pointerleave",g),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",p),d.removeEventListener("pointerleave",g)}}},[o.scrollArea,o.scrollHideDelay]),v.jsx(ln,{present:a||c,children:v.jsx(l1,{"data-state":c?"visible":"hidden",...i,ref:r})})}),u4=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=on(Gn,t.__scopeScrollArea),c=t.orientation==="horizontal",f=Cu(()=>h("SCROLL_END"),100),[d,h]=l4("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(d==="idle"){const p=window.setTimeout(()=>h("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[d,o.scrollHideDelay,h]),y.useEffect(()=>{const p=o.viewport,g=c?"scrollLeft":"scrollTop";if(p){let b=p[g];const x=()=>{const E=p[g];b!==E&&(h("SCROLL"),f()),b=E};return p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[o.viewport,c,h,f]),v.jsx(ln,{present:a||d!=="hidden",children:v.jsx(_p,{"data-state":d==="hidden"?"hidden":"visible",...i,ref:r,onPointerEnter:ge(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:ge(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),l1=y.forwardRef((t,r)=>{const a=on(Gn,t.__scopeScrollArea),{forceMount:i,...o}=t,[c,f]=y.useState(!1),d=t.orientation==="horizontal",h=Cu(()=>{if(a.viewport){const p=a.viewport.offsetWidth<a.viewport.scrollWidth,g=a.viewport.offsetHeight<a.viewport.scrollHeight;f(d?p:g)}},10);return wi(a.viewport,h),wi(a.content,h),v.jsx(ln,{present:i||c,children:v.jsx(_p,{"data-state":c?"visible":"hidden",...o,ref:r})})}),_p=y.forwardRef((t,r)=>{const{orientation:a="vertical",...i}=t,o=on(Gn,t.__scopeScrollArea),c=y.useRef(null),f=y.useRef(0),[d,h]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=d1(d.viewport,d.content),g={...i,sizes:d,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:x=>f.current=x};function b(x,E){return v4(x,f.current,d,E)}return a==="horizontal"?v.jsx(f4,{...g,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollLeft,E=H0(x,d,o.dir);c.current.style.transform=`translate3d(${E}px, 0, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollLeft=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollLeft=b(x,o.dir))}}):a==="vertical"?v.jsx(d4,{...g,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollTop,E=H0(x,d);c.current.style.transform=`translate3d(0, ${E}px, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollTop=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollTop=b(x))}}):null}),f4=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:i,...o}=t,c=on(Gn,t.__scopeScrollArea),[f,d]=y.useState(),h=y.useRef(null),p=ke(r,h,c.onScrollbarXChange);return y.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),v.jsx(c1,{"data-orientation":"horizontal",...o,ref:p,sizes:a,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Tu(a)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.x),onDragScroll:g=>t.onDragScroll(g.x),onWheelScroll:(g,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+g.deltaX;t.onWheelScroll(x),m1(x,b)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&f&&i({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:ru(f.paddingLeft),paddingEnd:ru(f.paddingRight)}})}})}),d4=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:i,...o}=t,c=on(Gn,t.__scopeScrollArea),[f,d]=y.useState(),h=y.useRef(null),p=ke(r,h,c.onScrollbarYChange);return y.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),v.jsx(c1,{"data-orientation":"vertical",...o,ref:p,sizes:a,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Tu(a)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.y),onDragScroll:g=>t.onDragScroll(g.y),onWheelScroll:(g,b)=>{if(c.viewport){const x=c.viewport.scrollTop+g.deltaY;t.onWheelScroll(x),m1(x,b)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&f&&i({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:ru(f.paddingTop),paddingEnd:ru(f.paddingBottom)}})}})}),[h4,o1]=r1(Gn),c1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,sizes:i,hasThumb:o,onThumbChange:c,onThumbPointerUp:f,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:g,onResize:b,...x}=t,E=on(Gn,a),[R,S]=y.useState(null),w=ke(r,H=>S(H)),C=y.useRef(null),A=y.useRef(""),N=E.viewport,L=i.content-i.viewport,_=nt(g),k=nt(h),I=Cu(b,10);function Y(H){if(C.current){const K=H.clientX-C.current.left,Z=H.clientY-C.current.top;p({x:K,y:Z})}}return y.useEffect(()=>{const H=K=>{const Z=K.target;(R==null?void 0:R.contains(Z))&&_(K,L)};return document.addEventListener("wheel",H,{passive:!1}),()=>document.removeEventListener("wheel",H,{passive:!1})},[N,R,L,_]),y.useEffect(k,[i,k]),wi(R,I),wi(E.content,I),v.jsx(h4,{scope:a,scrollbar:R,hasThumb:o,onThumbChange:nt(c),onThumbPointerUp:nt(f),onThumbPositionChange:k,onThumbPointerDown:nt(d),children:v.jsx(Se.div,{...x,ref:w,style:{position:"absolute",...x.style},onPointerDown:ge(t.onPointerDown,H=>{H.button===0&&(H.target.setPointerCapture(H.pointerId),C.current=R.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",E.viewport&&(E.viewport.style.scrollBehavior="auto"),Y(H))}),onPointerMove:ge(t.onPointerMove,Y),onPointerUp:ge(t.onPointerUp,H=>{const K=H.target;K.hasPointerCapture(H.pointerId)&&K.releasePointerCapture(H.pointerId),document.body.style.webkitUserSelect=A.current,E.viewport&&(E.viewport.style.scrollBehavior=""),C.current=null})})})}),nu="ScrollAreaThumb",u1=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=o1(nu,t.__scopeScrollArea);return v.jsx(ln,{present:a||o.hasThumb,children:v.jsx(m4,{ref:r,...i})})}),m4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,style:i,...o}=t,c=on(nu,a),f=o1(nu,a),{onThumbPositionChange:d}=f,h=ke(r,b=>f.onThumbChange(b)),p=y.useRef(void 0),g=Cu(()=>{p.current&&(p.current(),p.current=void 0)},100);return y.useEffect(()=>{const b=c.viewport;if(b){const x=()=>{if(g(),!p.current){const E=g4(b,d);p.current=E,d()}};return d(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,g,d]),v.jsx(Se.div,{"data-state":f.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:ge(t.onPointerDownCapture,b=>{const E=b.target.getBoundingClientRect(),R=b.clientX-E.left,S=b.clientY-E.top;f.onThumbPointerDown({x:R,y:S})}),onPointerUp:ge(t.onPointerUp,f.onThumbPointerUp)})});u1.displayName=nu;var Lp="ScrollAreaCorner",f1=y.forwardRef((t,r)=>{const a=on(Lp,t.__scopeScrollArea),i=!!(a.scrollbarX&&a.scrollbarY);return a.type!=="scroll"&&i?v.jsx(p4,{...t,ref:r}):null});f1.displayName=Lp;var p4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,...i}=t,o=on(Lp,a),[c,f]=y.useState(0),[d,h]=y.useState(0),p=!!(c&&d);return wi(o.scrollbarX,()=>{var b;const g=((b=o.scrollbarX)==null?void 0:b.offsetHeight)||0;o.onCornerHeightChange(g),h(g)}),wi(o.scrollbarY,()=>{var b;const g=((b=o.scrollbarY)==null?void 0:b.offsetWidth)||0;o.onCornerWidthChange(g),f(g)}),p?v.jsx(Se.div,{...i,ref:r,style:{width:c,height:d,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ru(t){return t?parseInt(t,10):0}function d1(t,r){const a=t/r;return isNaN(a)?0:a}function Tu(t){const r=d1(t.viewport,t.content),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=(t.scrollbar.size-a)*r;return Math.max(i,18)}function v4(t,r,a,i="ltr"){const o=Tu(a),c=o/2,f=r||c,d=o-f,h=a.scrollbar.paddingStart+f,p=a.scrollbar.size-a.scrollbar.paddingEnd-d,g=a.content-a.viewport,b=i==="ltr"?[0,g]:[g*-1,0];return h1([h,p],b)(t)}function H0(t,r,a="ltr"){const i=Tu(r),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,c=r.scrollbar.size-o,f=r.content-r.viewport,d=c-i,h=a==="ltr"?[0,f]:[f*-1,0],p=Um(t,h);return h1([0,f],[0,d])(p)}function h1(t,r){return a=>{if(t[0]===t[1]||r[0]===r[1])return r[0];const i=(r[1]-r[0])/(t[1]-t[0]);return r[0]+i*(a-t[0])}}function m1(t,r){return t>0&&t<r}var g4=(t,r=()=>{})=>{let a={left:t.scrollLeft,top:t.scrollTop},i=0;return function o(){const c={left:t.scrollLeft,top:t.scrollTop},f=a.left!==c.left,d=a.top!==c.top;(f||d)&&r(),a=c,i=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(i)};function Cu(t,r){const a=nt(t),i=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),y.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(a,r)},[a,r])}function wi(t,r){const a=nt(r);ft(()=>{let i=0;if(t){const o=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(a)});return o.observe(t),()=>{window.cancelAnimationFrame(i),o.unobserve(t)}}},[t,a])}var p1=a1,y4=i1,b4=f1;const v1=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(p1,{ref:i,className:le("relative overflow-hidden",t),...a,children:[v.jsx(y4,{className:"h-full w-full rounded-[inherit]",children:r}),v.jsx(g1,{}),v.jsx(b4,{})]}));v1.displayName=p1.displayName;const g1=y.forwardRef(({className:t,orientation:r="vertical",...a},i)=>v.jsx(Dp,{ref:i,orientation:r,className:le("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:v.jsx(u1,{className:"relative flex-1 rounded-full bg-border"})}));g1.displayName=Dp.displayName;function x4(t){const r=y.useRef({value:t,previous:t});return y.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var w4=[" ","Enter","ArrowUp","ArrowDown"],S4=[" ","Enter"],lo="Select",[Au,Nu,E4]=Ap(lo),[ji,Pz]=Hn(lo,[E4,hu]),Ou=hu(),[R4,ga]=ji(lo),[T4,C4]=ji(lo),y1=t=>{const{__scopeSelect:r,children:a,open:i,defaultOpen:o,onOpenChange:c,value:f,defaultValue:d,onValueChange:h,dir:p,name:g,autoComplete:b,disabled:x,required:E,form:R}=t,S=Ou(r),[w,C]=y.useState(null),[A,N]=y.useState(null),[L,_]=y.useState(!1),k=Su(p),[I=!1,Y]=rs({prop:i,defaultProp:o,onChange:c}),[H,K]=rs({prop:f,defaultProp:d,onChange:h}),Z=y.useRef(null),ne=w?R||!!w.closest("form"):!0,[ce,$]=y.useState(new Set),U=Array.from(ce).map(M=>M.props.value).join(";");return v.jsx(mS,{...S,children:v.jsxs(R4,{required:E,scope:r,trigger:w,onTriggerChange:C,valueNode:A,onValueNodeChange:N,valueNodeHasChildren:L,onValueNodeHasChildrenChange:_,contentId:yr(),value:H,onValueChange:K,open:I,onOpenChange:Y,dir:k,triggerPointerDownPosRef:Z,disabled:x,children:[v.jsx(Au.Provider,{scope:r,children:v.jsx(T4,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(M=>{$(q=>new Set(q).add(M))},[]),onNativeOptionRemove:y.useCallback(M=>{$(q=>{const z=new Set(q);return z.delete(M),z})},[]),children:a})}),ne?v.jsxs(I1,{"aria-hidden":!0,required:E,tabIndex:-1,name:g,autoComplete:b,value:H,onChange:M=>K(M.target.value),disabled:x,form:R,children:[H===void 0?v.jsx("option",{value:""}):null,Array.from(ce)]},U):null]})})};y1.displayName=lo;var b1="SelectTrigger",x1=y.forwardRef((t,r)=>{const{__scopeSelect:a,disabled:i=!1,...o}=t,c=Ou(a),f=ga(b1,a),d=f.disabled||i,h=ke(r,f.onTriggerChange),p=Nu(a),g=y.useRef("touch"),[b,x,E]=V1(S=>{const w=p().filter(N=>!N.disabled),C=w.find(N=>N.value===f.value),A=Y1(w,S,C);A!==void 0&&f.onValueChange(A.value)}),R=S=>{d||(f.onOpenChange(!0),E()),S&&(f.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return v.jsx(pS,{asChild:!0,...c,children:v.jsx(Se.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":B1(f.value)?"":void 0,...o,ref:h,onClick:ge(o.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&R(S)}),onPointerDown:ge(o.onPointerDown,S=>{g.current=S.pointerType;const w=S.target;w.hasPointerCapture(S.pointerId)&&w.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(R(S),S.preventDefault())}),onKeyDown:ge(o.onKeyDown,S=>{const w=b.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(w&&S.key===" ")&&w4.includes(S.key)&&(R(),S.preventDefault())})})})});x1.displayName=b1;var w1="SelectValue",S1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:i,style:o,children:c,placeholder:f="",...d}=t,h=ga(w1,a),{onValueNodeHasChildrenChange:p}=h,g=c!==void 0,b=ke(r,h.onValueNodeChange);return ft(()=>{p(g)},[p,g]),v.jsx(Se.span,{...d,ref:b,style:{pointerEvents:"none"},children:B1(h.value)?v.jsx(v.Fragment,{children:f}):c})});S1.displayName=w1;var A4="SelectIcon",E1=y.forwardRef((t,r)=>{const{__scopeSelect:a,children:i,...o}=t;return v.jsx(Se.span,{"aria-hidden":!0,...o,ref:r,children:i||"▼"})});E1.displayName=A4;var N4="SelectPortal",R1=t=>v.jsx(Jl,{asChild:!0,...t});R1.displayName=N4;var os="SelectContent",T1=y.forwardRef((t,r)=>{const a=ga(os,t.__scopeSelect),[i,o]=y.useState();if(ft(()=>{o(new DocumentFragment)},[]),!a.open){const c=i;return c?Ei.createPortal(v.jsx(C1,{scope:t.__scopeSelect,children:v.jsx(Au.Slot,{scope:t.__scopeSelect,children:v.jsx("div",{children:t.children})})}),c):null}return v.jsx(A1,{...t,ref:r})});T1.displayName=os;var hn=10,[C1,ya]=ji(os),O4="SelectContentImpl",A1=y.forwardRef((t,r)=>{const{__scopeSelect:a,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:c,onPointerDownOutside:f,side:d,sideOffset:h,align:p,alignOffset:g,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:R,hideWhenDetached:S,avoidCollisions:w,...C}=t,A=ga(os,a),[N,L]=y.useState(null),[_,k]=y.useState(null),I=ke(r,fe=>L(fe)),[Y,H]=y.useState(null),[K,Z]=y.useState(null),ne=Nu(a),[ce,$]=y.useState(!1),U=y.useRef(!1);y.useEffect(()=>{if(N)return Ew(N)},[N]),mw();const M=y.useCallback(fe=>{const[me,...Ee]=ne().map(Ae=>Ae.ref.current),[de]=Ee.slice(-1),we=document.activeElement;for(const Ae of fe)if(Ae===we||(Ae==null||Ae.scrollIntoView({block:"nearest"}),Ae===me&&_&&(_.scrollTop=0),Ae===de&&_&&(_.scrollTop=_.scrollHeight),Ae==null||Ae.focus(),document.activeElement!==we))return},[ne,_]),q=y.useCallback(()=>M([Y,N]),[M,Y,N]);y.useEffect(()=>{ce&&q()},[ce,q]);const{onOpenChange:z,triggerPointerDownPosRef:Q}=A;y.useEffect(()=>{if(N){let fe={x:0,y:0};const me=de=>{var we,Ae;fe={x:Math.abs(Math.round(de.pageX)-(((we=Q.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(de.pageY)-(((Ae=Q.current)==null?void 0:Ae.y)??0))}},Ee=de=>{fe.x<=10&&fe.y<=10?de.preventDefault():N.contains(de.target)||z(!1),document.removeEventListener("pointermove",me),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[N,z,Q]),y.useEffect(()=>{const fe=()=>z(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[z]);const[j,G]=V1(fe=>{const me=ne().filter(we=>!we.disabled),Ee=me.find(we=>we.ref.current===document.activeElement),de=Y1(me,fe,Ee);de&&setTimeout(()=>de.ref.current.focus())}),te=y.useCallback((fe,me,Ee)=>{const de=!U.current&&!Ee;(A.value!==void 0&&A.value===me||de)&&(H(fe),de&&(U.current=!0))},[A.value]),se=y.useCallback(()=>N==null?void 0:N.focus(),[N]),ae=y.useCallback((fe,me,Ee)=>{const de=!U.current&&!Ee;(A.value!==void 0&&A.value===me||de)&&Z(fe)},[A.value]),oe=i==="popper"?$m:N1,pe=oe===$m?{side:d,sideOffset:h,align:p,alignOffset:g,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:R,hideWhenDetached:S,avoidCollisions:w}:{};return v.jsx(C1,{scope:a,content:N,viewport:_,onViewportChange:k,itemRefCallback:te,selectedItem:Y,onItemLeave:se,itemTextRefCallback:ae,focusSelectedItem:q,selectedItemText:K,position:i,isPositioned:ce,searchRef:j,children:v.jsx(Jm,{as:sn,allowPinchZoom:!0,children:v.jsx(Zm,{asChild:!0,trapped:A.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:ge(o,fe=>{var me;(me=A.trigger)==null||me.focus({preventScroll:!0}),fe.preventDefault()}),children:v.jsx(Zl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:v.jsx(oe,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:fe=>fe.preventDefault(),...C,...pe,onPlaced:()=>$(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ge(C.onKeyDown,fe=>{const me=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!me&&fe.key.length===1&&G(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let de=ne().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const we=fe.target,Ae=de.indexOf(we);de=de.slice(Ae+1)}setTimeout(()=>M(de)),fe.preventDefault()}})})})})})})});A1.displayName=O4;var j4="SelectItemAlignedPosition",N1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onPlaced:i,...o}=t,c=ga(os,a),f=ya(os,a),[d,h]=y.useState(null),[p,g]=y.useState(null),b=ke(r,I=>g(I)),x=Nu(a),E=y.useRef(!1),R=y.useRef(!0),{viewport:S,selectedItem:w,selectedItemText:C,focusSelectedItem:A}=f,N=y.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&p&&S&&w&&C){const I=c.trigger.getBoundingClientRect(),Y=p.getBoundingClientRect(),H=c.valueNode.getBoundingClientRect(),K=C.getBoundingClientRect();if(c.dir!=="rtl"){const we=K.left-Y.left,Ae=H.left-we,Ve=I.left-Ae,Rt=I.width+Ve,Rn=Math.max(Rt,Y.width),Vt=window.innerWidth-hn,Fn=Um(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Rt+"px",d.style.left=Fn+"px"}else{const we=Y.right-K.right,Ae=window.innerWidth-H.right-we,Ve=window.innerWidth-I.right-Ae,Rt=I.width+Ve,Rn=Math.max(Rt,Y.width),Vt=window.innerWidth-hn,Fn=Um(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Rt+"px",d.style.right=Fn+"px"}const Z=x(),ne=window.innerHeight-hn*2,ce=S.scrollHeight,$=window.getComputedStyle(p),U=parseInt($.borderTopWidth,10),M=parseInt($.paddingTop,10),q=parseInt($.borderBottomWidth,10),z=parseInt($.paddingBottom,10),Q=U+M+ce+z+q,j=Math.min(w.offsetHeight*5,Q),G=window.getComputedStyle(S),te=parseInt(G.paddingTop,10),se=parseInt(G.paddingBottom,10),ae=I.top+I.height/2-hn,oe=ne-ae,pe=w.offsetHeight/2,fe=w.offsetTop+pe,me=U+M+fe,Ee=Q-me;if(me<=ae){const we=Z.length>0&&w===Z[Z.length-1].ref.current;d.style.bottom="0px";const Ae=p.clientHeight-S.offsetTop-S.offsetHeight,Ve=Math.max(oe,pe+(we?se:0)+Ae+q),Rt=me+Ve;d.style.height=Rt+"px"}else{const we=Z.length>0&&w===Z[0].ref.current;d.style.top="0px";const Ve=Math.max(ae,U+S.offsetTop+(we?te:0)+pe)+Ee;d.style.height=Ve+"px",S.scrollTop=me-ae+S.offsetTop}d.style.margin=`${hn}px 0`,d.style.minHeight=j+"px",d.style.maxHeight=ne+"px",i==null||i(),requestAnimationFrame(()=>E.current=!0)}},[x,c.trigger,c.valueNode,d,p,S,w,C,c.dir,i]);ft(()=>N(),[N]);const[L,_]=y.useState();ft(()=>{p&&_(window.getComputedStyle(p).zIndex)},[p]);const k=y.useCallback(I=>{I&&R.current===!0&&(N(),A==null||A(),R.current=!1)},[N,A]);return v.jsx(D4,{scope:a,contentWrapper:d,shouldExpandOnScrollRef:E,onScrollButtonChange:k,children:v.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:L},children:v.jsx(Se.div,{...o,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});N1.displayName=j4;var M4="SelectPopperPosition",$m=y.forwardRef((t,r)=>{const{__scopeSelect:a,align:i="start",collisionPadding:o=hn,...c}=t,f=Ou(a);return v.jsx(vS,{...f,...c,ref:r,align:i,collisionPadding:o,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$m.displayName=M4;var[D4,zp]=ji(os,{}),Hm="SelectViewport",O1=y.forwardRef((t,r)=>{const{__scopeSelect:a,nonce:i,...o}=t,c=ya(Hm,a),f=zp(Hm,a),d=ke(r,c.onViewportChange),h=y.useRef(0);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),v.jsx(Au.Slot,{scope:a,children:v.jsx(Se.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ge(o.onScroll,p=>{const g=p.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:x}=f;if(x!=null&&x.current&&b){const E=Math.abs(h.current-g.scrollTop);if(E>0){const R=window.innerHeight-hn*2,S=parseFloat(b.style.minHeight),w=parseFloat(b.style.height),C=Math.max(S,w);if(C<R){const A=C+E,N=Math.min(R,A),L=A-N;b.style.height=N+"px",b.style.bottom==="0px"&&(g.scrollTop=L>0?L:0,b.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})});O1.displayName=Hm;var j1="SelectGroup",[_4,L4]=ji(j1),z4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t,o=yr();return v.jsx(_4,{scope:a,id:o,children:v.jsx(Se.div,{role:"group","aria-labelledby":o,...i,ref:r})})});z4.displayName=j1;var M1="SelectLabel",D1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t,o=L4(M1,a);return v.jsx(Se.div,{id:o.id,...i,ref:r})});D1.displayName=M1;var au="SelectItem",[P4,_1]=ji(au),L1=y.forwardRef((t,r)=>{const{__scopeSelect:a,value:i,disabled:o=!1,textValue:c,...f}=t,d=ga(au,a),h=ya(au,a),p=d.value===i,[g,b]=y.useState(c??""),[x,E]=y.useState(!1),R=ke(r,A=>{var N;return(N=h.itemRefCallback)==null?void 0:N.call(h,A,i,o)}),S=yr(),w=y.useRef("touch"),C=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return v.jsx(P4,{scope:a,value:i,disabled:o,textId:S,isSelected:p,onItemTextChange:y.useCallback(A=>{b(N=>N||((A==null?void 0:A.textContent)??"").trim())},[]),children:v.jsx(Au.ItemSlot,{scope:a,value:i,disabled:o,textValue:g,children:v.jsx(Se.div,{role:"option","aria-labelledby":S,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...f,ref:R,onFocus:ge(f.onFocus,()=>E(!0)),onBlur:ge(f.onBlur,()=>E(!1)),onClick:ge(f.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:ge(f.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:ge(f.onPointerDown,A=>{w.current=A.pointerType}),onPointerMove:ge(f.onPointerMove,A=>{var N;w.current=A.pointerType,o?(N=h.onItemLeave)==null||N.call(h):w.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(f.onPointerLeave,A=>{var N;A.currentTarget===document.activeElement&&((N=h.onItemLeave)==null||N.call(h))}),onKeyDown:ge(f.onKeyDown,A=>{var L;((L=h.searchRef)==null?void 0:L.current)!==""&&A.key===" "||(S4.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})});L1.displayName=au;var Hl="SelectItemText",z1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:i,style:o,...c}=t,f=ga(Hl,a),d=ya(Hl,a),h=_1(Hl,a),p=C4(Hl,a),[g,b]=y.useState(null),x=ke(r,C=>b(C),h.onItemTextChange,C=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.call(d,C,h.value,h.disabled)}),E=g==null?void 0:g.textContent,R=y.useMemo(()=>v.jsx("option",{value:h.value,disabled:h.disabled,children:E},h.value),[h.disabled,h.value,E]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=p;return ft(()=>(S(R),()=>w(R)),[S,w,R]),v.jsxs(v.Fragment,{children:[v.jsx(Se.span,{id:h.textId,...c,ref:x}),h.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Ei.createPortal(c.children,f.valueNode):null]})});z1.displayName=Hl;var P1="SelectItemIndicator",k1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t;return _1(P1,a).isSelected?v.jsx(Se.span,{"aria-hidden":!0,...i,ref:r}):null});k1.displayName=P1;var qm="SelectScrollUpButton",U1=y.forwardRef((t,r)=>{const a=ya(qm,t.__scopeSelect),i=zp(qm,t.__scopeSelect),[o,c]=y.useState(!1),f=ke(r,i.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=h.scrollTop>0;c(p)};const h=a.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?v.jsx(H1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=a;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});U1.displayName=qm;var Bm="SelectScrollDownButton",$1=y.forwardRef((t,r)=>{const a=ya(Bm,t.__scopeSelect),i=zp(Bm,t.__scopeSelect),[o,c]=y.useState(!1),f=ke(r,i.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<p;c(g)};const h=a.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?v.jsx(H1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=a;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});$1.displayName=Bm;var H1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onAutoScroll:i,...o}=t,c=ya("SelectScrollButton",a),f=y.useRef(null),d=Nu(a),h=y.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return y.useEffect(()=>()=>h(),[h]),ft(()=>{var g;const p=d().find(b=>b.ref.current===document.activeElement);(g=p==null?void 0:p.ref.current)==null||g.scrollIntoView({block:"nearest"})},[d]),v.jsx(Se.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:ge(o.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(i,50))}),onPointerMove:ge(o.onPointerMove,()=>{var p;(p=c.onItemLeave)==null||p.call(c),f.current===null&&(f.current=window.setInterval(i,50))}),onPointerLeave:ge(o.onPointerLeave,()=>{h()})})}),k4="SelectSeparator",q1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t;return v.jsx(Se.div,{"aria-hidden":!0,...i,ref:r})});q1.displayName=k4;var Im="SelectArrow",U4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t,o=Ou(a),c=ga(Im,a),f=ya(Im,a);return c.open&&f.position==="popper"?v.jsx(gS,{...o,...i,ref:r}):null});U4.displayName=Im;function B1(t){return t===""||t===void 0}var I1=y.forwardRef((t,r)=>{const{value:a,...i}=t,o=y.useRef(null),c=ke(r,o),f=x4(a);return y.useEffect(()=>{const d=o.current,h=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(f!==a&&g){const b=new Event("change",{bubbles:!0});g.call(d,a),d.dispatchEvent(b)}},[f,a]),v.jsx(to,{asChild:!0,children:v.jsx("select",{...i,ref:c,defaultValue:a})})});I1.displayName="BubbleSelect";function V1(t){const r=nt(t),a=y.useRef(""),i=y.useRef(0),o=y.useCallback(f=>{const d=a.current+f;r(d),function h(p){a.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>h(""),1e3))}(d)},[r]),c=y.useCallback(()=>{a.current="",window.clearTimeout(i.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),[a,o,c]}function Y1(t,r,a){const o=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,c=a?t.indexOf(a):-1;let f=$4(t,Math.max(c,0));o.length===1&&(f=f.filter(p=>p!==a));const h=f.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return h!==a?h:void 0}function $4(t,r){return t.map((a,i)=>t[(r+i)%t.length])}var H4=y1,G1=x1,q4=S1,B4=E1,I4=R1,F1=T1,V4=O1,Q1=D1,X1=L1,Y4=z1,G4=k1,W1=U1,K1=$1,Z1=q1;const F4=H4,Q4=q4,J1=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(G1,{ref:i,className:le("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[r,v.jsx(B4,{asChild:!0,children:v.jsx(Vw,{className:"h-4 w-4 opacity-50"})})]}));J1.displayName=G1.displayName;const eR=y.forwardRef(({className:t,...r},a)=>v.jsx(W1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:v.jsx(ZO,{className:"h-4 w-4"})}));eR.displayName=W1.displayName;const tR=y.forwardRef(({className:t,...r},a)=>v.jsx(K1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:v.jsx(Vw,{className:"h-4 w-4"})}));tR.displayName=K1.displayName;const nR=y.forwardRef(({className:t,children:r,position:a="popper",...i},o)=>v.jsx(I4,{children:v.jsxs(F1,{ref:o,className:le("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...i,children:[v.jsx(eR,{}),v.jsx(V4,{className:le("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),v.jsx(tR,{})]})}));nR.displayName=F1.displayName;const X4=y.forwardRef(({className:t,...r},a)=>v.jsx(Q1,{ref:a,className:le("px-2 py-1.5 text-sm font-semibold",t),...r}));X4.displayName=Q1.displayName;const Vm=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(X1,{ref:i,className:le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[v.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(G4,{children:v.jsx(ap,{className:"h-4 w-4"})})}),v.jsx(Y4,{children:r})]}));Vm.displayName=X1.displayName;const W4=y.forwardRef(({className:t,...r},a)=>v.jsx(Z1,{ref:a,className:le("-mx-1 my-1 h-px bg-muted",t),...r}));W4.displayName=Z1.displayName;const K4={10:"TRACE",20:"DEBUG",27:"SUCCESS",28:"PROGRESS",29:"LOG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"},Z4={10:"text-gray-400",20:"text-blue-400",27:"text-green-600",28:"text-purple-400",29:"text-gray-300",30:"text-emerald-400",40:"text-yellow-400",50:"text-red-400",60:"text-red-600"};function J4(){const[t,r]=y.useState("all"),[a,i]=y.useState(!0),o=y.useRef(null),c=y.useRef(!1),f=y.useRef(""),{data:d,error:h,isLoading:p}=fs({queryKey:["logs",t],queryFn:()=>Et.getLogs(t==="all"?"":t),refetchInterval:1e3,staleTime:1e3}),g=()=>{if(!o.current)return;const w=o.current,C=w.scrollHeight,A=w.clientHeight;w.scrollTo({top:C-A,behavior:"instant"})};y.useEffect(()=>{var A;if(!((A=d==null?void 0:d.logs)!=null&&A.length))return;const w=d.logs[d.logs.length-1],C=`${w.time}-${w.msg}`;a&&C!==f.current&&(setTimeout(g,0),f.current=C)},[d==null?void 0:d.logs,a]);const b=w=>{if(c.current)return;const{scrollTop:C,scrollHeight:A,clientHeight:N}=w.currentTarget,_=A-(C+N)<100;i(_),c.current=!0,setTimeout(()=>{c.current=!1},150)},x=()=>{i(!0),g()};y.useEffect(()=>{setTimeout(g,100)},[d==null?void 0:d.logs]);const E=w=>K4[w]||"UNKNOWN",R=w=>Z4[w]||"text-gray-400",S=w=>{const C=s4(w.time,"yyyy-MM-dd HH:mm:ss"),A=E(w.level),N=Object.entries(w).filter(([_])=>!Number.isNaN(Number(_))).sort((_,k)=>Number(_[0])-Number(k[0])),L=N.length>0?`
|
|
269
|
+
Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let x=va(),E;if(r){let N=typeof r=="string"?Ai(r):r;Ke(g==="/"||((A=N.pathname)==null?void 0:A.startsWith(g)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${g}" but pathname "${N.pathname}" was given in the \`location\` prop.`),E=N}else E=x;let R=E.pathname||"/",S=R;if(g!=="/"){let N=g.replace(/^\//,"").split("/");S="/"+R.replace(/^\//,"").split("/").slice(N.length).join("/")}let w=!c&&a&&a.matches&&a.matches.length>0?a.matches:ZS(t,{pathname:S});$n(b||w!=null,`No routes matched location "${E.pathname}${E.search}${E.hash}" `),$n(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${E.pathname}${E.search}${E.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=RD(w&&w.map(N=>Object.assign({},N,{params:Object.assign({},h,N.params),pathname:wr([g,o.encodeLocation?o.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?g:wr([g,o.encodeLocation?o.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),f,a,i);return r&&C?y.createElement(ro.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...E},navigationType:"POP"}},C):C}function xD(){let t=OD(),r=hD(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),a=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:i},c={padding:"2px 4px",backgroundColor:i},f=null;return console.error("Error handled by React Router default ErrorBoundary:",t),f=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:c},"ErrorBoundary")," or"," ",y.createElement("code",{style:c},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},r),a?y.createElement("pre",{style:o},a):null,f)}var wD=y.createElement(xD,null),SD=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?y.createElement(Vn.Provider,{value:this.props.routeContext},y.createElement(Sp.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function ED({routeContext:t,match:r,children:a}){let i=y.useContext(Ni);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),y.createElement(Vn.Provider,{value:t},a)}function RD(t,r=[],a=null,i=null){if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let o=t,c=a==null?void 0:a.errors;if(c!=null){let h=o.findIndex(p=>p.route.id&&(c==null?void 0:c[p.route.id])!==void 0);Ke(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let f=!1,d=-1;if(a)for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(d=h),p.route.id){let{loaderData:g,errors:b}=a,x=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!b||b[p.route.id]===void 0);if(p.route.lazy||x){f=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((h,p,g)=>{let b,x=!1,E=null,R=null;a&&(b=c&&p.route.id?c[p.route.id]:void 0,E=p.route.errorElement||wD,f&&(d<0&&g===0?(cE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,R=null):d===g&&(x=!0,R=p.route.hydrateFallbackElement||null)));let S=r.concat(o.slice(0,g+1)),w=()=>{let C;return b?C=E:x?C=R:p.route.Component?C=y.createElement(p.route.Component,null):p.route.element?C=p.route.element:C=h,y.createElement(ED,{match:p,routeContext:{outlet:h,matches:S,isDataRoute:a!=null},children:C})};return a&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?y.createElement(SD,{location:a.location,revalidation:a.revalidation,component:E,error:b,children:w(),routeContext:{outlet:null,matches:S,isDataRoute:!0}}):w()},null)}function Ep(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TD(t){let r=y.useContext(Ni);return Ke(r,Ep(t)),r}function CD(t){let r=y.useContext(bu);return Ke(r,Ep(t)),r}function AD(t){let r=y.useContext(Vn);return Ke(r,Ep(t)),r}function Rp(t){let r=AD(t),a=r.matches[r.matches.length-1];return Ke(a.route.id,`${t} can only be used on routes that contain a unique "id"`),a.route.id}function ND(){return Rp("useRouteId")}function OD(){var i;let t=y.useContext(Sp),r=CD("useRouteError"),a=Rp("useRouteError");return t!==void 0?t:(i=r.errors)==null?void 0:i[a]}function jD(){let{router:t}=TD("useNavigate"),r=Rp("useNavigate"),a=y.useRef(!1);return iE(()=>{a.current=!0}),y.useCallback(async(o,c={})=>{$n(a.current,sE),a.current&&(typeof o=="number"?t.navigate(o):await t.navigate(o,{fromRouteId:r,...c}))},[t,r])}var N0={};function cE(t,r,a){!r&&!N0[t]&&(N0[t]=!0,$n(!1,a))}y.memo(MD);function MD({routes:t,future:r,state:a}){return oE(t,void 0,a,r)}function Ba(t){Ke(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function DD({basename:t="/",children:r=null,location:a,navigationType:i="POP",navigator:o,static:c=!1}){Ke(!ao(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=t.replace(/^\/*/,"/"),d=y.useMemo(()=>({basename:f,navigator:o,static:c,future:{}}),[f,o,c]);typeof a=="string"&&(a=Ai(a));let{pathname:h="/",search:p="",hash:g="",state:b=null,key:x="default"}=a,E=y.useMemo(()=>{let R=Tr(h,f);return R==null?null:{location:{pathname:R,search:p,hash:g,state:b,key:x},navigationType:i}},[f,h,p,g,b,x,i]);return $n(E!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:y.createElement(In.Provider,{value:d},y.createElement(ro.Provider,{children:r,value:E}))}function _D({children:t,location:r}){return bD(_m(t),r)}function _m(t,r=[]){let a=[];return y.Children.forEach(t,(i,o)=>{if(!y.isValidElement(i))return;let c=[...r,o];if(i.type===y.Fragment){a.push.apply(a,_m(i.props.children,c));return}Ke(i.type===Ba,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ke(!i.props.index||!i.props.children,"An index route cannot have child routes.");let f={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(f.children=_m(i.props.children,c)),a.push(f)}),a}var Hc="get",qc="application/x-www-form-urlencoded";function xu(t){return t!=null&&typeof t.tagName=="string"}function LD(t){return xu(t)&&t.tagName.toLowerCase()==="button"}function zD(t){return xu(t)&&t.tagName.toLowerCase()==="form"}function PD(t){return xu(t)&&t.tagName.toLowerCase()==="input"}function kD(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function UD(t,r){return t.button===0&&(!r||r==="_self")&&!kD(t)}var Oc=null;function $D(){if(Oc===null)try{new FormData(document.createElement("form"),0),Oc=!1}catch{Oc=!0}return Oc}var HD=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fh(t){return t!=null&&!HD.has(t)?($n(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qc}"`),null):t}function qD(t,r){let a,i,o,c,f;if(zD(t)){let d=t.getAttribute("action");i=d?Tr(d,r):null,a=t.getAttribute("method")||Hc,o=fh(t.getAttribute("enctype"))||qc,c=new FormData(t)}else if(LD(t)||PD(t)&&(t.type==="submit"||t.type==="image")){let d=t.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=t.getAttribute("formaction")||d.getAttribute("action");if(i=h?Tr(h,r):null,a=t.getAttribute("formmethod")||d.getAttribute("method")||Hc,o=fh(t.getAttribute("formenctype"))||fh(d.getAttribute("enctype"))||qc,c=new FormData(d,t),!$D()){let{name:p,type:g,value:b}=t;if(g==="image"){let x=p?`${p}.`:"";c.append(`${x}x`,"0"),c.append(`${x}y`,"0")}else p&&c.append(p,b)}}else{if(xu(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Hc,i=null,o=qc,f=t}return c&&o==="text/plain"&&(f=c,c=void 0),{action:i,method:a.toLowerCase(),encType:o,formData:c,body:f}}function Tp(t,r){if(t===!1||t===null||typeof t>"u")throw new Error(r)}async function BD(t,r){if(t.id in r)return r[t.id];try{let a=await import(t.module);return r[t.id]=a,a}catch(a){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ID(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function VD(t,r,a){let i=await Promise.all(t.map(async o=>{let c=r.routes[o.route.id];if(c){let f=await BD(c,a);return f.links?f.links():[]}return[]}));return QD(i.flat(1).filter(ID).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function O0(t,r,a,i,o,c){let f=(h,p)=>a[p]?h.route.id!==a[p].route.id:!0,d=(h,p)=>{var g;return a[p].pathname!==h.pathname||((g=a[p].route.path)==null?void 0:g.endsWith("*"))&&a[p].params["*"]!==h.params["*"]};return c==="assets"?r.filter((h,p)=>f(h,p)||d(h,p)):c==="data"?r.filter((h,p)=>{var b;let g=i.routes[h.route.id];if(!g||!g.hasLoader)return!1;if(f(h,p)||d(h,p))return!0;if(h.route.shouldRevalidate){let x=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((b=a[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function YD(t,r,{includeHydrateFallback:a}={}){return GD(t.map(i=>{let o=r.routes[i.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function GD(t){return[...new Set(t)]}function FD(t){let r={},a=Object.keys(t).sort();for(let i of a)r[i]=t[i];return r}function QD(t,r){let a=new Set;return new Set(r),t.reduce((i,o)=>{let c=JSON.stringify(FD(o));return a.has(c)||(a.add(c),i.push({key:c,link:o})),i},[])}function XD(t,r){let a=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return a.pathname==="/"?a.pathname="_root.data":r&&Tr(a.pathname,r)==="/"?a.pathname=`${r.replace(/\/$/,"")}/_root.data`:a.pathname=`${a.pathname.replace(/\/$/,"")}.data`,a}function uE(){let t=y.useContext(Ni);return Tp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function WD(){let t=y.useContext(bu);return Tp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Cp=y.createContext(void 0);Cp.displayName="FrameworkContext";function fE(){let t=y.useContext(Cp);return Tp(t,"You must render this element inside a <HydratedRouter> element"),t}function KD(t,r){let a=y.useContext(Cp),[i,o]=y.useState(!1),[c,f]=y.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:p,onMouseLeave:g,onTouchStart:b}=r,x=y.useRef(null);y.useEffect(()=>{if(t==="render"&&f(!0),t==="viewport"){let S=C=>{C.forEach(A=>{f(A.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return x.current&&w.observe(x.current),()=>{w.disconnect()}}},[t]),y.useEffect(()=>{if(i){let S=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(S)}}},[i]);let E=()=>{o(!0)},R=()=>{o(!1),f(!1)};return a?t!=="intent"?[c,x,{}]:[c,x,{onFocus:Ll(d,E),onBlur:Ll(h,R),onMouseEnter:Ll(p,E),onMouseLeave:Ll(g,R),onTouchStart:Ll(b,E)}]:[!1,x,{}]}function Ll(t,r){return a=>{t&&t(a),a.defaultPrevented||r(a)}}function ZD({page:t,...r}){let{router:a}=uE(),i=y.useMemo(()=>ZS(a.routes,t,a.basename),[a.routes,t,a.basename]);return i?y.createElement(e_,{page:t,matches:i,...r}):null}function JD(t){let{manifest:r,routeModules:a}=fE(),[i,o]=y.useState([]);return y.useEffect(()=>{let c=!1;return VD(t,r,a).then(f=>{c||o(f)}),()=>{c=!0}},[t,r,a]),i}function e_({page:t,matches:r,...a}){let i=va(),{manifest:o,routeModules:c}=fE(),{basename:f}=uE(),{loaderData:d,matches:h}=WD(),p=y.useMemo(()=>O0(t,r,h,o,i,"data"),[t,r,h,o,i]),g=y.useMemo(()=>O0(t,r,h,o,i,"assets"),[t,r,h,o,i]),b=y.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let R=new Set,S=!1;if(r.forEach(C=>{var N;let A=o.routes[C.route.id];!A||!A.hasLoader||(!p.some(L=>L.route.id===C.route.id)&&C.route.id in d&&((N=c[C.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?S=!0:R.add(C.route.id))}),R.size===0)return[];let w=XD(t,f);return S&&R.size>0&&w.searchParams.set("_routes",r.filter(C=>R.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[f,d,i,o,p,r,t,c]),x=y.useMemo(()=>YD(g,o),[g,o]),E=JD(g);return y.createElement(y.Fragment,null,b.map(R=>y.createElement("link",{key:R,rel:"prefetch",as:"fetch",href:R,...a})),x.map(R=>y.createElement("link",{key:R,rel:"modulepreload",href:R,...a})),E.map(({key:R,link:S})=>y.createElement("link",{key:R,...S})))}function t_(...t){return r=>{t.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var dE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{dE&&(window.__reactRouterVersion="7.3.0")}catch{}function n_({basename:t,children:r,window:a}){let i=y.useRef();i.current==null&&(i.current=YM({window:a,v5Compat:!0}));let o=i.current,[c,f]=y.useState({action:o.action,location:o.location}),d=y.useCallback(h=>{y.startTransition(()=>f(h))},[f]);return y.useLayoutEffect(()=>o.listen(d),[o,d]),y.createElement(DD,{basename:t,children:r,location:c.location,navigationType:c.action,navigator:o})}var hE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mE=y.forwardRef(function({onClick:r,discover:a="render",prefetch:i="none",relative:o,reloadDocument:c,replace:f,state:d,target:h,to:p,preventScrollReset:g,viewTransition:b,...x},E){let{basename:R}=y.useContext(In),S=typeof p=="string"&&hE.test(p),w,C=!1;if(typeof p=="string"&&S&&(w=p,dE))try{let H=new URL(window.location.href),K=p.startsWith("//")?new URL(H.protocol+p):new URL(p),Z=Tr(K.pathname,R);K.origin===H.origin&&Z!=null?p=Z+K.search+K.hash:C=!0}catch{$n(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let A=gD(p,{relative:o}),[N,L,_]=KD(i,x),k=s_(p,{replace:f,state:d,target:h,preventScrollReset:g,relative:o,viewTransition:b});function I(H){r&&r(H),H.defaultPrevented||k(H)}let Y=y.createElement("a",{...x,..._,href:w||A,onClick:C||c?r:I,ref:t_(E,L),target:h,"data-discover":!S&&a==="render"?"true":void 0});return N&&!S?y.createElement(y.Fragment,null,Y,y.createElement(ZD,{page:A})):Y});mE.displayName="Link";var Ya=y.forwardRef(function({"aria-current":r="page",caseSensitive:a=!1,className:i="",end:o=!1,style:c,to:f,viewTransition:d,children:h,...p},g){let b=so(f,{relative:p.relative}),x=va(),E=y.useContext(bu),{navigator:R,basename:S}=y.useContext(In),w=E!=null&&u_(b)&&d===!0,C=R.encodeLocation?R.encodeLocation(b).pathname:b.pathname,A=x.pathname,N=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;a||(A=A.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&S&&(N=Tr(N,S)||N);const L=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let _=A===C||!o&&A.startsWith(C)&&A.charAt(L)==="/",k=N!=null&&(N===C||!o&&N.startsWith(C)&&N.charAt(C.length)==="/"),I={isActive:_,isPending:k,isTransitioning:w},Y=_?r:void 0,H;typeof i=="function"?H=i(I):H=[i,_?"active":null,k?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let K=typeof c=="function"?c(I):c;return y.createElement(mE,{...p,"aria-current":Y,className:H,ref:g,style:K,to:f,viewTransition:d},typeof h=="function"?h(I):h)});Ya.displayName="NavLink";var r_=y.forwardRef(({discover:t="render",fetcherKey:r,navigate:a,reloadDocument:i,replace:o,state:c,method:f=Hc,action:d,onSubmit:h,relative:p,preventScrollReset:g,viewTransition:b,...x},E)=>{let R=o_(),S=c_(d,{relative:p}),w=f.toLowerCase()==="get"?"get":"post",C=typeof d=="string"&&hE.test(d),A=N=>{if(h&&h(N),N.defaultPrevented)return;N.preventDefault();let L=N.nativeEvent.submitter,_=(L==null?void 0:L.getAttribute("formmethod"))||f;R(L||N.currentTarget,{fetcherKey:r,method:_,navigate:a,replace:o,state:c,relative:p,preventScrollReset:g,viewTransition:b})};return y.createElement("form",{ref:E,method:w,action:S,onSubmit:i?h:A,...x,"data-discover":!C&&t==="render"?"true":void 0})});r_.displayName="Form";function a_(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pE(t){let r=y.useContext(Ni);return Ke(r,a_(t)),r}function s_(t,{target:r,replace:a,state:i,preventScrollReset:o,relative:c,viewTransition:f}={}){let d=Oi(),h=va(),p=so(t,{relative:c});return y.useCallback(g=>{if(UD(g,r)){g.preventDefault();let b=a!==void 0?a:Yl(h)===Yl(p);d(t,{replace:b,state:i,preventScrollReset:o,relative:c,viewTransition:f})}},[h,d,p,a,i,r,t,o,c,f])}var i_=0,l_=()=>`__${String(++i_)}__`;function o_(){let{router:t}=pE("useSubmit"),{basename:r}=y.useContext(In),a=ND();return y.useCallback(async(i,o={})=>{let{action:c,method:f,encType:d,formData:h,body:p}=qD(i,r);if(o.navigate===!1){let g=o.fetcherKey||l_();await t.fetch(g,a,o.action||c,{preventScrollReset:o.preventScrollReset,formData:h,body:p,formMethod:o.method||f,formEncType:o.encType||d,flushSync:o.flushSync})}else await t.navigate(o.action||c,{preventScrollReset:o.preventScrollReset,formData:h,body:p,formMethod:o.method||f,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:a,flushSync:o.flushSync,viewTransition:o.viewTransition})},[t,r,a])}function c_(t,{relative:r}={}){let{basename:a}=y.useContext(In),i=y.useContext(Vn);Ke(i,"useFormAction must be used inside a RouteContext");let[o]=i.matches.slice(-1),c={...so(t||".",{relative:r})},f=va();if(t==null){c.search=f.search;let d=new URLSearchParams(c.search),h=d.getAll("index");if(h.some(g=>g==="")){d.delete("index"),h.filter(b=>b).forEach(b=>d.append("index",b));let g=d.toString();c.search=g?`?${g}`:""}}return(!t||t===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:wr([a,c.pathname])),Yl(c)}function u_(t,r={}){let a=y.useContext(aE);Ke(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=pE("useViewTransitionState"),o=so(t,{relative:r.relative});if(!a.isTransitioning)return!1;let c=Tr(a.currentLocation.pathname,i)||a.currentLocation.pathname,f=Tr(a.nextLocation.pathname,i)||a.nextLocation.pathname;return Jc(o.pathname,f)!=null||Jc(o.pathname,c)!=null}new TextEncoder;const f_=pa("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Lm({className:t,variant:r,...a}){return v.jsx("div",{className:le(f_({variant:r}),t),...a})}var d_="Label",vE=y.forwardRef((t,r)=>v.jsx(Se.label,{...t,ref:r,onMouseDown:a=>{var o;a.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));vE.displayName=d_;var gE=vE;const h_=pa("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),eu=y.forwardRef(({className:t,...r},a)=>v.jsx(gE,{ref:a,className:le(h_(),t),...r}));eu.displayName=gE.displayName;const m_=({tag:t,onRemove:r})=>v.jsxs(Lm,{variant:"outline",className:"flex items-center gap-1.5 pr-1.5 text-sm py-1 px-2 transition-colors hover:bg-white hover:text-black dark:hover:text-black",children:[t,v.jsxs(Ie,{type:"button",variant:"ghost",size:"icon",onClick:()=>r(t),className:"hover:bg-muted/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[v.jsx(us,{className:"h-3 w-3"}),v.jsxs("span",{className:"sr-only",children:["Remove ",t]})]})]}),p_=({tags:t,onRemove:r})=>v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(a=>v.jsx(m_,{tag:a,onRemove:r},a))}),v_=({value:t,onChange:r,onKeyDown:a})=>v.jsx(gr,{value:t,onChange:r,onKeyDown:a,placeholder:"Type and press Enter to add...",className:le("bg-background",!t&&"text-muted-foreground")});function g_({title:t,data:r,onChange:a}){const[i,o]=y.useState(""),c=d=>{if(d.key==="Enter"){d.preventDefault();const h=i.trim();h&&!r.includes(h)&&(a([...r,h]),o(""))}},f=d=>{a(r.filter(h=>h!==d))};return v.jsxs("div",{className:"space-y-2",children:[v.jsx(eu,{children:t}),v.jsxs("div",{className:"p-2 bg-card rounded-md border",children:[v.jsx(p_,{tags:r,onRemove:f}),v.jsx(v_,{value:i,onChange:d=>o(d.target.value),onKeyDown:c})]})]})}const io=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("rounded-xl border bg-card text-card-foreground shadow",t),...r}));io.displayName="Card";const yE=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("flex flex-col space-y-1.5 p-6",t),...r}));yE.displayName="CardHeader";const bE=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("font-semibold leading-none tracking-tight",t),...r}));bE.displayName="CardTitle";const y_=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("text-sm text-muted-foreground",t),...r}));y_.displayName="CardDescription";const wu=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("p-6 pt-0",t),...r}));wu.displayName="CardContent";const xE=y.forwardRef(({className:t,...r},a)=>v.jsx("div",{ref:a,className:le("flex items-center p-6 pt-0",t),...r}));xE.displayName="CardFooter";function Ap(t){const r=t+"CollectionProvider",[a,i]=Hn(r),[o,c]=a(r,{collectionRef:{current:null},itemMap:new Map}),f=E=>{const{scope:R,children:S}=E,w=hr.useRef(null),C=hr.useRef(new Map).current;return v.jsx(o,{scope:R,itemMap:C,collectionRef:w,children:S})};f.displayName=r;const d=t+"CollectionSlot",h=hr.forwardRef((E,R)=>{const{scope:S,children:w}=E,C=c(d,S),A=ke(R,C.collectionRef);return v.jsx(sn,{ref:A,children:w})});h.displayName=d;const p=t+"CollectionItemSlot",g="data-radix-collection-item",b=hr.forwardRef((E,R)=>{const{scope:S,children:w,...C}=E,A=hr.useRef(null),N=ke(R,A),L=c(p,S);return hr.useEffect(()=>(L.itemMap.set(A,{ref:A,...C}),()=>void L.itemMap.delete(A))),v.jsx(sn,{[g]:"",ref:N,children:w})});b.displayName=p;function x(E){const R=c(t+"CollectionConsumer",E);return hr.useCallback(()=>{const w=R.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${g}]`));return Array.from(R.itemMap.values()).sort((L,_)=>C.indexOf(L.ref.current)-C.indexOf(_.ref.current))},[R.collectionRef,R.itemMap])}return[{Provider:f,Slot:h,ItemSlot:b},x,i]}var b_=y.createContext(void 0);function Su(t){const r=y.useContext(b_);return t||r||"ltr"}var dh="rovingFocusGroup.onEntryFocus",x_={bubbles:!1,cancelable:!0},Eu="RovingFocusGroup",[zm,wE,w_]=Ap(Eu),[S_,SE]=Hn(Eu,[w_]),[E_,R_]=S_(Eu),EE=y.forwardRef((t,r)=>v.jsx(zm.Provider,{scope:t.__scopeRovingFocusGroup,children:v.jsx(zm.Slot,{scope:t.__scopeRovingFocusGroup,children:v.jsx(T_,{...t,ref:r})})}));EE.displayName=Eu;var T_=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,orientation:i,loop:o=!1,dir:c,currentTabStopId:f,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:g=!1,...b}=t,x=y.useRef(null),E=ke(r,x),R=Su(c),[S=null,w]=rs({prop:f,defaultProp:d,onChange:h}),[C,A]=y.useState(!1),N=nt(p),L=wE(a),_=y.useRef(!1),[k,I]=y.useState(0);return y.useEffect(()=>{const Y=x.current;if(Y)return Y.addEventListener(dh,N),()=>Y.removeEventListener(dh,N)},[N]),v.jsx(E_,{scope:a,orientation:i,dir:R,loop:o,currentTabStopId:S,onItemFocus:y.useCallback(Y=>w(Y),[w]),onItemShiftTab:y.useCallback(()=>A(!0),[]),onFocusableItemAdd:y.useCallback(()=>I(Y=>Y+1),[]),onFocusableItemRemove:y.useCallback(()=>I(Y=>Y-1),[]),children:v.jsx(Se.div,{tabIndex:C||k===0?-1:0,"data-orientation":i,...b,ref:E,style:{outline:"none",...t.style},onMouseDown:ge(t.onMouseDown,()=>{_.current=!0}),onFocus:ge(t.onFocus,Y=>{const H=!_.current;if(Y.target===Y.currentTarget&&H&&!C){const K=new CustomEvent(dh,x_);if(Y.currentTarget.dispatchEvent(K),!K.defaultPrevented){const Z=L().filter(M=>M.focusable),ne=Z.find(M=>M.active),ce=Z.find(M=>M.id===S),U=[ne,ce,...Z].filter(Boolean).map(M=>M.ref.current);CE(U,g)}}_.current=!1}),onBlur:ge(t.onBlur,()=>A(!1))})})}),RE="RovingFocusGroupItem",TE=y.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:a,focusable:i=!0,active:o=!1,tabStopId:c,...f}=t,d=yr(),h=c||d,p=R_(RE,a),g=p.currentTabStopId===h,b=wE(a),{onFocusableItemAdd:x,onFocusableItemRemove:E}=p;return y.useEffect(()=>{if(i)return x(),()=>E()},[i,x,E]),v.jsx(zm.ItemSlot,{scope:a,id:h,focusable:i,active:o,children:v.jsx(Se.span,{tabIndex:g?0:-1,"data-orientation":p.orientation,...f,ref:r,onMouseDown:ge(t.onMouseDown,R=>{i?p.onItemFocus(h):R.preventDefault()}),onFocus:ge(t.onFocus,()=>p.onItemFocus(h)),onKeyDown:ge(t.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){p.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const S=N_(R,p.orientation,p.dir);if(S!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let C=b().filter(A=>A.focusable).map(A=>A.ref.current);if(S==="last")C.reverse();else if(S==="prev"||S==="next"){S==="prev"&&C.reverse();const A=C.indexOf(R.currentTarget);C=p.loop?O_(C,A+1):C.slice(A+1)}setTimeout(()=>CE(C))}})})})});TE.displayName=RE;var C_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function A_(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function N_(t,r,a){const i=A_(t.key,a);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return C_[i]}function CE(t,r=!1){const a=document.activeElement;for(const i of t)if(i===a||(i.focus({preventScroll:r}),document.activeElement!==a))return}function O_(t,r){return t.map((a,i)=>t[(r+i)%t.length])}var j_=EE,M_=TE,Np="Tabs",[D_,Lz]=Hn(Np,[SE]),AE=SE(),[__,Op]=D_(Np),NE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:i,onValueChange:o,defaultValue:c,orientation:f="horizontal",dir:d,activationMode:h="automatic",...p}=t,g=Su(d),[b,x]=rs({prop:i,onChange:o,defaultProp:c});return v.jsx(__,{scope:a,baseId:yr(),value:b,onValueChange:x,orientation:f,dir:g,activationMode:h,children:v.jsx(Se.div,{dir:g,"data-orientation":f,...p,ref:r})})});NE.displayName=Np;var OE="TabsList",jE=y.forwardRef((t,r)=>{const{__scopeTabs:a,loop:i=!0,...o}=t,c=Op(OE,a),f=AE(a);return v.jsx(j_,{asChild:!0,...f,orientation:c.orientation,dir:c.dir,loop:i,children:v.jsx(Se.div,{role:"tablist","aria-orientation":c.orientation,...o,ref:r})})});jE.displayName=OE;var ME="TabsTrigger",DE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:i,disabled:o=!1,...c}=t,f=Op(ME,a),d=AE(a),h=zE(f.baseId,i),p=PE(f.baseId,i),g=i===f.value;return v.jsx(M_,{asChild:!0,...d,focusable:!o,active:g,children:v.jsx(Se.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":p,"data-state":g?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:h,...c,ref:r,onMouseDown:ge(t.onMouseDown,b=>{!o&&b.button===0&&b.ctrlKey===!1?f.onValueChange(i):b.preventDefault()}),onKeyDown:ge(t.onKeyDown,b=>{[" ","Enter"].includes(b.key)&&f.onValueChange(i)}),onFocus:ge(t.onFocus,()=>{const b=f.activationMode!=="manual";!g&&!o&&b&&f.onValueChange(i)})})})});DE.displayName=ME;var _E="TabsContent",LE=y.forwardRef((t,r)=>{const{__scopeTabs:a,value:i,forceMount:o,children:c,...f}=t,d=Op(_E,a),h=zE(d.baseId,i),p=PE(d.baseId,i),g=i===d.value,b=y.useRef(g);return y.useEffect(()=>{const x=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(x)},[]),v.jsx(ln,{present:o||g,children:({present:x})=>v.jsx(Se.div,{"data-state":g?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!x,id:p,tabIndex:0,...f,ref:r,style:{...t.style,animationDuration:b.current?"0s":void 0},children:x&&c})})});LE.displayName=_E;function zE(t,r){return`${t}-trigger-${r}`}function PE(t,r){return`${t}-content-${r}`}var L_=NE,kE=jE,UE=DE,$E=LE;const z_=L_,HE=y.forwardRef(({className:t,...r},a)=>v.jsx(kE,{ref:a,className:le("inline-flex h-9 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));HE.displayName=kE.displayName;const Pm=y.forwardRef(({className:t,...r},a)=>v.jsx(UE,{ref:a,className:le("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...r}));Pm.displayName=UE.displayName;const km=y.forwardRef(({className:t,...r},a)=>v.jsx($E,{ref:a,className:le("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));km.displayName=$E.displayName;const jp=y.forwardRef(({className:t,...r},a)=>v.jsx("textarea",{className:le("flex min-h-[60px] select-none w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:a,...r}));jp.displayName="Textarea";const P_=1,k_=1e6;let hh=0;function U_(){return hh=(hh+1)%Number.MAX_SAFE_INTEGER,hh.toString()}const mh=new Map,j0=t=>{if(mh.has(t))return;const r=setTimeout(()=>{mh.delete(t),ql({type:"REMOVE_TOAST",toastId:t})},k_);mh.set(t,r)},$_=(t,r)=>{switch(r.type){case"ADD_TOAST":return{...t,toasts:[r.toast,...t.toasts].slice(0,P_)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===r.toast.id?{...a,...r.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=r;if(a)j0(a);else for(const i of t.toasts)j0(i.id);return{...t,toasts:t.toasts.map(i=>i.id===a||a===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return r.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==r.toastId)}}},Bc=[];let Ic={toasts:[]};function ql(t){Ic=$_(Ic,t);for(const r of Bc)r(Ic)}function H_({...t}){const r=U_(),a=o=>ql({type:"UPDATE_TOAST",toast:{...o,id:r}}),i=()=>ql({type:"DISMISS_TOAST",toastId:r});return ql({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:o=>{o||i()}}}),{id:r,dismiss:i,update:a}}function Yn(){const[t,r]=y.useState(Ic);return y.useEffect(()=>(Bc.push(r),()=>{const a=Bc.indexOf(r);a>-1&&Bc.splice(a,1)}),[]),{...t,toast:H_,dismiss:a=>ql({type:"DISMISS_TOAST",toastId:a})}}const M0=[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The display name of your character",fieldType:"text",getValue:t=>t.name||""},{title:"Username",name:"username",description:"Unique identifier for your character",fieldType:"text",getValue:t=>t.username||""},{title:"System",name:"system",description:"System prompt for character behavior",fieldType:"textarea",getValue:t=>t.system||""},{title:"Voice Model",name:"settings.voice.model",description:"Voice model used for speech synthesis",fieldType:"text",getValue:t=>{var r,a;return((a=(r=t.settings)==null?void 0:r.voice)==null?void 0:a.model)||""}}]},{sectionTitle:"Content",sectionValue:"content",sectionType:"array",fields:[{title:"Bio",description:"Key information about your character",path:"bio",getData:t=>Array.isArray(t.bio)?t.bio:[]},{title:"Topics",description:"Topics your character is knowledgeable about",path:"topics",getData:t=>t.topics||[]},{title:"Adjectives",description:"Words that describe your character's personality",path:"adjectives",getData:t=>t.adjectives||[]}]},{sectionTitle:"Style",sectionValue:"style",sectionType:"array",fields:[{title:"All",description:"Style rules applied to all interactions",path:"style.all",getData:t=>{var r;return((r=t.style)==null?void 0:r.all)||[]}},{title:"Chat",description:"Style rules for chat interactions",path:"style.chat",getData:t=>{var r;return((r=t.style)==null?void 0:r.chat)||[]}},{title:"Post",description:"Style rules for social media posts",path:"style.post",getData:t=>{var r;return((r=t.style)==null?void 0:r.post)||[]}}]}];function qE({characterValue:t,setCharacterValue:r,title:a,description:i,onSubmit:o,onDelete:c,onReset:f,customComponents:d=[]}){const{toast:h}=Yn(),[p,g]=y.useState(!1),b=w=>{const{name:C,value:A,type:N}=w.target,L=w.target.checked;if(C.includes(".")){const _=C.split(".");r(k=>{const I={...k};let Y=I;for(let H=0;H<_.length-1;H++)Y[_[H]]||(Y[_[H]]={}),Y=Y[_[H]];return Y[_[_.length-1]]=N==="checkbox"?L:A,I})}else r(_=>({..._,[C]:N==="checkbox"?L:A}))},x=(w,C)=>{r(A=>{const N={...A},L=w.split(".");let _=N;for(let k=0;k<L.length-1;k++){const I=L[k];(!_[I]||typeof _[I]!="object")&&(_[I]={}),_=_[I]}return _[L[L.length-1]]=C,N})},E=async w=>{w.preventDefault(),g(!0);try{await o(t)}catch(C){h({title:"Error",description:C instanceof Error?C.message:"Failed to update",variant:"destructive"})}finally{g(!1)}},R=w=>v.jsxs("div",{className:"space-y-2",children:[v.jsx(eu,{htmlFor:w.name,children:w.title}),w.description&&v.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),w.fieldType==="textarea"?v.jsx(jp,{id:w.name,name:w.name,value:w.getValue(t),onChange:b,className:"min-h-[120px] resize-y"}):w.fieldType==="checkbox"?v.jsx(gr,{id:w.name,name:w.name,type:"checkbox",checked:t[w.name]==="true",onChange:b}):v.jsx(gr,{id:w.name,name:w.name,type:w.fieldType,value:w.getValue(t),onChange:b})]},w.name),S=w=>v.jsxs("div",{className:"space-y-2",children:[v.jsx(eu,{htmlFor:w.path,children:w.title}),w.description&&v.jsx("p",{className:"text-sm text-muted-foreground",children:w.description}),v.jsx(g_,{data:w.getData(t),onChange:C=>x(w.path,C)})]},w.path);return v.jsxs("div",{className:"container max-w-4xl mx-auto p-6",children:[v.jsx("div",{className:"flex items-center justify-between mb-6",children:v.jsxs("div",{children:[v.jsx("h1",{className:"text-3xl font-bold",children:a}),v.jsx("p",{className:"text-muted-foreground mt-1",children:i})]})}),v.jsxs("form",{onSubmit:E,children:[v.jsxs(z_,{defaultValue:"basic",className:"w-full",children:[v.jsxs(HE,{className:"grid w-full mb-6",style:{gridTemplateColumns:`repeat(${d.length+3}, minmax(0, 1fr))`},children:[M0.map(w=>v.jsx(Pm,{value:w.sectionValue,children:w.sectionTitle},w.sectionValue)),d.map(w=>v.jsx(Pm,{value:`custom-${w.name}`,children:w.name},`custom-${w.name}`))]}),v.jsx(io,{children:v.jsxs(wu,{className:"p-6",children:[M0.map(w=>v.jsx(km,{value:w.sectionValue,className:"space-y-6",children:w.sectionType==="input"?w.fields.map(R):w.fields.map(S)},w.sectionValue)),d.map(w=>v.jsx(km,{value:`custom-${w.name}`,children:w.component},`custom-${w.name}`))]})})]}),v.jsxs("div",{className:"flex justify-between gap-4 mt-6",children:[v.jsx("div",{className:"flex gap-4 text-red-500",children:v.jsx(Ie,{type:"button",variant:"outline",onClick:()=>{c==null||c()},children:"Delete Character"})}),v.jsxs("div",{className:"flex gap-4",children:[v.jsx(Ie,{type:"button",variant:"outline",onClick:()=>{f==null||f()},children:"Reset Changes"}),v.jsx(Ie,{type:"submit",disabled:p,children:p?"Saving...":"Save Changes"})]})]})]})]})}const ph="elizaos-world-id",ts={getWorldId:()=>{const t=localStorage.getItem(ph);if(t)return t;const r=crypto.randomUUID();return localStorage.setItem(ph,r),r},resetWorldId:()=>{const t=crypto.randomUUID();return localStorage.setItem(ph,t),t},getRoomStorageKey:t=>`room-${ts.getWorldId()}-${t}`},q_="http://localhost:3000",ct=async({url:t,method:r,body:a,headers:i})=>{const o={method:r??"GET",headers:i||{Accept:"application/json","Content-Type":"application/json"}};return(r==="POST"||r==="PUT"||r==="PATCH")&&(a instanceof FormData?(o.headers&&typeof o.headers=="object"&&(o.headers=Object.fromEntries(Object.entries(o.headers).filter(([c])=>c!=="Content-Type"))),o.body=a):o.body=JSON.stringify(a)),fetch(`${q_}${t}`,o).then(async c=>{if(c.headers.get("Content-Type")==="audio/mpeg")return await c.blob();if(!c.ok){const d=await c.text();console.error("Error: ",d);let h="An error occurred.";try{h=JSON.parse(d).message||h}catch{h=d||h}throw new Error(h)}try{return await c.json()}catch(d){return console.error("JSON Parse Error:",d),null}})},Et={getAgents:()=>ct({url:"/agents"}),getAgent:t=>ct({url:`/agents/${t}`}),tts:(t,r)=>ct({url:`/agents/${t}/speech/generate`,method:"POST",body:{text:r},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),whisper:async(t,r)=>{const a=new FormData;return a.append("file",r,"recording.wav"),ct({url:`/agents/${t}/transcriptions`,method:"POST",body:a})},sendAudioMessage:async(t,r,a)=>{const i=new FormData;if(i.append("file",r,"recording.wav"),a)for(const[o,c]of Object.entries(a))c&&i.append(o,c);return ct({url:`/agents/${t}/audio-messages`,method:"POST",body:i})},speechConversation:async(t,r,a)=>ct({url:`/agents/${t}/speech/conversation`,method:"POST",body:{text:r,...a},headers:{"Content-Type":"application/json",Accept:"audio/mpeg","Transfer-Encoding":"chunked"}}),deleteAgent:t=>ct({url:`/agents/${t}`,method:"DELETE"}),updateAgent:(t,r)=>ct({url:`/agents/${t}`,method:"PATCH",body:r}),createAgent:t=>ct({url:"/agents/",method:"POST",body:t}),startAgent:t=>ct({url:`/agents/${t}`,method:"POST",body:{start:!0}}),stopAgent:t=>ct({url:`/agents/${t}`,method:"PUT"}),getMemories:(t,r,a)=>{const o={worldId:ts.getWorldId()};return a!=null&&a.limit&&(o.limit=a.limit),a!=null&&a.before&&(o.end=a.before),ct({url:`/agents/${t}/rooms/${r}/memories`,method:"GET",body:o})},getRooms:t=>{const r=ts.getWorldId();return ct({url:`/agents/${t}/rooms`,method:"GET",body:{worldId:r}})},createRoom:(t,r)=>{const a=ts.getWorldId();return ct({url:`/agents/${t}/rooms`,method:"POST",body:{name:r,worldId:a}})},getRoom:(t,r)=>ct({url:`/agents/${t}/rooms/${r}`,method:"GET"}),updateRoom:(t,r,a)=>ct({url:`/agents/${t}/rooms/${r}`,method:"PATCH",body:a}),deleteRoom:(t,r)=>ct({url:`/agents/${t}/rooms/${r}`,method:"DELETE"}),getLogs:t=>ct({url:`/logs?level=${t}`,method:"GET"}),getAgentCompletion:(t,r,a,i,o)=>ct({url:`/agents/${t}/message`,method:"POST",body:{text:a,roomId:i,senderId:r,source:o}})};function BE({characterValue:t,setCharacterValue:r}){var f;const[a,i]=y.useState(((f=t==null?void 0:t.settings)==null?void 0:f.avatar)||null),o=y.useRef(null),c=d=>{var p;const h=(p=d.target.files)==null?void 0:p[0];if(h){const g=new FileReader;g.onload=b=>{var x;if((x=b.target)!=null&&x.result){const E=new Image;E.src=b.target.result,E.onload=()=>{const R=document.createElement("canvas"),S=300;let w=E.width,C=E.height;w>C?w>S&&(C*=S/w,w=S):C>S&&(w*=S/C,C=S),R.width=w,R.height=C;const A=R.getContext("2d");A==null||A.drawImage(E,0,0,w,C);const N=R.toDataURL("image/jpeg",.8);i(N)}}},g.readAsDataURL(h)}};return y.useEffect(()=>{r(d=>({...d,settings:{...d.settings,avatar:a}}))},[a,r]),v.jsxs("div",{className:"rounded-lg w-full",children:[v.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Avatar Settings"}),v.jsxs("div",{className:"flex flex-col items-center gap-4 pb-4",children:[a?v.jsxs("div",{className:"relative w-64 h-64",children:[v.jsx("img",{src:a,alt:"Character Avatar",className:"object-cover rounded-lg border"}),v.jsx("button",{className:"absolute -top-2 -right-2 bg-white p-1 rounded-full shadow-md",onClick:()=>i(null),type:"button",children:v.jsx(us,{className:"w-5 h-5 text-card"})})]}):v.jsx("div",{className:"w-64 h-64 flex items-center justify-center border border-dashed rounded-lg text-gray-500",children:v.jsx(a2,{className:"w-10 h-10"})}),v.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:o,onChange:c}),v.jsxs(Ie,{className:"flex items-center gap-2",onClick:()=>{var d;return(d=o.current)==null?void 0:d.click()},children:[v.jsx(p2,{className:"w-5 h-5"})," Upload Avatar"]})]})]})}const B_=Hw,I_=YO,V_=qw,IE=y.forwardRef(({className:t,...r},a)=>v.jsx(iu,{ref:a,className:le("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));IE.displayName=iu.displayName;const VE=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(V_,{children:[v.jsx(IE,{}),v.jsxs(lu,{ref:i,className:le("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[r,v.jsxs(Bw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[v.jsx(us,{className:"h-4 w-4"}),v.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));VE.displayName=lu.displayName;const YE=({className:t,...r})=>v.jsx("div",{className:le("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});YE.displayName="DialogHeader";const GE=y.forwardRef(({className:t,...r},a)=>v.jsx(ou,{ref:a,className:le("text-lg font-semibold leading-none tracking-tight",t),...r}));GE.displayName=ou.displayName;const Y_=y.forwardRef(({className:t,...r},a)=>v.jsx(cu,{ref:a,className:le("text-sm text-muted-foreground",t),...r}));Y_.displayName=cu.displayName;function G_(){return fs({queryKey:["plugins"],queryFn:async()=>(await fetch("https://raw.githubusercontent.com/elizaos/registry/refs/heads/main/index.json")).json()})}function FE({characterValue:t,setCharacterValue:r}){const{data:a,error:i}=G_(),[o,c]=y.useState(""),[f,d]=y.useState(!1),h=y.useMemo(()=>a?Object.keys(a).map(x=>x.replace(/^@elizaos-plugins\//,"@elizaos/")):[],[a]),p=y.useMemo(()=>Array.isArray(t==null?void 0:t.plugins)?t.plugins:[],[t==null?void 0:t.plugins]),g=y.useMemo(()=>h.filter(x=>!p.includes(x)).filter(x=>x.toLowerCase().includes(o.toLowerCase())),[h,p,o]),b=x=>{r(E=>{const R=Array.isArray(E.plugins)?E.plugins:[],S=R.includes(x)?R.filter(w=>w!==x):[...R,x];return{...E,plugins:S}})};return v.jsx("div",{className:"space-y-6",children:v.jsx("div",{className:"space-y-4",children:v.jsxs("div",{children:[v.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),i?v.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",i.message]}):v.jsxs("div",{className:"space-y-4",children:[p.length>0&&v.jsxs("div",{className:"rounded-md bg-muted p-4",children:[v.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(x=>v.jsxs(Ie,{type:"button",variant:"ghost",size:"sm",className:"inline-flex items-center rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20 h-auto",onClick:()=>b(x),children:[x," ×"]},x))})]}),v.jsx("div",{className:"space-y-2",children:v.jsxs(B_,{open:f,onOpenChange:d,children:[v.jsx(I_,{asChild:!0,children:v.jsx(Ie,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),v.jsxs(VE,{className:"max-w-[400px]",children:[v.jsx(YE,{children:v.jsx(GE,{children:"Add Plugins"})}),v.jsxs("div",{className:"space-y-4 py-4",children:[v.jsx("div",{className:"space-y-2",children:v.jsx(gr,{type:"search",placeholder:"Search plugins...",value:o,onChange:x=>c(x.target.value)})}),v.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:g.length===0?v.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):g.map(x=>v.jsx(Ie,{variant:"ghost",className:"w-full justify-start font-normal",onClick:()=>{b(x),c(""),d(!1)},children:x},x))})]})]})]})})]})]})})})}function QE({characterValue:t,setCharacterValue:r}){var _;const[a,i]=y.useState(Object.entries(((_=t==null?void 0:t.settings)==null?void 0:_.secrets)||{}).map(([k,I])=>({name:k,value:String(I)}))),[o,c]=y.useState(""),[f,d]=y.useState(""),[h,p]=y.useState(!1),[g,b]=y.useState(null),[x,E]=y.useState(null),[R,S]=y.useState(""),w=y.useRef(null),C=()=>{o&&f&&(i([...a,{name:o,value:f}]),c(""),d(""))},A=k=>{E(k),S(a[k].value),b(null)},N=k=>{const I=[...a];I[k].value=R,i(I),E(null)},L=k=>{i(a.filter((I,Y)=>Y!==k)),b(null),E(null)};return y.useEffect(()=>{const k=I=>{w.current&&!w.current.contains(I.target)&&b(null)};return document.addEventListener("mousedown",k),()=>{document.removeEventListener("mousedown",k)}},[]),y.useEffect(()=>{r(k=>({...k,settings:{...k.settings,secrets:Object.fromEntries(a.map(({name:I,value:Y})=>[I,Y]))}}))},[a,r]),v.jsxs("div",{className:"rounded-lg w-full",children:[v.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Environment Settings"}),v.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-end w-full pb-4",children:[v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsx("label",{htmlFor:"secret-name",className:"ml-2 text-xs font-medium text-gray-400",children:"NAME"}),v.jsx(gr,{id:"secret-name",placeholder:"VARIABLE_NAME",value:o,onChange:k=>c(k.target.value)})]}),v.jsxs("div",{className:"flex flex-col gap-1 relative",children:[v.jsx("label",{htmlFor:"secret-value",className:"ml-2 text-xs font-medium text-gray-400",children:"VALUE"}),v.jsxs("div",{className:"relative",children:[v.jsx(gr,{id:"secret-value",type:h?"text":"password",placeholder:"i9ju23nfsdf56",value:f,onChange:k=>d(k.target.value),className:"pr-10"}),v.jsx("div",{className:"absolute inset-y-0 right-3 flex items-center cursor-pointer text-gray-500",onClick:()=>p(!h),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&p(!h)},children:h?v.jsx(n2,{}):v.jsx(r2,{})})]})]}),v.jsx(Ie,{className:"shrink-0",onClick:C,children:"Add"})]}),a.length>0&&v.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 mt-6 font-medium text-gray-400 border-b pb-2 ml-1",children:[v.jsx("div",{children:"Name"}),v.jsx("div",{children:"Value"}),v.jsx("div",{children:"Action"})]}),v.jsx("div",{className:"mt-2",children:a.map((k,I)=>v.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-center border-b py-2 ml-1 relative",children:[v.jsx("div",{children:k.name}),v.jsx("div",{children:x===I?v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(gr,{value:R,onChange:Y=>S(Y.target.value),className:"w-full"}),v.jsx(Ie,{variant:"ghost",onClick:()=>N(I),children:v.jsx(ap,{className:"w-5 h-5 text-green-500"})}),v.jsx(Ie,{variant:"ghost",onClick:()=>E(null),children:v.jsx(us,{className:"w-5 h-5 text-red-500"})})]}):v.jsx("div",{className:"truncate text-gray-500",children:"Encrypted"})}),v.jsxs("div",{className:"relative",children:[v.jsx(Ie,{variant:"ghost",className:"p-2 text-gray-500",onClick:()=>b(g===I?null:I),children:v.jsx(t2,{className:"w-5 h-5"})}),g===I&&v.jsxs("div",{className:"absolute right-0 -top-2 mt-2 w-24 bg-muted border rounded shadow-md z-10",ref:w,children:[v.jsx("button",{className:"w-full px-4 py-2 text-left hover:opacity-50",onClick:()=>A(I),type:"button",children:"Edit"}),v.jsx("div",{className:"w-full px-4 py-2 text-left text-red-500 hover:opacity-50 cursor-pointer",onClick:()=>L(I),children:"Remove"})]})]})]},I))})]})}const D0={name:"",username:"",system:"",bio:[],topics:[],adjectives:[]};function XE(){const t=Oi(),{toast:r}=Yn(),a=Bn(),[i,o]=y.useState({...D0}),c=d=>{var h,p,g;return{...d,bio:d.bio??[],messageExamples:d.messageExamples??[],postExamples:d.postExamples??[],topics:d.topics??[],adjectives:d.adjectives??[],plugins:d.plugins??[],style:{all:((h=d.style)==null?void 0:h.all)??[],chat:((p=d.style)==null?void 0:p.chat)??[],post:((g=d.style)==null?void 0:g.post)??[]}}},f=async d=>{try{const h=c(d);await Et.createAgent({characterJson:h}),a.invalidateQueries({queryKey:["characters"]}),r({title:"Success",description:"Character created successfully!"}),a.invalidateQueries({queryKey:["agents"]}),t("/")}catch(h){r({title:"Error",description:h instanceof Error?h.message:"Failed to create character",variant:"destructive"})}};return v.jsx(qE,{characterValue:i,setCharacterValue:o,title:"Character Settings",description:"Configure your AI character's behavior and capabilities",onSubmit:f,onReset:()=>o(D0),onDelete:()=>{t("/")},isAgent:!0,customComponents:[{name:"Plugins",component:v.jsx(FE,{characterValue:i,setCharacterValue:o})},{name:"Secret",component:v.jsx(QE,{characterValue:i,setCharacterValue:o})},{name:"Avatar",component:v.jsx(BE,{characterValue:i,setCharacterValue:o})}]})}const ns="user",gn={FREQUENT:30*1e3,STANDARD:2*60*1e3,RARE:10*60*1e3,NEVER:Number.POSITIVE_INFINITY},WE=()=>{const t=typeof navigator<"u"&&"connection"in navigator?navigator.connection:null;return{isOffline:typeof navigator<"u"&&!navigator.onLine,effectiveType:(t==null?void 0:t.effectiveType)||"unknown",saveData:(t==null?void 0:t.saveData)||!1}};function KE(t={}){const r=WE();return fs({queryKey:["agents"],queryFn:()=>Et.getAgents(),staleTime:gn.FREQUENT,refetchInterval:r.isOffline?!1:gn.FREQUENT,refetchIntervalInBackground:!1,...!r.isOffline&&r.effectiveType==="slow-2g"&&{refetchInterval:gn.STANDARD},...t})}function F_(t,r={}){const a=WE();return fs({queryKey:["agent",t],queryFn:()=>Et.getAgent(t||""),staleTime:gn.FREQUENT,enabled:!!t,refetchInterval:!a.isOffline&&t?gn.FREQUENT:!1,refetchIntervalInBackground:!1,...!a.isOffline&&a.effectiveType==="slow-2g"&&{refetchInterval:gn.STANDARD},...r})}function Q_(){const t=Bn(),{toast:r}=Yn();return yu({mutationFn:async a=>{try{return await Et.startAgent(a)}catch(i){if(i instanceof Error){if(i.message.includes("network"))throw new Error("Network error: Please check your connection and try again.");if(i.message.includes("already running"))throw new Error("Agent is already running.")}throw i}},onMutate:async a=>(r({title:"Starting Agent",description:"Initializing agent..."}),{agentId:a}),onSuccess:a=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["active-agents"]}),a!=null&&a.id&&t.invalidateQueries({queryKey:["agent",a.id]}),r({title:"Agent Started",description:`${(a==null?void 0:a.name)||"Agent"} is now running`})},onError:a=>{const i=a instanceof Error?a.message:"Failed to start agent";r({title:"Error Starting Agent",description:`${i}. Please try again.`,variant:"destructive"})}})}function X_(){const t=Bn(),{toast:r}=Yn();return yu({mutationFn:a=>Et.stopAgent(a),onMutate:async a=>{const i=t.getQueryData(["agent",a]);i&&r({title:"Stopping Agent",description:`Stopping ${i.name}...`})},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),r({title:"Agent Stopped",description:"The agent has been successfully stopped"})},onError:(a,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),r({title:"Error",description:a instanceof Error?a.message:"Failed to stop agent",variant:"destructive"})}})}function W_(t,r){const a=Bn(),i=ts.getWorldId(),[o,c]=y.useState(null),[f,d]=y.useState(!0),[h,p]=y.useState(!1);return{...fs({queryKey:["messages",t,r,i],queryFn:async()=>(await Et.getMemories(t,r)).data.memories.map(E=>({text:E.content.text,user:E.entityId===t?"agent":ns,name:E.entityId===t?"agent":ns,createdAt:E.createdAt,attachments:E.content.attachments,source:E.content.source,worldId:E.worldId||i,id:E.id})).sort((E,R)=>E.createdAt-R.createdAt),enabled:!!(t&&r),staleTime:gn.FREQUENT}),loadOlderMessages:async()=>{if(!o||!f||h)return!1;try{p(!0);const x=await Et.getMemories(t,r,{before:o,limit:20});if(x!=null&&x.memories&&x.memories.length>0){const E=x.memories.map(A=>A.createdAt),R=Math.min(...E);c(R);const S=a.getQueryData(["messages",t,r,i])||[],w=new Map;S.forEach(A=>{w.set(A.id,A)}),x.memories.forEach(A=>{w.set(A.id,A)});const C=Array.from(w.values());return C.sort((A,N)=>A.createdAt-N.createdAt),a.setQueryData(["messages",t,r,i],C),d(x.memories.length>=20),!0}return d(!1),!1}catch(x){return console.error("Error loading older messages:",x),!1}finally{p(!1)}},hasOlderMessages:f,isLoadingMore:h}}const K_="1.0.0-alpha.49",si={version:K_};var Vc=(t=>(t[t.ROOM_JOINING=1]="ROOM_JOINING",t[t.SEND_MESSAGE=2]="SEND_MESSAGE",t))(Vc||{}),ta=(t=>(t.ACTIVE="active",t.INACTIVE="inactive",t))(ta||{});function Z_(){const[t,r]=y.useState(null),[a,i]=y.useState(!0),[o,c]=y.useState(typeof navigator<"u"?navigator.onLine:!0),[f,d]=y.useState(!1),h=Bn(),[p,g]=y.useState(Date.now()),b=y.useRef(0),x=y.useRef(Date.now());y.useEffect(()=>{const k=()=>{i(document.visibilityState==="visible"),document.visibilityState==="visible"&&(b.current=0,Date.now()-p>1e4&&h.invalidateQueries({queryKey:["status"]}))},I=()=>{c(navigator.onLine),navigator.onLine&&(b.current=0,h.invalidateQueries({queryKey:["status"]}))};return document.addEventListener("visibilitychange",k),window.addEventListener("online",I),window.addEventListener("offline",I),i(document.visibilityState==="visible"),()=>{document.removeEventListener("visibilitychange",k),window.removeEventListener("online",I),window.removeEventListener("offline",I)}},[h,p]);const R=fs({queryKey:["status"],queryFn:async()=>{try{const k=performance.now(),I=await Et.getAgents(),Y=performance.now();return b.current=0,x.current=Date.now(),r(Y-k),g(Date.now()),I}catch(k){throw b.current+=1,console.error("Connection check failed:",k),k}},refetchInterval:o?b.current>0?Math.min(5e3*2**(b.current-1),6e4):a?3e3:15e3:!1,retry:3,retryDelay:k=>Math.min(1e3*1.5**k,1e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0,staleTime:500,gcTime:gn.STANDARD}),S=(R==null?void 0:R.isSuccess)&&!(R!=null&&R.isError),w=(R==null?void 0:R.isRefetching)||(R==null?void 0:R.isPending),C=S===!1&&b.current>5&&Date.now()-x.current>6e4,A=()=>o?C?"bg-yellow-600":w?"bg-muted-foreground":S?"bg-green-600":"bg-red-600":"bg-orange-600",N=()=>o?C?"Reconnecting...":w?"Connecting...":S?"Connected":"Disconnected":"Offline",L=()=>o?C?"text-yellow-600":w?"text-muted-foreground":S?"text-green-600":"text-red-600":"text-orange-600",_=()=>{b.current=0,h.invalidateQueries({queryKey:["agents"]}),h.invalidateQueries({queryKey:["status"]})};return v.jsx(mr,{children:v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx(Va,{onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:_,children:v.jsx("div",{className:"flex flex-col gap-1 select-none transition-all duration-200",children:v.jsxs("div",{className:"flex items-center gap-1",children:[f?v.jsx(f2,{className:"h-3.5 w-3.5 text-muted-foreground animate-pulse"}):v.jsx("div",{className:le(["h-2.5 w-2.5 rounded-full",A()])}),v.jsx("span",{className:le(["text-xs",f?"text-muted-foreground":L()]),children:f?"Refresh":N()})]})})})}),S&&!f?v.jsx(kn,{side:"top",children:v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(XO,{className:"size-4"}),v.jsxs("span",{children:[t==null?void 0:t.toFixed(2)," ms"]})]})}):null]})})}function J_(){const t=va(),{data:{data:r}={},isPending:a}=KE();return v.jsxs(jS,{className:"bg-background",children:[v.jsx(DS,{className:"pb-4",children:v.jsx(Uc,{children:v.jsx(mr,{children:v.jsx(Va,{size:"lg",asChild:!0,children:v.jsxs(Ya,{to:"/",className:"px-6 py-4",children:[v.jsx("img",{alt:"elizaos-icon",src:"/elizaos-icon.png",width:"100%",height:"100%",className:"size-9"}),v.jsxs("div",{className:"flex flex-col leading-none ",children:[v.jsx("span",{className:"font-semibold text-lg",children:"ElizaOS"}),v.jsxs("span",{className:"text-sm -mt-0.5 text-muted-foreground",children:["v",si==null?void 0:si.version]})]})]})})})})}),v.jsx(LS,{children:v.jsxs(zS,{children:[v.jsx(PS,{className:"px-6 py-2 text-sm font-medium text-muted-foreground",children:v.jsx(Ya,{to:"/",children:"AGENTS"})}),v.jsx(kS,{className:"px-2",children:v.jsx(Uc,{children:a?v.jsx("div",{children:Array.from({length:5}).map((i,o)=>v.jsx(mr,{children:v.jsx(US,{})},`skeleton-item-${o}`))}):v.jsx("div",{children:(()=>{const i=[...(r==null?void 0:r.agents)||[]].sort((f,d)=>f.status===ta.ACTIVE&&d.status!==ta.ACTIVE?-1:f.status!==ta.ACTIVE&&d.status===ta.ACTIVE?1:f.name.localeCompare(d.name)),o=i.filter(f=>f.status===ta.ACTIVE),c=i.filter(f=>f.status===ta.INACTIVE);return v.jsxs(v.Fragment,{children:[o.length>0&&v.jsx("div",{className:"px-4 py-1 mt-4",children:v.jsxs("div",{className:"flex items-center space-x-2",children:[v.jsx("div",{className:"size-2.5 rounded-full bg-green-500"}),v.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Online"})]})}),o.map(f=>{var d,h;return v.jsx(mr,{children:v.jsx(Ya,{to:`/chat/${f.id}`,children:v.jsx(Va,{isActive:t.pathname.includes(f.id),className:"transition-colors px-4 my-4 rounded-md",children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-8 h-8 flex justify-center items-center",children:v.jsx("div",{className:"relative bg-muted rounded-full w-full h-full",children:f&&v.jsxs("div",{className:"text-sm rounded-full h-full w-full flex justify-center items-center overflow-hidden",children:[(d=f.settings)!=null&&d.avatar?v.jsx("img",{src:(h=f.settings)==null?void 0:h.avatar,alt:"Agent Avatar",className:"w-full h-full object-contain"}):Yc(f.name),v.jsx("div",{className:"absolute bottom-0 right-0 w-2 h-2 rounded-full border-[1px] border-white bg-green-500"})]})})}),v.jsx("span",{className:"text-base",children:f.name})]})})})},f.id)}),c.length>0&&v.jsx("div",{className:"px-4 py-1 mt-12",children:v.jsxs("div",{className:"flex items-center space-x-2",children:[v.jsx("div",{className:"size-2.5 rounded-full bg-muted-foreground/50"}),v.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Offline"})]})}),c.map(f=>{var d;return v.jsx(mr,{children:v.jsx("div",{className:"transition-colors px-4 my-4 rounded-md",children:v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-8 h-8 flex justify-center items-center",children:v.jsx("div",{className:"relative bg-muted rounded-full w-full h-full",children:f&&v.jsxs("div",{className:"text-sm rounded-full h-full w-full flex justify-center items-center overflow-hidden",children:[(d=f.settings)!=null&&d.avatar?v.jsx("img",{src:f.settings.avatar,alt:"Agent Avatar",className:"w-full h-full object-contain"}):Yc(f.name),v.jsx("div",{className:"absolute bottom-0 right-0 w-2 h-2 rounded-full border-[1px] border-white bg-muted-foreground"})]})})}),v.jsx("span",{className:"text-base truncate max-w-24",children:f.name})]})})},f.id)})]})})()})})})]})}),v.jsx(_S,{className:"px-4 py-4",children:v.jsxs(Uc,{children:[v.jsx(mr,{children:v.jsx(Ya,{to:"https://elizaos.github.io/eliza/docs/intro/",target:"_blank",children:v.jsxs(Va,{className:"text-muted-foreground rounded-md",children:[v.jsx(KO,{className:"size-5"}),v.jsx("span",{children:"Documentation"})]})})}),v.jsx(mr,{children:v.jsx(Ya,{to:"/logs",children:v.jsxs(Va,{className:"text-muted-foreground rounded-md",children:[v.jsx(d2,{className:"size-5"}),v.jsx("span",{children:"Logs"})]})})}),v.jsx(mr,{children:v.jsxs(Va,{disabled:!0,className:"text-muted-foreground/50 rounded-md",children:[v.jsx(sp,{className:"size-5"}),v.jsx("span",{children:"Settings"})]})}),v.jsx(Z_,{})]})})]})}const ZE=6048e5,eL=864e5,_0=Symbol.for("constructDateFrom");function ma(t,r){return typeof t=="function"?t(r):t&&typeof t=="object"&&_0 in t?t[_0](r):t instanceof Date?new t.constructor(r):new Date(r)}function wn(t,r){return ma(r||t,t)}let tL={};function Ru(){return tL}function Gl(t,r){var d,h,p,g;const a=Ru(),i=(r==null?void 0:r.weekStartsOn)??((h=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:h.weekStartsOn)??a.weekStartsOn??((g=(p=a.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??0,o=wn(t,r==null?void 0:r.in),c=o.getDay(),f=(c<i?7:0)+c-i;return o.setDate(o.getDate()-f),o.setHours(0,0,0,0),o}function tu(t,r){return Gl(t,{...r,weekStartsOn:1})}function JE(t,r){const a=wn(t,r==null?void 0:r.in),i=a.getFullYear(),o=ma(a,0);o.setFullYear(i+1,0,4),o.setHours(0,0,0,0);const c=tu(o),f=ma(a,0);f.setFullYear(i,0,4),f.setHours(0,0,0,0);const d=tu(f);return a.getTime()>=c.getTime()?i+1:a.getTime()>=d.getTime()?i:i-1}function L0(t){const r=wn(t),a=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return a.setUTCFullYear(r.getFullYear()),+t-+a}function nL(t,...r){const a=ma.bind(null,r.find(i=>typeof i=="object"));return r.map(a)}function z0(t,r){const a=wn(t,r==null?void 0:r.in);return a.setHours(0,0,0,0),a}function rL(t,r,a){const[i,o]=nL(a==null?void 0:a.in,t,r),c=z0(i),f=z0(o),d=+c-L0(c),h=+f-L0(f);return Math.round((d-h)/eL)}function aL(t,r){const a=JE(t,r),i=ma(t,0);return i.setFullYear(a,0,4),i.setHours(0,0,0,0),tu(i)}function sL(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function iL(t){return!(!sL(t)&&typeof t!="number"||isNaN(+wn(t)))}function lL(t,r){const a=wn(t,r==null?void 0:r.in);return a.setFullYear(a.getFullYear(),0,1),a.setHours(0,0,0,0),a}const oL={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},cL=(t,r,a)=>{let i;const o=oL[t];return typeof o=="string"?i=o:r===1?i=o.one:i=o.other.replace("{{count}}",r.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+i:i+" ago":i};function vh(t){return(r={})=>{const a=r.width?String(r.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}const uL={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},fL={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},dL={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},hL={date:vh({formats:uL,defaultWidth:"full"}),time:vh({formats:fL,defaultWidth:"full"}),dateTime:vh({formats:dL,defaultWidth:"full"})},mL={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pL=(t,r,a,i)=>mL[t];function zl(t){return(r,a)=>{const i=a!=null&&a.context?String(a.context):"standalone";let o;if(i==="formatting"&&t.formattingValues){const f=t.defaultFormattingWidth||t.defaultWidth,d=a!=null&&a.width?String(a.width):f;o=t.formattingValues[d]||t.formattingValues[f]}else{const f=t.defaultWidth,d=a!=null&&a.width?String(a.width):t.defaultWidth;o=t.values[d]||t.values[f]}const c=t.argumentCallback?t.argumentCallback(r):r;return o[c]}}const vL={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gL={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yL={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},bL={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},xL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wL={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},SL=(t,r)=>{const a=Number(t),i=a%100;if(i>20||i<10)switch(i%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},EL={ordinalNumber:SL,era:zl({values:vL,defaultWidth:"wide"}),quarter:zl({values:gL,defaultWidth:"wide",argumentCallback:t=>t-1}),month:zl({values:yL,defaultWidth:"wide"}),day:zl({values:bL,defaultWidth:"wide"}),dayPeriod:zl({values:xL,defaultWidth:"wide",formattingValues:wL,defaultFormattingWidth:"wide"})};function Pl(t){return(r,a={})=>{const i=a.width,o=i&&t.matchPatterns[i]||t.matchPatterns[t.defaultMatchWidth],c=r.match(o);if(!c)return null;const f=c[0],d=i&&t.parsePatterns[i]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(d)?TL(d,b=>b.test(f)):RL(d,b=>b.test(f));let p;p=t.valueCallback?t.valueCallback(h):h,p=a.valueCallback?a.valueCallback(p):p;const g=r.slice(f.length);return{value:p,rest:g}}}function RL(t,r){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&r(t[a]))return a}function TL(t,r){for(let a=0;a<t.length;a++)if(r(t[a]))return a}function CL(t){return(r,a={})=>{const i=r.match(t.matchPattern);if(!i)return null;const o=i[0],c=r.match(t.parsePattern);if(!c)return null;let f=t.valueCallback?t.valueCallback(c[0]):c[0];f=a.valueCallback?a.valueCallback(f):f;const d=r.slice(o.length);return{value:f,rest:d}}}const AL=/^(\d+)(th|st|nd|rd)?/i,NL=/\d+/i,OL={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},jL={any:[/^b/i,/^(a|c)/i]},ML={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},DL={any:[/1/i,/2/i,/3/i,/4/i]},_L={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},LL={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zL={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},PL={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},kL={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},UL={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},$L={ordinalNumber:CL({matchPattern:AL,parsePattern:NL,valueCallback:t=>parseInt(t,10)}),era:Pl({matchPatterns:OL,defaultMatchWidth:"wide",parsePatterns:jL,defaultParseWidth:"any"}),quarter:Pl({matchPatterns:ML,defaultMatchWidth:"wide",parsePatterns:DL,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Pl({matchPatterns:_L,defaultMatchWidth:"wide",parsePatterns:LL,defaultParseWidth:"any"}),day:Pl({matchPatterns:zL,defaultMatchWidth:"wide",parsePatterns:PL,defaultParseWidth:"any"}),dayPeriod:Pl({matchPatterns:kL,defaultMatchWidth:"any",parsePatterns:UL,defaultParseWidth:"any"})},HL={code:"en-US",formatDistance:cL,formatLong:hL,formatRelative:pL,localize:EL,match:$L,options:{weekStartsOn:0,firstWeekContainsDate:1}};function qL(t,r){const a=wn(t,r==null?void 0:r.in);return rL(a,lL(a))+1}function BL(t,r){const a=wn(t,r==null?void 0:r.in),i=+tu(a)-+aL(a);return Math.round(i/ZE)+1}function e1(t,r){var g,b,x,E;const a=wn(t,r==null?void 0:r.in),i=a.getFullYear(),o=Ru(),c=(r==null?void 0:r.firstWeekContainsDate)??((b=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??o.firstWeekContainsDate??((E=(x=o.locale)==null?void 0:x.options)==null?void 0:E.firstWeekContainsDate)??1,f=ma((r==null?void 0:r.in)||t,0);f.setFullYear(i+1,0,c),f.setHours(0,0,0,0);const d=Gl(f,r),h=ma((r==null?void 0:r.in)||t,0);h.setFullYear(i,0,c),h.setHours(0,0,0,0);const p=Gl(h,r);return+a>=+d?i+1:+a>=+p?i:i-1}function IL(t,r){var d,h,p,g;const a=Ru(),i=(r==null?void 0:r.firstWeekContainsDate)??((h=(d=r==null?void 0:r.locale)==null?void 0:d.options)==null?void 0:h.firstWeekContainsDate)??a.firstWeekContainsDate??((g=(p=a.locale)==null?void 0:p.options)==null?void 0:g.firstWeekContainsDate)??1,o=e1(t,r),c=ma((r==null?void 0:r.in)||t,0);return c.setFullYear(o,0,i),c.setHours(0,0,0,0),Gl(c,r)}function VL(t,r){const a=wn(t,r==null?void 0:r.in),i=+Gl(a,r)-+IL(a,r);return Math.round(i/ZE)+1}function $e(t,r){const a=t<0?"-":"",i=Math.abs(t).toString().padStart(r,"0");return a+i}const Zr={y(t,r){const a=t.getFullYear(),i=a>0?a:1-a;return $e(r==="yy"?i%100:i,r.length)},M(t,r){const a=t.getMonth();return r==="M"?String(a+1):$e(a+1,2)},d(t,r){return $e(t.getDate(),r.length)},a(t,r){const a=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.toUpperCase();case"aaa":return a;case"aaaaa":return a[0];case"aaaa":default:return a==="am"?"a.m.":"p.m."}},h(t,r){return $e(t.getHours()%12||12,r.length)},H(t,r){return $e(t.getHours(),r.length)},m(t,r){return $e(t.getMinutes(),r.length)},s(t,r){return $e(t.getSeconds(),r.length)},S(t,r){const a=r.length,i=t.getMilliseconds(),o=Math.trunc(i*Math.pow(10,a-3));return $e(o,r.length)}},Ks={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},P0={G:function(t,r,a){const i=t.getFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return a.era(i,{width:"abbreviated"});case"GGGGG":return a.era(i,{width:"narrow"});case"GGGG":default:return a.era(i,{width:"wide"})}},y:function(t,r,a){if(r==="yo"){const i=t.getFullYear(),o=i>0?i:1-i;return a.ordinalNumber(o,{unit:"year"})}return Zr.y(t,r)},Y:function(t,r,a,i){const o=e1(t,i),c=o>0?o:1-o;if(r==="YY"){const f=c%100;return $e(f,2)}return r==="Yo"?a.ordinalNumber(c,{unit:"year"}):$e(c,r.length)},R:function(t,r){const a=JE(t);return $e(a,r.length)},u:function(t,r){const a=t.getFullYear();return $e(a,r.length)},Q:function(t,r,a){const i=Math.ceil((t.getMonth()+1)/3);switch(r){case"Q":return String(i);case"QQ":return $e(i,2);case"Qo":return a.ordinalNumber(i,{unit:"quarter"});case"QQQ":return a.quarter(i,{width:"abbreviated",context:"formatting"});case"QQQQQ":return a.quarter(i,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(i,{width:"wide",context:"formatting"})}},q:function(t,r,a){const i=Math.ceil((t.getMonth()+1)/3);switch(r){case"q":return String(i);case"qq":return $e(i,2);case"qo":return a.ordinalNumber(i,{unit:"quarter"});case"qqq":return a.quarter(i,{width:"abbreviated",context:"standalone"});case"qqqqq":return a.quarter(i,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(i,{width:"wide",context:"standalone"})}},M:function(t,r,a){const i=t.getMonth();switch(r){case"M":case"MM":return Zr.M(t,r);case"Mo":return a.ordinalNumber(i+1,{unit:"month"});case"MMM":return a.month(i,{width:"abbreviated",context:"formatting"});case"MMMMM":return a.month(i,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(i,{width:"wide",context:"formatting"})}},L:function(t,r,a){const i=t.getMonth();switch(r){case"L":return String(i+1);case"LL":return $e(i+1,2);case"Lo":return a.ordinalNumber(i+1,{unit:"month"});case"LLL":return a.month(i,{width:"abbreviated",context:"standalone"});case"LLLLL":return a.month(i,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(i,{width:"wide",context:"standalone"})}},w:function(t,r,a,i){const o=VL(t,i);return r==="wo"?a.ordinalNumber(o,{unit:"week"}):$e(o,r.length)},I:function(t,r,a){const i=BL(t);return r==="Io"?a.ordinalNumber(i,{unit:"week"}):$e(i,r.length)},d:function(t,r,a){return r==="do"?a.ordinalNumber(t.getDate(),{unit:"date"}):Zr.d(t,r)},D:function(t,r,a){const i=qL(t);return r==="Do"?a.ordinalNumber(i,{unit:"dayOfYear"}):$e(i,r.length)},E:function(t,r,a){const i=t.getDay();switch(r){case"E":case"EE":case"EEE":return a.day(i,{width:"abbreviated",context:"formatting"});case"EEEEE":return a.day(i,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(i,{width:"short",context:"formatting"});case"EEEE":default:return a.day(i,{width:"wide",context:"formatting"})}},e:function(t,r,a,i){const o=t.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(r){case"e":return String(c);case"ee":return $e(c,2);case"eo":return a.ordinalNumber(c,{unit:"day"});case"eee":return a.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return a.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(o,{width:"short",context:"formatting"});case"eeee":default:return a.day(o,{width:"wide",context:"formatting"})}},c:function(t,r,a,i){const o=t.getDay(),c=(o-i.weekStartsOn+8)%7||7;switch(r){case"c":return String(c);case"cc":return $e(c,r.length);case"co":return a.ordinalNumber(c,{unit:"day"});case"ccc":return a.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return a.day(o,{width:"narrow",context:"standalone"});case"cccccc":return a.day(o,{width:"short",context:"standalone"});case"cccc":default:return a.day(o,{width:"wide",context:"standalone"})}},i:function(t,r,a){const i=t.getDay(),o=i===0?7:i;switch(r){case"i":return String(o);case"ii":return $e(o,r.length);case"io":return a.ordinalNumber(o,{unit:"day"});case"iii":return a.day(i,{width:"abbreviated",context:"formatting"});case"iiiii":return a.day(i,{width:"narrow",context:"formatting"});case"iiiiii":return a.day(i,{width:"short",context:"formatting"});case"iiii":default:return a.day(i,{width:"wide",context:"formatting"})}},a:function(t,r,a){const o=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,r,a){const i=t.getHours();let o;switch(i===12?o=Ks.noon:i===0?o=Ks.midnight:o=i/12>=1?"pm":"am",r){case"b":case"bb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,r,a){const i=t.getHours();let o;switch(i>=17?o=Ks.evening:i>=12?o=Ks.afternoon:i>=4?o=Ks.morning:o=Ks.night,r){case"B":case"BB":case"BBB":return a.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return a.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,r,a){if(r==="ho"){let i=t.getHours()%12;return i===0&&(i=12),a.ordinalNumber(i,{unit:"hour"})}return Zr.h(t,r)},H:function(t,r,a){return r==="Ho"?a.ordinalNumber(t.getHours(),{unit:"hour"}):Zr.H(t,r)},K:function(t,r,a){const i=t.getHours()%12;return r==="Ko"?a.ordinalNumber(i,{unit:"hour"}):$e(i,r.length)},k:function(t,r,a){let i=t.getHours();return i===0&&(i=24),r==="ko"?a.ordinalNumber(i,{unit:"hour"}):$e(i,r.length)},m:function(t,r,a){return r==="mo"?a.ordinalNumber(t.getMinutes(),{unit:"minute"}):Zr.m(t,r)},s:function(t,r,a){return r==="so"?a.ordinalNumber(t.getSeconds(),{unit:"second"}):Zr.s(t,r)},S:function(t,r){return Zr.S(t,r)},X:function(t,r,a){const i=t.getTimezoneOffset();if(i===0)return"Z";switch(r){case"X":return U0(i);case"XXXX":case"XX":return Ia(i);case"XXXXX":case"XXX":default:return Ia(i,":")}},x:function(t,r,a){const i=t.getTimezoneOffset();switch(r){case"x":return U0(i);case"xxxx":case"xx":return Ia(i);case"xxxxx":case"xxx":default:return Ia(i,":")}},O:function(t,r,a){const i=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+k0(i,":");case"OOOO":default:return"GMT"+Ia(i,":")}},z:function(t,r,a){const i=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+k0(i,":");case"zzzz":default:return"GMT"+Ia(i,":")}},t:function(t,r,a){const i=Math.trunc(+t/1e3);return $e(i,r.length)},T:function(t,r,a){return $e(+t,r.length)}};function k0(t,r=""){const a=t>0?"-":"+",i=Math.abs(t),o=Math.trunc(i/60),c=i%60;return c===0?a+String(o):a+String(o)+r+$e(c,2)}function U0(t,r){return t%60===0?(t>0?"-":"+")+$e(Math.abs(t)/60,2):Ia(t,r)}function Ia(t,r=""){const a=t>0?"-":"+",i=Math.abs(t),o=$e(Math.trunc(i/60),2),c=$e(i%60,2);return a+o+r+c}const $0=(t,r)=>{switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},t1=(t,r)=>{switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},YL=(t,r)=>{const a=t.match(/(P+)(p+)?/)||[],i=a[1],o=a[2];if(!o)return $0(t,r);let c;switch(i){case"P":c=r.dateTime({width:"short"});break;case"PP":c=r.dateTime({width:"medium"});break;case"PPP":c=r.dateTime({width:"long"});break;case"PPPP":default:c=r.dateTime({width:"full"});break}return c.replace("{{date}}",$0(i,r)).replace("{{time}}",t1(o,r))},GL={p:t1,P:YL},FL=/^D+$/,QL=/^Y+$/,XL=["D","DD","YY","YYYY"];function WL(t){return FL.test(t)}function KL(t){return QL.test(t)}function ZL(t,r,a){const i=JL(t,r,a);if(console.warn(i),XL.includes(t))throw new RangeError(i)}function JL(t,r,a){const i=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${i} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const e4=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,t4=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,n4=/^'([^]*?)'?$/,r4=/''/g,a4=/[a-zA-Z]/;function s4(t,r,a){var g,b,x,E;const i=Ru(),o=i.locale??HL,c=i.firstWeekContainsDate??((b=(g=i.locale)==null?void 0:g.options)==null?void 0:b.firstWeekContainsDate)??1,f=i.weekStartsOn??((E=(x=i.locale)==null?void 0:x.options)==null?void 0:E.weekStartsOn)??0,d=wn(t,a==null?void 0:a.in);if(!iL(d))throw new RangeError("Invalid time value");let h=r.match(t4).map(R=>{const S=R[0];if(S==="p"||S==="P"){const w=GL[S];return w(R,o.formatLong)}return R}).join("").match(e4).map(R=>{if(R==="''")return{isToken:!1,value:"'"};const S=R[0];if(S==="'")return{isToken:!1,value:i4(R)};if(P0[S])return{isToken:!0,value:R};if(S.match(a4))throw new RangeError("Format string contains an unescaped latin alphabet character `"+S+"`");return{isToken:!1,value:R}});o.localize.preprocessor&&(h=o.localize.preprocessor(d,h));const p={firstWeekContainsDate:c,weekStartsOn:f,locale:o};return h.map(R=>{if(!R.isToken)return R.value;const S=R.value;(KL(S)||WL(S))&&ZL(S,r,String(t));const w=P0[S[0]];return w(d,S,o.localize,p)}).join("")}function i4(t){const r=t.match(n4);return r?r[1].replace(r4,"'"):t}function n1({title:t,subtitle:r}){return v.jsxs("div",{className:"space-y-0.5",children:[v.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:t}),r?v.jsx("p",{className:"text-muted-foreground",children:r}):null]})}function Um(t,[r,a]){return Math.min(a,Math.max(r,t))}function l4(t,r){return y.useReducer((a,i)=>r[a][i]??a,t)}var Mp="ScrollArea",[r1,zz]=Hn(Mp),[o4,on]=r1(Mp),a1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,type:i="hover",dir:o,scrollHideDelay:c=600,...f}=t,[d,h]=y.useState(null),[p,g]=y.useState(null),[b,x]=y.useState(null),[E,R]=y.useState(null),[S,w]=y.useState(null),[C,A]=y.useState(0),[N,L]=y.useState(0),[_,k]=y.useState(!1),[I,Y]=y.useState(!1),H=ke(r,Z=>h(Z)),K=Su(o);return v.jsx(o4,{scope:a,type:i,dir:K,scrollHideDelay:c,scrollArea:d,viewport:p,onViewportChange:g,content:b,onContentChange:x,scrollbarX:E,onScrollbarXChange:R,scrollbarXEnabled:_,onScrollbarXEnabledChange:k,scrollbarY:S,onScrollbarYChange:w,scrollbarYEnabled:I,onScrollbarYEnabledChange:Y,onCornerWidthChange:A,onCornerHeightChange:L,children:v.jsx(Se.div,{dir:K,...f,ref:H,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":N+"px",...t.style}})})});a1.displayName=Mp;var s1="ScrollAreaViewport",i1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,children:i,nonce:o,...c}=t,f=on(s1,a),d=y.useRef(null),h=ke(r,d,f.onViewportChange);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),v.jsx(Se.div,{"data-radix-scroll-area-viewport":"",...c,ref:h,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...t.style},children:v.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})});i1.displayName=s1;var Gn="ScrollAreaScrollbar",Dp=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=on(Gn,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:f}=o,d=t.orientation==="horizontal";return y.useEffect(()=>(d?c(!0):f(!0),()=>{d?c(!1):f(!1)}),[d,c,f]),o.type==="hover"?v.jsx(c4,{...i,ref:r,forceMount:a}):o.type==="scroll"?v.jsx(u4,{...i,ref:r,forceMount:a}):o.type==="auto"?v.jsx(l1,{...i,ref:r,forceMount:a}):o.type==="always"?v.jsx(_p,{...i,ref:r}):null});Dp.displayName=Gn;var c4=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=on(Gn,t.__scopeScrollArea),[c,f]=y.useState(!1);return y.useEffect(()=>{const d=o.scrollArea;let h=0;if(d){const p=()=>{window.clearTimeout(h),f(!0)},g=()=>{h=window.setTimeout(()=>f(!1),o.scrollHideDelay)};return d.addEventListener("pointerenter",p),d.addEventListener("pointerleave",g),()=>{window.clearTimeout(h),d.removeEventListener("pointerenter",p),d.removeEventListener("pointerleave",g)}}},[o.scrollArea,o.scrollHideDelay]),v.jsx(ln,{present:a||c,children:v.jsx(l1,{"data-state":c?"visible":"hidden",...i,ref:r})})}),u4=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=on(Gn,t.__scopeScrollArea),c=t.orientation==="horizontal",f=Cu(()=>h("SCROLL_END"),100),[d,h]=l4("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(d==="idle"){const p=window.setTimeout(()=>h("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[d,o.scrollHideDelay,h]),y.useEffect(()=>{const p=o.viewport,g=c?"scrollLeft":"scrollTop";if(p){let b=p[g];const x=()=>{const E=p[g];b!==E&&(h("SCROLL"),f()),b=E};return p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[o.viewport,c,h,f]),v.jsx(ln,{present:a||d!=="hidden",children:v.jsx(_p,{"data-state":d==="hidden"?"hidden":"visible",...i,ref:r,onPointerEnter:ge(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:ge(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),l1=y.forwardRef((t,r)=>{const a=on(Gn,t.__scopeScrollArea),{forceMount:i,...o}=t,[c,f]=y.useState(!1),d=t.orientation==="horizontal",h=Cu(()=>{if(a.viewport){const p=a.viewport.offsetWidth<a.viewport.scrollWidth,g=a.viewport.offsetHeight<a.viewport.scrollHeight;f(d?p:g)}},10);return wi(a.viewport,h),wi(a.content,h),v.jsx(ln,{present:i||c,children:v.jsx(_p,{"data-state":c?"visible":"hidden",...o,ref:r})})}),_p=y.forwardRef((t,r)=>{const{orientation:a="vertical",...i}=t,o=on(Gn,t.__scopeScrollArea),c=y.useRef(null),f=y.useRef(0),[d,h]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=d1(d.viewport,d.content),g={...i,sizes:d,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:x=>f.current=x};function b(x,E){return v4(x,f.current,d,E)}return a==="horizontal"?v.jsx(f4,{...g,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollLeft,E=H0(x,d,o.dir);c.current.style.transform=`translate3d(${E}px, 0, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollLeft=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollLeft=b(x,o.dir))}}):a==="vertical"?v.jsx(d4,{...g,ref:r,onThumbPositionChange:()=>{if(o.viewport&&c.current){const x=o.viewport.scrollTop,E=H0(x,d);c.current.style.transform=`translate3d(0, ${E}px, 0)`}},onWheelScroll:x=>{o.viewport&&(o.viewport.scrollTop=x)},onDragScroll:x=>{o.viewport&&(o.viewport.scrollTop=b(x))}}):null}),f4=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:i,...o}=t,c=on(Gn,t.__scopeScrollArea),[f,d]=y.useState(),h=y.useRef(null),p=ke(r,h,c.onScrollbarXChange);return y.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),v.jsx(c1,{"data-orientation":"horizontal",...o,ref:p,sizes:a,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Tu(a)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.x),onDragScroll:g=>t.onDragScroll(g.x),onWheelScroll:(g,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+g.deltaX;t.onWheelScroll(x),m1(x,b)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&f&&i({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:ru(f.paddingLeft),paddingEnd:ru(f.paddingRight)}})}})}),d4=y.forwardRef((t,r)=>{const{sizes:a,onSizesChange:i,...o}=t,c=on(Gn,t.__scopeScrollArea),[f,d]=y.useState(),h=y.useRef(null),p=ke(r,h,c.onScrollbarYChange);return y.useEffect(()=>{h.current&&d(getComputedStyle(h.current))},[h]),v.jsx(c1,{"data-orientation":"vertical",...o,ref:p,sizes:a,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Tu(a)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.y),onDragScroll:g=>t.onDragScroll(g.y),onWheelScroll:(g,b)=>{if(c.viewport){const x=c.viewport.scrollTop+g.deltaY;t.onWheelScroll(x),m1(x,b)&&g.preventDefault()}},onResize:()=>{h.current&&c.viewport&&f&&i({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:ru(f.paddingTop),paddingEnd:ru(f.paddingBottom)}})}})}),[h4,o1]=r1(Gn),c1=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,sizes:i,hasThumb:o,onThumbChange:c,onThumbPointerUp:f,onThumbPointerDown:d,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:g,onResize:b,...x}=t,E=on(Gn,a),[R,S]=y.useState(null),w=ke(r,H=>S(H)),C=y.useRef(null),A=y.useRef(""),N=E.viewport,L=i.content-i.viewport,_=nt(g),k=nt(h),I=Cu(b,10);function Y(H){if(C.current){const K=H.clientX-C.current.left,Z=H.clientY-C.current.top;p({x:K,y:Z})}}return y.useEffect(()=>{const H=K=>{const Z=K.target;(R==null?void 0:R.contains(Z))&&_(K,L)};return document.addEventListener("wheel",H,{passive:!1}),()=>document.removeEventListener("wheel",H,{passive:!1})},[N,R,L,_]),y.useEffect(k,[i,k]),wi(R,I),wi(E.content,I),v.jsx(h4,{scope:a,scrollbar:R,hasThumb:o,onThumbChange:nt(c),onThumbPointerUp:nt(f),onThumbPositionChange:k,onThumbPointerDown:nt(d),children:v.jsx(Se.div,{...x,ref:w,style:{position:"absolute",...x.style},onPointerDown:ge(t.onPointerDown,H=>{H.button===0&&(H.target.setPointerCapture(H.pointerId),C.current=R.getBoundingClientRect(),A.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",E.viewport&&(E.viewport.style.scrollBehavior="auto"),Y(H))}),onPointerMove:ge(t.onPointerMove,Y),onPointerUp:ge(t.onPointerUp,H=>{const K=H.target;K.hasPointerCapture(H.pointerId)&&K.releasePointerCapture(H.pointerId),document.body.style.webkitUserSelect=A.current,E.viewport&&(E.viewport.style.scrollBehavior=""),C.current=null})})})}),nu="ScrollAreaThumb",u1=y.forwardRef((t,r)=>{const{forceMount:a,...i}=t,o=o1(nu,t.__scopeScrollArea);return v.jsx(ln,{present:a||o.hasThumb,children:v.jsx(m4,{ref:r,...i})})}),m4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,style:i,...o}=t,c=on(nu,a),f=o1(nu,a),{onThumbPositionChange:d}=f,h=ke(r,b=>f.onThumbChange(b)),p=y.useRef(void 0),g=Cu(()=>{p.current&&(p.current(),p.current=void 0)},100);return y.useEffect(()=>{const b=c.viewport;if(b){const x=()=>{if(g(),!p.current){const E=g4(b,d);p.current=E,d()}};return d(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,g,d]),v.jsx(Se.div,{"data-state":f.hasThumb?"visible":"hidden",...o,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:ge(t.onPointerDownCapture,b=>{const E=b.target.getBoundingClientRect(),R=b.clientX-E.left,S=b.clientY-E.top;f.onThumbPointerDown({x:R,y:S})}),onPointerUp:ge(t.onPointerUp,f.onThumbPointerUp)})});u1.displayName=nu;var Lp="ScrollAreaCorner",f1=y.forwardRef((t,r)=>{const a=on(Lp,t.__scopeScrollArea),i=!!(a.scrollbarX&&a.scrollbarY);return a.type!=="scroll"&&i?v.jsx(p4,{...t,ref:r}):null});f1.displayName=Lp;var p4=y.forwardRef((t,r)=>{const{__scopeScrollArea:a,...i}=t,o=on(Lp,a),[c,f]=y.useState(0),[d,h]=y.useState(0),p=!!(c&&d);return wi(o.scrollbarX,()=>{var b;const g=((b=o.scrollbarX)==null?void 0:b.offsetHeight)||0;o.onCornerHeightChange(g),h(g)}),wi(o.scrollbarY,()=>{var b;const g=((b=o.scrollbarY)==null?void 0:b.offsetWidth)||0;o.onCornerWidthChange(g),f(g)}),p?v.jsx(Se.div,{...i,ref:r,style:{width:c,height:d,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ru(t){return t?parseInt(t,10):0}function d1(t,r){const a=t/r;return isNaN(a)?0:a}function Tu(t){const r=d1(t.viewport,t.content),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=(t.scrollbar.size-a)*r;return Math.max(i,18)}function v4(t,r,a,i="ltr"){const o=Tu(a),c=o/2,f=r||c,d=o-f,h=a.scrollbar.paddingStart+f,p=a.scrollbar.size-a.scrollbar.paddingEnd-d,g=a.content-a.viewport,b=i==="ltr"?[0,g]:[g*-1,0];return h1([h,p],b)(t)}function H0(t,r,a="ltr"){const i=Tu(r),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,c=r.scrollbar.size-o,f=r.content-r.viewport,d=c-i,h=a==="ltr"?[0,f]:[f*-1,0],p=Um(t,h);return h1([0,f],[0,d])(p)}function h1(t,r){return a=>{if(t[0]===t[1]||r[0]===r[1])return r[0];const i=(r[1]-r[0])/(t[1]-t[0]);return r[0]+i*(a-t[0])}}function m1(t,r){return t>0&&t<r}var g4=(t,r=()=>{})=>{let a={left:t.scrollLeft,top:t.scrollTop},i=0;return function o(){const c={left:t.scrollLeft,top:t.scrollTop},f=a.left!==c.left,d=a.top!==c.top;(f||d)&&r(),a=c,i=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(i)};function Cu(t,r){const a=nt(t),i=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),y.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(a,r)},[a,r])}function wi(t,r){const a=nt(r);ft(()=>{let i=0;if(t){const o=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(a)});return o.observe(t),()=>{window.cancelAnimationFrame(i),o.unobserve(t)}}},[t,a])}var p1=a1,y4=i1,b4=f1;const v1=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(p1,{ref:i,className:le("relative overflow-hidden",t),...a,children:[v.jsx(y4,{className:"h-full w-full rounded-[inherit]",children:r}),v.jsx(g1,{}),v.jsx(b4,{})]}));v1.displayName=p1.displayName;const g1=y.forwardRef(({className:t,orientation:r="vertical",...a},i)=>v.jsx(Dp,{ref:i,orientation:r,className:le("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:v.jsx(u1,{className:"relative flex-1 rounded-full bg-border"})}));g1.displayName=Dp.displayName;function x4(t){const r=y.useRef({value:t,previous:t});return y.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var w4=[" ","Enter","ArrowUp","ArrowDown"],S4=[" ","Enter"],lo="Select",[Au,Nu,E4]=Ap(lo),[ji,Pz]=Hn(lo,[E4,hu]),Ou=hu(),[R4,ga]=ji(lo),[T4,C4]=ji(lo),y1=t=>{const{__scopeSelect:r,children:a,open:i,defaultOpen:o,onOpenChange:c,value:f,defaultValue:d,onValueChange:h,dir:p,name:g,autoComplete:b,disabled:x,required:E,form:R}=t,S=Ou(r),[w,C]=y.useState(null),[A,N]=y.useState(null),[L,_]=y.useState(!1),k=Su(p),[I=!1,Y]=rs({prop:i,defaultProp:o,onChange:c}),[H,K]=rs({prop:f,defaultProp:d,onChange:h}),Z=y.useRef(null),ne=w?R||!!w.closest("form"):!0,[ce,$]=y.useState(new Set),U=Array.from(ce).map(M=>M.props.value).join(";");return v.jsx(mS,{...S,children:v.jsxs(R4,{required:E,scope:r,trigger:w,onTriggerChange:C,valueNode:A,onValueNodeChange:N,valueNodeHasChildren:L,onValueNodeHasChildrenChange:_,contentId:yr(),value:H,onValueChange:K,open:I,onOpenChange:Y,dir:k,triggerPointerDownPosRef:Z,disabled:x,children:[v.jsx(Au.Provider,{scope:r,children:v.jsx(T4,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(M=>{$(q=>new Set(q).add(M))},[]),onNativeOptionRemove:y.useCallback(M=>{$(q=>{const z=new Set(q);return z.delete(M),z})},[]),children:a})}),ne?v.jsxs(I1,{"aria-hidden":!0,required:E,tabIndex:-1,name:g,autoComplete:b,value:H,onChange:M=>K(M.target.value),disabled:x,form:R,children:[H===void 0?v.jsx("option",{value:""}):null,Array.from(ce)]},U):null]})})};y1.displayName=lo;var b1="SelectTrigger",x1=y.forwardRef((t,r)=>{const{__scopeSelect:a,disabled:i=!1,...o}=t,c=Ou(a),f=ga(b1,a),d=f.disabled||i,h=ke(r,f.onTriggerChange),p=Nu(a),g=y.useRef("touch"),[b,x,E]=V1(S=>{const w=p().filter(N=>!N.disabled),C=w.find(N=>N.value===f.value),A=Y1(w,S,C);A!==void 0&&f.onValueChange(A.value)}),R=S=>{d||(f.onOpenChange(!0),E()),S&&(f.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return v.jsx(pS,{asChild:!0,...c,children:v.jsx(Se.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":B1(f.value)?"":void 0,...o,ref:h,onClick:ge(o.onClick,S=>{S.currentTarget.focus(),g.current!=="mouse"&&R(S)}),onPointerDown:ge(o.onPointerDown,S=>{g.current=S.pointerType;const w=S.target;w.hasPointerCapture(S.pointerId)&&w.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(R(S),S.preventDefault())}),onKeyDown:ge(o.onKeyDown,S=>{const w=b.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&x(S.key),!(w&&S.key===" ")&&w4.includes(S.key)&&(R(),S.preventDefault())})})})});x1.displayName=b1;var w1="SelectValue",S1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:i,style:o,children:c,placeholder:f="",...d}=t,h=ga(w1,a),{onValueNodeHasChildrenChange:p}=h,g=c!==void 0,b=ke(r,h.onValueNodeChange);return ft(()=>{p(g)},[p,g]),v.jsx(Se.span,{...d,ref:b,style:{pointerEvents:"none"},children:B1(h.value)?v.jsx(v.Fragment,{children:f}):c})});S1.displayName=w1;var A4="SelectIcon",E1=y.forwardRef((t,r)=>{const{__scopeSelect:a,children:i,...o}=t;return v.jsx(Se.span,{"aria-hidden":!0,...o,ref:r,children:i||"▼"})});E1.displayName=A4;var N4="SelectPortal",R1=t=>v.jsx(Jl,{asChild:!0,...t});R1.displayName=N4;var os="SelectContent",T1=y.forwardRef((t,r)=>{const a=ga(os,t.__scopeSelect),[i,o]=y.useState();if(ft(()=>{o(new DocumentFragment)},[]),!a.open){const c=i;return c?Ei.createPortal(v.jsx(C1,{scope:t.__scopeSelect,children:v.jsx(Au.Slot,{scope:t.__scopeSelect,children:v.jsx("div",{children:t.children})})}),c):null}return v.jsx(A1,{...t,ref:r})});T1.displayName=os;var hn=10,[C1,ya]=ji(os),O4="SelectContentImpl",A1=y.forwardRef((t,r)=>{const{__scopeSelect:a,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:c,onPointerDownOutside:f,side:d,sideOffset:h,align:p,alignOffset:g,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:R,hideWhenDetached:S,avoidCollisions:w,...C}=t,A=ga(os,a),[N,L]=y.useState(null),[_,k]=y.useState(null),I=ke(r,fe=>L(fe)),[Y,H]=y.useState(null),[K,Z]=y.useState(null),ne=Nu(a),[ce,$]=y.useState(!1),U=y.useRef(!1);y.useEffect(()=>{if(N)return Ew(N)},[N]),mw();const M=y.useCallback(fe=>{const[me,...Ee]=ne().map(Ae=>Ae.ref.current),[de]=Ee.slice(-1),we=document.activeElement;for(const Ae of fe)if(Ae===we||(Ae==null||Ae.scrollIntoView({block:"nearest"}),Ae===me&&_&&(_.scrollTop=0),Ae===de&&_&&(_.scrollTop=_.scrollHeight),Ae==null||Ae.focus(),document.activeElement!==we))return},[ne,_]),q=y.useCallback(()=>M([Y,N]),[M,Y,N]);y.useEffect(()=>{ce&&q()},[ce,q]);const{onOpenChange:z,triggerPointerDownPosRef:Q}=A;y.useEffect(()=>{if(N){let fe={x:0,y:0};const me=de=>{var we,Ae;fe={x:Math.abs(Math.round(de.pageX)-(((we=Q.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(de.pageY)-(((Ae=Q.current)==null?void 0:Ae.y)??0))}},Ee=de=>{fe.x<=10&&fe.y<=10?de.preventDefault():N.contains(de.target)||z(!1),document.removeEventListener("pointermove",me),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",me),document.addEventListener("pointerup",Ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",me),document.removeEventListener("pointerup",Ee,{capture:!0})}}},[N,z,Q]),y.useEffect(()=>{const fe=()=>z(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[z]);const[j,G]=V1(fe=>{const me=ne().filter(we=>!we.disabled),Ee=me.find(we=>we.ref.current===document.activeElement),de=Y1(me,fe,Ee);de&&setTimeout(()=>de.ref.current.focus())}),te=y.useCallback((fe,me,Ee)=>{const de=!U.current&&!Ee;(A.value!==void 0&&A.value===me||de)&&(H(fe),de&&(U.current=!0))},[A.value]),se=y.useCallback(()=>N==null?void 0:N.focus(),[N]),ae=y.useCallback((fe,me,Ee)=>{const de=!U.current&&!Ee;(A.value!==void 0&&A.value===me||de)&&Z(fe)},[A.value]),oe=i==="popper"?$m:N1,pe=oe===$m?{side:d,sideOffset:h,align:p,alignOffset:g,arrowPadding:b,collisionBoundary:x,collisionPadding:E,sticky:R,hideWhenDetached:S,avoidCollisions:w}:{};return v.jsx(C1,{scope:a,content:N,viewport:_,onViewportChange:k,itemRefCallback:te,selectedItem:Y,onItemLeave:se,itemTextRefCallback:ae,focusSelectedItem:q,selectedItemText:K,position:i,isPositioned:ce,searchRef:j,children:v.jsx(Jm,{as:sn,allowPinchZoom:!0,children:v.jsx(Zm,{asChild:!0,trapped:A.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:ge(o,fe=>{var me;(me=A.trigger)==null||me.focus({preventScroll:!0}),fe.preventDefault()}),children:v.jsx(Zl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:v.jsx(oe,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:fe=>fe.preventDefault(),...C,...pe,onPlaced:()=>$(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:ge(C.onKeyDown,fe=>{const me=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!me&&fe.key.length===1&&G(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let de=ne().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const we=fe.target,Ae=de.indexOf(we);de=de.slice(Ae+1)}setTimeout(()=>M(de)),fe.preventDefault()}})})})})})})});A1.displayName=O4;var j4="SelectItemAlignedPosition",N1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onPlaced:i,...o}=t,c=ga(os,a),f=ya(os,a),[d,h]=y.useState(null),[p,g]=y.useState(null),b=ke(r,I=>g(I)),x=Nu(a),E=y.useRef(!1),R=y.useRef(!0),{viewport:S,selectedItem:w,selectedItemText:C,focusSelectedItem:A}=f,N=y.useCallback(()=>{if(c.trigger&&c.valueNode&&d&&p&&S&&w&&C){const I=c.trigger.getBoundingClientRect(),Y=p.getBoundingClientRect(),H=c.valueNode.getBoundingClientRect(),K=C.getBoundingClientRect();if(c.dir!=="rtl"){const we=K.left-Y.left,Ae=H.left-we,Ve=I.left-Ae,Rt=I.width+Ve,Rn=Math.max(Rt,Y.width),Vt=window.innerWidth-hn,Fn=Um(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Rt+"px",d.style.left=Fn+"px"}else{const we=Y.right-K.right,Ae=window.innerWidth-H.right-we,Ve=window.innerWidth-I.right-Ae,Rt=I.width+Ve,Rn=Math.max(Rt,Y.width),Vt=window.innerWidth-hn,Fn=Um(Ae,[hn,Math.max(hn,Vt-Rn)]);d.style.minWidth=Rt+"px",d.style.right=Fn+"px"}const Z=x(),ne=window.innerHeight-hn*2,ce=S.scrollHeight,$=window.getComputedStyle(p),U=parseInt($.borderTopWidth,10),M=parseInt($.paddingTop,10),q=parseInt($.borderBottomWidth,10),z=parseInt($.paddingBottom,10),Q=U+M+ce+z+q,j=Math.min(w.offsetHeight*5,Q),G=window.getComputedStyle(S),te=parseInt(G.paddingTop,10),se=parseInt(G.paddingBottom,10),ae=I.top+I.height/2-hn,oe=ne-ae,pe=w.offsetHeight/2,fe=w.offsetTop+pe,me=U+M+fe,Ee=Q-me;if(me<=ae){const we=Z.length>0&&w===Z[Z.length-1].ref.current;d.style.bottom="0px";const Ae=p.clientHeight-S.offsetTop-S.offsetHeight,Ve=Math.max(oe,pe+(we?se:0)+Ae+q),Rt=me+Ve;d.style.height=Rt+"px"}else{const we=Z.length>0&&w===Z[0].ref.current;d.style.top="0px";const Ve=Math.max(ae,U+S.offsetTop+(we?te:0)+pe)+Ee;d.style.height=Ve+"px",S.scrollTop=me-ae+S.offsetTop}d.style.margin=`${hn}px 0`,d.style.minHeight=j+"px",d.style.maxHeight=ne+"px",i==null||i(),requestAnimationFrame(()=>E.current=!0)}},[x,c.trigger,c.valueNode,d,p,S,w,C,c.dir,i]);ft(()=>N(),[N]);const[L,_]=y.useState();ft(()=>{p&&_(window.getComputedStyle(p).zIndex)},[p]);const k=y.useCallback(I=>{I&&R.current===!0&&(N(),A==null||A(),R.current=!1)},[N,A]);return v.jsx(D4,{scope:a,contentWrapper:d,shouldExpandOnScrollRef:E,onScrollButtonChange:k,children:v.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:L},children:v.jsx(Se.div,{...o,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});N1.displayName=j4;var M4="SelectPopperPosition",$m=y.forwardRef((t,r)=>{const{__scopeSelect:a,align:i="start",collisionPadding:o=hn,...c}=t,f=Ou(a);return v.jsx(vS,{...f,...c,ref:r,align:i,collisionPadding:o,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$m.displayName=M4;var[D4,zp]=ji(os,{}),Hm="SelectViewport",O1=y.forwardRef((t,r)=>{const{__scopeSelect:a,nonce:i,...o}=t,c=ya(Hm,a),f=zp(Hm,a),d=ke(r,c.onViewportChange),h=y.useRef(0);return v.jsxs(v.Fragment,{children:[v.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),v.jsx(Au.Slot,{scope:a,children:v.jsx(Se.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ge(o.onScroll,p=>{const g=p.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:x}=f;if(x!=null&&x.current&&b){const E=Math.abs(h.current-g.scrollTop);if(E>0){const R=window.innerHeight-hn*2,S=parseFloat(b.style.minHeight),w=parseFloat(b.style.height),C=Math.max(S,w);if(C<R){const A=C+E,N=Math.min(R,A),L=A-N;b.style.height=N+"px",b.style.bottom==="0px"&&(g.scrollTop=L>0?L:0,b.style.justifyContent="flex-end")}}}h.current=g.scrollTop})})})]})});O1.displayName=Hm;var j1="SelectGroup",[_4,L4]=ji(j1),z4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t,o=yr();return v.jsx(_4,{scope:a,id:o,children:v.jsx(Se.div,{role:"group","aria-labelledby":o,...i,ref:r})})});z4.displayName=j1;var M1="SelectLabel",D1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t,o=L4(M1,a);return v.jsx(Se.div,{id:o.id,...i,ref:r})});D1.displayName=M1;var au="SelectItem",[P4,_1]=ji(au),L1=y.forwardRef((t,r)=>{const{__scopeSelect:a,value:i,disabled:o=!1,textValue:c,...f}=t,d=ga(au,a),h=ya(au,a),p=d.value===i,[g,b]=y.useState(c??""),[x,E]=y.useState(!1),R=ke(r,A=>{var N;return(N=h.itemRefCallback)==null?void 0:N.call(h,A,i,o)}),S=yr(),w=y.useRef("touch"),C=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return v.jsx(P4,{scope:a,value:i,disabled:o,textId:S,isSelected:p,onItemTextChange:y.useCallback(A=>{b(N=>N||((A==null?void 0:A.textContent)??"").trim())},[]),children:v.jsx(Au.ItemSlot,{scope:a,value:i,disabled:o,textValue:g,children:v.jsx(Se.div,{role:"option","aria-labelledby":S,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...f,ref:R,onFocus:ge(f.onFocus,()=>E(!0)),onBlur:ge(f.onBlur,()=>E(!1)),onClick:ge(f.onClick,()=>{w.current!=="mouse"&&C()}),onPointerUp:ge(f.onPointerUp,()=>{w.current==="mouse"&&C()}),onPointerDown:ge(f.onPointerDown,A=>{w.current=A.pointerType}),onPointerMove:ge(f.onPointerMove,A=>{var N;w.current=A.pointerType,o?(N=h.onItemLeave)==null||N.call(h):w.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(f.onPointerLeave,A=>{var N;A.currentTarget===document.activeElement&&((N=h.onItemLeave)==null||N.call(h))}),onKeyDown:ge(f.onKeyDown,A=>{var L;((L=h.searchRef)==null?void 0:L.current)!==""&&A.key===" "||(S4.includes(A.key)&&C(),A.key===" "&&A.preventDefault())})})})})});L1.displayName=au;var Hl="SelectItemText",z1=y.forwardRef((t,r)=>{const{__scopeSelect:a,className:i,style:o,...c}=t,f=ga(Hl,a),d=ya(Hl,a),h=_1(Hl,a),p=C4(Hl,a),[g,b]=y.useState(null),x=ke(r,C=>b(C),h.onItemTextChange,C=>{var A;return(A=d.itemTextRefCallback)==null?void 0:A.call(d,C,h.value,h.disabled)}),E=g==null?void 0:g.textContent,R=y.useMemo(()=>v.jsx("option",{value:h.value,disabled:h.disabled,children:E},h.value),[h.disabled,h.value,E]),{onNativeOptionAdd:S,onNativeOptionRemove:w}=p;return ft(()=>(S(R),()=>w(R)),[S,w,R]),v.jsxs(v.Fragment,{children:[v.jsx(Se.span,{id:h.textId,...c,ref:x}),h.isSelected&&f.valueNode&&!f.valueNodeHasChildren?Ei.createPortal(c.children,f.valueNode):null]})});z1.displayName=Hl;var P1="SelectItemIndicator",k1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t;return _1(P1,a).isSelected?v.jsx(Se.span,{"aria-hidden":!0,...i,ref:r}):null});k1.displayName=P1;var qm="SelectScrollUpButton",U1=y.forwardRef((t,r)=>{const a=ya(qm,t.__scopeSelect),i=zp(qm,t.__scopeSelect),[o,c]=y.useState(!1),f=ke(r,i.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=h.scrollTop>0;c(p)};const h=a.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?v.jsx(H1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=a;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});U1.displayName=qm;var Bm="SelectScrollDownButton",$1=y.forwardRef((t,r)=>{const a=ya(Bm,t.__scopeSelect),i=zp(Bm,t.__scopeSelect),[o,c]=y.useState(!1),f=ke(r,i.onScrollButtonChange);return ft(()=>{if(a.viewport&&a.isPositioned){let d=function(){const p=h.scrollHeight-h.clientHeight,g=Math.ceil(h.scrollTop)<p;c(g)};const h=a.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[a.viewport,a.isPositioned]),o?v.jsx(H1,{...t,ref:f,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=a;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});$1.displayName=Bm;var H1=y.forwardRef((t,r)=>{const{__scopeSelect:a,onAutoScroll:i,...o}=t,c=ya("SelectScrollButton",a),f=y.useRef(null),d=Nu(a),h=y.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return y.useEffect(()=>()=>h(),[h]),ft(()=>{var g;const p=d().find(b=>b.ref.current===document.activeElement);(g=p==null?void 0:p.ref.current)==null||g.scrollIntoView({block:"nearest"})},[d]),v.jsx(Se.div,{"aria-hidden":!0,...o,ref:r,style:{flexShrink:0,...o.style},onPointerDown:ge(o.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(i,50))}),onPointerMove:ge(o.onPointerMove,()=>{var p;(p=c.onItemLeave)==null||p.call(c),f.current===null&&(f.current=window.setInterval(i,50))}),onPointerLeave:ge(o.onPointerLeave,()=>{h()})})}),k4="SelectSeparator",q1=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t;return v.jsx(Se.div,{"aria-hidden":!0,...i,ref:r})});q1.displayName=k4;var Im="SelectArrow",U4=y.forwardRef((t,r)=>{const{__scopeSelect:a,...i}=t,o=Ou(a),c=ga(Im,a),f=ya(Im,a);return c.open&&f.position==="popper"?v.jsx(gS,{...o,...i,ref:r}):null});U4.displayName=Im;function B1(t){return t===""||t===void 0}var I1=y.forwardRef((t,r)=>{const{value:a,...i}=t,o=y.useRef(null),c=ke(r,o),f=x4(a);return y.useEffect(()=>{const d=o.current,h=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(h,"value").set;if(f!==a&&g){const b=new Event("change",{bubbles:!0});g.call(d,a),d.dispatchEvent(b)}},[f,a]),v.jsx(to,{asChild:!0,children:v.jsx("select",{...i,ref:c,defaultValue:a})})});I1.displayName="BubbleSelect";function V1(t){const r=nt(t),a=y.useRef(""),i=y.useRef(0),o=y.useCallback(f=>{const d=a.current+f;r(d),function h(p){a.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>h(""),1e3))}(d)},[r]),c=y.useCallback(()=>{a.current="",window.clearTimeout(i.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),[a,o,c]}function Y1(t,r,a){const o=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,c=a?t.indexOf(a):-1;let f=$4(t,Math.max(c,0));o.length===1&&(f=f.filter(p=>p!==a));const h=f.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return h!==a?h:void 0}function $4(t,r){return t.map((a,i)=>t[(r+i)%t.length])}var H4=y1,G1=x1,q4=S1,B4=E1,I4=R1,F1=T1,V4=O1,Q1=D1,X1=L1,Y4=z1,G4=k1,W1=U1,K1=$1,Z1=q1;const F4=H4,Q4=q4,J1=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(G1,{ref:i,className:le("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[r,v.jsx(B4,{asChild:!0,children:v.jsx(Vw,{className:"h-4 w-4 opacity-50"})})]}));J1.displayName=G1.displayName;const eR=y.forwardRef(({className:t,...r},a)=>v.jsx(W1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:v.jsx(ZO,{className:"h-4 w-4"})}));eR.displayName=W1.displayName;const tR=y.forwardRef(({className:t,...r},a)=>v.jsx(K1,{ref:a,className:le("flex cursor-default items-center justify-center py-1",t),...r,children:v.jsx(Vw,{className:"h-4 w-4"})}));tR.displayName=K1.displayName;const nR=y.forwardRef(({className:t,children:r,position:a="popper",...i},o)=>v.jsx(I4,{children:v.jsxs(F1,{ref:o,className:le("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...i,children:[v.jsx(eR,{}),v.jsx(V4,{className:le("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),v.jsx(tR,{})]})}));nR.displayName=F1.displayName;const X4=y.forwardRef(({className:t,...r},a)=>v.jsx(Q1,{ref:a,className:le("px-2 py-1.5 text-sm font-semibold",t),...r}));X4.displayName=Q1.displayName;const Vm=y.forwardRef(({className:t,children:r,...a},i)=>v.jsxs(X1,{ref:i,className:le("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[v.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:v.jsx(G4,{children:v.jsx(ap,{className:"h-4 w-4"})})}),v.jsx(Y4,{children:r})]}));Vm.displayName=X1.displayName;const W4=y.forwardRef(({className:t,...r},a)=>v.jsx(Z1,{ref:a,className:le("-mx-1 my-1 h-px bg-muted",t),...r}));W4.displayName=Z1.displayName;const K4={10:"TRACE",20:"DEBUG",27:"SUCCESS",28:"PROGRESS",29:"LOG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"},Z4={10:"text-gray-400",20:"text-blue-400",27:"text-green-600",28:"text-purple-400",29:"text-gray-300",30:"text-emerald-400",40:"text-yellow-400",50:"text-red-400",60:"text-red-600"};function J4(){const[t,r]=y.useState("all"),[a,i]=y.useState(!0),o=y.useRef(null),c=y.useRef(!1),f=y.useRef(""),{data:d,error:h,isLoading:p}=fs({queryKey:["logs",t],queryFn:()=>Et.getLogs(t==="all"?"":t),refetchInterval:1e3,staleTime:1e3}),g=()=>{if(!o.current)return;const w=o.current,C=w.scrollHeight,A=w.clientHeight;w.scrollTo({top:C-A,behavior:"instant"})};y.useEffect(()=>{var A;if(!((A=d==null?void 0:d.logs)!=null&&A.length))return;const w=d.logs[d.logs.length-1],C=`${w.time}-${w.msg}`;a&&C!==f.current&&(setTimeout(g,0),f.current=C)},[d==null?void 0:d.logs,a]);const b=w=>{if(c.current)return;const{scrollTop:C,scrollHeight:A,clientHeight:N}=w.currentTarget,_=A-(C+N)<100;i(_),c.current=!0,setTimeout(()=>{c.current=!1},150)},x=()=>{i(!0),g()};y.useEffect(()=>{setTimeout(g,100)},[d==null?void 0:d.logs]);const E=w=>K4[w]||"UNKNOWN",R=w=>Z4[w]||"text-gray-400",S=w=>{const C=s4(w.time,"yyyy-MM-dd HH:mm:ss"),A=E(w.level),N=Object.entries(w).filter(([_])=>!Number.isNaN(Number(_))).sort((_,k)=>Number(_[0])-Number(k[0])),L=N.length>0?`
|
|
270
270
|
${N.map(([_,k])=>k).join(`
|
|
271
271
|
`)}`:"";return v.jsxs("div",{className:"whitespace-pre-wrap font-mono",children:[v.jsxs("span",{className:"text-gray-500",children:["[",C,"]"]})," ",v.jsxs("span",{className:R(w.level),children:[A,":"]})," ",v.jsx("span",{className:"text-white",children:w.msg}),v.jsx("span",{className:"text-gray-300",children:L})]},`${w.time}-${w.msg}`)};return v.jsxs("div",{className:"p-4",children:[v.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[v.jsx(n1,{title:"System Logs"}),v.jsxs("div",{className:"flex items-center gap-4",children:[!a&&v.jsx("button",{type:"button",onClick:x,className:"text-xs text-gray-400 hover:text-white transition-colors",children:"Resume auto-scroll"}),v.jsxs(F4,{value:t,onValueChange:r,children:[v.jsx(J1,{className:"w-32",children:v.jsx(Q4,{placeholder:"Select level"})}),v.jsxs(nR,{children:[v.jsx(Vm,{value:"all",children:"ALL"}),d==null?void 0:d.levels.map(w=>v.jsx(Vm,{value:w,children:w.toUpperCase()},w))]})]})]})]}),p?v.jsx("div",{className:"font-mono p-4",children:"Loading logs..."}):h?v.jsx("div",{className:"text-red-500 font-mono p-4",children:h instanceof Error?h.message:"Failed to fetch logs"}):v.jsx(v1,{className:"h-[600px] rounded-md border bg-black",children:v.jsx("div",{ref:o,onScroll:b,className:"p-4 text-sm space-y-1 h-full overflow-auto",children:(d==null?void 0:d.logs.length)===0?v.jsxs("div",{className:"text-gray-500 font-mono",children:["No ",t==="all"?"":t.toUpperCase()," ","logs found"]}):d==null?void 0:d.logs.map(w=>S(w))})})]})}var Pp="ToastProvider",[kp,e3,t3]=Ap("Toast"),[rR,kz]=Hn("Toast",[t3]),[n3,ju]=rR(Pp),aR=t=>{const{__scopeToast:r,label:a="Notification",duration:i=5e3,swipeDirection:o="right",swipeThreshold:c=50,children:f}=t,[d,h]=y.useState(null),[p,g]=y.useState(0),b=y.useRef(!1),x=y.useRef(!1);return a.trim()||console.error(`Invalid prop \`label\` supplied to \`${Pp}\`. Expected non-empty \`string\`.`),v.jsx(kp.Provider,{scope:r,children:v.jsx(n3,{scope:r,label:a,duration:i,swipeDirection:o,swipeThreshold:c,toastCount:p,viewport:d,onViewportChange:h,onToastAdd:y.useCallback(()=>g(E=>E+1),[]),onToastRemove:y.useCallback(()=>g(E=>E-1),[]),isFocusedToastEscapeKeyDownRef:b,isClosePausedRef:x,children:f})})};aR.displayName=Pp;var sR="ToastViewport",r3=["F8"],Ym="toast.viewportPause",Gm="toast.viewportResume",iR=y.forwardRef((t,r)=>{const{__scopeToast:a,hotkey:i=r3,label:o="Notifications ({hotkey})",...c}=t,f=ju(sR,a),d=e3(a),h=y.useRef(null),p=y.useRef(null),g=y.useRef(null),b=y.useRef(null),x=ke(r,b,f.onViewportChange),E=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=f.toastCount>0;y.useEffect(()=>{const w=C=>{var N;i.length!==0&&i.every(L=>C[L]||C.code===L)&&((N=b.current)==null||N.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),y.useEffect(()=>{const w=h.current,C=b.current;if(R&&w&&C){const A=()=>{if(!f.isClosePausedRef.current){const k=new CustomEvent(Ym);C.dispatchEvent(k),f.isClosePausedRef.current=!0}},N=()=>{if(f.isClosePausedRef.current){const k=new CustomEvent(Gm);C.dispatchEvent(k),f.isClosePausedRef.current=!1}},L=k=>{!w.contains(k.relatedTarget)&&N()},_=()=>{w.contains(document.activeElement)||N()};return w.addEventListener("focusin",A),w.addEventListener("focusout",L),w.addEventListener("pointermove",A),w.addEventListener("pointerleave",_),window.addEventListener("blur",A),window.addEventListener("focus",N),()=>{w.removeEventListener("focusin",A),w.removeEventListener("focusout",L),w.removeEventListener("pointermove",A),w.removeEventListener("pointerleave",_),window.removeEventListener("blur",A),window.removeEventListener("focus",N)}}},[R,f.isClosePausedRef]);const S=y.useCallback(({tabbingDirection:w})=>{const A=d().map(N=>{const L=N.ref.current,_=[L,...v3(L)];return w==="forwards"?_:_.reverse()});return(w==="forwards"?A.reverse():A).flat()},[d]);return y.useEffect(()=>{const w=b.current;if(w){const C=A=>{var _,k,I;const N=A.altKey||A.ctrlKey||A.metaKey;if(A.key==="Tab"&&!N){const Y=document.activeElement,H=A.shiftKey;if(A.target===w&&H){(_=p.current)==null||_.focus();return}const ne=S({tabbingDirection:H?"backwards":"forwards"}),ce=ne.findIndex($=>$===Y);gh(ne.slice(ce+1))?A.preventDefault():H?(k=p.current)==null||k.focus():(I=g.current)==null||I.focus()}};return w.addEventListener("keydown",C),()=>w.removeEventListener("keydown",C)}},[d,S]),v.jsxs(HN,{ref:h,role:"region","aria-label":o.replace("{hotkey}",E),tabIndex:-1,style:{pointerEvents:R?void 0:"none"},children:[R&&v.jsx(Fm,{ref:p,onFocusFromOutsideViewport:()=>{const w=S({tabbingDirection:"forwards"});gh(w)}}),v.jsx(kp.Slot,{scope:a,children:v.jsx(Se.ol,{tabIndex:-1,...c,ref:x})}),R&&v.jsx(Fm,{ref:g,onFocusFromOutsideViewport:()=>{const w=S({tabbingDirection:"backwards"});gh(w)}})]})});iR.displayName=sR;var lR="ToastFocusProxy",Fm=y.forwardRef((t,r)=>{const{__scopeToast:a,onFocusFromOutsideViewport:i,...o}=t,c=ju(lR,a);return v.jsx(to,{"aria-hidden":!0,tabIndex:0,...o,ref:r,style:{position:"fixed"},onFocus:f=>{var p;const d=f.relatedTarget;!((p=c.viewport)!=null&&p.contains(d))&&i()}})});Fm.displayName=lR;var Mu="Toast",a3="toast.swipeStart",s3="toast.swipeMove",i3="toast.swipeCancel",l3="toast.swipeEnd",oR=y.forwardRef((t,r)=>{const{forceMount:a,open:i,defaultOpen:o,onOpenChange:c,...f}=t,[d=!0,h]=rs({prop:i,defaultProp:o,onChange:c});return v.jsx(ln,{present:a||d,children:v.jsx(u3,{open:d,...f,ref:r,onClose:()=>h(!1),onPause:nt(t.onPause),onResume:nt(t.onResume),onSwipeStart:ge(t.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ge(t.onSwipeMove,p=>{const{x:g,y:b}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","move"),p.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${g}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${b}px`)}),onSwipeCancel:ge(t.onSwipeCancel,p=>{p.currentTarget.setAttribute("data-swipe","cancel"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ge(t.onSwipeEnd,p=>{const{x:g,y:b}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${g}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${b}px`),h(!1)})})})});oR.displayName=Mu;var[o3,c3]=rR(Mu,{onClose(){}}),u3=y.forwardRef((t,r)=>{const{__scopeToast:a,type:i="foreground",duration:o,open:c,onClose:f,onEscapeKeyDown:d,onPause:h,onResume:p,onSwipeStart:g,onSwipeMove:b,onSwipeCancel:x,onSwipeEnd:E,...R}=t,S=ju(Mu,a),[w,C]=y.useState(null),A=ke(r,$=>C($)),N=y.useRef(null),L=y.useRef(null),_=o||S.duration,k=y.useRef(0),I=y.useRef(_),Y=y.useRef(0),{onToastAdd:H,onToastRemove:K}=S,Z=nt(()=>{var U;(w==null?void 0:w.contains(document.activeElement))&&((U=S.viewport)==null||U.focus()),f()}),ne=y.useCallback($=>{!$||$===1/0||(window.clearTimeout(Y.current),k.current=new Date().getTime(),Y.current=window.setTimeout(Z,$))},[Z]);y.useEffect(()=>{const $=S.viewport;if($){const U=()=>{ne(I.current),p==null||p()},M=()=>{const q=new Date().getTime()-k.current;I.current=I.current-q,window.clearTimeout(Y.current),h==null||h()};return $.addEventListener(Ym,M),$.addEventListener(Gm,U),()=>{$.removeEventListener(Ym,M),$.removeEventListener(Gm,U)}}},[S.viewport,_,h,p,ne]),y.useEffect(()=>{c&&!S.isClosePausedRef.current&&ne(_)},[c,_,S.isClosePausedRef,ne]),y.useEffect(()=>(H(),()=>K()),[H,K]);const ce=y.useMemo(()=>w?pR(w):null,[w]);return S.viewport?v.jsxs(v.Fragment,{children:[ce&&v.jsx(f3,{__scopeToast:a,role:"status","aria-live":i==="foreground"?"assertive":"polite","aria-atomic":!0,children:ce}),v.jsx(o3,{scope:a,onClose:Z,children:Ei.createPortal(v.jsx(kp.ItemSlot,{scope:a,children:v.jsx($N,{asChild:!0,onEscapeKeyDown:ge(d,()=>{S.isFocusedToastEscapeKeyDownRef.current||Z(),S.isFocusedToastEscapeKeyDownRef.current=!1}),children:v.jsx(Se.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":S.swipeDirection,...R,ref:A,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:ge(t.onKeyDown,$=>{$.key==="Escape"&&(d==null||d($.nativeEvent),$.nativeEvent.defaultPrevented||(S.isFocusedToastEscapeKeyDownRef.current=!0,Z()))}),onPointerDown:ge(t.onPointerDown,$=>{$.button===0&&(N.current={x:$.clientX,y:$.clientY})}),onPointerMove:ge(t.onPointerMove,$=>{if(!N.current)return;const U=$.clientX-N.current.x,M=$.clientY-N.current.y,q=!!L.current,z=["left","right"].includes(S.swipeDirection),Q=["left","up"].includes(S.swipeDirection)?Math.min:Math.max,j=z?Q(0,U):0,G=z?0:Q(0,M),te=$.pointerType==="touch"?10:2,se={x:j,y:G},ae={originalEvent:$,delta:se};q?(L.current=se,jc(s3,b,ae,{discrete:!1})):q0(se,S.swipeDirection,te)?(L.current=se,jc(a3,g,ae,{discrete:!1}),$.target.setPointerCapture($.pointerId)):(Math.abs(U)>te||Math.abs(M)>te)&&(N.current=null)}),onPointerUp:ge(t.onPointerUp,$=>{const U=L.current,M=$.target;if(M.hasPointerCapture($.pointerId)&&M.releasePointerCapture($.pointerId),L.current=null,N.current=null,U){const q=$.currentTarget,z={originalEvent:$,delta:U};q0(U,S.swipeDirection,S.swipeThreshold)?jc(l3,E,z,{discrete:!0}):jc(i3,x,z,{discrete:!0}),q.addEventListener("click",Q=>Q.preventDefault(),{once:!0})}})})})}),S.viewport)})]}):null}),f3=t=>{const{__scopeToast:r,children:a,...i}=t,o=ju(Mu,r),[c,f]=y.useState(!1),[d,h]=y.useState(!1);return m3(()=>f(!0)),y.useEffect(()=>{const p=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(p)},[]),d?null:v.jsx(Jl,{asChild:!0,children:v.jsx(to,{...i,children:c&&v.jsxs(v.Fragment,{children:[o.label," ",a]})})})},d3="ToastTitle",cR=y.forwardRef((t,r)=>{const{__scopeToast:a,...i}=t;return v.jsx(Se.div,{...i,ref:r})});cR.displayName=d3;var h3="ToastDescription",uR=y.forwardRef((t,r)=>{const{__scopeToast:a,...i}=t;return v.jsx(Se.div,{...i,ref:r})});uR.displayName=h3;var fR="ToastAction",dR=y.forwardRef((t,r)=>{const{altText:a,...i}=t;return a.trim()?v.jsx(mR,{altText:a,asChild:!0,children:v.jsx(Up,{...i,ref:r})}):(console.error(`Invalid prop \`altText\` supplied to \`${fR}\`. Expected non-empty \`string\`.`),null)});dR.displayName=fR;var hR="ToastClose",Up=y.forwardRef((t,r)=>{const{__scopeToast:a,...i}=t,o=c3(hR,a);return v.jsx(mR,{asChild:!0,children:v.jsx(Se.button,{type:"button",...i,ref:r,onClick:ge(t.onClick,o.onClose)})})});Up.displayName=hR;var mR=y.forwardRef((t,r)=>{const{__scopeToast:a,altText:i,...o}=t;return v.jsx(Se.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":i||void 0,...o,ref:r})});function pR(t){const r=[];return Array.from(t.childNodes).forEach(i=>{if(i.nodeType===i.TEXT_NODE&&i.textContent&&r.push(i.textContent),p3(i)){const o=i.ariaHidden||i.hidden||i.style.display==="none",c=i.dataset.radixToastAnnounceExclude==="";if(!o)if(c){const f=i.dataset.radixToastAnnounceAlt;f&&r.push(f)}else r.push(...pR(i))}}),r}function jc(t,r,a,{discrete:i}){const o=a.originalEvent.currentTarget,c=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:a});r&&o.addEventListener(t,r,{once:!0}),i?iw(o,c):o.dispatchEvent(c)}var q0=(t,r,a=0)=>{const i=Math.abs(t.x),o=Math.abs(t.y),c=i>o;return r==="left"||r==="right"?c&&i>a:!c&&o>a};function m3(t=()=>{}){const r=nt(t);ft(()=>{let a=0,i=0;return a=window.requestAnimationFrame(()=>i=window.requestAnimationFrame(r)),()=>{window.cancelAnimationFrame(a),window.cancelAnimationFrame(i)}},[r])}function p3(t){return t.nodeType===t.ELEMENT_NODE}function v3(t){const r=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)r.push(a.currentNode);return r}function gh(t){const r=document.activeElement;return t.some(a=>a===r?!0:(a.focus(),document.activeElement!==r))}var g3=aR,vR=iR,gR=oR,yR=cR,bR=uR,xR=dR,wR=Up;const y3=g3,SR=y.forwardRef(({className:t,...r},a)=>v.jsx(vR,{ref:a,className:le("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...r}));SR.displayName=vR.displayName;const b3=pa("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ER=y.forwardRef(({className:t,variant:r,...a},i)=>v.jsx(gR,{ref:i,className:le(b3({variant:r}),t),...a}));ER.displayName=gR.displayName;const RR=y.forwardRef(({className:t,...r},a)=>v.jsx(xR,{ref:a,className:le("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...r}));RR.displayName=xR.displayName;const TR=y.forwardRef(({className:t,...r},a)=>v.jsx(wR,{ref:a,className:le("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...r,children:v.jsx(us,{className:"h-4 w-4"})}));TR.displayName=wR.displayName;const CR=y.forwardRef(({className:t,...r},a)=>v.jsx(yR,{ref:a,className:le("text-sm font-semibold [&+div]:text-xs",t),...r}));CR.displayName=yR.displayName;const AR=y.forwardRef(({className:t,...r},a)=>v.jsx(bR,{ref:a,className:le("text-sm opacity-90",t),...r}));AR.displayName=bR.displayName;function x3(){const{toasts:t}=Yn();return v.jsxs(y3,{children:[t.map(({id:r,title:a,description:i,action:o,...c})=>v.jsxs(ER,{...c,children:[v.jsxs("div",{className:"grid gap-1",children:[a&&v.jsx(CR,{children:a}),i&&v.jsx(AR,{children:i})]}),o,v.jsx(TR,{})]},r)),v.jsx(SR,{})]})}var Mc={exports:{}},yh,B0;function Du(){if(B0)return yh;B0=1;const t="2.0.0",r=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,o=r-6;return yh={MAX_LENGTH:r,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:o,MAX_SAFE_INTEGER:a,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},yh}var bh,I0;function _u(){if(I0)return bh;I0=1;var t={};return bh=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...a)=>console.error("SEMVER",...a):()=>{},bh}var V0;function oo(){return V0||(V0=1,function(t,r){const{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:o}=Du(),c=_u();r=t.exports={};const f=r.re=[],d=r.safeRe=[],h=r.src=[],p=r.safeSrc=[],g=r.t={};let b=0;const x="[a-zA-Z0-9-]",E=[["\\s",1],["\\d",o],[x,i]],R=w=>{for(const[C,A]of E)w=w.split(`${C}*`).join(`${C}{0,${A}}`).split(`${C}+`).join(`${C}{1,${A}}`);return w},S=(w,C,A)=>{const N=R(C),L=b++;c(w,L,C),g[w]=L,h[L]=C,p[L]=N,f[L]=new RegExp(C,A?"g":void 0),d[L]=new RegExp(N,A?"g":void 0)};S("NUMERICIDENTIFIER","0|[1-9]\\d*"),S("NUMERICIDENTIFIERLOOSE","\\d+"),S("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${x}*`),S("MAINVERSION",`(${h[g.NUMERICIDENTIFIER]})\\.(${h[g.NUMERICIDENTIFIER]})\\.(${h[g.NUMERICIDENTIFIER]})`),S("MAINVERSIONLOOSE",`(${h[g.NUMERICIDENTIFIERLOOSE]})\\.(${h[g.NUMERICIDENTIFIERLOOSE]})\\.(${h[g.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASEIDENTIFIER",`(?:${h[g.NUMERICIDENTIFIER]}|${h[g.NONNUMERICIDENTIFIER]})`),S("PRERELEASEIDENTIFIERLOOSE",`(?:${h[g.NUMERICIDENTIFIERLOOSE]}|${h[g.NONNUMERICIDENTIFIER]})`),S("PRERELEASE",`(?:-(${h[g.PRERELEASEIDENTIFIER]}(?:\\.${h[g.PRERELEASEIDENTIFIER]})*))`),S("PRERELEASELOOSE",`(?:-?(${h[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${h[g.PRERELEASEIDENTIFIERLOOSE]})*))`),S("BUILDIDENTIFIER",`${x}+`),S("BUILD",`(?:\\+(${h[g.BUILDIDENTIFIER]}(?:\\.${h[g.BUILDIDENTIFIER]})*))`),S("FULLPLAIN",`v?${h[g.MAINVERSION]}${h[g.PRERELEASE]}?${h[g.BUILD]}?`),S("FULL",`^${h[g.FULLPLAIN]}$`),S("LOOSEPLAIN",`[v=\\s]*${h[g.MAINVERSIONLOOSE]}${h[g.PRERELEASELOOSE]}?${h[g.BUILD]}?`),S("LOOSE",`^${h[g.LOOSEPLAIN]}$`),S("GTLT","((?:<|>)?=?)"),S("XRANGEIDENTIFIERLOOSE",`${h[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),S("XRANGEIDENTIFIER",`${h[g.NUMERICIDENTIFIER]}|x|X|\\*`),S("XRANGEPLAIN",`[v=\\s]*(${h[g.XRANGEIDENTIFIER]})(?:\\.(${h[g.XRANGEIDENTIFIER]})(?:\\.(${h[g.XRANGEIDENTIFIER]})(?:${h[g.PRERELEASE]})?${h[g.BUILD]}?)?)?`),S("XRANGEPLAINLOOSE",`[v=\\s]*(${h[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${h[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${h[g.XRANGEIDENTIFIERLOOSE]})(?:${h[g.PRERELEASELOOSE]})?${h[g.BUILD]}?)?)?`),S("XRANGE",`^${h[g.GTLT]}\\s*${h[g.XRANGEPLAIN]}$`),S("XRANGELOOSE",`^${h[g.GTLT]}\\s*${h[g.XRANGEPLAINLOOSE]}$`),S("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),S("COERCE",`${h[g.COERCEPLAIN]}(?:$|[^\\d])`),S("COERCEFULL",h[g.COERCEPLAIN]+`(?:${h[g.PRERELEASE]})?(?:${h[g.BUILD]})?(?:$|[^\\d])`),S("COERCERTL",h[g.COERCE],!0),S("COERCERTLFULL",h[g.COERCEFULL],!0),S("LONETILDE","(?:~>?)"),S("TILDETRIM",`(\\s*)${h[g.LONETILDE]}\\s+`,!0),r.tildeTrimReplace="$1~",S("TILDE",`^${h[g.LONETILDE]}${h[g.XRANGEPLAIN]}$`),S("TILDELOOSE",`^${h[g.LONETILDE]}${h[g.XRANGEPLAINLOOSE]}$`),S("LONECARET","(?:\\^)"),S("CARETTRIM",`(\\s*)${h[g.LONECARET]}\\s+`,!0),r.caretTrimReplace="$1^",S("CARET",`^${h[g.LONECARET]}${h[g.XRANGEPLAIN]}$`),S("CARETLOOSE",`^${h[g.LONECARET]}${h[g.XRANGEPLAINLOOSE]}$`),S("COMPARATORLOOSE",`^${h[g.GTLT]}\\s*(${h[g.LOOSEPLAIN]})$|^$`),S("COMPARATOR",`^${h[g.GTLT]}\\s*(${h[g.FULLPLAIN]})$|^$`),S("COMPARATORTRIM",`(\\s*)${h[g.GTLT]}\\s*(${h[g.LOOSEPLAIN]}|${h[g.XRANGEPLAIN]})`,!0),r.comparatorTrimReplace="$1$2$3",S("HYPHENRANGE",`^\\s*(${h[g.XRANGEPLAIN]})\\s+-\\s+(${h[g.XRANGEPLAIN]})\\s*$`),S("HYPHENRANGELOOSE",`^\\s*(${h[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${h[g.XRANGEPLAINLOOSE]})\\s*$`),S("STAR","(<|>)?=?\\s*\\*"),S("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),S("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Mc,Mc.exports)),Mc.exports}var xh,Y0;function $p(){if(Y0)return xh;Y0=1;const t=Object.freeze({loose:!0}),r=Object.freeze({});return xh=i=>i?typeof i!="object"?t:i:r,xh}var wh,G0;function NR(){if(G0)return wh;G0=1;const t=/^[0-9]+$/,r=(i,o)=>{const c=t.test(i),f=t.test(o);return c&&f&&(i=+i,o=+o),i===o?0:c&&!f?-1:f&&!c?1:i<o?-1:1};return wh={compareIdentifiers:r,rcompareIdentifiers:(i,o)=>r(o,i)},wh}var Sh,F0;function Ot(){if(F0)return Sh;F0=1;const t=_u(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:a}=Du(),{safeRe:i,safeSrc:o,t:c}=oo(),f=$p(),{compareIdentifiers:d}=NR();class h{constructor(g,b){if(b=f(b),g instanceof h){if(g.loose===!!b.loose&&g.includePrerelease===!!b.includePrerelease)return g;g=g.version}else if(typeof g!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof g}".`);if(g.length>r)throw new TypeError(`version is longer than ${r} characters`);t("SemVer",g,b),this.options=b,this.loose=!!b.loose,this.includePrerelease=!!b.includePrerelease;const x=g.trim().match(b.loose?i[c.LOOSE]:i[c.FULL]);if(!x)throw new TypeError(`Invalid Version: ${g}`);if(this.raw=g,this.major=+x[1],this.minor=+x[2],this.patch=+x[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");x[4]?this.prerelease=x[4].split(".").map(E=>{if(/^[0-9]+$/.test(E)){const R=+E;if(R>=0&&R<a)return R}return E}):this.prerelease=[],this.build=x[5]?x[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(g){if(t("SemVer.compare",this.version,this.options,g),!(g instanceof h)){if(typeof g=="string"&&g===this.version)return 0;g=new h(g,this.options)}return g.version===this.version?0:this.compareMain(g)||this.comparePre(g)}compareMain(g){return g instanceof h||(g=new h(g,this.options)),d(this.major,g.major)||d(this.minor,g.minor)||d(this.patch,g.patch)}comparePre(g){if(g instanceof h||(g=new h(g,this.options)),this.prerelease.length&&!g.prerelease.length)return-1;if(!this.prerelease.length&&g.prerelease.length)return 1;if(!this.prerelease.length&&!g.prerelease.length)return 0;let b=0;do{const x=this.prerelease[b],E=g.prerelease[b];if(t("prerelease compare",b,x,E),x===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(x===void 0)return-1;if(x===E)continue;return d(x,E)}while(++b)}compareBuild(g){g instanceof h||(g=new h(g,this.options));let b=0;do{const x=this.build[b],E=g.build[b];if(t("build compare",b,x,E),x===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(x===void 0)return-1;if(x===E)continue;return d(x,E)}while(++b)}inc(g,b,x){if(g.startsWith("pre")){if(!b&&x===!1)throw new Error("invalid increment argument: identifier is empty");if(b){const E=new RegExp(`^${this.options.loose?o[c.PRERELEASELOOSE]:o[c.PRERELEASE]}$`),R=`-${b}`.match(E);if(!R||R[1]!==b)throw new Error(`invalid identifier: ${b}`)}}switch(g){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",b,x);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",b,x);break;case"prepatch":this.prerelease.length=0,this.inc("patch",b,x),this.inc("pre",b,x);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",b,x),this.inc("pre",b,x);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const E=Number(x)?1:0;if(this.prerelease.length===0)this.prerelease=[E];else{let R=this.prerelease.length;for(;--R>=0;)typeof this.prerelease[R]=="number"&&(this.prerelease[R]++,R=-2);if(R===-1){if(b===this.prerelease.join(".")&&x===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(E)}}if(b){let R=[b,E];x===!1&&(R=[b]),d(this.prerelease[0],b)===0?isNaN(this.prerelease[1])&&(this.prerelease=R):this.prerelease=R}break}default:throw new Error(`invalid increment argument: ${g}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Sh=h,Sh}var Eh,Q0;function Mi(){if(Q0)return Eh;Q0=1;const t=Ot();return Eh=(a,i,o=!1)=>{if(a instanceof t)return a;try{return new t(a,i)}catch(c){if(!o)return null;throw c}},Eh}var Rh,X0;function w3(){if(X0)return Rh;X0=1;const t=Mi();return Rh=(a,i)=>{const o=t(a,i);return o?o.version:null},Rh}var Th,W0;function S3(){if(W0)return Th;W0=1;const t=Mi();return Th=(a,i)=>{const o=t(a.trim().replace(/^[=v]+/,""),i);return o?o.version:null},Th}var Ch,K0;function E3(){if(K0)return Ch;K0=1;const t=Ot();return Ch=(a,i,o,c,f)=>{typeof o=="string"&&(f=c,c=o,o=void 0);try{return new t(a instanceof t?a.version:a,o).inc(i,c,f).version}catch{return null}},Ch}var Ah,Z0;function R3(){if(Z0)return Ah;Z0=1;const t=Mi();return Ah=(a,i)=>{const o=t(a,null,!0),c=t(i,null,!0),f=o.compare(c);if(f===0)return null;const d=f>0,h=d?o:c,p=d?c:o,g=!!h.prerelease.length;if(!!p.prerelease.length&&!g){if(!p.patch&&!p.minor)return"major";if(p.compareMain(h)===0)return p.minor&&!p.patch?"minor":"patch"}const x=g?"pre":"";return o.major!==c.major?x+"major":o.minor!==c.minor?x+"minor":o.patch!==c.patch?x+"patch":"prerelease"},Ah}var Nh,J0;function T3(){if(J0)return Nh;J0=1;const t=Ot();return Nh=(a,i)=>new t(a,i).major,Nh}var Oh,ex;function C3(){if(ex)return Oh;ex=1;const t=Ot();return Oh=(a,i)=>new t(a,i).minor,Oh}var jh,tx;function A3(){if(tx)return jh;tx=1;const t=Ot();return jh=(a,i)=>new t(a,i).patch,jh}var Mh,nx;function N3(){if(nx)return Mh;nx=1;const t=Mi();return Mh=(a,i)=>{const o=t(a,i);return o&&o.prerelease.length?o.prerelease:null},Mh}var Dh,rx;function Sn(){if(rx)return Dh;rx=1;const t=Ot();return Dh=(a,i,o)=>new t(a,o).compare(new t(i,o)),Dh}var _h,ax;function O3(){if(ax)return _h;ax=1;const t=Sn();return _h=(a,i,o)=>t(i,a,o),_h}var Lh,sx;function j3(){if(sx)return Lh;sx=1;const t=Sn();return Lh=(a,i)=>t(a,i,!0),Lh}var zh,ix;function Hp(){if(ix)return zh;ix=1;const t=Ot();return zh=(a,i,o)=>{const c=new t(a,o),f=new t(i,o);return c.compare(f)||c.compareBuild(f)},zh}var Ph,lx;function M3(){if(lx)return Ph;lx=1;const t=Hp();return Ph=(a,i)=>a.sort((o,c)=>t(o,c,i)),Ph}var kh,ox;function D3(){if(ox)return kh;ox=1;const t=Hp();return kh=(a,i)=>a.sort((o,c)=>t(c,o,i)),kh}var Uh,cx;function Lu(){if(cx)return Uh;cx=1;const t=Sn();return Uh=(a,i,o)=>t(a,i,o)>0,Uh}var $h,ux;function qp(){if(ux)return $h;ux=1;const t=Sn();return $h=(a,i,o)=>t(a,i,o)<0,$h}var Hh,fx;function OR(){if(fx)return Hh;fx=1;const t=Sn();return Hh=(a,i,o)=>t(a,i,o)===0,Hh}var qh,dx;function jR(){if(dx)return qh;dx=1;const t=Sn();return qh=(a,i,o)=>t(a,i,o)!==0,qh}var Bh,hx;function Bp(){if(hx)return Bh;hx=1;const t=Sn();return Bh=(a,i,o)=>t(a,i,o)>=0,Bh}var Ih,mx;function Ip(){if(mx)return Ih;mx=1;const t=Sn();return Ih=(a,i,o)=>t(a,i,o)<=0,Ih}var Vh,px;function MR(){if(px)return Vh;px=1;const t=OR(),r=jR(),a=Lu(),i=Bp(),o=qp(),c=Ip();return Vh=(d,h,p,g)=>{switch(h){case"===":return typeof d=="object"&&(d=d.version),typeof p=="object"&&(p=p.version),d===p;case"!==":return typeof d=="object"&&(d=d.version),typeof p=="object"&&(p=p.version),d!==p;case"":case"=":case"==":return t(d,p,g);case"!=":return r(d,p,g);case">":return a(d,p,g);case">=":return i(d,p,g);case"<":return o(d,p,g);case"<=":return c(d,p,g);default:throw new TypeError(`Invalid operator: ${h}`)}},Vh}var Yh,vx;function _3(){if(vx)return Yh;vx=1;const t=Ot(),r=Mi(),{safeRe:a,t:i}=oo();return Yh=(c,f)=>{if(c instanceof t)return c;if(typeof c=="number"&&(c=String(c)),typeof c!="string")return null;f=f||{};let d=null;if(!f.rtl)d=c.match(f.includePrerelease?a[i.COERCEFULL]:a[i.COERCE]);else{const E=f.includePrerelease?a[i.COERCERTLFULL]:a[i.COERCERTL];let R;for(;(R=E.exec(c))&&(!d||d.index+d[0].length!==c.length);)(!d||R.index+R[0].length!==d.index+d[0].length)&&(d=R),E.lastIndex=R.index+R[1].length+R[2].length;E.lastIndex=-1}if(d===null)return null;const h=d[2],p=d[3]||"0",g=d[4]||"0",b=f.includePrerelease&&d[5]?`-${d[5]}`:"",x=f.includePrerelease&&d[6]?`+${d[6]}`:"";return r(`${h}.${p}.${g}${b}${x}`,f)},Yh}var Gh,gx;function L3(){if(gx)return Gh;gx=1;class t{constructor(){this.max=1e3,this.map=new Map}get(a){const i=this.map.get(a);if(i!==void 0)return this.map.delete(a),this.map.set(a,i),i}delete(a){return this.map.delete(a)}set(a,i){if(!this.delete(a)&&i!==void 0){if(this.map.size>=this.max){const c=this.map.keys().next().value;this.delete(c)}this.map.set(a,i)}return this}}return Gh=t,Gh}var Fh,yx;function En(){if(yx)return Fh;yx=1;const t=/\s+/g;class r{constructor(U,M){if(M=o(M),U instanceof r)return U.loose===!!M.loose&&U.includePrerelease===!!M.includePrerelease?U:new r(U.raw,M);if(U instanceof c)return this.raw=U.value,this.set=[[U]],this.formatted=void 0,this;if(this.options=M,this.loose=!!M.loose,this.includePrerelease=!!M.includePrerelease,this.raw=U.trim().replace(t," "),this.set=this.raw.split("||").map(q=>this.parseRange(q.trim())).filter(q=>q.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const q=this.set[0];if(this.set=this.set.filter(z=>!S(z[0])),this.set.length===0)this.set=[q];else if(this.set.length>1){for(const z of this.set)if(z.length===1&&w(z[0])){this.set=[z];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let U=0;U<this.set.length;U++){U>0&&(this.formatted+="||");const M=this.set[U];for(let q=0;q<M.length;q++)q>0&&(this.formatted+=" "),this.formatted+=M[q].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(U){const q=((this.options.includePrerelease&&E)|(this.options.loose&&R))+":"+U,z=i.get(q);if(z)return z;const Q=this.options.loose,j=Q?h[p.HYPHENRANGELOOSE]:h[p.HYPHENRANGE];U=U.replace(j,ne(this.options.includePrerelease)),f("hyphen replace",U),U=U.replace(h[p.COMPARATORTRIM],g),f("comparator trim",U),U=U.replace(h[p.TILDETRIM],b),f("tilde trim",U),U=U.replace(h[p.CARETTRIM],x),f("caret trim",U);let G=U.split(" ").map(oe=>A(oe,this.options)).join(" ").split(/\s+/).map(oe=>Z(oe,this.options));Q&&(G=G.filter(oe=>(f("loose invalid filter",oe,this.options),!!oe.match(h[p.COMPARATORLOOSE])))),f("range list",G);const te=new Map,se=G.map(oe=>new c(oe,this.options));for(const oe of se){if(S(oe))return[oe];te.set(oe.value,oe)}te.size>1&&te.has("")&&te.delete("");const ae=[...te.values()];return i.set(q,ae),ae}intersects(U,M){if(!(U instanceof r))throw new TypeError("a Range is required");return this.set.some(q=>C(q,M)&&U.set.some(z=>C(z,M)&&q.every(Q=>z.every(j=>Q.intersects(j,M)))))}test(U){if(!U)return!1;if(typeof U=="string")try{U=new d(U,this.options)}catch{return!1}for(let M=0;M<this.set.length;M++)if(ce(this.set[M],U,this.options))return!0;return!1}}Fh=r;const a=L3(),i=new a,o=$p(),c=zu(),f=_u(),d=Ot(),{safeRe:h,t:p,comparatorTrimReplace:g,tildeTrimReplace:b,caretTrimReplace:x}=oo(),{FLAG_INCLUDE_PRERELEASE:E,FLAG_LOOSE:R}=Du(),S=$=>$.value==="<0.0.0-0",w=$=>$.value==="",C=($,U)=>{let M=!0;const q=$.slice();let z=q.pop();for(;M&&q.length;)M=q.every(Q=>z.intersects(Q,U)),z=q.pop();return M},A=($,U)=>(f("comp",$,U),$=k($,U),f("caret",$),$=L($,U),f("tildes",$),$=Y($,U),f("xrange",$),$=K($,U),f("stars",$),$),N=$=>!$||$.toLowerCase()==="x"||$==="*",L=($,U)=>$.trim().split(/\s+/).map(M=>_(M,U)).join(" "),_=($,U)=>{const M=U.loose?h[p.TILDELOOSE]:h[p.TILDE];return $.replace(M,(q,z,Q,j,G)=>{f("tilde",$,q,z,Q,j,G);let te;return N(z)?te="":N(Q)?te=`>=${z}.0.0 <${+z+1}.0.0-0`:N(j)?te=`>=${z}.${Q}.0 <${z}.${+Q+1}.0-0`:G?(f("replaceTilde pr",G),te=`>=${z}.${Q}.${j}-${G} <${z}.${+Q+1}.0-0`):te=`>=${z}.${Q}.${j} <${z}.${+Q+1}.0-0`,f("tilde return",te),te})},k=($,U)=>$.trim().split(/\s+/).map(M=>I(M,U)).join(" "),I=($,U)=>{f("caret",$,U);const M=U.loose?h[p.CARETLOOSE]:h[p.CARET],q=U.includePrerelease?"-0":"";return $.replace(M,(z,Q,j,G,te)=>{f("caret",$,z,Q,j,G,te);let se;return N(Q)?se="":N(j)?se=`>=${Q}.0.0${q} <${+Q+1}.0.0-0`:N(G)?Q==="0"?se=`>=${Q}.${j}.0${q} <${Q}.${+j+1}.0-0`:se=`>=${Q}.${j}.0${q} <${+Q+1}.0.0-0`:te?(f("replaceCaret pr",te),Q==="0"?j==="0"?se=`>=${Q}.${j}.${G}-${te} <${Q}.${j}.${+G+1}-0`:se=`>=${Q}.${j}.${G}-${te} <${Q}.${+j+1}.0-0`:se=`>=${Q}.${j}.${G}-${te} <${+Q+1}.0.0-0`):(f("no pr"),Q==="0"?j==="0"?se=`>=${Q}.${j}.${G}${q} <${Q}.${j}.${+G+1}-0`:se=`>=${Q}.${j}.${G}${q} <${Q}.${+j+1}.0-0`:se=`>=${Q}.${j}.${G} <${+Q+1}.0.0-0`),f("caret return",se),se})},Y=($,U)=>(f("replaceXRanges",$,U),$.split(/\s+/).map(M=>H(M,U)).join(" ")),H=($,U)=>{$=$.trim();const M=U.loose?h[p.XRANGELOOSE]:h[p.XRANGE];return $.replace(M,(q,z,Q,j,G,te)=>{f("xRange",$,q,z,Q,j,G,te);const se=N(Q),ae=se||N(j),oe=ae||N(G),pe=oe;return z==="="&&pe&&(z=""),te=U.includePrerelease?"-0":"",se?z===">"||z==="<"?q="<0.0.0-0":q="*":z&&pe?(ae&&(j=0),G=0,z===">"?(z=">=",ae?(Q=+Q+1,j=0,G=0):(j=+j+1,G=0)):z==="<="&&(z="<",ae?Q=+Q+1:j=+j+1),z==="<"&&(te="-0"),q=`${z+Q}.${j}.${G}${te}`):ae?q=`>=${Q}.0.0${te} <${+Q+1}.0.0-0`:oe&&(q=`>=${Q}.${j}.0${te} <${Q}.${+j+1}.0-0`),f("xRange return",q),q})},K=($,U)=>(f("replaceStars",$,U),$.trim().replace(h[p.STAR],"")),Z=($,U)=>(f("replaceGTE0",$,U),$.trim().replace(h[U.includePrerelease?p.GTE0PRE:p.GTE0],"")),ne=$=>(U,M,q,z,Q,j,G,te,se,ae,oe,pe)=>(N(q)?M="":N(z)?M=`>=${q}.0.0${$?"-0":""}`:N(Q)?M=`>=${q}.${z}.0${$?"-0":""}`:j?M=`>=${M}`:M=`>=${M}${$?"-0":""}`,N(se)?te="":N(ae)?te=`<${+se+1}.0.0-0`:N(oe)?te=`<${se}.${+ae+1}.0-0`:pe?te=`<=${se}.${ae}.${oe}-${pe}`:$?te=`<${se}.${ae}.${+oe+1}-0`:te=`<=${te}`,`${M} ${te}`.trim()),ce=($,U,M)=>{for(let q=0;q<$.length;q++)if(!$[q].test(U))return!1;if(U.prerelease.length&&!M.includePrerelease){for(let q=0;q<$.length;q++)if(f($[q].semver),$[q].semver!==c.ANY&&$[q].semver.prerelease.length>0){const z=$[q].semver;if(z.major===U.major&&z.minor===U.minor&&z.patch===U.patch)return!0}return!1}return!0};return Fh}var Qh,bx;function zu(){if(bx)return Qh;bx=1;const t=Symbol("SemVer ANY");class r{static get ANY(){return t}constructor(g,b){if(b=a(b),g instanceof r){if(g.loose===!!b.loose)return g;g=g.value}g=g.trim().split(/\s+/).join(" "),f("comparator",g,b),this.options=b,this.loose=!!b.loose,this.parse(g),this.semver===t?this.value="":this.value=this.operator+this.semver.version,f("comp",this)}parse(g){const b=this.options.loose?i[o.COMPARATORLOOSE]:i[o.COMPARATOR],x=g.match(b);if(!x)throw new TypeError(`Invalid comparator: ${g}`);this.operator=x[1]!==void 0?x[1]:"",this.operator==="="&&(this.operator=""),x[2]?this.semver=new d(x[2],this.options.loose):this.semver=t}toString(){return this.value}test(g){if(f("Comparator.test",g,this.options.loose),this.semver===t||g===t)return!0;if(typeof g=="string")try{g=new d(g,this.options)}catch{return!1}return c(g,this.operator,this.semver,this.options)}intersects(g,b){if(!(g instanceof r))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new h(g.value,b).test(this.value):g.operator===""?g.value===""?!0:new h(this.value,b).test(g.semver):(b=a(b),b.includePrerelease&&(this.value==="<0.0.0-0"||g.value==="<0.0.0-0")||!b.includePrerelease&&(this.value.startsWith("<0.0.0")||g.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&g.operator.startsWith(">")||this.operator.startsWith("<")&&g.operator.startsWith("<")||this.semver.version===g.semver.version&&this.operator.includes("=")&&g.operator.includes("=")||c(this.semver,"<",g.semver,b)&&this.operator.startsWith(">")&&g.operator.startsWith("<")||c(this.semver,">",g.semver,b)&&this.operator.startsWith("<")&&g.operator.startsWith(">")))}}Qh=r;const a=$p(),{safeRe:i,t:o}=oo(),c=MR(),f=_u(),d=Ot(),h=En();return Qh}var Xh,xx;function Pu(){if(xx)return Xh;xx=1;const t=En();return Xh=(a,i,o)=>{try{i=new t(i,o)}catch{return!1}return i.test(a)},Xh}var Wh,wx;function z3(){if(wx)return Wh;wx=1;const t=En();return Wh=(a,i)=>new t(a,i).set.map(o=>o.map(c=>c.value).join(" ").trim().split(" ")),Wh}var Kh,Sx;function P3(){if(Sx)return Kh;Sx=1;const t=Ot(),r=En();return Kh=(i,o,c)=>{let f=null,d=null,h=null;try{h=new r(o,c)}catch{return null}return i.forEach(p=>{h.test(p)&&(!f||d.compare(p)===-1)&&(f=p,d=new t(f,c))}),f},Kh}var Zh,Ex;function k3(){if(Ex)return Zh;Ex=1;const t=Ot(),r=En();return Zh=(i,o,c)=>{let f=null,d=null,h=null;try{h=new r(o,c)}catch{return null}return i.forEach(p=>{h.test(p)&&(!f||d.compare(p)===1)&&(f=p,d=new t(f,c))}),f},Zh}var Jh,Rx;function U3(){if(Rx)return Jh;Rx=1;const t=Ot(),r=En(),a=Lu();return Jh=(o,c)=>{o=new r(o,c);let f=new t("0.0.0");if(o.test(f)||(f=new t("0.0.0-0"),o.test(f)))return f;f=null;for(let d=0;d<o.set.length;++d){const h=o.set[d];let p=null;h.forEach(g=>{const b=new t(g.semver.version);switch(g.operator){case">":b.prerelease.length===0?b.patch++:b.prerelease.push(0),b.raw=b.format();case"":case">=":(!p||a(b,p))&&(p=b);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${g.operator}`)}}),p&&(!f||a(f,p))&&(f=p)}return f&&o.test(f)?f:null},Jh}var em,Tx;function $3(){if(Tx)return em;Tx=1;const t=En();return em=(a,i)=>{try{return new t(a,i).range||"*"}catch{return null}},em}var tm,Cx;function Vp(){if(Cx)return tm;Cx=1;const t=Ot(),r=zu(),{ANY:a}=r,i=En(),o=Pu(),c=Lu(),f=qp(),d=Ip(),h=Bp();return tm=(g,b,x,E)=>{g=new t(g,E),b=new i(b,E);let R,S,w,C,A;switch(x){case">":R=c,S=d,w=f,C=">",A=">=";break;case"<":R=f,S=h,w=c,C="<",A="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(g,b,E))return!1;for(let N=0;N<b.set.length;++N){const L=b.set[N];let _=null,k=null;if(L.forEach(I=>{I.semver===a&&(I=new r(">=0.0.0")),_=_||I,k=k||I,R(I.semver,_.semver,E)?_=I:w(I.semver,k.semver,E)&&(k=I)}),_.operator===C||_.operator===A||(!k.operator||k.operator===C)&&S(g,k.semver))return!1;if(k.operator===A&&w(g,k.semver))return!1}return!0},tm}var nm,Ax;function H3(){if(Ax)return nm;Ax=1;const t=Vp();return nm=(a,i,o)=>t(a,i,">",o),nm}var rm,Nx;function q3(){if(Nx)return rm;Nx=1;const t=Vp();return rm=(a,i,o)=>t(a,i,"<",o),rm}var am,Ox;function B3(){if(Ox)return am;Ox=1;const t=En();return am=(a,i,o)=>(a=new t(a,o),i=new t(i,o),a.intersects(i,o)),am}var sm,jx;function I3(){if(jx)return sm;jx=1;const t=Pu(),r=Sn();return sm=(a,i,o)=>{const c=[];let f=null,d=null;const h=a.sort((x,E)=>r(x,E,o));for(const x of h)t(x,i,o)?(d=x,f||(f=x)):(d&&c.push([f,d]),d=null,f=null);f&&c.push([f,null]);const p=[];for(const[x,E]of c)x===E?p.push(x):!E&&x===h[0]?p.push("*"):E?x===h[0]?p.push(`<=${E}`):p.push(`${x} - ${E}`):p.push(`>=${x}`);const g=p.join(" || "),b=typeof i.raw=="string"?i.raw:String(i);return g.length<b.length?g:i},sm}var im,Mx;function V3(){if(Mx)return im;Mx=1;const t=En(),r=zu(),{ANY:a}=r,i=Pu(),o=Sn(),c=(b,x,E={})=>{if(b===x)return!0;b=new t(b,E),x=new t(x,E);let R=!1;e:for(const S of b.set){for(const w of x.set){const C=h(S,w,E);if(R=R||C!==null,C)continue e}if(R)return!1}return!0},f=[new r(">=0.0.0-0")],d=[new r(">=0.0.0")],h=(b,x,E)=>{if(b===x)return!0;if(b.length===1&&b[0].semver===a){if(x.length===1&&x[0].semver===a)return!0;E.includePrerelease?b=f:b=d}if(x.length===1&&x[0].semver===a){if(E.includePrerelease)return!0;x=d}const R=new Set;let S,w;for(const Y of b)Y.operator===">"||Y.operator===">="?S=p(S,Y,E):Y.operator==="<"||Y.operator==="<="?w=g(w,Y,E):R.add(Y.semver);if(R.size>1)return null;let C;if(S&&w){if(C=o(S.semver,w.semver,E),C>0)return null;if(C===0&&(S.operator!==">="||w.operator!=="<="))return null}for(const Y of R){if(S&&!i(Y,String(S),E)||w&&!i(Y,String(w),E))return null;for(const H of x)if(!i(Y,String(H),E))return!1;return!0}let A,N,L,_,k=w&&!E.includePrerelease&&w.semver.prerelease.length?w.semver:!1,I=S&&!E.includePrerelease&&S.semver.prerelease.length?S.semver:!1;k&&k.prerelease.length===1&&w.operator==="<"&&k.prerelease[0]===0&&(k=!1);for(const Y of x){if(_=_||Y.operator===">"||Y.operator===">=",L=L||Y.operator==="<"||Y.operator==="<=",S){if(I&&Y.semver.prerelease&&Y.semver.prerelease.length&&Y.semver.major===I.major&&Y.semver.minor===I.minor&&Y.semver.patch===I.patch&&(I=!1),Y.operator===">"||Y.operator===">="){if(A=p(S,Y,E),A===Y&&A!==S)return!1}else if(S.operator===">="&&!i(S.semver,String(Y),E))return!1}if(w){if(k&&Y.semver.prerelease&&Y.semver.prerelease.length&&Y.semver.major===k.major&&Y.semver.minor===k.minor&&Y.semver.patch===k.patch&&(k=!1),Y.operator==="<"||Y.operator==="<="){if(N=g(w,Y,E),N===Y&&N!==w)return!1}else if(w.operator==="<="&&!i(w.semver,String(Y),E))return!1}if(!Y.operator&&(w||S)&&C!==0)return!1}return!(S&&L&&!w&&C!==0||w&&_&&!S&&C!==0||I||k)},p=(b,x,E)=>{if(!b)return x;const R=o(b.semver,x.semver,E);return R>0?b:R<0||x.operator===">"&&b.operator===">="?x:b},g=(b,x,E)=>{if(!b)return x;const R=o(b.semver,x.semver,E);return R<0?b:R>0||x.operator==="<"&&b.operator==="<="?x:b};return im=c,im}var lm,Dx;function Y3(){if(Dx)return lm;Dx=1;const t=oo(),r=Du(),a=Ot(),i=NR(),o=Mi(),c=w3(),f=S3(),d=E3(),h=R3(),p=T3(),g=C3(),b=A3(),x=N3(),E=Sn(),R=O3(),S=j3(),w=Hp(),C=M3(),A=D3(),N=Lu(),L=qp(),_=OR(),k=jR(),I=Bp(),Y=Ip(),H=MR(),K=_3(),Z=zu(),ne=En(),ce=Pu(),$=z3(),U=P3(),M=k3(),q=U3(),z=$3(),Q=Vp(),j=H3(),G=q3(),te=B3(),se=I3(),ae=V3();return lm={parse:o,valid:c,clean:f,inc:d,diff:h,major:p,minor:g,patch:b,prerelease:x,compare:E,rcompare:R,compareLoose:S,compareBuild:w,sort:C,rsort:A,gt:N,lt:L,eq:_,neq:k,gte:I,lte:Y,cmp:H,coerce:K,Comparator:Z,Range:ne,satisfies:ce,toComparators:$,maxSatisfying:U,minSatisfying:M,minVersion:q,validRange:z,outside:Q,gtr:j,ltr:G,intersects:te,simplifyRange:se,subset:ae,SemVer:a,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:i.compareIdentifiers,rcompareIdentifiers:i.rcompareIdentifiers},lm}var G3=Y3();const F3=cs(G3);function Q3(){const{toast:t}=Yn();async function r(i){const o=`https://api.github.com/repos/${i}/releases/latest`;try{const c=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"fetch-latest-release"}});if(!c.ok)throw new Error(`Failed to fetch latest release: ${c.status} ${c.statusText}`);return(await c.json()).tag_name}catch{}}const a=async()=>{try{const i=await r("elizaos/eliza"),o=si==null?void 0:si.version;i&&o&&F3.gt(i.replace("v",""),o.replace("v",""))&&t({variant:"default",title:`New version ${i} is available.`,description:"Visit GitHub for more information.",action:v.jsx(Ya,{to:"https://github.com/elizaos/eliza/releases",target:"_blank",children:v.jsx(RR,{altText:"Update",children:"Update"})})})}catch(i){console.error(`Unable to retrieve latest version from GitHub: ${i}`)}};return y.useEffect(()=>{a()},[a]),null}var Yp="Avatar",[X3,Uz]=Hn(Yp),[W3,DR]=X3(Yp),_R=y.forwardRef((t,r)=>{const{__scopeAvatar:a,...i}=t,[o,c]=y.useState("idle");return v.jsx(W3,{scope:a,imageLoadingStatus:o,onImageLoadingStatusChange:c,children:v.jsx(Se.span,{...i,ref:r})})});_R.displayName=Yp;var LR="AvatarImage",zR=y.forwardRef((t,r)=>{const{__scopeAvatar:a,src:i,onLoadingStatusChange:o=()=>{},...c}=t,f=DR(LR,a),d=K3(i,c.referrerPolicy),h=nt(p=>{o(p),f.onImageLoadingStatusChange(p)});return ft(()=>{d!=="idle"&&h(d)},[d,h]),d==="loaded"?v.jsx(Se.img,{...c,ref:r,src:i}):null});zR.displayName=LR;var PR="AvatarFallback",kR=y.forwardRef((t,r)=>{const{__scopeAvatar:a,delayMs:i,...o}=t,c=DR(PR,a),[f,d]=y.useState(i===void 0);return y.useEffect(()=>{if(i!==void 0){const h=window.setTimeout(()=>d(!0),i);return()=>window.clearTimeout(h)}},[i]),f&&c.imageLoadingStatus!=="loaded"?v.jsx(Se.span,{...o,ref:r}):null});kR.displayName=PR;function K3(t,r){const[a,i]=y.useState("idle");return ft(()=>{if(!t){i("error");return}let o=!0;const c=new window.Image,f=d=>()=>{o&&i(d)};return i("loading"),c.onload=f("loaded"),c.onerror=f("error"),c.src=t,r&&(c.referrerPolicy=r),()=>{o=!1}},[t,r]),a}var UR=_R,$R=zR,HR=kR;const Qm=y.forwardRef(({className:t,...r},a)=>v.jsx(UR,{ref:a,className:le("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-md",t),...r}));Qm.displayName=UR.displayName;const Xm=y.forwardRef(({className:t,...r},a)=>v.jsx($R,{ref:a,className:le("aspect-square h-full w-full",t),...r}));Xm.displayName=$R.displayName;const qR=y.forwardRef(({className:t,...r},a)=>v.jsx(HR,{ref:a,className:le("flex h-full w-full items-center justify-center rounded-md bg-muted",t),...r}));qR.displayName=HR.displayName;function Z3(){return v.jsxs("svg",{role:"img","aria-label":"Loading animation",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground",children:[v.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:v.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),v.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:v.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),v.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:v.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}const J3=pa("flex gap-2 max-w-[60%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),BR=y.forwardRef(({className:t,variant:r,layout:a,children:i,...o},c)=>v.jsx("div",{className:le(J3({variant:r,layout:a,className:t}),"relative group"),ref:c,...o,children:y.Children.map(i,f=>y.isValidElement(f)&&typeof f.type!="string"&&f.type!==y.Fragment?y.cloneElement(f,{variant:r,layout:a}):f)}));BR.displayName="ChatBubble";const ez=pa("p-4",{variants:{variant:{received:"bg-secondary text-secondary-foreground rounded-lg rounded-bl-none",sent:"bg-primary text-primary-foreground rounded-lg rounded-br-none"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),IR=y.forwardRef(({className:t,variant:r,layout:a,isLoading:i=!1,children:o,...c},f)=>v.jsx("div",{className:le(ez({variant:r,layout:a,className:t}),"break-words max-w-full whitespace-pre-wrap"),ref:f,...c,children:i?v.jsx("div",{className:"flex items-center space-x-2",children:v.jsx(Z3,{})}):o}));IR.displayName="ChatBubbleMessage";const tz=({timestamp:t,className:r,...a})=>v.jsx("div",{className:le("text-xs text-right select-none",r),...a,children:t}),nz=y.forwardRef(({variant:t,className:r,children:a,...i},o)=>v.jsx("div",{ref:o,className:le("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",t==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",r),...i,children:a}));nz.displayName="ChatBubbleActionWrapper";const VR=y.forwardRef(({className:t,...r},a)=>v.jsx(jp,{autoComplete:"off",ref:a,name:"message",className:le("max-h-12 px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",t),...r}));VR.displayName="ChatInput";const YR=y.forwardRef(({className:t,children:r,scrollRef:a,isAtBottom:i,scrollToBottom:o,disableAutoScroll:c,...f},d)=>v.jsxs("div",{className:"relative w-full h-full",children:[v.jsx("div",{className:`flex flex-col w-full h-full p-4 overflow-y-auto ${t}`,ref:a,onWheel:c,onTouchMove:c,...f,children:v.jsx("div",{className:"flex flex-col gap-6",children:r})}),!i&&v.jsx(Ie,{onClick:()=>{o()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 transform -translate-x-1/2 inline-flex rounded-full shadow-md",children:v.jsx(WO,{className:"h-4 w-4"})})]}));YR.displayName="ChatMessageList";var om={exports:{}},_x;function rz(){return _x||(_x=1,function(t){var r=Object.prototype.hasOwnProperty,a="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(a=!1));function o(h,p,g){this.fn=h,this.context=p,this.once=g||!1}function c(h,p,g,b,x){if(typeof g!="function")throw new TypeError("The listener must be a function");var E=new o(g,b||h,x),R=a?a+p:p;return h._events[R]?h._events[R].fn?h._events[R]=[h._events[R],E]:h._events[R].push(E):(h._events[R]=E,h._eventsCount++),h}function f(h,p){--h._eventsCount===0?h._events=new i:delete h._events[p]}function d(){this._events=new i,this._eventsCount=0}d.prototype.eventNames=function(){var p=[],g,b;if(this._eventsCount===0)return p;for(b in g=this._events)r.call(g,b)&&p.push(a?b.slice(1):b);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(g)):p},d.prototype.listeners=function(p){var g=a?a+p:p,b=this._events[g];if(!b)return[];if(b.fn)return[b.fn];for(var x=0,E=b.length,R=new Array(E);x<E;x++)R[x]=b[x].fn;return R},d.prototype.listenerCount=function(p){var g=a?a+p:p,b=this._events[g];return b?b.fn?1:b.length:0},d.prototype.emit=function(p,g,b,x,E,R){var S=a?a+p:p;if(!this._events[S])return!1;var w=this._events[S],C=arguments.length,A,N;if(w.fn){switch(w.once&&this.removeListener(p,w.fn,void 0,!0),C){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,g),!0;case 3:return w.fn.call(w.context,g,b),!0;case 4:return w.fn.call(w.context,g,b,x),!0;case 5:return w.fn.call(w.context,g,b,x,E),!0;case 6:return w.fn.call(w.context,g,b,x,E,R),!0}for(N=1,A=new Array(C-1);N<C;N++)A[N-1]=arguments[N];w.fn.apply(w.context,A)}else{var L=w.length,_;for(N=0;N<L;N++)switch(w[N].once&&this.removeListener(p,w[N].fn,void 0,!0),C){case 1:w[N].fn.call(w[N].context);break;case 2:w[N].fn.call(w[N].context,g);break;case 3:w[N].fn.call(w[N].context,g,b);break;case 4:w[N].fn.call(w[N].context,g,b,x);break;default:if(!A)for(_=1,A=new Array(C-1);_<C;_++)A[_-1]=arguments[_];w[N].fn.apply(w[N].context,A)}}return!0},d.prototype.on=function(p,g,b){return c(this,p,g,b,!1)},d.prototype.once=function(p,g,b){return c(this,p,g,b,!0)},d.prototype.removeListener=function(p,g,b,x){var E=a?a+p:p;if(!this._events[E])return this;if(!g)return f(this,E),this;var R=this._events[E];if(R.fn)R.fn===g&&(!x||R.once)&&(!b||R.context===b)&&f(this,E);else{for(var S=0,w=[],C=R.length;S<C;S++)(R[S].fn!==g||x&&!R[S].once||b&&R[S].context!==b)&&w.push(R[S]);w.length?this._events[E]=w.length===1?w[0]:w:f(this,E)}return this},d.prototype.removeAllListeners=function(p){var g;return p?(g=a?a+p:p,this._events[g]&&f(this,g)):(this._events=new i,this._eventsCount=0),this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=a,d.EventEmitter=d,t.exports=d}(om)),om.exports}var az=rz();const sz=cs(az),iz="ws://localhost:3000",Ga=class Ga extends sz{constructor(){super();Nl(this,"sockets");Nl(this,"readyPromises");Nl(this,"resolveReadyMap");this.sockets=new Map,this.readyPromises=new Map,this.resolveReadyMap=new Map}static getInstance(){return Ga.instance||(Ga.instance=new Ga),Ga.instance}connect(a,i){if(this.sockets.has(a)){console.warn(`[WebSocket Client] WebSocket for agent ${a} already exists.`);return}const o=new WebSocket(iz),c=new Promise(f=>{this.resolveReadyMap.set(a,f)});this.readyPromises.set(a,c),o.onopen=()=>{var d;console.log(`[WebSocket Client] WebSocket connected for agent ${a}`),(d=this.resolveReadyMap.get(a))==null||d();const f={type:Vc.ROOM_JOINING,payload:{agentId:a,roomId:i}};this.sendMessage(a,f)},o.onmessage=async f=>{var p,g,b;const d=JSON.parse(f.data);console.log(`[WebSocket Client] Message for agent ${a}:`,d,d.type);const h=d.payload;if(d.type===Vc.SEND_MESSAGE){const x=await Et.getAgentCompletion(a,h.senderId,h.message,h.roomId,h.source);(g=(p=x==null?void 0:x.data)==null?void 0:p.message)!=null&&g.text&&this.handleBroadcastMessage(a,(b=x==null?void 0:x.data)==null?void 0:b.name,x.data.message.text,x.data.roomId,x.data.source)}},o.onerror=f=>{console.error(`[WebSocket Client] WebSocket error for agent ${a}:`,f)},o.onclose=f=>{console.log(`[WebSocket Client] WebSocket closed for agent ${a}. Reason:`,f.reason),this.sockets.has(a)?(console.warn(`[WebSocket Client] Unexpected WebSocket closure for agent ${a}, attempting to reconnect...`),this.cleanupWebSocket(a),setTimeout(()=>{this.connect(a,i)},3e3)):this.cleanupWebSocket(a)},this.sockets.set(a,o)}async sendMessage(a,i){const o=this.sockets.get(a),c=this.readyPromises.get(a);if(!o){console.warn(`[WebSocket Client] Cannot send message, WebSocket for agent ${a} does not exist.`);return}await c,o.readyState===WebSocket.OPEN?o.send(JSON.stringify(i)):console.warn(`[WebSocket Client] WebSocket for agent ${a} is not open.`)}cleanupWebSocket(a){this.sockets.delete(a),this.readyPromises.delete(a),this.resolveReadyMap.delete(a)}handleBroadcastMessage(a,i,o,c,f){console.log(`[WebSocket Client] broadcast: ${a} broadcast ${o} to ${c}`),this.emit("messageBroadcast",{senderId:a,senderName:i,text:o,roomId:c,createdAt:Date.now()}),this.sendMessage(a,{type:Vc.SEND_MESSAGE,payload:{senderId:a,senderName:i,message:o,roomId:c,worldId:ts.getWorldId(),source:f}})}disconnect(a){const i=this.sockets.get(a);i?(i.close(),this.sockets.delete(a),this.readyPromises.delete(a),this.resolveReadyMap.delete(a),console.log(`[WebSocket Client] WebSocket for agent ${a} disconnected.`)):console.warn(`[WebSocket Client] No WebSocket found for agent ${a}.`)}disconnectAll(){this.sockets.forEach((a,i)=>{console.log(`[WebSocket Client] Closing WebSocket for agent ${i}`),a.readyState===WebSocket.OPEN?(this.cleanupWebSocket(i),a.close()):console.warn(`[WebSocket Client] WebSocket for agent ${i} is already closed or closing.`)})}};Nl(Ga,"instance",null);let Wm=Ga;var Zs={},Js={},ei={},Lx;function lz(){if(Lx)return ei;Lx=1;var t=ei&&ei.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ei,"__esModule",{value:!0});var r=t(Kl()),a=function(i,o){var c=r.default.useRef(null),f=r.default.useRef(i);return r.default.useEffect(function(){f.current=i},[i]),r.default.useEffect(function(){var d=function(){return f.current()};if(typeof o=="number")return c.current=window.setInterval(d,o),function(){return window.clearInterval(c.current)}},[o]),c};return ei.default=a,ei}var qa={},zx;function oz(){if(zx)return qa;zx=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.getCurrentNodeOverflow=qa.getStringPosition=void 0;var t=function(a,i,o){return a.split(i,o).join(" ").length};qa.getStringPosition=t;var r=function(a,i){for(var o=0,c=0,f=0;f<a.length&&!(o+a[f]>i);f++)c++,o=o+a[f];return[c,i-o]};return qa.getCurrentNodeOverflow=r,qa}var Px;function cz(){if(Px)return Js;Px=1;var t=Js&&Js.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(Js,"__esModule",{value:!0});var r=t(Kl()),a=t(lz()),i=oz(),o=r.default.memo(function(c){var f=c.children,d=c.delay,h=d===void 0?25:d,p=c.onEnd,g=p===void 0?function(){}:p,b=r.default.useState(0),x=b[0],E=b[1],R=r.default.useMemo(function(){var C=[],A=function(N){var L,_=(L=N==null?void 0:N.props)===null||L===void 0?void 0:L.children;return Array.isArray(N)&&N.forEach(function(k){typeof k=="object"?A(k):typeof k=="string"&&C.push(k.split(" ").length)}),_===void 0&&typeof N=="string"&&C.push(N.split(" ").length),typeof _=="object"&&A(_),typeof _=="string"&&C.push(_.split(" ").length),C};return A(f)},[f]),S=r.default.useMemo(function(){return R.reduce(function(C,A){return C+A},0)},[R]),w=r.default.useMemo(function(){var C=0,A=0,N=function(L){var _;if(C>x)return null;var k=(_=L==null?void 0:L.props)===null||_===void 0?void 0:_.children;if(Array.isArray(L)){var I=[];return L.forEach(function(ne){if(typeof ne=="object")I.push(N(ne));else if(typeof ne=="string"){C+=ne.split(" ").length,A++;var ce=(0,i.getCurrentNodeOverflow)(R,x),$=ce[0],U=ce[1];$<A&&I.push(ne.slice(0,(0,i.getStringPosition)(ne," ",U))),I.push(ne)}}),I}if(k===void 0&&typeof L=="string"){C+=L.split(" ").length,A++;var Y=(0,i.getCurrentNodeOverflow)(R,x),H=Y[0],K=Y[1];return H<A?L.slice(0,(0,i.getStringPosition)(L," ",K)):L}if(typeof k=="object")return r.default.createElement(L.type,L==null?void 0:L.props,N(k));if(typeof k=="string"){C+=k.split(" ").length,A++;var Z=(0,i.getCurrentNodeOverflow)(R,x),H=Z[0],K=Z[1];return H<A?r.default.createElement(L.type,L==null?void 0:L.props,k.slice(0,(0,i.getStringPosition)(k," ",K))):L}};return N(f)},[f,x,R]);return(0,a.default)(function(){E(function(C){return C+1>=S&&g(),C+1})},S>x?h:null),r.default.useEffect(function(){console.log("hmmm"),E(0)},[f]),w});return o.displayName="AIWriter",Js.default=o,Js}var kx;function uz(){if(kx)return Zs;kx=1;var t=Zs&&Zs.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Zs,"__esModule",{value:!0});var r=t(cz());return Zs.default=r.default,Zs}var fz=uz();const dz=cs(fz);let kl,Ul=[],Dc;const Ux=(t,r)=>String(t).padStart(r,"0"),hz=({className:t,timerClassName:r,agentId:a,onChange:i})=>{const{toast:o}=Yn(),[c,f]=y.useState(!1),[d,h]=y.useState(!1),[p,g]=y.useState(0),[b,x]=y.useState({id:-1,name:"",file:null}),E=Math.floor(p%3600/60),R=p%60,[S,w]=y.useMemo(()=>Ux(E,2).split(""),[E]),[C,A]=y.useMemo(()=>Ux(R,2).split(""),[R]),N=y.useRef({stream:null,analyser:null,mediaRecorder:null,audioContext:null}),L=yu({mutationKey:["whisper"],mutationFn:H=>Et.whisper(a,H),onSuccess:H=>{var K;(K=H==null?void 0:H.data)!=null&&K.text&&i(H.data.text)},onError:H=>{o({variant:"destructive",title:"Unable to start recording",description:H.message}),console.log(H)}});function _(){var H;(H=navigator.mediaDevices)!=null&&H.getUserMedia&&navigator.mediaDevices.getUserMedia({audio:!0}).then(K=>{f(!0);const Z=window.AudioContext,ne=new Z,ce=ne.createAnalyser();ne.createMediaStreamSource(K).connect(ce),N.current={stream:K,analyser:ce,mediaRecorder:null,audioContext:ne};const M={mimeType:MediaRecorder.isTypeSupported("audio/mpeg")?"audio/mpeg":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/wav"};N.current.mediaRecorder=new MediaRecorder(K,M),N.current.mediaRecorder.start(),Ul=[],kl=new MediaRecorder(K),kl.start(),kl.ondataavailable=q=>{Ul.push(q.data)}}).catch(K=>{o({variant:"destructive",title:"Unable to start recording",description:K.message}),console.log(K)})}function k(){kl.onstop=()=>{const H=new Blob(Ul,{type:"audio/wav"});L.mutate(H),x({...b,file:window.URL.createObjectURL(H)}),Ul=[]},kl.stop(),f(!1),h(!0),g(0),clearTimeout(Dc)}function I(){const{mediaRecorder:H,stream:K,analyser:Z,audioContext:ne}=N.current;if(H&&(H.onstop=()=>{Ul=[]},H.stop()),Z&&Z.disconnect(),K)for(const ce of K.getTracks())ce.stop();ne&&ne.close(),f(!1),h(!0),g(0),clearTimeout(Dc)}const Y=()=>{k()};return y.useEffect(()=>(c&&(Dc=setTimeout(()=>{g(p+1)},1e3)),()=>clearTimeout(Dc)),[c,p]),L!=null&&L.isPending?v.jsx(Ie,{variant:"ghost",disabled:!0,size:"icon",children:v.jsx(ip,{className:"size-4"})}):v.jsxs("div",{className:le("flex items-center justify-center gap-2 border-l border-l-transparent border-opacity-0 transition-all duration-300",{"border-opacity-100 border-l-border pl-2":c},t),children:[c?v.jsxs("div",{className:"flex gap-1 items-center",children:[v.jsx("div",{className:"bg-red-500 rounded-full h-2.5 w-2.5 animate-pulse"}),v.jsx(GR,{minuteLeft:S,minuteRight:w,secondLeft:C,secondRight:A,timerClassName:r})]}):null,v.jsxs("div",{className:"flex items-center",children:[c?v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx(Ie,{onClick:I,size:"icon",variant:"ghost",children:v.jsx(m2,{className:"size-4"})})}),v.jsx(kn,{className:"m-2",children:v.jsx("span",{children:" Reset recording"})})]}):null,v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:c?v.jsx(Ie,{onClick:Y,variant:"ghost",size:"icon",children:v.jsx(Yw,{className:"size-4"})}):v.jsxs(Ie,{variant:"ghost",size:"icon",onClick:()=>_(),children:[v.jsx(i2,{className:"size-4"}),v.jsx("span",{className:"sr-only",children:"Use Microphone"})]})}),v.jsx(kn,{side:"right",children:v.jsxs("span",{children:[c?"Send":"Start"," "]})})]})]})]})},GR=hr.memo(({minuteLeft:t,minuteRight:r,secondLeft:a,secondRight:i,timerClassName:o})=>v.jsx("div",{className:le("text-sm animate-in duration-1000 fade-in-0 select-none",o),children:v.jsxs("p",{children:[t,r,":",a,i]})}));GR.displayName="Timer";const mz=({text:t})=>{const[r,a]=y.useState(!1),i=()=>{navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})};return v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx(Ie,{onClick:i,variant:"ghost",size:"icon",className:"flex items-center space-x-2 text-muted-foreground",children:r?v.jsx(ap,{className:"size-4"}):v.jsx(e2,{className:"size-4"})})}),v.jsx(kn,{side:"bottom",children:v.jsx("p",{children:"Copy"})})]})};function pz({agentId:t,text:r}){const{toast:a}=Yn(),[i,o]=y.useState(!1),[c,f]=y.useState(null),d=y.useRef(null),h=yu({mutationKey:["tts",r],mutationFn:()=>Et.tts(t,r),onSuccess:E=>{f(E),p()},onError:E=>{a({variant:"destructive",title:"Unable to read message aloud",description:E.message})}}),p=()=>{d.current&&d.current.play().catch(E=>{console.error("Error playing audio:",E)}),o(!0)},g=()=>{d.current&&(d.current.pause(),d.current.currentTime=0),o(!1)},b=()=>{if(!(h!=null&&h.isPending)){if(i){g();return}if(c){p();return}}},x="text-muted-foreground size-4";return v.jsxs("div",{children:[c?v.jsxs("audio",{crossOrigin:"anonymous",playsInline:!0,ref:d,onEnded:()=>{o(!1)},autoPlay:!0,children:[v.jsx("source",{src:URL.createObjectURL(c),type:"audio/mpeg"}),v.jsx("track",{kind:"captions",src:"",label:"English captions"}),"Your browser does not support the audio element."]}):null,v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx(Ie,{size:"icon",variant:"ghost",type:"button",onClick:()=>b(),disabled:h==null?void 0:h.isPending,children:h!=null&&h.isPending?v.jsx(ip,{className:x}):i?v.jsx(JO,{className:x}):v.jsx(v2,{className:x})})}),v.jsx(kn,{side:"bottom",children:v.jsx("p",{children:i?"Stop":"Read aloud"})})]})]})}function vz(t={}){const{offset:r=20,smooth:a=!1}=t,i=y.useRef(null),o=y.useRef(0),c=y.useRef(!1),[f,d]=y.useState({isAtBottom:!0,autoScrollEnabled:!0}),h=y.useCallback(x=>{const{scrollTop:E,scrollHeight:R,clientHeight:S}=x;return Math.abs(R-E-S)<=r},[r]),p=y.useCallback(x=>{if(!i.current)return;const E=i.current.scrollHeight-i.current.clientHeight;x?i.current.scrollTop=E:i.current.scrollTo({top:E,behavior:a?"smooth":"auto"}),d({isAtBottom:!0,autoScrollEnabled:!0}),c.current=!1},[a]),g=y.useCallback(()=>{if(!i.current)return;const x=h(i.current);d(E=>({isAtBottom:x,autoScrollEnabled:x?!0:E.autoScrollEnabled}))},[h]);y.useEffect(()=>{const x=i.current;if(x)return x.addEventListener("scroll",g,{passive:!0}),()=>x.removeEventListener("scroll",g)},[g]),y.useEffect(()=>{const x=i.current;if(!x)return;const E=x.scrollHeight;E!==o.current&&(f.autoScrollEnabled&&requestAnimationFrame(()=>{p(o.current===0)}),o.current=E)},[f.autoScrollEnabled,p]),y.useEffect(()=>{const x=i.current;if(!x)return;const E=new ResizeObserver(()=>{f.autoScrollEnabled&&p(!0)});return E.observe(x),()=>E.disconnect()},[f.autoScrollEnabled,p]);const b=y.useCallback(()=>{(i.current?h(i.current):!1)||(c.current=!0,d(E=>({...E,autoScrollEnabled:!1})))},[h]);return{scrollRef:i,isAtBottom:f.isAtBottom,autoScrollEnabled:f.autoScrollEnabled,scrollToBottom:()=>p(!1),disableAutoScroll:b}}const gz="client_chat";function yz({message:t,agentId:r}){var a;return v.jsxs("div",{className:"flex flex-col",children:[v.jsxs(IR,{isLoading:t.isLoading,...t.name===ns?{variant:"sent"}:{},children:[t.name===ns?t.text:v.jsx(dz,{children:t.text}),v.jsx("div",{children:(a=t.attachments)==null?void 0:a.map(i=>v.jsxs("div",{className:"flex flex-col gap-1 mt-2",children:[v.jsx("img",{alt:"attachment",src:i.url,width:"100%",height:"100%",className:"w-64 rounded-md"}),v.jsxs("div",{className:"flex items-center justify-between gap-4",children:[v.jsx("span",{}),v.jsx("span",{})]})]},`${i.url}-${i.title}`))})]}),v.jsxs("div",{className:"flex items-center gap-4 justify-between w-full mt-1",children:[t.text&&!t.isLoading?v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(mz,{text:t.text}),v.jsx(pz,{agentId:r,text:t.text})]}):null,v.jsxs("div",{className:le([t.isLoading?"mt-2":"","flex items-center justify-between gap-4 select-none"]),children:[t.source?v.jsx(Lm,{variant:"outline",children:t.source}):null,t.actions?v.jsx(Lm,{variant:"outline",children:t.actions.join(", ")}):null,t.createdAt?v.jsx(tz,{timestamp:bN(t.createdAt).format("LT")}):null]})]})]})}function bz({agentId:t}){var I,Y,H,K;const[r,a]=y.useState(null),[i,o]=y.useState(""),c=y.useRef(null),f=y.useRef(null),d=y.useRef(null),h=Bn(),p=ts.getWorldId(),g=(Y=(I=F_(t))==null?void 0:I.data)==null?void 0:Y.data,b=xN(),x=t,{data:E=[]}=W_(t,x),R=Wm.getInstance();y.useEffect(()=>{R.connect(t,x),R.connect(b,x);const Z=ne=>{h.setQueryData(["messages",t,x,p],(ce=[])=>[...ce,{...ne,name:ne.senderName}])};return R.on("messageBroadcast",Z),()=>{R.disconnectAll(),R.off("messageBroadcast",Z)}},[x]);const S=Z=>Z!==ns?"received":"sent",{scrollRef:w,isAtBottom:C,scrollToBottom:A,disableAutoScroll:N}=vz({smooth:!0});y.useEffect(()=>{A()},[h.getQueryData(["messages",t,x,p])]),y.useEffect(()=>{A()},[]);const L=Z=>{if(Z.key==="Enter"&&!Z.shiftKey){if(Z.preventDefault(),Z.nativeEvent.isComposing)return;_(Z)}},_=Z=>{var ne;Z.preventDefault(),i&&(R.handleBroadcastMessage(b,ns,i,x,gz),a(null),o(""),(ne=d.current)==null||ne.reset())};y.useEffect(()=>{c.current&&c.current.focus()},[]);const k=Z=>{var ce;const ne=(ce=Z.target.files)==null?void 0:ce[0];ne!=null&&ne.type.startsWith("image/")&&a(ne)};return v.jsxs("div",{className:"flex flex-col w-full h-[calc(100dvh)] p-4",children:[v.jsx("div",{className:"flex items-center justify-between mb-4 p-3 bg-card rounded-lg border",children:v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(Qm,{className:"size-10 border rounded-full",children:v.jsx(Xm,{src:(H=g==null?void 0:g.settings)!=null&&H.avatar?(K=g==null?void 0:g.settings)==null?void 0:K.avatar:"/elizaos-icon.png"})}),v.jsxs("div",{className:"flex flex-col",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h2",{className:"font-semibold text-lg",children:(g==null?void 0:g.name)||"Agent"}),(g==null?void 0:g.status)===ta.ACTIVE?v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx("div",{className:"size-2.5 rounded-full bg-green-500 ring-2 ring-green-500/20 animate-pulse"})}),v.jsx(kn,{side:"right",children:v.jsx("p",{children:"Agent is active"})})]}):v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsx("div",{className:"size-2.5 rounded-full bg-gray-300 ring-2 ring-gray-300/20"})}),v.jsx(kn,{side:"right",children:v.jsx("p",{children:"Agent is inactive"})})]})]}),(g==null?void 0:g.bio)&&v.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:Array.isArray(g.bio)?g.bio[0]:g.bio})]})]})}),v.jsx(YR,{scrollRef:w,isAtBottom:C,scrollToBottom:A,disableAutoScroll:N,children:E.map(Z=>{var ce,$;const ne=Z.name===ns;return v.jsx("div",{className:`flex flex-column gap-1 p-1 ${ne?"justify-end":""}`,children:v.jsxs(BR,{variant:S(Z.name),className:`flex flex-row items-center gap-2 ${ne?"flex-row-reverse":""}`,children:[v.jsxs(Qm,{className:"size-8 border rounded-full select-none",children:[v.jsx(Xm,{src:ne?"/user-icon.png":(ce=g==null?void 0:g.settings)!=null&&ce.avatar?($=g==null?void 0:g.settings)==null?void 0:$.avatar:"/elizaos-icon.png"}),ne&&v.jsx(qR,{children:"U"})]}),v.jsx(yz,{message:Z,agentId:t})]})},Z.name+Z.createdAt)})}),v.jsx("div",{className:"px-4 pb-4",children:v.jsxs("form",{ref:d,onSubmit:_,className:"relative rounded-md border bg-card",children:[r?v.jsx("div",{className:"p-3 flex",children:v.jsxs("div",{className:"relative rounded-md border p-2",children:[v.jsx(Ie,{onClick:()=>a(null),className:"absolute -right-2 -top-2 size-[22px] ring-2 ring-background",variant:"outline",size:"icon",children:v.jsx(us,{})}),v.jsx("img",{alt:"Selected file",src:URL.createObjectURL(r),height:"100%",width:"100%",className:"aspect-square object-contain w-16"})]})}):null,v.jsx(VR,{ref:c,onKeyDown:L,value:i,onChange:({target:Z})=>o(Z.value),placeholder:"Type your message here...",className:"min-h-12 resize-none rounded-md bg-card border-0 p-3 shadow-none focus-visible:ring-0"}),v.jsxs("div",{className:"flex items-center p-3 pt-0",children:[v.jsxs(br,{children:[v.jsx(xr,{asChild:!0,children:v.jsxs("div",{children:[v.jsxs(Ie,{variant:"ghost",size:"icon",onClick:()=>{f.current&&f.current.click()},children:[v.jsx(o2,{className:"size-4"}),v.jsx("span",{className:"sr-only",children:"Attach file"})]}),v.jsx("input",{type:"file",ref:f,onChange:k,accept:"image/*",className:"hidden"})]})}),v.jsx(kn,{side:"left",children:v.jsx("p",{children:"Attach file"})})]}),v.jsx(hz,{agentId:t,onChange:Z=>o(Z)}),v.jsx(Ie,{type:"submit",size:"sm",className:"ml-auto gap-1.5 h-[30px]",children:v.jsx(Yw,{className:"size-3.5"})})]})]})})]})}function xz(){const{agentId:t}=lE();return t?v.jsx(bz,{agentId:t}):v.jsx("div",{children:"No data."})}function wz(){return v.jsx(XE,{})}function Sz({title:t,content:r,buttons:a}){return v.jsxs(io,{className:"h-full",children:[v.jsx(yE,{className:"pb-2 pt-3",children:v.jsx(bE,{className:"text-base truncate max-w-48",children:t})}),v.jsx(wu,{className:"p-3",children:v.jsx("div",{className:"rounded-md bg-muted w-full mb-3 overflow-hidden",style:{aspectRatio:"1 / 1"},children:v.jsx("div",{className:"flex items-center justify-center h-full",children:v.jsx("div",{className:"text-4xl font-bold uppercase h-full flex items-center justify-center w-full",children:r})})})}),v.jsx(xE,{className:"p-3 pb-4",children:v.jsx("div",{className:"flex items-center gap-2 w-full justify-center",children:a.map(({label:i,icon:o,action:c,className:f,variant:d,size:h,disabled:p},g)=>v.jsxs(Ie,{variant:d,className:f,onClick:c,size:h,disabled:p,children:[o,i&&v.jsx("span",{children:i})]},g))})})]})}function Ez(){Oi();const t=Bn(),{toast:r}=Yn(),a=Q_(),i=X_(),[o,c]=y.useState([]),[f,d]=y.useState([]);return{startAgent:async x=>{if(!x.id){r({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const E=x.id;if(!o.includes(E))try{c(R=>[...R,E]),await a.mutateAsync(E),t.invalidateQueries({queryKey:["active-agents"]})}catch(R){console.error("Failed to start agent:",R),r({title:"Error Starting Agent",description:R instanceof Error?R.message:"Failed to start agent",variant:"destructive"})}finally{c(R=>R.filter(S=>S!==E))}},stopAgent:async x=>{if(!x.id){r({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const E=x.id;if(!f.includes(E))try{d(R=>[...R,E]),await i.mutateAsync(E),t.invalidateQueries({queryKey:["active-agents"]}),r({title:"Agent Stopped",description:`${x.name} has been stopped`})}catch(R){console.error("Failed to stop agent:",R),r({title:"Error Stopping Agent",description:R instanceof Error?R.message:"Failed to stop agent",variant:"destructive"})}finally{d(R=>R.filter(S=>S!==E))}},isAgentStarting:x=>x?o.includes(x):!1,isAgentStopping:x=>x?f.includes(x):!1,startingAgents:o,stoppingAgents:f}}function Rz({isOpen:t,onClose:r,agent:a}){var C;if(!t)return null;const{startAgent:i,stopAgent:o,isAgentStarting:c,isAgentStopping:f}=Ez(),d=Oi(),h=a.status==="active",p=c(a.id),g=f(a.id),b=p||g,x=y.useRef(null),[E,R]=y.useState(!1);let S="Start",w=v.jsx(c2,{});return p?(S="Starting...",w=v.jsx(s0,{className:"animate-spin"})):g?(S="Stopping...",w=v.jsx(s0,{className:"animate-spin"})):h&&(S="Stop",w=v.jsx(h2,{fill:"#EF4444",size:16})),y.useEffect(()=>{const A=N=>{x.current&&!x.current.contains(N.target)&&R(!1)};return document.addEventListener("mousedown",A),()=>{document.removeEventListener("mousedown",A)}},[]),v.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50",onClick:r,children:v.jsxs(io,{className:"flex flex-col items-center justify-between h-[70vh] w-[70vh]",onClick:A=>A.stopPropagation(),children:[v.jsx("div",{className:"p-3 h-[30%] w-full flex items-end",children:v.jsxs("div",{className:"flex w-full h-full justify-between items-end",children:[v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{className:"w-20 h-20 flex justify-center items-center relative",children:[a&&v.jsx("div",{className:"text-4xl bg-muted rounded-full h-full w-full flex justify-center items-center overflow-hidden",children:(C=a.settings)!=null&&C.avatar?v.jsx("img",{src:a.settings.avatar,alt:"Agent Avatar",className:"w-full h-full object-contain"}):Yc(a.name)}),v.jsx("div",{className:`absolute bottom-1 right-1 w-4 h-4 rounded-full border-2 border-white ${h?"bg-green-500":"bg-muted-foreground"}`})]}),v.jsx("div",{className:"flex justify-center items-center mr-4 font-bold",children:a&&v.jsx("div",{className:"text-xl truncate max-w-48",children:a.name})})]}),v.jsxs("div",{className:"flex flex-col items-end justify-between h-full",children:[v.jsxs("div",{className:"relative ",children:[v.jsx(ip,{className:"w-5 h-5 cursor-pointer",onClick:()=>{R(!0)}}),E&&v.jsx("div",{className:"absolute right-0 -top-1 mt-2 w-30 bg-muted border rounded shadow-md z-10",ref:x,children:v.jsxs(Ie,{variant:"ghost",className:"w-full px-4 py-2 text-left opacity-50 hover:opacity-100 cursor-pointer flex items-center gap-1",onClick:()=>{R(!1),d(`/settings/${a.id}`)},children:[v.jsx("div",{children:v.jsx(sp,{className:"w-4 h-4"})}),v.jsx("div",{children:"Setting"})]})})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs(Ie,{variant:"secondary",className:"mr-4",onClick:()=>{h&&d(`/chat/${a.id}`)},size:"default",disabled:!h,children:[v.jsx(s2,{className:"w-10 h-10 rounded-full",style:{height:14,width:14}}),"Message"]}),v.jsxs(Ie,{variant:"secondary",className:`mr-4 ${h?"text-red-500":""}`,onClick:()=>{b||(h?o(a):i(a))},size:"default",disabled:b,children:[w,S]})]})]})]})}),v.jsx(wu,{className:"p-3 h-[70%] w-full",children:v.jsx("div",{className:"rounded-md bg-muted h-full w-full mb-3",children:v.jsx("div",{className:"flex h-full",children:v.jsx("div",{className:"p-6 overflow-scroll flex flex-col gap-2",children:v.jsxs("div",{children:[v.jsx("p",{className:"font-light",children:"About Me"}),a&&v.jsx("p",{className:"font-light text-sm text-gray-500",children:a==null?void 0:a.system})]})})})})})]})})}function Tz(){const{data:{data:t}={},isLoading:r,isError:a,error:i}=KE(),o=Oi(),c=(t==null?void 0:t.agents)||[],[f,d]=y.useState(!1),[h,p]=y.useState(null),g=x=>{p(x),d(!0)},b=()=>{p(null),d(!1)};return v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-col gap-4 h-full p-4",children:[v.jsx("div",{className:"flex items-center justify-between",children:v.jsx(n1,{title:"Agents"})}),r&&v.jsx("div",{className:"text-center py-8",children:"Loading agents..."}),a&&v.jsxs("div",{className:"text-center py-8 text-destructive",children:["Error loading agents:"," ",i instanceof Error?i.message:"Unknown error"]}),c.length===0&&!r&&v.jsx("div",{className:"text-center py-8 flex flex-col items-center gap-4",children:v.jsx("p",{className:"text-muted-foreground",children:"No agents currently running. Start a character to begin."})}),!r&&!a&&v.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 p-3",children:[c==null?void 0:c.sort((x,E)=>Number(E==null?void 0:E.enabled)-Number(x==null?void 0:x.enabled)).map(x=>{var E;return v.jsx(Sz,{title:x.name,content:v.jsx("div",{className:"cursor-pointer h-full w-full flex items-center justify-center",onClick:()=>g(x),children:(E=x.settings)!=null&&E.avatar?v.jsx("img",{src:x.settings.avatar,alt:"Agent Avatar",className:"w-full h-full object-contain"}):Yc(x.name)}),buttons:[{label:"View",action:()=>{g(x)},className:"w-[80%]",variant:"default"},{icon:v.jsx(sp,{style:{height:16,width:16}}),className:"w-10 h-10 rounded-full",action:()=>o(`/settings/${x.id}`),variant:"outline"}]},x.id)}),v.jsx(io,{className:"flex flex-col items-center justify-center h-full cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>o("/create"),children:v.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 p-8",children:[v.jsx(u2,{size:40,className:"text-muted-foreground"}),v.jsx("span",{className:"text-muted-foreground whitespace-nowrap",children:"Create New Agent"})]})})]})]}),v.jsx(Rz,{isOpen:f,onClose:b,agent:c.find(x=>x.id===(h==null?void 0:h.id))||h,agents:c})]})}function Cz({agent:t,agentId:r}){const{toast:a}=Yn(),i=Oi(),o=Bn(),[c,f]=y.useState(t),d=async p=>{try{if(!r)throw new Error("Agent ID is missing");const g={...p,plugins:c.plugins};await Et.updateAgent(r,g),o.invalidateQueries({queryKey:["agent",r]}),o.invalidateQueries({queryKey:["agents"]}),i("/"),a({title:"Success",description:"Agent updated and restarted successfully"})}catch(g){throw a({title:"Error",description:g instanceof Error?g.message:"Failed to update agent",variant:"destructive"}),g}},h=async p=>{try{await Et.deleteAgent(p.id),o.invalidateQueries({queryKey:["agents"]}),i("/")}catch(g){console.error("Error deleting agent:",g)}};return v.jsx(qE,{characterValue:c,setCharacterValue:f,title:"Character Settings",description:"Configure your AI character's behavior and capabilities",onSubmit:d,onReset:()=>f(t),onDelete:()=>h(t),isAgent:!0,customComponents:[{name:"Plugins",component:v.jsx(FE,{characterValue:c,setCharacterValue:f})},{name:"Secret",component:v.jsx(QE,{characterValue:c,setCharacterValue:f})},{name:"Avatar",component:v.jsx(BE,{characterValue:c,setCharacterValue:f})}]})}function Az(){var i;const{agentId:t}=lE(),r=fs({queryKey:["agent",t],queryFn:()=>Et.getAgent(t??""),staleTime:gn.FREQUENT,refetchInterval:5e3,enabled:!!t});if(!t)return v.jsx("div",{children:"No data."});const a=(i=r==null?void 0:r.data)==null?void 0:i.data;return a?v.jsx(Cz,{agent:a,agentId:t}):null}const FR=new AM({defaultOptions:{queries:{staleTime:gn.STANDARD,refetchInterval:!1,retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4),refetchOnWindowFocus:!0,refetchOnReconnect:!0},mutations:{retry:3,retryDelay:t=>Math.min(1e3*2**t,3e4)}}}),QR=async()=>{try{await FR.prefetchQuery({queryKey:["agents"],queryFn:()=>Et.getAgents(),staleTime:gn.FREQUENT})}catch(t){console.error("Error prefetching initial data:",t)}};QR();function Nz(){return Q3(),y.useEffect(()=>{QR()},[]),v.jsx(DM,{client:FR,children:v.jsx("div",{className:"dark antialiased",style:{colorScheme:"dark"},children:v.jsx(n_,{children:v.jsxs(AS,{delayDuration:0,children:[v.jsxs(OS,{children:[v.jsx(J_,{}),v.jsx(MS,{children:v.jsx("div",{className:"flex flex-1 flex-col gap-4 size-full container",children:v.jsxs(_D,{children:[v.jsx(Ba,{path:"/",element:v.jsx(Tz,{})}),v.jsx(Ba,{path:"chat/:agentId",element:v.jsx(xz,{})}),v.jsx(Ba,{path:"settings/:agentId",element:v.jsx(Az,{})}),v.jsx(Ba,{path:"agents/new",element:v.jsx(wz,{})}),v.jsx(Ba,{path:"/create",element:v.jsx(XE,{})}),v.jsx(Ba,{path:"/logs",element:v.jsx(J4,{})})]})})})]}),v.jsx(x3,{})]})})})})}const XR=document.getElementById("root");if(!XR)throw new Error("Root element not found");jA.createRoot(XR).render(v.jsx(y.StrictMode,{children:v.jsx(Nz,{})}));
|