nestor-sh 2.7.1 → 3.0.0

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.
@@ -0,0 +1,596 @@
1
+ var rb=Object.defineProperty;var cb=(n,r,d)=>r in n?rb(n,r,{enumerable:!0,configurable:!0,writable:!0,value:d}):n[r]=d;var ud=(n,r,d)=>cb(n,typeof r!="symbol"?r+"":r,d);(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))c(m);new MutationObserver(m=>{for(const f of m)if(f.type==="childList")for(const h of f.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function d(m){const f={};return m.integrity&&(f.integrity=m.integrity),m.referrerPolicy&&(f.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?f.credentials="include":m.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function c(m){if(m.ep)return;m.ep=!0;const f=d(m);fetch(m.href,f)}})();var md={exports:{}},Gl={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ch;function ob(){if(ch)return Gl;ch=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function d(c,m,f){var h=null;if(f!==void 0&&(h=""+f),m.key!==void 0&&(h=""+m.key),"key"in m){f={};for(var b in m)b!=="key"&&(f[b]=m[b])}else f=m;return m=f.ref,{$$typeof:n,type:c,key:h,ref:m!==void 0?m:null,props:f}}return Gl.Fragment=r,Gl.jsx=d,Gl.jsxs=d,Gl}var oh;function db(){return oh||(oh=1,md.exports=ob()),md.exports}var t=db(),xd={exports:{}},je={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var dh;function ub(){if(dh)return je;dh=1;var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),y=Symbol.iterator;function k(T){return T===null||typeof T!="object"?null:(T=y&&T[y]||T["@@iterator"],typeof T=="function"?T:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,S={};function C(T,X,re){this.props=T,this.context=X,this.refs=S,this.updater=re||z}C.prototype.isReactComponent={},C.prototype.setState=function(T,X){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,X,"setState")},C.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function O(){}O.prototype=C.prototype;function D(T,X,re){this.props=T,this.context=X,this.refs=S,this.updater=re||z}var E=D.prototype=new O;E.constructor=D,N(E,C.prototype),E.isPureReactComponent=!0;var ae=Array.isArray;function oe(){}var B={H:null,A:null,T:null,S:null},q=Object.prototype.hasOwnProperty;function I(T,X,re){var $=re.ref;return{$$typeof:n,type:T,key:X,ref:$!==void 0?$:null,props:re}}function W(T,X){return I(T.type,X,T.props)}function Y(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function le(T){var X={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(re){return X[re]})}var J=/\/+/g;function ce(T,X){return typeof T=="object"&&T!==null&&T.key!=null?le(""+T.key):X.toString(36)}function he(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(oe,oe):(T.status="pending",T.then(function(X){T.status==="pending"&&(T.status="fulfilled",T.value=X)},function(X){T.status==="pending"&&(T.status="rejected",T.reason=X)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function G(T,X,re,$,de){var xe=typeof T;(xe==="undefined"||xe==="boolean")&&(T=null);var be=!1;if(T===null)be=!0;else switch(xe){case"bigint":case"string":case"number":be=!0;break;case"object":switch(T.$$typeof){case n:case r:be=!0;break;case w:return be=T._init,G(be(T._payload),X,re,$,de)}}if(be)return de=de(T),be=$===""?"."+ce(T,0):$,ae(de)?(re="",be!=null&&(re=be.replace(J,"$&/")+"/"),G(de,X,re,"",function(Q){return Q})):de!=null&&(Y(de)&&(de=W(de,re+(de.key==null||T&&T.key===de.key?"":(""+de.key).replace(J,"$&/")+"/")+be)),X.push(de)),1;be=0;var Ce=$===""?".":$+":";if(ae(T))for(var ve=0;ve<T.length;ve++)$=T[ve],xe=Ce+ce($,ve),be+=G($,X,re,xe,de);else if(ve=k(T),typeof ve=="function")for(T=ve.call(T),ve=0;!($=T.next()).done;)$=$.value,xe=Ce+ce($,ve++),be+=G($,X,re,xe,de);else if(xe==="object"){if(typeof T.then=="function")return G(he(T),X,re,$,de);throw X=String(T),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return be}function ie(T,X,re){if(T==null)return T;var $=[],de=0;return G(T,$,"","",function(xe){return X.call(re,xe,de++)}),$}function me(T){if(T._status===-1){var X=T._result;X=X(),X.then(function(re){(T._status===0||T._status===-1)&&(T._status=1,T._result=re)},function(re){(T._status===0||T._status===-1)&&(T._status=2,T._result=re)}),T._status===-1&&(T._status=0,T._result=X)}if(T._status===1)return T._result.default;throw T._result}var ne=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},we={map:ie,forEach:function(T,X,re){ie(T,function(){X.apply(this,arguments)},re)},count:function(T){var X=0;return ie(T,function(){X++}),X},toArray:function(T){return ie(T,function(X){return X})||[]},only:function(T){if(!Y(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return je.Activity=v,je.Children=we,je.Component=C,je.Fragment=d,je.Profiler=m,je.PureComponent=D,je.StrictMode=c,je.Suspense=g,je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,je.__COMPILER_RUNTIME={__proto__:null,c:function(T){return B.H.useMemoCache(T)}},je.cache=function(T){return function(){return T.apply(null,arguments)}},je.cacheSignal=function(){return null},je.cloneElement=function(T,X,re){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var $=N({},T.props),de=T.key;if(X!=null)for(xe in X.key!==void 0&&(de=""+X.key),X)!q.call(X,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&X.ref===void 0||($[xe]=X[xe]);var xe=arguments.length-2;if(xe===1)$.children=re;else if(1<xe){for(var be=Array(xe),Ce=0;Ce<xe;Ce++)be[Ce]=arguments[Ce+2];$.children=be}return I(T.type,de,$)},je.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:f,_context:T},T},je.createElement=function(T,X,re){var $,de={},xe=null;if(X!=null)for($ in X.key!==void 0&&(xe=""+X.key),X)q.call(X,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(de[$]=X[$]);var be=arguments.length-2;if(be===1)de.children=re;else if(1<be){for(var Ce=Array(be),ve=0;ve<be;ve++)Ce[ve]=arguments[ve+2];de.children=Ce}if(T&&T.defaultProps)for($ in be=T.defaultProps,be)de[$]===void 0&&(de[$]=be[$]);return I(T,xe,de)},je.createRef=function(){return{current:null}},je.forwardRef=function(T){return{$$typeof:b,render:T}},je.isValidElement=Y,je.lazy=function(T){return{$$typeof:w,_payload:{_status:-1,_result:T},_init:me}},je.memo=function(T,X){return{$$typeof:p,type:T,compare:X===void 0?null:X}},je.startTransition=function(T){var X=B.T,re={};B.T=re;try{var $=T(),de=B.S;de!==null&&de(re,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(oe,ne)}catch(xe){ne(xe)}finally{X!==null&&re.types!==null&&(X.types=re.types),B.T=X}},je.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},je.use=function(T){return B.H.use(T)},je.useActionState=function(T,X,re){return B.H.useActionState(T,X,re)},je.useCallback=function(T,X){return B.H.useCallback(T,X)},je.useContext=function(T){return B.H.useContext(T)},je.useDebugValue=function(){},je.useDeferredValue=function(T,X){return B.H.useDeferredValue(T,X)},je.useEffect=function(T,X){return B.H.useEffect(T,X)},je.useEffectEvent=function(T){return B.H.useEffectEvent(T)},je.useId=function(){return B.H.useId()},je.useImperativeHandle=function(T,X,re){return B.H.useImperativeHandle(T,X,re)},je.useInsertionEffect=function(T,X){return B.H.useInsertionEffect(T,X)},je.useLayoutEffect=function(T,X){return B.H.useLayoutEffect(T,X)},je.useMemo=function(T,X){return B.H.useMemo(T,X)},je.useOptimistic=function(T,X){return B.H.useOptimistic(T,X)},je.useReducer=function(T,X,re){return B.H.useReducer(T,X,re)},je.useRef=function(T){return B.H.useRef(T)},je.useState=function(T){return B.H.useState(T)},je.useSyncExternalStore=function(T,X,re){return B.H.useSyncExternalStore(T,X,re)},je.useTransition=function(){return B.H.useTransition()},je.version="19.2.4",je}var uh;function $d(){return uh||(uh=1,xd.exports=ub()),xd.exports}var u=$d(),fd={exports:{}},Kl={},hd={exports:{}},pd={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var mh;function mb(){return mh||(mh=1,(function(n){function r(G,ie){var me=G.length;G.push(ie);e:for(;0<me;){var ne=me-1>>>1,we=G[ne];if(0<m(we,ie))G[ne]=ie,G[me]=we,me=ne;else break e}}function d(G){return G.length===0?null:G[0]}function c(G){if(G.length===0)return null;var ie=G[0],me=G.pop();if(me!==ie){G[0]=me;e:for(var ne=0,we=G.length,T=we>>>1;ne<T;){var X=2*(ne+1)-1,re=G[X],$=X+1,de=G[$];if(0>m(re,me))$<we&&0>m(de,re)?(G[ne]=de,G[$]=me,ne=$):(G[ne]=re,G[X]=me,ne=X);else if($<we&&0>m(de,me))G[ne]=de,G[$]=me,ne=$;else break e}}return ie}function m(G,ie){var me=G.sortIndex-ie.sortIndex;return me!==0?me:G.id-ie.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,b=h.now();n.unstable_now=function(){return h.now()-b}}var g=[],p=[],w=1,v=null,y=3,k=!1,z=!1,N=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function E(G){for(var ie=d(p);ie!==null;){if(ie.callback===null)c(p);else if(ie.startTime<=G)c(p),ie.sortIndex=ie.expirationTime,r(g,ie);else break;ie=d(p)}}function ae(G){if(N=!1,E(G),!z)if(d(g)!==null)z=!0,oe||(oe=!0,le());else{var ie=d(p);ie!==null&&he(ae,ie.startTime-G)}}var oe=!1,B=-1,q=5,I=-1;function W(){return S?!0:!(n.unstable_now()-I<q)}function Y(){if(S=!1,oe){var G=n.unstable_now();I=G;var ie=!0;try{e:{z=!1,N&&(N=!1,O(B),B=-1),k=!0;var me=y;try{t:{for(E(G),v=d(g);v!==null&&!(v.expirationTime>G&&W());){var ne=v.callback;if(typeof ne=="function"){v.callback=null,y=v.priorityLevel;var we=ne(v.expirationTime<=G);if(G=n.unstable_now(),typeof we=="function"){v.callback=we,E(G),ie=!0;break t}v===d(g)&&c(g),E(G)}else c(g);v=d(g)}if(v!==null)ie=!0;else{var T=d(p);T!==null&&he(ae,T.startTime-G),ie=!1}}break e}finally{v=null,y=me,k=!1}ie=void 0}}finally{ie?le():oe=!1}}}var le;if(typeof D=="function")le=function(){D(Y)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,ce=J.port2;J.port1.onmessage=Y,le=function(){ce.postMessage(null)}}else le=function(){C(Y,0)};function he(G,ie){B=C(function(){G(n.unstable_now())},ie)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(G){G.callback=null},n.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<G?Math.floor(1e3/G):5},n.unstable_getCurrentPriorityLevel=function(){return y},n.unstable_next=function(G){switch(y){case 1:case 2:case 3:var ie=3;break;default:ie=y}var me=y;y=ie;try{return G()}finally{y=me}},n.unstable_requestPaint=function(){S=!0},n.unstable_runWithPriority=function(G,ie){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var me=y;y=G;try{return ie()}finally{y=me}},n.unstable_scheduleCallback=function(G,ie,me){var ne=n.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?ne+me:ne):me=ne,G){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=me+we,G={id:w++,callback:ie,priorityLevel:G,startTime:me,expirationTime:we,sortIndex:-1},me>ne?(G.sortIndex=me,r(p,G),d(g)===null&&G===d(p)&&(N?(O(B),B=-1):N=!0,he(ae,me-ne))):(G.sortIndex=we,r(g,G),z||k||(z=!0,oe||(oe=!0,le()))),G},n.unstable_shouldYield=W,n.unstable_wrapCallback=function(G){var ie=y;return function(){var me=y;y=ie;try{return G.apply(this,arguments)}finally{y=me}}}})(pd)),pd}var xh;function xb(){return xh||(xh=1,hd.exports=mb()),hd.exports}var gd={exports:{}},wt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var fh;function fb(){if(fh)return wt;fh=1;var n=$d();function r(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)p+="&args[]="+encodeURIComponent(arguments[w])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(){}var c={d:{f:d,r:function(){throw Error(r(522))},D:d,C:d,L:d,m:d,X:d,S:d,M:d},p:0,findDOMNode:null},m=Symbol.for("react.portal");function f(g,p,w){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:m,key:v==null?null:""+v,children:g,containerInfo:p,implementation:w}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function b(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,wt.createPortal=function(g,p){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return f(g,p,null,w)},wt.flushSync=function(g){var p=h.T,w=c.p;try{if(h.T=null,c.p=2,g)return g()}finally{h.T=p,c.p=w,c.d.f()}},wt.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,c.d.C(g,p))},wt.prefetchDNS=function(g){typeof g=="string"&&c.d.D(g)},wt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var w=p.as,v=b(w,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,k=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;w==="style"?c.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:y,fetchPriority:k}):w==="script"&&c.d.X(g,{crossOrigin:v,integrity:y,fetchPriority:k,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},wt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var w=b(p.as,p.crossOrigin);c.d.M(g,{crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&c.d.M(g)},wt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var w=p.as,v=b(w,p.crossOrigin);c.d.L(g,w,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},wt.preloadModule=function(g,p){if(typeof g=="string")if(p){var w=b(p.as,p.crossOrigin);c.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else c.d.m(g)},wt.requestFormReset=function(g){c.d.r(g)},wt.unstable_batchedUpdates=function(g,p){return g(p)},wt.useFormState=function(g,p,w){return h.H.useFormState(g,p,w)},wt.useFormStatus=function(){return h.H.useHostTransitionStatus()},wt.version="19.2.4",wt}var hh;function hb(){if(hh)return gd.exports;hh=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),gd.exports=fb(),gd.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var ph;function pb(){if(ph)return Kl;ph=1;var n=xb(),r=$d(),d=hb();function c(e){var a="https://react.dev/errors/"+e;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)a+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function m(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var a=e,s=e;if(e.alternate)for(;a.return;)a=a.return;else{e=a;do a=e,(a.flags&4098)!==0&&(s=a.return),e=a.return;while(e)}return a.tag===3?s:null}function h(e){if(e.tag===13){var a=e.memoizedState;if(a===null&&(e=e.alternate,e!==null&&(a=e.memoizedState)),a!==null)return a.dehydrated}return null}function b(e){if(e.tag===31){var a=e.memoizedState;if(a===null&&(e=e.alternate,e!==null&&(a=e.memoizedState)),a!==null)return a.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(c(188))}function p(e){var a=e.alternate;if(!a){if(a=f(e),a===null)throw Error(c(188));return a!==e?null:e}for(var s=e,l=a;;){var i=s.return;if(i===null)break;var o=i.alternate;if(o===null){if(l=i.return,l!==null){s=l;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===s)return g(i),e;if(o===l)return g(i),a;o=o.sibling}throw Error(c(188))}if(s.return!==l.return)s=i,l=o;else{for(var x=!1,j=i.child;j;){if(j===s){x=!0,s=i,l=o;break}if(j===l){x=!0,l=i,s=o;break}j=j.sibling}if(!x){for(j=o.child;j;){if(j===s){x=!0,s=o,l=i;break}if(j===l){x=!0,l=o,s=i;break}j=j.sibling}if(!x)throw Error(c(189))}}if(s.alternate!==l)throw Error(c(190))}if(s.tag!==3)throw Error(c(188));return s.stateNode.current===s?e:a}function w(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e;for(e=e.child;e!==null;){if(a=w(e),a!==null)return a;e=e.sibling}return null}var v=Object.assign,y=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),D=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=Y&&e[Y]||e["@@iterator"],typeof e=="function"?e:null)}var J=Symbol.for("react.client.reference");function ce(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===J?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case C:return"Profiler";case S:return"StrictMode";case ae:return"Suspense";case oe:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case z:return"Portal";case D:return e.displayName||"Context";case O:return(e._context.displayName||"Context")+".Consumer";case E:var a=e.render;return e=e.displayName,e||(e=a.displayName||a.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return a=e.displayName||null,a!==null?a:ce(e.type)||"Memo";case q:a=e._payload,e=e._init;try{return ce(e(a))}catch{}}return null}var he=Array.isArray,G=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=d.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},ne=[],we=-1;function T(e){return{current:e}}function X(e){0>we||(e.current=ne[we],ne[we]=null,we--)}function re(e,a){we++,ne[we]=e.current,e.current=a}var $=T(null),de=T(null),xe=T(null),be=T(null);function Ce(e,a){switch(re(xe,a),re(de,e),re($,null),a.nodeType){case 9:case 11:e=(e=a.documentElement)&&(e=e.namespaceURI)?Rf(e):0;break;default:if(e=a.tagName,a=a.namespaceURI)a=Rf(a),e=Mf(a,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X($),re($,e)}function ve(){X($),X(de),X(xe)}function Q(e){e.memoizedState!==null&&re(be,e);var a=$.current,s=Mf(a,e.type);a!==s&&(re(de,e),re($,s))}function ee(e){de.current===e&&(X($),X(de)),be.current===e&&(X(be),Bl._currentValue=me)}var ke,ze;function Ue(e){if(ke===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);ke=a&&a[1]||"",ze=-1<s.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+ke+e+ze}var Ie=!1;function De(e,a){if(!e||Ie)return"";Ie=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(a){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(K){var H=K}Reflect.construct(e,[],F)}else{try{F.call()}catch(K){H=K}e.call(F.prototype)}}else{try{throw Error()}catch(K){H=K}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(K){if(K&&H&&typeof K.stack=="string")return[K.stack,H.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=l.DetermineComponentFrameRoot(),x=o[0],j=o[1];if(x&&j){var A=x.split(`
44
+ `),U=j.split(`
45
+ `);for(i=l=0;l<A.length&&!A[l].includes("DetermineComponentFrameRoot");)l++;for(;i<U.length&&!U[i].includes("DetermineComponentFrameRoot");)i++;if(l===A.length||i===U.length)for(l=A.length-1,i=U.length-1;1<=l&&0<=i&&A[l]!==U[i];)i--;for(;1<=l&&0<=i;l--,i--)if(A[l]!==U[i]){if(l!==1||i!==1)do if(l--,i--,0>i||A[l]!==U[i]){var V=`
46
+ `+A[l].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=l&&0<=i);break}}}finally{Ie=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?Ue(s):""}function tt(e,a){switch(e.tag){case 26:case 27:case 5:return Ue(e.type);case 16:return Ue("Lazy");case 13:return e.child!==a&&a!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return De(e.type,!1);case 11:return De(e.type.render,!1);case 1:return De(e.type,!0);case 31:return Ue("Activity");default:return""}}function M(e){try{var a="",s=null;do a+=tt(e,s),s=e,e=e.return;while(e);return a}catch(l){return`
47
+ Error generating stack: `+l.message+`
48
+ `+l.stack}}var P=Object.prototype.hasOwnProperty,ye=n.unstable_scheduleCallback,Ye=n.unstable_cancelCallback,Bt=n.unstable_shouldYield,Ft=n.unstable_requestPaint,ut=n.unstable_now,ri=n.unstable_getCurrentPriorityLevel,Jn=n.unstable_ImmediatePriority,ci=n.unstable_UserBlockingPriority,Ps=n.unstable_NormalPriority,G0=n.unstable_LowPriority,du=n.unstable_IdlePriority,K0=n.log,V0=n.unstable_setDisableYieldValue,Fn=null,$t=null;function Za(e){if(typeof K0=="function"&&V0(e),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(Fn,e)}catch{}}var Ht=Math.clz32?Math.clz32:Q0,Y0=Math.log,X0=Math.LN2;function Q0(e){return e>>>=0,e===0?32:31-(Y0(e)/X0|0)|0}var oi=256,di=262144,ui=4194304;function As(e){var a=e&42;if(a!==0)return a;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function mi(e,a,s){var l=e.pendingLanes;if(l===0)return 0;var i=0,o=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~o,l!==0?i=As(l):(x&=j,x!==0?i=As(x):s||(s=j&~e,s!==0&&(i=As(s))))):(j=l&~o,j!==0?i=As(j):x!==0?i=As(x):s||(s=l&~e,s!==0&&(i=As(s)))),i===0?0:a!==0&&a!==i&&(a&o)===0&&(o=i&-i,s=a&-a,o>=s||o===32&&(s&4194048)!==0)?a:i}function In(e,a){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&a)===0}function Z0(e,a){switch(e){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function uu(){var e=ui;return ui<<=1,(ui&62914560)===0&&(ui=4194304),e}function Pr(e){for(var a=[],s=0;31>s;s++)a.push(e);return a}function Pn(e,a){e.pendingLanes|=a,a!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function J0(e,a,s,l,i,o){var x=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var j=e.entanglements,A=e.expirationTimes,U=e.hiddenUpdates;for(s=x&~s;0<s;){var V=31-Ht(s),F=1<<V;j[V]=0,A[V]=-1;var H=U[V];if(H!==null)for(U[V]=null,V=0;V<H.length;V++){var K=H[V];K!==null&&(K.lane&=-536870913)}s&=~F}l!==0&&mu(e,l,0),o!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=o&~(x&~a))}function mu(e,a,s){e.pendingLanes|=a,e.suspendedLanes&=~a;var l=31-Ht(a);e.entangledLanes|=a,e.entanglements[l]=e.entanglements[l]|1073741824|s&261930}function xu(e,a){var s=e.entangledLanes|=a;for(e=e.entanglements;s;){var l=31-Ht(s),i=1<<l;i&a|e[l]&a&&(e[l]|=a),s&=~i}}function fu(e,a){var s=a&-a;return s=(s&42)!==0?1:Wr(s),(s&(e.suspendedLanes|a))!==0?0:s}function Wr(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ec(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function hu(){var e=ie.p;return e!==0?e:(e=window.event,e===void 0?32:th(e.type))}function pu(e,a){var s=ie.p;try{return ie.p=e,a()}finally{ie.p=s}}var Ja=Math.random().toString(36).slice(2),gt="__reactFiber$"+Ja,Tt="__reactProps$"+Ja,Ws="__reactContainer$"+Ja,tc="__reactEvents$"+Ja,F0="__reactListeners$"+Ja,I0="__reactHandles$"+Ja,gu="__reactResources$"+Ja,Wn="__reactMarker$"+Ja;function ac(e){delete e[gt],delete e[Tt],delete e[tc],delete e[F0],delete e[I0]}function en(e){var a=e[gt];if(a)return a;for(var s=e.parentNode;s;){if(a=s[Ws]||s[gt]){if(s=a.alternate,a.child!==null||s!==null&&s.child!==null)for(e=$f(e);e!==null;){if(s=e[gt])return s;e=$f(e)}return a}e=s,s=e.parentNode}return null}function tn(e){if(e=e[gt]||e[Ws]){var a=e.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return e}return null}function el(e){var a=e.tag;if(a===5||a===26||a===27||a===6)return e.stateNode;throw Error(c(33))}function an(e){var a=e[gu];return a||(a=e[gu]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function mt(e){e[Wn]=!0}var bu=new Set,yu={};function Es(e,a){sn(e,a),sn(e+"Capture",a)}function sn(e,a){for(yu[e]=a,e=0;e<a.length;e++)bu.add(a[e])}var P0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),vu={},ju={};function W0(e){return P.call(ju,e)?!0:P.call(vu,e)?!1:P0.test(e)?ju[e]=!0:(vu[e]=!0,!1)}function xi(e,a,s){if(W0(a))if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(a);return;case"boolean":var l=a.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(a);return}}e.setAttribute(a,""+s)}}function fi(e,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttribute(a,""+s)}}function Sa(e,a,s,l){if(l===null)e.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(a,s,""+l)}}function It(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Nu(e){var a=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ep(e,a,s){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,a);if(!e.hasOwnProperty(a)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var i=l.get,o=l.set;return Object.defineProperty(e,a,{configurable:!0,get:function(){return i.call(this)},set:function(x){s=""+x,o.call(this,x)}}),Object.defineProperty(e,a,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(x){s=""+x},stopTracking:function(){e._valueTracker=null,delete e[a]}}}}function sc(e){if(!e._valueTracker){var a=Nu(e)?"checked":"value";e._valueTracker=ep(e,a,""+e[a])}}function wu(e){if(!e)return!1;var a=e._valueTracker;if(!a)return!0;var s=a.getValue(),l="";return e&&(l=Nu(e)?e.checked?"true":"false":e.value),e=l,e!==s?(a.setValue(e),!0):!1}function hi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var tp=/[\n"\\]/g;function Pt(e){return e.replace(tp,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function nc(e,a,s,l,i,o,x,j){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),a!=null?x==="number"?(a===0&&e.value===""||e.value!=a)&&(e.value=""+It(a)):e.value!==""+It(a)&&(e.value=""+It(a)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),a!=null?lc(e,x,It(a)):s!=null?lc(e,x,It(s)):l!=null&&e.removeAttribute("value"),i==null&&o!=null&&(e.defaultChecked=!!o),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+It(j):e.removeAttribute("name")}function Su(e,a,s,l,i,o,x,j){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),a!=null||s!=null){if(!(o!=="submit"&&o!=="reset"||a!=null)){sc(e);return}s=s!=null?""+It(s):"",a=a!=null?""+It(a):s,j||a===e.value||(e.value=a),e.defaultValue=a}l=l??i,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=j?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),sc(e)}function lc(e,a,s){a==="number"&&hi(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function nn(e,a,s,l){if(e=e.options,a){a={};for(var i=0;i<s.length;i++)a["$"+s[i]]=!0;for(s=0;s<e.length;s++)i=a.hasOwnProperty("$"+e[s].value),e[s].selected!==i&&(e[s].selected=i),i&&l&&(e[s].defaultSelected=!0)}else{for(s=""+It(s),a=null,i=0;i<e.length;i++){if(e[i].value===s){e[i].selected=!0,l&&(e[i].defaultSelected=!0);return}a!==null||e[i].disabled||(a=e[i])}a!==null&&(a.selected=!0)}}function ku(e,a,s){if(a!=null&&(a=""+It(a),a!==e.value&&(e.value=a),s==null)){e.defaultValue!==a&&(e.defaultValue=a);return}e.defaultValue=s!=null?""+It(s):""}function zu(e,a,s,l){if(a==null){if(l!=null){if(s!=null)throw Error(c(92));if(he(l)){if(1<l.length)throw Error(c(93));l=l[0]}s=l}s==null&&(s=""),a=s}s=It(a),e.defaultValue=s,l=e.textContent,l===s&&l!==""&&l!==null&&(e.value=l),sc(e)}function ln(e,a){if(a){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=a;return}}e.textContent=a}var ap=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Cu(e,a,s){var l=a.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?l?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="":l?e.setProperty(a,s):typeof s!="number"||s===0||ap.has(a)?a==="float"?e.cssFloat=s:e[a]=(""+s).trim():e[a]=s+"px"}function Au(e,a,s){if(a!=null&&typeof a!="object")throw Error(c(62));if(e=e.style,s!=null){for(var l in s)!s.hasOwnProperty(l)||a!=null&&a.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var i in a)l=a[i],a.hasOwnProperty(i)&&s[i]!==l&&Cu(e,i,l)}else for(var o in a)a.hasOwnProperty(o)&&Cu(e,o,a[o])}function ic(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sp=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),np=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function pi(e){return np.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ka(){}var rc=null;function cc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rn=null,cn=null;function Eu(e){var a=tn(e);if(a&&(e=a.stateNode)){var s=e[Tt]||null;e:switch(e=a.stateNode,a.type){case"input":if(nc(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),a=s.name,s.type==="radio"&&a!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Pt(""+a)+'"][type="radio"]'),a=0;a<s.length;a++){var l=s[a];if(l!==e&&l.form===e.form){var i=l[Tt]||null;if(!i)throw Error(c(90));nc(l,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(a=0;a<s.length;a++)l=s[a],l.form===e.form&&wu(l)}break e;case"textarea":ku(e,s.value,s.defaultValue);break e;case"select":a=s.value,a!=null&&nn(e,!!s.multiple,a,!1)}}}var oc=!1;function Tu(e,a,s){if(oc)return e(a,s);oc=!0;try{var l=e(a);return l}finally{if(oc=!1,(rn!==null||cn!==null)&&(sr(),rn&&(a=rn,e=cn,cn=rn=null,Eu(a),e)))for(a=0;a<e.length;a++)Eu(e[a])}}function tl(e,a){var s=e.stateNode;if(s===null)return null;var l=s[Tt]||null;if(l===null)return null;s=l[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(c(231,a,typeof s));return s}var za=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dc=!1;if(za)try{var al={};Object.defineProperty(al,"passive",{get:function(){dc=!0}}),window.addEventListener("test",al,al),window.removeEventListener("test",al,al)}catch{dc=!1}var Fa=null,uc=null,gi=null;function Ru(){if(gi)return gi;var e,a=uc,s=a.length,l,i="value"in Fa?Fa.value:Fa.textContent,o=i.length;for(e=0;e<s&&a[e]===i[e];e++);var x=s-e;for(l=1;l<=x&&a[s-l]===i[o-l];l++);return gi=i.slice(e,1<l?1-l:void 0)}function bi(e){var a=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&a===13&&(e=13)):e=a,e===10&&(e=13),32<=e||e===13?e:0}function yi(){return!0}function Mu(){return!1}function Rt(e){function a(s,l,i,o,x){this._reactName=s,this._targetInst=i,this.type=l,this.nativeEvent=o,this.target=x,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(s=e[j],this[j]=s?s(o):o[j]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?yi:Mu,this.isPropagationStopped=Mu,this}return v(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=yi)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=yi)},persist:function(){},isPersistent:yi}),a}var Ts={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vi=Rt(Ts),sl=v({},Ts,{view:0,detail:0}),lp=Rt(sl),mc,xc,nl,ji=v({},sl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nl&&(nl&&e.type==="mousemove"?(mc=e.screenX-nl.screenX,xc=e.screenY-nl.screenY):xc=mc=0,nl=e),mc)},movementY:function(e){return"movementY"in e?e.movementY:xc}}),Du=Rt(ji),ip=v({},ji,{dataTransfer:0}),rp=Rt(ip),cp=v({},sl,{relatedTarget:0}),fc=Rt(cp),op=v({},Ts,{animationName:0,elapsedTime:0,pseudoElement:0}),dp=Rt(op),up=v({},Ts,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),mp=Rt(up),xp=v({},Ts,{data:0}),Ou=Rt(xp),fp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hp={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},pp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gp(e){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(e):(e=pp[e])?!!a[e]:!1}function hc(){return gp}var bp=v({},sl,{key:function(e){if(e.key){var a=fp[e.key]||e.key;if(a!=="Unidentified")return a}return e.type==="keypress"?(e=bi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?hp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(e){return e.type==="keypress"?bi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?bi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),yp=Rt(bp),vp=v({},ji,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lu=Rt(vp),jp=v({},sl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),Np=Rt(jp),wp=v({},Ts,{propertyName:0,elapsedTime:0,pseudoElement:0}),Sp=Rt(wp),kp=v({},ji,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),zp=Rt(kp),Cp=v({},Ts,{newState:0,oldState:0}),Ap=Rt(Cp),Ep=[9,13,27,32],pc=za&&"CompositionEvent"in window,ll=null;za&&"documentMode"in document&&(ll=document.documentMode);var Tp=za&&"TextEvent"in window&&!ll,_u=za&&(!pc||ll&&8<ll&&11>=ll),Uu=" ",Bu=!1;function $u(e,a){switch(e){case"keyup":return Ep.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var on=!1;function Rp(e,a){switch(e){case"compositionend":return Hu(a);case"keypress":return a.which!==32?null:(Bu=!0,Uu);case"textInput":return e=a.data,e===Uu&&Bu?null:e;default:return null}}function Mp(e,a){if(on)return e==="compositionend"||!pc&&$u(e,a)?(e=Ru(),gi=uc=Fa=null,on=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return _u&&a.locale!=="ko"?null:a.data;default:return null}}var Dp={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function qu(e){var a=e&&e.nodeName&&e.nodeName.toLowerCase();return a==="input"?!!Dp[e.type]:a==="textarea"}function Gu(e,a,s,l){rn?cn?cn.push(l):cn=[l]:rn=l,a=dr(a,"onChange"),0<a.length&&(s=new vi("onChange","change",null,s,l),e.push({event:s,listeners:a}))}var il=null,rl=null;function Op(e){kf(e,0)}function Ni(e){var a=el(e);if(wu(a))return e}function Ku(e,a){if(e==="change")return a}var Vu=!1;if(za){var gc;if(za){var bc="oninput"in document;if(!bc){var Yu=document.createElement("div");Yu.setAttribute("oninput","return;"),bc=typeof Yu.oninput=="function"}gc=bc}else gc=!1;Vu=gc&&(!document.documentMode||9<document.documentMode)}function Xu(){il&&(il.detachEvent("onpropertychange",Qu),rl=il=null)}function Qu(e){if(e.propertyName==="value"&&Ni(rl)){var a=[];Gu(a,rl,e,cc(e)),Tu(Op,a)}}function Lp(e,a,s){e==="focusin"?(Xu(),il=a,rl=s,il.attachEvent("onpropertychange",Qu)):e==="focusout"&&Xu()}function _p(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ni(rl)}function Up(e,a){if(e==="click")return Ni(a)}function Bp(e,a){if(e==="input"||e==="change")return Ni(a)}function $p(e,a){return e===a&&(e!==0||1/e===1/a)||e!==e&&a!==a}var qt=typeof Object.is=="function"?Object.is:$p;function cl(e,a){if(qt(e,a))return!0;if(typeof e!="object"||e===null||typeof a!="object"||a===null)return!1;var s=Object.keys(e),l=Object.keys(a);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var i=s[l];if(!P.call(a,i)||!qt(e[i],a[i]))return!1}return!0}function Zu(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ju(e,a){var s=Zu(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=a&&l>=a)return{node:s,offset:a-e};e=l}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Zu(s)}}function Fu(e,a){return e&&a?e===a?!0:e&&e.nodeType===3?!1:a&&a.nodeType===3?Fu(e,a.parentNode):"contains"in e?e.contains(a):e.compareDocumentPosition?!!(e.compareDocumentPosition(a)&16):!1:!1}function Iu(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var a=hi(e.document);a instanceof e.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)e=a.contentWindow;else break;a=hi(e.document)}return a}function yc(e){var a=e&&e.nodeName&&e.nodeName.toLowerCase();return a&&(a==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||a==="textarea"||e.contentEditable==="true")}var Hp=za&&"documentMode"in document&&11>=document.documentMode,dn=null,vc=null,ol=null,jc=!1;function Pu(e,a,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;jc||dn==null||dn!==hi(l)||(l=dn,"selectionStart"in l&&yc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ol&&cl(ol,l)||(ol=l,l=dr(vc,"onSelect"),0<l.length&&(a=new vi("onSelect","select",null,a,s),e.push({event:a,listeners:l}),a.target=dn)))}function Rs(e,a){var s={};return s[e.toLowerCase()]=a.toLowerCase(),s["Webkit"+e]="webkit"+a,s["Moz"+e]="moz"+a,s}var un={animationend:Rs("Animation","AnimationEnd"),animationiteration:Rs("Animation","AnimationIteration"),animationstart:Rs("Animation","AnimationStart"),transitionrun:Rs("Transition","TransitionRun"),transitionstart:Rs("Transition","TransitionStart"),transitioncancel:Rs("Transition","TransitionCancel"),transitionend:Rs("Transition","TransitionEnd")},Nc={},Wu={};za&&(Wu=document.createElement("div").style,"AnimationEvent"in window||(delete un.animationend.animation,delete un.animationiteration.animation,delete un.animationstart.animation),"TransitionEvent"in window||delete un.transitionend.transition);function Ms(e){if(Nc[e])return Nc[e];if(!un[e])return e;var a=un[e],s;for(s in a)if(a.hasOwnProperty(s)&&s in Wu)return Nc[e]=a[s];return e}var em=Ms("animationend"),tm=Ms("animationiteration"),am=Ms("animationstart"),qp=Ms("transitionrun"),Gp=Ms("transitionstart"),Kp=Ms("transitioncancel"),sm=Ms("transitionend"),nm=new Map,wc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");wc.push("scrollEnd");function da(e,a){nm.set(e,a),Es(a,[e])}var wi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Wt=[],mn=0,Sc=0;function Si(){for(var e=mn,a=Sc=mn=0;a<e;){var s=Wt[a];Wt[a++]=null;var l=Wt[a];Wt[a++]=null;var i=Wt[a];Wt[a++]=null;var o=Wt[a];if(Wt[a++]=null,l!==null&&i!==null){var x=l.pending;x===null?i.next=i:(i.next=x.next,x.next=i),l.pending=i}o!==0&&lm(s,i,o)}}function ki(e,a,s,l){Wt[mn++]=e,Wt[mn++]=a,Wt[mn++]=s,Wt[mn++]=l,Sc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function kc(e,a,s,l){return ki(e,a,s,l),zi(e)}function Ds(e,a){return ki(e,null,null,a),zi(e)}function lm(e,a,s){e.lanes|=s;var l=e.alternate;l!==null&&(l.lanes|=s);for(var i=!1,o=e.return;o!==null;)o.childLanes|=s,l=o.alternate,l!==null&&(l.childLanes|=s),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(i=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,i&&a!==null&&(i=31-Ht(s),e=o.hiddenUpdates,l=e[i],l===null?e[i]=[a]:l.push(a),a.lane=s|536870912),o):null}function zi(e){if(50<Rl)throw Rl=0,Lo=null,Error(c(185));for(var a=e.return;a!==null;)e=a,a=e.return;return e.tag===3?e.stateNode:null}var xn={};function Vp(e,a,s,l){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gt(e,a,s,l){return new Vp(e,a,s,l)}function zc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ca(e,a){var s=e.alternate;return s===null?(s=Gt(e.tag,a,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=a,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,a=e.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function im(e,a){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=a,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,a=s.dependencies,e.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),e}function Ci(e,a,s,l,i,o){var x=0;if(l=e,typeof e=="function")zc(e)&&(x=1);else if(typeof e=="string")x=Jg(e,s,$.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=Gt(31,s,a,i),e.elementType=I,e.lanes=o,e;case N:return Os(s.children,i,o,a);case S:x=8,i|=24;break;case C:return e=Gt(12,s,a,i|2),e.elementType=C,e.lanes=o,e;case ae:return e=Gt(13,s,a,i),e.elementType=ae,e.lanes=o,e;case oe:return e=Gt(19,s,a,i),e.elementType=oe,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:x=10;break e;case O:x=9;break e;case E:x=11;break e;case B:x=14;break e;case q:x=16,l=null;break e}x=29,s=Error(c(130,e===null?"null":typeof e,"")),l=null}return a=Gt(x,s,a,i),a.elementType=e,a.type=l,a.lanes=o,a}function Os(e,a,s,l){return e=Gt(7,e,l,a),e.lanes=s,e}function Cc(e,a,s){return e=Gt(6,e,null,a),e.lanes=s,e}function rm(e){var a=Gt(18,null,null,0);return a.stateNode=e,a}function Ac(e,a,s){return a=Gt(4,e.children!==null?e.children:[],e.key,a),a.lanes=s,a.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},a}var cm=new WeakMap;function ea(e,a){if(typeof e=="object"&&e!==null){var s=cm.get(e);return s!==void 0?s:(a={value:e,source:a,stack:M(a)},cm.set(e,a),a)}return{value:e,source:a,stack:M(a)}}var fn=[],hn=0,Ai=null,dl=0,ta=[],aa=0,Ia=null,ha=1,pa="";function Aa(e,a){fn[hn++]=dl,fn[hn++]=Ai,Ai=e,dl=a}function om(e,a,s){ta[aa++]=ha,ta[aa++]=pa,ta[aa++]=Ia,Ia=e;var l=ha;e=pa;var i=32-Ht(l)-1;l&=~(1<<i),s+=1;var o=32-Ht(a)+i;if(30<o){var x=i-i%5;o=(l&(1<<x)-1).toString(32),l>>=x,i-=x,ha=1<<32-Ht(a)+i|s<<i|l,pa=o+e}else ha=1<<o|s<<i|l,pa=e}function Ec(e){e.return!==null&&(Aa(e,1),om(e,1,0))}function Tc(e){for(;e===Ai;)Ai=fn[--hn],fn[hn]=null,dl=fn[--hn],fn[hn]=null;for(;e===Ia;)Ia=ta[--aa],ta[aa]=null,pa=ta[--aa],ta[aa]=null,ha=ta[--aa],ta[aa]=null}function dm(e,a){ta[aa++]=ha,ta[aa++]=pa,ta[aa++]=Ia,ha=a.id,pa=a.overflow,Ia=e}var bt=null,Qe=null,Me=!1,Pa=null,sa=!1,Rc=Error(c(519));function Wa(e){var a=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ul(ea(a,e)),Rc}function um(e){var a=e.stateNode,s=e.type,l=e.memoizedProps;switch(a[gt]=e,a[Tt]=l,s){case"dialog":Ee("cancel",a),Ee("close",a);break;case"iframe":case"object":case"embed":Ee("load",a);break;case"video":case"audio":for(s=0;s<Dl.length;s++)Ee(Dl[s],a);break;case"source":Ee("error",a);break;case"img":case"image":case"link":Ee("error",a),Ee("load",a);break;case"details":Ee("toggle",a);break;case"input":Ee("invalid",a),Su(a,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ee("invalid",a);break;case"textarea":Ee("invalid",a),zu(a,l.value,l.defaultValue,l.children)}s=l.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||a.textContent===""+s||l.suppressHydrationWarning===!0||Ef(a.textContent,s)?(l.popover!=null&&(Ee("beforetoggle",a),Ee("toggle",a)),l.onScroll!=null&&Ee("scroll",a),l.onScrollEnd!=null&&Ee("scrollend",a),l.onClick!=null&&(a.onclick=ka),a=!0):a=!1,a||Wa(e,!0)}function mm(e){for(bt=e.return;bt;)switch(bt.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:bt=bt.return}}function pn(e){if(e!==bt)return!1;if(!Me)return mm(e),Me=!0,!1;var a=e.tag,s;if((s=a!==3&&a!==27)&&((s=a===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Fo(e.type,e.memoizedProps)),s=!s),s&&Qe&&Wa(e),mm(e),a===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));Qe=Bf(e)}else if(a===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));Qe=Bf(e)}else a===27?(a=Qe,xs(e.type)?(e=td,td=null,Qe=e):Qe=a):Qe=bt?la(e.stateNode.nextSibling):null;return!0}function Ls(){Qe=bt=null,Me=!1}function Mc(){var e=Pa;return e!==null&&(Lt===null?Lt=e:Lt.push.apply(Lt,e),Pa=null),e}function ul(e){Pa===null?Pa=[e]:Pa.push(e)}var Dc=T(null),_s=null,Ea=null;function es(e,a,s){re(Dc,a._currentValue),a._currentValue=s}function Ta(e){e._currentValue=Dc.current,X(Dc)}function Oc(e,a,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&a)!==a?(e.childLanes|=a,l!==null&&(l.childLanes|=a)):l!==null&&(l.childLanes&a)!==a&&(l.childLanes|=a),e===s)break;e=e.return}}function Lc(e,a,s,l){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var x=i.child;o=o.firstContext;e:for(;o!==null;){var j=o;o=i;for(var A=0;A<a.length;A++)if(j.context===a[A]){o.lanes|=s,j=o.alternate,j!==null&&(j.lanes|=s),Oc(o.return,s,e),l||(x=null);break e}o=j.next}}else if(i.tag===18){if(x=i.return,x===null)throw Error(c(341));x.lanes|=s,o=x.alternate,o!==null&&(o.lanes|=s),Oc(x,s,e),x=null}else x=i.child;if(x!==null)x.return=i;else for(x=i;x!==null;){if(x===e){x=null;break}if(i=x.sibling,i!==null){i.return=x.return,x=i;break}x=x.return}i=x}}function gn(e,a,s,l){e=null;for(var i=a,o=!1;i!==null;){if(!o){if((i.flags&524288)!==0)o=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var x=i.alternate;if(x===null)throw Error(c(387));if(x=x.memoizedProps,x!==null){var j=i.type;qt(i.pendingProps.value,x.value)||(e!==null?e.push(j):e=[j])}}else if(i===be.current){if(x=i.alternate,x===null)throw Error(c(387));x.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Bl):e=[Bl])}i=i.return}e!==null&&Lc(a,e,s,l),a.flags|=262144}function Ei(e){for(e=e.firstContext;e!==null;){if(!qt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Us(e){_s=e,Ea=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return xm(_s,e)}function Ti(e,a){return _s===null&&Us(e),xm(e,a)}function xm(e,a){var s=a._currentValue;if(a={context:a,memoizedValue:s,next:null},Ea===null){if(e===null)throw Error(c(308));Ea=a,e.dependencies={lanes:0,firstContext:a},e.flags|=524288}else Ea=Ea.next=a;return s}var Yp=typeof AbortController<"u"?AbortController:function(){var e=[],a=this.signal={aborted:!1,addEventListener:function(s,l){e.push(l)}};this.abort=function(){a.aborted=!0,e.forEach(function(s){return s()})}},Xp=n.unstable_scheduleCallback,Qp=n.unstable_NormalPriority,lt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _c(){return{controller:new Yp,data:new Map,refCount:0}}function ml(e){e.refCount--,e.refCount===0&&Xp(Qp,function(){e.controller.abort()})}var xl=null,Uc=0,bn=0,yn=null;function Zp(e,a){if(xl===null){var s=xl=[];Uc=0,bn=qo(),yn={status:"pending",value:void 0,then:function(l){s.push(l)}}}return Uc++,a.then(fm,fm),a}function fm(){if(--Uc===0&&xl!==null){yn!==null&&(yn.status="fulfilled");var e=xl;xl=null,bn=0,yn=null;for(var a=0;a<e.length;a++)(0,e[a])()}}function Jp(e,a){var s=[],l={status:"pending",value:null,reason:null,then:function(i){s.push(i)}};return e.then(function(){l.status="fulfilled",l.value=a;for(var i=0;i<s.length;i++)(0,s[i])(a)},function(i){for(l.status="rejected",l.reason=i,i=0;i<s.length;i++)(0,s[i])(void 0)}),l}var hm=G.S;G.S=function(e,a){Px=ut(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&Zp(e,a),hm!==null&&hm(e,a)};var Bs=T(null);function Bc(){var e=Bs.current;return e!==null?e:Ve.pooledCache}function Ri(e,a){a===null?re(Bs,Bs.current):re(Bs,a.pool)}function pm(){var e=Bc();return e===null?null:{parent:lt._currentValue,pool:e}}var vn=Error(c(460)),$c=Error(c(474)),Mi=Error(c(542)),Di={then:function(){}};function gm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function bm(e,a,s){switch(s=e[s],s===void 0?e.push(a):s!==a&&(a.then(ka,ka),a=s),a.status){case"fulfilled":return a.value;case"rejected":throw e=a.reason,vm(e),e;default:if(typeof a.status=="string")a.then(ka,ka);else{if(e=Ve,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=a,e.status="pending",e.then(function(l){if(a.status==="pending"){var i=a;i.status="fulfilled",i.value=l}},function(l){if(a.status==="pending"){var i=a;i.status="rejected",i.reason=l}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw e=a.reason,vm(e),e}throw Hs=a,vn}}function $s(e){try{var a=e._init;return a(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Hs=s,vn):s}}var Hs=null;function ym(){if(Hs===null)throw Error(c(459));var e=Hs;return Hs=null,e}function vm(e){if(e===vn||e===Mi)throw Error(c(483))}var jn=null,fl=0;function Oi(e){var a=fl;return fl+=1,jn===null&&(jn=[]),bm(jn,e,a)}function hl(e,a){a=a.props.ref,e.ref=a!==void 0?a:null}function Li(e,a){throw a.$$typeof===y?Error(c(525)):(e=Object.prototype.toString.call(a),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":e)))}function jm(e){function a(L,R){if(e){var _=L.deletions;_===null?(L.deletions=[R],L.flags|=16):_.push(R)}}function s(L,R){if(!e)return null;for(;R!==null;)a(L,R),R=R.sibling;return null}function l(L){for(var R=new Map;L!==null;)L.key!==null?R.set(L.key,L):R.set(L.index,L),L=L.sibling;return R}function i(L,R){return L=Ca(L,R),L.index=0,L.sibling=null,L}function o(L,R,_){return L.index=_,e?(_=L.alternate,_!==null?(_=_.index,_<R?(L.flags|=67108866,R):_):(L.flags|=67108866,R)):(L.flags|=1048576,R)}function x(L){return e&&L.alternate===null&&(L.flags|=67108866),L}function j(L,R,_,Z){return R===null||R.tag!==6?(R=Cc(_,L.mode,Z),R.return=L,R):(R=i(R,_),R.return=L,R)}function A(L,R,_,Z){var pe=_.type;return pe===N?V(L,R,_.props.children,Z,_.key):R!==null&&(R.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===q&&$s(pe)===R.type)?(R=i(R,_.props),hl(R,_),R.return=L,R):(R=Ci(_.type,_.key,_.props,null,L.mode,Z),hl(R,_),R.return=L,R)}function U(L,R,_,Z){return R===null||R.tag!==4||R.stateNode.containerInfo!==_.containerInfo||R.stateNode.implementation!==_.implementation?(R=Ac(_,L.mode,Z),R.return=L,R):(R=i(R,_.children||[]),R.return=L,R)}function V(L,R,_,Z,pe){return R===null||R.tag!==7?(R=Os(_,L.mode,Z,pe),R.return=L,R):(R=i(R,_),R.return=L,R)}function F(L,R,_){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=Cc(""+R,L.mode,_),R.return=L,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case k:return _=Ci(R.type,R.key,R.props,null,L.mode,_),hl(_,R),_.return=L,_;case z:return R=Ac(R,L.mode,_),R.return=L,R;case q:return R=$s(R),F(L,R,_)}if(he(R)||le(R))return R=Os(R,L.mode,_,null),R.return=L,R;if(typeof R.then=="function")return F(L,Oi(R),_);if(R.$$typeof===D)return F(L,Ti(L,R),_);Li(L,R)}return null}function H(L,R,_,Z){var pe=R!==null?R.key:null;if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return pe!==null?null:j(L,R,""+_,Z);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case k:return _.key===pe?A(L,R,_,Z):null;case z:return _.key===pe?U(L,R,_,Z):null;case q:return _=$s(_),H(L,R,_,Z)}if(he(_)||le(_))return pe!==null?null:V(L,R,_,Z,null);if(typeof _.then=="function")return H(L,R,Oi(_),Z);if(_.$$typeof===D)return H(L,R,Ti(L,_),Z);Li(L,_)}return null}function K(L,R,_,Z,pe){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return L=L.get(_)||null,j(R,L,""+Z,pe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case k:return L=L.get(Z.key===null?_:Z.key)||null,A(R,L,Z,pe);case z:return L=L.get(Z.key===null?_:Z.key)||null,U(R,L,Z,pe);case q:return Z=$s(Z),K(L,R,_,Z,pe)}if(he(Z)||le(Z))return L=L.get(_)||null,V(R,L,Z,pe,null);if(typeof Z.then=="function")return K(L,R,_,Oi(Z),pe);if(Z.$$typeof===D)return K(L,R,_,Ti(R,Z),pe);Li(R,Z)}return null}function ue(L,R,_,Z){for(var pe=null,Le=null,fe=R,Se=R=0,Re=null;fe!==null&&Se<_.length;Se++){fe.index>Se?(Re=fe,fe=null):Re=fe.sibling;var _e=H(L,fe,_[Se],Z);if(_e===null){fe===null&&(fe=Re);break}e&&fe&&_e.alternate===null&&a(L,fe),R=o(_e,R,Se),Le===null?pe=_e:Le.sibling=_e,Le=_e,fe=Re}if(Se===_.length)return s(L,fe),Me&&Aa(L,Se),pe;if(fe===null){for(;Se<_.length;Se++)fe=F(L,_[Se],Z),fe!==null&&(R=o(fe,R,Se),Le===null?pe=fe:Le.sibling=fe,Le=fe);return Me&&Aa(L,Se),pe}for(fe=l(fe);Se<_.length;Se++)Re=K(fe,L,Se,_[Se],Z),Re!==null&&(e&&Re.alternate!==null&&fe.delete(Re.key===null?Se:Re.key),R=o(Re,R,Se),Le===null?pe=Re:Le.sibling=Re,Le=Re);return e&&fe.forEach(function(bs){return a(L,bs)}),Me&&Aa(L,Se),pe}function ge(L,R,_,Z){if(_==null)throw Error(c(151));for(var pe=null,Le=null,fe=R,Se=R=0,Re=null,_e=_.next();fe!==null&&!_e.done;Se++,_e=_.next()){fe.index>Se?(Re=fe,fe=null):Re=fe.sibling;var bs=H(L,fe,_e.value,Z);if(bs===null){fe===null&&(fe=Re);break}e&&fe&&bs.alternate===null&&a(L,fe),R=o(bs,R,Se),Le===null?pe=bs:Le.sibling=bs,Le=bs,fe=Re}if(_e.done)return s(L,fe),Me&&Aa(L,Se),pe;if(fe===null){for(;!_e.done;Se++,_e=_.next())_e=F(L,_e.value,Z),_e!==null&&(R=o(_e,R,Se),Le===null?pe=_e:Le.sibling=_e,Le=_e);return Me&&Aa(L,Se),pe}for(fe=l(fe);!_e.done;Se++,_e=_.next())_e=K(fe,L,Se,_e.value,Z),_e!==null&&(e&&_e.alternate!==null&&fe.delete(_e.key===null?Se:_e.key),R=o(_e,R,Se),Le===null?pe=_e:Le.sibling=_e,Le=_e);return e&&fe.forEach(function(ib){return a(L,ib)}),Me&&Aa(L,Se),pe}function Ke(L,R,_,Z){if(typeof _=="object"&&_!==null&&_.type===N&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case k:e:{for(var pe=_.key;R!==null;){if(R.key===pe){if(pe=_.type,pe===N){if(R.tag===7){s(L,R.sibling),Z=i(R,_.props.children),Z.return=L,L=Z;break e}}else if(R.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===q&&$s(pe)===R.type){s(L,R.sibling),Z=i(R,_.props),hl(Z,_),Z.return=L,L=Z;break e}s(L,R);break}else a(L,R);R=R.sibling}_.type===N?(Z=Os(_.props.children,L.mode,Z,_.key),Z.return=L,L=Z):(Z=Ci(_.type,_.key,_.props,null,L.mode,Z),hl(Z,_),Z.return=L,L=Z)}return x(L);case z:e:{for(pe=_.key;R!==null;){if(R.key===pe)if(R.tag===4&&R.stateNode.containerInfo===_.containerInfo&&R.stateNode.implementation===_.implementation){s(L,R.sibling),Z=i(R,_.children||[]),Z.return=L,L=Z;break e}else{s(L,R);break}else a(L,R);R=R.sibling}Z=Ac(_,L.mode,Z),Z.return=L,L=Z}return x(L);case q:return _=$s(_),Ke(L,R,_,Z)}if(he(_))return ue(L,R,_,Z);if(le(_)){if(pe=le(_),typeof pe!="function")throw Error(c(150));return _=pe.call(_),ge(L,R,_,Z)}if(typeof _.then=="function")return Ke(L,R,Oi(_),Z);if(_.$$typeof===D)return Ke(L,R,Ti(L,_),Z);Li(L,_)}return typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint"?(_=""+_,R!==null&&R.tag===6?(s(L,R.sibling),Z=i(R,_),Z.return=L,L=Z):(s(L,R),Z=Cc(_,L.mode,Z),Z.return=L,L=Z),x(L)):s(L,R)}return function(L,R,_,Z){try{fl=0;var pe=Ke(L,R,_,Z);return jn=null,pe}catch(fe){if(fe===vn||fe===Mi)throw fe;var Le=Gt(29,fe,null,L.mode);return Le.lanes=Z,Le.return=L,Le}finally{}}}var qs=jm(!0),Nm=jm(!1),ts=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(e,a){e=e.updateQueue,a.updateQueue===e&&(a.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function as(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ss(e,a,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Be&2)!==0){var i=l.pending;return i===null?a.next=a:(a.next=i.next,i.next=a),l.pending=a,a=zi(e),lm(e,null,s),a}return ki(e,l,a,s),zi(e)}function pl(e,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var l=a.lanes;l&=e.pendingLanes,s|=l,a.lanes=s,xu(e,s)}}function Gc(e,a){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var i=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var x={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};o===null?i=o=x:o=o.next=x,s=s.next}while(s!==null);o===null?i=o=a:o=o.next=a}else i=o=a;s={baseState:l.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:l.shared,callbacks:l.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=a:e.next=a,s.lastBaseUpdate=a}var Kc=!1;function gl(){if(Kc){var e=yn;if(e!==null)throw e}}function bl(e,a,s,l){Kc=!1;var i=e.updateQueue;ts=!1;var o=i.firstBaseUpdate,x=i.lastBaseUpdate,j=i.shared.pending;if(j!==null){i.shared.pending=null;var A=j,U=A.next;A.next=null,x===null?o=U:x.next=U,x=A;var V=e.alternate;V!==null&&(V=V.updateQueue,j=V.lastBaseUpdate,j!==x&&(j===null?V.firstBaseUpdate=U:j.next=U,V.lastBaseUpdate=A))}if(o!==null){var F=i.baseState;x=0,V=U=A=null,j=o;do{var H=j.lane&-536870913,K=H!==j.lane;if(K?(Te&H)===H:(l&H)===H){H!==0&&H===bn&&(Kc=!0),V!==null&&(V=V.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ue=e,ge=j;H=a;var Ke=s;switch(ge.tag){case 1:if(ue=ge.payload,typeof ue=="function"){F=ue.call(Ke,F,H);break e}F=ue;break e;case 3:ue.flags=ue.flags&-65537|128;case 0:if(ue=ge.payload,H=typeof ue=="function"?ue.call(Ke,F,H):ue,H==null)break e;F=v({},F,H);break e;case 2:ts=!0}}H=j.callback,H!==null&&(e.flags|=64,K&&(e.flags|=8192),K=i.callbacks,K===null?i.callbacks=[H]:K.push(H))}else K={lane:H,tag:j.tag,payload:j.payload,callback:j.callback,next:null},V===null?(U=V=K,A=F):V=V.next=K,x|=H;if(j=j.next,j===null){if(j=i.shared.pending,j===null)break;K=j,j=K.next,K.next=null,i.lastBaseUpdate=K,i.shared.pending=null}}while(!0);V===null&&(A=F),i.baseState=A,i.firstBaseUpdate=U,i.lastBaseUpdate=V,o===null&&(i.shared.lanes=0),cs|=x,e.lanes=x,e.memoizedState=F}}function wm(e,a){if(typeof e!="function")throw Error(c(191,e));e.call(a)}function Sm(e,a){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)wm(s[e],a)}var Nn=T(null),_i=T(0);function km(e,a){e=$a,re(_i,e),re(Nn,a),$a=e|a.baseLanes}function Vc(){re(_i,$a),re(Nn,Nn.current)}function Yc(){$a=_i.current,X(Nn),X(_i)}var Kt=T(null),na=null;function ns(e){var a=e.alternate;re(at,at.current&1),re(Kt,e),na===null&&(a===null||Nn.current!==null||a.memoizedState!==null)&&(na=e)}function Xc(e){re(at,at.current),re(Kt,e),na===null&&(na=e)}function zm(e){e.tag===22?(re(at,at.current),re(Kt,e),na===null&&(na=e)):ls()}function ls(){re(at,at.current),re(Kt,Kt.current)}function Vt(e){X(Kt),na===e&&(na=null),X(at)}var at=T(0);function Ui(e){for(var a=e;a!==null;){if(a.tag===13){var s=a.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Wo(s)||ed(s)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===e)break;for(;a.sibling===null;){if(a.return===null||a.return===e)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ra=0,Ne=null,qe=null,it=null,Bi=!1,wn=!1,Gs=!1,$i=0,yl=0,Sn=null,Fp=0;function Pe(){throw Error(c(321))}function Qc(e,a){if(a===null)return!1;for(var s=0;s<a.length&&s<e.length;s++)if(!qt(e[s],a[s]))return!1;return!0}function Zc(e,a,s,l,i,o){return Ra=o,Ne=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,G.H=e===null||e.memoizedState===null?ox:oo,Gs=!1,o=s(l,i),Gs=!1,wn&&(o=Am(a,s,l,i)),Cm(e),o}function Cm(e){G.H=Nl;var a=qe!==null&&qe.next!==null;if(Ra=0,it=qe=Ne=null,Bi=!1,yl=0,Sn=null,a)throw Error(c(300));e===null||rt||(e=e.dependencies,e!==null&&Ei(e)&&(rt=!0))}function Am(e,a,s,l){Ne=e;var i=0;do{if(wn&&(Sn=null),yl=0,wn=!1,25<=i)throw Error(c(301));if(i+=1,it=qe=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}G.H=dx,o=a(s,l)}while(wn);return o}function Ip(){var e=G.H,a=e.useState()[0];return a=typeof a.then=="function"?vl(a):a,e=e.useState()[0],(qe!==null?qe.memoizedState:null)!==e&&(Ne.flags|=1024),a}function Jc(){var e=$i!==0;return $i=0,e}function Fc(e,a,s){a.updateQueue=e.updateQueue,a.flags&=-2053,e.lanes&=~s}function Ic(e){if(Bi){for(e=e.memoizedState;e!==null;){var a=e.queue;a!==null&&(a.pending=null),e=e.next}Bi=!1}Ra=0,it=qe=Ne=null,wn=!1,yl=$i=0,Sn=null}function zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Ne.memoizedState=it=e:it=it.next=e,it}function st(){if(qe===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=qe.next;var a=it===null?Ne.memoizedState:it.next;if(a!==null)it=a,qe=e;else{if(e===null)throw Ne.alternate===null?Error(c(467)):Error(c(310));qe=e,e={memoizedState:qe.memoizedState,baseState:qe.baseState,baseQueue:qe.baseQueue,queue:qe.queue,next:null},it===null?Ne.memoizedState=it=e:it=it.next=e}return it}function Hi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vl(e){var a=yl;return yl+=1,Sn===null&&(Sn=[]),e=bm(Sn,e,a),a=Ne,(it===null?a.memoizedState:it.next)===null&&(a=a.alternate,G.H=a===null||a.memoizedState===null?ox:oo),e}function qi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return vl(e);if(e.$$typeof===D)return yt(e)}throw Error(c(438,String(e)))}function Pc(e){var a=null,s=Ne.updateQueue;if(s!==null&&(a=s.memoCache),a==null){var l=Ne.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(a={data:l.data.map(function(i){return i.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),s===null&&(s=Hi(),Ne.updateQueue=s),s.memoCache=a,s=a.data[a.index],s===void 0)for(s=a.data[a.index]=Array(e),l=0;l<e;l++)s[l]=W;return a.index++,s}function Ma(e,a){return typeof a=="function"?a(e):a}function Gi(e){var a=st();return Wc(a,qe,e)}function Wc(e,a,s){var l=e.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=s;var i=e.baseQueue,o=l.pending;if(o!==null){if(i!==null){var x=i.next;i.next=o.next,o.next=x}a.baseQueue=i=o,l.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{a=i.next;var j=x=null,A=null,U=a,V=!1;do{var F=U.lane&-536870913;if(F!==U.lane?(Te&F)===F:(Ra&F)===F){var H=U.revertLane;if(H===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),F===bn&&(V=!0);else if((Ra&H)===H){U=U.next,H===bn&&(V=!0);continue}else F={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},A===null?(j=A=F,x=o):A=A.next=F,Ne.lanes|=H,cs|=H;F=U.action,Gs&&s(o,F),o=U.hasEagerState?U.eagerState:s(o,F)}else H={lane:F,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},A===null?(j=A=H,x=o):A=A.next=H,Ne.lanes|=F,cs|=F;U=U.next}while(U!==null&&U!==a);if(A===null?x=o:A.next=j,!qt(o,e.memoizedState)&&(rt=!0,V&&(s=yn,s!==null)))throw s;e.memoizedState=o,e.baseState=x,e.baseQueue=A,l.lastRenderedState=o}return i===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function eo(e){var a=st(),s=a.queue;if(s===null)throw Error(c(311));s.lastRenderedReducer=e;var l=s.dispatch,i=s.pending,o=a.memoizedState;if(i!==null){s.pending=null;var x=i=i.next;do o=e(o,x.action),x=x.next;while(x!==i);qt(o,a.memoizedState)||(rt=!0),a.memoizedState=o,a.baseQueue===null&&(a.baseState=o),s.lastRenderedState=o}return[o,l]}function Em(e,a,s){var l=Ne,i=st(),o=Me;if(o){if(s===void 0)throw Error(c(407));s=s()}else s=a();var x=!qt((qe||i).memoizedState,s);if(x&&(i.memoizedState=s,rt=!0),i=i.queue,so(Mm.bind(null,l,i,e),[e]),i.getSnapshot!==a||x||it!==null&&it.memoizedState.tag&1){if(l.flags|=2048,kn(9,{destroy:void 0},Rm.bind(null,l,i,s,a),null),Ve===null)throw Error(c(349));o||(Ra&127)!==0||Tm(l,a,s)}return s}function Tm(e,a,s){e.flags|=16384,e={getSnapshot:a,value:s},a=Ne.updateQueue,a===null?(a=Hi(),Ne.updateQueue=a,a.stores=[e]):(s=a.stores,s===null?a.stores=[e]:s.push(e))}function Rm(e,a,s,l){a.value=s,a.getSnapshot=l,Dm(a)&&Om(e)}function Mm(e,a,s){return s(function(){Dm(a)&&Om(e)})}function Dm(e){var a=e.getSnapshot;e=e.value;try{var s=a();return!qt(e,s)}catch{return!0}}function Om(e){var a=Ds(e,2);a!==null&&_t(a,e,2)}function to(e){var a=zt();if(typeof e=="function"){var s=e;if(e=s(),Gs){Za(!0);try{s()}finally{Za(!1)}}}return a.memoizedState=a.baseState=e,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:e},a}function Lm(e,a,s,l){return e.baseState=s,Wc(e,qe,typeof l=="function"?l:Ma)}function Pp(e,a,s,l,i){if(Yi(e))throw Error(c(485));if(e=a.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){o.listeners.push(x)}};G.T!==null?s(!0):o.isTransition=!1,l(o),s=a.pending,s===null?(o.next=a.pending=o,_m(a,o)):(o.next=s.next,a.pending=s.next=o)}}function _m(e,a){var s=a.action,l=a.payload,i=e.state;if(a.isTransition){var o=G.T,x={};G.T=x;try{var j=s(i,l),A=G.S;A!==null&&A(x,j),Um(e,a,j)}catch(U){ao(e,a,U)}finally{o!==null&&x.types!==null&&(o.types=x.types),G.T=o}}else try{o=s(i,l),Um(e,a,o)}catch(U){ao(e,a,U)}}function Um(e,a,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){Bm(e,a,l)},function(l){return ao(e,a,l)}):Bm(e,a,s)}function Bm(e,a,s){a.status="fulfilled",a.value=s,$m(a),e.state=s,a=e.pending,a!==null&&(s=a.next,s===a?e.pending=null:(s=s.next,a.next=s,_m(e,s)))}function ao(e,a,s){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do a.status="rejected",a.reason=s,$m(a),a=a.next;while(a!==l)}e.action=null}function $m(e){e=e.listeners;for(var a=0;a<e.length;a++)(0,e[a])()}function Hm(e,a){return a}function qm(e,a){if(Me){var s=Ve.formState;if(s!==null){e:{var l=Ne;if(Me){if(Qe){t:{for(var i=Qe,o=sa;i.nodeType!==8;){if(!o){i=null;break t}if(i=la(i.nextSibling),i===null){i=null;break t}}o=i.data,i=o==="F!"||o==="F"?i:null}if(i){Qe=la(i.nextSibling),l=i.data==="F!";break e}}Wa(l)}l=!1}l&&(a=s[0])}}return s=zt(),s.memoizedState=s.baseState=a,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hm,lastRenderedState:a},s.queue=l,s=ix.bind(null,Ne,l),l.dispatch=s,l=to(!1),o=co.bind(null,Ne,!1,l.queue),l=zt(),i={state:a,dispatch:null,action:e,pending:null},l.queue=i,s=Pp.bind(null,Ne,i,o,s),i.dispatch=s,l.memoizedState=e,[a,s,!1]}function Gm(e){var a=st();return Km(a,qe,e)}function Km(e,a,s){if(a=Wc(e,a,Hm)[0],e=Gi(Ma)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var l=vl(a)}catch(x){throw x===vn?Mi:x}else l=a;a=st();var i=a.queue,o=i.dispatch;return s!==a.memoizedState&&(Ne.flags|=2048,kn(9,{destroy:void 0},Wp.bind(null,i,s),null)),[l,o,e]}function Wp(e,a){e.action=a}function Vm(e){var a=st(),s=qe;if(s!==null)return Km(a,s,e);st(),a=a.memoizedState,s=st();var l=s.queue.dispatch;return s.memoizedState=e,[a,l,!1]}function kn(e,a,s,l){return e={tag:e,create:s,deps:l,inst:a,next:null},a=Ne.updateQueue,a===null&&(a=Hi(),Ne.updateQueue=a),s=a.lastEffect,s===null?a.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,a.lastEffect=e),e}function Ym(){return st().memoizedState}function Ki(e,a,s,l){var i=zt();Ne.flags|=e,i.memoizedState=kn(1|a,{destroy:void 0},s,l===void 0?null:l)}function Vi(e,a,s,l){var i=st();l=l===void 0?null:l;var o=i.memoizedState.inst;qe!==null&&l!==null&&Qc(l,qe.memoizedState.deps)?i.memoizedState=kn(a,o,s,l):(Ne.flags|=e,i.memoizedState=kn(1|a,o,s,l))}function Xm(e,a){Ki(8390656,8,e,a)}function so(e,a){Vi(2048,8,e,a)}function eg(e){Ne.flags|=4;var a=Ne.updateQueue;if(a===null)a=Hi(),Ne.updateQueue=a,a.events=[e];else{var s=a.events;s===null?a.events=[e]:s.push(e)}}function Qm(e){var a=st().memoizedState;return eg({ref:a,nextImpl:e}),function(){if((Be&2)!==0)throw Error(c(440));return a.impl.apply(void 0,arguments)}}function Zm(e,a){return Vi(4,2,e,a)}function Jm(e,a){return Vi(4,4,e,a)}function Fm(e,a){if(typeof a=="function"){e=e();var s=a(e);return function(){typeof s=="function"?s():a(null)}}if(a!=null)return e=e(),a.current=e,function(){a.current=null}}function Im(e,a,s){s=s!=null?s.concat([e]):null,Vi(4,4,Fm.bind(null,a,e),s)}function no(){}function Pm(e,a){var s=st();a=a===void 0?null:a;var l=s.memoizedState;return a!==null&&Qc(a,l[1])?l[0]:(s.memoizedState=[e,a],e)}function Wm(e,a){var s=st();a=a===void 0?null:a;var l=s.memoizedState;if(a!==null&&Qc(a,l[1]))return l[0];if(l=e(),Gs){Za(!0);try{e()}finally{Za(!1)}}return s.memoizedState=[l,a],l}function lo(e,a,s){return s===void 0||(Ra&1073741824)!==0&&(Te&261930)===0?e.memoizedState=a:(e.memoizedState=s,e=ef(),Ne.lanes|=e,cs|=e,s)}function ex(e,a,s,l){return qt(s,a)?s:Nn.current!==null?(e=lo(e,s,l),qt(e,a)||(rt=!0),e):(Ra&42)===0||(Ra&1073741824)!==0&&(Te&261930)===0?(rt=!0,e.memoizedState=s):(e=ef(),Ne.lanes|=e,cs|=e,a)}function tx(e,a,s,l,i){var o=ie.p;ie.p=o!==0&&8>o?o:8;var x=G.T,j={};G.T=j,co(e,!1,a,s);try{var A=i(),U=G.S;if(U!==null&&U(j,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var V=Jp(A,l);jl(e,a,V,Qt(e))}else jl(e,a,l,Qt(e))}catch(F){jl(e,a,{then:function(){},status:"rejected",reason:F},Qt())}finally{ie.p=o,x!==null&&j.types!==null&&(x.types=j.types),G.T=x}}function tg(){}function io(e,a,s,l){if(e.tag!==5)throw Error(c(476));var i=ax(e).queue;tx(e,i,a,me,s===null?tg:function(){return sx(e),s(l)})}function ax(e){var a=e.memoizedState;if(a!==null)return a;a={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:me},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:s},next:null},e.memoizedState=a,e=e.alternate,e!==null&&(e.memoizedState=a),a}function sx(e){var a=ax(e);a.next===null&&(a=e.alternate.memoizedState),jl(e,a.next.queue,{},Qt())}function ro(){return yt(Bl)}function nx(){return st().memoizedState}function lx(){return st().memoizedState}function ag(e){for(var a=e.return;a!==null;){switch(a.tag){case 24:case 3:var s=Qt();e=as(s);var l=ss(a,e,s);l!==null&&(_t(l,a,s),pl(l,a,s)),a={cache:_c()},e.payload=a;return}a=a.return}}function sg(e,a,s){var l=Qt();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Yi(e)?rx(a,s):(s=kc(e,a,s,l),s!==null&&(_t(s,e,l),cx(s,a,l)))}function ix(e,a,s){var l=Qt();jl(e,a,s,l)}function jl(e,a,s,l){var i={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Yi(e))rx(a,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=a.lastRenderedReducer,o!==null))try{var x=a.lastRenderedState,j=o(x,s);if(i.hasEagerState=!0,i.eagerState=j,qt(j,x))return ki(e,a,i,0),Ve===null&&Si(),!1}catch{}finally{}if(s=kc(e,a,i,l),s!==null)return _t(s,e,l),cx(s,a,l),!0}return!1}function co(e,a,s,l){if(l={lane:2,revertLane:qo(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yi(e)){if(a)throw Error(c(479))}else a=kc(e,s,l,2),a!==null&&_t(a,e,2)}function Yi(e){var a=e.alternate;return e===Ne||a!==null&&a===Ne}function rx(e,a){wn=Bi=!0;var s=e.pending;s===null?a.next=a:(a.next=s.next,s.next=a),e.pending=a}function cx(e,a,s){if((s&4194048)!==0){var l=a.lanes;l&=e.pendingLanes,s|=l,a.lanes=s,xu(e,s)}}var Nl={readContext:yt,use:qi,useCallback:Pe,useContext:Pe,useEffect:Pe,useImperativeHandle:Pe,useLayoutEffect:Pe,useInsertionEffect:Pe,useMemo:Pe,useReducer:Pe,useRef:Pe,useState:Pe,useDebugValue:Pe,useDeferredValue:Pe,useTransition:Pe,useSyncExternalStore:Pe,useId:Pe,useHostTransitionStatus:Pe,useFormState:Pe,useActionState:Pe,useOptimistic:Pe,useMemoCache:Pe,useCacheRefresh:Pe};Nl.useEffectEvent=Pe;var ox={readContext:yt,use:qi,useCallback:function(e,a){return zt().memoizedState=[e,a===void 0?null:a],e},useContext:yt,useEffect:Xm,useImperativeHandle:function(e,a,s){s=s!=null?s.concat([e]):null,Ki(4194308,4,Fm.bind(null,a,e),s)},useLayoutEffect:function(e,a){return Ki(4194308,4,e,a)},useInsertionEffect:function(e,a){Ki(4,2,e,a)},useMemo:function(e,a){var s=zt();a=a===void 0?null:a;var l=e();if(Gs){Za(!0);try{e()}finally{Za(!1)}}return s.memoizedState=[l,a],l},useReducer:function(e,a,s){var l=zt();if(s!==void 0){var i=s(a);if(Gs){Za(!0);try{s(a)}finally{Za(!1)}}}else i=a;return l.memoizedState=l.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},l.queue=e,e=e.dispatch=sg.bind(null,Ne,e),[l.memoizedState,e]},useRef:function(e){var a=zt();return e={current:e},a.memoizedState=e},useState:function(e){e=to(e);var a=e.queue,s=ix.bind(null,Ne,a);return a.dispatch=s,[e.memoizedState,s]},useDebugValue:no,useDeferredValue:function(e,a){var s=zt();return lo(s,e,a)},useTransition:function(){var e=to(!1);return e=tx.bind(null,Ne,e.queue,!0,!1),zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,a,s){var l=Ne,i=zt();if(Me){if(s===void 0)throw Error(c(407));s=s()}else{if(s=a(),Ve===null)throw Error(c(349));(Te&127)!==0||Tm(l,a,s)}i.memoizedState=s;var o={value:s,getSnapshot:a};return i.queue=o,Xm(Mm.bind(null,l,o,e),[e]),l.flags|=2048,kn(9,{destroy:void 0},Rm.bind(null,l,o,s,a),null),s},useId:function(){var e=zt(),a=Ve.identifierPrefix;if(Me){var s=pa,l=ha;s=(l&~(1<<32-Ht(l)-1)).toString(32)+s,a="_"+a+"R_"+s,s=$i++,0<s&&(a+="H"+s.toString(32)),a+="_"}else s=Fp++,a="_"+a+"r_"+s.toString(32)+"_";return e.memoizedState=a},useHostTransitionStatus:ro,useFormState:qm,useActionState:qm,useOptimistic:function(e){var a=zt();a.memoizedState=a.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=s,a=co.bind(null,Ne,!0,s),s.dispatch=a,[e,a]},useMemoCache:Pc,useCacheRefresh:function(){return zt().memoizedState=ag.bind(null,Ne)},useEffectEvent:function(e){var a=zt(),s={impl:e};return a.memoizedState=s,function(){if((Be&2)!==0)throw Error(c(440));return s.impl.apply(void 0,arguments)}}},oo={readContext:yt,use:qi,useCallback:Pm,useContext:yt,useEffect:so,useImperativeHandle:Im,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:Wm,useReducer:Gi,useRef:Ym,useState:function(){return Gi(Ma)},useDebugValue:no,useDeferredValue:function(e,a){var s=st();return ex(s,qe.memoizedState,e,a)},useTransition:function(){var e=Gi(Ma)[0],a=st().memoizedState;return[typeof e=="boolean"?e:vl(e),a]},useSyncExternalStore:Em,useId:nx,useHostTransitionStatus:ro,useFormState:Gm,useActionState:Gm,useOptimistic:function(e,a){var s=st();return Lm(s,qe,e,a)},useMemoCache:Pc,useCacheRefresh:lx};oo.useEffectEvent=Qm;var dx={readContext:yt,use:qi,useCallback:Pm,useContext:yt,useEffect:so,useImperativeHandle:Im,useInsertionEffect:Zm,useLayoutEffect:Jm,useMemo:Wm,useReducer:eo,useRef:Ym,useState:function(){return eo(Ma)},useDebugValue:no,useDeferredValue:function(e,a){var s=st();return qe===null?lo(s,e,a):ex(s,qe.memoizedState,e,a)},useTransition:function(){var e=eo(Ma)[0],a=st().memoizedState;return[typeof e=="boolean"?e:vl(e),a]},useSyncExternalStore:Em,useId:nx,useHostTransitionStatus:ro,useFormState:Vm,useActionState:Vm,useOptimistic:function(e,a){var s=st();return qe!==null?Lm(s,qe,e,a):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Pc,useCacheRefresh:lx};dx.useEffectEvent=Qm;function uo(e,a,s,l){a=e.memoizedState,s=s(l,a),s=s==null?a:v({},a,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var mo={enqueueSetState:function(e,a,s){e=e._reactInternals;var l=Qt(),i=as(l);i.payload=a,s!=null&&(i.callback=s),a=ss(e,i,l),a!==null&&(_t(a,e,l),pl(a,e,l))},enqueueReplaceState:function(e,a,s){e=e._reactInternals;var l=Qt(),i=as(l);i.tag=1,i.payload=a,s!=null&&(i.callback=s),a=ss(e,i,l),a!==null&&(_t(a,e,l),pl(a,e,l))},enqueueForceUpdate:function(e,a){e=e._reactInternals;var s=Qt(),l=as(s);l.tag=2,a!=null&&(l.callback=a),a=ss(e,l,s),a!==null&&(_t(a,e,s),pl(a,e,s))}};function ux(e,a,s,l,i,o,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,o,x):a.prototype&&a.prototype.isPureReactComponent?!cl(s,l)||!cl(i,o):!0}function mx(e,a,s,l){e=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(s,l),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(s,l),a.state!==e&&mo.enqueueReplaceState(a,a.state,null)}function Ks(e,a){var s=a;if("ref"in a){s={};for(var l in a)l!=="ref"&&(s[l]=a[l])}if(e=e.defaultProps){s===a&&(s=v({},s));for(var i in e)s[i]===void 0&&(s[i]=e[i])}return s}function xx(e){wi(e)}function fx(e){console.error(e)}function hx(e){wi(e)}function Xi(e,a){try{var s=e.onUncaughtError;s(a.value,{componentStack:a.stack})}catch(l){setTimeout(function(){throw l})}}function px(e,a,s){try{var l=e.onCaughtError;l(s.value,{componentStack:s.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function xo(e,a,s){return s=as(s),s.tag=3,s.payload={element:null},s.callback=function(){Xi(e,a)},s}function gx(e){return e=as(e),e.tag=3,e}function bx(e,a,s,l){var i=s.type.getDerivedStateFromError;if(typeof i=="function"){var o=l.value;e.payload=function(){return i(o)},e.callback=function(){px(a,s,l)}}var x=s.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){px(a,s,l),typeof i!="function"&&(os===null?os=new Set([this]):os.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function ng(e,a,s,l,i){if(s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(a=s.alternate,a!==null&&gn(a,s,i,!0),s=Kt.current,s!==null){switch(s.tag){case 31:case 13:return na===null?nr():s.alternate===null&&We===0&&(We=3),s.flags&=-257,s.flags|=65536,s.lanes=i,l===Di?s.flags|=16384:(a=s.updateQueue,a===null?s.updateQueue=new Set([l]):a.add(l),Bo(e,l,i)),!1;case 22:return s.flags|=65536,l===Di?s.flags|=16384:(a=s.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([l])},s.updateQueue=a):(s=a.retryQueue,s===null?a.retryQueue=new Set([l]):s.add(l)),Bo(e,l,i)),!1}throw Error(c(435,s.tag))}return Bo(e,l,i),nr(),!1}if(Me)return a=Kt.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=i,l!==Rc&&(e=Error(c(422),{cause:l}),ul(ea(e,s)))):(l!==Rc&&(a=Error(c(423),{cause:l}),ul(ea(a,s))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,l=ea(l,s),i=xo(e.stateNode,l,i),Gc(e,i),We!==4&&(We=2)),!1;var o=Error(c(520),{cause:l});if(o=ea(o,s),Tl===null?Tl=[o]:Tl.push(o),We!==4&&(We=2),a===null)return!0;l=ea(l,s),s=a;do{switch(s.tag){case 3:return s.flags|=65536,e=i&-i,s.lanes|=e,e=xo(s.stateNode,l,e),Gc(s,e),!1;case 1:if(a=s.type,o=s.stateNode,(s.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(os===null||!os.has(o))))return s.flags|=65536,i&=-i,s.lanes|=i,i=gx(i),bx(i,e,s,l),Gc(s,i),!1}s=s.return}while(s!==null);return!1}var fo=Error(c(461)),rt=!1;function vt(e,a,s,l){a.child=e===null?Nm(a,null,s,l):qs(a,e.child,s,l)}function yx(e,a,s,l,i){s=s.render;var o=a.ref;if("ref"in l){var x={};for(var j in l)j!=="ref"&&(x[j]=l[j])}else x=l;return Us(a),l=Zc(e,a,s,x,o,i),j=Jc(),e!==null&&!rt?(Fc(e,a,i),Da(e,a,i)):(Me&&j&&Ec(a),a.flags|=1,vt(e,a,l,i),a.child)}function vx(e,a,s,l,i){if(e===null){var o=s.type;return typeof o=="function"&&!zc(o)&&o.defaultProps===void 0&&s.compare===null?(a.tag=15,a.type=o,jx(e,a,o,l,i)):(e=Ci(s.type,null,l,a,a.mode,i),e.ref=a.ref,e.return=a,a.child=e)}if(o=e.child,!No(e,i)){var x=o.memoizedProps;if(s=s.compare,s=s!==null?s:cl,s(x,l)&&e.ref===a.ref)return Da(e,a,i)}return a.flags|=1,e=Ca(o,l),e.ref=a.ref,e.return=a,a.child=e}function jx(e,a,s,l,i){if(e!==null){var o=e.memoizedProps;if(cl(o,l)&&e.ref===a.ref)if(rt=!1,a.pendingProps=l=o,No(e,i))(e.flags&131072)!==0&&(rt=!0);else return a.lanes=e.lanes,Da(e,a,i)}return ho(e,a,s,l,i)}function Nx(e,a,s,l){var i=l.children,o=e!==null?e.memoizedState:null;if(e===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((a.flags&128)!==0){if(o=o!==null?o.baseLanes|s:s,e!==null){for(l=a.child=e.child,i=0;l!==null;)i=i|l.lanes|l.childLanes,l=l.sibling;l=i&~o}else l=0,a.child=null;return wx(e,a,o,s,l)}if((s&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ri(a,o!==null?o.cachePool:null),o!==null?km(a,o):Vc(),zm(a);else return l=a.lanes=536870912,wx(e,a,o!==null?o.baseLanes|s:s,s,l)}else o!==null?(Ri(a,o.cachePool),km(a,o),ls(),a.memoizedState=null):(e!==null&&Ri(a,null),Vc(),ls());return vt(e,a,i,s),a.child}function wl(e,a){return e!==null&&e.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function wx(e,a,s,l,i){var o=Bc();return o=o===null?null:{parent:lt._currentValue,pool:o},a.memoizedState={baseLanes:s,cachePool:o},e!==null&&Ri(a,null),Vc(),zm(a),e!==null&&gn(e,a,l,!0),a.childLanes=i,null}function Qi(e,a){return a=Ji({mode:a.mode,children:a.children},e.mode),a.ref=e.ref,e.child=a,a.return=e,a}function Sx(e,a,s){return qs(a,e.child,null,s),e=Qi(a,a.pendingProps),e.flags|=2,Vt(a),a.memoizedState=null,e}function lg(e,a,s){var l=a.pendingProps,i=(a.flags&128)!==0;if(a.flags&=-129,e===null){if(Me){if(l.mode==="hidden")return e=Qi(a,l),a.lanes=536870912,wl(null,e);if(Xc(a),(e=Qe)?(e=Uf(e,sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(a.memoizedState={dehydrated:e,treeContext:Ia!==null?{id:ha,overflow:pa}:null,retryLane:536870912,hydrationErrors:null},s=rm(e),s.return=a,a.child=s,bt=a,Qe=null)):e=null,e===null)throw Wa(a);return a.lanes=536870912,null}return Qi(a,l)}var o=e.memoizedState;if(o!==null){var x=o.dehydrated;if(Xc(a),i)if(a.flags&256)a.flags&=-257,a=Sx(e,a,s);else if(a.memoizedState!==null)a.child=e.child,a.flags|=128,a=null;else throw Error(c(558));else if(rt||gn(e,a,s,!1),i=(s&e.childLanes)!==0,rt||i){if(l=Ve,l!==null&&(x=fu(l,s),x!==0&&x!==o.retryLane))throw o.retryLane=x,Ds(e,x),_t(l,e,x),fo;nr(),a=Sx(e,a,s)}else e=o.treeContext,Qe=la(x.nextSibling),bt=a,Me=!0,Pa=null,sa=!1,e!==null&&dm(a,e),a=Qi(a,l),a.flags|=4096;return a}return e=Ca(e.child,{mode:l.mode,children:l.children}),e.ref=a.ref,a.child=e,e.return=a,e}function Zi(e,a){var s=a.ref;if(s===null)e!==null&&e.ref!==null&&(a.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(c(284));(e===null||e.ref!==s)&&(a.flags|=4194816)}}function ho(e,a,s,l,i){return Us(a),s=Zc(e,a,s,l,void 0,i),l=Jc(),e!==null&&!rt?(Fc(e,a,i),Da(e,a,i)):(Me&&l&&Ec(a),a.flags|=1,vt(e,a,s,i),a.child)}function kx(e,a,s,l,i,o){return Us(a),a.updateQueue=null,s=Am(a,l,s,i),Cm(e),l=Jc(),e!==null&&!rt?(Fc(e,a,o),Da(e,a,o)):(Me&&l&&Ec(a),a.flags|=1,vt(e,a,s,o),a.child)}function zx(e,a,s,l,i){if(Us(a),a.stateNode===null){var o=xn,x=s.contextType;typeof x=="object"&&x!==null&&(o=yt(x)),o=new s(l,o),a.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=mo,a.stateNode=o,o._reactInternals=a,o=a.stateNode,o.props=l,o.state=a.memoizedState,o.refs={},Hc(a),x=s.contextType,o.context=typeof x=="object"&&x!==null?yt(x):xn,o.state=a.memoizedState,x=s.getDerivedStateFromProps,typeof x=="function"&&(uo(a,s,x,l),o.state=a.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(x=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),x!==o.state&&mo.enqueueReplaceState(o,o.state,null),bl(a,l,o,i),gl(),o.state=a.memoizedState),typeof o.componentDidMount=="function"&&(a.flags|=4194308),l=!0}else if(e===null){o=a.stateNode;var j=a.memoizedProps,A=Ks(s,j);o.props=A;var U=o.context,V=s.contextType;x=xn,typeof V=="object"&&V!==null&&(x=yt(V));var F=s.getDerivedStateFromProps;V=typeof F=="function"||typeof o.getSnapshotBeforeUpdate=="function",j=a.pendingProps!==j,V||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(j||U!==x)&&mx(a,o,l,x),ts=!1;var H=a.memoizedState;o.state=H,bl(a,l,o,i),gl(),U=a.memoizedState,j||H!==U||ts?(typeof F=="function"&&(uo(a,s,F,l),U=a.memoizedState),(A=ts||ux(a,s,A,l,H,U,x))?(V||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(a.flags|=4194308)):(typeof o.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=l,a.memoizedState=U),o.props=l,o.state=U,o.context=x,l=A):(typeof o.componentDidMount=="function"&&(a.flags|=4194308),l=!1)}else{o=a.stateNode,qc(e,a),x=a.memoizedProps,V=Ks(s,x),o.props=V,F=a.pendingProps,H=o.context,U=s.contextType,A=xn,typeof U=="object"&&U!==null&&(A=yt(U)),j=s.getDerivedStateFromProps,(U=typeof j=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(x!==F||H!==A)&&mx(a,o,l,A),ts=!1,H=a.memoizedState,o.state=H,bl(a,l,o,i),gl();var K=a.memoizedState;x!==F||H!==K||ts||e!==null&&e.dependencies!==null&&Ei(e.dependencies)?(typeof j=="function"&&(uo(a,s,j,l),K=a.memoizedState),(V=ts||ux(a,s,V,l,H,K,A)||e!==null&&e.dependencies!==null&&Ei(e.dependencies))?(U||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(l,K,A),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(l,K,A)),typeof o.componentDidUpdate=="function"&&(a.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof o.componentDidUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=1024),a.memoizedProps=l,a.memoizedState=K),o.props=l,o.state=K,o.context=A,l=V):(typeof o.componentDidUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&H===e.memoizedState||(a.flags|=1024),l=!1)}return o=l,Zi(e,a),l=(a.flags&128)!==0,o||l?(o=a.stateNode,s=l&&typeof s.getDerivedStateFromError!="function"?null:o.render(),a.flags|=1,e!==null&&l?(a.child=qs(a,e.child,null,i),a.child=qs(a,null,s,i)):vt(e,a,s,i),a.memoizedState=o.state,e=a.child):e=Da(e,a,i),e}function Cx(e,a,s,l){return Ls(),a.flags|=256,vt(e,a,s,l),a.child}var po={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function go(e){return{baseLanes:e,cachePool:pm()}}function bo(e,a,s){return e=e!==null?e.childLanes&~s:0,a&&(e|=Xt),e}function Ax(e,a,s){var l=a.pendingProps,i=!1,o=(a.flags&128)!==0,x;if((x=o)||(x=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),x&&(i=!0,a.flags&=-129),x=(a.flags&32)!==0,a.flags&=-33,e===null){if(Me){if(i?ns(a):ls(),(e=Qe)?(e=Uf(e,sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(a.memoizedState={dehydrated:e,treeContext:Ia!==null?{id:ha,overflow:pa}:null,retryLane:536870912,hydrationErrors:null},s=rm(e),s.return=a,a.child=s,bt=a,Qe=null)):e=null,e===null)throw Wa(a);return ed(e)?a.lanes=32:a.lanes=536870912,null}var j=l.children;return l=l.fallback,i?(ls(),i=a.mode,j=Ji({mode:"hidden",children:j},i),l=Os(l,i,s,null),j.return=a,l.return=a,j.sibling=l,a.child=j,l=a.child,l.memoizedState=go(s),l.childLanes=bo(e,x,s),a.memoizedState=po,wl(null,l)):(ns(a),yo(a,j))}var A=e.memoizedState;if(A!==null&&(j=A.dehydrated,j!==null)){if(o)a.flags&256?(ns(a),a.flags&=-257,a=vo(e,a,s)):a.memoizedState!==null?(ls(),a.child=e.child,a.flags|=128,a=null):(ls(),j=l.fallback,i=a.mode,l=Ji({mode:"visible",children:l.children},i),j=Os(j,i,s,null),j.flags|=2,l.return=a,j.return=a,l.sibling=j,a.child=l,qs(a,e.child,null,s),l=a.child,l.memoizedState=go(s),l.childLanes=bo(e,x,s),a.memoizedState=po,a=wl(null,l));else if(ns(a),ed(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var U=x.dgst;x=U,l=Error(c(419)),l.stack="",l.digest=x,ul({value:l,source:null,stack:null}),a=vo(e,a,s)}else if(rt||gn(e,a,s,!1),x=(s&e.childLanes)!==0,rt||x){if(x=Ve,x!==null&&(l=fu(x,s),l!==0&&l!==A.retryLane))throw A.retryLane=l,Ds(e,l),_t(x,e,l),fo;Wo(j)||nr(),a=vo(e,a,s)}else Wo(j)?(a.flags|=192,a.child=e.child,a=null):(e=A.treeContext,Qe=la(j.nextSibling),bt=a,Me=!0,Pa=null,sa=!1,e!==null&&dm(a,e),a=yo(a,l.children),a.flags|=4096);return a}return i?(ls(),j=l.fallback,i=a.mode,A=e.child,U=A.sibling,l=Ca(A,{mode:"hidden",children:l.children}),l.subtreeFlags=A.subtreeFlags&65011712,U!==null?j=Ca(U,j):(j=Os(j,i,s,null),j.flags|=2),j.return=a,l.return=a,l.sibling=j,a.child=l,wl(null,l),l=a.child,j=e.child.memoizedState,j===null?j=go(s):(i=j.cachePool,i!==null?(A=lt._currentValue,i=i.parent!==A?{parent:A,pool:A}:i):i=pm(),j={baseLanes:j.baseLanes|s,cachePool:i}),l.memoizedState=j,l.childLanes=bo(e,x,s),a.memoizedState=po,wl(e.child,l)):(ns(a),s=e.child,e=s.sibling,s=Ca(s,{mode:"visible",children:l.children}),s.return=a,s.sibling=null,e!==null&&(x=a.deletions,x===null?(a.deletions=[e],a.flags|=16):x.push(e)),a.child=s,a.memoizedState=null,s)}function yo(e,a){return a=Ji({mode:"visible",children:a},e.mode),a.return=e,e.child=a}function Ji(e,a){return e=Gt(22,e,null,a),e.lanes=0,e}function vo(e,a,s){return qs(a,e.child,null,s),e=yo(a,a.pendingProps.children),e.flags|=2,a.memoizedState=null,e}function Ex(e,a,s){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a),Oc(e.return,a,s)}function jo(e,a,s,l,i,o){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:i,treeForkCount:o}:(x.isBackwards=a,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=s,x.tailMode=i,x.treeForkCount=o)}function Tx(e,a,s){var l=a.pendingProps,i=l.revealOrder,o=l.tail;l=l.children;var x=at.current,j=(x&2)!==0;if(j?(x=x&1|2,a.flags|=128):x&=1,re(at,x),vt(e,a,l,s),l=Me?dl:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=a.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ex(e,s,a);else if(e.tag===19)Ex(e,s,a);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===a)break e;for(;e.sibling===null;){if(e.return===null||e.return===a)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":for(s=a.child,i=null;s!==null;)e=s.alternate,e!==null&&Ui(e)===null&&(i=s),s=s.sibling;s=i,s===null?(i=a.child,a.child=null):(i=s.sibling,s.sibling=null),jo(a,!1,i,s,o,l);break;case"backwards":case"unstable_legacy-backwards":for(s=null,i=a.child,a.child=null;i!==null;){if(e=i.alternate,e!==null&&Ui(e)===null){a.child=i;break}e=i.sibling,i.sibling=s,s=i,i=e}jo(a,!0,s,null,o,l);break;case"together":jo(a,!1,null,null,void 0,l);break;default:a.memoizedState=null}return a.child}function Da(e,a,s){if(e!==null&&(a.dependencies=e.dependencies),cs|=a.lanes,(s&a.childLanes)===0)if(e!==null){if(gn(e,a,s,!1),(s&a.childLanes)===0)return null}else return null;if(e!==null&&a.child!==e.child)throw Error(c(153));if(a.child!==null){for(e=a.child,s=Ca(e,e.pendingProps),a.child=s,s.return=a;e.sibling!==null;)e=e.sibling,s=s.sibling=Ca(e,e.pendingProps),s.return=a;s.sibling=null}return a.child}function No(e,a){return(e.lanes&a)!==0?!0:(e=e.dependencies,!!(e!==null&&Ei(e)))}function ig(e,a,s){switch(a.tag){case 3:Ce(a,a.stateNode.containerInfo),es(a,lt,e.memoizedState.cache),Ls();break;case 27:case 5:Q(a);break;case 4:Ce(a,a.stateNode.containerInfo);break;case 10:es(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Xc(a),null;break;case 13:var l=a.memoizedState;if(l!==null)return l.dehydrated!==null?(ns(a),a.flags|=128,null):(s&a.child.childLanes)!==0?Ax(e,a,s):(ns(a),e=Da(e,a,s),e!==null?e.sibling:null);ns(a);break;case 19:var i=(e.flags&128)!==0;if(l=(s&a.childLanes)!==0,l||(gn(e,a,s,!1),l=(s&a.childLanes)!==0),i){if(l)return Tx(e,a,s);a.flags|=128}if(i=a.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),re(at,at.current),l)break;return null;case 22:return a.lanes=0,Nx(e,a,s,a.pendingProps);case 24:es(a,lt,e.memoizedState.cache)}return Da(e,a,s)}function Rx(e,a,s){if(e!==null)if(e.memoizedProps!==a.pendingProps)rt=!0;else{if(!No(e,s)&&(a.flags&128)===0)return rt=!1,ig(e,a,s);rt=(e.flags&131072)!==0}else rt=!1,Me&&(a.flags&1048576)!==0&&om(a,dl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var l=a.pendingProps;if(e=$s(a.elementType),a.type=e,typeof e=="function")zc(e)?(l=Ks(e,l),a.tag=1,a=zx(null,a,e,l,s)):(a.tag=0,a=ho(null,a,e,l,s));else{if(e!=null){var i=e.$$typeof;if(i===E){a.tag=11,a=yx(null,a,e,l,s);break e}else if(i===B){a.tag=14,a=vx(null,a,e,l,s);break e}}throw a=ce(e)||e,Error(c(306,a,""))}}return a;case 0:return ho(e,a,a.type,a.pendingProps,s);case 1:return l=a.type,i=Ks(l,a.pendingProps),zx(e,a,l,i,s);case 3:e:{if(Ce(a,a.stateNode.containerInfo),e===null)throw Error(c(387));l=a.pendingProps;var o=a.memoizedState;i=o.element,qc(e,a),bl(a,l,null,s);var x=a.memoizedState;if(l=x.cache,es(a,lt,l),l!==o.cache&&Lc(a,[lt],s,!0),gl(),l=x.element,o.isDehydrated)if(o={element:l,isDehydrated:!1,cache:x.cache},a.updateQueue.baseState=o,a.memoizedState=o,a.flags&256){a=Cx(e,a,l,s);break e}else if(l!==i){i=ea(Error(c(424)),a),ul(i),a=Cx(e,a,l,s);break e}else{switch(e=a.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Qe=la(e.firstChild),bt=a,Me=!0,Pa=null,sa=!0,s=Nm(a,null,l,s),a.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(Ls(),l===i){a=Da(e,a,s);break e}vt(e,a,l,s)}a=a.child}return a;case 26:return Zi(e,a),e===null?(s=Kf(a.type,null,a.pendingProps,null))?a.memoizedState=s:Me||(s=a.type,e=a.pendingProps,l=ur(xe.current).createElement(s),l[gt]=a,l[Tt]=e,jt(l,s,e),mt(l),a.stateNode=l):a.memoizedState=Kf(a.type,e.memoizedProps,a.pendingProps,e.memoizedState),null;case 27:return Q(a),e===null&&Me&&(l=a.stateNode=Hf(a.type,a.pendingProps,xe.current),bt=a,sa=!0,i=Qe,xs(a.type)?(td=i,Qe=la(l.firstChild)):Qe=i),vt(e,a,a.pendingProps.children,s),Zi(e,a),e===null&&(a.flags|=4194304),a.child;case 5:return e===null&&Me&&((i=l=Qe)&&(l=_g(l,a.type,a.pendingProps,sa),l!==null?(a.stateNode=l,bt=a,Qe=la(l.firstChild),sa=!1,i=!0):i=!1),i||Wa(a)),Q(a),i=a.type,o=a.pendingProps,x=e!==null?e.memoizedProps:null,l=o.children,Fo(i,o)?l=null:x!==null&&Fo(i,x)&&(a.flags|=32),a.memoizedState!==null&&(i=Zc(e,a,Ip,null,null,s),Bl._currentValue=i),Zi(e,a),vt(e,a,l,s),a.child;case 6:return e===null&&Me&&((e=s=Qe)&&(s=Ug(s,a.pendingProps,sa),s!==null?(a.stateNode=s,bt=a,Qe=null,e=!0):e=!1),e||Wa(a)),null;case 13:return Ax(e,a,s);case 4:return Ce(a,a.stateNode.containerInfo),l=a.pendingProps,e===null?a.child=qs(a,null,l,s):vt(e,a,l,s),a.child;case 11:return yx(e,a,a.type,a.pendingProps,s);case 7:return vt(e,a,a.pendingProps,s),a.child;case 8:return vt(e,a,a.pendingProps.children,s),a.child;case 12:return vt(e,a,a.pendingProps.children,s),a.child;case 10:return l=a.pendingProps,es(a,a.type,l.value),vt(e,a,l.children,s),a.child;case 9:return i=a.type._context,l=a.pendingProps.children,Us(a),i=yt(i),l=l(i),a.flags|=1,vt(e,a,l,s),a.child;case 14:return vx(e,a,a.type,a.pendingProps,s);case 15:return jx(e,a,a.type,a.pendingProps,s);case 19:return Tx(e,a,s);case 31:return lg(e,a,s);case 22:return Nx(e,a,s,a.pendingProps);case 24:return Us(a),l=yt(lt),e===null?(i=Bc(),i===null&&(i=Ve,o=_c(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=s),i=o),a.memoizedState={parent:l,cache:i},Hc(a),es(a,lt,i)):((e.lanes&s)!==0&&(qc(e,a),bl(a,null,null,s),gl()),i=e.memoizedState,o=a.memoizedState,i.parent!==l?(i={parent:l,cache:l},a.memoizedState=i,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=i),es(a,lt,l)):(l=o.cache,es(a,lt,l),l!==i.cache&&Lc(a,[lt],s,!0))),vt(e,a,a.pendingProps.children,s),a.child;case 29:throw a.pendingProps}throw Error(c(156,a.tag))}function Oa(e){e.flags|=4}function wo(e,a,s,l,i){if((a=(e.mode&32)!==0)&&(a=!1),a){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(nf())e.flags|=8192;else throw Hs=Di,$c}else e.flags&=-16777217}function Mx(e,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Zf(a))if(nf())e.flags|=8192;else throw Hs=Di,$c}function Fi(e,a){a!==null&&(e.flags|=4),e.flags&16384&&(a=e.tag!==22?uu():536870912,e.lanes|=a,En|=a)}function Sl(e,a){if(!Me)switch(e.tailMode){case"hidden":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?a||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Ze(e){var a=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(a)for(var i=e.child;i!==null;)s|=i.lanes|i.childLanes,l|=i.subtreeFlags&65011712,l|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)s|=i.lanes|i.childLanes,l|=i.subtreeFlags,l|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=l,e.childLanes=s,a}function rg(e,a,s){var l=a.pendingProps;switch(Tc(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ze(a),null;case 1:return Ze(a),null;case 3:return s=a.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Ta(lt),ve(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(pn(a)?Oa(a):e===null||e.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Mc())),Ze(a),null;case 26:var i=a.type,o=a.memoizedState;return e===null?(Oa(a),o!==null?(Ze(a),Mx(a,o)):(Ze(a),wo(a,i,null,l,s))):o?o!==e.memoizedState?(Oa(a),Ze(a),Mx(a,o)):(Ze(a),a.flags&=-16777217):(e=e.memoizedProps,e!==l&&Oa(a),Ze(a),wo(a,i,e,l,s)),null;case 27:if(ee(a),s=xe.current,i=a.type,e!==null&&a.stateNode!=null)e.memoizedProps!==l&&Oa(a);else{if(!l){if(a.stateNode===null)throw Error(c(166));return Ze(a),null}e=$.current,pn(a)?um(a):(e=Hf(i,l,s),a.stateNode=e,Oa(a))}return Ze(a),null;case 5:if(ee(a),i=a.type,e!==null&&a.stateNode!=null)e.memoizedProps!==l&&Oa(a);else{if(!l){if(a.stateNode===null)throw Error(c(166));return Ze(a),null}if(o=$.current,pn(a))um(a);else{var x=ur(xe.current);switch(o){case 1:o=x.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:o=x.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":o=x.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":o=x.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":o=x.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?o.multiple=!0:l.size&&(o.size=l.size);break;default:o=typeof l.is=="string"?x.createElement(i,{is:l.is}):x.createElement(i)}}o[gt]=a,o[Tt]=l;e:for(x=a.child;x!==null;){if(x.tag===5||x.tag===6)o.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===a)break e;for(;x.sibling===null;){if(x.return===null||x.return===a)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}a.stateNode=o;e:switch(jt(o,i,l),i){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Oa(a)}}return Ze(a),wo(a,a.type,e===null?null:e.memoizedProps,a.pendingProps,s),null;case 6:if(e&&a.stateNode!=null)e.memoizedProps!==l&&Oa(a);else{if(typeof l!="string"&&a.stateNode===null)throw Error(c(166));if(e=xe.current,pn(a)){if(e=a.stateNode,s=a.memoizedProps,l=null,i=bt,i!==null)switch(i.tag){case 27:case 5:l=i.memoizedProps}e[gt]=a,e=!!(e.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||Ef(e.nodeValue,s)),e||Wa(a,!0)}else e=ur(e).createTextNode(l),e[gt]=a,a.stateNode=e}return Ze(a),null;case 31:if(s=a.memoizedState,e===null||e.memoizedState!==null){if(l=pn(a),s!==null){if(e===null){if(!l)throw Error(c(318));if(e=a.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[gt]=a}else Ls(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ze(a),e=!1}else s=Mc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return a.flags&256?(Vt(a),a):(Vt(a),null);if((a.flags&128)!==0)throw Error(c(558))}return Ze(a),null;case 13:if(l=a.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=pn(a),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(c(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(c(317));i[gt]=a}else Ls(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Ze(a),i=!1}else i=Mc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return a.flags&256?(Vt(a),a):(Vt(a),null)}return Vt(a),(a.flags&128)!==0?(a.lanes=s,a):(s=l!==null,e=e!==null&&e.memoizedState!==null,s&&(l=a.child,i=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(i=l.alternate.memoizedState.cachePool.pool),o=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(o=l.memoizedState.cachePool.pool),o!==i&&(l.flags|=2048)),s!==e&&s&&(a.child.flags|=8192),Fi(a,a.updateQueue),Ze(a),null);case 4:return ve(),e===null&&Yo(a.stateNode.containerInfo),Ze(a),null;case 10:return Ta(a.type),Ze(a),null;case 19:if(X(at),l=a.memoizedState,l===null)return Ze(a),null;if(i=(a.flags&128)!==0,o=l.rendering,o===null)if(i)Sl(l,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=a.child;e!==null;){if(o=Ui(e),o!==null){for(a.flags|=128,Sl(l,!1),e=o.updateQueue,a.updateQueue=e,Fi(a,e),a.subtreeFlags=0,e=s,s=a.child;s!==null;)im(s,e),s=s.sibling;return re(at,at.current&1|2),Me&&Aa(a,l.treeForkCount),a.child}e=e.sibling}l.tail!==null&&ut()>tr&&(a.flags|=128,i=!0,Sl(l,!1),a.lanes=4194304)}else{if(!i)if(e=Ui(o),e!==null){if(a.flags|=128,i=!0,e=e.updateQueue,a.updateQueue=e,Fi(a,e),Sl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!o.alternate&&!Me)return Ze(a),null}else 2*ut()-l.renderingStartTime>tr&&s!==536870912&&(a.flags|=128,i=!0,Sl(l,!1),a.lanes=4194304);l.isBackwards?(o.sibling=a.child,a.child=o):(e=l.last,e!==null?e.sibling=o:a.child=o,l.last=o)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ut(),e.sibling=null,s=at.current,re(at,i?s&1|2:s&1),Me&&Aa(a,l.treeForkCount),e):(Ze(a),null);case 22:case 23:return Vt(a),Yc(),l=a.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(a.flags|=8192):l&&(a.flags|=8192),l?(s&536870912)!==0&&(a.flags&128)===0&&(Ze(a),a.subtreeFlags&6&&(a.flags|=8192)):Ze(a),s=a.updateQueue,s!==null&&Fi(a,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),l=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==s&&(a.flags|=2048),e!==null&&X(Bs),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Ta(lt),Ze(a),null;case 25:return null;case 30:return null}throw Error(c(156,a.tag))}function cg(e,a){switch(Tc(a),a.tag){case 1:return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 3:return Ta(lt),ve(),e=a.flags,(e&65536)!==0&&(e&128)===0?(a.flags=e&-65537|128,a):null;case 26:case 27:case 5:return ee(a),null;case 31:if(a.memoizedState!==null){if(Vt(a),a.alternate===null)throw Error(c(340));Ls()}return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 13:if(Vt(a),e=a.memoizedState,e!==null&&e.dehydrated!==null){if(a.alternate===null)throw Error(c(340));Ls()}return e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 19:return X(at),null;case 4:return ve(),null;case 10:return Ta(a.type),null;case 22:case 23:return Vt(a),Yc(),e!==null&&X(Bs),e=a.flags,e&65536?(a.flags=e&-65537|128,a):null;case 24:return Ta(lt),null;case 25:return null;default:return null}}function Dx(e,a){switch(Tc(a),a.tag){case 3:Ta(lt),ve();break;case 26:case 27:case 5:ee(a);break;case 4:ve();break;case 31:a.memoizedState!==null&&Vt(a);break;case 13:Vt(a);break;case 19:X(at);break;case 10:Ta(a.type);break;case 22:case 23:Vt(a),Yc(),e!==null&&X(Bs);break;case 24:Ta(lt)}}function kl(e,a){try{var s=a.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var i=l.next;s=i;do{if((s.tag&e)===e){l=void 0;var o=s.create,x=s.inst;l=o(),x.destroy=l}s=s.next}while(s!==i)}}catch(j){He(a,a.return,j)}}function is(e,a,s){try{var l=a.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var o=i.next;l=o;do{if((l.tag&e)===e){var x=l.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,i=a;var A=s,U=j;try{U()}catch(V){He(i,A,V)}}}l=l.next}while(l!==o)}}catch(V){He(a,a.return,V)}}function Ox(e){var a=e.updateQueue;if(a!==null){var s=e.stateNode;try{Sm(a,s)}catch(l){He(e,e.return,l)}}}function Lx(e,a,s){s.props=Ks(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(l){He(e,a,l)}}function zl(e,a){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof s=="function"?e.refCleanup=s(l):s.current=l}}catch(i){He(e,a,i)}}function ga(e,a){var s=e.ref,l=e.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(i){He(e,a,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(i){He(e,a,i)}else s.current=null}function _x(e){var a=e.type,s=e.memoizedProps,l=e.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break e;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(i){He(e,e.return,i)}}function So(e,a,s){try{var l=e.stateNode;Tg(l,e.type,s,a),l[Tt]=a}catch(i){He(e,e.return,i)}}function Ux(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xs(e.type)||e.tag===4}function ko(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ux(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&xs(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function zo(e,a,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(e),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=ka));else if(l!==4&&(l===27&&xs(e.type)&&(s=e.stateNode,a=null),e=e.child,e!==null))for(zo(e,a,s),e=e.sibling;e!==null;)zo(e,a,s),e=e.sibling}function Ii(e,a,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,a?s.insertBefore(e,a):s.appendChild(e);else if(l!==4&&(l===27&&xs(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(Ii(e,a,s),e=e.sibling;e!==null;)Ii(e,a,s),e=e.sibling}function Bx(e){var a=e.stateNode,s=e.memoizedProps;try{for(var l=e.type,i=a.attributes;i.length;)a.removeAttributeNode(i[0]);jt(a,l,s),a[gt]=e,a[Tt]=s}catch(o){He(e,e.return,o)}}var La=!1,ct=!1,Co=!1,$x=typeof WeakSet=="function"?WeakSet:Set,xt=null;function og(e,a){if(e=e.containerInfo,Zo=br,e=Iu(e),yc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var i=l.anchorOffset,o=l.focusNode;l=l.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var x=0,j=-1,A=-1,U=0,V=0,F=e,H=null;t:for(;;){for(var K;F!==s||i!==0&&F.nodeType!==3||(j=x+i),F!==o||l!==0&&F.nodeType!==3||(A=x+l),F.nodeType===3&&(x+=F.nodeValue.length),(K=F.firstChild)!==null;)H=F,F=K;for(;;){if(F===e)break t;if(H===s&&++U===i&&(j=x),H===o&&++V===l&&(A=x),(K=F.nextSibling)!==null)break;F=H,H=F.parentNode}F=K}s=j===-1||A===-1?null:{start:j,end:A}}else s=null}s=s||{start:0,end:0}}else s=null;for(Jo={focusedElem:e,selectionRange:s},br=!1,xt=a;xt!==null;)if(a=xt,e=a.child,(a.subtreeFlags&1028)!==0&&e!==null)e.return=a,xt=e;else for(;xt!==null;){switch(a=xt,o=a.alternate,e=a.flags,a.tag){case 0:if((e&4)!==0&&(e=a.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)i=e[s],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,s=a,i=o.memoizedProps,o=o.memoizedState,l=s.stateNode;try{var ue=Ks(s.type,i);e=l.getSnapshotBeforeUpdate(ue,o),l.__reactInternalSnapshotBeforeUpdate=e}catch(ge){He(s,s.return,ge)}}break;case 3:if((e&1024)!==0){if(e=a.stateNode.containerInfo,s=e.nodeType,s===9)Po(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Po(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(c(163))}if(e=a.sibling,e!==null){e.return=a.return,xt=e;break}xt=a.return}}function Hx(e,a,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:Ua(e,s),l&4&&kl(5,s);break;case 1:if(Ua(e,s),l&4)if(e=s.stateNode,a===null)try{e.componentDidMount()}catch(x){He(s,s.return,x)}else{var i=Ks(s.type,a.memoizedProps);a=a.memoizedState;try{e.componentDidUpdate(i,a,e.__reactInternalSnapshotBeforeUpdate)}catch(x){He(s,s.return,x)}}l&64&&Ox(s),l&512&&zl(s,s.return);break;case 3:if(Ua(e,s),l&64&&(e=s.updateQueue,e!==null)){if(a=null,s.child!==null)switch(s.child.tag){case 27:case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}try{Sm(e,a)}catch(x){He(s,s.return,x)}}break;case 27:a===null&&l&4&&Bx(s);case 26:case 5:Ua(e,s),a===null&&l&4&&_x(s),l&512&&zl(s,s.return);break;case 12:Ua(e,s);break;case 31:Ua(e,s),l&4&&Kx(e,s);break;case 13:Ua(e,s),l&4&&Vx(e,s),l&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=bg.bind(null,s),Bg(e,s))));break;case 22:if(l=s.memoizedState!==null||La,!l){a=a!==null&&a.memoizedState!==null||ct,i=La;var o=ct;La=l,(ct=a)&&!o?Ba(e,s,(s.subtreeFlags&8772)!==0):Ua(e,s),La=i,ct=o}break;case 30:break;default:Ua(e,s)}}function qx(e){var a=e.alternate;a!==null&&(e.alternate=null,qx(a)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(a=e.stateNode,a!==null&&ac(a)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Je=null,Mt=!1;function _a(e,a,s){for(s=s.child;s!==null;)Gx(e,a,s),s=s.sibling}function Gx(e,a,s){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(Fn,s)}catch{}switch(s.tag){case 26:ct||ga(s,a),_a(e,a,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:ct||ga(s,a);var l=Je,i=Mt;xs(s.type)&&(Je=s.stateNode,Mt=!1),_a(e,a,s),Ll(s.stateNode),Je=l,Mt=i;break;case 5:ct||ga(s,a);case 6:if(l=Je,i=Mt,Je=null,_a(e,a,s),Je=l,Mt=i,Je!==null)if(Mt)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(s.stateNode)}catch(o){He(s,a,o)}else try{Je.removeChild(s.stateNode)}catch(o){He(s,a,o)}break;case 18:Je!==null&&(Mt?(e=Je,Lf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Un(e)):Lf(Je,s.stateNode));break;case 4:l=Je,i=Mt,Je=s.stateNode.containerInfo,Mt=!0,_a(e,a,s),Je=l,Mt=i;break;case 0:case 11:case 14:case 15:is(2,s,a),ct||is(4,s,a),_a(e,a,s);break;case 1:ct||(ga(s,a),l=s.stateNode,typeof l.componentWillUnmount=="function"&&Lx(s,a,l)),_a(e,a,s);break;case 21:_a(e,a,s);break;case 22:ct=(l=ct)||s.memoizedState!==null,_a(e,a,s),ct=l;break;default:_a(e,a,s)}}function Kx(e,a){if(a.memoizedState===null&&(e=a.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Un(e)}catch(s){He(a,a.return,s)}}}function Vx(e,a){if(a.memoizedState===null&&(e=a.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Un(e)}catch(s){He(a,a.return,s)}}function dg(e){switch(e.tag){case 31:case 13:case 19:var a=e.stateNode;return a===null&&(a=e.stateNode=new $x),a;case 22:return e=e.stateNode,a=e._retryCache,a===null&&(a=e._retryCache=new $x),a;default:throw Error(c(435,e.tag))}}function Pi(e,a){var s=dg(e);a.forEach(function(l){if(!s.has(l)){s.add(l);var i=yg.bind(null,e,l);l.then(i,i)}})}function Dt(e,a){var s=a.deletions;if(s!==null)for(var l=0;l<s.length;l++){var i=s[l],o=e,x=a,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(xs(j.type)){Je=j.stateNode,Mt=!1;break e}break;case 5:Je=j.stateNode,Mt=!1;break e;case 3:case 4:Je=j.stateNode.containerInfo,Mt=!0;break e}j=j.return}if(Je===null)throw Error(c(160));Gx(o,x,i),Je=null,Mt=!1,o=i.alternate,o!==null&&(o.return=null),i.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Yx(a,e),a=a.sibling}var ua=null;function Yx(e,a){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Dt(a,e),Ot(e),l&4&&(is(3,e,e.return),kl(3,e),is(5,e,e.return));break;case 1:Dt(a,e),Ot(e),l&512&&(ct||s===null||ga(s,s.return)),l&64&&La&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?l:s.concat(l))));break;case 26:var i=ua;if(Dt(a,e),Ot(e),l&512&&(ct||s===null||ga(s,s.return)),l&4){var o=s!==null?s.memoizedState:null;if(l=e.memoizedState,s===null)if(l===null)if(e.stateNode===null){e:{l=e.type,s=e.memoizedProps,i=i.ownerDocument||i;t:switch(l){case"title":o=i.getElementsByTagName("title")[0],(!o||o[Wn]||o[gt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=i.createElement(l),i.head.insertBefore(o,i.querySelector("head > title"))),jt(o,l,s),o[gt]=e,mt(o),l=o;break e;case"link":var x=Xf("link","href",i).get(l+(s.href||""));if(x){for(var j=0;j<x.length;j++)if(o=x[j],o.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&o.getAttribute("rel")===(s.rel==null?null:s.rel)&&o.getAttribute("title")===(s.title==null?null:s.title)&&o.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){x.splice(j,1);break t}}o=i.createElement(l),jt(o,l,s),i.head.appendChild(o);break;case"meta":if(x=Xf("meta","content",i).get(l+(s.content||""))){for(j=0;j<x.length;j++)if(o=x[j],o.getAttribute("content")===(s.content==null?null:""+s.content)&&o.getAttribute("name")===(s.name==null?null:s.name)&&o.getAttribute("property")===(s.property==null?null:s.property)&&o.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&o.getAttribute("charset")===(s.charSet==null?null:s.charSet)){x.splice(j,1);break t}}o=i.createElement(l),jt(o,l,s),i.head.appendChild(o);break;default:throw Error(c(468,l))}o[gt]=e,mt(o),l=o}e.stateNode=l}else Qf(i,e.type,e.stateNode);else e.stateNode=Yf(i,l,e.memoizedProps);else o!==l?(o===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):o.count--,l===null?Qf(i,e.type,e.stateNode):Yf(i,l,e.memoizedProps)):l===null&&e.stateNode!==null&&So(e,e.memoizedProps,s.memoizedProps)}break;case 27:Dt(a,e),Ot(e),l&512&&(ct||s===null||ga(s,s.return)),s!==null&&l&4&&So(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Dt(a,e),Ot(e),l&512&&(ct||s===null||ga(s,s.return)),e.flags&32){i=e.stateNode;try{ln(i,"")}catch(ue){He(e,e.return,ue)}}l&4&&e.stateNode!=null&&(i=e.memoizedProps,So(e,i,s!==null?s.memoizedProps:i)),l&1024&&(Co=!0);break;case 6:if(Dt(a,e),Ot(e),l&4){if(e.stateNode===null)throw Error(c(162));l=e.memoizedProps,s=e.stateNode;try{s.nodeValue=l}catch(ue){He(e,e.return,ue)}}break;case 3:if(fr=null,i=ua,ua=mr(a.containerInfo),Dt(a,e),ua=i,Ot(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{Un(a.containerInfo)}catch(ue){He(e,e.return,ue)}Co&&(Co=!1,Xx(e));break;case 4:l=ua,ua=mr(e.stateNode.containerInfo),Dt(a,e),Ot(e),ua=l;break;case 12:Dt(a,e),Ot(e);break;case 31:Dt(a,e),Ot(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Pi(e,l)));break;case 13:Dt(a,e),Ot(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(er=ut()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Pi(e,l)));break;case 22:i=e.memoizedState!==null;var A=s!==null&&s.memoizedState!==null,U=La,V=ct;if(La=U||i,ct=V||A,Dt(a,e),ct=V,La=U,Ot(e),l&8192)e:for(a=e.stateNode,a._visibility=i?a._visibility&-2:a._visibility|1,i&&(s===null||A||La||ct||Vs(e)),s=null,a=e;;){if(a.tag===5||a.tag===26){if(s===null){A=s=a;try{if(o=A.stateNode,i)x=o.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=A.stateNode;var F=A.memoizedProps.style,H=F!=null&&F.hasOwnProperty("display")?F.display:null;j.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(ue){He(A,A.return,ue)}}}else if(a.tag===6){if(s===null){A=a;try{A.stateNode.nodeValue=i?"":A.memoizedProps}catch(ue){He(A,A.return,ue)}}}else if(a.tag===18){if(s===null){A=a;try{var K=A.stateNode;i?_f(K,!0):_f(A.stateNode,!1)}catch(ue){He(A,A.return,ue)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===e)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===e)break e;for(;a.sibling===null;){if(a.return===null||a.return===e)break e;s===a&&(s=null),a=a.return}s===a&&(s=null),a.sibling.return=a.return,a=a.sibling}l&4&&(l=e.updateQueue,l!==null&&(s=l.retryQueue,s!==null&&(l.retryQueue=null,Pi(e,s))));break;case 19:Dt(a,e),Ot(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Pi(e,l)));break;case 30:break;case 21:break;default:Dt(a,e),Ot(e)}}function Ot(e){var a=e.flags;if(a&2){try{for(var s,l=e.return;l!==null;){if(Ux(l)){s=l;break}l=l.return}if(s==null)throw Error(c(160));switch(s.tag){case 27:var i=s.stateNode,o=ko(e);Ii(e,o,i);break;case 5:var x=s.stateNode;s.flags&32&&(ln(x,""),s.flags&=-33);var j=ko(e);Ii(e,j,x);break;case 3:case 4:var A=s.stateNode.containerInfo,U=ko(e);zo(e,U,A);break;default:throw Error(c(161))}}catch(V){He(e,e.return,V)}e.flags&=-3}a&4096&&(e.flags&=-4097)}function Xx(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var a=e;Xx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),e=e.sibling}}function Ua(e,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Hx(e,a.alternate,a),a=a.sibling}function Vs(e){for(e=e.child;e!==null;){var a=e;switch(a.tag){case 0:case 11:case 14:case 15:is(4,a,a.return),Vs(a);break;case 1:ga(a,a.return);var s=a.stateNode;typeof s.componentWillUnmount=="function"&&Lx(a,a.return,s),Vs(a);break;case 27:Ll(a.stateNode);case 26:case 5:ga(a,a.return),Vs(a);break;case 22:a.memoizedState===null&&Vs(a);break;case 30:Vs(a);break;default:Vs(a)}e=e.sibling}}function Ba(e,a,s){for(s=s&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var l=a.alternate,i=e,o=a,x=o.flags;switch(o.tag){case 0:case 11:case 15:Ba(i,o,s),kl(4,o);break;case 1:if(Ba(i,o,s),l=o,i=l.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(U){He(l,l.return,U)}if(l=o,i=l.updateQueue,i!==null){var j=l.stateNode;try{var A=i.shared.hiddenCallbacks;if(A!==null)for(i.shared.hiddenCallbacks=null,i=0;i<A.length;i++)wm(A[i],j)}catch(U){He(l,l.return,U)}}s&&x&64&&Ox(o),zl(o,o.return);break;case 27:Bx(o);case 26:case 5:Ba(i,o,s),s&&l===null&&x&4&&_x(o),zl(o,o.return);break;case 12:Ba(i,o,s);break;case 31:Ba(i,o,s),s&&x&4&&Kx(i,o);break;case 13:Ba(i,o,s),s&&x&4&&Vx(i,o);break;case 22:o.memoizedState===null&&Ba(i,o,s),zl(o,o.return);break;case 30:break;default:Ba(i,o,s)}a=a.sibling}}function Ao(e,a){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(e=a.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&ml(s))}function Eo(e,a){e=null,a.alternate!==null&&(e=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==e&&(a.refCount++,e!=null&&ml(e))}function ma(e,a,s,l){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Qx(e,a,s,l),a=a.sibling}function Qx(e,a,s,l){var i=a.flags;switch(a.tag){case 0:case 11:case 15:ma(e,a,s,l),i&2048&&kl(9,a);break;case 1:ma(e,a,s,l);break;case 3:ma(e,a,s,l),i&2048&&(e=null,a.alternate!==null&&(e=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==e&&(a.refCount++,e!=null&&ml(e)));break;case 12:if(i&2048){ma(e,a,s,l),e=a.stateNode;try{var o=a.memoizedProps,x=o.id,j=o.onPostCommit;typeof j=="function"&&j(x,a.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(A){He(a,a.return,A)}}else ma(e,a,s,l);break;case 31:ma(e,a,s,l);break;case 13:ma(e,a,s,l);break;case 23:break;case 22:o=a.stateNode,x=a.alternate,a.memoizedState!==null?o._visibility&2?ma(e,a,s,l):Cl(e,a):o._visibility&2?ma(e,a,s,l):(o._visibility|=2,zn(e,a,s,l,(a.subtreeFlags&10256)!==0||!1)),i&2048&&Ao(x,a);break;case 24:ma(e,a,s,l),i&2048&&Eo(a.alternate,a);break;default:ma(e,a,s,l)}}function zn(e,a,s,l,i){for(i=i&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var o=e,x=a,j=s,A=l,U=x.flags;switch(x.tag){case 0:case 11:case 15:zn(o,x,j,A,i),kl(8,x);break;case 23:break;case 22:var V=x.stateNode;x.memoizedState!==null?V._visibility&2?zn(o,x,j,A,i):Cl(o,x):(V._visibility|=2,zn(o,x,j,A,i)),i&&U&2048&&Ao(x.alternate,x);break;case 24:zn(o,x,j,A,i),i&&U&2048&&Eo(x.alternate,x);break;default:zn(o,x,j,A,i)}a=a.sibling}}function Cl(e,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var s=e,l=a,i=l.flags;switch(l.tag){case 22:Cl(s,l),i&2048&&Ao(l.alternate,l);break;case 24:Cl(s,l),i&2048&&Eo(l.alternate,l);break;default:Cl(s,l)}a=a.sibling}}var Al=8192;function Cn(e,a,s){if(e.subtreeFlags&Al)for(e=e.child;e!==null;)Zx(e,a,s),e=e.sibling}function Zx(e,a,s){switch(e.tag){case 26:Cn(e,a,s),e.flags&Al&&e.memoizedState!==null&&Fg(s,ua,e.memoizedState,e.memoizedProps);break;case 5:Cn(e,a,s);break;case 3:case 4:var l=ua;ua=mr(e.stateNode.containerInfo),Cn(e,a,s),ua=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Al,Al=16777216,Cn(e,a,s),Al=l):Cn(e,a,s));break;default:Cn(e,a,s)}}function Jx(e){var a=e.alternate;if(a!==null&&(e=a.child,e!==null)){a.child=null;do a=e.sibling,e.sibling=null,e=a;while(e!==null)}}function El(e){var a=e.deletions;if((e.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var l=a[s];xt=l,Ix(l,e)}Jx(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fx(e),e=e.sibling}function Fx(e){switch(e.tag){case 0:case 11:case 15:El(e),e.flags&2048&&is(9,e,e.return);break;case 3:El(e);break;case 12:El(e);break;case 22:var a=e.stateNode;e.memoizedState!==null&&a._visibility&2&&(e.return===null||e.return.tag!==13)?(a._visibility&=-3,Wi(e)):El(e);break;default:El(e)}}function Wi(e){var a=e.deletions;if((e.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var l=a[s];xt=l,Ix(l,e)}Jx(e)}for(e=e.child;e!==null;){switch(a=e,a.tag){case 0:case 11:case 15:is(8,a,a.return),Wi(a);break;case 22:s=a.stateNode,s._visibility&2&&(s._visibility&=-3,Wi(a));break;default:Wi(a)}e=e.sibling}}function Ix(e,a){for(;xt!==null;){var s=xt;switch(s.tag){case 0:case 11:case 15:is(8,s,a);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var l=s.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ml(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,xt=l;else e:for(s=e;xt!==null;){l=xt;var i=l.sibling,o=l.return;if(qx(l),l===s){xt=null;break e}if(i!==null){i.return=o,xt=i;break e}xt=o}}}var ug={getCacheForType:function(e){var a=yt(lt),s=a.data.get(e);return s===void 0&&(s=e(),a.data.set(e,s)),s},cacheSignal:function(){return yt(lt).controller.signal}},mg=typeof WeakMap=="function"?WeakMap:Map,Be=0,Ve=null,Ae=null,Te=0,$e=0,Yt=null,rs=!1,An=!1,To=!1,$a=0,We=0,cs=0,Ys=0,Ro=0,Xt=0,En=0,Tl=null,Lt=null,Mo=!1,er=0,Px=0,tr=1/0,ar=null,os=null,ot=0,ds=null,Tn=null,Ha=0,Do=0,Oo=null,Wx=null,Rl=0,Lo=null;function Qt(){return(Be&2)!==0&&Te!==0?Te&-Te:G.T!==null?qo():hu()}function ef(){if(Xt===0)if((Te&536870912)===0||Me){var e=di;di<<=1,(di&3932160)===0&&(di=262144),Xt=e}else Xt=536870912;return e=Kt.current,e!==null&&(e.flags|=32),Xt}function _t(e,a,s){(e===Ve&&($e===2||$e===9)||e.cancelPendingCommit!==null)&&(Rn(e,0),us(e,Te,Xt,!1)),Pn(e,s),((Be&2)===0||e!==Ve)&&(e===Ve&&((Be&2)===0&&(Ys|=s),We===4&&us(e,Te,Xt,!1)),ba(e))}function tf(e,a,s){if((Be&6)!==0)throw Error(c(327));var l=!s&&(a&127)===0&&(a&e.expiredLanes)===0||In(e,a),i=l?hg(e,a):Uo(e,a,!0),o=l;do{if(i===0){An&&!l&&us(e,a,0,!1);break}else{if(s=e.current.alternate,o&&!xg(s)){i=Uo(e,a,!1),o=!1;continue}if(i===2){if(o=a,e.errorRecoveryDisabledLanes&o)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){a=x;e:{var j=e;i=Tl;var A=j.current.memoizedState.isDehydrated;if(A&&(Rn(j,x).flags|=256),x=Uo(j,x,!1),x!==2){if(To&&!A){j.errorRecoveryDisabledLanes|=o,Ys|=o,i=4;break e}o=Lt,Lt=i,o!==null&&(Lt===null?Lt=o:Lt.push.apply(Lt,o))}i=x}if(o=!1,i!==2)continue}}if(i===1){Rn(e,0),us(e,a,0,!0);break}e:{switch(l=e,o=i,o){case 0:case 1:throw Error(c(345));case 4:if((a&4194048)!==a)break;case 6:us(l,a,Xt,!rs);break e;case 2:Lt=null;break;case 3:case 5:break;default:throw Error(c(329))}if((a&62914560)===a&&(i=er+300-ut(),10<i)){if(us(l,a,Xt,!rs),mi(l,0,!0)!==0)break e;Ha=a,l.timeoutHandle=Df(af.bind(null,l,s,Lt,ar,Mo,a,Xt,Ys,En,rs,o,"Throttled",-0,0),i);break e}af(l,s,Lt,ar,Mo,a,Xt,Ys,En,rs,o,null,-0,0)}}break}while(!0);ba(e)}function af(e,a,s,l,i,o,x,j,A,U,V,F,H,K){if(e.timeoutHandle=-1,F=a.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ka},Zx(a,o,F);var ue=(o&62914560)===o?er-ut():(o&4194048)===o?Px-ut():0;if(ue=Ig(F,ue),ue!==null){Ha=o,e.cancelPendingCommit=ue(uf.bind(null,e,a,o,s,l,i,x,j,A,V,F,null,H,K)),us(e,o,x,!U);return}}uf(e,a,o,s,l,i,x,j,A)}function xg(e){for(var a=e;;){var s=a.tag;if((s===0||s===11||s===15)&&a.flags&16384&&(s=a.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var l=0;l<s.length;l++){var i=s[l],o=i.getSnapshot;i=i.value;try{if(!qt(o(),i))return!1}catch{return!1}}if(s=a.child,a.subtreeFlags&16384&&s!==null)s.return=a,a=s;else{if(a===e)break;for(;a.sibling===null;){if(a.return===null||a.return===e)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function us(e,a,s,l){a&=~Ro,a&=~Ys,e.suspendedLanes|=a,e.pingedLanes&=~a,l&&(e.warmLanes|=a),l=e.expirationTimes;for(var i=a;0<i;){var o=31-Ht(i),x=1<<o;l[o]=-1,i&=~x}s!==0&&mu(e,s,a)}function sr(){return(Be&6)===0?(Ml(0),!1):!0}function _o(){if(Ae!==null){if($e===0)var e=Ae.return;else e=Ae,Ea=_s=null,Ic(e),jn=null,fl=0,e=Ae;for(;e!==null;)Dx(e.alternate,e),e=e.return;Ae=null}}function Rn(e,a){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Dg(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Ha=0,_o(),Ve=e,Ae=s=Ca(e.current,null),Te=a,$e=0,Yt=null,rs=!1,An=In(e,a),To=!1,En=Xt=Ro=Ys=cs=We=0,Lt=Tl=null,Mo=!1,(a&8)!==0&&(a|=a&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=a;0<l;){var i=31-Ht(l),o=1<<i;a|=e[i],l&=~o}return $a=a,Si(),s}function sf(e,a){Ne=null,G.H=Nl,a===vn||a===Mi?(a=ym(),$e=3):a===$c?(a=ym(),$e=4):$e=a===fo?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Yt=a,Ae===null&&(We=1,Xi(e,ea(a,e.current)))}function nf(){var e=Kt.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function lf(){var e=G.H;return G.H=Nl,e===null?Nl:e}function rf(){var e=G.A;return G.A=ug,e}function nr(){We=4,rs||(Te&4194048)!==Te&&Kt.current!==null||(An=!0),(cs&134217727)===0&&(Ys&134217727)===0||Ve===null||us(Ve,Te,Xt,!1)}function Uo(e,a,s){var l=Be;Be|=2;var i=lf(),o=rf();(Ve!==e||Te!==a)&&(ar=null,Rn(e,a)),a=!1;var x=We;e:do try{if($e!==0&&Ae!==null){var j=Ae,A=Yt;switch($e){case 8:_o(),x=6;break e;case 3:case 2:case 9:case 6:Kt.current===null&&(a=!0);var U=$e;if($e=0,Yt=null,Mn(e,j,A,U),s&&An){x=0;break e}break;default:U=$e,$e=0,Yt=null,Mn(e,j,A,U)}}fg(),x=We;break}catch(V){sf(e,V)}while(!0);return a&&e.shellSuspendCounter++,Ea=_s=null,Be=l,G.H=i,G.A=o,Ae===null&&(Ve=null,Te=0,Si()),x}function fg(){for(;Ae!==null;)cf(Ae)}function hg(e,a){var s=Be;Be|=2;var l=lf(),i=rf();Ve!==e||Te!==a?(ar=null,tr=ut()+500,Rn(e,a)):An=In(e,a);e:do try{if($e!==0&&Ae!==null){a=Ae;var o=Yt;t:switch($e){case 1:$e=0,Yt=null,Mn(e,a,o,1);break;case 2:case 9:if(gm(o)){$e=0,Yt=null,of(a);break}a=function(){$e!==2&&$e!==9||Ve!==e||($e=7),ba(e)},o.then(a,a);break e;case 3:$e=7;break e;case 4:$e=5;break e;case 7:gm(o)?($e=0,Yt=null,of(a)):($e=0,Yt=null,Mn(e,a,o,7));break;case 5:var x=null;switch(Ae.tag){case 26:x=Ae.memoizedState;case 5:case 27:var j=Ae;if(x?Zf(x):j.stateNode.complete){$e=0,Yt=null;var A=j.sibling;if(A!==null)Ae=A;else{var U=j.return;U!==null?(Ae=U,lr(U)):Ae=null}break t}}$e=0,Yt=null,Mn(e,a,o,5);break;case 6:$e=0,Yt=null,Mn(e,a,o,6);break;case 8:_o(),We=6;break e;default:throw Error(c(462))}}pg();break}catch(V){sf(e,V)}while(!0);return Ea=_s=null,G.H=l,G.A=i,Be=s,Ae!==null?0:(Ve=null,Te=0,Si(),We)}function pg(){for(;Ae!==null&&!Bt();)cf(Ae)}function cf(e){var a=Rx(e.alternate,e,$a);e.memoizedProps=e.pendingProps,a===null?lr(e):Ae=a}function of(e){var a=e,s=a.alternate;switch(a.tag){case 15:case 0:a=kx(s,a,a.pendingProps,a.type,void 0,Te);break;case 11:a=kx(s,a,a.pendingProps,a.type.render,a.ref,Te);break;case 5:Ic(a);default:Dx(s,a),a=Ae=im(a,$a),a=Rx(s,a,$a)}e.memoizedProps=e.pendingProps,a===null?lr(e):Ae=a}function Mn(e,a,s,l){Ea=_s=null,Ic(a),jn=null,fl=0;var i=a.return;try{if(ng(e,i,a,s,Te)){We=1,Xi(e,ea(s,e.current)),Ae=null;return}}catch(o){if(i!==null)throw Ae=i,o;We=1,Xi(e,ea(s,e.current)),Ae=null;return}a.flags&32768?(Me||l===1?e=!0:An||(Te&536870912)!==0?e=!1:(rs=e=!0,(l===2||l===9||l===3||l===6)&&(l=Kt.current,l!==null&&l.tag===13&&(l.flags|=16384))),df(a,e)):lr(a)}function lr(e){var a=e;do{if((a.flags&32768)!==0){df(a,rs);return}e=a.return;var s=rg(a.alternate,a,$a);if(s!==null){Ae=s;return}if(a=a.sibling,a!==null){Ae=a;return}Ae=a=e}while(a!==null);We===0&&(We=5)}function df(e,a){do{var s=cg(e.alternate,e);if(s!==null){s.flags&=32767,Ae=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!a&&(e=e.sibling,e!==null)){Ae=e;return}Ae=e=s}while(e!==null);We=6,Ae=null}function uf(e,a,s,l,i,o,x,j,A){e.cancelPendingCommit=null;do ir();while(ot!==0);if((Be&6)!==0)throw Error(c(327));if(a!==null){if(a===e.current)throw Error(c(177));if(o=a.lanes|a.childLanes,o|=Sc,J0(e,s,o,x,j,A),e===Ve&&(Ae=Ve=null,Te=0),Tn=a,ds=e,Ha=s,Do=o,Oo=i,Wx=l,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,vg(Ps,function(){return pf(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||l){l=G.T,G.T=null,i=ie.p,ie.p=2,x=Be,Be|=4;try{og(e,a,s)}finally{Be=x,ie.p=i,G.T=l}}ot=1,mf(),xf(),ff()}}function mf(){if(ot===1){ot=0;var e=ds,a=Tn,s=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||s){s=G.T,G.T=null;var l=ie.p;ie.p=2;var i=Be;Be|=4;try{Yx(a,e);var o=Jo,x=Iu(e.containerInfo),j=o.focusedElem,A=o.selectionRange;if(x!==j&&j&&j.ownerDocument&&Fu(j.ownerDocument.documentElement,j)){if(A!==null&&yc(j)){var U=A.start,V=A.end;if(V===void 0&&(V=U),"selectionStart"in j)j.selectionStart=U,j.selectionEnd=Math.min(V,j.value.length);else{var F=j.ownerDocument||document,H=F&&F.defaultView||window;if(H.getSelection){var K=H.getSelection(),ue=j.textContent.length,ge=Math.min(A.start,ue),Ke=A.end===void 0?ge:Math.min(A.end,ue);!K.extend&&ge>Ke&&(x=Ke,Ke=ge,ge=x);var L=Ju(j,ge),R=Ju(j,Ke);if(L&&R&&(K.rangeCount!==1||K.anchorNode!==L.node||K.anchorOffset!==L.offset||K.focusNode!==R.node||K.focusOffset!==R.offset)){var _=F.createRange();_.setStart(L.node,L.offset),K.removeAllRanges(),ge>Ke?(K.addRange(_),K.extend(R.node,R.offset)):(_.setEnd(R.node,R.offset),K.addRange(_))}}}}for(F=[],K=j;K=K.parentNode;)K.nodeType===1&&F.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<F.length;j++){var Z=F[j];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}br=!!Zo,Jo=Zo=null}finally{Be=i,ie.p=l,G.T=s}}e.current=a,ot=2}}function xf(){if(ot===2){ot=0;var e=ds,a=Tn,s=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||s){s=G.T,G.T=null;var l=ie.p;ie.p=2;var i=Be;Be|=4;try{Hx(e,a.alternate,a)}finally{Be=i,ie.p=l,G.T=s}}ot=3}}function ff(){if(ot===4||ot===3){ot=0,Ft();var e=ds,a=Tn,s=Ha,l=Wx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ot=5:(ot=0,Tn=ds=null,hf(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(os=null),ec(s),a=a.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(Fn,a,void 0,(a.current.flags&128)===128)}catch{}if(l!==null){a=G.T,i=ie.p,ie.p=2,G.T=null;try{for(var o=e.onRecoverableError,x=0;x<l.length;x++){var j=l[x];o(j.value,{componentStack:j.stack})}}finally{G.T=a,ie.p=i}}(Ha&3)!==0&&ir(),ba(e),i=e.pendingLanes,(s&261930)!==0&&(i&42)!==0?e===Lo?Rl++:(Rl=0,Lo=e):Rl=0,Ml(0)}}function hf(e,a){(e.pooledCacheLanes&=a)===0&&(a=e.pooledCache,a!=null&&(e.pooledCache=null,ml(a)))}function ir(){return mf(),xf(),ff(),pf()}function pf(){if(ot!==5)return!1;var e=ds,a=Do;Do=0;var s=ec(Ha),l=G.T,i=ie.p;try{ie.p=32>s?32:s,G.T=null,s=Oo,Oo=null;var o=ds,x=Ha;if(ot=0,Tn=ds=null,Ha=0,(Be&6)!==0)throw Error(c(331));var j=Be;if(Be|=4,Fx(o.current),Qx(o,o.current,x,s),Be=j,Ml(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(Fn,o)}catch{}return!0}finally{ie.p=i,G.T=l,hf(e,a)}}function gf(e,a,s){a=ea(s,a),a=xo(e.stateNode,a,2),e=ss(e,a,2),e!==null&&(Pn(e,2),ba(e))}function He(e,a,s){if(e.tag===3)gf(e,e,s);else for(;a!==null;){if(a.tag===3){gf(a,e,s);break}else if(a.tag===1){var l=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(os===null||!os.has(l))){e=ea(s,e),s=gx(2),l=ss(a,s,2),l!==null&&(bx(s,l,a,e),Pn(l,2),ba(l));break}}a=a.return}}function Bo(e,a,s){var l=e.pingCache;if(l===null){l=e.pingCache=new mg;var i=new Set;l.set(a,i)}else i=l.get(a),i===void 0&&(i=new Set,l.set(a,i));i.has(s)||(To=!0,i.add(s),e=gg.bind(null,e,a,s),a.then(e,e))}function gg(e,a,s){var l=e.pingCache;l!==null&&l.delete(a),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ve===e&&(Te&s)===s&&(We===4||We===3&&(Te&62914560)===Te&&300>ut()-er?(Be&2)===0&&Rn(e,0):Ro|=s,En===Te&&(En=0)),ba(e)}function bf(e,a){a===0&&(a=uu()),e=Ds(e,a),e!==null&&(Pn(e,a),ba(e))}function bg(e){var a=e.memoizedState,s=0;a!==null&&(s=a.retryLane),bf(e,s)}function yg(e,a){var s=0;switch(e.tag){case 31:case 13:var l=e.stateNode,i=e.memoizedState;i!==null&&(s=i.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(c(314))}l!==null&&l.delete(a),bf(e,s)}function vg(e,a){return ye(e,a)}var rr=null,Dn=null,$o=!1,cr=!1,Ho=!1,ms=0;function ba(e){e!==Dn&&e.next===null&&(Dn===null?rr=Dn=e:Dn=Dn.next=e),cr=!0,$o||($o=!0,Ng())}function Ml(e,a){if(!Ho&&cr){Ho=!0;do for(var s=!1,l=rr;l!==null;){if(e!==0){var i=l.pendingLanes;if(i===0)var o=0;else{var x=l.suspendedLanes,j=l.pingedLanes;o=(1<<31-Ht(42|e)+1)-1,o&=i&~(x&~j),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(s=!0,Nf(l,o))}else o=Te,o=mi(l,l===Ve?o:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(o&3)===0||In(l,o)||(s=!0,Nf(l,o));l=l.next}while(s);Ho=!1}}function jg(){yf()}function yf(){cr=$o=!1;var e=0;ms!==0&&Mg()&&(e=ms);for(var a=ut(),s=null,l=rr;l!==null;){var i=l.next,o=vf(l,a);o===0?(l.next=null,s===null?rr=i:s.next=i,i===null&&(Dn=s)):(s=l,(e!==0||(o&3)!==0)&&(cr=!0)),l=i}ot!==0&&ot!==5||Ml(e),ms!==0&&(ms=0)}function vf(e,a){for(var s=e.suspendedLanes,l=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var x=31-Ht(o),j=1<<x,A=i[x];A===-1?((j&s)===0||(j&l)!==0)&&(i[x]=Z0(j,a)):A<=a&&(e.expiredLanes|=j),o&=~j}if(a=Ve,s=Te,s=mi(e,e===a?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,s===0||e===a&&($e===2||$e===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Ye(l),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||In(e,s)){if(a=s&-s,a===e.callbackPriority)return a;switch(l!==null&&Ye(l),ec(s)){case 2:case 8:s=ci;break;case 32:s=Ps;break;case 268435456:s=du;break;default:s=Ps}return l=jf.bind(null,e),s=ye(s,l),e.callbackPriority=a,e.callbackNode=s,a}return l!==null&&l!==null&&Ye(l),e.callbackPriority=2,e.callbackNode=null,2}function jf(e,a){if(ot!==0&&ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(ir()&&e.callbackNode!==s)return null;var l=Te;return l=mi(e,e===Ve?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(tf(e,l,a),vf(e,ut()),e.callbackNode!=null&&e.callbackNode===s?jf.bind(null,e):null)}function Nf(e,a){if(ir())return null;tf(e,a,!0)}function Ng(){Og(function(){(Be&6)!==0?ye(Jn,jg):yf()})}function qo(){if(ms===0){var e=bn;e===0&&(e=oi,oi<<=1,(oi&261888)===0&&(oi=256)),ms=e}return ms}function wf(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:pi(""+e)}function Sf(e,a){var s=a.ownerDocument.createElement("input");return s.name=a.name,s.value=a.value,e.id&&s.setAttribute("form",e.id),a.parentNode.insertBefore(s,a),e=new FormData(e),s.parentNode.removeChild(s),e}function wg(e,a,s,l,i){if(a==="submit"&&s&&s.stateNode===i){var o=wf((i[Tt]||null).action),x=l.submitter;x&&(a=(a=x[Tt]||null)?wf(a.formAction):x.getAttribute("formAction"),a!==null&&(o=a,x=null));var j=new vi("action","action",null,l,i);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ms!==0){var A=x?Sf(i,x):new FormData(i);io(s,{pending:!0,data:A,method:i.method,action:o},null,A)}}else typeof o=="function"&&(j.preventDefault(),A=x?Sf(i,x):new FormData(i),io(s,{pending:!0,data:A,method:i.method,action:o},o,A))},currentTarget:i}]})}}for(var Go=0;Go<wc.length;Go++){var Ko=wc[Go],Sg=Ko.toLowerCase(),kg=Ko[0].toUpperCase()+Ko.slice(1);da(Sg,"on"+kg)}da(em,"onAnimationEnd"),da(tm,"onAnimationIteration"),da(am,"onAnimationStart"),da("dblclick","onDoubleClick"),da("focusin","onFocus"),da("focusout","onBlur"),da(qp,"onTransitionRun"),da(Gp,"onTransitionStart"),da(Kp,"onTransitionCancel"),da(sm,"onTransitionEnd"),sn("onMouseEnter",["mouseout","mouseover"]),sn("onMouseLeave",["mouseout","mouseover"]),sn("onPointerEnter",["pointerout","pointerover"]),sn("onPointerLeave",["pointerout","pointerover"]),Es("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Es("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Es("onBeforeInput",["compositionend","keypress","textInput","paste"]),Es("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Es("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Es("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zg=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dl));function kf(e,a){a=(a&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],i=l.event;l=l.listeners;e:{var o=void 0;if(a)for(var x=l.length-1;0<=x;x--){var j=l[x],A=j.instance,U=j.currentTarget;if(j=j.listener,A!==o&&i.isPropagationStopped())break e;o=j,i.currentTarget=U;try{o(i)}catch(V){wi(V)}i.currentTarget=null,o=A}else for(x=0;x<l.length;x++){if(j=l[x],A=j.instance,U=j.currentTarget,j=j.listener,A!==o&&i.isPropagationStopped())break e;o=j,i.currentTarget=U;try{o(i)}catch(V){wi(V)}i.currentTarget=null,o=A}}}}function Ee(e,a){var s=a[tc];s===void 0&&(s=a[tc]=new Set);var l=e+"__bubble";s.has(l)||(zf(a,e,2,!1),s.add(l))}function Vo(e,a,s){var l=0;a&&(l|=4),zf(s,e,l,a)}var or="_reactListening"+Math.random().toString(36).slice(2);function Yo(e){if(!e[or]){e[or]=!0,bu.forEach(function(s){s!=="selectionchange"&&(zg.has(s)||Vo(s,!1,e),Vo(s,!0,e))});var a=e.nodeType===9?e:e.ownerDocument;a===null||a[or]||(a[or]=!0,Vo("selectionchange",!1,a))}}function zf(e,a,s,l){switch(th(a)){case 2:var i=eb;break;case 8:i=tb;break;default:i=id}s=i.bind(null,a,s,e),i=void 0,!dc||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(i=!0),l?i!==void 0?e.addEventListener(a,s,{capture:!0,passive:i}):e.addEventListener(a,s,!0):i!==void 0?e.addEventListener(a,s,{passive:i}):e.addEventListener(a,s,!1)}function Xo(e,a,s,l,i){var o=l;if((a&1)===0&&(a&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var j=l.stateNode.containerInfo;if(j===i)break;if(x===4)for(x=l.return;x!==null;){var A=x.tag;if((A===3||A===4)&&x.stateNode.containerInfo===i)return;x=x.return}for(;j!==null;){if(x=en(j),x===null)return;if(A=x.tag,A===5||A===6||A===26||A===27){l=o=x;continue e}j=j.parentNode}}l=l.return}Tu(function(){var U=o,V=cc(s),F=[];e:{var H=nm.get(e);if(H!==void 0){var K=vi,ue=e;switch(e){case"keypress":if(bi(s)===0)break e;case"keydown":case"keyup":K=yp;break;case"focusin":ue="focus",K=fc;break;case"focusout":ue="blur",K=fc;break;case"beforeblur":case"afterblur":K=fc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=Du;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=rp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Np;break;case em:case tm:case am:K=dp;break;case sm:K=Sp;break;case"scroll":case"scrollend":K=lp;break;case"wheel":K=zp;break;case"copy":case"cut":case"paste":K=mp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Lu;break;case"toggle":case"beforetoggle":K=Ap}var ge=(a&4)!==0,Ke=!ge&&(e==="scroll"||e==="scrollend"),L=ge?H!==null?H+"Capture":null:H;ge=[];for(var R=U,_;R!==null;){var Z=R;if(_=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||_===null||L===null||(Z=tl(R,L),Z!=null&&ge.push(Ol(R,Z,_))),Ke)break;R=R.return}0<ge.length&&(H=new K(H,ue,null,s,V),F.push({event:H,listeners:ge}))}}if((a&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",H&&s!==rc&&(ue=s.relatedTarget||s.fromElement)&&(en(ue)||ue[Ws]))break e;if((K||H)&&(H=V.window===V?V:(H=V.ownerDocument)?H.defaultView||H.parentWindow:window,K?(ue=s.relatedTarget||s.toElement,K=U,ue=ue?en(ue):null,ue!==null&&(Ke=f(ue),ge=ue.tag,ue!==Ke||ge!==5&&ge!==27&&ge!==6)&&(ue=null)):(K=null,ue=U),K!==ue)){if(ge=Du,Z="onMouseLeave",L="onMouseEnter",R="mouse",(e==="pointerout"||e==="pointerover")&&(ge=Lu,Z="onPointerLeave",L="onPointerEnter",R="pointer"),Ke=K==null?H:el(K),_=ue==null?H:el(ue),H=new ge(Z,R+"leave",K,s,V),H.target=Ke,H.relatedTarget=_,Z=null,en(V)===U&&(ge=new ge(L,R+"enter",ue,s,V),ge.target=_,ge.relatedTarget=Ke,Z=ge),Ke=Z,K&&ue)t:{for(ge=Cg,L=K,R=ue,_=0,Z=L;Z;Z=ge(Z))_++;Z=0;for(var pe=R;pe;pe=ge(pe))Z++;for(;0<_-Z;)L=ge(L),_--;for(;0<Z-_;)R=ge(R),Z--;for(;_--;){if(L===R||R!==null&&L===R.alternate){ge=L;break t}L=ge(L),R=ge(R)}ge=null}else ge=null;K!==null&&Cf(F,H,K,ge,!1),ue!==null&&Ke!==null&&Cf(F,Ke,ue,ge,!0)}}e:{if(H=U?el(U):window,K=H.nodeName&&H.nodeName.toLowerCase(),K==="select"||K==="input"&&H.type==="file")var Le=Ku;else if(qu(H))if(Vu)Le=Bp;else{Le=_p;var fe=Lp}else K=H.nodeName,!K||K.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?U&&ic(U.elementType)&&(Le=Ku):Le=Up;if(Le&&(Le=Le(e,U))){Gu(F,Le,s,V);break e}fe&&fe(e,H,U),e==="focusout"&&U&&H.type==="number"&&U.memoizedProps.value!=null&&lc(H,"number",H.value)}switch(fe=U?el(U):window,e){case"focusin":(qu(fe)||fe.contentEditable==="true")&&(dn=fe,vc=U,ol=null);break;case"focusout":ol=vc=dn=null;break;case"mousedown":jc=!0;break;case"contextmenu":case"mouseup":case"dragend":jc=!1,Pu(F,s,V);break;case"selectionchange":if(Hp)break;case"keydown":case"keyup":Pu(F,s,V)}var Se;if(pc)e:{switch(e){case"compositionstart":var Re="onCompositionStart";break e;case"compositionend":Re="onCompositionEnd";break e;case"compositionupdate":Re="onCompositionUpdate";break e}Re=void 0}else on?$u(e,s)&&(Re="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Re="onCompositionStart");Re&&(_u&&s.locale!=="ko"&&(on||Re!=="onCompositionStart"?Re==="onCompositionEnd"&&on&&(Se=Ru()):(Fa=V,uc="value"in Fa?Fa.value:Fa.textContent,on=!0)),fe=dr(U,Re),0<fe.length&&(Re=new Ou(Re,e,null,s,V),F.push({event:Re,listeners:fe}),Se?Re.data=Se:(Se=Hu(s),Se!==null&&(Re.data=Se)))),(Se=Tp?Rp(e,s):Mp(e,s))&&(Re=dr(U,"onBeforeInput"),0<Re.length&&(fe=new Ou("onBeforeInput","beforeinput",null,s,V),F.push({event:fe,listeners:Re}),fe.data=Se)),wg(F,e,U,s,V)}kf(F,a)})}function Ol(e,a,s){return{instance:e,listener:a,currentTarget:s}}function dr(e,a){for(var s=a+"Capture",l=[];e!==null;){var i=e,o=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||o===null||(i=tl(e,s),i!=null&&l.unshift(Ol(e,i,o)),i=tl(e,a),i!=null&&l.push(Ol(e,i,o))),e.tag===3)return l;e=e.return}return[]}function Cg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Cf(e,a,s,l,i){for(var o=a._reactName,x=[];s!==null&&s!==l;){var j=s,A=j.alternate,U=j.stateNode;if(j=j.tag,A!==null&&A===l)break;j!==5&&j!==26&&j!==27||U===null||(A=U,i?(U=tl(s,o),U!=null&&x.unshift(Ol(s,U,A))):i||(U=tl(s,o),U!=null&&x.push(Ol(s,U,A)))),s=s.return}x.length!==0&&e.push({event:a,listeners:x})}var Ag=/\r\n?/g,Eg=/\u0000|\uFFFD/g;function Af(e){return(typeof e=="string"?e:""+e).replace(Ag,`
49
+ `).replace(Eg,"")}function Ef(e,a){return a=Af(a),Af(e)===a}function Ge(e,a,s,l,i,o){switch(s){case"children":typeof l=="string"?a==="body"||a==="textarea"&&l===""||ln(e,l):(typeof l=="number"||typeof l=="bigint")&&a!=="body"&&ln(e,""+l);break;case"className":fi(e,"class",l);break;case"tabIndex":fi(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":fi(e,s,l);break;case"style":Au(e,l,o);break;case"data":if(a!=="object"){fi(e,"data",l);break}case"src":case"href":if(l===""&&(a!=="a"||s!=="href")){e.removeAttribute(s);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=pi(""+l),e.setAttribute(s,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(s==="formAction"?(a!=="input"&&Ge(e,a,"name",i.name,i,null),Ge(e,a,"formEncType",i.formEncType,i,null),Ge(e,a,"formMethod",i.formMethod,i,null),Ge(e,a,"formTarget",i.formTarget,i,null)):(Ge(e,a,"encType",i.encType,i,null),Ge(e,a,"method",i.method,i,null),Ge(e,a,"target",i.target,i,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=pi(""+l),e.setAttribute(s,l);break;case"onClick":l!=null&&(e.onclick=ka);break;case"onScroll":l!=null&&Ee("scroll",e);break;case"onScrollEnd":l!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(s=l.__html,s!=null){if(i.children!=null)throw Error(c(60));e.innerHTML=s}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}s=pi(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""+l):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":l===!0?e.setAttribute(s,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,l):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(s,l):e.removeAttribute(s);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(s):e.setAttribute(s,l);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),xi(e,"popover",l);break;case"xlinkActuate":Sa(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Sa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Sa(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Sa(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Sa(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Sa(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Sa(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Sa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Sa(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":xi(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=sp.get(s)||s,xi(e,s,l))}}function Qo(e,a,s,l,i,o){switch(s){case"style":Au(e,l,o);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(c(61));if(s=l.__html,s!=null){if(i.children!=null)throw Error(c(60));e.innerHTML=s}}break;case"children":typeof l=="string"?ln(e,l):(typeof l=="number"||typeof l=="bigint")&&ln(e,""+l);break;case"onScroll":l!=null&&Ee("scroll",e);break;case"onScrollEnd":l!=null&&Ee("scrollend",e);break;case"onClick":l!=null&&(e.onclick=ka);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yu.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(i=s.endsWith("Capture"),a=s.slice(2,i?s.length-7:void 0),o=e[Tt]||null,o=o!=null?o[s]:null,typeof o=="function"&&e.removeEventListener(a,o,i),typeof l=="function")){typeof o!="function"&&o!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(a,l,i);break e}s in e?e[s]=l:l===!0?e.setAttribute(s,""):xi(e,s,l)}}}function jt(e,a,s){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var l=!1,i=!1,o;for(o in s)if(s.hasOwnProperty(o)){var x=s[o];if(x!=null)switch(o){case"src":l=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,a));default:Ge(e,a,o,x,s,null)}}i&&Ge(e,a,"srcSet",s.srcSet,s,null),l&&Ge(e,a,"src",s.src,s,null);return;case"input":Ee("invalid",e);var j=o=x=i=null,A=null,U=null;for(l in s)if(s.hasOwnProperty(l)){var V=s[l];if(V!=null)switch(l){case"name":i=V;break;case"type":x=V;break;case"checked":A=V;break;case"defaultChecked":U=V;break;case"value":o=V;break;case"defaultValue":j=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(c(137,a));break;default:Ge(e,a,l,V,s,null)}}Su(e,o,j,A,U,x,i,!1);return;case"select":Ee("invalid",e),l=x=o=null;for(i in s)if(s.hasOwnProperty(i)&&(j=s[i],j!=null))switch(i){case"value":o=j;break;case"defaultValue":x=j;break;case"multiple":l=j;default:Ge(e,a,i,j,s,null)}a=o,s=x,e.multiple=!!l,a!=null?nn(e,!!l,a,!1):s!=null&&nn(e,!!l,s,!0);return;case"textarea":Ee("invalid",e),o=i=l=null;for(x in s)if(s.hasOwnProperty(x)&&(j=s[x],j!=null))switch(x){case"value":l=j;break;case"defaultValue":i=j;break;case"children":o=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(c(91));break;default:Ge(e,a,x,j,s,null)}zu(e,l,i,o);return;case"option":for(A in s)if(s.hasOwnProperty(A)&&(l=s[A],l!=null))switch(A){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Ge(e,a,A,l,s,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(l=0;l<Dl.length;l++)Ee(Dl[l],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(U in s)if(s.hasOwnProperty(U)&&(l=s[U],l!=null))switch(U){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,a));default:Ge(e,a,U,l,s,null)}return;default:if(ic(a)){for(V in s)s.hasOwnProperty(V)&&(l=s[V],l!==void 0&&Qo(e,a,V,l,s,void 0));return}}for(j in s)s.hasOwnProperty(j)&&(l=s[j],l!=null&&Ge(e,a,j,l,s,null))}function Tg(e,a,s,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,o=null,x=null,j=null,A=null,U=null,V=null;for(K in s){var F=s[K];if(s.hasOwnProperty(K)&&F!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":A=F;default:l.hasOwnProperty(K)||Ge(e,a,K,null,l,F)}}for(var H in l){var K=l[H];if(F=s[H],l.hasOwnProperty(H)&&(K!=null||F!=null))switch(H){case"type":o=K;break;case"name":i=K;break;case"checked":U=K;break;case"defaultChecked":V=K;break;case"value":x=K;break;case"defaultValue":j=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(c(137,a));break;default:K!==F&&Ge(e,a,H,K,l,F)}}nc(e,x,j,A,U,V,o,i);return;case"select":K=x=j=H=null;for(o in s)if(A=s[o],s.hasOwnProperty(o)&&A!=null)switch(o){case"value":break;case"multiple":K=A;default:l.hasOwnProperty(o)||Ge(e,a,o,null,l,A)}for(i in l)if(o=l[i],A=s[i],l.hasOwnProperty(i)&&(o!=null||A!=null))switch(i){case"value":H=o;break;case"defaultValue":j=o;break;case"multiple":x=o;default:o!==A&&Ge(e,a,i,o,l,A)}a=j,s=x,l=K,H!=null?nn(e,!!s,H,!1):!!l!=!!s&&(a!=null?nn(e,!!s,a,!0):nn(e,!!s,s?[]:"",!1));return;case"textarea":K=H=null;for(j in s)if(i=s[j],s.hasOwnProperty(j)&&i!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:Ge(e,a,j,null,l,i)}for(x in l)if(i=l[x],o=s[x],l.hasOwnProperty(x)&&(i!=null||o!=null))switch(x){case"value":H=i;break;case"defaultValue":K=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(c(91));break;default:i!==o&&Ge(e,a,x,i,l,o)}ku(e,H,K);return;case"option":for(var ue in s)if(H=s[ue],s.hasOwnProperty(ue)&&H!=null&&!l.hasOwnProperty(ue))switch(ue){case"selected":e.selected=!1;break;default:Ge(e,a,ue,null,l,H)}for(A in l)if(H=l[A],K=s[A],l.hasOwnProperty(A)&&H!==K&&(H!=null||K!=null))switch(A){case"selected":e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:Ge(e,a,A,H,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ge in s)H=s[ge],s.hasOwnProperty(ge)&&H!=null&&!l.hasOwnProperty(ge)&&Ge(e,a,ge,null,l,H);for(U in l)if(H=l[U],K=s[U],l.hasOwnProperty(U)&&H!==K&&(H!=null||K!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(c(137,a));break;default:Ge(e,a,U,H,l,K)}return;default:if(ic(a)){for(var Ke in s)H=s[Ke],s.hasOwnProperty(Ke)&&H!==void 0&&!l.hasOwnProperty(Ke)&&Qo(e,a,Ke,void 0,l,H);for(V in l)H=l[V],K=s[V],!l.hasOwnProperty(V)||H===K||H===void 0&&K===void 0||Qo(e,a,V,H,l,K);return}}for(var L in s)H=s[L],s.hasOwnProperty(L)&&H!=null&&!l.hasOwnProperty(L)&&Ge(e,a,L,null,l,H);for(F in l)H=l[F],K=s[F],!l.hasOwnProperty(F)||H===K||H==null&&K==null||Ge(e,a,F,H,l,K)}function Tf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Rg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,a=0,s=performance.getEntriesByType("resource"),l=0;l<s.length;l++){var i=s[l],o=i.transferSize,x=i.initiatorType,j=i.duration;if(o&&j&&Tf(x)){for(x=0,j=i.responseEnd,l+=1;l<s.length;l++){var A=s[l],U=A.startTime;if(U>j)break;var V=A.transferSize,F=A.initiatorType;V&&Tf(F)&&(A=A.responseEnd,x+=V*(A<j?1:(j-U)/(A-U)))}if(--l,a+=8*(o+x)/(i.duration/1e3),e++,10<e)break}}if(0<e)return a/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Zo=null,Jo=null;function ur(e){return e.nodeType===9?e:e.ownerDocument}function Rf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mf(e,a){if(e===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&a==="foreignObject"?0:e}function Fo(e,a){return e==="textarea"||e==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Io=null;function Mg(){var e=window.event;return e&&e.type==="popstate"?e===Io?!1:(Io=e,!0):(Io=null,!1)}var Df=typeof setTimeout=="function"?setTimeout:void 0,Dg=typeof clearTimeout=="function"?clearTimeout:void 0,Of=typeof Promise=="function"?Promise:void 0,Og=typeof queueMicrotask=="function"?queueMicrotask:typeof Of<"u"?function(e){return Of.resolve(null).then(e).catch(Lg)}:Df;function Lg(e){setTimeout(function(){throw e})}function xs(e){return e==="head"}function Lf(e,a){var s=a,l=0;do{var i=s.nextSibling;if(e.removeChild(s),i&&i.nodeType===8)if(s=i.data,s==="/$"||s==="/&"){if(l===0){e.removeChild(i),Un(a);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")Ll(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Ll(s);for(var o=s.firstChild;o;){var x=o.nextSibling,j=o.nodeName;o[Wn]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&o.rel.toLowerCase()==="stylesheet"||s.removeChild(o),o=x}}else s==="body"&&Ll(e.ownerDocument.body);s=i}while(s);Un(a)}function _f(e,a){var s=e;e=0;do{var l=s.nextSibling;if(s.nodeType===1?a?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(a?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),l&&l.nodeType===8)if(s=l.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=l}while(s)}function Po(e){var a=e.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var s=a;switch(a=a.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Po(s),ac(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function _g(e,a,s,l){for(;e.nodeType===1;){var i=s;if(e.nodeName.toLowerCase()!==a.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Wn])switch(a){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(a==="input"&&e.type==="hidden"){var o=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=la(e.nextSibling),e===null)break}return null}function Ug(e,a,s){if(a==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=la(e.nextSibling),e===null))return null;return e}function Uf(e,a){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=la(e.nextSibling),e===null))return null;return e}function Wo(e){return e.data==="$?"||e.data==="$~"}function ed(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Bg(e,a){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=a;else if(e.data!=="$?"||s.readyState!=="loading")a();else{var l=function(){a(),s.removeEventListener("DOMContentLoaded",l)};s.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function la(e){for(;e!=null;e=e.nextSibling){var a=e.nodeType;if(a===1||a===3)break;if(a===8){if(a=e.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return e}var td=null;function Bf(e){e=e.nextSibling;for(var a=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(a===0)return la(e.nextSibling);a--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||a++}e=e.nextSibling}return null}function $f(e){e=e.previousSibling;for(var a=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(a===0)return e;a--}else s!=="/$"&&s!=="/&"||a++}e=e.previousSibling}return null}function Hf(e,a,s){switch(a=ur(s),e){case"html":if(e=a.documentElement,!e)throw Error(c(452));return e;case"head":if(e=a.head,!e)throw Error(c(453));return e;case"body":if(e=a.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function Ll(e){for(var a=e.attributes;a.length;)e.removeAttributeNode(a[0]);ac(e)}var ia=new Map,qf=new Set;function mr(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qa=ie.d;ie.d={f:$g,r:Hg,D:qg,C:Gg,L:Kg,m:Vg,X:Xg,S:Yg,M:Qg};function $g(){var e=qa.f(),a=sr();return e||a}function Hg(e){var a=tn(e);a!==null&&a.tag===5&&a.type==="form"?sx(a):qa.r(e)}var On=typeof document>"u"?null:document;function Gf(e,a,s){var l=On;if(l&&typeof a=="string"&&a){var i=Pt(a);i='link[rel="'+e+'"][href="'+i+'"]',typeof s=="string"&&(i+='[crossorigin="'+s+'"]'),qf.has(i)||(qf.add(i),e={rel:e,crossOrigin:s,href:a},l.querySelector(i)===null&&(a=l.createElement("link"),jt(a,"link",e),mt(a),l.head.appendChild(a)))}}function qg(e){qa.D(e),Gf("dns-prefetch",e,null)}function Gg(e,a){qa.C(e,a),Gf("preconnect",e,a)}function Kg(e,a,s){qa.L(e,a,s);var l=On;if(l&&e&&a){var i='link[rel="preload"][as="'+Pt(a)+'"]';a==="image"&&s&&s.imageSrcSet?(i+='[imagesrcset="'+Pt(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(i+='[imagesizes="'+Pt(s.imageSizes)+'"]')):i+='[href="'+Pt(e)+'"]';var o=i;switch(a){case"style":o=Ln(e);break;case"script":o=_n(e)}ia.has(o)||(e=v({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:e,as:a},s),ia.set(o,e),l.querySelector(i)!==null||a==="style"&&l.querySelector(_l(o))||a==="script"&&l.querySelector(Ul(o))||(a=l.createElement("link"),jt(a,"link",e),mt(a),l.head.appendChild(a)))}}function Vg(e,a){qa.m(e,a);var s=On;if(s&&e){var l=a&&typeof a.as=="string"?a.as:"script",i='link[rel="modulepreload"][as="'+Pt(l)+'"][href="'+Pt(e)+'"]',o=i;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=_n(e)}if(!ia.has(o)&&(e=v({rel:"modulepreload",href:e},a),ia.set(o,e),s.querySelector(i)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ul(o)))return}l=s.createElement("link"),jt(l,"link",e),mt(l),s.head.appendChild(l)}}}function Yg(e,a,s){qa.S(e,a,s);var l=On;if(l&&e){var i=an(l).hoistableStyles,o=Ln(e);a=a||"default";var x=i.get(o);if(!x){var j={loading:0,preload:null};if(x=l.querySelector(_l(o)))j.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":a},s),(s=ia.get(o))&&ad(e,s);var A=x=l.createElement("link");mt(A),jt(A,"link",e),A._p=new Promise(function(U,V){A.onload=U,A.onerror=V}),A.addEventListener("load",function(){j.loading|=1}),A.addEventListener("error",function(){j.loading|=2}),j.loading|=4,xr(x,a,l)}x={type:"stylesheet",instance:x,count:1,state:j},i.set(o,x)}}}function Xg(e,a){qa.X(e,a);var s=On;if(s&&e){var l=an(s).hoistableScripts,i=_n(e),o=l.get(i);o||(o=s.querySelector(Ul(i)),o||(e=v({src:e,async:!0},a),(a=ia.get(i))&&sd(e,a),o=s.createElement("script"),mt(o),jt(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(i,o))}}function Qg(e,a){qa.M(e,a);var s=On;if(s&&e){var l=an(s).hoistableScripts,i=_n(e),o=l.get(i);o||(o=s.querySelector(Ul(i)),o||(e=v({src:e,async:!0,type:"module"},a),(a=ia.get(i))&&sd(e,a),o=s.createElement("script"),mt(o),jt(o,"link",e),s.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},l.set(i,o))}}function Kf(e,a,s,l){var i=(i=xe.current)?mr(i):null;if(!i)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=Ln(s.href),s=an(i).hoistableStyles,l=s.get(a),l||(l={type:"style",instance:null,count:0,state:null},s.set(a,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Ln(s.href);var o=an(i).hoistableStyles,x=o.get(e);if(x||(i=i.ownerDocument||i,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,x),(o=i.querySelector(_l(e)))&&!o._p&&(x.instance=o,x.state.loading=5),ia.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ia.set(e,s),o||Zg(i,e,s,x.state))),a&&l===null)throw Error(c(528,""));return x}if(a&&l!==null)throw Error(c(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=_n(s),s=an(i).hoistableScripts,l=s.get(a),l||(l={type:"script",instance:null,count:0,state:null},s.set(a,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function Ln(e){return'href="'+Pt(e)+'"'}function _l(e){return'link[rel="stylesheet"]['+e+"]"}function Vf(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Zg(e,a,s,l){e.querySelector('link[rel="preload"][as="style"]['+a+"]")?l.loading=1:(a=e.createElement("link"),l.preload=a,a.addEventListener("load",function(){return l.loading|=1}),a.addEventListener("error",function(){return l.loading|=2}),jt(a,"link",s),mt(a),e.head.appendChild(a))}function _n(e){return'[src="'+Pt(e)+'"]'}function Ul(e){return"script[async]"+e}function Yf(e,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var l=e.querySelector('style[data-href~="'+Pt(s.href)+'"]');if(l)return a.instance=l,mt(l),l;var i=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),mt(l),jt(l,"style",i),xr(l,s.precedence,e),a.instance=l;case"stylesheet":i=Ln(s.href);var o=e.querySelector(_l(i));if(o)return a.state.loading|=4,a.instance=o,mt(o),o;l=Vf(s),(i=ia.get(i))&&ad(l,i),o=(e.ownerDocument||e).createElement("link"),mt(o);var x=o;return x._p=new Promise(function(j,A){x.onload=j,x.onerror=A}),jt(o,"link",l),a.state.loading|=4,xr(o,s.precedence,e),a.instance=o;case"script":return o=_n(s.src),(i=e.querySelector(Ul(o)))?(a.instance=i,mt(i),i):(l=s,(i=ia.get(o))&&(l=v({},s),sd(l,i)),e=e.ownerDocument||e,i=e.createElement("script"),mt(i),jt(i,"link",l),e.head.appendChild(i),a.instance=i);case"void":return null;default:throw Error(c(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(l=a.instance,a.state.loading|=4,xr(l,s.precedence,e));return a.instance}function xr(e,a,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=l.length?l[l.length-1]:null,o=i,x=0;x<l.length;x++){var j=l[x];if(j.dataset.precedence===a)o=j;else if(o!==i)break}o?o.parentNode.insertBefore(e,o.nextSibling):(a=s.nodeType===9?s.head:s,a.insertBefore(e,a.firstChild))}function ad(e,a){e.crossOrigin==null&&(e.crossOrigin=a.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=a.referrerPolicy),e.title==null&&(e.title=a.title)}function sd(e,a){e.crossOrigin==null&&(e.crossOrigin=a.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=a.referrerPolicy),e.integrity==null&&(e.integrity=a.integrity)}var fr=null;function Xf(e,a,s){if(fr===null){var l=new Map,i=fr=new Map;i.set(s,l)}else i=fr,l=i.get(s),l||(l=new Map,i.set(s,l));if(l.has(e))return l;for(l.set(e,null),s=s.getElementsByTagName(e),i=0;i<s.length;i++){var o=s[i];if(!(o[Wn]||o[gt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var x=o.getAttribute(a)||"";x=e+x;var j=l.get(x);j?j.push(o):l.set(x,[o])}}return l}function Qf(e,a,s){e=e.ownerDocument||e,e.head.insertBefore(s,a==="title"?e.querySelector("head > title"):null)}function Jg(e,a,s){if(s===1||a.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return e=a.disabled,typeof a.precedence=="string"&&e==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Zf(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Fg(e,a,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var i=Ln(l.href),o=a.querySelector(_l(i));if(o){a=o._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(e.count++,e=hr.bind(e),a.then(e,e)),s.state.loading|=4,s.instance=o,mt(o);return}o=a.ownerDocument||a,l=Vf(l),(i=ia.get(i))&&ad(l,i),o=o.createElement("link"),mt(o);var x=o;x._p=new Promise(function(j,A){x.onload=j,x.onerror=A}),jt(o,"link",l),s.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=hr.bind(e),a.addEventListener("load",s),a.addEventListener("error",s))}}var nd=0;function Ig(e,a){return e.stylesheets&&e.count===0&&gr(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var l=setTimeout(function(){if(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+a);0<e.imgBytes&&nd===0&&(nd=62500*Rg());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gr(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>nd?50:800)+a);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(i)}}:null}function hr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var pr=null;function gr(e,a){e.stylesheets=null,e.unsuspend!==null&&(e.count++,pr=new Map,a.forEach(Pg,e),pr=null,hr.call(e))}function Pg(e,a){if(!(a.state.loading&4)){var s=pr.get(e);if(s)var l=s.get(null);else{s=new Map,pr.set(e,s);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<i.length;o++){var x=i[o];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(s.set(x.dataset.precedence,x),l=x)}l&&s.set(null,l)}i=a.instance,x=i.getAttribute("data-precedence"),o=s.get(x)||l,o===l&&s.set(null,i),s.set(x,i),this.count++,l=hr.bind(this),i.addEventListener("load",l),i.addEventListener("error",l),o?o.parentNode.insertBefore(i,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),a.state.loading|=4}}var Bl={$$typeof:D,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function Wg(e,a,s,l,i,o,x,j,A){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Pr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pr(0),this.hiddenUpdates=Pr(null),this.identifierPrefix=l,this.onUncaughtError=i,this.onCaughtError=o,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.incompleteTransitions=new Map}function Jf(e,a,s,l,i,o,x,j,A,U,V,F){return e=new Wg(e,a,s,x,A,U,V,F,j),a=1,o===!0&&(a|=24),o=Gt(3,null,null,a),e.current=o,o.stateNode=e,a=_c(),a.refCount++,e.pooledCache=a,a.refCount++,o.memoizedState={element:l,isDehydrated:s,cache:a},Hc(o),e}function Ff(e){return e?(e=xn,e):xn}function If(e,a,s,l,i,o){i=Ff(i),l.context===null?l.context=i:l.pendingContext=i,l=as(a),l.payload={element:s},o=o===void 0?null:o,o!==null&&(l.callback=o),s=ss(e,l,a),s!==null&&(_t(s,e,a),pl(s,e,a))}function Pf(e,a){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<a?s:a}}function ld(e,a){Pf(e,a),(e=e.alternate)&&Pf(e,a)}function Wf(e){if(e.tag===13||e.tag===31){var a=Ds(e,67108864);a!==null&&_t(a,e,67108864),ld(e,67108864)}}function eh(e){if(e.tag===13||e.tag===31){var a=Qt();a=Wr(a);var s=Ds(e,a);s!==null&&_t(s,e,a),ld(e,a)}}var br=!0;function eb(e,a,s,l){var i=G.T;G.T=null;var o=ie.p;try{ie.p=2,id(e,a,s,l)}finally{ie.p=o,G.T=i}}function tb(e,a,s,l){var i=G.T;G.T=null;var o=ie.p;try{ie.p=8,id(e,a,s,l)}finally{ie.p=o,G.T=i}}function id(e,a,s,l){if(br){var i=rd(l);if(i===null)Xo(e,a,l,yr,s),ah(e,l);else if(sb(i,e,a,s,l))l.stopPropagation();else if(ah(e,l),a&4&&-1<ab.indexOf(e)){for(;i!==null;){var o=tn(i);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var x=As(o.pendingLanes);if(x!==0){var j=o;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var A=1<<31-Ht(x);j.entanglements[1]|=A,x&=~A}ba(o),(Be&6)===0&&(tr=ut()+500,Ml(0))}}break;case 31:case 13:j=Ds(o,2),j!==null&&_t(j,o,2),sr(),ld(o,2)}if(o=rd(l),o===null&&Xo(e,a,l,yr,s),o===i)break;i=o}i!==null&&l.stopPropagation()}else Xo(e,a,l,null,s)}}function rd(e){return e=cc(e),cd(e)}var yr=null;function cd(e){if(yr=null,e=en(e),e!==null){var a=f(e);if(a===null)e=null;else{var s=a.tag;if(s===13){if(e=h(a),e!==null)return e;e=null}else if(s===31){if(e=b(a),e!==null)return e;e=null}else if(s===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;e=null}else a!==e&&(e=null)}}return yr=e,null}function th(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ri()){case Jn:return 2;case ci:return 8;case Ps:case G0:return 32;case du:return 268435456;default:return 32}default:return 32}}var od=!1,fs=null,hs=null,ps=null,$l=new Map,Hl=new Map,gs=[],ab="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ah(e,a){switch(e){case"focusin":case"focusout":fs=null;break;case"dragenter":case"dragleave":hs=null;break;case"mouseover":case"mouseout":ps=null;break;case"pointerover":case"pointerout":$l.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hl.delete(a.pointerId)}}function ql(e,a,s,l,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:a,domEventName:s,eventSystemFlags:l,nativeEvent:o,targetContainers:[i]},a!==null&&(a=tn(a),a!==null&&Wf(a)),e):(e.eventSystemFlags|=l,a=e.targetContainers,i!==null&&a.indexOf(i)===-1&&a.push(i),e)}function sb(e,a,s,l,i){switch(a){case"focusin":return fs=ql(fs,e,a,s,l,i),!0;case"dragenter":return hs=ql(hs,e,a,s,l,i),!0;case"mouseover":return ps=ql(ps,e,a,s,l,i),!0;case"pointerover":var o=i.pointerId;return $l.set(o,ql($l.get(o)||null,e,a,s,l,i)),!0;case"gotpointercapture":return o=i.pointerId,Hl.set(o,ql(Hl.get(o)||null,e,a,s,l,i)),!0}return!1}function sh(e){var a=en(e.target);if(a!==null){var s=f(a);if(s!==null){if(a=s.tag,a===13){if(a=h(s),a!==null){e.blockedOn=a,pu(e.priority,function(){eh(s)});return}}else if(a===31){if(a=b(s),a!==null){e.blockedOn=a,pu(e.priority,function(){eh(s)});return}}else if(a===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vr(e){if(e.blockedOn!==null)return!1;for(var a=e.targetContainers;0<a.length;){var s=rd(e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);rc=l,s.target.dispatchEvent(l),rc=null}else return a=tn(s),a!==null&&Wf(a),e.blockedOn=s,!1;a.shift()}return!0}function nh(e,a,s){vr(e)&&s.delete(a)}function nb(){od=!1,fs!==null&&vr(fs)&&(fs=null),hs!==null&&vr(hs)&&(hs=null),ps!==null&&vr(ps)&&(ps=null),$l.forEach(nh),Hl.forEach(nh)}function jr(e,a){e.blockedOn===a&&(e.blockedOn=null,od||(od=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,nb)))}var Nr=null;function lh(e){Nr!==e&&(Nr=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Nr===e&&(Nr=null);for(var a=0;a<e.length;a+=3){var s=e[a],l=e[a+1],i=e[a+2];if(typeof l!="function"){if(cd(l||s)===null)continue;break}var o=tn(s);o!==null&&(e.splice(a,3),a-=3,io(o,{pending:!0,data:i,method:s.method,action:l},l,i))}}))}function Un(e){function a(A){return jr(A,e)}fs!==null&&jr(fs,e),hs!==null&&jr(hs,e),ps!==null&&jr(ps,e),$l.forEach(a),Hl.forEach(a);for(var s=0;s<gs.length;s++){var l=gs[s];l.blockedOn===e&&(l.blockedOn=null)}for(;0<gs.length&&(s=gs[0],s.blockedOn===null);)sh(s),s.blockedOn===null&&gs.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(l=0;l<s.length;l+=3){var i=s[l],o=s[l+1],x=i[Tt]||null;if(typeof o=="function")x||lh(s);else if(x){var j=null;if(o&&o.hasAttribute("formAction")){if(i=o,x=o[Tt]||null)j=x.formAction;else if(cd(i)!==null)continue}else j=x.action;typeof j=="function"?s[l+1]=j:(s.splice(l,3),l-=3),lh(s)}}}function ih(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(x){return i=x})},focusReset:"manual",scroll:"manual"})}function a(){i!==null&&(i(),i=null),l||setTimeout(s,20)}function s(){if(!l&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(s,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),i!==null&&(i(),i=null)}}}function dd(e){this._internalRoot=e}wr.prototype.render=dd.prototype.render=function(e){var a=this._internalRoot;if(a===null)throw Error(c(409));var s=a.current,l=Qt();If(s,l,e,a,null,null)},wr.prototype.unmount=dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var a=e.containerInfo;If(e.current,2,null,e,null,null),sr(),a[Ws]=null}};function wr(e){this._internalRoot=e}wr.prototype.unstable_scheduleHydration=function(e){if(e){var a=hu();e={blockedOn:null,target:e,priority:a};for(var s=0;s<gs.length&&a!==0&&a<gs[s].priority;s++);gs.splice(s,0,e),s===0&&sh(e)}};var rh=r.version;if(rh!=="19.2.4")throw Error(c(527,rh,"19.2.4"));ie.findDOMNode=function(e){var a=e._reactInternals;if(a===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=p(a),e=e!==null?w(e):null,e=e===null?null:e.stateNode,e};var lb={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sr.isDisabled&&Sr.supportsFiber)try{Fn=Sr.inject(lb),$t=Sr}catch{}}return Kl.createRoot=function(e,a){if(!m(e))throw Error(c(299));var s=!1,l="",i=xx,o=fx,x=hx;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(l=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(o=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError)),a=Jf(e,1,!1,null,null,s,l,null,i,o,x,ih),e[Ws]=a.current,Yo(e),new dd(a)},Kl.hydrateRoot=function(e,a,s){if(!m(e))throw Error(c(299));var l=!1,i="",o=xx,x=fx,j=hx,A=null;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(i=s.identifierPrefix),s.onUncaughtError!==void 0&&(o=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(j=s.onRecoverableError),s.formState!==void 0&&(A=s.formState)),a=Jf(e,1,!0,a,s??null,l,i,A,o,x,j,ih),a.context=Ff(null),s=a.current,l=Qt(),l=Wr(l),i=as(l),i.callback=null,ss(s,i,l),s=l,a.current.lanes=s,Pn(a,s),ba(a),e[Ws]=a.current,Yo(e),new wr(a)},Kl.version="19.2.4",Kl}var gh;function gb(){if(gh)return fd.exports;gh=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),fd.exports=pb(),fd.exports}var bb=gb();/**
50
+ * react-router v7.13.2
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var bh="popstate";function yh(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function yb(n={}){function r(c,m){var p;let f=(p=m.state)==null?void 0:p.masked,{pathname:h,search:b,hash:g}=f||c.location;return Ed("",{pathname:h,search:b,hash:g},m.state&&m.state.usr||null,m.state&&m.state.key||"default",f?{pathname:c.location.pathname,search:c.location.search,hash:c.location.hash}:void 0)}function d(c,m){return typeof m=="string"?m:Fl(m)}return jb(r,d,null,n)}function Fe(n,r){if(n===!1||n===null||typeof n>"u")throw new Error(r)}function ca(n,r){if(!n){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function vb(){return Math.random().toString(36).substring(2,10)}function vh(n,r){return{usr:n.state,key:n.key,idx:r,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Ed(n,r,d=null,c,m){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof r=="string"?Gn(r):r,state:d,key:r&&r.key||c||vb(),unstable_mask:m}}function Fl({pathname:n="/",search:r="",hash:d=""}){return r&&r!=="?"&&(n+=r.charAt(0)==="?"?r:"?"+r),d&&d!=="#"&&(n+=d.charAt(0)==="#"?d:"#"+d),n}function Gn(n){let r={};if(n){let d=n.indexOf("#");d>=0&&(r.hash=n.substring(d),n=n.substring(0,d));let c=n.indexOf("?");c>=0&&(r.search=n.substring(c),n=n.substring(0,c)),n&&(r.pathname=n)}return r}function jb(n,r,d,c={}){let{window:m=document.defaultView,v5Compat:f=!1}=c,h=m.history,b="POP",g=null,p=w();p==null&&(p=0,h.replaceState({...h.state,idx:p},""));function w(){return(h.state||{idx:null}).idx}function v(){b="POP";let S=w(),C=S==null?null:S-p;p=S,g&&g({action:b,location:N.location,delta:C})}function y(S,C){b="PUSH";let O=yh(S)?S:Ed(N.location,S,C);p=w()+1;let D=vh(O,p),E=N.createHref(O.unstable_mask||O);try{h.pushState(D,"",E)}catch(ae){if(ae instanceof DOMException&&ae.name==="DataCloneError")throw ae;m.location.assign(E)}f&&g&&g({action:b,location:N.location,delta:1})}function k(S,C){b="REPLACE";let O=yh(S)?S:Ed(N.location,S,C);p=w();let D=vh(O,p),E=N.createHref(O.unstable_mask||O);h.replaceState(D,"",E),f&&g&&g({action:b,location:N.location,delta:0})}function z(S){return Nb(S)}let N={get action(){return b},get location(){return n(m,h)},listen(S){if(g)throw new Error("A history only accepts one active listener");return m.addEventListener(bh,v),g=S,()=>{m.removeEventListener(bh,v),g=null}},createHref(S){return r(m,S)},createURL:z,encodeLocation(S){let C=z(S);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:y,replace:k,go(S){return h.go(S)}};return N}function Nb(n,r=!1){let d="http://localhost";typeof window<"u"&&(d=window.location.origin!=="null"?window.location.origin:window.location.href),Fe(d,"No window.location.(origin|href) available to create URL");let c=typeof n=="string"?n:Fl(n);return c=c.replace(/ $/,"%20"),!r&&c.startsWith("//")&&(c=d+c),new URL(c,d)}function Zh(n,r,d="/"){return wb(n,r,d,!1)}function wb(n,r,d,c){let m=typeof r=="string"?Gn(r):r,f=Va(m.pathname||"/",d);if(f==null)return null;let h=Jh(n);Sb(h);let b=null;for(let g=0;b==null&&g<h.length;++g){let p=Lb(f);b=Db(h[g],p,c)}return b}function Jh(n,r=[],d=[],c="",m=!1){let f=(h,b,g=m,p)=>{let w={relativePath:p===void 0?h.path||"":p,caseSensitive:h.caseSensitive===!0,childrenIndex:b,route:h};if(w.relativePath.startsWith("/")){if(!w.relativePath.startsWith(c)&&g)return;Fe(w.relativePath.startsWith(c),`Absolute route path "${w.relativePath}" nested under path "${c}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),w.relativePath=w.relativePath.slice(c.length)}let v=ya([c,w.relativePath]),y=d.concat(w);h.children&&h.children.length>0&&(Fe(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Jh(h.children,r,y,v,g)),!(h.path==null&&!h.index)&&r.push({path:v,score:Rb(v,h.index),routesMeta:y})};return n.forEach((h,b)=>{var g;if(h.path===""||!((g=h.path)!=null&&g.includes("?")))f(h,b);else for(let p of Fh(h.path))f(h,b,!0,p)}),r}function Fh(n){let r=n.split("/");if(r.length===0)return[];let[d,...c]=r,m=d.endsWith("?"),f=d.replace(/\?$/,"");if(c.length===0)return m?[f,""]:[f];let h=Fh(c.join("/")),b=[];return b.push(...h.map(g=>g===""?f:[f,g].join("/"))),m&&b.push(...h),b.map(g=>n.startsWith("/")&&g===""?"/":g)}function Sb(n){n.sort((r,d)=>r.score!==d.score?d.score-r.score:Mb(r.routesMeta.map(c=>c.childrenIndex),d.routesMeta.map(c=>c.childrenIndex)))}var kb=/^:[\w-]+$/,zb=3,Cb=2,Ab=1,Eb=10,Tb=-2,jh=n=>n==="*";function Rb(n,r){let d=n.split("/"),c=d.length;return d.some(jh)&&(c+=Tb),r&&(c+=Cb),d.filter(m=>!jh(m)).reduce((m,f)=>m+(kb.test(f)?zb:f===""?Ab:Eb),c)}function Mb(n,r){return n.length===r.length&&n.slice(0,-1).every((c,m)=>c===r[m])?n[n.length-1]-r[r.length-1]:0}function Db(n,r,d=!1){let{routesMeta:c}=n,m={},f="/",h=[];for(let b=0;b<c.length;++b){let g=c[b],p=b===c.length-1,w=f==="/"?r:r.slice(f.length)||"/",v=Br({path:g.relativePath,caseSensitive:g.caseSensitive,end:p},w),y=g.route;if(!v&&p&&d&&!c[c.length-1].route.index&&(v=Br({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},w)),!v)return null;Object.assign(m,v.params),h.push({params:m,pathname:ya([f,v.pathname]),pathnameBase:$b(ya([f,v.pathnameBase])),route:y}),v.pathnameBase!=="/"&&(f=ya([f,v.pathnameBase]))}return h}function Br(n,r){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[d,c]=Ob(n.path,n.caseSensitive,n.end),m=r.match(d);if(!m)return null;let f=m[0],h=f.replace(/(.)\/+$/,"$1"),b=m.slice(1);return{params:c.reduce((p,{paramName:w,isOptional:v},y)=>{if(w==="*"){let z=b[y]||"";h=f.slice(0,f.length-z.length).replace(/(.)\/+$/,"$1")}const k=b[y];return v&&!k?p[w]=void 0:p[w]=(k||"").replace(/%2F/g,"/"),p},{}),pathname:f,pathnameBase:h,pattern:n}}function Ob(n,r=!1,d=!0){ca(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let c=[],m="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,b,g,p,w)=>{if(c.push({paramName:b,isOptional:g!=null}),g){let v=w.charAt(p+h.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(c.push({paramName:"*"}),m+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):d?m+="\\/*$":n!==""&&n!=="/"&&(m+="(?:(?=\\/|$))"),[new RegExp(m,r?void 0:"i"),c]}function Lb(n){try{return n.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return ca(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),n}}function Va(n,r){if(r==="/")return n;if(!n.toLowerCase().startsWith(r.toLowerCase()))return null;let d=r.endsWith("/")?r.length-1:r.length,c=n.charAt(d);return c&&c!=="/"?null:n.slice(d)||"/"}var _b=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ub(n,r="/"){let{pathname:d,search:c="",hash:m=""}=typeof n=="string"?Gn(n):n,f;return d?(d=d.replace(/\/\/+/g,"/"),d.startsWith("/")?f=Nh(d.substring(1),"/"):f=Nh(d,r)):f=r,{pathname:f,search:Hb(c),hash:qb(m)}}function Nh(n,r){let d=r.replace(/\/+$/,"").split("/");return n.split("/").forEach(m=>{m===".."?d.length>1&&d.pop():m!=="."&&d.push(m)}),d.length>1?d.join("/"):"/"}function bd(n,r,d,c){return`Cannot include a '${n}' character in a manually specified \`to.${r}\` field [${JSON.stringify(c)}]. Please separate it out to the \`to.${d}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Bb(n){return n.filter((r,d)=>d===0||r.route.path&&r.route.path.length>0)}function Hd(n){let r=Bb(n);return r.map((d,c)=>c===r.length-1?d.pathname:d.pathnameBase)}function qr(n,r,d,c=!1){let m;typeof n=="string"?m=Gn(n):(m={...n},Fe(!m.pathname||!m.pathname.includes("?"),bd("?","pathname","search",m)),Fe(!m.pathname||!m.pathname.includes("#"),bd("#","pathname","hash",m)),Fe(!m.search||!m.search.includes("#"),bd("#","search","hash",m)));let f=n===""||m.pathname==="",h=f?"/":m.pathname,b;if(h==null)b=d;else{let v=r.length-1;if(!c&&h.startsWith("..")){let y=h.split("/");for(;y[0]==="..";)y.shift(),v-=1;m.pathname=y.join("/")}b=v>=0?r[v]:"/"}let g=Ub(m,b),p=h&&h!=="/"&&h.endsWith("/"),w=(f||h===".")&&d.endsWith("/");return!g.pathname.endsWith("/")&&(p||w)&&(g.pathname+="/"),g}var ya=n=>n.join("/").replace(/\/\/+/g,"/"),$b=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),Hb=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,qb=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,Gb=class{constructor(n,r,d,c=!1){this.status=n,this.statusText=r||"",this.internal=c,d instanceof Error?(this.data=d.toString(),this.error=d):this.data=d}};function Kb(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function Vb(n){return n.map(r=>r.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ih=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ph(n,r){let d=n;if(typeof d!="string"||!_b.test(d))return{absoluteURL:void 0,isExternal:!1,to:d};let c=d,m=!1;if(Ih)try{let f=new URL(window.location.href),h=d.startsWith("//")?new URL(f.protocol+d):new URL(d),b=Va(h.pathname,r);h.origin===f.origin&&b!=null?d=b+h.search+h.hash:m=!0}catch{ca(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:c,isExternal:m,to:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Wh=["POST","PUT","PATCH","DELETE"];new Set(Wh);var Yb=["GET",...Wh];new Set(Yb);var Kn=u.createContext(null);Kn.displayName="DataRouter";var Gr=u.createContext(null);Gr.displayName="DataRouterState";var Xb=u.createContext(!1),e0=u.createContext({isTransitioning:!1});e0.displayName="ViewTransition";var Qb=u.createContext(new Map);Qb.displayName="Fetchers";var Zb=u.createContext(null);Zb.displayName="Await";var Jt=u.createContext(null);Jt.displayName="Navigation";var ai=u.createContext(null);ai.displayName="Location";var oa=u.createContext({outlet:null,matches:[],isDataRoute:!1});oa.displayName="Route";var qd=u.createContext(null);qd.displayName="RouteError";var t0="REACT_ROUTER_ERROR",Jb="REDIRECT",Fb="ROUTE_ERROR_RESPONSE";function Ib(n){if(n.startsWith(`${t0}:${Jb}:{`))try{let r=JSON.parse(n.slice(28));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.location=="string"&&typeof r.reloadDocument=="boolean"&&typeof r.replace=="boolean")return r}catch{}}function Pb(n){if(n.startsWith(`${t0}:${Fb}:{`))try{let r=JSON.parse(n.slice(40));if(typeof r=="object"&&r&&typeof r.status=="number"&&typeof r.statusText=="string")return new Gb(r.status,r.statusText,r.data)}catch{}}function Wb(n,{relative:r}={}){Fe(Vn(),"useHref() may be used only in the context of a <Router> component.");let{basename:d,navigator:c}=u.useContext(Jt),{hash:m,pathname:f,search:h}=si(n,{relative:r}),b=f;return d!=="/"&&(b=f==="/"?d:ya([d,f])),c.createHref({pathname:b,search:h,hash:m})}function Vn(){return u.useContext(ai)!=null}function fa(){return Fe(Vn(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(ai).location}var a0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function s0(n){u.useContext(Jt).static||u.useLayoutEffect(n)}function Et(){let{isDataRoute:n}=u.useContext(oa);return n?fy():ey()}function ey(){Fe(Vn(),"useNavigate() may be used only in the context of a <Router> component.");let n=u.useContext(Kn),{basename:r,navigator:d}=u.useContext(Jt),{matches:c}=u.useContext(oa),{pathname:m}=fa(),f=JSON.stringify(Hd(c)),h=u.useRef(!1);return s0(()=>{h.current=!0}),u.useCallback((g,p={})=>{if(ca(h.current,a0),!h.current)return;if(typeof g=="number"){d.go(g);return}let w=qr(g,JSON.parse(f),m,p.relative==="path");n==null&&r!=="/"&&(w.pathname=w.pathname==="/"?r:ya([r,w.pathname])),(p.replace?d.replace:d.push)(w,p.state,p)},[r,d,f,m,n])}var ty=u.createContext(null);function ay(n){let r=u.useContext(oa).outlet;return u.useMemo(()=>r&&u.createElement(ty.Provider,{value:n},r),[r,n])}function Yn(){let{matches:n}=u.useContext(oa),r=n[n.length-1];return r?r.params:{}}function si(n,{relative:r}={}){let{matches:d}=u.useContext(oa),{pathname:c}=fa(),m=JSON.stringify(Hd(d));return u.useMemo(()=>qr(n,JSON.parse(m),c,r==="path"),[n,m,c,r])}function sy(n,r){return n0(n,r)}function n0(n,r,d){var S;Fe(Vn(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=u.useContext(Jt),{matches:m}=u.useContext(oa),f=m[m.length-1],h=f?f.params:{},b=f?f.pathname:"/",g=f?f.pathnameBase:"/",p=f&&f.route;{let C=p&&p.path||"";i0(b,!p||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${b}" (under <Route path="${C}">) 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.
59
+
60
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let w=fa(),v;if(r){let C=typeof r=="string"?Gn(r):r;Fe(g==="/"||((S=C.pathname)==null?void 0:S.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 "${C.pathname}" was given in the \`location\` prop.`),v=C}else v=w;let y=v.pathname||"/",k=y;if(g!=="/"){let C=g.replace(/^\//,"").split("/");k="/"+y.replace(/^\//,"").split("/").slice(C.length).join("/")}let z=Zh(n,{pathname:k});ca(p||z!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),ca(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.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 N=cy(z&&z.map(C=>Object.assign({},C,{params:Object.assign({},h,C.params),pathname:ya([g,c.encodeLocation?c.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?g:ya([g,c.encodeLocation?c.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),m,d);return r&&N?u.createElement(ai.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...v},navigationType:"POP"}},N):N}function ny(){let n=xy(),r=Kb(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),d=n instanceof Error?n.stack:null,c="rgba(200,200,200, 0.5)",m={padding:"0.5rem",backgroundColor:c},f={padding:"2px 4px",backgroundColor:c},h=null;return console.error("Error handled by React Router default ErrorBoundary:",n),h=u.createElement(u.Fragment,null,u.createElement("p",null,"💿 Hey developer 👋"),u.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",u.createElement("code",{style:f},"ErrorBoundary")," or"," ",u.createElement("code",{style:f},"errorElement")," prop on your route.")),u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},r),d?u.createElement("pre",{style:m},d):null,h)}var ly=u.createElement(ny,null),l0=class extends u.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){return r.location!==n.location||r.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:r.error,location:r.location,revalidation:n.revalidation||r.revalidation}}componentDidCatch(n,r){this.props.onError?this.props.onError(n,r):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const d=Pb(n.digest);d&&(n=d)}let r=n!==void 0?u.createElement(oa.Provider,{value:this.props.routeContext},u.createElement(qd.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?u.createElement(iy,{error:n},r):r}};l0.contextType=Xb;var yd=new WeakMap;function iy({children:n,error:r}){let{basename:d}=u.useContext(Jt);if(typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){let c=Ib(r.digest);if(c){let m=yd.get(r);if(m)throw m;let f=Ph(c.location,d);if(Ih&&!yd.get(r))if(f.isExternal||c.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const h=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:c.replace}));throw yd.set(r,h),h}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function ry({routeContext:n,match:r,children:d}){let c=u.useContext(Kn);return c&&c.static&&c.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(c.staticContext._deepestRenderedBoundaryId=r.route.id),u.createElement(oa.Provider,{value:n},d)}function cy(n,r=[],d){let c=d==null?void 0:d.state;if(n==null){if(!c)return null;if(c.errors)n=c.matches;else if(r.length===0&&!c.initialized&&c.matches.length>0)n=c.matches;else return null}let m=n,f=c==null?void 0:c.errors;if(f!=null){let w=m.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Fe(w>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),m=m.slice(0,Math.min(m.length,w+1))}let h=!1,b=-1;if(d&&c){h=c.renderFallback;for(let w=0;w<m.length;w++){let v=m[w];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(b=w),v.route.id){let{loaderData:y,errors:k}=c,z=v.route.loader&&!y.hasOwnProperty(v.route.id)&&(!k||k[v.route.id]===void 0);if(v.route.lazy||z){d.isStatic&&(h=!0),b>=0?m=m.slice(0,b+1):m=[m[0]];break}}}}let g=d==null?void 0:d.onError,p=c&&g?(w,v)=>{var y,k;g(w,{location:c.location,params:((k=(y=c.matches)==null?void 0:y[0])==null?void 0:k.params)??{},unstable_pattern:Vb(c.matches),errorInfo:v})}:void 0;return m.reduceRight((w,v,y)=>{let k,z=!1,N=null,S=null;c&&(k=f&&v.route.id?f[v.route.id]:void 0,N=v.route.errorElement||ly,h&&(b<0&&y===0?(i0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),z=!0,S=null):b===y&&(z=!0,S=v.route.hydrateFallbackElement||null)));let C=r.concat(m.slice(0,y+1)),O=()=>{let D;return k?D=N:z?D=S:v.route.Component?D=u.createElement(v.route.Component,null):v.route.element?D=v.route.element:D=w,u.createElement(ry,{match:v,routeContext:{outlet:w,matches:C,isDataRoute:c!=null},children:D})};return c&&(v.route.ErrorBoundary||v.route.errorElement||y===0)?u.createElement(l0,{location:c.location,revalidation:c.revalidation,component:N,error:k,children:O(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:p}):O()},null)}function Gd(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oy(n){let r=u.useContext(Kn);return Fe(r,Gd(n)),r}function dy(n){let r=u.useContext(Gr);return Fe(r,Gd(n)),r}function uy(n){let r=u.useContext(oa);return Fe(r,Gd(n)),r}function Kd(n){let r=uy(n),d=r.matches[r.matches.length-1];return Fe(d.route.id,`${n} can only be used on routes that contain a unique "id"`),d.route.id}function my(){return Kd("useRouteId")}function xy(){var c;let n=u.useContext(qd),r=dy("useRouteError"),d=Kd("useRouteError");return n!==void 0?n:(c=r.errors)==null?void 0:c[d]}function fy(){let{router:n}=oy("useNavigate"),r=Kd("useNavigate"),d=u.useRef(!1);return s0(()=>{d.current=!0}),u.useCallback(async(m,f={})=>{ca(d.current,a0),d.current&&(typeof m=="number"?await n.navigate(m):await n.navigate(m,{fromRouteId:r,...f}))},[n,r])}var wh={};function i0(n,r,d){!r&&!wh[n]&&(wh[n]=!0,ca(!1,d))}u.memo(hy);function hy({routes:n,future:r,state:d,isStatic:c,onError:m}){return n0(n,void 0,{state:d,isStatic:c,onError:m})}function Sh({to:n,replace:r,state:d,relative:c}){Fe(Vn(),"<Navigate> may be used only in the context of a <Router> component.");let{static:m}=u.useContext(Jt);ca(!m,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:f}=u.useContext(oa),{pathname:h}=fa(),b=Et(),g=qr(n,Hd(f),h,c==="path"),p=JSON.stringify(g);return u.useEffect(()=>{b(JSON.parse(p),{replace:r,state:d,relative:c})},[b,p,c,r,d]),null}function py(n){return ay(n.context)}function Oe(n){Fe(!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 gy({basename:n="/",children:r=null,location:d,navigationType:c="POP",navigator:m,static:f=!1,unstable_useTransitions:h}){Fe(!Vn(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let b=n.replace(/^\/*/,"/"),g=u.useMemo(()=>({basename:b,navigator:m,static:f,unstable_useTransitions:h,future:{}}),[b,m,f,h]);typeof d=="string"&&(d=Gn(d));let{pathname:p="/",search:w="",hash:v="",state:y=null,key:k="default",unstable_mask:z}=d,N=u.useMemo(()=>{let S=Va(p,b);return S==null?null:{location:{pathname:S,search:w,hash:v,state:y,key:k,unstable_mask:z},navigationType:c}},[b,p,w,v,y,k,c,z]);return ca(N!=null,`<Router basename="${b}"> is not able to match the URL "${p}${w}${v}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:u.createElement(Jt.Provider,{value:g},u.createElement(ai.Provider,{children:r,value:N}))}function r0({children:n,location:r}){return sy(Td(n),r)}function Td(n,r=[]){let d=[];return u.Children.forEach(n,(c,m)=>{if(!u.isValidElement(c))return;let f=[...r,m];if(c.type===u.Fragment){d.push.apply(d,Td(c.props.children,f));return}Fe(c.type===Oe,`[${typeof c.type=="string"?c.type:c.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Fe(!c.props.index||!c.props.children,"An index route cannot have child routes.");let h={id:c.props.id||f.join("-"),caseSensitive:c.props.caseSensitive,element:c.props.element,Component:c.props.Component,index:c.props.index,path:c.props.path,middleware:c.props.middleware,loader:c.props.loader,action:c.props.action,hydrateFallbackElement:c.props.hydrateFallbackElement,HydrateFallback:c.props.HydrateFallback,errorElement:c.props.errorElement,ErrorBoundary:c.props.ErrorBoundary,hasErrorBoundary:c.props.hasErrorBoundary===!0||c.props.ErrorBoundary!=null||c.props.errorElement!=null,shouldRevalidate:c.props.shouldRevalidate,handle:c.props.handle,lazy:c.props.lazy};c.props.children&&(h.children=Td(c.props.children,f)),d.push(h)}),d}var Lr="get",_r="application/x-www-form-urlencoded";function Kr(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function by(n){return Kr(n)&&n.tagName.toLowerCase()==="button"}function yy(n){return Kr(n)&&n.tagName.toLowerCase()==="form"}function vy(n){return Kr(n)&&n.tagName.toLowerCase()==="input"}function jy(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Ny(n,r){return n.button===0&&(!r||r==="_self")&&!jy(n)}function Rd(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((r,d)=>{let c=n[d];return r.concat(Array.isArray(c)?c.map(m=>[d,m]):[[d,c]])},[]))}function wy(n,r){let d=Rd(n);return r&&r.forEach((c,m)=>{d.has(m)||r.getAll(m).forEach(f=>{d.append(m,f)})}),d}var kr=null;function Sy(){if(kr===null)try{new FormData(document.createElement("form"),0),kr=!1}catch{kr=!0}return kr}var ky=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vd(n){return n!=null&&!ky.has(n)?(ca(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_r}"`),null):n}function zy(n,r){let d,c,m,f,h;if(yy(n)){let b=n.getAttribute("action");c=b?Va(b,r):null,d=n.getAttribute("method")||Lr,m=vd(n.getAttribute("enctype"))||_r,f=new FormData(n)}else if(by(n)||vy(n)&&(n.type==="submit"||n.type==="image")){let b=n.form;if(b==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=n.getAttribute("formaction")||b.getAttribute("action");if(c=g?Va(g,r):null,d=n.getAttribute("formmethod")||b.getAttribute("method")||Lr,m=vd(n.getAttribute("formenctype"))||vd(b.getAttribute("enctype"))||_r,f=new FormData(b,n),!Sy()){let{name:p,type:w,value:v}=n;if(w==="image"){let y=p?`${p}.`:"";f.append(`${y}x`,"0"),f.append(`${y}y`,"0")}else p&&f.append(p,v)}}else{if(Kr(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');d=Lr,c=null,m=_r,h=n}return f&&m==="text/plain"&&(h=f,f=void 0),{action:c,method:d.toLowerCase(),encType:m,formData:f,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vd(n,r){if(n===!1||n===null||typeof n>"u")throw new Error(r)}function Cy(n,r,d,c){let m=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return d?m.pathname.endsWith("/")?m.pathname=`${m.pathname}_.${c}`:m.pathname=`${m.pathname}.${c}`:m.pathname==="/"?m.pathname=`_root.${c}`:r&&Va(m.pathname,r)==="/"?m.pathname=`${r.replace(/\/$/,"")}/_root.${c}`:m.pathname=`${m.pathname.replace(/\/$/,"")}.${c}`,m}async function Ay(n,r){if(n.id in r)return r[n.id];try{let d=await import(n.module);return r[n.id]=d,d}catch(d){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(d),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ey(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Ty(n,r,d){let c=await Promise.all(n.map(async m=>{let f=r.routes[m.route.id];if(f){let h=await Ay(f,d);return h.links?h.links():[]}return[]}));return Oy(c.flat(1).filter(Ey).filter(m=>m.rel==="stylesheet"||m.rel==="preload").map(m=>m.rel==="stylesheet"?{...m,rel:"prefetch",as:"style"}:{...m,rel:"prefetch"}))}function kh(n,r,d,c,m,f){let h=(g,p)=>d[p]?g.route.id!==d[p].route.id:!0,b=(g,p)=>{var w;return d[p].pathname!==g.pathname||((w=d[p].route.path)==null?void 0:w.endsWith("*"))&&d[p].params["*"]!==g.params["*"]};return f==="assets"?r.filter((g,p)=>h(g,p)||b(g,p)):f==="data"?r.filter((g,p)=>{var v;let w=c.routes[g.route.id];if(!w||!w.hasLoader)return!1;if(h(g,p)||b(g,p))return!0;if(g.route.shouldRevalidate){let y=g.route.shouldRevalidate({currentUrl:new URL(m.pathname+m.search+m.hash,window.origin),currentParams:((v=d[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function Ry(n,r,{includeHydrateFallback:d}={}){return My(n.map(c=>{let m=r.routes[c.route.id];if(!m)return[];let f=[m.module];return m.clientActionModule&&(f=f.concat(m.clientActionModule)),m.clientLoaderModule&&(f=f.concat(m.clientLoaderModule)),d&&m.hydrateFallbackModule&&(f=f.concat(m.hydrateFallbackModule)),m.imports&&(f=f.concat(m.imports)),f}).flat(1))}function My(n){return[...new Set(n)]}function Dy(n){let r={},d=Object.keys(n).sort();for(let c of d)r[c]=n[c];return r}function Oy(n,r){let d=new Set;return new Set(r),n.reduce((c,m)=>{let f=JSON.stringify(Dy(m));return d.has(f)||(d.add(f),c.push({key:f,link:m})),c},[])}function c0(){let n=u.useContext(Kn);return Vd(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function Ly(){let n=u.useContext(Gr);return Vd(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var Yd=u.createContext(void 0);Yd.displayName="FrameworkContext";function o0(){let n=u.useContext(Yd);return Vd(n,"You must render this element inside a <HydratedRouter> element"),n}function _y(n,r){let d=u.useContext(Yd),[c,m]=u.useState(!1),[f,h]=u.useState(!1),{onFocus:b,onBlur:g,onMouseEnter:p,onMouseLeave:w,onTouchStart:v}=r,y=u.useRef(null);u.useEffect(()=>{if(n==="render"&&h(!0),n==="viewport"){let N=C=>{C.forEach(O=>{h(O.isIntersecting)})},S=new IntersectionObserver(N,{threshold:.5});return y.current&&S.observe(y.current),()=>{S.disconnect()}}},[n]),u.useEffect(()=>{if(c){let N=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(N)}}},[c]);let k=()=>{m(!0)},z=()=>{m(!1),h(!1)};return d?n!=="intent"?[f,y,{}]:[f,y,{onFocus:Vl(b,k),onBlur:Vl(g,z),onMouseEnter:Vl(p,k),onMouseLeave:Vl(w,z),onTouchStart:Vl(v,k)}]:[!1,y,{}]}function Vl(n,r){return d=>{n&&n(d),d.defaultPrevented||r(d)}}function Uy({page:n,...r}){let{router:d}=c0(),c=u.useMemo(()=>Zh(d.routes,n,d.basename),[d.routes,n,d.basename]);return c?u.createElement($y,{page:n,matches:c,...r}):null}function By(n){let{manifest:r,routeModules:d}=o0(),[c,m]=u.useState([]);return u.useEffect(()=>{let f=!1;return Ty(n,r,d).then(h=>{f||m(h)}),()=>{f=!0}},[n,r,d]),c}function $y({page:n,matches:r,...d}){let c=fa(),{future:m,manifest:f,routeModules:h}=o0(),{basename:b}=c0(),{loaderData:g,matches:p}=Ly(),w=u.useMemo(()=>kh(n,r,p,f,c,"data"),[n,r,p,f,c]),v=u.useMemo(()=>kh(n,r,p,f,c,"assets"),[n,r,p,f,c]),y=u.useMemo(()=>{if(n===c.pathname+c.search+c.hash)return[];let N=new Set,S=!1;if(r.forEach(O=>{var E;let D=f.routes[O.route.id];!D||!D.hasLoader||(!w.some(ae=>ae.route.id===O.route.id)&&O.route.id in g&&((E=h[O.route.id])!=null&&E.shouldRevalidate)||D.hasClientLoader?S=!0:N.add(O.route.id))}),N.size===0)return[];let C=Cy(n,b,m.unstable_trailingSlashAwareDataRequests,"data");return S&&N.size>0&&C.searchParams.set("_routes",r.filter(O=>N.has(O.route.id)).map(O=>O.route.id).join(",")),[C.pathname+C.search]},[b,m.unstable_trailingSlashAwareDataRequests,g,c,f,w,r,n,h]),k=u.useMemo(()=>Ry(v,f),[v,f]),z=By(v);return u.createElement(u.Fragment,null,y.map(N=>u.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...d})),k.map(N=>u.createElement("link",{key:N,rel:"modulepreload",href:N,...d})),z.map(({key:N,link:S})=>u.createElement("link",{key:N,nonce:d.nonce,...S,crossOrigin:S.crossOrigin??d.crossOrigin})))}function Hy(...n){return r=>{n.forEach(d=>{typeof d=="function"?d(r):d!=null&&(d.current=r)})}}var qy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{qy&&(window.__reactRouterVersion="7.13.2")}catch{}function Gy({basename:n,children:r,unstable_useTransitions:d,window:c}){let m=u.useRef();m.current==null&&(m.current=yb({window:c,v5Compat:!0}));let f=m.current,[h,b]=u.useState({action:f.action,location:f.location}),g=u.useCallback(p=>{d===!1?b(p):u.startTransition(()=>b(p))},[d]);return u.useLayoutEffect(()=>f.listen(g),[f,g]),u.createElement(gy,{basename:n,children:r,location:h.location,navigationType:h.action,navigator:f,unstable_useTransitions:d})}var d0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ga=u.forwardRef(function({onClick:r,discover:d="render",prefetch:c="none",relative:m,reloadDocument:f,replace:h,unstable_mask:b,state:g,target:p,to:w,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:k,...z},N){let{basename:S,navigator:C,unstable_useTransitions:O}=u.useContext(Jt),D=typeof w=="string"&&d0.test(w),E=Ph(w,S);w=E.to;let ae=Wb(w,{relative:m}),oe=fa(),B=null;if(b){let he=qr(b,[],oe.unstable_mask?oe.unstable_mask.pathname:"/",!0);S!=="/"&&(he.pathname=he.pathname==="/"?S:ya([S,he.pathname])),B=C.createHref(he)}let[q,I,W]=_y(c,z),Y=Yy(w,{replace:h,unstable_mask:b,state:g,target:p,preventScrollReset:v,relative:m,viewTransition:y,unstable_defaultShouldRevalidate:k,unstable_useTransitions:O});function le(he){r&&r(he),he.defaultPrevented||Y(he)}let J=!(E.isExternal||f),ce=u.createElement("a",{...z,...W,href:(J?B:void 0)||E.absoluteURL||ae,onClick:J?le:r,ref:Hy(N,I),target:p,"data-discover":!D&&d==="render"?"true":void 0});return q&&!D?u.createElement(u.Fragment,null,ce,u.createElement(Uy,{page:ae})):ce});Ga.displayName="Link";var Zl=u.forwardRef(function({"aria-current":r="page",caseSensitive:d=!1,className:c="",end:m=!1,style:f,to:h,viewTransition:b,children:g,...p},w){let v=si(h,{relative:p.relative}),y=fa(),k=u.useContext(Gr),{navigator:z,basename:N}=u.useContext(Jt),S=k!=null&&Iy(v)&&b===!0,C=z.encodeLocation?z.encodeLocation(v).pathname:v.pathname,O=y.pathname,D=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;d||(O=O.toLowerCase(),D=D?D.toLowerCase():null,C=C.toLowerCase()),D&&N&&(D=Va(D,N)||D);const E=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let ae=O===C||!m&&O.startsWith(C)&&O.charAt(E)==="/",oe=D!=null&&(D===C||!m&&D.startsWith(C)&&D.charAt(C.length)==="/"),B={isActive:ae,isPending:oe,isTransitioning:S},q=ae?r:void 0,I;typeof c=="function"?I=c(B):I=[c,ae?"active":null,oe?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let W=typeof f=="function"?f(B):f;return u.createElement(Ga,{...p,"aria-current":q,className:I,ref:w,style:W,to:h,viewTransition:b},typeof g=="function"?g(B):g)});Zl.displayName="NavLink";var Ky=u.forwardRef(({discover:n="render",fetcherKey:r,navigate:d,reloadDocument:c,replace:m,state:f,method:h=Lr,action:b,onSubmit:g,relative:p,preventScrollReset:w,viewTransition:v,unstable_defaultShouldRevalidate:y,...k},z)=>{let{unstable_useTransitions:N}=u.useContext(Jt),S=Jy(),C=Fy(b,{relative:p}),O=h.toLowerCase()==="get"?"get":"post",D=typeof b=="string"&&d0.test(b),E=ae=>{if(g&&g(ae),ae.defaultPrevented)return;ae.preventDefault();let oe=ae.nativeEvent.submitter,B=(oe==null?void 0:oe.getAttribute("formmethod"))||h,q=()=>S(oe||ae.currentTarget,{fetcherKey:r,method:B,navigate:d,replace:m,state:f,relative:p,preventScrollReset:w,viewTransition:v,unstable_defaultShouldRevalidate:y});N&&d!==!1?u.startTransition(()=>q()):q()};return u.createElement("form",{ref:z,method:O,action:C,onSubmit:c?g:E,...k,"data-discover":!D&&n==="render"?"true":void 0})});Ky.displayName="Form";function Vy(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function u0(n){let r=u.useContext(Kn);return Fe(r,Vy(n)),r}function Yy(n,{target:r,replace:d,unstable_mask:c,state:m,preventScrollReset:f,relative:h,viewTransition:b,unstable_defaultShouldRevalidate:g,unstable_useTransitions:p}={}){let w=Et(),v=fa(),y=si(n,{relative:h});return u.useCallback(k=>{if(Ny(k,r)){k.preventDefault();let z=d!==void 0?d:Fl(v)===Fl(y),N=()=>w(n,{replace:z,unstable_mask:c,state:m,preventScrollReset:f,relative:h,viewTransition:b,unstable_defaultShouldRevalidate:g});p?u.startTransition(()=>N()):N()}},[v,w,y,d,c,m,r,n,f,h,b,g,p])}function Xy(n){ca(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let r=u.useRef(Rd(n)),d=u.useRef(!1),c=fa(),m=u.useMemo(()=>wy(c.search,d.current?null:r.current),[c.search]),f=Et(),h=u.useCallback((b,g)=>{const p=Rd(typeof b=="function"?b(new URLSearchParams(m)):b);d.current=!0,f("?"+p,g)},[f,m]);return[m,h]}var Qy=0,Zy=()=>`__${String(++Qy)}__`;function Jy(){let{router:n}=u0("useSubmit"),{basename:r}=u.useContext(Jt),d=my(),c=n.fetch,m=n.navigate;return u.useCallback(async(f,h={})=>{let{action:b,method:g,encType:p,formData:w,body:v}=zy(f,r);if(h.navigate===!1){let y=h.fetcherKey||Zy();await c(y,d,h.action||b,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:w,body:v,formMethod:h.method||g,formEncType:h.encType||p,flushSync:h.flushSync})}else await m(h.action||b,{unstable_defaultShouldRevalidate:h.unstable_defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:w,body:v,formMethod:h.method||g,formEncType:h.encType||p,replace:h.replace,state:h.state,fromRouteId:d,flushSync:h.flushSync,viewTransition:h.viewTransition})},[c,m,r,d])}function Fy(n,{relative:r}={}){let{basename:d}=u.useContext(Jt),c=u.useContext(oa);Fe(c,"useFormAction must be used inside a RouteContext");let[m]=c.matches.slice(-1),f={...si(n||".",{relative:r})},h=fa();if(n==null){f.search=h.search;let b=new URLSearchParams(f.search),g=b.getAll("index");if(g.some(w=>w==="")){b.delete("index"),g.filter(v=>v).forEach(v=>b.append("index",v));let w=b.toString();f.search=w?`?${w}`:""}}return(!n||n===".")&&m.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),d!=="/"&&(f.pathname=f.pathname==="/"?d:ya([d,f.pathname])),Fl(f)}function Iy(n,{relative:r}={}){let d=u.useContext(e0);Fe(d!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:c}=u0("useViewTransitionState"),m=si(n,{relative:r});if(!d.isTransitioning)return!1;let f=Va(d.currentLocation.pathname,c)||d.currentLocation.pathname,h=Va(d.nextLocation.pathname,c)||d.nextLocation.pathname;return Br(m.pathname,h)!=null||Br(m.pathname,f)!=null}/**
61
+ * @license lucide-react v0.468.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const Py=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),m0=(...n)=>n.filter((r,d,c)=>!!r&&r.trim()!==""&&c.indexOf(r)===d).join(" ").trim();/**
66
+ * @license lucide-react v0.468.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var Wy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
+ * @license lucide-react v0.468.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const ev=u.forwardRef(({color:n="currentColor",size:r=24,strokeWidth:d=2,absoluteStrokeWidth:c,className:m="",children:f,iconNode:h,...b},g)=>u.createElement("svg",{ref:g,...Wy,width:r,height:r,stroke:n,strokeWidth:c?Number(d)*24/Number(r):d,className:m0("lucide",m),...b},[...h.map(([p,w])=>u.createElement(p,w)),...Array.isArray(f)?f:[f]]));/**
76
+ * @license lucide-react v0.468.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const te=(n,r)=>{const d=u.forwardRef(({className:c,...m},f)=>u.createElement(ev,{ref:f,iconNode:r,className:m0(`lucide-${Py(n)}`,c),...m}));return d.displayName=`${n}`,d};/**
81
+ * @license lucide-react v0.468.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const Zt=te("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.468.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const Hn=te("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
91
+ * @license lucide-react v0.468.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const x0=te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
96
+ * @license lucide-react v0.468.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const tv=te("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
101
+ * @license lucide-react v0.468.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const Ya=te("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
106
+ * @license lucide-react v0.468.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const ws=te("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
111
+ * @license lucide-react v0.468.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const av=te("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
116
+ * @license lucide-react v0.468.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const f0=te("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
121
+ * @license lucide-react v0.468.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const Xd=te("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
126
+ * @license lucide-react v0.468.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const sv=te("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
131
+ * @license lucide-react v0.468.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const nv=te("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
136
+ * @license lucide-react v0.468.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const ja=te("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
141
+ * @license lucide-react v0.468.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const Nt=te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
146
+ * @license lucide-react v0.468.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Xa=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
151
+ * @license lucide-react v0.468.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const zh=te("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
156
+ * @license lucide-react v0.468.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const ra=te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
161
+ * @license lucide-react v0.468.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const Il=te("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
166
+ * @license lucide-react v0.468.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const Pl=te("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/**
171
+ * @license lucide-react v0.468.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const ft=te("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
176
+ * @license lucide-react v0.468.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const Qd=te("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
181
+ * @license lucide-react v0.468.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const lv=te("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
186
+ * @license lucide-react v0.468.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const h0=te("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
191
+ * @license lucide-react v0.468.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const At=te("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
196
+ * @license lucide-react v0.468.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const jd=te("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
201
+ * @license lucide-react v0.468.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const iv=te("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
206
+ * @license lucide-react v0.468.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const qn=te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
211
+ * @license lucide-react v0.468.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const rv=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
216
+ * @license lucide-react v0.468.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const cv=te("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
221
+ * @license lucide-react v0.468.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const p0=te("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
226
+ * @license lucide-react v0.468.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const wa=te("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
231
+ * @license lucide-react v0.468.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const Wl=te("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
236
+ * @license lucide-react v0.468.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const $n=te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
241
+ * @license lucide-react v0.468.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const Zd=te("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
246
+ * @license lucide-react v0.468.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const Vr=te("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
251
+ * @license lucide-react v0.468.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const Fs=te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
256
+ * @license lucide-react v0.468.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const g0=te("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
261
+ * @license lucide-react v0.468.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const Ch=te("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
266
+ * @license lucide-react v0.468.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const Nd=te("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
271
+ * @license lucide-react v0.468.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const ov=te("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/**
276
+ * @license lucide-react v0.468.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const $r=te("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
281
+ * @license lucide-react v0.468.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const Jd=te("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
286
+ * @license lucide-react v0.468.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const Ah=te("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
291
+ * @license lucide-react v0.468.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const dv=te("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
296
+ * @license lucide-react v0.468.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const ni=te("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
301
+ * @license lucide-react v0.468.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const uv=te("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
306
+ * @license lucide-react v0.468.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const Fd=te("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
311
+ * @license lucide-react v0.468.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const Md=te("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
316
+ * @license lucide-react v0.468.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const ht=te("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
321
+ * @license lucide-react v0.468.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const mv=te("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
326
+ * @license lucide-react v0.468.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const Dd=te("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
331
+ * @license lucide-react v0.468.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const xv=te("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
336
+ * @license lucide-react v0.468.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const fv=te("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
341
+ * @license lucide-react v0.468.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const hv=te("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
346
+ * @license lucide-react v0.468.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const Ss=te("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
351
+ * @license lucide-react v0.468.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const pv=te("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
356
+ * @license lucide-react v0.468.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const gv=te("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
361
+ * @license lucide-react v0.468.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const bv=te("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
366
+ * @license lucide-react v0.468.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const yv=te("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
371
+ * @license lucide-react v0.468.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const Yr=te("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
376
+ * @license lucide-react v0.468.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const vv=te("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
381
+ * @license lucide-react v0.468.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const Id=te("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
386
+ * @license lucide-react v0.468.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const kt=te("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
391
+ * @license lucide-react v0.468.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const pt=te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
396
+ * @license lucide-react v0.468.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const Xr=te("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
401
+ * @license lucide-react v0.468.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const b0=te("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
406
+ * @license lucide-react v0.468.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const Ct=te("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
411
+ * @license lucide-react v0.468.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const y0=te("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
416
+ * @license lucide-react v0.468.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const Qr=te("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
421
+ * @license lucide-react v0.468.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const ks=te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
426
+ * @license lucide-react v0.468.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const Pd=te("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
431
+ * @license lucide-react v0.468.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const Wd=te("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
436
+ * @license lucide-react v0.468.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const Xn=te("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
441
+ * @license lucide-react v0.468.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const Na=te("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
446
+ * @license lucide-react v0.468.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const eu=te("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
451
+ * @license lucide-react v0.468.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const zs=te("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
456
+ * @license lucide-react v0.468.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const jv=te("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/**
461
+ * @license lucide-react v0.468.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const Nv=te("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
466
+ * @license lucide-react v0.468.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const wv=te("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
471
+ * @license lucide-react v0.468.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const Sv=te("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
476
+ * @license lucide-react v0.468.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const Zs=te("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
481
+ * @license lucide-react v0.468.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const v0=te("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
486
+ * @license lucide-react v0.468.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */const ei=te("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/**
491
+ * @license lucide-react v0.468.0 - ISC
492
+ *
493
+ * This source code is licensed under the ISC license.
494
+ * See the LICENSE file in the root directory of this source tree.
495
+ */const Od=te("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/**
496
+ * @license lucide-react v0.468.0 - ISC
497
+ *
498
+ * This source code is licensed under the ISC license.
499
+ * See the LICENSE file in the root directory of this source tree.
500
+ */const ti=te("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
501
+ * @license lucide-react v0.468.0 - ISC
502
+ *
503
+ * This source code is licensed under the ISC license.
504
+ * See the LICENSE file in the root directory of this source tree.
505
+ */const kv=te("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
506
+ * @license lucide-react v0.468.0 - ISC
507
+ *
508
+ * This source code is licensed under the ISC license.
509
+ * See the LICENSE file in the root directory of this source tree.
510
+ */const zv=te("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
511
+ * @license lucide-react v0.468.0 - ISC
512
+ *
513
+ * This source code is licensed under the ISC license.
514
+ * See the LICENSE file in the root directory of this source tree.
515
+ */const Cv=te("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
516
+ * @license lucide-react v0.468.0 - ISC
517
+ *
518
+ * This source code is licensed under the ISC license.
519
+ * See the LICENSE file in the root directory of this source tree.
520
+ */const Ut=te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
521
+ * @license lucide-react v0.468.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */const Av=te("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
526
+ * @license lucide-react v0.468.0 - ISC
527
+ *
528
+ * This source code is licensed under the ISC license.
529
+ * See the LICENSE file in the root directory of this source tree.
530
+ */const tu=te("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
531
+ * @license lucide-react v0.468.0 - ISC
532
+ *
533
+ * This source code is licensed under the ISC license.
534
+ * See the LICENSE file in the root directory of this source tree.
535
+ */const dt=te("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
536
+ * @license lucide-react v0.468.0 - ISC
537
+ *
538
+ * This source code is licensed under the ISC license.
539
+ * See the LICENSE file in the root directory of this source tree.
540
+ */const Bn=te("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
541
+ * @license lucide-react v0.468.0 - ISC
542
+ *
543
+ * This source code is licensed under the ISC license.
544
+ * See the LICENSE file in the root directory of this source tree.
545
+ */const Ev=te("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
546
+ * @license lucide-react v0.468.0 - ISC
547
+ *
548
+ * This source code is licensed under the ISC license.
549
+ * See the LICENSE file in the root directory of this source tree.
550
+ */const Qn=te("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
551
+ * @license lucide-react v0.468.0 - ISC
552
+ *
553
+ * This source code is licensed under the ISC license.
554
+ * See the LICENSE file in the root directory of this source tree.
555
+ */const Tv=te("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
556
+ * @license lucide-react v0.468.0 - ISC
557
+ *
558
+ * This source code is licensed under the ISC license.
559
+ * See the LICENSE file in the root directory of this source tree.
560
+ */const Rv=te("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
561
+ * @license lucide-react v0.468.0 - ISC
562
+ *
563
+ * This source code is licensed under the ISC license.
564
+ * See the LICENSE file in the root directory of this source tree.
565
+ */const Zn=te("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
566
+ * @license lucide-react v0.468.0 - ISC
567
+ *
568
+ * This source code is licensed under the ISC license.
569
+ * See the LICENSE file in the root directory of this source tree.
570
+ */const et=te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
571
+ * @license lucide-react v0.468.0 - ISC
572
+ *
573
+ * This source code is licensed under the ISC license.
574
+ * See the LICENSE file in the root directory of this source tree.
575
+ */const Ka=te("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Ld={en:"English",fr:"Français",es:"Español",de:"Deutsch",pt:"Português",ja:"日本語",zh:"中文",ko:"한국어",ar:"العربية",ru:"Русский",it:"Italiano",nl:"Nederlands"},Mv=["ar"],Dv=Object.keys(Ld);function _d(n){return Dv.includes(n)}function Ov(n){if(!n)return"en";const r=n.toLowerCase();if(_d(r))return r;const d=r.split("-")[0];return _d(d)?d:"en"}const Eh={en:{"nav.missions":"Missions","nav.chat":"Chat","nav.history":"History","nav.dashboard":"Dashboard","nav.agents":"Agents","nav.workflows":"Workflows","nav.skills":"Skills","nav.runs":"Runs","nav.approvals":"Approvals","nav.handoffs":"Handoffs","nav.apiKeys":"API Keys","nav.settings":"Settings","nav.users":"Users","nav.prompts":"Prompts","dashboard.title":"Dashboard","dashboard.activeAgents":"Active Agents","dashboard.runningTasks":"Running Tasks","dashboard.costToday":"Cost Today","dashboard.skillsInstalled":"Skills Installed","dashboard.recentActivity":"Recent Activity","dashboard.quickActions":"Quick Actions","dashboard.systemHealth":"System Health","dashboard.createAgent":"Create Agent","dashboard.runWorkflow":"Run Workflow","dashboard.installSkill":"Install Skill","agents.title":"Agents","agents.create":"Create Agent","agents.empty":"No agents configured yet.","agents.emptyDesc":"Create your first AI agent to get started with automated tasks.","agent.overview":"Overview","agent.runs":"Runs","agent.events":"Events","agent.configuration":"Configuration","agent.budget":"Budget","agent.recentRuns":"Recent Runs","agent.delete":"Delete Agent","agent.start":"Start","agent.stop":"Stop","agent.run":"Run","workflows.title":"Workflows","workflows.create":"Create Workflow","workflows.empty":"No workflows defined yet.","workflows.emptyDesc":"Design your first workflow to orchestrate multiple agents.","workflows.nodes":"{count} nodes","workflows.edit":"Edit","workflow.editor":"Workflow Editor","workflow.addNode":"Add Node","workflow.save":"Save","workflow.run":"Run Workflow","skills.title":"Skills","skills.install":"Install Skill","skills.empty":"No skills installed yet.","skills.emptyDesc":"Browse and install skills to extend your agents' capabilities.","skills.scan":"Scan Directory","skills.source":"Source URL or path","runs.title":"Runs","runs.empty":"No runs recorded yet.","runs.emptyDesc":"Run an agent or workflow to see execution history.","runs.filter":"Filter","run.events":"Events","run.output":"Output","run.cost":"Cost Breakdown","run.duration":"Duration","approvals.title":"Approval Queue","approvals.empty":"No pending approvals.","approvals.emptyDesc":"All clear. Dangerous actions will appear here for review.","approvals.approve":"Approve","approvals.deny":"Deny","approvals.pending":"Pending","nav.analytics":"Analytics","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Memory","nav.goals":"Goals","nav.plans":"Plans","nav.guardrails":"Guardrails","analytics.title":"Cost Analytics","analytics.description":"Track spending, token usage, and budget utilization across agents.","analytics.totalSpend":"Total Spend","analytics.totalRuns":"Total Runs","analytics.avgCostPerRun":"Avg Cost/Run","analytics.monthlyEstimate":"Monthly Estimate","analytics.dailyCosts":"Daily Costs (30 days)","analytics.agentBreakdown":"Cost by Agent","analytics.modelBreakdown":"Cost by Model","analytics.budgetUtilization":"Budget Utilization","analytics.runs":"Runs","analytics.totalCost":"Total Cost","analytics.avgCost":"Avg Cost","analytics.model":"Model","analytics.tokens":"Tokens","analytics.cost":"Cost","analytics.noAgentData":"No agent cost data yet.","analytics.noModelData":"No model cost data yet.","settings.title":"Settings","settings.general":"General","settings.security":"Security","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Save Changes","settings.saved":"Settings saved successfully.","settings.language":"Language","common.loading":"Loading...","common.error":"An error occurred.","common.retry":"Retry","common.cancel":"Cancel","common.save":"Save","common.delete":"Delete","common.close":"Close","common.search":"Search...","common.noResults":"No results found.","common.name":"Name","common.description":"Description","common.status":"Status","common.type":"Type","common.actions":"Actions","common.created":"Created","common.updated":"Updated","status.running":"Running","status.completed":"Completed","status.failed":"Failed","status.pending":"Pending","status.paused":"Paused","status.cancelled":"Cancelled","status.idle":"Idle","trust.builtin":"Built-in","trust.official":"Official","trust.trusted":"Trusted","trust.community":"Community","trust.local":"Local"},fr:{"nav.missions":"Missions","nav.chat":"Chat","nav.history":"Historique","nav.dashboard":"Tableau de bord","nav.agents":"Agents","nav.workflows":"Workflows","nav.skills":"Compétences","nav.runs":"Exécutions","nav.approvals":"Approbations","nav.handoffs":"Transferts","nav.apiKeys":"Clés API","nav.settings":"Paramètres","nav.users":"Utilisateurs","nav.prompts":"Prompts","dashboard.title":"Tableau de bord","dashboard.activeAgents":"Agents actifs","dashboard.runningTasks":"Tâches en cours","dashboard.costToday":"Coût aujourd'hui","dashboard.skillsInstalled":"Compétences installées","dashboard.recentActivity":"Activité récente","dashboard.quickActions":"Actions rapides","dashboard.systemHealth":"Santé système","dashboard.createAgent":"Créer un agent","dashboard.runWorkflow":"Lancer un workflow","dashboard.installSkill":"Installer une compétence","agents.title":"Agents","agents.create":"Créer un agent","agents.empty":"Aucun agent configuré.","agents.emptyDesc":"Créez votre premier agent IA pour automatiser vos tâches.","agent.overview":"Aperçu","agent.runs":"Exécutions","agent.events":"Événements","agent.configuration":"Configuration","agent.budget":"Budget","agent.recentRuns":"Exécutions récentes","agent.delete":"Supprimer l'agent","agent.start":"Démarrer","agent.stop":"Arrêter","agent.run":"Exécuter","workflows.title":"Workflows","workflows.create":"Créer un workflow","workflows.empty":"Aucun workflow défini.","workflows.emptyDesc":"Concevez votre premier workflow pour orchestrer vos agents.","workflows.nodes":"{count} nœuds","workflows.edit":"Modifier","workflow.editor":"Éditeur de workflow","workflow.addNode":"Ajouter un nœud","workflow.save":"Enregistrer","workflow.run":"Lancer le workflow","skills.title":"Compétences","skills.install":"Installer","skills.empty":"Aucune compétence installée.","skills.emptyDesc":"Parcourez et installez des compétences pour étendre les capacités de vos agents.","skills.scan":"Scanner un répertoire","skills.source":"URL ou chemin source","runs.title":"Exécutions","runs.empty":"Aucune exécution enregistrée.","runs.emptyDesc":"Lancez un agent ou un workflow pour voir l'historique.","runs.filter":"Filtrer","run.events":"Événements","run.output":"Sortie","run.cost":"Détail des coûts","run.duration":"Durée","approvals.title":"File d'approbation","approvals.empty":"Aucune approbation en attente.","approvals.emptyDesc":"Tout est clair. Les actions dangereuses apparaîtront ici.","approvals.approve":"Approuver","approvals.deny":"Refuser","approvals.pending":"En attente","nav.analytics":"Analytique","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Mémoire","nav.goals":"Objectifs","nav.plans":"Plans","nav.guardrails":"Garde-fous","analytics.title":"Analytique des coûts","analytics.description":"Suivez les dépenses, l'utilisation des tokens et le budget par agent.","analytics.totalSpend":"Dépense totale","analytics.totalRuns":"Total exécutions","analytics.avgCostPerRun":"Coût moyen/exéc.","analytics.monthlyEstimate":"Estimation mensuelle","analytics.dailyCosts":"Coûts quotidiens (30 jours)","analytics.agentBreakdown":"Coûts par agent","analytics.modelBreakdown":"Coûts par modèle","analytics.budgetUtilization":"Utilisation du budget","analytics.runs":"Exécutions","analytics.totalCost":"Coût total","analytics.avgCost":"Coût moyen","analytics.model":"Modèle","analytics.tokens":"Tokens","analytics.cost":"Coût","analytics.noAgentData":"Aucune donnée de coût par agent.","analytics.noModelData":"Aucune donnée de coût par modèle.","settings.title":"Paramètres","settings.general":"Général","settings.security":"Sécurité","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Enregistrer","settings.saved":"Paramètres sauvegardés.","settings.language":"Langue","common.loading":"Chargement...","common.error":"Une erreur est survenue.","common.retry":"Réessayer","common.cancel":"Annuler","common.save":"Enregistrer","common.delete":"Supprimer","common.close":"Fermer","common.search":"Rechercher...","common.noResults":"Aucun résultat.","common.name":"Nom","common.description":"Description","common.status":"Statut","common.type":"Type","common.actions":"Actions","common.created":"Créé","common.updated":"Mis à jour","status.running":"En cours","status.completed":"Terminé","status.failed":"Échoué","status.pending":"En attente","status.paused":"En pause","status.cancelled":"Annulé","status.idle":"Inactif","trust.builtin":"Intégré","trust.official":"Officiel","trust.trusted":"Vérifié","trust.community":"Communautaire","trust.local":"Local"},es:{"nav.dashboard":"Panel","nav.agents":"Agentes","nav.workflows":"Flujos de trabajo","nav.skills":"Habilidades","nav.runs":"Ejecuciones","nav.approvals":"Aprobaciones","nav.handoffs":"Transferencias","nav.apiKeys":"Claves API","nav.settings":"Configuración","nav.users":"Usuarios","nav.prompts":"Prompts","dashboard.title":"Panel","dashboard.activeAgents":"Agentes activos","dashboard.runningTasks":"Tareas en ejecución","dashboard.costToday":"Coste hoy","dashboard.skillsInstalled":"Habilidades instaladas","dashboard.recentActivity":"Actividad reciente","dashboard.quickActions":"Acciones rápidas","dashboard.systemHealth":"Estado del sistema","dashboard.createAgent":"Crear agente","dashboard.runWorkflow":"Ejecutar flujo","dashboard.installSkill":"Instalar habilidad","agents.title":"Agentes","agents.create":"Crear agente","agents.empty":"No hay agentes configurados.","agents.emptyDesc":"Crea tu primer agente IA para empezar con tareas automatizadas.","agent.overview":"Resumen","agent.runs":"Ejecuciones","agent.events":"Eventos","agent.configuration":"Configuración","agent.budget":"Presupuesto","agent.recentRuns":"Ejecuciones recientes","agent.delete":"Eliminar agente","agent.start":"Iniciar","agent.stop":"Detener","agent.run":"Ejecutar","workflows.title":"Flujos de trabajo","workflows.create":"Crear flujo","workflows.empty":"No hay flujos definidos.","workflows.emptyDesc":"Diseña tu primer flujo de trabajo para orquestar múltiples agentes.","workflows.nodes":"{count} nodos","workflows.edit":"Editar","workflow.editor":"Editor de flujo","workflow.addNode":"Añadir nodo","workflow.save":"Guardar","workflow.run":"Ejecutar flujo","skills.title":"Habilidades","skills.install":"Instalar","skills.empty":"No hay habilidades instaladas.","skills.emptyDesc":"Explora e instala habilidades para ampliar las capacidades de tus agentes.","skills.scan":"Escanear directorio","skills.source":"URL o ruta de origen","runs.title":"Ejecuciones","runs.empty":"No hay ejecuciones registradas.","runs.emptyDesc":"Ejecuta un agente o flujo para ver el historial.","runs.filter":"Filtrar","run.events":"Eventos","run.output":"Salida","run.cost":"Desglose de costes","run.duration":"Duración","approvals.title":"Cola de aprobación","approvals.empty":"Sin aprobaciones pendientes.","approvals.emptyDesc":"Todo despejado. Las acciones peligrosas aparecerán aquí.","approvals.approve":"Aprobar","approvals.deny":"Denegar","approvals.pending":"Pendiente","nav.analytics":"Analíticas","nav.budget":"Presupuesto","nav.traces":"Trazas","nav.memory":"Memoria","nav.goals":"Objetivos","nav.plans":"Planes","nav.guardrails":"Salvaguardas","analytics.title":"Analíticas de coste","analytics.description":"Seguimiento de gastos, uso de tokens y presupuesto por agente.","analytics.totalSpend":"Gasto total","analytics.totalRuns":"Total ejecuciones","analytics.avgCostPerRun":"Coste medio/ejec.","analytics.monthlyEstimate":"Estimación mensual","analytics.dailyCosts":"Costes diarios (30 días)","analytics.agentBreakdown":"Coste por agente","analytics.modelBreakdown":"Coste por modelo","analytics.budgetUtilization":"Uso del presupuesto","analytics.runs":"Ejecuciones","analytics.totalCost":"Coste total","analytics.avgCost":"Coste medio","analytics.model":"Modelo","analytics.tokens":"Tokens","analytics.cost":"Coste","analytics.noAgentData":"Sin datos de coste por agente.","analytics.noModelData":"Sin datos de coste por modelo.","settings.title":"Configuración","settings.general":"General","settings.security":"Seguridad","settings.llm":"LLM","settings.budget":"Presupuesto","settings.save":"Guardar cambios","settings.saved":"Configuración guardada.","settings.language":"Idioma","common.loading":"Cargando...","common.error":"Se produjo un error.","common.retry":"Reintentar","common.cancel":"Cancelar","common.save":"Guardar","common.delete":"Eliminar","common.close":"Cerrar","common.search":"Buscar...","common.noResults":"Sin resultados.","common.name":"Nombre","common.description":"Descripción","common.status":"Estado","common.type":"Tipo","common.actions":"Acciones","common.created":"Creado","common.updated":"Actualizado","status.running":"En ejecución","status.completed":"Completado","status.failed":"Fallido","status.pending":"Pendiente","status.paused":"En pausa","status.cancelled":"Cancelado","status.idle":"Inactivo","trust.builtin":"Integrado","trust.official":"Oficial","trust.trusted":"Verificado","trust.community":"Comunidad","trust.local":"Local"},de:{"nav.dashboard":"Dashboard","nav.agents":"Agenten","nav.workflows":"Workflows","nav.skills":"Fähigkeiten","nav.runs":"Ausführungen","nav.approvals":"Genehmigungen","nav.handoffs":"Übergaben","nav.apiKeys":"API-Schlüssel","nav.settings":"Einstellungen","nav.users":"Benutzer","nav.prompts":"Prompts","dashboard.title":"Dashboard","dashboard.activeAgents":"Aktive Agenten","dashboard.runningTasks":"Laufende Aufgaben","dashboard.costToday":"Kosten heute","dashboard.skillsInstalled":"Installierte Fähigkeiten","dashboard.recentActivity":"Letzte Aktivität","dashboard.quickActions":"Schnellaktionen","dashboard.systemHealth":"Systemstatus","dashboard.createAgent":"Agent erstellen","dashboard.runWorkflow":"Workflow starten","dashboard.installSkill":"Fähigkeit installieren","agents.title":"Agenten","agents.create":"Agent erstellen","agents.empty":"Keine Agenten konfiguriert.","agents.emptyDesc":"Erstellen Sie Ihren ersten KI-Agenten für automatisierte Aufgaben.","agent.overview":"Übersicht","agent.runs":"Ausführungen","agent.events":"Ereignisse","agent.configuration":"Konfiguration","agent.budget":"Budget","agent.recentRuns":"Letzte Ausführungen","agent.delete":"Agent löschen","agent.start":"Starten","agent.stop":"Stoppen","agent.run":"Ausführen","workflows.title":"Workflows","workflows.create":"Workflow erstellen","workflows.empty":"Keine Workflows definiert.","workflows.emptyDesc":"Entwerfen Sie Ihren ersten Workflow zur Orchestrierung mehrerer Agenten.","workflows.nodes":"{count} Knoten","workflows.edit":"Bearbeiten","workflow.editor":"Workflow-Editor","workflow.addNode":"Knoten hinzufügen","workflow.save":"Speichern","workflow.run":"Workflow starten","skills.title":"Fähigkeiten","skills.install":"Installieren","skills.empty":"Keine Fähigkeiten installiert.","skills.emptyDesc":"Durchsuchen und installieren Sie Fähigkeiten, um die Möglichkeiten Ihrer Agenten zu erweitern.","skills.scan":"Verzeichnis scannen","skills.source":"Quell-URL oder -pfad","runs.title":"Ausführungen","runs.empty":"Keine Ausführungen aufgezeichnet.","runs.emptyDesc":"Starten Sie einen Agenten oder Workflow, um den Verlauf anzuzeigen.","runs.filter":"Filtern","run.events":"Ereignisse","run.output":"Ausgabe","run.cost":"Kostenaufschlüsselung","run.duration":"Dauer","approvals.title":"Genehmigungswarteschlange","approvals.empty":"Keine ausstehenden Genehmigungen.","approvals.emptyDesc":"Alles in Ordnung. Gefährliche Aktionen erscheinen hier zur Überprüfung.","approvals.approve":"Genehmigen","approvals.deny":"Ablehnen","approvals.pending":"Ausstehend","nav.analytics":"Analytik","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Speicher","nav.goals":"Ziele","nav.plans":"Pläne","nav.guardrails":"Leitplanken","analytics.title":"Kostenanalytik","analytics.description":"Ausgaben, Token-Nutzung und Budgetauslastung pro Agent verfolgen.","analytics.totalSpend":"Gesamtausgaben","analytics.totalRuns":"Gesamtausführungen","analytics.avgCostPerRun":"Ø Kosten/Ausf.","analytics.monthlyEstimate":"Monatliche Schätzung","analytics.dailyCosts":"Tägliche Kosten (30 Tage)","analytics.agentBreakdown":"Kosten pro Agent","analytics.modelBreakdown":"Kosten pro Modell","analytics.budgetUtilization":"Budgetauslastung","analytics.runs":"Ausführungen","analytics.totalCost":"Gesamtkosten","analytics.avgCost":"Ø Kosten","analytics.model":"Modell","analytics.tokens":"Tokens","analytics.cost":"Kosten","analytics.noAgentData":"Noch keine Kostendaten pro Agent.","analytics.noModelData":"Noch keine Kostendaten pro Modell.","settings.title":"Einstellungen","settings.general":"Allgemein","settings.security":"Sicherheit","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Änderungen speichern","settings.saved":"Einstellungen gespeichert.","settings.language":"Sprache","common.loading":"Laden...","common.error":"Ein Fehler ist aufgetreten.","common.retry":"Erneut versuchen","common.cancel":"Abbrechen","common.save":"Speichern","common.delete":"Löschen","common.close":"Schließen","common.search":"Suchen...","common.noResults":"Keine Ergebnisse.","common.name":"Name","common.description":"Beschreibung","common.status":"Status","common.type":"Typ","common.actions":"Aktionen","common.created":"Erstellt","common.updated":"Aktualisiert","status.running":"Läuft","status.completed":"Abgeschlossen","status.failed":"Fehlgeschlagen","status.pending":"Ausstehend","status.paused":"Pausiert","status.cancelled":"Abgebrochen","status.idle":"Inaktiv","trust.builtin":"Integriert","trust.official":"Offiziell","trust.trusted":"Vertrauenswürdig","trust.community":"Community","trust.local":"Lokal"},pt:{"nav.dashboard":"Painel","nav.agents":"Agentes","nav.workflows":"Fluxos de trabalho","nav.skills":"Habilidades","nav.runs":"Execuções","nav.approvals":"Aprovações","nav.handoffs":"Transferências","nav.apiKeys":"Chaves API","nav.settings":"Configurações","nav.users":"Usuários","nav.prompts":"Prompts","dashboard.title":"Painel","dashboard.activeAgents":"Agentes ativos","dashboard.runningTasks":"Tarefas em execução","dashboard.costToday":"Custo hoje","dashboard.skillsInstalled":"Habilidades instaladas","dashboard.recentActivity":"Atividade recente","dashboard.quickActions":"Ações rápidas","dashboard.systemHealth":"Saúde do sistema","dashboard.createAgent":"Criar agente","dashboard.runWorkflow":"Executar fluxo","dashboard.installSkill":"Instalar habilidade","agents.title":"Agentes","agents.create":"Criar agente","agents.empty":"Nenhum agente configurado.","agents.emptyDesc":"Crie seu primeiro agente de IA para começar com tarefas automatizadas.","agent.overview":"Visão geral","agent.runs":"Execuções","agent.events":"Eventos","agent.configuration":"Configuração","agent.budget":"Orçamento","agent.recentRuns":"Execuções recentes","agent.delete":"Excluir agente","agent.start":"Iniciar","agent.stop":"Parar","agent.run":"Executar","workflows.title":"Fluxos de trabalho","workflows.create":"Criar fluxo","workflows.empty":"Nenhum fluxo definido.","workflows.emptyDesc":"Projete seu primeiro fluxo de trabalho para orquestrar múltiplos agentes.","workflows.nodes":"{count} nós","workflows.edit":"Editar","workflow.editor":"Editor de fluxo","workflow.addNode":"Adicionar nó","workflow.save":"Salvar","workflow.run":"Executar fluxo","skills.title":"Habilidades","skills.install":"Instalar","skills.empty":"Nenhuma habilidade instalada.","skills.emptyDesc":"Explore e instale habilidades para ampliar as capacidades dos seus agentes.","skills.scan":"Escanear diretório","skills.source":"URL ou caminho de origem","runs.title":"Execuções","runs.empty":"Nenhuma execução registrada.","runs.emptyDesc":"Execute um agente ou fluxo para ver o histórico.","runs.filter":"Filtrar","run.events":"Eventos","run.output":"Saída","run.cost":"Detalhamento de custos","run.duration":"Duração","approvals.title":"Fila de aprovação","approvals.empty":"Sem aprovações pendentes.","approvals.emptyDesc":"Tudo limpo. Ações perigosas aparecerão aqui para revisão.","approvals.approve":"Aprovar","approvals.deny":"Negar","approvals.pending":"Pendente","nav.analytics":"Análises","nav.budget":"Orçamento","nav.traces":"Rastros","nav.memory":"Memória","nav.goals":"Objetivos","nav.plans":"Planos","nav.guardrails":"Proteções","analytics.title":"Análise de custos","analytics.description":"Acompanhe gastos, uso de tokens e orçamento por agente.","analytics.totalSpend":"Gasto total","analytics.totalRuns":"Total de execuções","analytics.avgCostPerRun":"Custo médio/exec.","analytics.monthlyEstimate":"Estimativa mensal","analytics.dailyCosts":"Custos diários (30 dias)","analytics.agentBreakdown":"Custo por agente","analytics.modelBreakdown":"Custo por modelo","analytics.budgetUtilization":"Utilização do orçamento","analytics.runs":"Execuções","analytics.totalCost":"Custo total","analytics.avgCost":"Custo médio","analytics.model":"Modelo","analytics.tokens":"Tokens","analytics.cost":"Custo","analytics.noAgentData":"Sem dados de custo por agente.","analytics.noModelData":"Sem dados de custo por modelo.","settings.title":"Configurações","settings.general":"Geral","settings.security":"Segurança","settings.llm":"LLM","settings.budget":"Orçamento","settings.save":"Salvar alterações","settings.saved":"Configurações salvas.","settings.language":"Idioma","common.loading":"Carregando...","common.error":"Ocorreu um erro.","common.retry":"Tentar novamente","common.cancel":"Cancelar","common.save":"Salvar","common.delete":"Excluir","common.close":"Fechar","common.search":"Pesquisar...","common.noResults":"Nenhum resultado.","common.name":"Nome","common.description":"Descrição","common.status":"Status","common.type":"Tipo","common.actions":"Ações","common.created":"Criado","common.updated":"Atualizado","status.running":"Em execução","status.completed":"Concluído","status.failed":"Falhou","status.pending":"Pendente","status.paused":"Pausado","status.cancelled":"Cancelado","status.idle":"Inativo","trust.builtin":"Integrado","trust.official":"Oficial","trust.trusted":"Verificado","trust.community":"Comunidade","trust.local":"Local"},ja:{"nav.dashboard":"ダッシュボード","nav.agents":"エージェント","nav.workflows":"ワークフロー","nav.skills":"スキル","nav.runs":"実行履歴","nav.approvals":"承認","nav.handoffs":"引き継ぎ","nav.apiKeys":"APIキー","nav.settings":"設定","nav.users":"ユーザー","nav.prompts":"プロンプト","dashboard.title":"ダッシュボード","dashboard.activeAgents":"アクティブなエージェント","dashboard.runningTasks":"実行中のタスク","dashboard.costToday":"本日のコスト","dashboard.skillsInstalled":"インストール済みスキル","dashboard.recentActivity":"最近のアクティビティ","dashboard.quickActions":"クイックアクション","dashboard.systemHealth":"システム状態","dashboard.createAgent":"エージェント作成","dashboard.runWorkflow":"ワークフロー実行","dashboard.installSkill":"スキルインストール","agents.title":"エージェント","agents.create":"エージェント作成","agents.empty":"エージェントが構成されていません。","agents.emptyDesc":"最初のAIエージェントを作成して自動化タスクを始めましょう。","agent.overview":"概要","agent.runs":"実行履歴","agent.events":"イベント","agent.configuration":"構成","agent.budget":"予算","agent.recentRuns":"最近の実行","agent.delete":"エージェント削除","agent.start":"開始","agent.stop":"停止","agent.run":"実行","workflows.title":"ワークフロー","workflows.create":"ワークフロー作成","workflows.empty":"ワークフローが定義されていません。","workflows.emptyDesc":"最初のワークフローを設計して複数のエージェントをオーケストレーションしましょう。","workflows.nodes":"{count} ノード","workflows.edit":"編集","workflow.editor":"ワークフローエディタ","workflow.addNode":"ノード追加","workflow.save":"保存","workflow.run":"ワークフロー実行","skills.title":"スキル","skills.install":"インストール","skills.empty":"スキルがインストールされていません。","skills.emptyDesc":"スキルを参照・インストールしてエージェントの機能を拡張しましょう。","skills.scan":"ディレクトリスキャン","skills.source":"ソースURLまたはパス","runs.title":"実行履歴","runs.empty":"実行記録がありません。","runs.emptyDesc":"エージェントまたはワークフローを実行して履歴を確認しましょう。","runs.filter":"フィルター","run.events":"イベント","run.output":"出力","run.cost":"コスト内訳","run.duration":"所要時間","approvals.title":"承認キュー","approvals.empty":"保留中の承認はありません。","approvals.emptyDesc":"問題なし。危険なアクションはここに表示されます。","approvals.approve":"承認","approvals.deny":"拒否","approvals.pending":"保留中","nav.analytics":"アナリティクス","nav.budget":"予算","nav.traces":"トレース","nav.memory":"メモリ","nav.goals":"目標","nav.plans":"プラン","nav.guardrails":"ガードレール","analytics.title":"コスト分析","analytics.description":"エージェントごとの支出、トークン使用量、予算利用状況を追跡。","analytics.totalSpend":"総支出","analytics.totalRuns":"総実行数","analytics.avgCostPerRun":"平均コスト/実行","analytics.monthlyEstimate":"月間見積もり","analytics.dailyCosts":"日次コスト(30日間)","analytics.agentBreakdown":"エージェント別コスト","analytics.modelBreakdown":"モデル別コスト","analytics.budgetUtilization":"予算利用率","analytics.runs":"実行回数","analytics.totalCost":"総コスト","analytics.avgCost":"平均コスト","analytics.model":"モデル","analytics.tokens":"トークン","analytics.cost":"コスト","analytics.noAgentData":"エージェントコストデータがまだありません。","analytics.noModelData":"モデルコストデータがまだありません。","settings.title":"設定","settings.general":"一般","settings.security":"セキュリティ","settings.llm":"LLM","settings.budget":"予算","settings.save":"変更を保存","settings.saved":"設定が保存されました。","settings.language":"言語","common.loading":"読み込み中...","common.error":"エラーが発生しました。","common.retry":"再試行","common.cancel":"キャンセル","common.save":"保存","common.delete":"削除","common.close":"閉じる","common.search":"検索...","common.noResults":"結果が見つかりません。","common.name":"名前","common.description":"説明","common.status":"ステータス","common.type":"タイプ","common.actions":"アクション","common.created":"作成日","common.updated":"更新日","status.running":"実行中","status.completed":"完了","status.failed":"失敗","status.pending":"保留中","status.paused":"一時停止","status.cancelled":"キャンセル済み","status.idle":"アイドル","trust.builtin":"組み込み","trust.official":"公式","trust.trusted":"信頼済み","trust.community":"コミュニティ","trust.local":"ローカル"},zh:{"nav.dashboard":"仪表盘","nav.agents":"代理","nav.workflows":"工作流","nav.skills":"技能","nav.runs":"执行记录","nav.approvals":"审批","nav.handoffs":"交接","nav.apiKeys":"API密钥","nav.settings":"设置","nav.users":"用户","nav.prompts":"提示词","dashboard.title":"仪表盘","dashboard.activeAgents":"活跃代理","dashboard.runningTasks":"运行中的任务","dashboard.costToday":"今日费用","dashboard.skillsInstalled":"已安装技能","dashboard.recentActivity":"最近活动","dashboard.quickActions":"快捷操作","dashboard.systemHealth":"系统状态","dashboard.createAgent":"创建代理","dashboard.runWorkflow":"运行工作流","dashboard.installSkill":"安装技能","agents.title":"代理","agents.create":"创建代理","agents.empty":"尚无已配置的代理。","agents.emptyDesc":"创建您的第一个AI代理以开始自动化任务。","agent.overview":"概览","agent.runs":"执行记录","agent.events":"事件","agent.configuration":"配置","agent.budget":"预算","agent.recentRuns":"最近执行","agent.delete":"删除代理","agent.start":"启动","agent.stop":"停止","agent.run":"运行","workflows.title":"工作流","workflows.create":"创建工作流","workflows.empty":"尚无已定义的工作流。","workflows.emptyDesc":"设计您的第一个工作流以编排多个代理。","workflows.nodes":"{count} 个节点","workflows.edit":"编辑","workflow.editor":"工作流编辑器","workflow.addNode":"添加节点","workflow.save":"保存","workflow.run":"运行工作流","skills.title":"技能","skills.install":"安装","skills.empty":"尚无已安装的技能。","skills.emptyDesc":"浏览并安装技能以扩展代理的能力。","skills.scan":"扫描目录","skills.source":"源URL或路径","runs.title":"执行记录","runs.empty":"尚无执行记录。","runs.emptyDesc":"运行代理或工作流以查看执行历史。","runs.filter":"筛选","run.events":"事件","run.output":"输出","run.cost":"费用明细","run.duration":"持续时间","approvals.title":"审批队列","approvals.empty":"没有待审批项。","approvals.emptyDesc":"一切正常。危险操作将在此显示以供审查。","approvals.approve":"批准","approvals.deny":"拒绝","approvals.pending":"待处理","nav.analytics":"分析","nav.budget":"预算","nav.traces":"追踪","nav.memory":"记忆","nav.goals":"目标","nav.plans":"计划","nav.guardrails":"护栏","analytics.title":"费用分析","analytics.description":"追踪各代理的支出、令牌使用量和预算利用率。","analytics.totalSpend":"总支出","analytics.totalRuns":"总执行次数","analytics.avgCostPerRun":"平均费用/次","analytics.monthlyEstimate":"月度估算","analytics.dailyCosts":"每日费用(30天)","analytics.agentBreakdown":"按代理的费用","analytics.modelBreakdown":"按模型的费用","analytics.budgetUtilization":"预算利用率","analytics.runs":"执行次数","analytics.totalCost":"总费用","analytics.avgCost":"平均费用","analytics.model":"模型","analytics.tokens":"令牌","analytics.cost":"费用","analytics.noAgentData":"尚无代理费用数据。","analytics.noModelData":"尚无模型费用数据。","settings.title":"设置","settings.general":"通用","settings.security":"安全","settings.llm":"LLM","settings.budget":"预算","settings.save":"保存更改","settings.saved":"设置已保存。","settings.language":"语言","common.loading":"加载中...","common.error":"发生错误。","common.retry":"重试","common.cancel":"取消","common.save":"保存","common.delete":"删除","common.close":"关闭","common.search":"搜索...","common.noResults":"未找到结果。","common.name":"名称","common.description":"描述","common.status":"状态","common.type":"类型","common.actions":"操作","common.created":"创建时间","common.updated":"更新时间","status.running":"运行中","status.completed":"已完成","status.failed":"失败","status.pending":"待处理","status.paused":"已暂停","status.cancelled":"已取消","status.idle":"空闲","trust.builtin":"内置","trust.official":"官方","trust.trusted":"受信任","trust.community":"社区","trust.local":"本地"},ko:{"nav.dashboard":"대시보드","nav.agents":"에이전트","nav.workflows":"워크플로우","nav.skills":"스킬","nav.runs":"실행 기록","nav.approvals":"승인","nav.handoffs":"인수인계","nav.apiKeys":"API 키","nav.settings":"설정","nav.users":"사용자","nav.prompts":"프롬프트","dashboard.title":"대시보드","dashboard.activeAgents":"활성 에이전트","dashboard.runningTasks":"실행 중인 작업","dashboard.costToday":"오늘 비용","dashboard.skillsInstalled":"설치된 스킬","dashboard.recentActivity":"최근 활동","dashboard.quickActions":"빠른 작업","dashboard.systemHealth":"시스템 상태","dashboard.createAgent":"에이전트 생성","dashboard.runWorkflow":"워크플로우 실행","dashboard.installSkill":"스킬 설치","agents.title":"에이전트","agents.create":"에이전트 생성","agents.empty":"구성된 에이전트가 없습니다.","agents.emptyDesc":"첫 번째 AI 에이전트를 만들어 자동화 작업을 시작하세요.","agent.overview":"개요","agent.runs":"실행 기록","agent.events":"이벤트","agent.configuration":"구성","agent.budget":"예산","agent.recentRuns":"최근 실행","agent.delete":"에이전트 삭제","agent.start":"시작","agent.stop":"중지","agent.run":"실행","workflows.title":"워크플로우","workflows.create":"워크플로우 생성","workflows.empty":"정의된 워크플로우가 없습니다.","workflows.emptyDesc":"첫 번째 워크플로우를 설계하여 여러 에이전트를 조율하세요.","workflows.nodes":"{count}개 노드","workflows.edit":"편집","workflow.editor":"워크플로우 편집기","workflow.addNode":"노드 추가","workflow.save":"저장","workflow.run":"워크플로우 실행","skills.title":"스킬","skills.install":"설치","skills.empty":"설치된 스킬이 없습니다.","skills.emptyDesc":"스킬을 탐색하고 설치하여 에이전트의 기능을 확장하세요.","skills.scan":"디렉토리 스캔","skills.source":"소스 URL 또는 경로","runs.title":"실행 기록","runs.empty":"기록된 실행이 없습니다.","runs.emptyDesc":"에이전트 또는 워크플로우를 실행하여 실행 기록을 확인하세요.","runs.filter":"필터","run.events":"이벤트","run.output":"출력","run.cost":"비용 내역","run.duration":"소요 시간","approvals.title":"승인 대기열","approvals.empty":"대기 중인 승인이 없습니다.","approvals.emptyDesc":"문제 없음. 위험한 작업은 여기에 검토를 위해 표시됩니다.","approvals.approve":"승인","approvals.deny":"거부","approvals.pending":"대기 중","nav.analytics":"분석","nav.budget":"예산","nav.traces":"추적","nav.memory":"메모리","nav.goals":"목표","nav.plans":"계획","nav.guardrails":"가드레일","analytics.title":"비용 분석","analytics.description":"에이전트별 지출, 토큰 사용량 및 예산 활용도를 추적합니다.","analytics.totalSpend":"총 지출","analytics.totalRuns":"총 실행 수","analytics.avgCostPerRun":"평균 비용/실행","analytics.monthlyEstimate":"월간 추정","analytics.dailyCosts":"일별 비용 (30일)","analytics.agentBreakdown":"에이전트별 비용","analytics.modelBreakdown":"모델별 비용","analytics.budgetUtilization":"예산 활용률","analytics.runs":"실행 횟수","analytics.totalCost":"총 비용","analytics.avgCost":"평균 비용","analytics.model":"모델","analytics.tokens":"토큰","analytics.cost":"비용","analytics.noAgentData":"에이전트 비용 데이터가 없습니다.","analytics.noModelData":"모델 비용 데이터가 없습니다.","settings.title":"설정","settings.general":"일반","settings.security":"보안","settings.llm":"LLM","settings.budget":"예산","settings.save":"변경 사항 저장","settings.saved":"설정이 저장되었습니다.","settings.language":"언어","common.loading":"로딩 중...","common.error":"오류가 발생했습니다.","common.retry":"재시도","common.cancel":"취소","common.save":"저장","common.delete":"삭제","common.close":"닫기","common.search":"검색...","common.noResults":"결과를 찾을 수 없습니다.","common.name":"이름","common.description":"설명","common.status":"상태","common.type":"유형","common.actions":"작업","common.created":"생성일","common.updated":"수정일","status.running":"실행 중","status.completed":"완료","status.failed":"실패","status.pending":"대기 중","status.paused":"일시 중지","status.cancelled":"취소됨","status.idle":"유휴","trust.builtin":"내장","trust.official":"공식","trust.trusted":"신뢰됨","trust.community":"커뮤니티","trust.local":"로컬"},ar:{"nav.dashboard":"لوحة التحكم","nav.agents":"الوكلاء","nav.workflows":"مسارات العمل","nav.skills":"المهارات","nav.runs":"عمليات التنفيذ","nav.approvals":"الموافقات","nav.handoffs":"التسليمات","nav.apiKeys":"مفاتيح API","nav.settings":"الإعدادات","nav.users":"المستخدمون","nav.prompts":"التعليمات","dashboard.title":"لوحة التحكم","dashboard.activeAgents":"الوكلاء النشطون","dashboard.runningTasks":"المهام قيد التشغيل","dashboard.costToday":"تكلفة اليوم","dashboard.skillsInstalled":"المهارات المثبتة","dashboard.recentActivity":"النشاط الأخير","dashboard.quickActions":"إجراءات سريعة","dashboard.systemHealth":"حالة النظام","dashboard.createAgent":"إنشاء وكيل","dashboard.runWorkflow":"تشغيل مسار عمل","dashboard.installSkill":"تثبيت مهارة","agents.title":"الوكلاء","agents.create":"إنشاء وكيل","agents.empty":"لا توجد وكلاء مهيأة بعد.","agents.emptyDesc":"أنشئ أول وكيل ذكاء اصطناعي لبدء المهام الآلية.","agent.overview":"نظرة عامة","agent.runs":"عمليات التنفيذ","agent.events":"الأحداث","agent.configuration":"التكوين","agent.budget":"الميزانية","agent.recentRuns":"آخر عمليات التنفيذ","agent.delete":"حذف الوكيل","agent.start":"بدء","agent.stop":"إيقاف","agent.run":"تشغيل","workflows.title":"مسارات العمل","workflows.create":"إنشاء مسار عمل","workflows.empty":"لا توجد مسارات عمل معرّفة بعد.","workflows.emptyDesc":"صمّم أول مسار عمل لتنسيق عدة وكلاء.","workflows.nodes":"{count} عقدة","workflows.edit":"تعديل","workflow.editor":"محرر مسار العمل","workflow.addNode":"إضافة عقدة","workflow.save":"حفظ","workflow.run":"تشغيل مسار العمل","skills.title":"المهارات","skills.install":"تثبيت","skills.empty":"لا توجد مهارات مثبتة بعد.","skills.emptyDesc":"تصفّح وثبّت المهارات لتوسيع قدرات وكلائك.","skills.scan":"فحص المجلد","skills.source":"عنوان URL أو مسار المصدر","runs.title":"عمليات التنفيذ","runs.empty":"لا توجد عمليات تنفيذ مسجلة بعد.","runs.emptyDesc":"شغّل وكيلًا أو مسار عمل لعرض سجل التنفيذ.","runs.filter":"تصفية","run.events":"الأحداث","run.output":"المخرجات","run.cost":"تفصيل التكاليف","run.duration":"المدة","approvals.title":"قائمة الموافقات","approvals.empty":"لا توجد موافقات معلقة.","approvals.emptyDesc":"كل شيء على ما يرام. ستظهر الإجراءات الخطيرة هنا للمراجعة.","approvals.approve":"موافقة","approvals.deny":"رفض","approvals.pending":"معلّق","nav.analytics":"التحليلات","nav.budget":"الميزانية","nav.traces":"التتبع","nav.memory":"الذاكرة","nav.goals":"الأهداف","nav.plans":"الخطط","nav.guardrails":"الحواجز","analytics.title":"تحليل التكاليف","analytics.description":"تتبع الإنفاق واستخدام الرموز وميزانية كل وكيل.","analytics.totalSpend":"إجمالي الإنفاق","analytics.totalRuns":"إجمالي عمليات التنفيذ","analytics.avgCostPerRun":"متوسط التكلفة/تنفيذ","analytics.monthlyEstimate":"التقدير الشهري","analytics.dailyCosts":"التكاليف اليومية (30 يومًا)","analytics.agentBreakdown":"التكلفة حسب الوكيل","analytics.modelBreakdown":"التكلفة حسب النموذج","analytics.budgetUtilization":"استخدام الميزانية","analytics.runs":"عمليات التنفيذ","analytics.totalCost":"التكلفة الإجمالية","analytics.avgCost":"متوسط التكلفة","analytics.model":"النموذج","analytics.tokens":"الرموز","analytics.cost":"التكلفة","analytics.noAgentData":"لا توجد بيانات تكلفة للوكلاء بعد.","analytics.noModelData":"لا توجد بيانات تكلفة للنماذج بعد.","settings.title":"الإعدادات","settings.general":"عام","settings.security":"الأمان","settings.llm":"LLM","settings.budget":"الميزانية","settings.save":"حفظ التغييرات","settings.saved":"تم حفظ الإعدادات بنجاح.","settings.language":"اللغة","common.loading":"جارٍ التحميل...","common.error":"حدث خطأ.","common.retry":"إعادة المحاولة","common.cancel":"إلغاء","common.save":"حفظ","common.delete":"حذف","common.close":"إغلاق","common.search":"بحث...","common.noResults":"لم يتم العثور على نتائج.","common.name":"الاسم","common.description":"الوصف","common.status":"الحالة","common.type":"النوع","common.actions":"الإجراءات","common.created":"تاريخ الإنشاء","common.updated":"تاريخ التحديث","status.running":"قيد التشغيل","status.completed":"مكتمل","status.failed":"فشل","status.pending":"معلّق","status.paused":"متوقف مؤقتًا","status.cancelled":"ملغى","status.idle":"خامل","trust.builtin":"مدمج","trust.official":"رسمي","trust.trusted":"موثوق","trust.community":"مجتمعي","trust.local":"محلي"},ru:{"nav.dashboard":"Панель управления","nav.agents":"Агенты","nav.workflows":"Рабочие процессы","nav.skills":"Навыки","nav.runs":"Запуски","nav.approvals":"Одобрения","nav.handoffs":"Передачи","nav.apiKeys":"API-ключи","nav.settings":"Настройки","nav.users":"Пользователи","nav.prompts":"Промпты","dashboard.title":"Панель управления","dashboard.activeAgents":"Активные агенты","dashboard.runningTasks":"Запущенные задачи","dashboard.costToday":"Расходы сегодня","dashboard.skillsInstalled":"Установленные навыки","dashboard.recentActivity":"Последняя активность","dashboard.quickActions":"Быстрые действия","dashboard.systemHealth":"Состояние системы","dashboard.createAgent":"Создать агента","dashboard.runWorkflow":"Запустить процесс","dashboard.installSkill":"Установить навык","agents.title":"Агенты","agents.create":"Создать агента","agents.empty":"Нет настроенных агентов.","agents.emptyDesc":"Создайте первого ИИ-агента для автоматизации задач.","agent.overview":"Обзор","agent.runs":"Запуски","agent.events":"События","agent.configuration":"Конфигурация","agent.budget":"Бюджет","agent.recentRuns":"Последние запуски","agent.delete":"Удалить агента","agent.start":"Запустить","agent.stop":"Остановить","agent.run":"Выполнить","workflows.title":"Рабочие процессы","workflows.create":"Создать процесс","workflows.empty":"Нет определённых процессов.","workflows.emptyDesc":"Создайте первый рабочий процесс для оркестрации агентов.","workflows.nodes":"{count} узлов","workflows.edit":"Редактировать","workflow.editor":"Редактор процессов","workflow.addNode":"Добавить узел","workflow.save":"Сохранить","workflow.run":"Запустить процесс","skills.title":"Навыки","skills.install":"Установить","skills.empty":"Нет установленных навыков.","skills.emptyDesc":"Просматривайте и устанавливайте навыки для расширения возможностей агентов.","skills.scan":"Сканировать каталог","skills.source":"URL или путь к источнику","runs.title":"Запуски","runs.empty":"Нет записей о запусках.","runs.emptyDesc":"Запустите агента или процесс, чтобы увидеть историю выполнения.","runs.filter":"Фильтр","run.events":"События","run.output":"Вывод","run.cost":"Разбивка стоимости","run.duration":"Длительность","approvals.title":"Очередь одобрений","approvals.empty":"Нет ожидающих одобрений.","approvals.emptyDesc":"Всё в порядке. Опасные действия появятся здесь для проверки.","approvals.approve":"Одобрить","approvals.deny":"Отклонить","approvals.pending":"Ожидает","nav.analytics":"Аналитика","nav.budget":"Бюджет","nav.traces":"Трассировки","nav.memory":"Память","nav.goals":"Цели","nav.plans":"Планы","nav.guardrails":"Ограждения","analytics.title":"Аналитика расходов","analytics.description":"Отслеживание расходов, использования токенов и бюджета по агентам.","analytics.totalSpend":"Общие расходы","analytics.totalRuns":"Всего запусков","analytics.avgCostPerRun":"Ср. стоимость/запуск","analytics.monthlyEstimate":"Месячная оценка","analytics.dailyCosts":"Ежедневные расходы (30 дней)","analytics.agentBreakdown":"Расходы по агентам","analytics.modelBreakdown":"Расходы по моделям","analytics.budgetUtilization":"Использование бюджета","analytics.runs":"Запуски","analytics.totalCost":"Общая стоимость","analytics.avgCost":"Ср. стоимость","analytics.model":"Модель","analytics.tokens":"Токены","analytics.cost":"Стоимость","analytics.noAgentData":"Нет данных о расходах по агентам.","analytics.noModelData":"Нет данных о расходах по моделям.","settings.title":"Настройки","settings.general":"Общие","settings.security":"Безопасность","settings.llm":"LLM","settings.budget":"Бюджет","settings.save":"Сохранить изменения","settings.saved":"Настройки сохранены.","settings.language":"Язык","common.loading":"Загрузка...","common.error":"Произошла ошибка.","common.retry":"Повторить","common.cancel":"Отмена","common.save":"Сохранить","common.delete":"Удалить","common.close":"Закрыть","common.search":"Поиск...","common.noResults":"Результатов не найдено.","common.name":"Название","common.description":"Описание","common.status":"Статус","common.type":"Тип","common.actions":"Действия","common.created":"Создано","common.updated":"Обновлено","status.running":"Выполняется","status.completed":"Завершено","status.failed":"Ошибка","status.pending":"Ожидание","status.paused":"Пауза","status.cancelled":"Отменено","status.idle":"Простой","trust.builtin":"Встроенный","trust.official":"Официальный","trust.trusted":"Доверенный","trust.community":"Сообщество","trust.local":"Локальный"},it:{"nav.dashboard":"Pannello","nav.agents":"Agenti","nav.workflows":"Flussi di lavoro","nav.skills":"Competenze","nav.runs":"Esecuzioni","nav.approvals":"Approvazioni","nav.handoffs":"Passaggi","nav.apiKeys":"Chiavi API","nav.settings":"Impostazioni","nav.users":"Utenti","nav.prompts":"Prompt","dashboard.title":"Pannello","dashboard.activeAgents":"Agenti attivi","dashboard.runningTasks":"Attività in corso","dashboard.costToday":"Costo oggi","dashboard.skillsInstalled":"Competenze installate","dashboard.recentActivity":"Attività recente","dashboard.quickActions":"Azioni rapide","dashboard.systemHealth":"Stato del sistema","dashboard.createAgent":"Crea agente","dashboard.runWorkflow":"Esegui flusso","dashboard.installSkill":"Installa competenza","agents.title":"Agenti","agents.create":"Crea agente","agents.empty":"Nessun agente configurato.","agents.emptyDesc":"Crea il tuo primo agente IA per iniziare con le attività automatizzate.","agent.overview":"Panoramica","agent.runs":"Esecuzioni","agent.events":"Eventi","agent.configuration":"Configurazione","agent.budget":"Budget","agent.recentRuns":"Esecuzioni recenti","agent.delete":"Elimina agente","agent.start":"Avvia","agent.stop":"Arresta","agent.run":"Esegui","workflows.title":"Flussi di lavoro","workflows.create":"Crea flusso","workflows.empty":"Nessun flusso di lavoro definito.","workflows.emptyDesc":"Progetta il tuo primo flusso di lavoro per orchestrare più agenti.","workflows.nodes":"{count} nodi","workflows.edit":"Modifica","workflow.editor":"Editor del flusso","workflow.addNode":"Aggiungi nodo","workflow.save":"Salva","workflow.run":"Esegui flusso","skills.title":"Competenze","skills.install":"Installa","skills.empty":"Nessuna competenza installata.","skills.emptyDesc":"Esplora e installa competenze per ampliare le capacità dei tuoi agenti.","skills.scan":"Scansiona directory","skills.source":"URL o percorso sorgente","runs.title":"Esecuzioni","runs.empty":"Nessuna esecuzione registrata.","runs.emptyDesc":"Esegui un agente o un flusso per vedere la cronologia.","runs.filter":"Filtra","run.events":"Eventi","run.output":"Output","run.cost":"Dettaglio costi","run.duration":"Durata","approvals.title":"Coda di approvazione","approvals.empty":"Nessuna approvazione in sospeso.","approvals.emptyDesc":"Tutto a posto. Le azioni pericolose appariranno qui per la revisione.","approvals.approve":"Approva","approvals.deny":"Nega","approvals.pending":"In sospeso","nav.analytics":"Analisi","nav.budget":"Budget","nav.traces":"Tracce","nav.memory":"Memoria","nav.goals":"Obiettivi","nav.plans":"Piani","nav.guardrails":"Protezioni","analytics.title":"Analisi dei costi","analytics.description":"Monitora spese, utilizzo dei token e budget per agente.","analytics.totalSpend":"Spesa totale","analytics.totalRuns":"Esecuzioni totali","analytics.avgCostPerRun":"Costo medio/esec.","analytics.monthlyEstimate":"Stima mensile","analytics.dailyCosts":"Costi giornalieri (30 giorni)","analytics.agentBreakdown":"Costo per agente","analytics.modelBreakdown":"Costo per modello","analytics.budgetUtilization":"Utilizzo del budget","analytics.runs":"Esecuzioni","analytics.totalCost":"Costo totale","analytics.avgCost":"Costo medio","analytics.model":"Modello","analytics.tokens":"Token","analytics.cost":"Costo","analytics.noAgentData":"Nessun dato di costo per agente.","analytics.noModelData":"Nessun dato di costo per modello.","settings.title":"Impostazioni","settings.general":"Generale","settings.security":"Sicurezza","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Salva modifiche","settings.saved":"Impostazioni salvate.","settings.language":"Lingua","common.loading":"Caricamento...","common.error":"Si è verificato un errore.","common.retry":"Riprova","common.cancel":"Annulla","common.save":"Salva","common.delete":"Elimina","common.close":"Chiudi","common.search":"Cerca...","common.noResults":"Nessun risultato.","common.name":"Nome","common.description":"Descrizione","common.status":"Stato","common.type":"Tipo","common.actions":"Azioni","common.created":"Creato","common.updated":"Aggiornato","status.running":"In esecuzione","status.completed":"Completato","status.failed":"Fallito","status.pending":"In sospeso","status.paused":"In pausa","status.cancelled":"Annullato","status.idle":"Inattivo","trust.builtin":"Integrato","trust.official":"Ufficiale","trust.trusted":"Affidabile","trust.community":"Comunità","trust.local":"Locale"},nl:{"nav.dashboard":"Dashboard","nav.agents":"Agents","nav.workflows":"Workflows","nav.skills":"Vaardigheden","nav.runs":"Uitvoeringen","nav.approvals":"Goedkeuringen","nav.handoffs":"Overdrachten","nav.apiKeys":"API-sleutels","nav.settings":"Instellingen","nav.users":"Gebruikers","nav.prompts":"Prompts","dashboard.title":"Dashboard","dashboard.activeAgents":"Actieve agents","dashboard.runningTasks":"Lopende taken","dashboard.costToday":"Kosten vandaag","dashboard.skillsInstalled":"Geïnstalleerde vaardigheden","dashboard.recentActivity":"Recente activiteit","dashboard.quickActions":"Snelle acties","dashboard.systemHealth":"Systeemstatus","dashboard.createAgent":"Agent aanmaken","dashboard.runWorkflow":"Workflow uitvoeren","dashboard.installSkill":"Vaardigheid installeren","agents.title":"Agents","agents.create":"Agent aanmaken","agents.empty":"Geen agents geconfigureerd.","agents.emptyDesc":"Maak uw eerste AI-agent aan om te beginnen met geautomatiseerde taken.","agent.overview":"Overzicht","agent.runs":"Uitvoeringen","agent.events":"Gebeurtenissen","agent.configuration":"Configuratie","agent.budget":"Budget","agent.recentRuns":"Recente uitvoeringen","agent.delete":"Agent verwijderen","agent.start":"Starten","agent.stop":"Stoppen","agent.run":"Uitvoeren","workflows.title":"Workflows","workflows.create":"Workflow aanmaken","workflows.empty":"Geen workflows gedefinieerd.","workflows.emptyDesc":"Ontwerp uw eerste workflow om meerdere agents te orkestreren.","workflows.nodes":"{count} knooppunten","workflows.edit":"Bewerken","workflow.editor":"Workflow-editor","workflow.addNode":"Knooppunt toevoegen","workflow.save":"Opslaan","workflow.run":"Workflow uitvoeren","skills.title":"Vaardigheden","skills.install":"Installeren","skills.empty":"Geen vaardigheden geïnstalleerd.","skills.emptyDesc":"Blader door en installeer vaardigheden om de mogelijkheden van uw agents uit te breiden.","skills.scan":"Map scannen","skills.source":"Bron-URL of pad","runs.title":"Uitvoeringen","runs.empty":"Geen uitvoeringen geregistreerd.","runs.emptyDesc":"Voer een agent of workflow uit om de uitvoeringsgeschiedenis te bekijken.","runs.filter":"Filteren","run.events":"Gebeurtenissen","run.output":"Uitvoer","run.cost":"Kostenoverzicht","run.duration":"Duur","approvals.title":"Goedkeuringswachtrij","approvals.empty":"Geen wachtende goedkeuringen.","approvals.emptyDesc":"Alles in orde. Gevaarlijke acties verschijnen hier ter beoordeling.","approvals.approve":"Goedkeuren","approvals.deny":"Weigeren","approvals.pending":"In afwachting","nav.analytics":"Analyse","nav.budget":"Budget","nav.traces":"Traces","nav.memory":"Geheugen","nav.goals":"Doelen","nav.plans":"Plannen","nav.guardrails":"Vangrails","analytics.title":"Kostenanalyse","analytics.description":"Volg uitgaven, tokengebruik en budgetbenutting per agent.","analytics.totalSpend":"Totale uitgaven","analytics.totalRuns":"Totaal uitvoeringen","analytics.avgCostPerRun":"Gem. kosten/uitv.","analytics.monthlyEstimate":"Maandelijkse schatting","analytics.dailyCosts":"Dagelijkse kosten (30 dagen)","analytics.agentBreakdown":"Kosten per agent","analytics.modelBreakdown":"Kosten per model","analytics.budgetUtilization":"Budgetbenutting","analytics.runs":"Uitvoeringen","analytics.totalCost":"Totale kosten","analytics.avgCost":"Gem. kosten","analytics.model":"Model","analytics.tokens":"Tokens","analytics.cost":"Kosten","analytics.noAgentData":"Nog geen kostengegevens per agent.","analytics.noModelData":"Nog geen kostengegevens per model.","settings.title":"Instellingen","settings.general":"Algemeen","settings.security":"Beveiliging","settings.llm":"LLM","settings.budget":"Budget","settings.save":"Wijzigingen opslaan","settings.saved":"Instellingen opgeslagen.","settings.language":"Taal","common.loading":"Laden...","common.error":"Er is een fout opgetreden.","common.retry":"Opnieuw proberen","common.cancel":"Annuleren","common.save":"Opslaan","common.delete":"Verwijderen","common.close":"Sluiten","common.search":"Zoeken...","common.noResults":"Geen resultaten gevonden.","common.name":"Naam","common.description":"Beschrijving","common.status":"Status","common.type":"Type","common.actions":"Acties","common.created":"Aangemaakt","common.updated":"Bijgewerkt","status.running":"Actief","status.completed":"Voltooid","status.failed":"Mislukt","status.pending":"In afwachting","status.paused":"Gepauzeerd","status.cancelled":"Geannuleerd","status.idle":"Inactief","trust.builtin":"Ingebouwd","trust.official":"Officieel","trust.trusted":"Vertrouwd","trust.community":"Community","trust.local":"Lokaal"}},j0=u.createContext({lang:"en",setLang:()=>{},t:n=>n,isRTL:!1});function Lv({children:n}){const[r,d]=u.useState(()=>{const h=localStorage.getItem("nestor_lang");return h&&_d(h)?h:Ov(navigator.language)}),c=Mv.includes(r);u.useEffect(()=>{document.documentElement.dir=c?"rtl":"ltr",document.documentElement.lang=r},[r,c]);const m=u.useCallback(h=>{d(h),localStorage.setItem("nestor_lang",h)},[]),f=u.useCallback((h,b)=>{var p;let g=((p=Eh[r])==null?void 0:p[h])??Eh.en[h]??h;if(b)for(const[w,v]of Object.entries(b))g=g.replace(`{${w}}`,String(v));return g},[r]);return t.jsx(j0.Provider,{value:{lang:r,setLang:m,t:f,isRTL:c},children:n})}function nt(){return u.useContext(j0)}const _v={admin:{agents:["create","read","update","delete","execute","admin"],workflows:["create","read","update","delete","execute","admin"],skills:["create","read","update","delete","admin"],settings:["read","update","admin"],users:["create","read","update","delete","admin"],prompts:["create","read","update","delete","admin"]},member:{agents:["create","read","update","execute"],workflows:["create","read","update","execute"],skills:["read","create"],settings:["read"],prompts:["read","create","update"]},viewer:{agents:["read"],workflows:["read"],skills:["read"],settings:["read"],prompts:["read"]}},N0=u.createContext({user:null,loading:!0,login:async()=>{},logout:async()=>{},register:async()=>{},isAdmin:!1,hasPermission:()=>!1}),Uv="/api";function Bv(){const n=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/);return n?decodeURIComponent(n[1]):null}async function Yl(n,r){var h;const d={"Content-Type":"application/json",...(r==null?void 0:r.headers)||{}},c=((r==null?void 0:r.method)||"GET").toUpperCase();if(c!=="GET"&&c!=="HEAD"){const b=Bv();b&&(d["X-CSRF-Token"]=b)}const m=await fetch(`${Uv}${n}`,{credentials:"include",headers:d,...r}),f=await m.json().catch(()=>({}));if(!m.ok)throw new Error(((h=f==null?void 0:f.error)==null?void 0:h.message)||`Request failed (${m.status})`);return f}function $v({children:n}){const[r,d]=u.useState(null),[c,m]=u.useState(!0);u.useEffect(()=>{Yl("/auth/me").then(w=>{var v;(v=w.data)!=null&&v.user&&typeof w.data.user=="object"&&d(w.data.user)}).catch(async()=>{try{(await Yl("/health")).status==="ok"&&d({id:"local",email:"admin@localhost",name:"Admin",role:"admin"})}catch{}}).finally(()=>m(!1))},[]);const f=u.useCallback(async(w,v)=>{const y=await Yl("/auth/login",{method:"POST",body:JSON.stringify({email:w,password:v})});d(y.data.user)},[]),h=u.useCallback(async()=>{await Yl("/auth/logout",{method:"POST"}).catch(()=>{}),d(null)},[]),b=u.useCallback(async(w,v,y)=>{await Yl("/auth/register",{method:"POST",body:JSON.stringify({email:w,password:v,name:y})})},[]),g=(r==null?void 0:r.role)==="admin",p=u.useCallback((w,v)=>{if(!r)return!1;const y=_v[r.role];if(!y)return!1;const k=y[w];return k?k.includes(v)||k.includes("admin"):!1},[r]);return t.jsx(N0.Provider,{value:{user:r,loading:c,login:f,logout:h,register:b,isAdmin:g,hasPermission:p},children:n})}function li(){return u.useContext(N0)}const Hv=[{to:"/missions",icon:Ka,labelKey:"nav.missions"},{to:"/chat",icon:Ss,labelKey:"nav.chat"},{to:"/agents",icon:Ya,labelKey:"nav.agents"},{to:"/workflows",icon:$r,labelKey:"nav.workflows"},{to:"/runs",icon:kt,labelKey:"nav.history"}],w0=[{key:"tools",label:"Tools",defaultOpen:!1,items:[{to:"/skills",icon:Xr,labelKey:"nav.skills"},{to:"/memory",icon:ws,labelKey:"nav.memory"},{to:"/plans",icon:iv,labelKey:"nav.plans"},{to:"/guardrails",icon:zs,labelKey:"nav.guardrails"}]},{key:"monitoring",label:"Monitoring",defaultOpen:!1,items:[{to:"/analytics",icon:ja,labelKey:"nav.analytics"},{to:"/budget",icon:wa,labelKey:"nav.budget"},{to:"/traces",icon:Zt,labelKey:"nav.traces"},{to:"/approvals",icon:eu,labelKey:"nav.approvals"}]},{key:"advanced",label:"Advanced",defaultOpen:!1,items:[{to:"/goals",icon:Zs,labelKey:"nav.goals"},{to:"/handoffs",icon:Pl,labelKey:"nav.handoffs"},{to:"/keys",icon:ni,labelKey:"nav.apiKeys"},{to:"/settings",icon:Xn,labelKey:"nav.settings"}]}],qv=[{to:"/users",icon:Qn,labelKey:"nav.users"},{to:"/admin",icon:Xn,labelKey:"nav.admin"}],S0="nestor_sidebar_sections";function Gv(){try{const r=localStorage.getItem(S0);if(r)return JSON.parse(r)}catch{}const n={};for(const r of w0)n[r.key]=r.defaultOpen;return n}function Kv(n){try{localStorage.setItem(S0,JSON.stringify(n))}catch{}}function Vv({onNavigate:n}){const{t:r}=nt(),{user:d,isAdmin:c,logout:m}=li(),[f,h]=u.useState(Gv);u.useEffect(()=>{Kv(f)},[f]);const b=u.useCallback(p=>{h(w=>({...w,[p]:!w[p]}))},[]),g=({isActive:p})=>`flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${p?"bg-purple-500/10 text-purple-400":"text-zinc-400 hover:bg-surface-hover hover:text-zinc-200"}`;return t.jsxs("aside",{className:"fixed inset-y-0 left-0 z-30 flex w-60 flex-col border-r border-border bg-surface",children:[t.jsxs("div",{className:"flex h-14 items-center gap-2.5 px-5 border-b border-border",children:[t.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-purple-600 text-white",children:t.jsx(Ka,{className:"h-4 w-4"})}),t.jsxs("span",{className:"text-lg font-semibold text-white tracking-tight",children:["Nestor ",t.jsx("span",{className:"text-xs font-normal text-zinc-500",children:"Studio"})]})]}),t.jsxs("nav",{className:"flex-1 space-y-0.5 px-3 py-4 overflow-y-auto",children:[Hv.map(p=>{const w=p.icon;return t.jsxs(Zl,{to:p.to,end:p.to==="/chat",onClick:n,className:g,children:[t.jsx(w,{className:"h-4 w-4 flex-shrink-0"}),r(p.labelKey)]},p.to)}),w0.map(p=>t.jsxs("div",{className:"mt-2",children:[t.jsxs("button",{onClick:()=>b(p.key),className:"flex items-center gap-2 w-full px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-zinc-600 hover:text-zinc-400 transition-colors",children:[f[p.key]?t.jsx(Xa,{className:"h-3 w-3"}):t.jsx(ra,{className:"h-3 w-3"}),p.label]}),f[p.key]&&t.jsx("div",{className:"space-y-0.5",children:p.items.map(w=>{const v=w.icon;return t.jsxs(Zl,{to:w.to,onClick:n,className:g,children:[t.jsx(v,{className:"h-4 w-4 flex-shrink-0"}),r(w.labelKey)]},w.to)})})]},p.key)),c&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-2 border-t border-border/50"}),t.jsx("div",{className:"px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-zinc-600",children:"Admin"}),qv.map(p=>{const w=p.icon;return t.jsxs(Zl,{to:p.to,onClick:n,className:g,children:[t.jsx(w,{className:"h-4 w-4 flex-shrink-0"}),r(p.labelKey)]},p.to)})]})]}),t.jsxs("div",{className:"border-t border-border px-4 py-3",children:[d&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-medium text-zinc-200",children:d.name}),t.jsx("p",{className:"truncate text-xs text-zinc-500",children:d.role})]}),t.jsx("button",{onClick:m,className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200",title:"Sign out",children:t.jsx(fv,{className:"h-4 w-4"})})]}),t.jsx("p",{className:"mt-2 text-xs text-zinc-600",children:"Nestor v2.9.0"})]})]})}const Yv=["system","agents","runs","approvals"],Xv=10,Qv=1e3,Zv=3e4,Jv=3e4,Fv=200;function Iv(n,r,d){const c=Math.min(r*2**n,d),m=c*Math.random()*.25;return c+m}function Pv(){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,d=localStorage.getItem("nestor_token"),c=d?`?token=${encodeURIComponent(d)}`:"";return`${n}//${r}/ws${c}`}function au(n=Yv,r){const{reconnect:d=!0,maxRetries:c=Xv,baseDelay:m=Qv,maxDelay:f=Zv}={},[h,b]=u.useState([]),[g,p]=u.useState("disconnected"),[w,v]=u.useState(0),y=u.useRef(null),k=u.useRef(),z=u.useRef(),N=u.useRef(n),S=u.useRef(!1),C=u.useRef(0);N.current=n;const O=u.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=void 0)},[]),D=u.useCallback(()=>{z.current&&(clearInterval(z.current),z.current=void 0)},[]),E=u.useCallback(le=>{D(),z.current=setInterval(()=>{le.readyState===WebSocket.OPEN&&le.send(JSON.stringify({type:"ping"}))},Jv)},[D]),ae=u.useCallback((le,J)=>{for(const ce of J)le.readyState===WebSocket.OPEN&&le.send(JSON.stringify({type:"subscribe",channel:ce}))},[]),oe=u.useCallback(le=>{if(!d||S.current)return;if(C.current>=c){console.warn(`[Nestor WS] Max retries (${c}) reached. Giving up.`),p("disconnected");return}const J=Iv(C.current,m,f);console.info(`[Nestor WS] Reconnecting in ${Math.round(J)}ms (attempt ${C.current+1}/${c})`),p("reconnecting"),O(),k.current=setTimeout(()=>{C.current+=1,v(C.current),le()},J)},[d,c,m,f,O]),B=u.useCallback(()=>{if(!(y.current&&(y.current.readyState===WebSocket.OPEN||y.current.readyState===WebSocket.CONNECTING)))try{const le=Pv(),J=new WebSocket(le);y.current=J,p("connecting"),J.onopen=()=>{console.info("[Nestor WS] Connected"),p("connected"),C.current=0,v(0),S.current=!1,ae(J,N.current),E(J)},J.onmessage=ce=>{try{const he=JSON.parse(ce.data);if(he.type==="ping"){J.send(JSON.stringify({type:"pong"}));return}if(he.type==="pong")return;if(he.type==="event"){const G=he;b(ie=>[...ie.slice(-(Fv-1)),G])}}catch{}},J.onclose=ce=>{if(console.info(`[Nestor WS] Closed (code=${ce.code}, reason=${ce.reason||"none"})`),y.current=null,D(),S.current){p("disconnected");return}oe(B)},J.onerror=ce=>{console.error("[Nestor WS] Error:",ce),J.close()}}catch{oe(B)}},[ae,E,D,oe]);u.useEffect(()=>(S.current=!1,B(),()=>{S.current=!0,O(),D(),y.current&&(y.current.close(1e3,"Component unmount"),y.current=null)}),[B,O,D]),u.useEffect(()=>{const le=y.current;!le||le.readyState!==WebSocket.OPEN||ae(le,n)},[n,ae]);const q=u.useCallback(le=>{const J=y.current;J&&J.readyState===WebSocket.OPEN&&J.send(JSON.stringify({type:"subscribe",channel:le}))},[]),I=u.useCallback(le=>{const J=y.current;J&&J.readyState===WebSocket.OPEN&&J.send(JSON.stringify({type:"unsubscribe",channel:le}))},[]),W=u.useCallback(()=>{b([])},[]),Y=u.useCallback(()=>{S.current=!0,O(),D(),y.current&&(y.current.close(1e3,"Manual close"),y.current=null),p("disconnected")},[O,D]);return{events:h,connected:g==="connected",status:g,retryCount:w,subscribe:q,unsubscribe:I,clearEvents:W,close:Y}}const Wv="/api";class ej extends Error{constructor(r,d,c){super(`API Error ${r}: ${d}`),this.status=r,this.statusText=d,this.body=c,this.name="ApiError"}}function tj(n){const r=document.cookie.match(new RegExp(`(?:^|; )${n}=([^;]*)`));return r?decodeURIComponent(r[1]):null}async function se(n,r={}){const d=`${Wv}${n}`,c={"Content-Type":"application/json",...r.headers},m=localStorage.getItem("nestor_token");m&&(c.Authorization=`Bearer ${m}`);const f=(r.method||"GET").toUpperCase();if(f!=="GET"&&f!=="HEAD"){const g=tj("nestor-csrf");g&&(c["X-CSRF-Token"]=g)}const h=localStorage.getItem("nestor_tenant_id");h&&(c["X-Tenant-ID"]=h);const b=await fetch(d,{...r,headers:c});if(!b.ok){let g;try{g=await b.json()}catch{g=await b.text()}throw new ej(b.status,b.statusText,g)}if(b.status!==204)return b.json()}const Cs={list:n=>{const r=new URLSearchParams;n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.offset&&r.set("offset",String(n.offset));const d=r.toString();return se(`/agents${d?`?${d}`:""}`)},get:n=>se(`/agents/${n}`),create:n=>se("/agents",{method:"POST",body:JSON.stringify(n)}),update:(n,r)=>se(`/agents/${n}`,{method:"PATCH",body:JSON.stringify(r)}),delete:n=>se(`/agents/${n}`,{method:"DELETE"}),run:(n,r)=>se(`/agents/${n}/run`,{method:"POST",body:JSON.stringify({prompt:r})}),getStatus:n=>se(`/agents/${n}/status`),start:(n,r="daemon")=>se(`/agents/${n}/start`,{method:"POST",body:JSON.stringify({mode:r})}),stop:n=>se(`/agents/${n}/stop`,{method:"POST"})},su={list:n=>{const r=new URLSearchParams;n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.offset&&r.set("offset",String(n.offset));const d=r.toString();return se(`/workflows${d?`?${d}`:""}`)},get:n=>se(`/workflows/${n}`),create:n=>se("/workflows",{method:"POST",body:JSON.stringify(n)}),run:(n,r={})=>se(`/workflows/${n}/run`,{method:"POST",body:JSON.stringify({input:r})})},Qs={list:n=>{const r=new URLSearchParams;n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.offset&&r.set("offset",String(n.offset)),n!=null&&n.status&&r.set("status",n.status),n!=null&&n.agentId&&r.set("agentId",n.agentId),n!=null&&n.workflowId&&r.set("workflowId",n.workflowId);const d=r.toString();return se(`/runs${d?`?${d}`:""}`)},get:n=>se(`/runs/${n}`),getEvents:n=>se(`/runs/${n}/events`),abort:n=>se(`/runs/${n}/abort`,{method:"POST"}),delete:n=>se(`/runs/${n}`,{method:"DELETE"})},Ur={list:n=>{const r=new URLSearchParams;n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.offset&&r.set("offset",String(n.offset));const d=r.toString();return se(`/skills${d?`?${d}`:""}`)},install:n=>se("/skills/install",{method:"POST",body:JSON.stringify(n)}),scan:n=>se("/skills/scan",{method:"POST",body:JSON.stringify({path:n})}),delete:n=>se(`/skills/${n}`,{method:"DELETE"})},va={stats:()=>se("/system/stats"),health:()=>se("/health"),getConfig:()=>se("/system/config"),updateConfig:n=>se("/system/config",{method:"PUT",body:JSON.stringify(n)})},zr={summary:n=>{const r=new URLSearchParams;n!=null&&n.from&&r.set("from",String(n.from)),n!=null&&n.to&&r.set("to",String(n.to)),n!=null&&n.agentId&&r.set("agentId",n.agentId);const d=r.toString();return se(`/analytics/summary${d?`?${d}`:""}`)},daily:(n=30)=>se(`/analytics/daily?days=${n}`),budget:()=>se("/analytics/budget"),estimate:()=>se("/analytics/estimate"),agentBreakdown:n=>se(`/analytics/agents/${n}`),qualityOverview:(n=30)=>se(`/analytics/quality?days=${n}`),qualityAgent:(n,r=30)=>se(`/analytics/quality/${n}?days=${r}`)},wd={list:n=>{const r=new URLSearchParams;n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.status&&r.set("status",n.status);const d=r.toString();return se(`/traces${d?`?${d}`:""}`)},get:n=>se(`/traces/${n}`),clear:()=>se("/traces",{method:"DELETE"})},Th={list:()=>se("/tenants"),get:n=>se(`/tenants/${n}`),create:n=>se("/tenants",{method:"POST",body:JSON.stringify(n)}),update:(n,r)=>se(`/tenants/${n}`,{method:"PUT",body:JSON.stringify(r)}),delete:n=>se(`/tenants/${n}`,{method:"DELETE"}),switch:n=>se(`/tenants/${n}/switch`,{method:"POST"})},Xl={tree:()=>se("/goals"),get:n=>se(`/goals/${n}`),create:n=>se("/goals",{method:"POST",body:JSON.stringify(n)}),update:(n,r)=>se(`/goals/${n}`,{method:"PUT",body:JSON.stringify(r)}),delete:n=>se(`/goals/${n}`,{method:"DELETE"}),ancestry:n=>se(`/goals/${n}/ancestry`),assign:(n,r)=>se(`/goals/${n}/assign/${r}`,{method:"POST"}),agentGoals:n=>se(`/agents/${n}/goals`)},Ql={list:n=>{const r=new URLSearchParams;n!=null&&n.status&&r.set("status",n.status),n!=null&&n.agentId&&r.set("agentId",n.agentId),n!=null&&n.type&&r.set("type",n.type),n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.offset&&r.set("offset",String(n.offset));const d=r.toString();return se(`/approvals${d?`?${d}`:""}`)},create:n=>se("/approvals",{method:"POST",body:JSON.stringify(n)}),get:n=>se(`/approvals/${n}`),approve:(n,r)=>se(`/approvals/${n}/approve`,{method:"POST",body:JSON.stringify({decidedBy:(r==null?void 0:r.reviewerId)??"user",comment:r==null?void 0:r.comment})}),reject:(n,r)=>se(`/approvals/${n}/reject`,{method:"POST",body:JSON.stringify({decidedBy:(r==null?void 0:r.reviewerId)??"user",reason:r==null?void 0:r.reason})}),history:n=>{const r=new URLSearchParams;n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.agentId&&r.set("agentId",n.agentId);const d=r.toString();return se(`/approvals/history${d?`?${d}`:""}`)},stats:()=>se("/approvals/stats")},Sd={forRun:n=>se(`/runs/${n}/annotations`),create:(n,r)=>se(`/runs/${n}/annotate`,{method:"POST",body:JSON.stringify(r)}),delete:n=>se(`/annotations/${n}`,{method:"DELETE"})},Hr={list:n=>{const r=new URLSearchParams;n!=null&&n.status&&r.set("status",n.status);const d=r.toString();return se(`/handoffs${d?`?${d}`:""}`)},get:n=>se(`/handoffs/${n}`),create:(n,r)=>se(`/runs/${n}/handoff`,{method:"POST",body:JSON.stringify(r)}),resume:(n,r)=>se(`/handoffs/${n}/resume`,{method:"POST",body:JSON.stringify({humanResolution:r})})},St={overview:()=>se("/admin/overview"),tenants:{list:()=>se("/tenants"),create:n=>se("/tenants",{method:"POST",body:JSON.stringify(n)}),get:n=>se(`/tenants/${n}`),update:(n,r)=>se(`/tenants/${n}`,{method:"PUT",body:JSON.stringify(r)})},users:{list:n=>{const r=new URLSearchParams;n!=null&&n.tenantId&&r.set("tenantId",n.tenantId),n!=null&&n.role&&r.set("role",n.role);const d=r.toString();return se(`/users${d?`?${d}`:""}`)},updateRole:(n,r)=>se(`/users/${n}`,{method:"PATCH",body:JSON.stringify({role:r})}),lock:n=>se(`/users/${n}`,{method:"PATCH",body:JSON.stringify({isActive:!1})}),unlock:n=>se(`/users/${n}`,{method:"PATCH",body:JSON.stringify({isActive:!0})})},system:{info:()=>se("/admin/system-info"),dbStats:()=>se("/admin/db-stats"),rateLimitStats:()=>se("/admin/rate-limit-stats")},audit:{query:n=>{const r=new URLSearchParams;n!=null&&n.userId&&r.set("userId",n.userId),n!=null&&n.resourceType&&r.set("resourceType",n.resourceType),n!=null&&n.action&&r.set("action",n.action),n!=null&&n.limit&&r.set("limit",String(n.limit));const d=r.toString();return se(`/users/audit${d?`?${d}`:""}`)},export:n=>se(`/users/audit?limit=10000&format=${n}`)},security:{failedLogins:(n=24)=>se(`/admin/security/failed-logins?hours=${n}`),lockedAccounts:()=>se("/admin/security/locked-accounts"),activeSessions:()=>se("/admin/security/active-sessions"),rateLimitViolations:(n=100)=>se(`/admin/security/rate-violations?limit=${n}`)}},Rh={status:()=>se("/providers/status"),test:n=>se("/providers/test",{method:"POST",body:JSON.stringify(n)})},xa={list:()=>se("/keys"),set:(n,r,d)=>se("/keys",{method:"POST",body:JSON.stringify({provider:n,key:r,label:d})}),remove:n=>se(`/keys/${n}`,{method:"DELETE"}),test:n=>se(`/keys/test/${n}`)},ys={plan:(n,r)=>se("/missions/plan",{method:"POST",body:JSON.stringify({objective:n,...r})}),list:()=>se("/missions"),get:n=>se(`/missions/${n}`),getReport:(n,r)=>se(`/missions/${n}/report${r==="md"?"?format=md":""}`),cancel:n=>se(`/missions/${n}/cancel`,{method:"POST"})};function aj({onMenuClick:n,showMenu:r}){const{lang:d,setLang:c,t:m}=nt(),{connected:f}=au(),[h,b]=u.useState([]),[g,p]=u.useState(()=>localStorage.getItem("nestor_tenant_id")??"default"),[w,v]=u.useState(!1),[y,k]=u.useState(!1),z=u.useRef(null),N=u.useRef(null),S=h.find(E=>E.id===g)??null,C=u.useCallback(async()=>{try{const E=await Th.list();b(E.data)}catch{}},[]);u.useEffect(()=>{C()},[C]),u.useEffect(()=>{const E=ae=>{z.current&&!z.current.contains(ae.target)&&v(!1),N.current&&!N.current.contains(ae.target)&&k(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);const O=async E=>{try{await Th.switch(E.id),localStorage.setItem("nestor_tenant_id",E.id),p(E.id),v(!1),window.location.reload()}catch(ae){console.error("Failed to switch tenant:",ae)}},D=Object.keys(Ld);return t.jsxs("header",{className:"header sticky top-0 z-20 flex h-14 items-center justify-between border-b border-border bg-[#0a0a0f]/80 px-6 backdrop-blur-sm",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[r&&t.jsx("button",{onClick:n,className:"p-2 hover:bg-surface-hover rounded-lg transition-colors","aria-label":"Toggle menu",children:t.jsx(hv,{className:"h-5 w-5 text-zinc-400"})}),t.jsxs("div",{className:"relative max-w-md flex-1",children:[t.jsx(ks,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",placeholder:m("common.search"),className:"input pl-9 max-w-sm"})]})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[h.length>0&&t.jsxs("div",{className:"relative hidden sm:block",ref:z,children:[t.jsxs("button",{onClick:()=>v(!w),className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-1.5 text-sm transition-colors hover:border-zinc-600",children:[t.jsx(Xd,{className:"h-3.5 w-3.5 text-indigo-400"}),t.jsx("span",{className:"text-zinc-200 max-w-[120px] truncate",children:(S==null?void 0:S.name)??"Default"}),t.jsx(Xa,{className:`h-3.5 w-3.5 text-zinc-500 transition-transform ${w?"rotate-180":""}`})]}),w&&t.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 rounded-lg border border-border bg-surface shadow-xl z-50",children:[t.jsx("div",{className:"px-3 py-2 text-[10px] font-semibold uppercase tracking-wider text-zinc-600",children:"Switch Tenant"}),t.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:h.map(E=>t.jsxs("button",{onClick:()=>O(E),className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-zinc-300 transition-colors hover:bg-surface-hover",children:[E.id===g?t.jsx(Nt,{className:"h-3.5 w-3.5 text-indigo-400"}):t.jsx("div",{className:"h-3.5 w-3.5"}),t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx("div",{className:"font-medium",children:E.name}),t.jsx("div",{className:"text-xs text-zinc-500",children:E.slug})]})]},E.id))})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[f?t.jsx(Rv,{className:"h-4 w-4 text-green-400"}):t.jsx(Tv,{className:"h-4 w-4 text-zinc-500"}),t.jsx("span",{className:`text-xs hidden sm:inline ${f?"text-green-400":"text-zinc-500"}`,children:f?"Connected":"Offline"})]}),t.jsxs("div",{className:"relative",ref:N,children:[t.jsxs("button",{onClick:()=>k(!y),className:"btn-ghost btn-sm flex items-center gap-1.5",title:"Switch language",children:[t.jsx(Jd,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs uppercase",children:d}),t.jsx(Xa,{className:`h-3 w-3 text-zinc-500 transition-transform ${y?"rotate-180":""}`})]}),y&&t.jsx("div",{className:"absolute right-0 top-full mt-1 w-48 rounded-lg border border-border bg-surface shadow-xl z-50 max-h-80 overflow-y-auto",children:D.map(E=>t.jsxs("button",{onClick:()=>{c(E),k(!1)},className:"flex w-full items-center gap-2 px-3 py-2 text-sm text-zinc-300 transition-colors hover:bg-surface-hover",children:[E===d?t.jsx(Nt,{className:"h-3.5 w-3.5 text-indigo-400"}):t.jsx("div",{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"flex-1 text-left",children:Ld[E]}),t.jsx("span",{className:"text-xs text-zinc-500 uppercase",children:E})]},E))})]})]})]})}const sj=[{to:"/",icon:Ss,labelKey:"nav.chat"},{to:"/agents",icon:Ya,labelKey:"nav.agents"},{to:"/dashboard",icon:Fd,labelKey:"nav.dashboard"},{to:"/runs",icon:kt,labelKey:"nav.history"},{to:"/settings",icon:Xn,labelKey:"nav.settings"}];function nj(){const{t:n}=nt();return t.jsx("nav",{className:"mobile-bottom-nav",children:sj.map(r=>{const d=r.icon;return t.jsxs(Zl,{to:r.to,end:r.to==="/",className:({isActive:c})=>`mobile-bottom-nav-item ${c?"active":""}`,children:[t.jsx(d,{className:"h-5 w-5"}),t.jsx("span",{className:"mobile-bottom-nav-label",children:n(r.labelKey)})]},r.to)})})}function lj(){const[n,r]=u.useState(!1),[d,c]=u.useState(!1);u.useEffect(()=>{const f=()=>c(window.innerWidth<769);return f(),window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const m=()=>{d&&r(!1)};return t.jsxs("div",{className:"flex min-h-screen bg-[#0a0a0f]",children:[d&&n&&t.jsx("div",{className:"sidebar-overlay",onClick:()=>r(!1)}),t.jsx("div",{className:`sidebar ${d&&n?"open":""}`,children:t.jsx(Vv,{onNavigate:m})}),t.jsxs("div",{className:`flex flex-1 flex-col ${d?"":"pl-60"}`,children:[t.jsx(aj,{onMenuClick:()=>r(!n),showMenu:d}),t.jsx("main",{className:`main-content flex-1 p-6 ${d?"pb-20":""}`,children:t.jsx(py,{})}),d&&t.jsx(nj,{})]})]})}class ij extends u.Component{constructor(){super(...arguments);ud(this,"state",{hasError:!1,error:null});ud(this,"handleReset",()=>{this.setState({hasError:!1,error:null})})}static getDerivedStateFromError(d){return{hasError:!0,error:d}}componentDidCatch(d,c){var m,f;console.error("[Nestor] UI Error:",d,c),(f=(m=this.props).onError)==null||f.call(m,d,c)}render(){var d;return this.state.hasError?this.props.fallback?this.props.fallback:t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] p-8",children:[t.jsx("div",{className:"text-red-500 text-xl mb-4",children:"Something went wrong"}),t.jsx("pre",{className:"bg-gray-100 dark:bg-gray-800 p-4 rounded-lg text-sm max-w-lg overflow-auto mb-4",children:(d=this.state.error)==null?void 0:d.message}),t.jsx("button",{onClick:this.handleReset,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Try Again"})]}):this.props.children}}function rj(){const n=Et();return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] p-8 text-center",children:[t.jsx("div",{className:"w-16 h-16 mb-6 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:t.jsx("svg",{className:"w-8 h-8 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),t.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Page Error"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-8 max-w-md",children:"An unexpected error occurred while rendering this page. The error has been logged for investigation."}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:"Reload Page"}),t.jsx("button",{onClick:()=>n("/"),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Go Home"})]})]})}const cj={node_started:{icon:kt,color:"text-blue-400"},node_completed:{icon:ft,color:"text-green-400"},node_failed:{icon:At,color:"text-red-400"},tool_call_requested:{icon:Ka,color:"text-amber-400"},tool_call_approved:{icon:ft,color:"text-green-400"},tool_call_denied:{icon:Na,color:"text-red-400"},tool_call_completed:{icon:ft,color:"text-emerald-400"},approval_requested:{icon:Na,color:"text-amber-400"},approval_resolved:{icon:ft,color:"text-green-400"},budget_warning:{icon:dt,color:"text-amber-400"},budget_exceeded:{icon:wa,color:"text-red-400"},run_paused:{icon:Yr,color:"text-blue-400"},run_resumed:{icon:y0,color:"text-blue-400"}};function oj(n){try{return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return n}}function dj(n,r){switch(n){case"node_started":return`Node started: ${r.nodeId??r.label??""}`;case"node_completed":return`Node completed: ${r.nodeId??r.label??""}`;case"node_failed":return`Node failed: ${r.error??r.nodeId??""}`;case"tool_call_requested":return`Tool call: ${r.toolName??""}`;case"tool_call_approved":return`Tool approved: ${r.toolName??""}`;case"tool_call_denied":return`Tool denied: ${r.toolName??""}`;case"tool_call_completed":return`Tool completed: ${r.toolName??""}`;case"approval_requested":return`Approval required: ${r.toolName??r.action??""}`;case"approval_resolved":return`Approval resolved: ${r.decision??""}`;case"budget_warning":return`Budget warning: ${r.percent??""}% used`;case"budget_exceeded":return"Budget exceeded";case"run_paused":return"Run paused";case"run_resumed":return"Run resumed";default:return n.replace(/_/g," ")}}function nu({events:n,maxHeight:r="400px"}){return n.length===0?t.jsxs("div",{className:"flex items-center justify-center py-8 text-sm text-zinc-500",children:[t.jsx(qn,{className:"mr-2 h-4 w-4"}),"Waiting for events..."]}):t.jsx("div",{className:"overflow-y-auto",style:{maxHeight:r},children:t.jsx("div",{className:"space-y-0.5",children:[...n].reverse().map(d=>{const c=cj[d.type]??{icon:Ka,color:"text-zinc-400"},m=c.icon;return t.jsxs("div",{className:"flex items-start gap-3 rounded-lg px-3 py-2 hover:bg-surface-hover transition-colors",children:[t.jsx("div",{className:`mt-0.5 flex-shrink-0 ${c.color}`,children:t.jsx(m,{className:"h-4 w-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm text-zinc-300 truncate",children:dj(d.type,d.data)}),d.nodeId&&t.jsxs("p",{className:"text-xs text-zinc-500 truncate",children:["Node: ",d.nodeId]})]}),t.jsx("time",{className:"flex-shrink-0 text-xs text-zinc-500",children:oj(d.timestamp)})]},d.id)})})})}function Cr({label:n,value:r,icon:d,color:c,bgColor:m}){return t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"mt-1 text-2xl font-semibold text-white",children:r})]}),t.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl ${m}`,children:t.jsx(d,{className:`h-5 w-5 ${c}`})})]})})}function uj(){const{t:n}=nt(),{events:r}=au(),[d,c]=u.useState(null),[m,f]=u.useState("healthy"),[h,b]=u.useState(!0),[g,p]=u.useState(null);u.useEffect(()=>{va.stats().then(z=>{c(z.data),f("healthy"),p(null)}).catch(z=>{f("down"),p(z instanceof Error?z.message:"Failed to connect to server")}).finally(()=>{b(!1)}),va.health().then(z=>{f(z.status==="healthy"?"healthy":"degraded")}).catch(()=>{f("down")})},[]),u.useEffect(()=>{r.length!==0&&va.stats().then(z=>c(z.data)).catch(()=>{})},[r.length]);const v={healthy:{icon:ft,color:"text-green-400",bg:"bg-green-500/10",label:"All systems operational"},degraded:{icon:dt,color:"text-amber-400",bg:"bg-amber-500/10",label:"Some services degraded"},down:{icon:At,color:"text-red-400",bg:"bg-red-500/10",label:"Services unavailable"}}[m],y=v.icon,k=r.map((z,N)=>{var S;return{id:String(N),type:typeof z.data=="object"&&z.data!==null&&"kind"in z.data?z.data.kind:z.channel,data:z.data??{},timestamp:((S=z.data)==null?void 0:S.timestamp)??new Date().toISOString()}});return h?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("dashboard.title")}),g&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:["Unable to connect to the Nestor server. Make sure the server is running.",t.jsx("span",{className:"ml-2 text-xs text-red-500/70",children:g})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(Cr,{label:n("dashboard.activeAgents"),value:(d==null?void 0:d.agents.total)??0,icon:Ya,color:"text-indigo-400",bgColor:"bg-indigo-500/10"}),t.jsx(Cr,{label:n("dashboard.runningTasks"),value:(d==null?void 0:d.runs.running)??0,icon:kt,color:"text-emerald-400",bgColor:"bg-emerald-500/10"}),t.jsx(Cr,{label:n("dashboard.costToday"),value:"$0.00",icon:wa,color:"text-amber-400",bgColor:"bg-amber-500/10"}),t.jsx(Cr,{label:n("dashboard.skillsInstalled"),value:(d==null?void 0:d.skills.total)??0,icon:Xr,color:"text-violet-400",bgColor:"bg-violet-500/10"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:[t.jsxs("div",{className:"card lg:col-span-2",children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:n("dashboard.recentActivity")}),t.jsx(Zt,{className:"h-4 w-4 text-zinc-500"})]}),t.jsx(nu,{events:k,maxHeight:"300px"})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:n("dashboard.quickActions")}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs(Ga,{to:"/agents",className:"btn-secondary w-full justify-start",children:[t.jsx(pt,{className:"h-4 w-4"}),n("dashboard.createAgent")]}),t.jsxs(Ga,{to:"/workflows",className:"btn-secondary w-full justify-start",children:[t.jsx($r,{className:"h-4 w-4"}),n("dashboard.runWorkflow")]}),t.jsxs(Ga,{to:"/skills",className:"btn-secondary w-full justify-start",children:[t.jsx(Wl,{className:"h-4 w-4"}),n("dashboard.installSkill")]})]})]}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:n("dashboard.systemHealth")}),t.jsxs("div",{className:`flex items-center gap-3 rounded-lg p-3 ${v.bg}`,children:[t.jsx(y,{className:`h-5 w-5 ${v.color}`}),t.jsxs("div",{children:[t.jsx("p",{className:`text-sm font-medium ${v.color}`,children:v.label}),t.jsx("p",{className:"text-xs text-zinc-500",children:d?`${d.agents.total} agents | ${d.workflows.total} workflows | ${d.runs.today} runs today`:"Loading..."})]})]}),(d==null?void 0:d.server)&&t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"Version"}),t.jsx("p",{className:"text-zinc-300 font-mono",children:d.server.version})]}),t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"Uptime"}),t.jsxs("p",{className:"text-zinc-300 font-mono",children:[Math.floor(d.server.uptime/3600),"h ",Math.floor(d.server.uptime%3600/60),"m"]})]}),t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"Memory (RSS)"}),t.jsxs("p",{className:"text-zinc-300 font-mono",children:[d.server.memoryUsage.rss," MB"]})]}),t.jsxs("div",{className:"rounded bg-[#0a0a0f] p-2",children:[t.jsx("span",{className:"text-zinc-500",children:"WS Connections"}),t.jsx("p",{className:"text-zinc-300 font-mono",children:d.websocket.connections})]})]})]})]})]})]})}function mj(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),h=u.useCallback(async()=>{c(!0),f(null);try{const b=await Cs.list({limit:200});r(b.data)}catch(b){f(b instanceof Error?b.message:"Failed to fetch agents")}finally{c(!1)}},[]);return u.useEffect(()=>{h()},[h]),{agents:n,loading:d,error:m,refetch:h}}function xj(n){const[r,d]=u.useState(null),[c,m]=u.useState(!0),[f,h]=u.useState(null),b=u.useCallback(async()=>{if(n){m(!0),h(null);try{const g=await Cs.get(n);d(g.data)}catch(g){h(g instanceof Error?g.message:"Failed to fetch agent")}finally{m(!1)}}},[n]);return u.useEffect(()=>{b()},[b]),{agent:r,loading:c,error:f,refetch:b}}const Mh={running:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"bg-emerald-400"},completed:{bg:"bg-green-500/10",text:"text-green-400",dot:"bg-green-400"},failed:{bg:"bg-red-500/10",text:"text-red-400",dot:"bg-red-400"},pending:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"bg-amber-400"},paused:{bg:"bg-blue-500/10",text:"text-blue-400",dot:"bg-blue-400"},cancelled:{bg:"bg-zinc-500/10",text:"text-zinc-400",dot:"bg-zinc-400"},idle:{bg:"bg-zinc-500/10",text:"text-zinc-500",dot:"bg-zinc-500"}};function ii({status:n,pulse:r}){const{t:d}=nt(),c=Mh[n]??Mh.idle;return t.jsxs("span",{className:`badge ${c.bg} ${c.text}`,children:[t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${c.dot} ${r&&n==="running"?"animate-pulse":""}`}),d(`status.${n}`)]})}const fj={builtin:{bg:"bg-indigo-500/10",text:"text-indigo-400"},official:{bg:"bg-blue-500/10",text:"text-blue-400"},trusted:{bg:"bg-emerald-500/10",text:"text-emerald-400"},community:{bg:"bg-amber-500/10",text:"text-amber-400"},local:{bg:"bg-zinc-500/10",text:"text-zinc-400"}};function lu({level:n}){const{t:r}=nt(),d=fj[n];return t.jsxs("span",{className:`badge ${d.bg} ${d.text}`,children:[n==="builtin"||n==="official"?t.jsx("svg",{className:"h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M6.267 3.455a3.066 3.066 0 001.745-.723 3.066 3.066 0 013.976 0 3.066 3.066 0 001.745.723 3.066 3.066 0 012.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 010 3.976 3.066 3.066 0 00-.723 1.745 3.066 3.066 0 01-2.812 2.812 3.066 3.066 0 00-1.745.723 3.066 3.066 0 01-3.976 0 3.066 3.066 0 00-1.745-.723 3.066 3.066 0 01-2.812-2.812 3.066 3.066 0 00-.723-1.745 3.066 3.066 0 010-3.976 3.066 3.066 0 00.723-1.745 3.066 3.066 0 012.812-2.812zm7.44 5.252a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}):null,r(`trust.${n}`)]})}function k0({spent:n,limit:r,currency:d="$"}){const c=r>0?Math.min(n/r*100,100):0,m=c>=75,f=c>=90,h=f?"bg-red-500":m?"bg-amber-500":"bg-indigo-500";return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsxs("span",{className:"text-zinc-400",children:[d,n.toFixed(2)," / ",d,r.toFixed(2)]}),t.jsxs("span",{className:`font-medium ${f?"text-red-400":m?"text-amber-400":"text-zinc-400"}`,children:[c.toFixed(0),"%"]})]}),t.jsx("div",{className:"h-1.5 w-full rounded-full bg-zinc-800",children:t.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${h}`,style:{width:`${c}%`}})})]})}const hj={anthropic:Ya,openai:Ya,local:cv};function pj({agent:n,status:r="idle",budgetSpent:d=0,budgetLimit:c=10}){const m=hj[n.adapterType]??Ya;return t.jsxs(Ga,{to:`/agents/${n.id}`,className:"card group hover:border-indigo-500/30 hover:bg-surface-hover transition-all duration-200",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-indigo-500/10 text-indigo-400 group-hover:bg-indigo-500/20 transition-colors",children:t.jsx(m,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200 group-hover:text-white transition-colors",children:n.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:[n.adapterType," ",n.adapterConfig.model?`/ ${n.adapterConfig.model}`:""]})]})]}),t.jsx(ii,{status:r,pulse:!0})]}),n.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:n.description}),t.jsx("div",{className:"mt-4 flex items-center justify-between",children:t.jsx(lu,{level:n.trustLevel})}),t.jsx("div",{className:"mt-3",children:t.jsx(k0,{spent:d,limit:c})})]})}function Js({icon:n,title:r,description:d,action:c}){return t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[t.jsx("div",{className:"mb-4 rounded-2xl bg-surface p-4 text-zinc-500",children:n??t.jsx(dv,{className:"h-8 w-8"})}),t.jsx("h3",{className:"text-lg font-medium text-zinc-300",children:r}),d&&t.jsx("p",{className:"mt-1.5 max-w-sm text-sm text-zinc-500",children:d}),c&&t.jsx("div",{className:"mt-4",children:c})]})}function gj(){const{t:n}=nt(),{agents:r,loading:d,error:c,refetch:m}=mj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,w]=u.useState({name:"",description:"",adapterType:"anthropic",model:"",trustLevel:"community"}),v=async()=>{if(p.name.trim()){g(!0);try{await Cs.create({name:p.name,description:p.description||void 0,adapterType:p.adapterType,adapterConfig:p.model?{model:p.model}:{},trustLevel:p.trustLevel}),h(!1),w({name:"",description:"",adapterType:"anthropic",model:"",trustLevel:"community"}),m()}catch(y){console.error("Failed to create agent:",y)}finally{g(!1)}}};return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("agents.title")}),t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(pt,{className:"h-4 w-4"}),n("agents.create")]})]}),c&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[c,t.jsx("button",{onClick:m,className:"ml-3 underline",children:"Retry"})]}),r.length===0&&!c?t.jsx(Js,{icon:t.jsx(Ya,{className:"h-8 w-8"}),title:n("agents.empty"),description:n("agents.emptyDesc"),action:t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(pt,{className:"h-4 w-4"}),n("agents.create")]})}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:r.map(y=>t.jsx(pj,{agent:y},y.id))}),f&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:n("agents.create")}),t.jsx("button",{onClick:()=>h(!1),className:"btn-ghost btn-sm",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.name")}),t.jsx("input",{className:"input",value:p.name,onChange:y=>w({...p,name:y.target.value}),placeholder:"My Agent"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.description")}),t.jsx("textarea",{className:"input min-h-[80px] resize-none",value:p.description,onChange:y=>w({...p,description:y.target.value}),placeholder:"What does this agent do?"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Adapter"}),t.jsxs("select",{className:"input",value:p.adapterType,onChange:y=>w({...p,adapterType:y.target.value}),children:[t.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),t.jsx("option",{value:"openai",children:"OpenAI (GPT)"}),t.jsx("option",{value:"gemini",children:"Google (Gemini)"}),t.jsx("option",{value:"grok",children:"xAI (Grok)"}),t.jsx("option",{value:"mistral",children:"Mistral AI"}),t.jsx("option",{value:"ollama",children:"Ollama (Local)"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Model"}),t.jsx("input",{className:"input",value:p.model,onChange:y=>w({...p,model:y.target.value}),placeholder:"claude-sonnet-4-20250514"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Trust Level"}),t.jsxs("select",{className:"input",value:p.trustLevel,onChange:y=>w({...p,trustLevel:y.target.value}),children:[t.jsx("option",{value:"builtin",children:"Built-in"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]})]}),t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>h(!1),className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:v,disabled:!p.name.trim()||b,className:"btn-primary",children:n(b?"common.loading":"agents.create")})]})]})})]})}const bj="/api";async function yj(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=localStorage.getItem("nestor_tenant_id");c&&(d["X-Tenant-ID"]=c);try{const m=await fetch(`${bj}/agents/${n}/quality`,{headers:d});return m.ok?(await m.json()).data??null:null}catch{return null}}function Dh(n){return`${(n*100).toFixed(0)}%`}function Ar({icon:n,label:r,value:d,subtext:c,color:m}){return t.jsxs("div",{className:"rounded-lg bg-zinc-800/50 p-4 border border-zinc-700/50",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx(n,{className:`h-4 w-4 ${m}`}),t.jsx("span",{className:"text-xs text-zinc-500 uppercase tracking-wide",children:r})]}),t.jsx("p",{className:`text-2xl font-bold ${m}`,children:d}),c&&t.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:c})]})}function vj({agentId:n}){const[r,d]=u.useState(null),[c,m]=u.useState(!0),f=u.useCallback(async()=>{m(!0);const N=await yj(n);d(N),m(!1)},[n]);if(u.useEffect(()=>{f()},[f]),c)return t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Quality"}),t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})})]});if(!r)return t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Quality"}),t.jsx("p",{className:"text-sm text-zinc-500",children:"No quality data available yet."})]});const h=r.satisfactionRate>=.8?"text-green-400":r.satisfactionRate>=.5?"text-yellow-400":"text-red-400",b=r.successRate>=.8?"text-green-400":r.successRate>=.5?"text-yellow-400":"text-red-400",g=r.recentFeedback.filter(N=>N.rating===1).length,p=r.recentFeedback.length,w=p>0?g/p:0,v=r.satisfactionRate,y=p<3?"stable":w>v+.1?"improving":w<v-.1?"declining":"stable",k=y==="improving"?tu:y==="declining"?Av:pv,z=y==="improving"?"text-green-400":y==="declining"?"text-red-400":"text-zinc-400";return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Quality"}),t.jsxs("div",{className:`flex items-center gap-1 text-xs ${z}`,children:[t.jsx(k,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"capitalize",children:y})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[t.jsx(Ar,{icon:ti,label:"Satisfaction",value:Dh(r.satisfactionRate),subtext:`${r.positiveFeedback}/${r.totalFeedback} positive`,color:h}),t.jsx(Ar,{icon:ft,label:"Success Rate",value:Dh(r.successRate),subtext:`${r.completedRuns} completed, ${r.failedRuns} failed`,color:b}),t.jsx(Ar,{icon:wa,label:"Avg Cost / Run",value:`$${r.avgCostPerRun.toFixed(4)}`,subtext:`${r.totalRuns} total runs`,color:"text-blue-400"}),t.jsx(Ar,{icon:ja,label:"Total Runs",value:r.totalRuns.toString(),subtext:`${r.totalFeedback} rated`,color:"text-indigo-400"})]}),r.recentFeedback.length>0&&t.jsxs("div",{className:"mt-4",children:[t.jsx("h3",{className:"text-xs font-medium text-zinc-500 uppercase tracking-wide mb-2",children:"Recent Feedback"}),t.jsx("div",{className:"space-y-1 max-h-40 overflow-y-auto",children:r.recentFeedback.slice(0,10).map((N,S)=>t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsx("span",{className:N.rating===1?"text-green-400":"text-red-400",children:N.rating===1?"+":"-"}),t.jsx("span",{className:"text-zinc-400 flex-1",children:N.comment??(N.rating===1?"Positive":"Negative")}),t.jsx("span",{className:"text-zinc-600 shrink-0",children:new Date(N.createdAt).toLocaleDateString()})]},S))})]})]})}function jj({event:n}){switch(n.type){case"tool_start":return t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-amber-500/20 bg-amber-500/5 px-3 py-1.5",children:[t.jsx(Zn,{className:"h-3.5 w-3.5 text-amber-400"}),t.jsx("span",{className:"text-xs text-amber-300 font-medium",children:n.name}),t.jsx(ht,{className:"h-3 w-3 text-amber-400 animate-spin"})]});case"tool_result":return t.jsxs("div",{className:`flex items-center gap-2 rounded-md border px-3 py-1.5 ${n.success?"border-emerald-500/20 bg-emerald-500/5":"border-red-500/20 bg-red-500/5"}`,children:[n.success?t.jsx(ft,{className:"h-3.5 w-3.5 text-emerald-400"}):t.jsx(At,{className:"h-3.5 w-3.5 text-red-400"}),t.jsxs("span",{className:`text-xs font-medium ${n.success?"text-emerald-300":"text-red-300"}`,children:[n.name," ",n.success?"completed":"failed"]})]});case"reasoning":return t.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-yellow-500/20 bg-yellow-500/5 px-3 py-1.5",children:[t.jsx(Md,{className:"h-3.5 w-3.5 text-yellow-400 mt-0.5 shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[n.phase&&t.jsx("span",{className:"text-[10px] uppercase text-yellow-600 font-mono",children:n.phase}),t.jsx("p",{className:"text-xs text-yellow-200/80 break-words",children:n.reasoning}),n.confidence!=null&&t.jsxs("span",{className:"text-[10px] text-yellow-600",children:["confidence: ",(n.confidence*100).toFixed(0),"%"]})]})]});case"error":return t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-1.5",children:[t.jsx(At,{className:"h-3.5 w-3.5 text-red-400"}),t.jsx("span",{className:"text-xs text-red-300",children:n.text})]});default:return null}}function Nj({runId:n,onComplete:r}){const[d,c]=u.useState(""),[m,f]=u.useState([]),[h,b]=u.useState(!0),g=u.useRef(null),p=u.useRef(0),{subscribe:w,unsubscribe:v,events:y,connected:k}=au([`run:${n}`]);return u.useEffect(()=>(k&&w(`run:${n}`),()=>{v(`run:${n}`)}),[k,n,w,v]),u.useEffect(()=>{for(const z of y){if(z.channel!==`run:${n}`)continue;const N=z.data;if(!N||N.runId!==n)continue;const S=N.type,C=++p.current;switch(S){case"token":c(O=>O+(N.text??""));break;case"tool_start":f(O=>[...O,{id:C,type:"tool_start",name:N.name,args:N.args,timestamp:Date.now()}]);break;case"tool_result":f(O=>[...O,{id:C,type:"tool_result",name:N.name,result:N.result,success:N.success,timestamp:Date.now()}]);break;case"reasoning":{const O=N.entry;f(D=>[...D,{id:C,type:"reasoning",reasoning:(O==null?void 0:O.reasoning)??N.reasoning??"",phase:(O==null?void 0:O.phase)??void 0,confidence:(O==null?void 0:O.confidence)??void 0,timestamp:Date.now()}]);break}case"error":f(O=>[...O,{id:C,type:"error",text:N.message,timestamp:Date.now()}]);break;case"done":b(!1),r==null||r();break}}},[y,n,r]),u.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[d]),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(b0,{className:`h-3.5 w-3.5 ${h?"text-green-400 animate-pulse":"text-zinc-500"}`}),t.jsx("span",{className:"text-xs font-medium text-zinc-400",children:h?"Live Output":"Run Completed"}),!k&&t.jsx("span",{className:"text-[10px] text-red-400 ml-auto",children:"Disconnected"})]}),t.jsx("div",{ref:g,className:"bg-gray-900 p-4 rounded-lg max-h-96 overflow-y-auto whitespace-pre-wrap font-mono text-sm text-zinc-200 border border-zinc-700",children:d||t.jsx("span",{className:"text-zinc-500 italic",children:h?"Waiting for output...":"No output produced."})}),m.length>0&&t.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:m.map(z=>t.jsx(jj,{event:z},z.id))})]})}function wj(){const{id:n}=Yn(),r=Et(),{t:d}=nt(),{agent:c,loading:m,error:f}=xj(n),[h,b]=u.useState("overview"),[g,p]=u.useState(""),[w,v]=u.useState(!1),[y,k]=u.useState(null);if(m)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(f||!c)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[t.jsx("p",{className:"text-red-400",children:f??"Agent not found"}),t.jsxs("button",{onClick:()=>r("/agents"),className:"btn-secondary mt-4",children:[t.jsx(Hn,{className:"h-4 w-4"})," Back to Agents"]})]});const z=async()=>{var C;if(!(!g.trim()||!n)){v(!0);try{const O=await Cs.run(n,g),D=((C=O==null?void 0:O.data)==null?void 0:C.id)??null;k(D),p("")}catch(O){console.error("Run failed:",O)}finally{v(!1)}}},N=async()=>{if(n&&window.confirm(`Delete agent "${c.name}"?`))try{await Cs.delete(n),r("/agents")}catch(C){console.error("Delete failed:",C)}},S=[{key:"overview",label:d("agent.overview"),icon:ja},{key:"quality",label:"Quality",icon:Zt},{key:"runs",label:d("agent.runs"),icon:kt},{key:"events",label:d("agent.events"),icon:Zt},{key:"configuration",label:d("agent.configuration"),icon:Xn}];return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{onClick:()=>r("/agents"),className:"btn-ghost btn-sm",children:t.jsx(Hn,{className:"h-4 w-4"})}),t.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-500/10 text-indigo-400",children:t.jsx(Ya,{className:"h-6 w-6"})}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:c.name}),t.jsx(ii,{status:"idle"})]}),t.jsxs("p",{className:"text-sm text-zinc-400",children:[c.adapterType,c.adapterConfig.model?` / ${c.adapterConfig.model}`:"",t.jsx("span",{className:"mx-2 text-zinc-600",children:"|"}),t.jsx(lu,{level:c.trustLevel})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(kt,{className:"h-3.5 w-3.5"})," ",d("agent.start")]}),t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(wv,{className:"h-3.5 w-3.5"})," ",d("agent.stop")]}),t.jsxs("button",{onClick:N,className:"btn-danger btn-sm",children:[t.jsx(Ut,{className:"h-3.5 w-3.5"})," ",d("agent.delete")]})]})]}),t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(v0,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{className:"input pl-9",placeholder:"Enter a prompt to run this agent...",value:g,onChange:C=>p(C.target.value),onKeyDown:C=>C.key==="Enter"&&z()})]}),t.jsxs("button",{onClick:z,disabled:!g.trim()||w,className:"btn-primary",children:[t.jsx(kt,{className:"h-4 w-4"}),d(w?"common.loading":"agent.run")]})]})}),y&&t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(b0,{className:"h-4 w-4 text-green-400 animate-pulse"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Live Output"}),t.jsxs("span",{className:"text-[10px] font-mono text-zinc-500",children:[y.slice(0,12),"..."]})]}),t.jsx("button",{onClick:()=>k(null),className:"text-xs text-zinc-500 hover:text-zinc-300 transition-colors",children:"Dismiss"})]}),t.jsx(Nj,{runId:y,onComplete:()=>{}})]}),t.jsx("div",{className:"flex gap-1 border-b border-border",children:S.map(({key:C,label:O,icon:D})=>t.jsxs("button",{onClick:()=>b(C),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${h===C?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(D,{className:"h-4 w-4"}),O]},C))}),h==="quality"&&n&&t.jsx(vj,{agentId:n}),h==="overview"&&t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("agent.budget")}),t.jsx(k0,{spent:0,limit:10}),t.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"rounded-lg bg-[#0a0a0f] p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Total Spent"}),t.jsx("p",{className:"text-lg font-semibold text-white",children:"$0.00"})]}),t.jsxs("div",{className:"rounded-lg bg-[#0a0a0f] p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Runs Today"}),t.jsx("p",{className:"text-lg font-semibold text-white",children:"0"})]})]})]}),t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("agent.recentRuns")}),t.jsx("p",{className:"text-sm text-zinc-500",children:"No runs recorded yet."})]}),c.description&&t.jsxs("div",{className:"card lg:col-span-2",children:[t.jsx("h3",{className:"mb-2 text-lg font-medium text-zinc-200",children:d("common.description")}),t.jsx("p",{className:"text-sm text-zinc-400",children:c.description})]})]}),h==="runs"&&t.jsx("div",{className:"card",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-left",children:[t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:"Run ID"}),t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:d("common.status")}),t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:d("run.duration")}),t.jsx("th",{className:"pb-3 pr-4 text-zinc-400 font-medium",children:"Cost"}),t.jsx("th",{className:"pb-3 text-zinc-400 font-medium",children:d("common.created")})]})}),t.jsx("tbody",{children:t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"py-8 text-center text-zinc-500",children:"No runs recorded for this agent."})})})]})})}),h==="events"&&t.jsx("div",{className:"card",children:t.jsx(nu,{events:[],maxHeight:"500px"})}),h==="configuration"&&t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Agent Configuration"}),t.jsx("pre",{className:"overflow-auto rounded-lg bg-[#0a0a0f] p-4 text-sm text-zinc-300",children:JSON.stringify(c,null,2)})]})]})}function Sj(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),h=u.useCallback(async()=>{c(!0),f(null);try{const b=await su.list({limit:200});r(b.data)}catch(b){f(b instanceof Error?b.message:"Failed to fetch workflows")}finally{c(!1)}},[]);return u.useEffect(()=>{h()},[h]),{workflows:n,loading:d,error:m,refetch:h}}function kj(n){const[r,d]=u.useState(null),[c,m]=u.useState(!0),[f,h]=u.useState(null),b=u.useCallback(async()=>{if(n){m(!0),h(null);try{const g=await su.get(n);d(g.data)}catch(g){h(g instanceof Error?g.message:"Failed to fetch workflow")}finally{m(!1)}}},[n]);return u.useEffect(()=>{b()},[b]),{workflow:r,loading:c,error:f,refetch:b}}function zj(){const{t:n}=nt(),{workflows:r,loading:d,error:c,refetch:m}=Sj(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,w]=u.useState({name:"",description:""}),v=async()=>{if(p.name.trim()){g(!0);try{const y={id:"start",type:"agent",label:"Start",config:{},next:[]};await su.create({name:p.name,description:p.description||void 0,nodes:[y],entryNodeId:"start"}),h(!1),w({name:"",description:""}),m()}catch(y){console.error("Failed to create workflow:",y)}finally{g(!1)}}};return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("workflows.title")}),t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(pt,{className:"h-4 w-4"}),n("workflows.create")]})]}),c&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[c,t.jsx("button",{onClick:m,className:"ml-3 underline",children:"Retry"})]}),r.length===0&&!c?t.jsx(Js,{icon:t.jsx($r,{className:"h-8 w-8"}),title:n("workflows.empty"),description:n("workflows.emptyDesc"),action:t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(pt,{className:"h-4 w-4"}),n("workflows.create")]})}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:r.map(y=>t.jsxs("div",{className:"card group hover:border-indigo-500/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-blue-500/10 text-blue-400",children:t.jsx($r,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:y.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["v",y.currentVersion]})]})]}),t.jsx(ii,{status:"idle"})]}),y.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:y.description}),t.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-zinc-500",children:[n("common.updated"),": ",new Date(y.updatedAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.jsx(Ga,{to:`/workflows/${y.id}/edit`,className:"btn-ghost btn-sm",children:t.jsx(Id,{className:"h-3.5 w-3.5"})}),t.jsx("button",{className:"btn-ghost btn-sm text-green-400",children:t.jsx(kt,{className:"h-3.5 w-3.5"})})]})]})]},y.id))}),f&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:n("workflows.create")}),t.jsx("button",{onClick:()=>h(!1),className:"btn-ghost btn-sm",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.name")}),t.jsx("input",{className:"input",value:p.name,onChange:y=>w({...p,name:y.target.value}),placeholder:"My Workflow"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.description")}),t.jsx("textarea",{className:"input min-h-[80px] resize-none",value:p.description,onChange:y=>w({...p,description:y.target.value}),placeholder:"What does this workflow do?"})]})]}),t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>h(!1),className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:v,disabled:!p.name.trim()||b,className:"btn-primary",children:n(b?"common.loading":"workflows.create")})]})]})})]})}const Oh={agent:"border-indigo-500 bg-indigo-500/10",tool:"border-emerald-500 bg-emerald-500/10",condition:"border-amber-500 bg-amber-500/10",parallel:"border-blue-500 bg-blue-500/10",loop:"border-violet-500 bg-violet-500/10",human:"border-rose-500 bg-rose-500/10"},Er={agent:"Agent",tool:"Tool",condition:"Condition",parallel:"Parallel",loop:"Loop",human:"Human"};function Cj(n,r){var g;const d=new Map;if(n.length===0)return d;const c=new Set,m=[],f=new Map,h=r??((g=n[0])==null?void 0:g.id);for(h&&m.push({id:h,depth:0,index:0});m.length>0;){const{id:p,depth:w}=m.shift();if(c.has(p))continue;c.add(p);const v=f.get(w)??0;f.set(w,v+1),d.set(p,{x:80+v*220,y:60+w*120});const y=n.find(k=>k.id===p);if(y)for(const k of y.next)c.has(k)||m.push({id:k,depth:w+1,index:0})}let b=(f.get(0)??0)*220+80;for(const p of n)c.has(p.id)||(d.set(p.id,{x:b,y:60}),b+=220);return d}function Aj(){const{id:n}=Yn(),r=Et(),{t:d}=nt(),{workflow:c,loading:m,error:f}=kj(n),[h,b]=u.useState([]),[g,p]=u.useState(),[w,v]=u.useState(null),[y,k]=u.useState(!1),[z,N]=u.useState({label:"",type:"agent"});u.useEffect(()=>{c!=null&&c.nodes&&(b(c.nodes),p(c.entryNodeId))},[c]);const S=u.useMemo(()=>Cj(h,g),[h,g]),C=Math.max(800,...Array.from(S.values()).map(B=>B.x+200)),O=Math.max(400,...Array.from(S.values()).map(B=>B.y+100)),D=u.useMemo(()=>{const B=[];for(const q of h){const I=S.get(q.id);if(I)for(const W of q.next){const Y=S.get(W);Y&&B.push({from:I,to:Y,fromId:q.id,toId:W})}}return B},[h,S]),E=u.useCallback(()=>{if(!z.label.trim())return;const B=`node_${Date.now()}`;b(q=>[...q,{id:B,type:z.type,label:z.label,config:{},next:[]}]),h.length===0&&p(B),N({label:"",type:"agent"}),k(!1)},[z,h.length]),ae=u.useCallback(B=>{var q;b(I=>I.filter(Y=>Y.id!==B).map(Y=>({...Y,next:Y.next.filter(le=>le!==B)}))),w===B&&v(null),g===B&&p((q=h.find(I=>I.id!==B))==null?void 0:q.id)},[w,g,h]),oe=h.find(B=>B.id===w);return m?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):f?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[t.jsx("p",{className:"text-red-400",children:f}),t.jsxs("button",{onClick:()=>r("/workflows"),className:"btn-secondary mt-4",children:[t.jsx(Hn,{className:"h-4 w-4"})," Back to Workflows"]})]}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:()=>r("/workflows"),className:"btn-ghost btn-sm",children:t.jsx(Hn,{className:"h-4 w-4"})}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:(c==null?void 0:c.name)??d("workflow.editor")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>k(!0),className:"btn-secondary btn-sm",children:[t.jsx(pt,{className:"h-3.5 w-3.5"})," ",d("workflow.addNode")]}),t.jsxs("button",{className:"btn-secondary btn-sm",children:[t.jsx(Qr,{className:"h-3.5 w-3.5"})," ",d("workflow.save")]}),t.jsxs("button",{className:"btn-primary btn-sm",children:[t.jsx(kt,{className:"h-3.5 w-3.5"})," ",d("workflow.run")]})]})]}),t.jsxs("div",{className:"flex gap-4",children:[t.jsxs("div",{className:"card flex-1 overflow-auto p-0",style:{minHeight:"500px"},children:[t.jsxs("svg",{width:C,height:O,className:"w-full",children:[D.map((B,q)=>{const I=B.from.x+80,W=B.from.y+40,Y=B.to.x+80,le=B.to.y,J=(W+le)/2;return t.jsx("path",{d:`M ${I} ${W} C ${I} ${J}, ${Y} ${J}, ${Y} ${le}`,fill:"none",stroke:"#2a2a35",strokeWidth:"2",markerEnd:"url(#arrowhead)"},q)}),t.jsx("defs",{children:t.jsx("marker",{id:"arrowhead",markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto",children:t.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:"#2a2a35"})})})]}),t.jsx("div",{className:"absolute inset-0",style:{width:C,height:O},children:h.map(B=>{const q=S.get(B.id);if(!q)return null;const I=B.id===g,W=B.id===w;return t.jsxs("div",{className:`absolute cursor-pointer rounded-lg border-2 px-4 py-2.5 text-sm transition-all ${Oh[B.type]} ${W?"ring-2 ring-indigo-500 ring-offset-2 ring-offset-[#0a0a0f]":""} ${I?"shadow-lg":""}`,style:{left:q.x,top:q.y,width:160},onClick:()=>v(B.id),children:[t.jsx("div",{className:"font-medium text-zinc-200 truncate",children:B.label}),t.jsx("div",{className:"text-xs text-zinc-500 mt-0.5",children:Er[B.type]}),I&&t.jsx("div",{className:"absolute -top-2 -right-2 h-4 w-4 rounded-full bg-indigo-500 border-2 border-[#0a0a0f]"})]},B.id)})}),h.length===0&&t.jsx("div",{className:"flex items-center justify-center h-full text-zinc-500 text-sm",children:"Add nodes to build your workflow DAG"})]}),oe&&t.jsxs("div",{className:"w-72 card space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:"Node Properties"}),t.jsx("button",{onClick:()=>v(null),className:"btn-ghost btn-sm",children:t.jsx(et,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Label"}),t.jsx("input",{className:"input",value:oe.label,onChange:B=>b(q=>q.map(I=>I.id===oe.id?{...I,label:B.target.value}:I))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:d("common.type")}),t.jsx("select",{className:"input",value:oe.type,onChange:B=>b(q=>q.map(I=>I.id===oe.id?{...I,type:B.target.value}:I)),children:Object.entries(Er).map(([B,q])=>t.jsx("option",{value:B,children:q},B))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Agent ID"}),t.jsx("input",{className:"input",value:oe.agentId??"",onChange:B=>b(q=>q.map(I=>I.id===oe.id?{...I,agentId:B.target.value||void 0}:I)),placeholder:"Optional agent ID"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Connect to"}),t.jsxs("select",{className:"input",value:"",onChange:B=>{B.target.value&&b(q=>q.map(I=>I.id===oe.id&&!I.next.includes(B.target.value)?{...I,next:[...I.next,B.target.value]}:I))},children:[t.jsx("option",{value:"",children:"Select a node..."}),h.filter(B=>B.id!==oe.id&&!oe.next.includes(B.id)).map(B=>t.jsx("option",{value:B.id,children:B.label},B.id))]}),oe.next.length>0&&t.jsx("div",{className:"mt-2 space-y-1",children:oe.next.map(B=>{const q=h.find(I=>I.id===B);return t.jsxs("div",{className:"flex items-center justify-between rounded bg-[#0a0a0f] px-2 py-1 text-xs",children:[t.jsx("span",{className:"text-zinc-400",children:(q==null?void 0:q.label)??B}),t.jsx("button",{onClick:()=>b(I=>I.map(W=>W.id===oe.id?{...W,next:W.next.filter(Y=>Y!==B)}:W)),className:"text-zinc-500 hover:text-red-400",children:t.jsx(et,{className:"h-3 w-3"})})]},B)})})]}),t.jsxs("button",{onClick:()=>ae(oe.id),className:"btn-danger w-full",children:[t.jsx(Ut,{className:"h-3.5 w-3.5"}),"Delete Node"]})]})]}),y&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:d("workflow.addNode")}),t.jsx("button",{onClick:()=>k(!1),className:"btn-ghost btn-sm",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Label"}),t.jsx("input",{className:"input",value:z.label,onChange:B=>N({...z,label:B.target.value}),placeholder:"Node label"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:d("common.type")}),t.jsx("div",{className:"grid grid-cols-3 gap-2",children:Object.keys(Er).map(B=>t.jsx("button",{onClick:()=>N({...z,type:B}),className:`rounded-lg border-2 p-2.5 text-center text-xs font-medium transition-colors ${z.type===B?Oh[B]:"border-border text-zinc-400 hover:border-zinc-600"}`,children:Er[B]},B))})]})]}),t.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>k(!1),className:"btn-secondary",children:d("common.cancel")}),t.jsx("button",{onClick:E,disabled:!z.label.trim(),className:"btn-primary",children:d("workflow.addNode")})]})]})})]})}function Ej(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),h=u.useCallback(async()=>{c(!0),f(null);try{const b=await Ur.list({limit:200});r(b.data)}catch(b){f(b instanceof Error?b.message:"Failed to fetch skills")}finally{c(!1)}},[]);return u.useEffect(()=>{h()},[h]),{skills:n,loading:d,error:m,refetch:h}}function Tj({skill:n,onDelete:r}){return t.jsxs("div",{className:"card group hover:border-indigo-500/30 transition-colors",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-violet-500/10 text-violet-400",children:t.jsx(Xr,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-medium text-zinc-200",children:n.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["v",n.version," by ",n.author]})]})]}),t.jsx(lu,{level:n.trustLevel})]}),n.description&&t.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:n.description}),t.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.tags.slice(0,3).map(d=>t.jsx("span",{className:"rounded-md bg-zinc-800 px-2 py-0.5 text-xs text-zinc-400",children:d},d)),n.tags.length>3&&t.jsxs("span",{className:"text-xs text-zinc-500",children:["+",n.tags.length-3]})]}),r&&t.jsx("button",{onClick:d=>{d.preventDefault(),r(n.id)},className:"btn-ghost btn-sm text-zinc-500 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Ut,{className:"h-3.5 w-3.5"})})]})]})}function Rj(){const{t:n}=nt(),{skills:r,loading:d,error:c,refetch:m}=Ej(),[f,h]=u.useState(!1),[b,g]=u.useState(!1),[p,w]=u.useState(""),[v,y]=u.useState({source:"",type:"local",name:"",trustLevel:"community"}),[k,z]=u.useState(null),N=async()=>{if(v.source.trim()){g(!0);try{await Ur.install({source:v.source,type:v.type,name:v.name||void 0,trustLevel:v.trustLevel}),h(!1),y({source:"",type:"local",name:"",trustLevel:"community"}),m()}catch(D){console.error("Failed to install skill:",D)}finally{g(!1)}}},S=async D=>{if(window.confirm("Remove this skill?"))try{await Ur.delete(D),m()}catch(E){console.error("Failed to delete skill:",E)}},C=async()=>{if(v.source.trim())try{const D=await Ur.scan(v.source);z(D)}catch(D){console.error("Scan failed:",D)}},O=r.filter(D=>!p||D.name.toLowerCase().includes(p.toLowerCase())||D.description.toLowerCase().includes(p.toLowerCase())||D.tags.some(E=>E.toLowerCase().includes(p.toLowerCase())));return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("skills.title")}),t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(pt,{className:"h-4 w-4"}),n("skills.install")]})]}),r.length>0&&t.jsxs("div",{className:"relative max-w-md",children:[t.jsx(ks,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",className:"input pl-9",placeholder:n("common.search"),value:p,onChange:D=>w(D.target.value)})]}),c&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[c,t.jsx("button",{onClick:m,className:"ml-3 underline",children:"Retry"})]}),r.length===0&&!c?t.jsx(Js,{icon:t.jsx(Xr,{className:"h-8 w-8"}),title:n("skills.empty"),description:n("skills.emptyDesc"),action:t.jsxs("button",{onClick:()=>h(!0),className:"btn-primary",children:[t.jsx(pt,{className:"h-4 w-4"}),n("skills.install")]})}):O.length===0?t.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:n("common.noResults")}):t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:O.map(D=>t.jsx(Tj,{skill:D,onDelete:S},D.id))}),f&&t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-5",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:n("skills.install")}),t.jsx("button",{onClick:()=>{h(!1),z(null)},className:"btn-ghost btn-sm",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("skills.source")}),t.jsx("input",{className:"input",value:v.source,onChange:D=>y({...v,source:D.target.value}),placeholder:"/path/to/skill or https://..."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:n("common.type")}),t.jsxs("select",{className:"input",value:v.type,onChange:D=>y({...v,type:D.target.value}),children:[t.jsx("option",{value:"local",children:"Local"}),t.jsx("option",{value:"npm",children:"NPM"}),t.jsx("option",{value:"git",children:"Git"}),t.jsx("option",{value:"url",children:"URL"})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"label",children:[n("common.name")," (optional)"]}),t.jsx("input",{className:"input",value:v.name,onChange:D=>y({...v,name:D.target.value}),placeholder:"my-skill"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Trust Level"}),t.jsxs("select",{className:"input",value:v.trustLevel,onChange:D=>y({...v,trustLevel:D.target.value}),children:[t.jsx("option",{value:"builtin",children:"Built-in"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]}),k&&t.jsxs("div",{className:"rounded-lg bg-[#0a0a0f] p-4",children:[t.jsx("h4",{className:"text-sm font-medium text-zinc-300 mb-2",children:"Scan Results"}),t.jsx("pre",{className:"text-xs text-zinc-400 overflow-auto max-h-40",children:JSON.stringify(k,null,2)})]})]}),t.jsxs("div",{className:"mt-6 flex justify-between",children:[t.jsxs("button",{onClick:C,disabled:!v.source.trim(),className:"btn-secondary",children:[t.jsx(ov,{className:"h-4 w-4"}),n("skills.scan")]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{h(!1),z(null)},className:"btn-secondary",children:n("common.cancel")}),t.jsx("button",{onClick:N,disabled:!v.source.trim()||b,className:"btn-primary",children:n(b?"common.loading":"skills.install")})]})]})]})})]})}function Mj(){const{t:n}=nt(),[r,d]=u.useState([]),[c,m]=u.useState(!0),[f,h]=u.useState(null),[b,g]=u.useState("all"),p=u.useCallback(async()=>{m(!0),h(null);try{const y={limit:100};b!=="all"&&(y.status=b);const k=await Qs.list(y);d(k.data)}catch(y){h(y instanceof Error?y.message:"Failed to fetch runs"),d([])}finally{m(!1)}},[b]);u.useEffect(()=>{p()},[p]);const w=async y=>{try{await Qs.abort(y),p()}catch(k){console.error("Abort failed:",k)}},v=async y=>{if(window.confirm("Delete this run record?"))try{await Qs.delete(y),d(k=>k.filter(z=>z.id!==y))}catch(k){console.error("Delete failed:",k)}};return c?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("runs.title")}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:p,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})}),t.jsx(g0,{className:"h-4 w-4 text-zinc-500"}),t.jsxs("select",{className:"input w-auto",value:b,onChange:y=>g(y.target.value),children:[t.jsx("option",{value:"all",children:"All Status"}),t.jsx("option",{value:"running",children:n("status.running")}),t.jsx("option",{value:"completed",children:n("status.completed")}),t.jsx("option",{value:"failed",children:n("status.failed")}),t.jsx("option",{value:"pending",children:n("status.pending")}),t.jsx("option",{value:"paused",children:n("status.paused")}),t.jsx("option",{value:"cancelled",children:n("status.cancelled")})]})]})]}),f&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[f,t.jsx("button",{onClick:p,className:"ml-3 underline",children:n("common.retry")})]}),r.length===0&&!f?t.jsx(Js,{icon:t.jsx(kt,{className:"h-8 w-8"}),title:n("runs.empty"),description:n("runs.emptyDesc")}):r.length>0?t.jsx("div",{className:"card overflow-hidden p-0",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:"Run ID"}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:"Workflow"}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:n("common.status")}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:"Started"}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:n("run.duration")}),t.jsx("th",{className:"px-5 py-3 text-left text-zinc-400 font-medium",children:n("common.actions")})]})}),t.jsx("tbody",{children:r.map(y=>{var z;const k=y.completedAt&&y.startedAt?Math.round((new Date(y.completedAt).getTime()-new Date(y.startedAt).getTime())/1e3):null;return t.jsxs("tr",{className:"border-b border-border hover:bg-surface-hover transition-colors",children:[t.jsx("td",{className:"px-5 py-3",children:t.jsxs(Ga,{to:`/runs/${y.id}`,className:"text-indigo-400 hover:text-indigo-300 font-mono text-xs",children:[y.id.slice(0,8),"..."]})}),t.jsxs("td",{className:"px-5 py-3 text-zinc-300 font-mono text-xs",children:[((z=y.workflowId)==null?void 0:z.slice(0,8))??"—","..."]}),t.jsx("td",{className:"px-5 py-3",children:t.jsx(ii,{status:y.status,pulse:!0})}),t.jsx("td",{className:"px-5 py-3 text-zinc-400 text-xs",children:new Date(y.startedAt).toLocaleString()}),t.jsx("td",{className:"px-5 py-3 text-zinc-400 text-xs",children:k!==null?`${k}s`:"—"}),t.jsx("td",{className:"px-5 py-3",children:t.jsxs("div",{className:"flex gap-1",children:[(y.status==="running"||y.status==="pending")&&t.jsx("button",{onClick:()=>w(y.id),className:"btn-ghost btn-sm text-amber-400",title:"Abort run",children:t.jsx(h0,{className:"h-3.5 w-3.5"})}),(y.status==="completed"||y.status==="failed"||y.status==="cancelled")&&t.jsx("button",{onClick:()=>v(y.id),className:"btn-ghost btn-sm text-zinc-400 hover:text-red-400",title:"Delete run",children:t.jsx(Ut,{className:"h-3.5 w-3.5"})})]})})]},y.id)})})]})})}):null]})}const z0="/api";async function Dj(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=localStorage.getItem("nestor_tenant_id");c&&(d["X-Tenant-ID"]=c);const m=await fetch(`${z0}/runs/${n}/feedback`,{headers:d});return m.ok?(await m.json()).data??[]:[]}async function Lh(n,r,d,c){const m=localStorage.getItem("nestor_token"),f={"Content-Type":"application/json"};m&&(f.Authorization=`Bearer ${m}`);const h=localStorage.getItem("nestor_tenant_id");h&&(f["X-Tenant-ID"]=h),await fetch(`${z0}/runs/${n}/feedback`,{method:"POST",headers:f,body:JSON.stringify({rating:r,comment:d||void 0,agentId:c})})}function Oj({runId:n,agentId:r}){const[d,c]=u.useState([]),[m,f]=u.useState(!1),[h,b]=u.useState(null),[g,p]=u.useState(""),[w,v]=u.useState(!1),y=u.useCallback(async()=>{const N=await Dj(n);c(N),N.length>0&&(f(!0),b(N[0].rating))},[n]);u.useEffect(()=>{y()},[y]);const k=async N=>{m||(b(N),N===1?(await Lh(n,N,void 0,r),f(!0),y()):v(!0))},z=async()=>{h!==null&&(await Lh(n,h,g||void 0,r),f(!0),v(!1),y())};return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-400",children:"Was this helpful?"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>k(1),disabled:m,className:`rounded-lg p-2 transition-colors ${h===1?"bg-green-500/20 text-green-400":m?"text-zinc-600 cursor-not-allowed":"text-zinc-400 hover:bg-green-500/10 hover:text-green-400"}`,title:"Helpful",children:t.jsx(ti,{className:"h-5 w-5"})}),t.jsx("button",{onClick:()=>k(-1),disabled:m,className:`rounded-lg p-2 transition-colors ${h===-1?"bg-red-500/20 text-red-400":m?"text-zinc-600 cursor-not-allowed":"text-zinc-400 hover:bg-red-500/10 hover:text-red-400"}`,title:"Not helpful",children:t.jsx(Od,{className:"h-5 w-5"})})]})]}),w&&!m&&t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsx("input",{type:"text",value:g,onChange:N=>p(N.target.value),placeholder:"What could be improved? (optional)",className:"flex-1 rounded-lg bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 border border-zinc-700 focus:border-indigo-500 focus:outline-none",onKeyDown:N=>{N.key==="Enter"&&z()}}),t.jsx("button",{onClick:z,className:"rounded-lg bg-indigo-600 px-3 py-2 text-sm text-white hover:bg-indigo-500 transition-colors",children:t.jsx(Pd,{className:"h-4 w-4"})})]}),m&&t.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:[h===1?"Thanks for the positive feedback!":"Thanks for your feedback.",d.length>0&&d[0].comment&&t.jsxs("span",{className:"text-zinc-600",children:[" — “",d[0].comment,"”"]})]})]})}const Lj={llm_request:{icon:ws,color:"text-purple-400",bgColor:"bg-purple-500/10",label:"LLM Request"},llm_response:{icon:Ss,color:"text-blue-400",bgColor:"bg-blue-500/10",label:"LLM Response"},tool_call_requested:{icon:Zn,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Tool Call"},tool_call_completed:{icon:ft,color:"text-emerald-400",bgColor:"bg-emerald-500/10",label:"Tool Result"},tool_call_denied:{icon:At,color:"text-red-400",bgColor:"bg-red-500/10",label:"Tool Denied"},node_started:{icon:kt,color:"text-blue-400",bgColor:"bg-blue-500/10",label:"Step Started"},node_completed:{icon:ft,color:"text-green-400",bgColor:"bg-green-500/10",label:"Step Completed"},node_failed:{icon:At,color:"text-red-400",bgColor:"bg-red-500/10",label:"Step Failed"},thinking:{icon:Md,color:"text-yellow-400",bgColor:"bg-yellow-500/10",label:"Thinking"},reasoning:{icon:Md,color:"text-yellow-400",bgColor:"bg-yellow-500/10",label:"Reasoning"},approval_requested:{icon:Na,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Approval Requested"},budget_warning:{icon:dt,color:"text-amber-400",bgColor:"bg-amber-500/10",label:"Budget Warning"},budget_exceeded:{icon:wa,color:"text-red-400",bgColor:"bg-red-500/10",label:"Budget Exceeded"},error:{icon:dt,color:"text-red-400",bgColor:"bg-red-500/10",label:"Error"}},_j={icon:kt,color:"text-zinc-400",bgColor:"bg-zinc-500/10",label:"Event"};function Uj(n){try{return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}catch{return n}}function _h(n,r){try{return new Date(r).getTime()-new Date(n).getTime()}catch{return 0}}function Bj(n){return n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`}function $j(n){const r=n.data;if(!r)return"";if(typeof r.reasoning=="string")return r.reasoning;if(typeof r.content=="string")return r.content;if(typeof r.text=="string")return r.text;if(typeof r.output=="string")return r.output;if(typeof r.prompt=="string")return r.prompt;if(typeof r.error=="string")return r.error;if(typeof r.tool=="string"){const c=r.args?` (${JSON.stringify(r.args).slice(0,120)})`:"";return`${r.tool}${c}`}const d=JSON.stringify(r,null,2);return d.length>300?d.slice(0,300)+"...":d}function Hj(n,r){let d=0;for(let c=0;c<=r&&c<n.length;c++){const m=n[c].data;typeof m.estimatedCostUsd=="number"?d=m.estimatedCostUsd:typeof m.cost=="number"&&(d+=m.cost)}return d}function qj({runId:n}){const[r,d]=u.useState([]),[c,m]=u.useState(!0),[f,h]=u.useState(null),[b,g]=u.useState(-1),[p,w]=u.useState(!1),[v,y]=u.useState(1),k=u.useRef(null),z=u.useRef(null),N=u.useRef(new Map);u.useEffect(()=>{let W=!1;return m(!0),h(null),Qs.getEvents(n).then(Y=>{W||d(Y.data.sort((le,J)=>new Date(le.timestamp).getTime()-new Date(J.timestamp).getTime()))}).catch(Y=>{W||h(Y instanceof Error?Y.message:"Failed to load events")}).finally(()=>{W||m(!1)}),()=>{W=!0}},[n]);const S=u.useCallback(()=>{w(!1),k.current&&(clearTimeout(k.current),k.current=null)},[]),C=u.useCallback(()=>{g(W=>{const Y=W+1;if(Y>=r.length)return S(),W;const le=r[W]??r[0],J=r[Y];if(le&&J){const ce=_h(le.timestamp,J.timestamp),he=Math.max(50,Math.min(ce/v,2e3/v));k.current=setTimeout(C,he)}return Y})},[r,v,S]),O=u.useCallback(()=>{r.length!==0&&(w(!0),g(W=>{const Y=W>=r.length-1?0:W,le=300/v;return k.current=setTimeout(C,le),Y}))},[r,v,C]),D=u.useCallback(()=>{p?S():O()},[p,S,O]),E=u.useCallback(()=>{S(),g(W=>Math.min(W+1,r.length-1))},[r.length,S]),ae=u.useCallback(()=>{S(),g(W=>Math.max(W-1,0))},[S]),oe=u.useCallback(W=>{S(),g(W)},[S]),B=u.useCallback(()=>{y(W=>{const Y=[1,2,4,8],le=Y.indexOf(W);return Y[(le+1)%Y.length]})},[]);if(u.useEffect(()=>{if(b>=0){const W=N.current.get(b);W==null||W.scrollIntoView({behavior:"smooth",block:"nearest"})}},[b]),u.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),c)return t.jsxs("div",{className:"flex items-center justify-center py-12",children:[t.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"}),t.jsx("span",{className:"ml-3 text-sm text-zinc-400",children:"Loading events..."})]});if(f)return t.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4",children:t.jsx("p",{className:"text-sm text-red-400",children:f})});if(r.length===0)return t.jsx("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 p-6 text-center",children:t.jsx("p",{className:"text-sm text-zinc-500",children:"No events recorded for this run."})});const q=r.length>0?(b+1)/r.length*100:0,I=b>=0?Hj(r,b):0;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-700 bg-zinc-800/80 px-4 py-3",children:[t.jsx("button",{onClick:ae,disabled:b<=0,className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Step backward",children:t.jsx(jv,{className:"h-4 w-4"})}),t.jsx("button",{onClick:D,className:"flex h-9 w-9 items-center justify-center rounded-full bg-indigo-600 text-white transition-colors hover:bg-indigo-500",title:p?"Pause":"Play",children:p?t.jsx(Yr,{className:"h-4 w-4"}):t.jsx(kt,{className:"h-4 w-4 ml-0.5"})}),t.jsx("button",{onClick:E,disabled:b>=r.length-1,className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Step forward",children:t.jsx(Nv,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:B,className:"rounded border border-zinc-600 px-2 py-1 text-xs font-mono text-zinc-300 transition-colors hover:bg-zinc-700",title:"Cycle playback speed",children:[v,"x"]}),t.jsx("div",{className:"flex-1 mx-2",children:t.jsxs("div",{className:"relative h-2 rounded-full bg-zinc-700 cursor-pointer",onClick:W=>{const Y=W.currentTarget.getBoundingClientRect(),le=(W.clientX-Y.left)/Y.width,J=Math.round(le*(r.length-1));oe(Math.max(0,Math.min(J,r.length-1)))},children:[t.jsx("div",{className:"absolute top-0 left-0 h-full rounded-full bg-indigo-500 transition-all duration-150",style:{width:`${q}%`}}),t.jsx("div",{className:"absolute top-1/2 -translate-y-1/2 h-3.5 w-3.5 rounded-full border-2 border-indigo-400 bg-zinc-900 transition-all duration-150",style:{left:`calc(${q}% - 7px)`}})]})}),t.jsxs("span",{className:"text-xs font-mono text-zinc-500 whitespace-nowrap",children:[b+1," / ",r.length]}),I>0&&t.jsxs("span",{className:"flex items-center gap-1 text-xs font-mono text-amber-400 whitespace-nowrap",children:[t.jsx(wa,{className:"h-3 w-3"}),I.toFixed(4)]})]}),t.jsx("div",{ref:z,className:"max-h-[600px] overflow-y-auto rounded-lg border border-zinc-700 bg-zinc-900/50",children:t.jsx("div",{className:"divide-y divide-zinc-800",children:r.map((W,Y)=>{const le=Lj[W.type]??_j,J=le.icon,ce=Y===b,he=b<0||Y<=b,G=$j(W),ie=Y>0?_h(r[Y-1].timestamp,W.timestamp):0;return t.jsxs("div",{ref:me=>{me&&N.current.set(Y,me)},className:`
576
+ flex items-start gap-3 px-4 py-3 cursor-pointer transition-all duration-200
577
+ ${ce?"bg-indigo-500/10 border-l-2 border-l-indigo-500":"border-l-2 border-l-transparent"}
578
+ ${he?"opacity-100":"opacity-30"}
579
+ hover:bg-zinc-800/50
580
+ `,onClick:()=>oe(Y),children:[t.jsx("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded text-[10px] font-mono text-zinc-600",children:Y+1}),t.jsx("div",{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg ${le.bgColor}`,children:t.jsx(J,{className:`h-3.5 w-3.5 ${le.color}`})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`text-xs font-medium ${le.color}`,children:le.label}),t.jsx("span",{className:"text-[10px] font-mono text-zinc-600",children:Uj(W.timestamp)}),ie>0&&t.jsxs("span",{className:"text-[10px] text-zinc-600",children:["+",Bj(ie)]})]}),G&&he&&t.jsx("pre",{className:`mt-1 text-xs whitespace-pre-wrap break-words ${ce?"text-zinc-200":"text-zinc-500"} max-h-40 overflow-hidden`,children:G.length>500?G.slice(0,500)+"...":G})]}),ce&&t.jsx(ra,{className:"mt-1.5 h-3.5 w-3.5 shrink-0 text-indigo-400"})]},W.id)})})})]})}function Gj(){const{id:n}=Yn(),r=Et(),{t:d}=nt(),[c,m]=u.useState(null),[f,h]=u.useState([]),[b,g]=u.useState([]),[p,w]=u.useState([]),[v,y]=u.useState(!0),[k,z]=u.useState(null),[N,S]=u.useState(null),[C,O]=u.useState(""),[D,E]=u.useState("details"),ae=u.useCallback(async()=>{if(n)try{const J=await Qs.get(n);m(J.data)}catch(J){z(J instanceof Error?J.message:"Failed to load run")}},[n]),oe=u.useCallback(async()=>{if(n)try{const J=await Qs.getEvents(n);h(J.data)}catch{}},[n]),B=u.useCallback(async()=>{if(n)try{const J=await Sd.forRun(n);g(J.data)}catch{}},[n]),q=u.useCallback(async()=>{if(n)try{const J=await Hr.list();w(J.data.filter(ce=>ce.runId===n))}catch{}},[n]);u.useEffect(()=>{n&&(y(!0),z(null),Promise.all([ae(),oe(),B(),q()]).finally(()=>{y(!1)}))},[n,ae,oe,B,q]),u.useEffect(()=>{if(!c||c.status==="completed"||c.status==="failed"||c.status==="cancelled")return;const J=setInterval(()=>{ae(),oe()},3e3);return()=>clearInterval(J)},[c==null?void 0:c.status,ae,oe]);const I=async()=>{if(n)try{await Qs.abort(n),ae()}catch(J){console.error("Abort failed:",J)}};if(v)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(k||!c)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-20",children:[t.jsx("p",{className:"text-red-400",children:k??"Run not found"}),t.jsxs("button",{onClick:()=>r("/runs"),className:"btn-secondary mt-4",children:[t.jsx(Hn,{className:"h-4 w-4"})," Back to Runs"]})]});const W=c.completedAt&&c.startedAt?Math.round((new Date(c.completedAt).getTime()-new Date(c.startedAt).getTime())/1e3):null,Y=c.status==="completed"?t.jsx(ft,{className:"h-5 w-5 text-green-400"}):c.status==="failed"?t.jsx(At,{className:"h-5 w-5 text-red-400"}):t.jsx(kt,{className:"h-5 w-5 text-blue-400"}),le=c.status==="running"||c.status==="pending";return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("button",{onClick:()=>r("/runs"),className:"btn-ghost btn-sm",children:t.jsx(Hn,{className:"h-4 w-4"})}),t.jsxs("div",{className:"flex items-center gap-3",children:[Y,t.jsxs("div",{children:[t.jsxs("h1",{className:"text-2xl font-semibold text-white",children:["Run ",t.jsxs("span",{className:"font-mono text-lg text-zinc-400",children:[c.id.slice(0,12),"..."]})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsx(ii,{status:c.status,pulse:!0}),t.jsxs("span",{className:"text-xs text-zinc-500",children:["Started: ",new Date(c.startedAt).toLocaleString()]})]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>{ae(),oe()},className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-3.5 w-3.5"})}),le&&t.jsxs("button",{onClick:I,className:"btn-danger btn-sm",children:[t.jsx(h0,{className:"h-3.5 w-3.5"})," Abort"]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/10",children:t.jsx(kv,{className:"h-4 w-4 text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:d("run.duration")}),t.jsx("p",{className:"text-lg font-semibold text-white",children:W!==null?`${W}s`:"In progress..."})]})]})}),t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-amber-500/10",children:t.jsx(wa,{className:"h-4 w-4 text-amber-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:d("run.cost")}),t.jsx("p",{className:"text-lg font-semibold text-white",children:"$0.00"})]})]})}),t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-violet-500/10",children:t.jsx(qn,{className:"h-4 w-4 text-violet-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Events"}),t.jsx("p",{className:"text-lg font-semibold text-white",children:f.length})]})]})})]}),t.jsxs("div",{className:"flex items-center gap-1 border-b border-zinc-700",children:[t.jsx("button",{onClick:()=>E("details"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${D==="details"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:"Details"}),t.jsxs("button",{onClick:()=>E("replay"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors flex items-center gap-1.5 ${D==="replay"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:[t.jsx(kt,{className:"h-3.5 w-3.5"}),"Replay"]})]}),D==="replay"&&t.jsx(qj,{runId:n}),D==="details"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsx(Oj,{runId:n}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("run.events")}),t.jsx(nu,{events:f,maxHeight:"500px"})]}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:d("run.output")}),c.output?t.jsx("pre",{className:"overflow-auto rounded-lg bg-[#0a0a0f] p-4 text-sm text-zinc-300 max-h-64",children:JSON.stringify(c.output,null,2)}):t.jsx("p",{className:"text-sm text-zinc-500",children:"No output available yet."})]}),c.error&&t.jsxs("div",{className:"card border-red-500/20",children:[t.jsx("h2",{className:"mb-2 text-lg font-medium text-red-400",children:"Error"}),t.jsx("pre",{className:"overflow-auto rounded-lg bg-red-500/5 p-4 text-sm text-red-300",children:c.error})]}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"mb-4 text-lg font-medium text-zinc-200",children:"Input"}),t.jsx("pre",{className:"overflow-auto rounded-lg bg-[#0a0a0f] p-4 text-sm text-zinc-300 max-h-40",children:JSON.stringify(c.input,null,2)})]})]})]}),p.filter(J=>J.status==="pending").map(J=>t.jsxs("div",{className:"card border-amber-500/30 bg-amber-500/5",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.jsx(Pl,{className:"h-5 w-5 text-amber-400"}),t.jsx("h2",{className:"text-lg font-semibold text-amber-300",children:"Handoff Pending"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Accomplished"}),t.jsx("p",{className:"text-zinc-300",children:J.accomplished})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Blocking"}),t.jsx("p",{className:"text-red-400",children:J.blocking})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1",children:"Suggestions"}),t.jsx("p",{className:"text-zinc-300",children:J.suggestions})]})]}),t.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[t.jsx("input",{type:"text",className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-indigo-500 focus:outline-none",placeholder:"Describe how you resolved the blocking issue...",value:C,onChange:ce=>O(ce.target.value)}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!C.trim(),onClick:async()=>{try{await Hr.resume(J.id,C),O(""),q()}catch(ce){console.error("Resume failed:",ce)}},children:"Resume"})]})]},J.id)),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Annotations"}),t.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>S(N?null:{type:"note",content:""}),children:N?"Cancel":"+ Add"})]}),N&&t.jsxs("div",{className:"mb-4 rounded-lg border border-zinc-700 p-3 space-y-2",children:[t.jsx("div",{className:"flex gap-2",children:["good","bad","wrong_approach","note"].map(J=>{const ce={good:t.jsx(ti,{className:"h-3.5 w-3.5"}),bad:t.jsx(Od,{className:"h-3.5 w-3.5"}),wrong_approach:t.jsx(Ch,{className:"h-3.5 w-3.5"}),note:t.jsx(Ss,{className:"h-3.5 w-3.5"})},he={good:"text-green-400 border-green-500/30",bad:"text-red-400 border-red-500/30",wrong_approach:"text-amber-400 border-amber-500/30",note:"text-blue-400 border-blue-500/30"};return t.jsxs("button",{className:`flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs ${N.type===J?he[J]+" bg-zinc-800":"border-zinc-700 text-zinc-500 hover:text-zinc-300"}`,onClick:()=>S({...N,type:J}),children:[ce[J]," ",J.replace("_"," ")]},J)})}),t.jsx("textarea",{className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-indigo-500 focus:outline-none",rows:2,placeholder:"Add your annotation...",value:N.content,onChange:J=>S({...N,content:J.target.value})}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!N.content.trim(),onClick:async()=>{if(!(!n||!N.content.trim()))try{await Sd.create(n,{type:N.type,content:N.content}),S(null),B()}catch(J){console.error("Failed to add annotation:",J)}},children:"Save Annotation"})]}),b.length===0?t.jsx("p",{className:"text-sm text-zinc-500",children:"No annotations yet."}):t.jsx("div",{className:"space-y-2",children:b.map(J=>{const ce={good:"border-green-500/30 bg-green-500/5",bad:"border-red-500/30 bg-red-500/5",wrong_approach:"border-amber-500/30 bg-amber-500/5",note:"border-blue-500/30 bg-blue-500/5",handoff:"border-purple-500/30 bg-purple-500/5"},he={good:t.jsx(ti,{className:"h-3.5 w-3.5 text-green-400"}),bad:t.jsx(Od,{className:"h-3.5 w-3.5 text-red-400"}),wrong_approach:t.jsx(Ch,{className:"h-3.5 w-3.5 text-amber-400"}),note:t.jsx(Ss,{className:"h-3.5 w-3.5 text-blue-400"}),handoff:t.jsx(Pl,{className:"h-3.5 w-3.5 text-purple-400"})};return t.jsxs("div",{className:`flex items-start gap-2 rounded-lg border p-2 text-sm ${ce[J.type]??"border-zinc-700"}`,children:[t.jsx("span",{className:"mt-0.5",children:he[J.type]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-zinc-300",children:J.content}),t.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[J.author," · ",new Date(J.createdAt).toLocaleString(),J.eventIndex!=null&&` &middot; Event #${J.eventIndex}`]})]}),t.jsx("button",{className:"text-zinc-600 hover:text-red-400 transition-colors",title:"Delete annotation",onClick:async()=>{try{await Sd.delete(J.id),B()}catch(G){console.error("Delete failed:",G)}},children:t.jsx(At,{className:"h-3.5 w-3.5"})})]},J.id)})})]})]})]})}function Kj(){const{t:n}=nt(),[r,d]=u.useState("general"),[c,m]=u.useState(null),[f,h]=u.useState(!0),[b,g]=u.useState(!1),[p,w]=u.useState(!1),[v,y]=u.useState(null);u.useEffect(()=>{va.getConfig().then(C=>m(C.data)).catch(()=>{m({server:{host:"127.0.0.1",port:3100},security:{defaultTrustLevel:"community",approvalMode:"manual",maxConcurrentRuns:10},budget:{enabled:!1,defaultMaxCostPerRunUsd:1,defaultMaxTokensPerRun:1e5,warningThresholdPercent:80},logging:{level:"info",format:"pretty"}})}).finally(()=>h(!1))},[]);const k=async()=>{if(c){g(!0),w(!1),y(null);try{const C=await va.updateConfig(c);m(C.data),w(!0),setTimeout(()=>w(!1),3e3)}catch(C){y(C instanceof Error?C.message:"Failed to save")}finally{g(!1)}}},z=async()=>{h(!0);try{const C=await va.getConfig();m(C.data),y(null)}catch{y("Failed to refresh config")}finally{h(!1)}},N=(C,O,D)=>{c&&m({...c,[C]:{...c[C],[O]:D}})},S=[{key:"general",label:n("settings.general")},{key:"security",label:n("settings.security")},{key:"budget",label:n("settings.budget")},{key:"apikeys",label:"API Keys"},{key:"studio",label:"Studio"}];return f?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):c?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("settings.title")}),t.jsxs("div",{className:"flex items-center gap-3",children:[p&&t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-green-400",children:[t.jsx(Nt,{className:"h-4 w-4"}),n("settings.saved")]}),v&&t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-red-400",children:[t.jsx(Il,{className:"h-4 w-4"}),v]}),t.jsx("button",{onClick:z,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:k,disabled:b,className:"btn-primary",children:[t.jsx(Qr,{className:"h-4 w-4"}),n(b?"common.loading":"settings.save")]})]})]}),t.jsx("div",{className:"flex gap-1 border-b border-border",children:S.map(({key:C,label:O})=>t.jsx("button",{onClick:()=>d(C),className:`px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${r===C?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:O},C))}),r==="general"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Server Configuration"}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Host"}),t.jsx("input",{className:"input",value:c.server.host,onChange:C=>N("server","host",C.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Port"}),t.jsx("input",{className:"input",type:"number",value:c.server.port,onChange:C=>N("server","port",parseInt(C.target.value)||3100)})]})]}),t.jsx("h2",{className:"text-lg font-medium text-zinc-200 pt-4",children:"Logging"}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Level"}),t.jsxs("select",{className:"input",value:c.logging.level,onChange:C=>N("logging","level",C.target.value),children:[t.jsx("option",{value:"debug",children:"Debug"}),t.jsx("option",{value:"info",children:"Info"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"error",children:"Error"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Format"}),t.jsxs("select",{className:"input",value:c.logging.format,onChange:C=>N("logging","format",C.target.value),children:[t.jsx("option",{value:"json",children:"JSON"}),t.jsx("option",{value:"pretty",children:"Pretty"})]})]})]})]}),r==="security"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Security Settings"}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Trust Level"}),t.jsxs("select",{className:"input",value:c.security.defaultTrustLevel,onChange:C=>N("security","defaultTrustLevel",C.target.value),children:[t.jsx("option",{value:"builtin",children:"Built-in"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Approval Mode"}),t.jsxs("select",{className:"input",value:c.security.approvalMode,onChange:C=>N("security","approvalMode",C.target.value),children:[t.jsx("option",{value:"manual",children:"Manual"}),t.jsx("option",{value:"smart",children:"Smart"}),t.jsx("option",{value:"off",children:"Off"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Concurrent Runs"}),t.jsx("input",{className:"input",type:"number",value:c.security.maxConcurrentRuns,onChange:C=>N("security","maxConcurrentRuns",parseInt(C.target.value)||10)})]})]})]}),r==="budget"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Budget Configuration"}),t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[t.jsx("input",{type:"checkbox",checked:c.budget.enabled,onChange:C=>N("budget","enabled",C.target.checked),className:"peer sr-only"}),t.jsx("div",{className:"h-6 w-11 rounded-full bg-zinc-700 after:absolute after:left-[2px] after:top-0.5 after:h-5 after:w-5 after:rounded-full after:bg-white after:transition-all peer-checked:bg-indigo-600 peer-checked:after:translate-x-full"})]}),t.jsx("span",{className:"text-sm text-zinc-300",children:"Enable Budget Tracking"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Max Cost Per Run (USD)"}),t.jsx("input",{className:"input",type:"number",step:"0.01",value:c.budget.defaultMaxCostPerRunUsd,onChange:C=>N("budget","defaultMaxCostPerRunUsd",parseFloat(C.target.value)||1)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Max Tokens Per Run"}),t.jsx("input",{className:"input",type:"number",value:c.budget.defaultMaxTokensPerRun,onChange:C=>N("budget","defaultMaxTokensPerRun",parseInt(C.target.value)||1e5)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Warning Threshold (%)"}),t.jsx("input",{className:"input",type:"number",min:0,max:100,value:c.budget.warningThresholdPercent,onChange:C=>N("budget","warningThresholdPercent",parseInt(C.target.value)||80)})]})]})]}),r==="apikeys"&&t.jsx(Vj,{}),r==="studio"&&t.jsxs("div",{className:"card space-y-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(gv,{className:"h-5 w-5 text-indigo-400"}),t.jsx("h2",{className:"text-lg font-medium text-zinc-200",children:"Studio Web UI"})]}),t.jsx("p",{className:"text-sm text-zinc-400",children:"The Studio web UI provides a browser-based dashboard for managing agents, workflows, and monitoring runs. You are currently viewing the Studio interface."}),t.jsxs("div",{className:"rounded-lg border border-border bg-zinc-900/50 p-4",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Current Configuration"}),t.jsx("pre",{className:"mt-2 text-xs text-zinc-400 overflow-auto max-h-40 rounded bg-[#0a0a0f] p-3",children:JSON.stringify(c,null,2)})]}),t.jsxs("div",{className:"text-xs text-zinc-500",children:["Changes are applied to the runtime config and take effect immediately. To persist changes across restarts, update the Nestor config file.",t.jsx("code",{className:"ml-1 rounded bg-zinc-800 px-1.5 py-0.5 text-zinc-300",children:"npx nestor-sh config edit"})]})]})]}):null}const Uh=[{id:"gemini",name:"Gemini",provider:"Google",emoji:"🔵",color:"text-blue-400",defaultModel:"gemini-2.5-flash",keyUrl:"https://aistudio.google.com/apikey",keyUrlLabel:"aistudio.google.com",needsKey:!0},{id:"claude",name:"Claude",provider:"Anthropic",emoji:"🟣",color:"text-purple-400",defaultModel:"claude-sonnet-4-6",keyUrl:"https://console.anthropic.com/settings/keys",keyUrlLabel:"console.anthropic.com",needsKey:!0},{id:"openai",name:"GPT-4o",provider:"OpenAI",emoji:"🟢",color:"text-green-400",defaultModel:"gpt-4o",keyUrl:"https://platform.openai.com/api-keys",keyUrlLabel:"platform.openai.com",needsKey:!0},{id:"grok",name:"Grok",provider:"xAI",emoji:"⚪",color:"text-zinc-300",defaultModel:"grok-3",keyUrl:"https://console.x.ai/",keyUrlLabel:"console.x.ai",needsKey:!0},{id:"mistral",name:"Mistral",provider:"Mistral AI",emoji:"🟠",color:"text-orange-400",defaultModel:"mistral-large-latest",keyUrl:"https://console.mistral.ai/api-keys",keyUrlLabel:"console.mistral.ai",needsKey:!0},{id:"ollama",name:"Ollama",provider:"Local",emoji:"🦙",color:"text-amber-400",defaultModel:"llama3.1",keyUrl:"https://ollama.ai/download",keyUrlLabel:"ollama.ai",needsKey:!1}];function Vj(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(""),[g,p]=u.useState(!1),[w,v]=u.useState(null),[y,k]=u.useState(null),[z,N]=u.useState({}),S=u.useCallback(async()=>{try{const q=await xa.list();r(q.data)}catch{}finally{c(!1)}},[]);u.useEffect(()=>{S()},[S]);const C=q=>n.find(I=>I.provider===q),O=q=>{f(q),b(""),p(!1)},D=()=>{f(null),b(""),p(!1)},E=async q=>{if(h.trim()){v(q);try{await xa.set(q,h.trim()),f(null),b(""),await S()}catch{}finally{v(null)}}},ae=async q=>{k(q);try{const I=await xa.test(q);N(W=>({...W,[q]:I.data}))}catch(I){N(W=>({...W,[q]:{valid:!1,message:I instanceof Error?I.message:"Test failed"}}))}finally{k(null)}},oe=async q=>{try{await xa.remove(q),N(I=>{const W={...I};return delete W[q],W}),await S()}catch{}};if(d)return t.jsx("div",{className:"flex items-center justify-center py-16",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-purple-500 border-t-transparent"})});const B=n.filter(q=>q.configured).length;return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"rounded-xl border border-border bg-surface/50 p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(zs,{className:"h-5 w-5 text-purple-400 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs text-zinc-400 space-y-1",children:[t.jsx("p",{children:"API keys are encrypted with AES-256-GCM and stored locally in the Nestor database. Keys set via environment variables take precedence over database-stored keys."}),t.jsxs("p",{className:"text-zinc-500",children:[B,"/",Uh.length," providers configured."]})]})]})}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Uh.map(q=>{const I=C(q.id),W=(I==null?void 0:I.configured)??!1,Y=m===q.id,le=y===q.id,J=w===q.id,ce=z[q.id];return t.jsxs("div",{className:`rounded-xl border bg-surface p-5 transition-all hover:shadow-lg hover:shadow-black/20 ${W?"border-border":"border-border/50"}`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:q.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:q.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:q.provider})]})]}),W?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-green-500/10 px-2.5 py-0.5 text-xs font-medium text-green-400",children:[t.jsx(Nt,{className:"h-3 w-3"}),"Configured"]}):t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-red-500/10 px-2.5 py-0.5 text-xs font-medium text-red-400",children:[t.jsx(et,{className:"h-3 w-3"}),"Not set"]})]}),t.jsxs("p",{className:"text-xs text-zinc-500 mb-3",children:["Default model: ",t.jsx("code",{className:"text-zinc-400",children:q.defaultModel})]}),W&&(I==null?void 0:I.maskedKey)&&!Y&&t.jsxs("div",{className:"mb-3 rounded-lg bg-background/50 px-3 py-2",children:[t.jsx("p",{className:"font-mono text-xs text-zinc-400",children:I.maskedKey}),I.source==="env"&&t.jsx("p",{className:"text-[10px] text-yellow-500/80 mt-0.5",children:"From environment variable"}),I.source==="db"&&I.label&&t.jsx("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:I.label})]}),Y&&t.jsxs("div",{className:"mb-3 space-y-2",children:[t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:g?"text":"password",value:h,onChange:he=>b(he.target.value),placeholder:`Enter ${q.provider} API key`,className:"w-full rounded-lg border border-border bg-background px-3 py-2 pr-10 text-sm text-zinc-200 focus:border-purple-500 focus:outline-none placeholder:text-zinc-600",autoFocus:!0}),t.jsx("button",{type:"button",onClick:()=>p(!g),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:g?t.jsx(Zd,{className:"h-3.5 w-3.5"}):t.jsx(Vr,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>E(q.id),disabled:!h.trim()||J,className:"inline-flex items-center gap-1.5 rounded-lg bg-purple-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[J?t.jsx(ht,{className:"h-3 w-3 animate-spin"}):t.jsx(Nt,{className:"h-3 w-3"}),"Save"]}),t.jsx("button",{onClick:D,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover",children:"Cancel"})]})]}),ce&&t.jsxs("div",{className:`mb-3 rounded-lg border p-2.5 text-xs ${ce.valid?"border-green-500/20 bg-green-500/5 text-green-400":"border-red-500/20 bg-red-500/5 text-red-400"}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[ce.valid?t.jsx(Nt,{className:"h-3 w-3"}):t.jsx(Il,{className:"h-3 w-3"}),ce.valid?"Working":"Failed"]}),t.jsx("p",{className:"mt-0.5 text-[10px] opacity-80",children:ce.message}),ce.models&&ce.models.length>0&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[ce.models.slice(0,4).map(he=>t.jsx("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px] font-mono",children:he},he)),ce.models.length>4&&t.jsxs("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px]",children:["+",ce.models.length-4]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:W&&!Y?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:()=>ae(q.id),disabled:le,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200 disabled:opacity-50",children:[le?t.jsx(ht,{className:"h-3 w-3 animate-spin"}):t.jsx(ei,{className:"h-3 w-3"}),"Test"]}),q.needsKey&&t.jsxs("button",{onClick:()=>O(q.id),className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200",children:[t.jsx(ni,{className:"h-3 w-3"}),"Edit"]}),(I==null?void 0:I.source)==="db"&&t.jsxs("button",{onClick:()=>oe(q.id),className:"inline-flex items-center gap-1.5 rounded-lg border border-red-500/20 px-3 py-1.5 text-xs font-medium text-red-400 transition-colors hover:bg-red-500/10",children:[t.jsx(Ut,{className:"h-3 w-3"}),"Remove"]})]}):Y?null:q.needsKey?t.jsxs("button",{onClick:()=>O(q.id),className:"inline-flex items-center gap-1.5 rounded-lg bg-purple-600 px-4 py-1.5 text-xs font-medium text-white transition-colors hover:bg-purple-700",children:[t.jsx(pt,{className:"h-3 w-3"}),"Add Key"]}):t.jsxs("button",{onClick:()=>ae(q.id),disabled:le,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200 disabled:opacity-50",children:[le?t.jsx(ht,{className:"h-3 w-3 animate-spin"}):t.jsx(ei,{className:"h-3 w-3"}),"Test Connection"]})}),t.jsx("div",{className:"mt-3 border-t border-border/50 pt-2.5",children:t.jsxs("a",{href:q.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-zinc-600 hover:text-zinc-400 transition-colors",children:[t.jsx($n,{className:"h-2.5 w-2.5"}),"Get API Key at ",q.keyUrlLabel]})})]},q.id)})})]})}const Bh={low:{bg:"bg-green-500/10",text:"text-green-400",icon:eu},medium:{bg:"bg-amber-500/10",text:"text-amber-400",icon:dt},high:{bg:"bg-orange-500/10",text:"text-orange-400",icon:Na},critical:{bg:"bg-red-500/10",text:"text-red-400",icon:tv}},iu={command:"Command",budget:"Budget",config:"Config",hire:"Hire",strategy:"Strategy",deploy:"Deploy",custom:"Custom"},Yj={pending:"bg-amber-500/10 text-amber-400",approved:"bg-green-500/10 text-green-400",rejected:"bg-red-500/10 text-red-400",expired:"bg-zinc-500/10 text-zinc-400"};function $h({approval:n,onApprove:r,onReject:d,actionLoading:c,showActions:m}){const[f,h]=u.useState(""),b=Bh[n.riskLevel]??Bh.medium,g=b.icon,p=c===n.id;return t.jsx("div",{className:"card hover:border-amber-500/20 transition-colors",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start gap-4 flex-1 min-w-0",children:[t.jsx("div",{className:`flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg ${b.bg}`,children:t.jsx(g,{className:`h-5 w-5 ${b.text}`})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"font-medium text-zinc-200",children:n.title}),t.jsx("span",{className:`badge ${b.bg} ${b.text} uppercase text-[10px]`,children:n.riskLevel}),t.jsx("span",{className:"badge bg-zinc-700/50 text-zinc-400 text-[10px]",children:iu[n.type]??n.type}),n.status!=="pending"&&t.jsx("span",{className:`badge ${Yj[n.status]} uppercase text-[10px]`,children:n.status})]}),n.description&&t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:n.description}),t.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Agent: ",t.jsx("span",{className:"text-zinc-300",children:n.agentId})]}),Object.keys(n.payload).length>0&&t.jsx("pre",{className:"mt-2 max-h-24 overflow-auto rounded-lg bg-[#0a0a0f] p-3 text-xs text-zinc-400",children:JSON.stringify(n.payload,null,2)}),t.jsxs("div",{className:"mt-2 flex items-center gap-4 text-xs text-zinc-500",children:[t.jsx("span",{children:new Date(n.createdAt).toLocaleString()}),n.reviewerId&&t.jsxs("span",{children:["Reviewed by: ",t.jsx("span",{className:"text-zinc-400",children:n.reviewerId})]}),n.reviewComment&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ss,{className:"h-3 w-3"}),n.reviewComment]})]})]})]}),m&&n.status==="pending"&&t.jsxs("div",{className:"flex flex-col gap-2 flex-shrink-0",children:[t.jsx("input",{type:"text",placeholder:"Comment...",value:f,onChange:w=>h(w.target.value),className:"input text-xs w-40"}),t.jsxs("button",{onClick:()=>r==null?void 0:r(n.id,f),disabled:p,className:"btn-primary btn-sm",children:[t.jsx(Nt,{className:"h-3.5 w-3.5"}),"Approve"]}),t.jsxs("button",{onClick:()=>d==null?void 0:d(n.id,f),disabled:p,className:"btn-danger btn-sm",children:[t.jsx(et,{className:"h-3.5 w-3.5"}),"Reject"]})]})]})})}function Xj({stats:n}){const d=n.pending+n.approved+n.rejected+n.expired>0?Math.round(n.approved/(n.approved+n.rejected||1)*100):0;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-amber-400",children:n.pending}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Pending"})]}),t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-green-400",children:n.approved}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Approved"})]}),t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-red-400",children:n.rejected}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Rejected"})]}),t.jsxs("div",{className:"card text-center",children:[t.jsx("p",{className:"text-2xl font-bold text-zinc-400",children:n.expired}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Expired"})]})]}),t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300 mb-3",children:"Approval Rate"}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex-1 h-2 rounded-full bg-zinc-800",children:t.jsx("div",{className:"h-full rounded-full bg-green-500",style:{width:`${d}%`}})}),t.jsxs("span",{className:"text-sm font-medium text-zinc-300",children:[d,"%"]})]})]}),Object.keys(n.byType).length>0&&t.jsxs("div",{className:"card",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300 mb-3",children:"By Type"}),t.jsx("div",{className:"space-y-2",children:Object.entries(n.byType).map(([c,m])=>t.jsxs("div",{className:"flex items-center justify-between text-sm",children:[t.jsx("span",{className:"text-zinc-400",children:iu[c]??c}),t.jsx("span",{className:"font-medium text-zinc-200",children:m})]},c))})]})]})}function Qj(){const{t:n}=nt(),[r,d]=u.useState("pending"),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,w]=u.useState(!0),[v,y]=u.useState(null),[k,z]=u.useState(null),[N,S]=u.useState(""),[C,O]=u.useState(""),D=u.useCallback(async()=>{try{y(null);const q={status:"pending"};N&&(q.type=N);let W=(await Ql.list(q)).data;C&&(W=W.filter(Y=>Y.riskLevel===C)),m(W)}catch(q){y(q instanceof Error?q.message:"Failed to fetch approvals"),m([])}finally{w(!1)}},[N,C]),E=u.useCallback(async()=>{try{const q=await Ql.history({limit:100});h(q.data)}catch{h([])}},[]),ae=u.useCallback(async()=>{try{const q=await Ql.stats();g(q.data)}catch{g(null)}},[]);u.useEffect(()=>{r==="pending"?D():r==="history"?E():r==="stats"&&ae()},[r,D,E,ae]),u.useEffect(()=>{if(r==="pending"){const q=setInterval(D,5e3);return()=>clearInterval(q)}},[r,D]);const oe=async(q,I)=>{z(q);try{await Ql.approve(q,{comment:I||void 0}),m(W=>W.filter(Y=>Y.id!==q))}catch(W){console.error("Approve failed:",W)}finally{z(null)}},B=async(q,I)=>{z(q);try{await Ql.reject(q,{reason:I||void 0}),m(W=>W.filter(Y=>Y.id!==q))}catch(W){console.error("Reject failed:",W)}finally{z(null)}};return p&&r==="pending"?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("approvals.title")}),c.length>0&&r==="pending"&&t.jsxs("span",{className:"badge bg-amber-500/10 text-amber-400",children:[c.length," pending"]})]}),t.jsx("button",{onClick:()=>{r==="pending"?D():r==="history"?E():ae()},className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:[{key:"pending",label:"Pending",icon:Na},{key:"history",label:"History",icon:Ah},{key:"stats",label:"Stats",icon:ja}].map(({key:q,label:I,icon:W})=>t.jsxs("button",{onClick:()=>d(q),className:`flex items-center gap-2 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${r===q?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:[t.jsx(W,{className:"h-4 w-4"}),I]},q))}),r==="pending"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(g0,{className:"h-4 w-4 text-zinc-500"}),t.jsxs("select",{value:N,onChange:q=>S(q.target.value),className:"input text-sm w-40",children:[t.jsx("option",{value:"",children:"All Types"}),Object.entries(iu).map(([q,I])=>t.jsx("option",{value:q,children:I},q))]}),t.jsxs("select",{value:C,onChange:q=>O(q.target.value),className:"input text-sm w-40",children:[t.jsx("option",{value:"",children:"All Risk Levels"}),t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"medium",children:"Medium"}),t.jsx("option",{value:"high",children:"High"}),t.jsx("option",{value:"critical",children:"Critical"})]})]}),v&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[v,t.jsx("button",{onClick:D,className:"ml-3 underline",children:"Retry"})]}),r==="pending"&&(c.length===0&&!v?t.jsx(Js,{icon:t.jsx(eu,{className:"h-8 w-8"}),title:n("approvals.empty"),description:n("approvals.emptyDesc"),action:t.jsxs("div",{className:"mt-2 space-y-3 text-left max-w-md",children:[t.jsx("p",{className:"text-sm text-zinc-400",children:"Approvals appear when an agent requests permission for a risky action (shell commands, file deletions, config changes, etc.)."}),t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"To enable approval mode:"}),t.jsx("code",{className:"text-xs text-indigo-400 font-mono",children:"npx nestor-sh config set security.approvalMode smart"})]}),t.jsxs("p",{className:"text-xs text-zinc-500",children:["Modes: ",t.jsx("span",{className:"text-zinc-400",children:"auto"})," (no approvals) ·"," ",t.jsx("span",{className:"text-zinc-400",children:"smart"})," (risky actions only) ·"," ",t.jsx("span",{className:"text-zinc-400",children:"manual"})," (all actions)"]})]})}):t.jsx("div",{className:"space-y-3",children:c.map(q=>t.jsx($h,{approval:q,onApprove:oe,onReject:B,actionLoading:k,showActions:!0},q.id))})),r==="history"&&(f.length===0?t.jsx(Js,{icon:t.jsx(Ah,{className:"h-8 w-8"}),title:"No history",description:"Approval history will appear here after decisions are made."}):t.jsx("div",{className:"space-y-3",children:f.map(q=>t.jsx($h,{approval:q,actionLoading:null,showActions:!1},q.id))})),r==="stats"&&b&&t.jsx(Xj,{stats:b})]})}const Zj="/api";async function Jj(n=30){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=localStorage.getItem("nestor_tenant_id");c&&(d["X-Tenant-ID"]=c);try{const m=await fetch(`${Zj}/analytics/quality?days=${n}`,{headers:d});return m.ok?(await m.json()).data??null:null}catch{return null}}function Zr(n){return`${(n*100).toFixed(0)}%`}function C0(n){return n>0?`+${(n*100).toFixed(0)}%`:`${(n*100).toFixed(0)}%`}function Tr({label:n,value:r,icon:d,color:c,bgColor:m,subtitle:f}){return t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"mt-1 text-2xl font-semibold text-white",children:r}),f&&t.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:f})]}),t.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl ${m}`,children:t.jsx(d,{className:`h-5 w-5 ${c}`})})]})})}function Fj({data:n}){return n.length===0?t.jsx("div",{className:"flex h-48 items-center justify-center text-zinc-500 text-sm",children:"No data available"}):t.jsx("div",{className:"flex items-end gap-1 h-48",children:n.map(r=>{const d=Math.max(r.successRate*100,2),c=r.successRate>=.8?"bg-emerald-500 hover:bg-emerald-400":r.successRate>=.5?"bg-amber-500 hover:bg-amber-400":"bg-red-500 hover:bg-red-400";return t.jsxs("div",{className:"flex-1 flex flex-col items-center min-w-0",children:[t.jsx("div",{className:`w-full rounded-t transition-all cursor-default min-h-[2px] ${c}`,style:{height:`${d}%`},title:`${r.date}: ${Zr(r.successRate)} (${r.completedRuns}/${r.totalRuns} runs)`}),t.jsx("span",{className:"text-[10px] text-zinc-500 mt-1 truncate w-full text-center",children:r.date.slice(5)})]},r.date)})})}function Ij({agents:n}){return n.length===0?t.jsx("p",{className:"text-zinc-500 text-sm",children:"No agent data available"}):t.jsx("div",{className:"space-y-2",children:n.map((r,d)=>{const c=r.score>=70?"text-emerald-400":r.score>=50?"text-amber-400":"text-red-400",m=r.score>=70?"bg-emerald-500":r.score>=50?"bg-amber-500":"bg-red-500";return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"w-6 text-xs text-zinc-500 text-right font-mono",children:["#",d+1]}),t.jsx("span",{className:"text-sm text-zinc-300 w-32 truncate",title:r.name,children:r.name}),t.jsx("div",{className:"flex-1 h-2 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full transition-all ${m}`,style:{width:`${Math.min(r.score,100)}%`}})}),t.jsx("span",{className:`text-xs font-medium w-12 text-right ${c}`,children:r.score.toFixed(0)}),t.jsx("span",{className:"text-xs text-zinc-500 w-16 text-right",children:Zr(r.successRate)})]},r.agentId)})})}function Pj({items:n}){return n.length===0?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[t.jsx(ft,{className:"h-4 w-4 text-emerald-500"}),"All agents performing well"]}):t.jsx("div",{className:"space-y-2",children:n.map(r=>t.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-red-500/5 border border-red-500/20",children:[t.jsx(dt,{className:"h-4 w-4 text-red-400 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:"text-sm text-zinc-300 truncate block",children:r.name}),t.jsx("span",{className:"text-xs text-zinc-500",children:r.issue})]}),t.jsx("span",{className:"text-xs text-red-400 font-mono",children:typeof r.metric=="number"&&r.metric<=1?Zr(r.metric):C0(r.metric)})]},r.agentId))})}function Wj({tools:n}){if(n.length===0)return t.jsx("p",{className:"text-zinc-500 text-sm",children:"No tool usage data"});const r=Math.max(...n.map(d=>d.count),1);return t.jsx("div",{className:"space-y-2",children:n.slice(0,10).map(d=>{const c=d.failRate>=.3?"text-red-400":d.failRate>=.1?"text-amber-400":"text-zinc-500";return t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Zn,{className:"h-3.5 w-3.5 text-zinc-500 shrink-0"}),t.jsx("span",{className:"text-xs text-zinc-300 w-32 truncate font-mono",title:d.name,children:d.name}),t.jsx("div",{className:"flex-1 h-1.5 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-indigo-500 rounded-full",style:{width:`${d.count/r*100}%`}})}),t.jsx("span",{className:"text-xs text-zinc-500 w-10 text-right",children:d.count}),t.jsxs("span",{className:`text-xs w-12 text-right ${c}`,children:[(d.failRate*100).toFixed(0),"% fail"]})]},d.name)})})}function e1({errors:n}){return n.length===0?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[t.jsx(ft,{className:"h-4 w-4 text-emerald-500"}),"No recurring errors detected"]}):t.jsx("div",{className:"space-y-2",children:n.slice(0,8).map((r,d)=>t.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-zinc-800/50",children:[t.jsx(f0,{className:"h-3.5 w-3.5 text-red-400 shrink-0 mt-0.5"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-zinc-300 font-mono break-all line-clamp-2",children:r.pattern}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsxs("span",{className:"text-[10px] text-zinc-500",children:[r.count," occurrences"]}),r.lastSeen&&t.jsxs("span",{className:"text-[10px] text-zinc-600",children:["Last: ",new Date(r.lastSeen).toLocaleDateString()]})]})]})]},d))})}function t1(){const[n,r]=u.useState(null),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(30);if(u.useEffect(()=>{async function w(){c(!0),f(null);const v=await Jj(h);v?r(v):f("Failed to load quality metrics"),c(!1)}w()},[h]),d)return t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(m||!n)return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-3",children:[t.jsx(dt,{className:"h-8 w-8 text-amber-500"}),t.jsx("p",{className:"text-zinc-400",children:m??"No data available"})]});const g=n.overallFeedbackScore>=0?"text-emerald-400":"text-red-400",p=n.overallSuccessRate>=.8?"text-emerald-400":n.overallSuccessRate>=.5?"text-amber-400":"text-red-400";return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center gap-2",children:[7,14,30,90].map(w=>t.jsxs("button",{onClick:()=>b(w),className:`px-3 py-1 text-xs rounded-lg transition-colors ${h===w?"bg-indigo-500/20 text-indigo-400 border border-indigo-500/30":"bg-zinc-800/50 text-zinc-500 border border-zinc-700/50 hover:border-zinc-600"}`,children:[w,"d"]},w))}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(Tr,{label:"Total Runs",value:String(n.totalRuns),icon:Zt,color:"text-blue-400",bgColor:"bg-blue-400/10",subtitle:`Last ${h} days`}),t.jsx(Tr,{label:"Success Rate",value:Zr(n.overallSuccessRate),icon:ft,color:p,bgColor:n.overallSuccessRate>=.8?"bg-emerald-400/10":"bg-amber-400/10"}),t.jsx(Tr,{label:"Feedback Score",value:C0(n.overallFeedbackScore),icon:ti,color:g,bgColor:n.overallFeedbackScore>=0?"bg-emerald-400/10":"bg-red-400/10"}),t.jsx(Tr,{label:"Active Agents",value:`${n.activeAgents} / ${n.totalAgents}`,icon:Qn,color:"text-purple-400",bgColor:"bg-purple-400/10"})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(ja,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Success Rate Trend"})]}),t.jsx(Fj,{data:n.dailySuccessRates})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(tu,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Top Performers"})]}),t.jsx(Ij,{agents:n.topPerformers})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(dt,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Needs Attention"})]}),t.jsx(Pj,{items:n.needsAttention})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(Zn,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Tool Performance"})]}),t.jsx(Wj,{tools:n.toolPerformance})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(f0,{className:"h-4 w-4 text-zinc-400"}),t.jsx("h2",{className:"text-lg font-medium text-white",children:"Error Patterns"})]}),t.jsx(e1,{errors:n.errorPatterns})]})]})]})}function Rr({label:n,value:r,icon:d,color:c,bgColor:m,subtitle:f}){return t.jsx("div",{className:"card",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"mt-1 text-2xl font-semibold text-white",children:r}),f&&t.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:f})]}),t.jsx("div",{className:`flex h-11 w-11 items-center justify-center rounded-xl ${m}`,children:t.jsx(d,{className:`h-5 w-5 ${c}`})})]})})}const Jl={"7d":{label:"7 jours",days:7,aggregate:"day"},"30d":{label:"30 jours",days:30,aggregate:"day"},"90d":{label:"3 mois",days:90,aggregate:"week"},"6m":{label:"6 mois",days:180,aggregate:"week"},"1y":{label:"1 an",days:365,aggregate:"month"}};function a1(n,r){if(r==="day"){const c=n.filter(m=>m.costUsd>0);return c.length>0?c:n.slice(-7)}const d=new Map;for(const c of n){let m;const f=new Date(c.date);if(r==="week"){const b=new Date(f);b.setDate(f.getDate()-f.getDay()+1),m=b.toISOString().slice(0,10)}else m=c.date.slice(0,7);const h=d.get(m)||{costUsd:0,runs:0};h.costUsd+=c.costUsd,h.runs+=c.runs,d.set(m,h)}return Array.from(d.entries()).map(([c,m])=>({date:c,costUsd:m.costUsd,runs:m.runs})).sort((c,m)=>c.date.localeCompare(m.date))}function s1({data:n,period:r,onPeriodChange:d}){const c=Jl[r],m=a1(n,c.aggregate);if(m.length===0)return t.jsx("div",{className:"flex h-48 items-center justify-center text-zinc-500 text-sm",children:"No cost data available"});const f=Math.max(...m.map(g=>g.costUsd),.01),h=m.reduce((g,p)=>g+p.costUsd,0),b=m.reduce((g,p)=>g+p.runs,0);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("div",{className:"flex gap-1",children:Object.keys(Jl).map(g=>t.jsx("button",{onClick:()=>d(g),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${r===g?"bg-indigo-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:Jl[g].label},g))}),t.jsxs("div",{className:"text-xs text-zinc-500",children:["$",h.toFixed(2)," · ",b," runs · ",m.length," ",c.aggregate==="day"?"jours":c.aggregate==="week"?"semaines":"mois"]})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("div",{className:"flex flex-col justify-between h-48 text-right pr-1 text-[10px] text-zinc-600 w-12 flex-shrink-0",children:[t.jsxs("span",{children:["$",f.toFixed(2)]}),t.jsxs("span",{children:["$",(f*.75).toFixed(2)]}),t.jsxs("span",{children:["$",(f*.5).toFixed(2)]}),t.jsxs("span",{children:["$",(f*.25).toFixed(2)]}),t.jsx("span",{children:"$0"})]}),t.jsx("div",{className:"flex items-end gap-1 h-48 flex-1",children:m.map(g=>{const p=Math.max(g.costUsd/f*100,3),w=g.costUsd===f;return t.jsxs("div",{className:"flex-1 flex flex-col items-center min-w-0 group relative",children:[t.jsxs("div",{className:"absolute bottom-full mb-1 hidden group-hover:block bg-zinc-800 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-10 pointer-events-none",children:["$",g.costUsd.toFixed(4)," · ",g.runs," runs"]}),t.jsx("div",{className:`w-full rounded-t transition-all cursor-default ${w?"bg-indigo-400":"bg-indigo-500 hover:bg-indigo-400"}`,style:{height:`${p}%`}}),t.jsx("span",{className:"text-[10px] text-zinc-500 mt-1 truncate w-full text-center",children:(c.aggregate==="month",g.date.slice(5))})]},g.date)})})]})]})}function vs(n){return n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:`$${n.toFixed(2)}`}function Hh(n){return n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:String(n)}function n1(){const{t:n}=nt(),[r,d]=u.useState(null),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,w]=u.useState("30d"),[v,y]=u.useState(!0),[k,z]=u.useState(null);if(u.useEffect(()=>{async function S(){try{y(!0),z(null);const[C,O,D,E]=await Promise.all([zr.summary(),zr.daily(Jl[p].days),zr.budget(),zr.estimate()]);d(C.data),m(O.data),h(D.data),g(E.data)}catch(C){z(C instanceof Error?C.message:"Failed to load analytics")}finally{y(!1)}}S()},[p]),v)return t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-zinc-400",children:n("common.loading")})});if(k)return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] gap-3",children:[t.jsx(dt,{className:"h-8 w-8 text-amber-500"}),t.jsx("p",{className:"text-zinc-400",children:k})]});const N=r&&r.totalRuns>0?r.totalCostUsd/r.totalRuns:0;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsx(Rr,{label:n("analytics.totalSpend"),value:vs((r==null?void 0:r.totalCostUsd)??0),icon:wa,color:"text-emerald-400",bgColor:"bg-emerald-400/10"}),t.jsx(Rr,{label:n("analytics.totalRuns"),value:String((r==null?void 0:r.totalRuns)??0),icon:Zt,color:"text-blue-400",bgColor:"bg-blue-400/10",subtitle:`${Hh((r==null?void 0:r.totalTokens)??0)} tokens`}),t.jsx(Rr,{label:n("analytics.avgCostPerRun"),value:vs(N),icon:sv,color:"text-amber-400",bgColor:"bg-amber-400/10"}),t.jsx(Rr,{label:n("analytics.monthlyEstimate"),value:vs((b==null?void 0:b.estimatedUsd)??0),icon:tu,color:"text-purple-400",bgColor:"bg-purple-400/10",subtitle:b?`${b.confidence} confidence`:void 0})]}),t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t.jsx(ja,{className:"h-4 w-4 text-zinc-400"}),t.jsxs("h2",{className:"text-lg font-medium text-white",children:[n("analytics.dailyCosts")," (",Jl[p].label,")"]})]}),t.jsx(s1,{data:c,period:p,onPeriodChange:S=>{w(S)}})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:n("analytics.agentBreakdown")}),r&&r.byAgent.length>0?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-zinc-400",children:[t.jsx("th",{className:"text-left pb-2 font-medium",children:n("common.name")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.runs")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.totalCost")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.avgCost")})]})}),t.jsx("tbody",{children:r.byAgent.map(S=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"py-2 text-white",children:S.agentName}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:S.runs}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:vs(S.costUsd)}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:vs(S.runs>0?S.costUsd/S.runs:0)})]},S.agentId))})]})}):t.jsx("p",{className:"text-zinc-500 text-sm",children:n("analytics.noAgentData")})]}),t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:n("analytics.modelBreakdown")}),r&&r.byModel.length>0?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-zinc-400",children:[t.jsx("th",{className:"text-left pb-2 font-medium",children:n("analytics.model")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.tokens")}),t.jsx("th",{className:"text-right pb-2 font-medium",children:n("analytics.cost")})]})}),t.jsx("tbody",{children:r.byModel.map(S=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"py-2 text-white font-mono text-xs",children:S.model}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:Hh(S.tokens)}),t.jsx("td",{className:"py-2 text-right text-zinc-300",children:vs(S.costUsd)})]},S.model))})]})}):t.jsx("p",{className:"text-zinc-500 text-sm",children:n("analytics.noModelData")})]})]}),f.length>0&&t.jsxs("div",{className:"card",children:[t.jsx("h2",{className:"text-lg font-medium text-white mb-4",children:n("analytics.budgetUtilization")}),t.jsx("div",{className:"space-y-3",children:f.map(S=>t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("span",{className:"text-sm text-zinc-300 w-32 truncate",children:S.name}),t.jsx("div",{className:"flex-1 h-2 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full transition-all ${S.percent>=90?"bg-red-500":S.percent>=70?"bg-amber-500":"bg-indigo-500"}`,style:{width:`${Math.min(S.percent,100)}%`}})}),t.jsxs("span",{className:"text-xs text-zinc-400 w-24 text-right",children:[vs(S.spentUsd)," / ",vs(S.budgetUsd)]}),t.jsxs("span",{className:`text-xs font-medium w-12 text-right ${S.percent>=90?"text-red-400":S.percent>=70?"text-amber-400":"text-zinc-400"}`,children:[S.percent.toFixed(0),"%"]})]},S.agentId))})]})]})}function l1(){const{t:n}=nt(),[r,d]=u.useState("costs");return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:n("analytics.title")}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:n("analytics.description")})]})}),t.jsxs("div",{className:"flex items-center gap-1 border-b border-border",children:[t.jsx("button",{onClick:()=>d("costs"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r==="costs"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-300 hover:border-zinc-600"}`,children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(wa,{className:"h-4 w-4"}),"Costs"]})}),t.jsx("button",{onClick:()=>d("quality"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${r==="quality"?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-300 hover:border-zinc-600"}`,children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ft,{className:"h-4 w-4"}),"Quality"]})})]}),r==="costs"&&t.jsx(n1,{}),r==="quality"&&t.jsx(t1,{})]})}function A0(n){return new Date(n).toLocaleString()}function ru(n){return n===void 0?"--":n<1e3?`${n}ms`:n<6e4?`${(n/1e3).toFixed(1)}s`:`${(n/6e4).toFixed(1)}m`}function cu(n){switch(n){case"ok":return t.jsx(ft,{className:"h-4 w-4 text-emerald-400"});case"error":return t.jsx(At,{className:"h-4 w-4 text-red-400"});default:return t.jsx(dt,{className:"h-4 w-4 text-zinc-500"})}}function E0(n){const r={ok:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",error:"bg-red-500/10 text-red-400 border-red-500/20",unset:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"};return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${r[n]??r.unset}`,children:[cu(n),n]})}function i1({span:n,traceStart:r,traceDuration:d}){if(d===0)return null;const c=(n.startTime-r)/d*100,m=Math.max((n.durationMs??0)/d*100,.5),f=n.status==="error"?"bg-red-500":n.kind==="server"?"bg-indigo-500":n.kind==="client"?"bg-cyan-500":"bg-emerald-500";return t.jsx("div",{className:"relative h-5 w-full rounded bg-zinc-800/50",children:t.jsx("div",{className:`absolute top-0.5 h-4 rounded ${f} opacity-80`,style:{left:`${Math.min(c,99)}%`,width:`${Math.min(m,100-c)}%`}})})}function r1({span:n,depth:r,traceStart:d,traceDuration:c}){const[m,f]=u.useState(!1),h=Object.keys(n.attributes).length>0||n.events.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs("tr",{className:"border-b border-zinc-800/50 hover:bg-zinc-800/30 cursor-pointer transition-colors",onClick:()=>h&&f(!m),children:[t.jsx("td",{className:"py-2 px-3 text-sm font-mono text-zinc-300 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center gap-1",style:{paddingLeft:`${r*16}px`},children:[h?m?t.jsx(Xa,{className:"h-3 w-3 text-zinc-500"}):t.jsx(ra,{className:"h-3 w-3 text-zinc-500"}):t.jsx("span",{className:"w-3"}),cu(n.status),t.jsx("span",{className:"ml-1",children:n.name})]})}),t.jsx("td",{className:"py-2 px-3 text-xs text-zinc-500 whitespace-nowrap",children:n.kind}),t.jsx("td",{className:"py-2 px-3 text-xs text-zinc-400 font-mono whitespace-nowrap text-right",children:ru(n.durationMs)}),t.jsx("td",{className:"py-2 px-3 w-1/3",children:t.jsx(i1,{span:n,traceStart:d,traceDuration:c})})]}),m&&t.jsx("tr",{className:"border-b border-zinc-800/50",children:t.jsx("td",{colSpan:4,className:"px-6 py-3 bg-zinc-900/50",children:t.jsxs("div",{style:{paddingLeft:`${r*16+16}px`},children:[Object.keys(n.attributes).length>0&&t.jsxs("div",{className:"mb-2",children:[t.jsx("p",{className:"text-xs font-semibold text-zinc-500 uppercase mb-1",children:"Attributes"}),t.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5",children:Object.entries(n.attributes).map(([b,g])=>t.jsxs("div",{className:"text-xs",children:[t.jsxs("span",{className:"text-zinc-500",children:[b,":"]})," ",t.jsx("span",{className:"text-zinc-300 font-mono",children:String(g)})]},b))})]}),n.events.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold text-zinc-500 uppercase mb-1",children:"Events"}),n.events.map((b,g)=>t.jsxs("div",{className:"text-xs mb-1",children:[t.jsx("span",{className:"text-amber-400",children:b.name}),t.jsxs("span",{className:"text-zinc-600 ml-2",children:["+",b.time-n.startTime,"ms"]}),b.attributes&&Object.entries(b.attributes).map(([p,w])=>t.jsxs("span",{className:"text-zinc-500 ml-2",children:[p,"=",String(w)]},p))]},g))]})]})})})]})}function c1(n){const r=new Map,d=[];for(const c of n)r.set(c.spanId,{span:c,children:[]});for(const c of n){const m=r.get(c.spanId);c.parentSpanId&&r.has(c.parentSpanId)?r.get(c.parentSpanId).children.push(m):d.push(m)}return d}function T0(n,r=0){const d=[];for(const c of n)d.push({span:c.span,depth:r}),d.push(...T0(c.children,r+1));return d}function o1({trace:n}){const r=n.startTime,d=n.durationMs??1,c=c1(n.spans),m=T0(c);return t.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-4 py-3",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:n.rootSpanName}),t.jsxs("p",{className:"text-xs text-zinc-500 mt-0.5",children:[A0(n.startTime)," · ",n.spanCount," spans · ",ru(n.durationMs)]})]}),E0(n.status)]}),t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full min-w-[600px]",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-zinc-800 text-xs text-zinc-500 uppercase",children:[t.jsx("th",{className:"py-2 px-3 text-left font-medium",children:"Span"}),t.jsx("th",{className:"py-2 px-3 text-left font-medium w-16",children:"Kind"}),t.jsx("th",{className:"py-2 px-3 text-right font-medium w-20",children:"Duration"}),t.jsx("th",{className:"py-2 px-3 text-left font-medium w-1/3",children:"Timeline"})]})}),t.jsx("tbody",{children:m.map(({span:f,depth:h})=>t.jsx(r1,{span:f,depth:h,traceStart:r,traceDuration:d},f.spanId))})]})}),t.jsx("div",{className:"border-t border-zinc-800 px-4 py-2",children:t.jsxs("p",{className:"text-xs text-zinc-600 font-mono",children:["traceId: ",n.traceId]})})]})}function d1(){const[n,r]=u.useState([]),[d,c]=u.useState(null),[m,f]=u.useState(null),[h,b]=u.useState(!0),[g,p]=u.useState(!1),[w,v]=u.useState(null),y=u.useCallback(async()=>{b(!0),v(null);try{const N=await wd.list();r(N.data),p(N.meta.tracingEnabled)}catch(N){v(N instanceof Error?N.message:"Failed to load traces")}finally{b(!1)}},[]);u.useEffect(()=>{y()},[y]);const k=u.useCallback(async N=>{if(m===N){f(null),c(null);return}f(N);try{const S=await wd.get(N);c(S.data)}catch{c(null)}},[m]),z=async()=>{try{await wd.clear(),r([]),c(null),f(null)}catch{}};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Traces"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Distributed tracing for agent runs, HTTP requests, and orchestrations."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!g&&t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/10 px-3 py-1 text-xs font-medium text-amber-400",children:[t.jsx(dt,{className:"h-3 w-3"}),"Tracing disabled"]}),t.jsxs("button",{onClick:y,className:"inline-flex items-center gap-1.5 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-zinc-300 hover:bg-zinc-700 transition-colors",children:[t.jsx(Ct,{className:"h-3.5 w-3.5"}),"Refresh"]}),t.jsxs("button",{onClick:z,className:"inline-flex items-center gap-1.5 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-red-400 hover:bg-zinc-700 transition-colors",children:[t.jsx(Ut,{className:"h-3.5 w-3.5"}),"Clear"]})]})]}),w&&t.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/10 p-4",children:t.jsx("p",{className:"text-sm text-red-400",children:w})}),h&&t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsx("div",{className:"animate-spin h-6 w-6 border-2 border-indigo-500 border-t-transparent rounded-full"})}),!h&&n.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"mb-4 rounded-2xl bg-surface p-4 text-zinc-500",children:t.jsx(Zt,{className:"h-8 w-8"})}),t.jsx("h3",{className:"text-lg font-medium text-zinc-300",children:"No traces recorded"}),t.jsx("p",{className:"mt-1.5 max-w-md text-sm text-zinc-500",children:g?"Traces will appear here as agents run and HTTP requests are processed.":"Distributed tracing records the full execution path of agent runs, tool calls, and HTTP requests."}),t.jsxs("div",{className:"mt-4 space-y-3 text-left max-w-md",children:[!g&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Enable via CLI:"}),t.jsx("code",{className:"text-xs text-indigo-400 font-mono block",children:"npx nestor-sh config set observability.tracing.enabled true"})]}),t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Or in nestor.config.json:"}),t.jsx("pre",{className:"text-xs text-zinc-400 font-mono",children:`{
581
+ "observability": {
582
+ "tracing": { "enabled": true }
583
+ }
584
+ }`})]})]}),g&&t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Traces are recorded when:"}),t.jsxs("ul",{className:"text-xs text-zinc-400 space-y-1 list-disc list-inside",children:[t.jsx("li",{children:"An agent run executes (chat, mission, workflow)"}),t.jsx("li",{children:"Tool calls are made (shell, file, HTTP)"}),t.jsx("li",{children:"API requests are processed by the server"})]})]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Each trace shows a waterfall timeline of spans, durations, and errors."})]})]}),!h&&n.length>0&&t.jsx("div",{className:"space-y-2",children:n.map(N=>t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>k(N.traceId),className:`w-full flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-colors ${m===N.traceId?"border-indigo-500/30 bg-indigo-500/5":"border-zinc-800 bg-zinc-900/50 hover:bg-zinc-800/50"}`,children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m===N.traceId?t.jsx(Xa,{className:"h-4 w-4 text-zinc-500 flex-shrink-0"}):t.jsx(ra,{className:"h-4 w-4 text-zinc-500 flex-shrink-0"}),cu(N.status),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-white truncate",children:N.rootSpanName}),t.jsx("p",{className:"text-xs text-zinc-500",children:A0(N.startTime)})]})]}),t.jsxs("div",{className:"flex items-center gap-4 flex-shrink-0",children:[t.jsxs("span",{className:"text-xs text-zinc-500",children:[N.spanCount," span",N.spanCount!==1?"s":""]}),t.jsx("span",{className:"text-xs font-mono text-zinc-400 w-16 text-right",children:ru(N.durationMs)}),E0(N.status)]})]}),m===N.traceId&&d&&t.jsx("div",{className:"mt-2 ml-4",children:t.jsx(o1,{trace:d})})]},N.traceId))})]})}function R0(){const{login:n,register:r}=li(),d=Et(),[c,m]=u.useState("login"),[f,h]=u.useState(""),[b,g]=u.useState(""),[p,w]=u.useState(""),[v,y]=u.useState(""),[k,z]=u.useState(!1),N=async S=>{S.preventDefault(),y(""),z(!0);try{c==="register"?(await r(f,b,p),await n(f,b)):await n(f,b),d("/",{replace:!0})}catch(C){y(C.message||"An error occurred.")}finally{z(!1)}};return t.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:t.jsxs("div",{className:"w-full max-w-sm",children:[t.jsxs("div",{className:"mb-8 flex flex-col items-center gap-3",children:[t.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-600 text-white",children:t.jsx(Ka,{className:"h-6 w-6"})}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Nestor Studio"}),t.jsx("p",{className:"text-sm text-zinc-400",children:c==="login"?"Sign in to your account":"Create a new account"})]}),t.jsxs("form",{onSubmit:N,className:"space-y-4",children:[v&&t.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-400",children:[t.jsx(Il,{className:"h-4 w-4 flex-shrink-0"}),v]}),c==="register"&&t.jsxs("div",{children:[t.jsx("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Name"}),t.jsx("input",{type:"text",value:p,onChange:S=>w(S.target.value),required:!0,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:"Your name"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Email"}),t.jsx("input",{type:"email",value:f,onChange:S=>h(S.target.value),required:!0,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:"you@example.com"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Password"}),t.jsx("input",{type:"password",value:b,onChange:S=>g(S.target.value),required:!0,minLength:c==="register"?6:1,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500",placeholder:c==="register"?"At least 6 characters":"Your password"})]}),t.jsx("button",{type:"submit",disabled:k,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-indigo-700 disabled:opacity-50",children:k?"Please wait...":c==="login"?t.jsxs(t.Fragment,{children:[t.jsx(xv,{className:"h-4 w-4"})," Sign In"]}):t.jsxs(t.Fragment,{children:[t.jsx(Ev,{className:"h-4 w-4"})," Create Account"]})})]}),t.jsx("div",{className:"mt-6 text-center",children:t.jsx("button",{type:"button",onClick:()=>{m(c==="login"?"register":"login"),y("")},className:"text-sm text-zinc-400 transition-colors hover:text-indigo-400",children:c==="login"?"Don't have an account? Register":"Already have an account? Sign in"})})]})})}function u1(){const{isAdmin:n}=li(),[r,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState("users"),[b,g]=u.useState(!0),[p,w]=u.useState(""),v=u.useCallback(async()=>{try{const N=await fetch("/api/users",{credentials:"include"}),S=await N.json();N.ok&&d(S.data||[])}catch{}},[]),y=u.useCallback(async()=>{try{const N=await fetch("/api/users/audit?limit=50",{credentials:"include"}),S=await N.json();N.ok&&m(S.data||[])}catch{}},[]);u.useEffect(()=>{g(!0),Promise.all([v(),y()]).finally(()=>g(!1))},[v,y]);const k=async(N,S)=>{var C;w("");try{const O=await fetch(`/api/users/${N}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:S})});if(!O.ok){const D=await O.json();throw new Error(((C=D.error)==null?void 0:C.message)||"Failed to update role.")}await v()}catch(O){w(O.message)}},z=async N=>{var S;if(confirm("Are you sure you want to delete this user?")){w("");try{const C=await fetch(`/api/users/${N}`,{method:"DELETE",credentials:"include"});if(!C.ok){const O=await C.json();throw new Error(((S=O.error)==null?void 0:S.message)||"Failed to delete user.")}await v()}catch(C){w(C.message)}}};return n?t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"User Management"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Manage users, roles, and view audit log."})]})}),p&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400",children:p}),t.jsxs("div",{className:"flex gap-1 border-b border-border",children:[t.jsxs("button",{onClick:()=>h("users"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors ${f==="users"?"border-b-2 border-indigo-500 text-indigo-400":"text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(Qn,{className:"h-4 w-4"})," Users (",r.length,")"]}),t.jsxs("button",{onClick:()=>h("audit"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors ${f==="audit"?"border-b-2 border-indigo-500 text-indigo-400":"text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(Fs,{className:"h-4 w-4"})," Audit Log"]})]}),b?t.jsx("div",{className:"text-center text-zinc-400 py-8",children:"Loading..."}):f==="users"?t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Name"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Role"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Provider"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Last Login"}),t.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400",children:"Actions"})]})}),t.jsxs("tbody",{children:[r.map(N=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-white",children:N.name}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:N.email}),t.jsx("td",{className:"px-4 py-3",children:t.jsxs("select",{value:N.role,onChange:S=>k(N.id,S.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs text-white focus:outline-none",children:[t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"member",children:"Member"}),t.jsx("option",{value:"viewer",children:"Viewer"})]})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:N.authProvider}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:N.lastLoginAt?new Date(N.lastLoginAt*1e3).toLocaleString():"Never"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("button",{onClick:()=>z(N.id),className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Delete user",children:t.jsx(Ut,{className:"h-4 w-4"})})})]},N.id)),r.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-zinc-500",children:"No users found."})})]})]})}):t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Time"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Action"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Resource"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"User"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Details"})]})}),t.jsxs("tbody",{children:[c.map(N=>{var S;return t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 text-zinc-400 whitespace-nowrap",children:new Date(N.createdAt*1e3).toLocaleString()}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-indigo-400",children:N.action}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:N.resourceType&&t.jsxs("span",{children:[N.resourceType,N.resourceId?`/${N.resourceId.slice(0,8)}`:""]})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400",children:((S=N.userId)==null?void 0:S.slice(0,8))||"-"}),t.jsx("td",{className:"px-4 py-3 text-xs text-zinc-500 max-w-xs truncate",children:N.details?JSON.stringify(N.details):"-"})]},N.id)}),c.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-zinc-500",children:"No audit entries."})})]})]})})]}):t.jsxs("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:[t.jsx(zs,{className:"mr-2 h-5 w-5"})," Admin access required."]})}function kd({label:n,valueA:r,valueB:d,format:c}){const m=Math.max(r,d,.001);return t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-zinc-400",children:n}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"w-12 text-right text-xs text-indigo-400",children:c(r)}),t.jsxs("div",{className:"flex-1 flex gap-0.5",children:[t.jsx("div",{className:"h-4 rounded-l bg-indigo-500/40",style:{width:`${r/m*50}%`}}),t.jsx("div",{className:"h-4 rounded-r bg-emerald-500/40",style:{width:`${d/m*50}%`}})]}),t.jsx("span",{className:"w-12 text-left text-xs text-emerald-400",children:c(d)})]})]})}function m1(){const{id:n}=Yn(),[r,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(!0),[b,g]=u.useState(""),[p,w]=u.useState(!1),[v,y]=u.useState(""),[k,z]=u.useState(""),[N,S]=u.useState(""),[C,O]=u.useState(""),[D,E]=u.useState(null),[ae,oe]=u.useState(!1),[B,q]=u.useState(""),[I,W]=u.useState(""),[Y,le]=u.useState(""),[J,ce]=u.useState(50),[he,G]=u.useState([]),[ie,me]=u.useState({}),[ne,we]=u.useState(!1),[T,X]=u.useState(""),[re,$]=u.useState(""),[de,xe]=u.useState(""),[be,Ce]=u.useState(.5),ve=u.useCallback(async()=>{if(n){try{const[M,P,ye]=await Promise.all([fetch(`/api/agents/${n}/prompts`,{credentials:"include"}),fetch(`/api/agents/${n}/prompts/ab-tests`,{credentials:"include"}),fetch(`/api/agents/${n}/experiments`,{credentials:"include"})]),Ye=await M.json(),Bt=await P.json(),Ft=await ye.json();if(M.ok&&d(Ye.data||[]),P.ok&&m(Bt.data||[]),ye.ok){const ut=Ft.data||[];G(ut);for(const ri of ut)try{const Jn=await fetch(`/api/experiments/${ri.id}`,{credentials:"include"});if(Jn.ok){const ci=await Jn.json();me(Ps=>({...Ps,[ri.id]:ci.data}))}}catch{}}}catch{}h(!1)}},[n]);u.useEffect(()=>{ve()},[ve]);const Q=async()=>{var M;if(!(!n||!v.trim())){g("");try{const P=await fetch(`/api/agents/${n}/prompts`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({systemPrompt:v,name:k||void 0})});if(!P.ok){const ye=await P.json();throw new Error(((M=ye.error)==null?void 0:M.message)||"Failed")}w(!1),y(""),z(""),await ve()}catch(P){g(P.message)}}},ee=async M=>{var P;if(n){g("");try{const ye=await fetch(`/api/agents/${n}/prompts/${M}/activate`,{method:"PATCH",credentials:"include"});if(!ye.ok){const Ye=await ye.json();throw new Error(((P=Ye.error)==null?void 0:P.message)||"Failed")}await ve()}catch(ye){g(ye.message)}}},ke=async()=>{if(!(!n||!N||!C))try{const M=await fetch(`/api/agents/${n}/prompts/compare?a=${N}&b=${C}`,{credentials:"include"}),P=await M.json();M.ok&&E(P.data)}catch{}},ze=async()=>{var M;if(!(!n||!B||!I)){g("");try{const P=await fetch(`/api/agents/${n}/prompts/ab-tests`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({variantAId:B,variantBId:I,name:Y||void 0,splitPercent:J})});if(!P.ok){const ye=await P.json();throw new Error(((M=ye.error)==null?void 0:M.message)||"Failed")}oe(!1),await ve()}catch(P){g(P.message)}}},Ue=async(M,P)=>{if(n)try{(await fetch(`/api/agents/${n}/prompts/ab-tests/${M}/complete`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({winnerId:P})})).ok&&await ve()}catch{}},Ie=async()=>{if(n){g("");try{const M=r.find(Ye=>Ye.isActive);if(!M){g("No active version to rollback from.");return}const P=r.indexOf(M),ye=r[P+1];if(!ye){g("No previous version to rollback to.");return}await ee(ye.id)}catch(M){g(M.message)}}},De=async()=>{var M;if(!(!n||!T||!re)){g("");try{const P=await fetch(`/api/agents/${n}/experiments`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:de||`Experiment ${new Date().toISOString().slice(0,10)}`,variantAId:T,variantBId:re,trafficSplit:be})});if(!P.ok){const ye=await P.json();throw new Error(((M=ye.error)==null?void 0:M.message)||"Failed")}we(!1),xe(""),X(""),$(""),await ve()}catch(P){g(P.message)}}},tt=async(M,P)=>{try{(await fetch(`/api/experiments/${M}/complete`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({winnerId:P})})).ok&&await ve()}catch{}};return f?t.jsx("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:"Loading..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Prompt Versions"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Manage, compare, and A/B test prompt versions for this agent."})]}),t.jsxs("div",{className:"flex gap-2",children:[r.length>=2&&t.jsxs("button",{onClick:Ie,className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-sm text-zinc-300 hover:bg-surface-hover",children:[t.jsx(y0,{className:"h-4 w-4"})," Rollback"]}),t.jsxs("button",{onClick:()=>we(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-sm text-zinc-300 hover:bg-surface-hover",children:[t.jsx(Zt,{className:"h-4 w-4"})," New Experiment"]}),t.jsxs("button",{onClick:()=>oe(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-sm text-zinc-300 hover:bg-surface-hover",children:[t.jsx(Nd,{className:"h-4 w-4"})," New A/B Test"]}),t.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-3 py-2 text-sm font-medium text-white hover:bg-indigo-700",children:[t.jsx(pt,{className:"h-4 w-4"})," New Version"]})]})]}),b&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400",children:b}),p&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-white",children:"Create New Version"}),t.jsx("button",{onClick:()=>w(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:k,onChange:M=>z(M.target.value),placeholder:"Version name (optional)",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsx("textarea",{value:v,onChange:M=>y(M.target.value),placeholder:"System prompt...",rows:8,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white font-mono"}),t.jsx("button",{onClick:Q,disabled:!v.trim(),className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Create Version"})]}),t.jsxs("div",{className:"space-y-2",children:[r.map(M=>t.jsxs("div",{className:`rounded-lg border p-4 ${M.isActive?"border-indigo-500/50 bg-indigo-500/5":"border-border bg-surface"}`,children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-surface text-sm font-bold text-zinc-300",children:["v",M.version]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-white",children:M.name||`Version ${M.version}`}),M.isActive&&t.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-green-500/20 px-2 py-0.5 text-xs text-green-400",children:[t.jsx(ft,{className:"h-3 w-3"})," Active"]})]}),t.jsxs("div",{className:"mt-1 flex items-center gap-4 text-xs text-zinc-400",children:[t.jsxs("span",{children:[M.totalRuns," runs"]}),t.jsxs("span",{children:["Score: ",M.performanceScore!=null?`${(M.performanceScore*100).toFixed(0)}%`:"N/A"]}),t.jsxs("span",{children:["Avg cost: $",M.avgCostUsd.toFixed(4)]}),t.jsxs("span",{children:["Avg duration: ",M.avgDurationMs.toFixed(0),"ms"]})]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:!M.isActive&&t.jsx("button",{onClick:()=>ee(M.id),className:"rounded-lg border border-border px-3 py-1.5 text-xs text-zinc-300 hover:bg-surface-hover",children:"Activate"})})]}),t.jsx("div",{className:"mt-3 rounded-lg bg-background p-3",children:t.jsxs("pre",{className:"max-h-24 overflow-y-auto text-xs text-zinc-400 font-mono whitespace-pre-wrap",children:[M.systemPrompt.slice(0,500),M.systemPrompt.length>500?"...":""]})})]},M.id)),r.length===0&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-8 text-center text-zinc-400",children:[t.jsx(Fs,{className:"mx-auto mb-2 h-8 w-8"}),"No prompt versions yet. Create your first version."]})]}),r.length>=2&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[t.jsx(ja,{className:"h-4 w-4"})," Compare Versions"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("select",{value:N,onChange:M=>S(M.target.value),className:"flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Select version A"}),r.map(M=>t.jsxs("option",{value:M.id,children:["v",M.version," - ",M.name||`Version ${M.version}`]},M.id))]}),t.jsx(x0,{className:"h-4 w-4 text-zinc-400 flex-shrink-0"}),t.jsxs("select",{value:C,onChange:M=>O(M.target.value),className:"flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Select version B"}),r.map(M=>t.jsxs("option",{value:M.id,children:["v",M.version," - ",M.name||`Version ${M.version}`]},M.id))]}),t.jsx("button",{onClick:ke,disabled:!N||!C||N===C,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm text-white hover:bg-indigo-700 disabled:opacity-50",children:"Compare"})]}),D&&t.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-indigo-400 mb-2",children:["Variant A (v",D.variantA.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(D.aSuccessRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",D.aCostAvg.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[D.aDurationAvg.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Total Runs"}),t.jsx("span",{className:"text-white",children:D.variantA.totalRuns})]})]})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-background p-3",children:[t.jsxs("h4",{className:"text-sm font-medium text-emerald-400 mb-2",children:["Variant B (v",D.variantB.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(D.bSuccessRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",D.bCostAvg.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[D.bDurationAvg.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Total Runs"}),t.jsx("span",{className:"text-white",children:D.variantB.totalRuns})]})]})]})]})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-lg font-medium text-white",children:[t.jsx(Nd,{className:"h-5 w-5"})," A/B Tests"]}),ae&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-sm font-medium text-white",children:"New A/B Test"}),t.jsx("button",{onClick:()=>oe(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:Y,onChange:M=>le(M.target.value),placeholder:"Test name (optional)",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("select",{value:B,onChange:M=>q(M.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant A"}),r.map(M=>t.jsxs("option",{value:M.id,children:["v",M.version," - ",M.name||`Version ${M.version}`]},M.id))]}),t.jsxs("select",{value:I,onChange:M=>W(M.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant B"}),r.map(M=>t.jsxs("option",{value:M.id,children:["v",M.version," - ",M.name||`Version ${M.version}`]},M.id))]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-xs text-zinc-400",children:["Traffic split: ",J,"% A / ",100-J,"% B"]}),t.jsx("input",{type:"range",min:10,max:90,value:J,onChange:M=>ce(Number(M.target.value)),className:"w-full"})]}),t.jsx("button",{onClick:ze,disabled:!B||!I||B===I,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Start Test"})]}),c.map(M=>{const P=r.find(Ye=>Ye.id===M.variantAId),ye=r.find(Ye=>Ye.id===M.variantBId);return t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Nd,{className:"h-4 w-4 text-indigo-400"}),t.jsx("span",{className:"font-medium text-white",children:M.name}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs ${M.status==="running"?"bg-green-500/20 text-green-400":M.status==="completed"?"bg-blue-500/20 text-blue-400":"bg-zinc-500/20 text-zinc-400"}`,children:M.status})]}),t.jsxs("span",{className:"text-xs text-zinc-400",children:[M.totalRuns," runs"]})]}),t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3 text-xs",children:[t.jsxs("div",{className:"rounded bg-background p-2",children:[t.jsxs("div",{className:"text-zinc-400",children:["Variant A (",M.splitPercent,"%)"]}),t.jsxs("div",{className:"text-white mt-1",children:["v",(P==null?void 0:P.version)??"?"," - ",(P==null?void 0:P.name)||"unnamed"]}),P&&t.jsxs("div",{className:"text-zinc-400 mt-1",children:["Score: ",P.performanceScore!=null?`${(P.performanceScore*100).toFixed(0)}%`:"N/A"]})]}),t.jsxs("div",{className:"rounded bg-background p-2",children:[t.jsxs("div",{className:"text-zinc-400",children:["Variant B (",100-M.splitPercent,"%)"]}),t.jsxs("div",{className:"text-white mt-1",children:["v",(ye==null?void 0:ye.version)??"?"," - ",(ye==null?void 0:ye.name)||"unnamed"]}),ye&&t.jsxs("div",{className:"text-zinc-400 mt-1",children:["Score: ",ye.performanceScore!=null?`${(ye.performanceScore*100).toFixed(0)}%`:"N/A"]})]})]}),M.status==="running"&&P&&ye&&t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsxs("button",{onClick:()=>Ue(M.id,M.variantAId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-indigo-400 hover:bg-surface-hover",children:[t.jsx(Bn,{className:"h-3 w-3"})," A wins"]}),t.jsxs("button",{onClick:()=>Ue(M.id,M.variantBId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-emerald-400 hover:bg-surface-hover",children:[t.jsx(Bn,{className:"h-3 w-3"})," B wins"]})]}),M.winnerId&&t.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-yellow-400",children:[t.jsx(Bn,{className:"h-3 w-3"}),"Winner: v",M.winnerId===M.variantAId?P==null?void 0:P.version:ye==null?void 0:ye.version]})]},M.id)}),c.length===0&&!ae&&t.jsx("div",{className:"rounded-lg border border-border bg-surface p-6 text-center text-zinc-400 text-sm",children:"No A/B tests yet. Create one to compare prompt performance."})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-lg font-medium text-white",children:[t.jsx(Zt,{className:"h-5 w-5"})," Experiments"]}),ne&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-sm font-medium text-white",children:"New Experiment"}),t.jsx("button",{onClick:()=>we(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsx("input",{type:"text",value:de,onChange:M=>xe(M.target.value),placeholder:"Experiment name",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("select",{value:T,onChange:M=>X(M.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant A"}),r.map(M=>t.jsxs("option",{value:M.id,children:["v",M.version," - ",M.name||`Version ${M.version}`]},M.id))]}),t.jsxs("select",{value:re,onChange:M=>$(M.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"Variant B"}),r.map(M=>t.jsxs("option",{value:M.id,children:["v",M.version," - ",M.name||`Version ${M.version}`]},M.id))]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-xs text-zinc-400",children:["Traffic split: ",Math.round(be*100),"% A / ",Math.round((1-be)*100),"% B"]}),t.jsx("input",{type:"range",min:10,max:90,value:be*100,onChange:M=>Ce(Number(M.target.value)/100),className:"w-full"})]}),t.jsx("button",{onClick:De,disabled:!T||!re||T===re,className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Start Experiment"})]}),he.map(M=>{const P=ie[M.id];return t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Zt,{className:"h-4 w-4 text-indigo-400"}),t.jsx("span",{className:"font-medium text-white",children:M.name}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs ${M.status==="running"?"bg-green-500/20 text-green-400":M.status==="completed"?"bg-blue-500/20 text-blue-400":M.status==="paused"?"bg-yellow-500/20 text-yellow-400":"bg-zinc-500/20 text-zinc-400"}`,children:M.status})]}),t.jsxs("span",{className:"text-xs text-zinc-400",children:["Split: ",Math.round(M.trafficSplit*100),"% / ",Math.round((1-M.trafficSplit)*100),"%"]})]}),P&&t.jsxs("div",{className:"mt-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"rounded-lg border border-indigo-500/20 bg-background p-3",children:[t.jsxs("h5",{className:"text-xs font-medium text-indigo-400 mb-2",children:["Variant A (v",P.variantA.version.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Runs"}),t.jsx("span",{className:"text-white",children:P.variantA.runs})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(P.variantA.successRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",P.variantA.avgCostUsd.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[P.variantA.avgDurationMs.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Feedback"}),t.jsx("span",{className:"text-white",children:P.variantA.avgFeedbackScore.toFixed(2)})]})]})]}),t.jsxs("div",{className:"rounded-lg border border-emerald-500/20 bg-background p-3",children:[t.jsxs("h5",{className:"text-xs font-medium text-emerald-400 mb-2",children:["Variant B (v",P.variantB.version.version,")"]}),t.jsxs("div",{className:"space-y-1 text-xs",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Runs"}),t.jsx("span",{className:"text-white",children:P.variantB.runs})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Success Rate"}),t.jsxs("span",{className:"text-white",children:[(P.variantB.successRate*100).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Cost"}),t.jsxs("span",{className:"text-white",children:["$",P.variantB.avgCostUsd.toFixed(4)]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Duration"}),t.jsxs("span",{className:"text-white",children:[P.variantB.avgDurationMs.toFixed(0),"ms"]})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-zinc-400",children:"Avg Feedback"}),t.jsx("span",{className:"text-white",children:P.variantB.avgFeedbackScore.toFixed(2)})]})]})]})]}),t.jsxs("div",{className:"space-y-2 rounded-lg bg-background p-3",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs mb-2",children:[t.jsx("span",{className:"text-indigo-400",children:"Variant A"}),t.jsx("span",{className:"text-emerald-400",children:"Variant B"})]}),t.jsx(kd,{label:"Success Rate",valueA:P.variantA.successRate,valueB:P.variantB.successRate,format:ye=>`${(ye*100).toFixed(0)}%`}),t.jsx(kd,{label:"Avg Cost",valueA:P.variantA.avgCostUsd,valueB:P.variantB.avgCostUsd,format:ye=>`$${ye.toFixed(3)}`}),t.jsx(kd,{label:"Duration",valueA:P.variantA.avgDurationMs,valueB:P.variantB.avgDurationMs,format:ye=>`${ye.toFixed(0)}ms`})]}),t.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-background p-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ja,{className:"h-3.5 w-3.5 text-zinc-400"}),t.jsxs("span",{className:"text-zinc-400",children:["p-value: ",P.statisticalSignificance.toFixed(4)]}),P.statisticalSignificance<.05&&t.jsx("span",{className:"rounded-full bg-green-500/20 px-2 py-0.5 text-green-400",children:"Significant"})]}),t.jsx("span",{className:`font-medium ${P.recommendation==="A"?"text-indigo-400":P.recommendation==="B"?"text-emerald-400":"text-zinc-400"}`,children:P.recommendation==="insufficient_data"?"Need more data":`Recommendation: Variant ${P.recommendation}`})]}),M.status==="running"&&P.variantA.runs>0&&P.variantB.runs>0&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("button",{onClick:()=>tt(M.id,M.variantAId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-indigo-400 hover:bg-surface-hover",children:[t.jsx(Bn,{className:"h-3 w-3"})," A wins"]}),t.jsxs("button",{onClick:()=>tt(M.id,M.variantBId),className:"flex items-center gap-1 rounded-lg border border-border px-3 py-1.5 text-xs text-emerald-400 hover:bg-surface-hover",children:[t.jsx(Bn,{className:"h-3 w-3"})," B wins"]})]}),M.winnerId&&t.jsxs("div",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[t.jsx(Bn,{className:"h-3 w-3"}),"Winner: ",M.winnerId===M.variantAId?"Variant A":"Variant B"]})]}),!P&&t.jsx("div",{className:"mt-3 text-xs text-zinc-500",children:"No runs yet. Run the agent to start collecting data."})]},M.id)}),he.length===0&&!ne&&t.jsx("div",{className:"rounded-lg border border-border bg-surface p-6 text-center text-zinc-400 text-sm",children:"No experiments yet. Create one to A/B test prompts with per-run metrics and statistical analysis."})]})]})}const M0="/api";async function Mr(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=await fetch(`${M0}${n}`,{headers:d});if(!c.ok)throw new Error(`API error: ${c.status}`);return c.json()}async function x1(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=await fetch(`${M0}${n}`,{method:"DELETE",headers:d});if(!c.ok)throw new Error(`API error: ${c.status}`)}const f1={observation:"bg-blue-500/20 text-blue-400",fact:"bg-green-500/20 text-green-400",instruction:"bg-purple-500/20 text-purple-400",reflection:"bg-amber-500/20 text-amber-400"};function qh({type:n}){return t.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${f1[n]??"bg-zinc-500/20 text-zinc-400"}`,children:n})}function h1({value:n}){const r=Math.round(n*100),d=r>=80?"bg-red-500":r>=50?"bg-amber-500":"bg-green-500";return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-1.5 w-16 rounded-full bg-zinc-700",children:t.jsx("div",{className:`h-full rounded-full ${d}`,style:{width:`${r}%`}})}),t.jsxs("span",{className:"text-xs text-zinc-500",children:[r,"%"]})]})}function Dr({label:n,value:r,icon:d}){return t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-zinc-400",children:[t.jsx(d,{className:"h-4 w-4"}),t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider",children:n})]}),t.jsx("p",{className:"mt-2 text-2xl font-semibold text-white",children:r})]})}function p1(){const{t:n}=nt(),[r,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(null),[b,g]=u.useState(!0),[p,w]=u.useState(""),[v,y]=u.useState(""),[k,z]=u.useState(""),[N,S]=u.useState(null);u.useEffect(()=>{Mr("/agents").then(E=>m(E.data)).catch(console.error)},[]);const C=u.useCallback(async()=>{g(!0);try{const E=new URLSearchParams;p&&E.set("q",p),v&&E.set("agentId",v),k&&E.set("type",k),E.set("limit","100");const ae=E.toString(),oe=await Mr(`/memory?${ae}`);if(d(oe.data),v){const B=await Mr(`/memory/stats/${v}`);h(B.data)}else if(c.length>0){let B=0,q=0;const I={};let W=!1;for(const Y of c)try{const le=await Mr(`/memory/stats/${Y.id}`);B+=le.data.total,q+=le.data.avgImportance*le.data.total;for(const[J,ce]of Object.entries(le.data.byType))I[J]=(I[J]??0)+ce;le.data.fts5Available&&(W=!0)}catch{}h({total:B,byType:I,avgImportance:B>0?q/B:0,fts5Available:W})}}catch(E){console.error("Failed to load memories:",E)}finally{g(!1)}},[p,v,k,c]);u.useEffect(()=>{(c.length>0||v)&&C()},[C,c.length,v]);const O=async E=>{S(E);try{await x1(`/memory/${E}`),d(ae=>ae.filter(oe=>oe.id!==E))}catch(ae){console.error("Failed to delete memory:",ae)}finally{S(null)}},D=E=>{E.preventDefault(),C()};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ws,{className:"h-6 w-6 text-indigo-400"}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Memory"})]}),(f==null?void 0:f.fts5Available)&&t.jsx("span",{className:"rounded-full bg-green-500/10 px-3 py-1 text-xs font-medium text-green-400",children:"FTS5 Active"})]}),f&&t.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[t.jsx(Dr,{label:"Total Memories",value:f.total,icon:ws}),t.jsx(Dr,{label:"Avg Importance",value:`${Math.round(f.avgImportance*100)}%`,icon:ja}),t.jsx(Dr,{label:"Types",value:Object.keys(f.byType).length,icon:Sv}),t.jsx(Dr,{label:"Observations",value:f.byType.observation??0,icon:qn})]}),f&&Object.keys(f.byType).length>0&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("h3",{className:"mb-3 text-sm font-medium text-zinc-400",children:"Distribution by Type"}),t.jsx("div",{className:"flex gap-4",children:Object.entries(f.byType).map(([E,ae])=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(qh,{type:E}),t.jsx("span",{className:"text-sm text-white",children:ae})]},E))})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("form",{onSubmit:D,className:"flex flex-1 gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(ks,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",value:p,onChange:E=>w(E.target.value),placeholder:"Search memories...",className:"w-full rounded-lg border border-border bg-surface py-2 pl-10 pr-4 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none"})]}),t.jsx("button",{type:"submit",className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:"Search"})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("select",{value:v,onChange:E=>y(E.target.value),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"",children:"All Agents"}),c.map(E=>t.jsx("option",{value:E.id,children:E.name},E.id))]}),t.jsxs("select",{value:k,onChange:E=>z(E.target.value),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"",children:"All Types"}),t.jsx("option",{value:"observation",children:"Observation"}),t.jsx("option",{value:"fact",children:"Fact"}),t.jsx("option",{value:"instruction",children:"Instruction"}),t.jsx("option",{value:"reflection",children:"Reflection"})]})]})]}),b?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):r.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface py-16",children:[t.jsx(ws,{className:"h-12 w-12 text-zinc-600"}),t.jsx("p",{className:"mt-4 text-sm text-zinc-400",children:"No memories found"}),t.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Memories are created when agents store observations, facts, and reflections."})]}):t.jsx("div",{className:"space-y-2",children:r.map(E=>t.jsx("div",{className:"group rounded-lg border border-border bg-surface p-4 transition-colors hover:border-border/80",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx(qh,{type:E.memoryType}),t.jsx(h1,{value:E.importance}),t.jsxs("span",{className:"text-xs text-zinc-500",children:[new Date(E.createdAt*1e3).toLocaleDateString()," ",new Date(E.createdAt*1e3).toLocaleTimeString()]}),E.accessCount>0&&t.jsxs("span",{className:"text-xs text-zinc-600",children:["accessed ",E.accessCount,"x"]})]}),t.jsx("p",{className:"mt-2 text-sm text-zinc-200 leading-relaxed",children:E.content}),E.tags.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:E.tags.map(ae=>t.jsxs("span",{className:"inline-flex items-center rounded bg-zinc-800 px-1.5 py-0.5 text-[10px] text-zinc-400",children:["#",ae]},ae))})]}),t.jsx("button",{onClick:()=>O(E.id),disabled:N===E.id,className:"rounded p-1.5 text-zinc-500 opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100 disabled:opacity-50",title:"Delete memory",children:N===E.id?t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border border-red-400 border-t-transparent"}):t.jsx(Ut,{className:"h-4 w-4"})})]})},E.id))})]})}const g1="/api/budget";function b1(){const n={"Content-Type":"application/json"},r=localStorage.getItem("nestor_token");return r&&(n.Authorization=`Bearer ${r}`),n}async function js(n,r){const d=await fetch(`${g1}${n}`,{...r,headers:b1()});if(!d.ok)throw new Error(`API error: ${d.status}`);if(d.status!==204)return d.json()}const Xs={listPolicies:()=>js("/policies"),createPolicy:n=>js("/policies",{method:"POST",body:JSON.stringify(n)}),updatePolicy:(n,r)=>js(`/policies/${n}`,{method:"PUT",body:JSON.stringify(r)}),deletePolicy:n=>js(`/policies/${n}`,{method:"DELETE"}),utilization:()=>js("/utilization"),incidents:(n=50)=>js(`/incidents?limit=${n}`),pauseAgent:n=>js(`/agents/${n}/pause`,{method:"POST",body:"{}"}),resumeAgent:n=>js(`/agents/${n}/resume`,{method:"POST",body:"{}"})};function Ud(n){return n<.01?`$${n.toFixed(4)}`:n<1?`$${n.toFixed(3)}`:`$${n.toFixed(2)}`}function D0(n){return new Date(n*1e3).toLocaleString()}function O0(n){switch(n){case"warning":return"text-amber-400";case"breach":return"text-red-400";case"pause":return"text-orange-400";case"resume":return"text-emerald-400";default:return"text-zinc-400"}}function y1(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function Gh({initial:n,onSave:r,onCancel:d}){const[c,m]=u.useState((n==null?void 0:n.name)??""),[f,h]=u.useState((n==null?void 0:n.scope)??"global"),[b,g]=u.useState((n==null?void 0:n.scopeId)??""),[p,w]=u.useState((n==null?void 0:n.window)??"monthly"),[v,y]=u.useState(String((n==null?void 0:n.limitUsd)??10)),[k,z]=u.useState(String((n==null?void 0:n.warningThresholdPercent)??80)),[N,S]=u.useState((n==null?void 0:n.action)??"stop"),[C,O]=u.useState((n==null?void 0:n.enabled)!==!1),D=E=>{E.preventDefault(),r({name:c,scope:f,scopeId:b||null,window:p,limitUsd:parseFloat(v)||10,warningThresholdPercent:parseFloat(k)||80,action:N,enabled:C})};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:t.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border bg-surface p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold text-white",children:n!=null&&n.id?"Edit Policy":"New Budget Policy"}),t.jsx("button",{onClick:d,className:"text-zinc-400 hover:text-white",children:t.jsx(et,{className:"h-5 w-5"})})]}),t.jsxs("form",{onSubmit:D,className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Name"}),t.jsx("input",{value:c,onChange:E=>m(E.target.value),required:!0,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Scope"}),t.jsxs("select",{value:f,onChange:E=>h(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"global",children:"Global"}),t.jsx("option",{value:"agent",children:"Agent"}),t.jsx("option",{value:"workflow",children:"Workflow"}),t.jsx("option",{value:"tenant",children:"Tenant"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Scope ID"}),t.jsx("input",{value:b,onChange:E=>g(E.target.value),placeholder:"(optional)",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Window"}),t.jsxs("select",{value:p,onChange:E=>w(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"per_run",children:"Per Run"}),t.jsx("option",{value:"hourly",children:"Hourly"}),t.jsx("option",{value:"daily",children:"Daily"}),t.jsx("option",{value:"weekly",children:"Weekly"}),t.jsx("option",{value:"monthly",children:"Monthly"}),t.jsx("option",{value:"lifetime",children:"Lifetime"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Limit (USD)"}),t.jsx("input",{type:"number",step:"0.01",min:"0",value:v,onChange:E=>y(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Warning at (%)"}),t.jsx("input",{type:"number",step:"1",min:"0",max:"100",value:k,onChange:E=>z(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs text-zinc-400 mb-1",children:"Action"}),t.jsxs("select",{value:N,onChange:E=>S(E.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"stop",children:"Stop"}),t.jsx("option",{value:"pause",children:"Pause"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"notify",children:"Notify"})]})]})]}),t.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-300",children:[t.jsx("input",{type:"checkbox",checked:C,onChange:E=>O(E.target.checked),className:"rounded border-border"}),"Enabled"]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[t.jsx("button",{type:"button",onClick:d,className:"px-4 py-2 text-sm text-zinc-400 hover:text-white",children:"Cancel"}),t.jsx("button",{type:"submit",className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:"Save"})]})]})]})})}function v1({report:n}){const r=n.policy;return t.jsxs("div",{className:"card",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-white",children:r.name}),t.jsxs("p",{className:"text-xs text-zinc-500",children:[r.scope,r.scopeId?` / ${r.scopeId}`:""," · ",r.window," · ",r.action]})]}),t.jsx("span",{className:`text-xs font-medium ${r.enabled?"text-emerald-400":"text-zinc-500"}`,children:r.enabled?"Active":"Disabled"})]}),t.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-zinc-400",children:[t.jsxs("span",{children:[Ud(n.spentUsd)," / ",Ud(r.limitUsd)]}),t.jsxs("span",{children:[n.utilizationPercent.toFixed(1),"%"]})]}),t.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-zinc-800",children:t.jsx("div",{className:`h-full rounded-full transition-all ${y1(n.utilizationPercent)}`,style:{width:`${Math.min(100,n.utilizationPercent)}%`}})}),n.incidents.length>0&&t.jsxs("div",{className:"mt-2 text-xs text-zinc-500",children:["Last incident: ",t.jsx("span",{className:O0(n.incidents[0].type),children:n.incidents[0].type})," ",D0(n.incidents[0].createdAt)]})]})}function j1(){const{t:n}=nt(),[r,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState([]),[b,g]=u.useState(!0),[p,w]=u.useState(null),[v,y]=u.useState(!1),[k,z]=u.useState(null),N=u.useCallback(async()=>{try{g(!0),w(null);const[E,ae,oe]=await Promise.all([Xs.listPolicies(),Xs.utilization(),Xs.incidents(50)]);d(E.data),m(ae.data),h(oe.data)}catch(E){w(E instanceof Error?E.message:"Failed to load budget data")}finally{g(!1)}},[]);u.useEffect(()=>{N()},[N]);const S=async E=>{try{await Xs.createPolicy(E),y(!1),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to create policy")}},C=async E=>{if(k)try{await Xs.updatePolicy(k.id,E),z(null),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to update policy")}},O=async E=>{if(confirm("Delete this budget policy?"))try{await Xs.deletePolicy(E),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to delete policy")}},D=async E=>{try{await Xs.resumeAgent(E),await N()}catch(ae){w(ae instanceof Error?ae.message:"Failed to resume agent")}};return b?t.jsx("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:"Loading budget data..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Budget Management"}),t.jsx("p",{className:"text-sm text-zinc-400",children:"Scoped budget policies, utilization tracking, and cost control."})]}),t.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:[t.jsx(pt,{className:"h-4 w-4"})," New Policy"]})]}),p&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:p}),c.length>0&&t.jsxs("section",{children:[t.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Utilization"}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",children:c.map(E=>t.jsx(v1,{report:E},E.policy.id))})]}),t.jsxs("section",{children:[t.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Policies"}),r.length===0?t.jsx("div",{className:"card text-center text-sm text-zinc-500 py-8",children:'No budget policies configured. Click "New Policy" to create one.'}):t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-left text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border text-zinc-500",children:[t.jsx("th",{className:"py-2 px-3 font-medium",children:"Name"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Scope"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Window"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Limit"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Action"}),t.jsx("th",{className:"py-2 px-3 font-medium",children:"Status"}),t.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"Actions"})]})}),t.jsx("tbody",{children:r.map(E=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover transition-colors",children:[t.jsx("td",{className:"py-2.5 px-3 text-white font-medium",children:E.name}),t.jsxs("td",{className:"py-2.5 px-3 text-zinc-300",children:[E.scope,E.scopeId?t.jsxs("span",{className:"text-zinc-500",children:[" / ",E.scopeId]}):""]}),t.jsx("td",{className:"py-2.5 px-3 text-zinc-300",children:E.window}),t.jsx("td",{className:"py-2.5 px-3 text-zinc-300",children:Ud(E.limitUsd)}),t.jsx("td",{className:"py-2.5 px-3",children:t.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${E.action==="stop"?"bg-red-500/10 text-red-400":E.action==="pause"?"bg-orange-500/10 text-orange-400":E.action==="warn"?"bg-amber-500/10 text-amber-400":"bg-blue-500/10 text-blue-400"}`,children:E.action})}),t.jsx("td",{className:"py-2.5 px-3",children:t.jsx("span",{className:`text-xs ${E.enabled?"text-emerald-400":"text-zinc-500"}`,children:E.enabled?"Enabled":"Disabled"})}),t.jsx("td",{className:"py-2.5 px-3 text-right",children:t.jsxs("div",{className:"flex items-center justify-end gap-1",children:[t.jsx("button",{onClick:()=>z(E),className:"p-1 text-zinc-400 hover:text-white",title:"Edit",children:t.jsx(vv,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>O(E.id),className:"p-1 text-zinc-400 hover:text-red-400",title:"Delete",children:t.jsx(Ut,{className:"h-3.5 w-3.5"})})]})})]},E.id))})]})})]}),t.jsxs("section",{children:[t.jsx("h2",{className:"mb-3 text-lg font-semibold text-white",children:"Recent Incidents"}),f.length===0?t.jsx("div",{className:"card text-center text-sm text-zinc-500 py-6",children:"No budget incidents recorded."}):t.jsx("div",{className:"space-y-1",children:f.map(E=>t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/30 bg-surface px-4 py-2.5 text-sm",children:[t.jsx("span",{className:`font-medium ${O0(E.type)}`,children:E.type.toUpperCase()}),t.jsx("span",{className:"flex-1 text-zinc-300 truncate",children:E.message}),E.agentId&&t.jsxs("span",{className:"text-xs text-zinc-500",children:["Agent: ",E.agentId.slice(0,8)]}),t.jsx("span",{className:"text-xs text-zinc-500",children:D0(E.createdAt)}),E.type==="pause"&&E.agentId&&t.jsxs("button",{onClick:()=>D(E.agentId),className:"flex items-center gap-1 rounded bg-emerald-600/20 px-2 py-1 text-xs text-emerald-400 hover:bg-emerald-600/30",children:[t.jsx(lv,{className:"h-3 w-3"})," Resume"]})]},E.id))})]}),v&&t.jsx(Gh,{onSave:S,onCancel:()=>y(!1)}),k&&t.jsx(Gh,{initial:k,onSave:C,onCancel:()=>z(null)})]})}const L0={mission:"Mission",objective:"Objective",key_result:"Key Result",task:"Task"},N1={mission:"bg-purple-500/10 text-purple-400 border-purple-500/20",objective:"bg-blue-500/10 text-blue-400 border-blue-500/20",key_result:"bg-cyan-500/10 text-cyan-400 border-cyan-500/20",task:"bg-green-500/10 text-green-400 border-green-500/20"},w1={active:Zs,completed:Nt,paused:Yr,cancelled:et},S1={active:"text-indigo-400",completed:"text-green-400",paused:"text-amber-400",cancelled:"text-zinc-500"};function _0({goal:n,depth:r,agents:d,onEdit:c,onDelete:m,onStatusChange:f}){const[h,b]=u.useState(r<2),g=n.children&&n.children.length>0,p=w1[n.status]??Zs,w=d.find(v=>v.id===n.ownerAgentId);return t.jsxs("div",{className:"group",children:[t.jsxs("div",{className:`flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-surface-hover ${r===0?"bg-surface border border-border":""}`,style:{paddingLeft:`${r*24+12}px`},children:[t.jsx("button",{onClick:()=>b(!h),className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded transition-colors ${g?"text-zinc-400 hover:text-zinc-200":"text-transparent"}`,disabled:!g,children:g&&(h?t.jsx(Xa,{className:"h-3.5 w-3.5"}):t.jsx(ra,{className:"h-3.5 w-3.5"}))}),t.jsx(p,{className:`h-4 w-4 flex-shrink-0 ${S1[n.status]}`}),t.jsx("span",{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-medium uppercase ${N1[n.type]}`,children:L0[n.type]}),t.jsx("span",{className:"flex-1 truncate text-sm font-medium text-zinc-200",children:n.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-1.5 w-20 rounded-full bg-zinc-800",children:t.jsx("div",{className:"h-full rounded-full bg-indigo-500 transition-all",style:{width:`${n.progressPercent}%`}})}),t.jsxs("span",{className:"w-8 text-right text-xs text-zinc-500",children:[n.progressPercent,"%"]})]}),w&&t.jsxs("span",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[t.jsx(Ya,{className:"h-3 w-3"}),w.name]}),n.dueDate&&t.jsxs("span",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[t.jsx(nv,{className:"h-3 w-3"}),new Date(n.dueDate).toLocaleDateString()]}),t.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[n.status==="active"&&t.jsx("button",{onClick:()=>f(n.id,"completed"),className:"rounded p-1 text-zinc-500 hover:bg-green-500/10 hover:text-green-400",title:"Mark completed",children:t.jsx(Nt,{className:"h-3.5 w-3.5"})}),n.status==="active"&&t.jsx("button",{onClick:()=>f(n.id,"paused"),className:"rounded p-1 text-zinc-500 hover:bg-amber-500/10 hover:text-amber-400",title:"Pause",children:t.jsx(Yr,{className:"h-3.5 w-3.5"})}),n.status==="paused"&&t.jsx("button",{onClick:()=>f(n.id,"active"),className:"rounded p-1 text-zinc-500 hover:bg-indigo-500/10 hover:text-indigo-400",title:"Resume",children:t.jsx(Zs,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>c(n),className:"rounded p-1 text-zinc-500 hover:bg-surface-hover hover:text-zinc-200",title:"Edit",children:t.jsx(Id,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:()=>m(n.id),className:"rounded p-1 text-zinc-500 hover:bg-red-500/10 hover:text-red-400",title:"Delete",children:t.jsx(Ut,{className:"h-3.5 w-3.5"})})]})]}),h&&g&&t.jsx("div",{children:n.children.map(v=>t.jsx(_0,{goal:v,depth:r+1,agents:d,onEdit:c,onDelete:m,onStatusChange:f},v.id))})]})}function k1({goal:n,parentGoals:r,agents:d,onSave:c,onClose:m}){const[f,h]=u.useState((n==null?void 0:n.title)??""),[b,g]=u.useState((n==null?void 0:n.description)??""),[p,w]=u.useState((n==null?void 0:n.type)??"task"),[v,y]=u.useState((n==null?void 0:n.parentId)??""),[k,z]=u.useState((n==null?void 0:n.ownerAgentId)??""),[N,S]=u.useState((n==null?void 0:n.priority)??5),[C,O]=u.useState((n==null?void 0:n.dueDate)??""),D=E=>{E.preventDefault(),c({title:f,description:b||void 0,type:p,parentId:v||null,ownerAgentId:k||void 0,priority:N,dueDate:C||void 0})};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-surface p-6 shadow-xl",children:[t.jsx("h2",{className:"text-lg font-semibold text-white mb-4",children:n?"Edit Goal":"Create Goal"}),t.jsxs("form",{onSubmit:D,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Title"}),t.jsx("input",{type:"text",value:f,onChange:E=>h(E.target.value),className:"input w-full",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Description"}),t.jsx("textarea",{value:b,onChange:E=>g(E.target.value),className:"input w-full h-20 resize-none"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Type"}),t.jsxs("select",{value:p,onChange:E=>w(E.target.value),className:"input w-full",children:[t.jsx("option",{value:"mission",children:"Mission"}),t.jsx("option",{value:"objective",children:"Objective"}),t.jsx("option",{value:"key_result",children:"Key Result"}),t.jsx("option",{value:"task",children:"Task"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Parent"}),t.jsxs("select",{value:v,onChange:E=>y(E.target.value),className:"input w-full",children:[t.jsx("option",{value:"",children:"None (root)"}),r.map(E=>t.jsxs("option",{value:E.id,children:["[",L0[E.type],"] ",E.title]},E.id))]})]})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Priority (1-10)"}),t.jsx("input",{type:"number",min:1,max:10,value:N,onChange:E=>S(Number(E.target.value)),className:"input w-full"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Assign Agent"}),t.jsxs("select",{value:k,onChange:E=>z(E.target.value),className:"input w-full",children:[t.jsx("option",{value:"",children:"Unassigned"}),d.map(E=>t.jsx("option",{value:E.id,children:E.name},E.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Due Date"}),t.jsx("input",{type:"date",value:C,onChange:E=>O(E.target.value),className:"input w-full"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{type:"button",onClick:m,className:"btn-ghost",children:"Cancel"}),t.jsx("button",{type:"submit",className:"btn-primary",children:n?"Update":"Create"})]})]})]})})}function U0(n,r=[]){for(const d of n)r.push(d),d.children&&U0(d.children,r);return r}function z1(){const{t:n}=nt(),[r,d]=u.useState([]),[c,m]=u.useState([]),[f,h]=u.useState(!0),[b,g]=u.useState(null),[p,w]=u.useState(null),v=u.useCallback(async()=>{try{g(null);const[S,C]=await Promise.all([Xl.tree(),Cs.list()]);d(S.data),m(C.data)}catch(S){g(S instanceof Error?S.message:"Failed to fetch goals")}finally{h(!1)}},[]);u.useEffect(()=>{v()},[v]);const y=async S=>{try{p&&p!=="new"?await Xl.update(p.id,S):await Xl.create(S),w(null),v()}catch(C){console.error("Save failed:",C)}},k=async S=>{if(confirm("Delete this goal and all its children?"))try{await Xl.delete(S),v()}catch(C){console.error("Delete failed:",C)}},z=async(S,C)=>{try{await Xl.update(S,{status:C}),v()}catch(O){console.error("Status change failed:",O)}};if(f)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});const N=U0(r);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Goals"}),r.length>0&&t.jsxs("span",{className:"badge bg-indigo-500/10 text-indigo-400",children:[N.length," total"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:v,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:()=>w("new"),className:"btn-primary btn-sm",children:[t.jsx(pt,{className:"h-4 w-4"}),"New Goal"]})]})]}),b&&t.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-4 text-sm text-red-400",children:[b,t.jsx("button",{onClick:v,className:"ml-3 underline",children:"Retry"})]}),r.length===0&&!b?t.jsx(Js,{icon:t.jsx(Zs,{className:"h-8 w-8"}),title:"No goals yet",description:"Goals let you define objectives and track AI agent progress with an OKR-style hierarchy.",action:t.jsxs("div",{className:"mt-2 space-y-3 text-left max-w-md",children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Goal hierarchy:"}),t.jsxs("ul",{className:"text-xs text-zinc-400 space-y-1",children:[t.jsxs("li",{children:[t.jsx("span",{className:"text-purple-400 font-medium",children:"Mission"})," → High-level strategic goal"]}),t.jsxs("li",{children:[t.jsx("span",{className:"text-blue-400 font-medium",children:"Objective"})," → Measurable outcome"]}),t.jsxs("li",{children:[t.jsx("span",{className:"text-cyan-400 font-medium",children:"Key Result"})," → Quantifiable metric"]}),t.jsxs("li",{children:[t.jsx("span",{className:"text-green-400 font-medium",children:"Task"})," → Actionable work item"]})]})]}),t.jsxs("button",{onClick:()=>w("new"),className:"btn-primary btn-sm",children:[t.jsx(pt,{className:"h-4 w-4"}),"Create your first goal"]})]})}):t.jsx("div",{className:"space-y-1",children:r.map(S=>t.jsx(_0,{goal:S,depth:0,agents:c,onEdit:C=>w(C),onDelete:k,onStatusChange:z},S.id))}),p!==null&&t.jsx(k1,{goal:p==="new"?null:p,parentGoals:N,agents:c,onSave:y,onClose:()=>w(null)})]})}function C1(){const n=Et(),{t:r}=nt(),[d,c]=u.useState([]),[m,f]=u.useState(!0),[h,b]=u.useState("pending"),[g,p]=u.useState({}),[w,v]=u.useState(null),y=u.useCallback(async()=>{try{const S=h==="all"?void 0:{status:h},C=await Hr.list(S);c(C.data)}catch{}finally{f(!1)}},[h]);u.useEffect(()=>{f(!0),y()},[y]);const k=async S=>{var O;const C=(O=g[S.id])==null?void 0:O.trim();if(C){v(S.id);try{await Hr.resume(S.id,C),p(D=>{const E={...D};return delete E[S.id],E}),y()}catch(D){console.error("Resume failed:",D)}finally{v(null)}}},z=S=>{switch(S){case"pending":return t.jsx(qn,{className:"h-4 w-4 text-amber-400"});case"resumed":return t.jsx(ft,{className:"h-4 w-4 text-green-400"});case"expired":return t.jsx(At,{className:"h-4 w-4 text-zinc-500"});default:return t.jsx(qn,{className:"h-4 w-4 text-zinc-500"})}},N=S=>{const C={pending:"bg-amber-500/10 text-amber-400 border-amber-500/30",resumed:"bg-green-500/10 text-green-400 border-green-500/30",expired:"bg-zinc-500/10 text-zinc-400 border-zinc-500/30"};return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${C[S]??C.expired}`,children:[z(S),S]})};return m?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Pl,{className:"h-6 w-6 text-amber-400"}),t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Handoffs"})]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("button",{onClick:y,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-3.5 w-3.5"})})})]}),t.jsx("div",{className:"flex gap-2",children:["pending","resumed","expired","all"].map(S=>t.jsx("button",{className:`rounded-lg px-3 py-1.5 text-sm font-medium transition-colors ${h===S?"bg-indigo-500/10 text-indigo-400 border border-indigo-500/30":"text-zinc-400 hover:text-zinc-200 border border-transparent"}`,onClick:()=>b(S),children:S.charAt(0).toUpperCase()+S.slice(1)},S))}),d.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[t.jsx("div",{className:"mb-4 rounded-2xl bg-surface p-4 text-zinc-500",children:t.jsx(Pl,{className:"h-8 w-8"})}),t.jsxs("h3",{className:"text-lg font-medium text-zinc-300",children:["No ",h==="all"?"":h+" ","handoffs"]}),t.jsx("p",{className:"mt-1.5 max-w-sm text-sm text-zinc-500",children:"Handoffs occur when an agent encounters a blocking issue and needs human help to continue."}),t.jsxs("div",{className:"mt-4 space-y-3 text-left max-w-md",children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Handoffs are created automatically when:"}),t.jsxs("ul",{className:"text-xs text-zinc-400 space-y-1 list-disc list-inside",children:[t.jsx("li",{children:"An agent needs credentials or access it doesn't have"}),t.jsx("li",{children:"A task requires human judgment or decision"}),t.jsx("li",{children:"An agent encounters an unrecoverable error"})]})]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Run a complex mission and the agent will hand off to you if it gets stuck."})]})]}):t.jsx("div",{className:"space-y-4",children:d.map(S=>{var C;return t.jsxs("div",{className:`card ${S.status==="pending"?"border-amber-500/20":""}`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[N(S.status),t.jsxs("span",{className:"text-xs text-zinc-500 font-mono",children:[S.id.slice(0,12),"..."]})]}),t.jsx("button",{className:"text-xs text-indigo-400 hover:text-indigo-300",onClick:()=>n(`/runs/${S.runId}`),children:"View Run"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1 font-medium",children:"Accomplished"}),t.jsx("p",{className:"text-sm text-zinc-300",children:S.accomplished})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1 font-medium",children:"Blocking"}),t.jsx("p",{className:"text-sm text-red-400",children:S.blocking})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1 font-medium",children:"Suggestions"}),t.jsx("p",{className:"text-sm text-zinc-300",children:S.suggestions})]})]}),t.jsxs("div",{className:"flex items-center gap-3 mt-3 text-xs text-zinc-500",children:[t.jsxs("span",{children:["Agent: ",S.agentId.slice(0,12),"..."]}),t.jsxs("span",{children:["Created: ",new Date(S.createdAt).toLocaleString()]}),S.resumedAt&&t.jsxs("span",{children:["Resumed: ",new Date(S.resumedAt).toLocaleString()]})]}),S.status==="pending"&&t.jsxs("div",{className:"mt-4 flex items-center gap-2 border-t border-zinc-800 pt-3",children:[t.jsx("input",{type:"text",className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-indigo-500 focus:outline-none",placeholder:"Describe how you resolved the blocking issue...",value:g[S.id]??"",onChange:O=>p(D=>({...D,[S.id]:O.target.value}))}),t.jsx("button",{className:"btn-primary btn-sm",disabled:!((C=g[S.id])!=null&&C.trim())||w===S.id,onClick:()=>k(S),children:w===S.id?"Resuming...":"Resume"})]})]},S.id)})})]})}const Kh={low:"bg-green-500/10 text-green-400 border-green-500/20",medium:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",high:"bg-orange-500/10 text-orange-400 border-orange-500/20",critical:"bg-red-500/10 text-red-400 border-red-500/20"};function A1({level:n}){return t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${Kh[n]??Kh.low}`,children:[n==="critical"&&t.jsx(dt,{className:"h-3 w-3"}),n==="high"&&t.jsx(dt,{className:"h-3 w-3"}),n.toUpperCase()]})}const Jr="/api";async function zd(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=await fetch(`${Jr}/plans/${n}`,{headers:d});if(!c.ok)throw new Error(`Failed to fetch plan: ${c.statusText}`);return(await c.json()).data}async function E1(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=await fetch(`${Jr}/plans/${n}/execute`,{method:"POST",headers:d});if(!c.ok)throw new Error(`Failed to execute plan: ${c.statusText}`)}async function T1(n){const r=localStorage.getItem("nestor_token"),d={"Content-Type":"application/json"};r&&(d.Authorization=`Bearer ${r}`);const c=await fetch(`${Jr}/plans/${n}/cancel`,{method:"POST",headers:d});if(!c.ok)throw new Error(`Failed to cancel plan: ${c.statusText}`)}async function R1(){const n=localStorage.getItem("nestor_token"),r={"Content-Type":"application/json"};n&&(r.Authorization=`Bearer ${n}`);const d=await fetch(`${Jr}/plans?limit=50`,{headers:r});if(!d.ok)throw new Error(`Failed to fetch plans: ${d.statusText}`);return(await d.json()).data}function M1(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),m=Et();return u.useEffect(()=>{R1().then(r).catch(console.error).finally(()=>c(!1))},[]),d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Dry-Run Plans"})}),n.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface p-12 text-center",children:[t.jsx(zs,{className:"mb-4 h-12 w-12 text-zinc-600"}),t.jsx("h3",{className:"text-lg font-medium text-zinc-300",children:"No dry-run plans yet"}),t.jsx("p",{className:"mt-1.5 max-w-md text-sm text-zinc-500",children:"Plans let you preview what an agent will do before it executes. The agent creates a step-by-step plan with cost estimates and risk levels."}),t.jsxs("div",{className:"mt-4 space-y-3 text-left max-w-md",children:[t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Create a plan via CLI:"}),t.jsx("code",{className:"text-xs text-indigo-400 font-mono block",children:'npx nestor-sh plan "Audit the codebase for security issues"'})]}),t.jsxs("div",{className:"rounded-lg bg-zinc-900 border border-zinc-800 p-3",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-1.5 font-medium",children:"Or via API:"}),t.jsxs("code",{className:"text-xs text-indigo-400 font-mono block",children:["POST /api/plans ","{",' "agentId": "...", "prompt": "..." ',"}"]})]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Once created, you can review each step, approve or reject, then execute."})]})]}):t.jsx("div",{className:"space-y-3",children:n.map(f=>t.jsxs("button",{onClick:()=>m(`/plans/${f.id}`),className:"flex w-full items-center justify-between rounded-lg border border-border bg-surface p-4 text-left transition-colors hover:bg-surface-hover",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"text-sm font-medium text-white",children:[f.prompt.slice(0,80),f.prompt.length>80?"...":""]}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${f.status==="completed"?"bg-green-500/10 text-green-400":f.status==="executing"?"bg-blue-500/10 text-blue-400":f.status==="cancelled"?"bg-zinc-500/10 text-zinc-400":"bg-yellow-500/10 text-yellow-400"}`,children:f.status})]}),t.jsxs("div",{className:"mt-1 flex items-center gap-4 text-xs text-zinc-500",children:[t.jsxs("span",{children:[f.steps.length," step(s)"]}),t.jsxs("span",{children:["$",f.estimatedCostUsd.toFixed(4)]}),t.jsx("span",{children:new Date(f.createdAt).toLocaleString()})]})]}),t.jsx(ra,{className:"h-4 w-4 text-zinc-600"})]},f.id))})]})}function D1(){const{id:n}=Yn(),r=Et(),[d,c]=u.useState(null),[m,f]=u.useState(!0),[h,b]=u.useState(!1),[g,p]=u.useState(-1);u.useEffect(()=>{n&&zd(n).then(c).catch(console.error).finally(()=>f(!1))},[n]);const w=async()=>{if(d){b(!0);try{await E1(d.id);for(let z=0;z<d.steps.length;z++)p(z),await new Promise(N=>setTimeout(N,500));p(d.steps.length);const k=await zd(d.id);c(k)}catch(k){console.error("Execute failed:",k)}finally{b(!1)}}},v=async()=>{if(d)try{await T1(d.id);const k=await zd(d.id);c(k)}catch(k){console.error("Cancel failed:",k)}};if(m)return t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})});if(!d)return t.jsx("div",{className:"py-20 text-center text-zinc-400",children:"Plan not found."});const y=d.status==="pending"||d.status==="approved";return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("button",{onClick:()=>r("/plans"),className:"text-sm text-zinc-500 hover:text-zinc-300",children:"← Back to Plans"}),t.jsxs("h1",{className:"mt-1 text-2xl font-bold text-white",children:["Plan: ",d.id]}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:d.prompt})]}),t.jsx("div",{className:"flex gap-2",children:y&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:w,disabled:h,className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500 disabled:opacity-50",children:[t.jsx(kt,{className:"h-4 w-4"}),"Execute All"]}),t.jsxs("button",{onClick:v,className:"flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium text-zinc-400 hover:text-white hover:border-zinc-600",children:[t.jsx(At,{className:"h-4 w-4"}),"Cancel"]})]})})]}),t.jsxs("div",{className:"flex gap-4 rounded-lg border border-border bg-surface p-4 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Status:"})," ",t.jsx("span",{className:"font-medium text-white",children:d.status})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Steps:"})," ",t.jsx("span",{className:"font-medium text-white",children:d.steps.length})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Est. Cost:"})," ",t.jsxs("span",{className:"font-medium text-white",children:["$",d.estimatedCostUsd.toFixed(4)]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500",children:"Iterations:"})," ",t.jsx("span",{className:"font-medium text-white",children:d.estimatedIterations})]})]}),t.jsx("div",{className:"space-y-2",children:d.steps.map((k,z)=>{const N=g===z,S=g>z,C=Object.entries(k.args).map(([O,D])=>`${O}: ${typeof D=="string"?D.slice(0,80):JSON.stringify(D).slice(0,80)}`).join(" | ");return t.jsxs("div",{className:`rounded-lg border p-4 transition-colors ${N?"border-indigo-500 bg-indigo-500/5":S?"border-green-500/30 bg-green-500/5":"border-border bg-surface"}`,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-full text-xs font-bold ${S?"bg-green-500/20 text-green-400":N?"bg-indigo-500/20 text-indigo-400":"bg-zinc-800 text-zinc-400"}`,children:S?t.jsx(ft,{className:"h-4 w-4"}):z+1}),t.jsx("span",{className:"font-mono text-sm font-medium text-white",children:k.toolName}),t.jsx(A1,{level:k.riskLevel}),N&&t.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})]}),t.jsx("div",{className:"mt-2 pl-10 text-xs text-zinc-500 font-mono",children:C}),t.jsx("div",{className:"mt-1 pl-10 text-xs text-zinc-600 italic",children:k.mockResult})]},k.index)})})]})}const O1={file_pattern:"File Pattern",command_pattern:"Command Pattern",url_pattern:"URL Pattern",limit:"Limit"},L1={block:"bg-red-500/10 text-red-400 border-red-500/20",warn:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",approve:"bg-blue-500/10 text-blue-400 border-blue-500/20"},Fr="/api";function Ir(){const n={"Content-Type":"application/json"},r=localStorage.getItem("nestor_token");r&&(n.Authorization=`Bearer ${r}`);const d=localStorage.getItem("nestor_tenant_id");return d&&(n["X-Tenant-ID"]=d),n}async function _1(){const n=await fetch(`${Fr}/guardrails`,{headers:Ir()});if(!n.ok)throw new Error(`Failed to fetch guardrails: ${n.statusText}`);return(await n.json()).data}async function U1(n){const r=await fetch(`${Fr}/guardrails`,{method:"POST",headers:Ir(),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to create guardrail: ${r.statusText}`);return(await r.json()).data}async function Vh(n,r){const d=await fetch(`${Fr}/guardrails/${n}`,{method:"PUT",headers:Ir(),body:JSON.stringify(r)});if(!d.ok)throw new Error(`Failed to update guardrail: ${d.statusText}`)}async function B1(n){const r=await fetch(`${Fr}/guardrails/${n}`,{method:"DELETE",headers:Ir()});if(!r.ok)throw new Error(`Failed to delete guardrail: ${r.statusText}`)}function $1(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(!1),[h,b]=u.useState(null),[g,p]=u.useState({name:"",type:"command_pattern",pattern:"",action:"block",config:"{}",enabled:!0}),w=u.useCallback(()=>{c(!0),_1().then(r).catch(console.error).finally(()=>c(!1))},[]);u.useEffect(()=>{w()},[w]);const v=()=>{p({name:"",type:"command_pattern",pattern:"",action:"block",config:"{}",enabled:!0}),b(null),f(!1)},y=async()=>{if(!g.name.trim()||!g.pattern.trim())return;let S={};try{S=JSON.parse(g.config)}catch{}try{h?await Vh(h,{...g,config:S}):await U1({...g,config:S}),v(),w()}catch(C){console.error("Save failed:",C)}},k=async S=>{try{await Vh(S.id,{enabled:!S.enabled}),w()}catch(C){console.error("Toggle failed:",C)}},z=async S=>{try{await B1(S),w()}catch(C){console.error("Delete failed:",C)}},N=S=>{p({name:S.name,type:S.type,pattern:S.pattern,action:S.action,config:JSON.stringify(S.config,null,2),enabled:S.enabled}),b(S.id),f(!0)};return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-2xl font-bold text-white",children:"Guardrails"}),t.jsxs("button",{onClick:()=>{v(),f(!0)},className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:[t.jsx(pt,{className:"h-4 w-4"}),"Add Rule"]})]}),m&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-5 space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-lg font-semibold text-white",children:h?"Edit Guardrail":"New Guardrail"}),t.jsx("button",{onClick:v,className:"text-zinc-500 hover:text-white",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Name"}),t.jsx("input",{value:g.name,onChange:S=>p(C=>({...C,name:S.target.value})),placeholder:"e.g., Block production DB access",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white placeholder:text-zinc-600 focus:border-indigo-500 focus:outline-none"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Type"}),t.jsxs("select",{value:g.type,onChange:S=>p(C=>({...C,type:S.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"command_pattern",children:"Command Pattern"}),t.jsx("option",{value:"file_pattern",children:"File Pattern"}),t.jsx("option",{value:"url_pattern",children:"URL Pattern"}),t.jsx("option",{value:"limit",children:"Limit"})]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Pattern (regex or substring)"}),t.jsx("input",{value:g.pattern,onChange:S=>p(C=>({...C,pattern:S.target.value})),placeholder:g.type==="limit"?"shell_exec":"e.g., rm\\s+-rf|DROP\\s+TABLE",className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white font-mono placeholder:text-zinc-600 focus:border-indigo-500 focus:outline-none"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Action"}),t.jsxs("select",{value:g.action,onChange:S=>p(C=>({...C,action:S.target.value})),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white focus:border-indigo-500 focus:outline-none",children:[t.jsx("option",{value:"block",children:"Block"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"approve",children:"Require Approval"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1",children:"Config (JSON)"}),t.jsx("input",{value:g.config,onChange:S=>p(C=>({...C,config:S.target.value})),placeholder:'e.g., {"maxPerRun": 5}',className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white font-mono placeholder:text-zinc-600 focus:border-indigo-500 focus:outline-none"})]})]}),t.jsxs("div",{className:"flex items-center justify-between pt-2",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[t.jsx("input",{type:"checkbox",checked:g.enabled,onChange:S=>p(C=>({...C,enabled:S.target.checked})),className:"rounded border-border"}),"Enabled"]}),t.jsx("button",{onClick:y,className:"rounded-lg bg-indigo-600 px-6 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:h?"Update":"Create"})]})]}),n.length===0&&!m?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface p-12 text-center",children:[t.jsx(zs,{className:"mb-4 h-12 w-12 text-zinc-600"}),t.jsx("p",{className:"text-zinc-400",children:"No guardrails configured."}),t.jsx("p",{className:"mt-1 text-sm text-zinc-600",children:"Add rules to control what tools can do -- block dangerous patterns, enforce limits, or require approval."})]}):t.jsx("div",{className:"space-y-2",children:n.map(S=>t.jsxs("div",{className:`flex items-center justify-between rounded-lg border p-4 transition-colors ${S.enabled?"border-border bg-surface":"border-border/50 bg-surface/50 opacity-60"}`,children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-sm font-medium text-white",children:S.name}),t.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-[10px] font-medium text-zinc-400",children:O1[S.type]??S.type}),t.jsx("span",{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium ${L1[S.action]??""}`,children:S.action})]}),t.jsx("div",{className:"mt-1 font-mono text-xs text-zinc-500",children:S.pattern})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:()=>k(S),className:"text-zinc-500 hover:text-white",title:S.enabled?"Disable":"Enable",children:S.enabled?t.jsx(Cv,{className:"h-5 w-5 text-green-400"}):t.jsx(zv,{className:"h-5 w-5"})}),t.jsx("button",{onClick:()=>N(S),className:"text-zinc-500 hover:text-white",title:"Edit",children:t.jsx(Id,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>z(S.id),className:"text-zinc-500 hover:text-red-400",title:"Delete",children:t.jsx(Ut,{className:"h-4 w-4"})})]})]},S.id))})]})}const Yh={agent:t.jsx(av,{className:"h-3 w-3"}),project:t.jsx(p0,{className:"h-3 w-3"}),global:t.jsx(Jd,{className:"h-3 w-3"})},Xh={agent:"bg-blue-500/20 text-blue-400",project:"bg-purple-500/20 text-purple-400",global:"bg-amber-500/20 text-amber-400"};function H1(){const{id:n}=Yn(),[r,d]=u.useState([]),[c,m]=u.useState(null),[f,h]=u.useState(!0),[b,g]=u.useState(""),[p,w]=u.useState(""),[v,y]=u.useState(""),[k,z]=u.useState(!1),[N,S]=u.useState(""),[C,O]=u.useState(""),[D,E]=u.useState("agent"),[ae,oe]=u.useState(.5),B=u.useCallback(async()=>{if(n){h(!0);try{const Y=new URLSearchParams;b&&Y.set("q",b),p&&Y.set("scope",p),Y.set("limit","100");const[le,J]=await Promise.all([fetch(`/api/agents/${n}/memory?${Y}`,{credentials:"include"}),fetch(`/api/agents/${n}/memory/stats`,{credentials:"include"})]);if(le.ok){const ce=await le.json();d(ce.data||[])}if(J.ok){const ce=await J.json();m(ce.data)}}catch{}h(!1)}},[n,b,p]);u.useEffect(()=>{B()},[B]);const q=Y=>{Y.preventDefault(),B()},I=async()=>{var Y;if(!(!n||!N.trim()||!C.trim())){y("");try{const le=await fetch(`/api/agents/${n}/memory`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:N,value:C,scope:D,importance:ae})});if(!le.ok){const J=await le.json();throw new Error(((Y=J.error)==null?void 0:Y.message)||"Failed")}z(!1),S(""),O(""),oe(.5),await B()}catch(le){y(le.message)}}},W=async Y=>{if(n)try{(await fetch(`/api/agents/${n}/memory/${encodeURIComponent(Y)}`,{method:"DELETE",credentials:"include"})).ok&&d(J=>J.filter(ce=>ce.key!==Y))}catch{}};return f?t.jsx("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:"Loading..."}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ws,{className:"h-6 w-6 text-indigo-400"}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Agent Memory Store"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Key-value memory entries with scope, importance, and FTS5 search."})]})]}),t.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-3 py-2 text-sm font-medium text-white hover:bg-indigo-700",children:[t.jsx(pt,{className:"h-4 w-4"})," Add Memory"]})]}),v&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400",children:v}),c&&t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400",children:"Total Entries"}),t.jsx("p",{className:"mt-2 text-2xl font-semibold text-white",children:c.total})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400",children:"Total Size"}),t.jsx("p",{className:"mt-2 text-2xl font-semibold text-white",children:c.totalSize>1024?`${(c.totalSize/1024).toFixed(1)} KB`:`${c.totalSize} B`})]}),t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4",children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-zinc-400",children:"By Scope"}),t.jsx("div",{className:"mt-2 flex gap-2",children:Object.entries(c.byScope).map(([Y,le])=>t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${Xh[Y]??"bg-zinc-500/20 text-zinc-400"}`,children:[Yh[Y]," ",Y,": ",le]},Y))})]})]}),k&&t.jsxs("div",{className:"rounded-lg border border-border bg-surface p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h3",{className:"text-sm font-medium text-white",children:"Add Memory Entry"}),t.jsx("button",{onClick:()=>z(!1),className:"text-zinc-400 hover:text-white",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx("input",{type:"text",value:N,onChange:Y=>S(Y.target.value),placeholder:"Key (e.g. user_preference_language)",className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("select",{value:D,onChange:Y=>E(Y.target.value),className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"agent",children:"agent"}),t.jsx("option",{value:"project",children:"project"}),t.jsx("option",{value:"global",children:"global"})]})]}),t.jsx("textarea",{value:C,onChange:Y=>O(Y.target.value),placeholder:"Value...",rows:3,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-white"}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-xs text-zinc-400",children:["Importance: ",ae.toFixed(1)]}),t.jsx("input",{type:"range",min:0,max:100,value:ae*100,onChange:Y=>oe(Number(Y.target.value)/100),className:"w-full"})]}),t.jsx("button",{onClick:I,disabled:!N.trim()||!C.trim(),className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 disabled:opacity-50",children:"Store Memory"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("form",{onSubmit:q,className:"flex flex-1 gap-2",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(ks,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{type:"text",value:b,onChange:Y=>g(Y.target.value),placeholder:"Search by key or value...",className:"w-full rounded-lg border border-border bg-surface py-2 pl-10 pr-4 text-sm text-white placeholder:text-zinc-500 focus:border-indigo-500 focus:outline-none"})]}),t.jsx("button",{type:"submit",className:"rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-500",children:"Search"})]}),t.jsxs("select",{value:p,onChange:Y=>w(Y.target.value),className:"rounded-lg border border-border bg-surface px-3 py-2 text-sm text-white",children:[t.jsx("option",{value:"",children:"All Scopes"}),t.jsx("option",{value:"agent",children:"Agent"}),t.jsx("option",{value:"project",children:"Project"}),t.jsx("option",{value:"global",children:"Global"})]})]}),r.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-border bg-surface py-16",children:[t.jsx(uv,{className:"h-12 w-12 text-zinc-600"}),t.jsx("p",{className:"mt-4 text-sm text-zinc-400",children:"No memory entries found"}),t.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Memory entries are key-value pairs that persist across agent runs."})]}):t.jsx("div",{className:"space-y-2",children:r.map(Y=>t.jsx("div",{className:"group rounded-lg border border-border bg-surface p-4 hover:border-border/80",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${Xh[Y.scope]??"bg-zinc-500/20 text-zinc-400"}`,children:[Yh[Y.scope]," ",Y.scope]}),t.jsx("span",{className:"font-mono text-sm font-medium text-indigo-400",children:Y.key}),t.jsxs("span",{className:"text-xs text-zinc-600",children:["importance: ",(Y.importance*100).toFixed(0),"%"]}),Y.accessCount>0&&t.jsxs("span",{className:"text-xs text-zinc-600",children:["accessed ",Y.accessCount,"x"]})]}),t.jsx("p",{className:"mt-2 text-sm text-zinc-200 leading-relaxed",children:Y.value}),t.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xs text-zinc-500",children:[t.jsxs("span",{children:["Created: ",new Date(Y.createdAt).toLocaleString()]}),Y.expiresAt&&t.jsxs("span",{className:"text-yellow-500",children:["Expires: ",new Date(Y.expiresAt).toLocaleString()]})]})]}),t.jsx("button",{onClick:()=>W(Y.key),className:"rounded p-1.5 text-zinc-500 opacity-0 transition-all hover:bg-red-500/10 hover:text-red-400 group-hover:opacity-100",title:"Delete memory entry",children:t.jsx(Ut,{className:"h-4 w-4"})})]})},Y.id))})]})}function q1(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function B0(n){const r=Math.floor(n/86400),d=Math.floor(n%86400/3600),c=Math.floor(n%3600/60);return r>0?`${r}d ${d}h ${c}m`:d>0?`${d}h ${c}m`:`${c}m`}function Ns({label:n,value:r,icon:d,color:c="indigo"}){const m={indigo:"bg-indigo-500/10 text-indigo-400",green:"bg-green-500/10 text-green-400",amber:"bg-amber-500/10 text-amber-400",red:"bg-red-500/10 text-red-400",blue:"bg-blue-500/10 text-blue-400",zinc:"bg-zinc-500/10 text-zinc-400"};return t.jsxs("div",{className:"card flex items-center gap-4 p-4",children:[t.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${m[c]??m.indigo}`,children:t.jsx(d,{className:"h-5 w-5"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-zinc-400",children:n}),t.jsx("p",{className:"text-xl font-semibold text-white",children:r})]})]})}function G1(){const[n,r]=u.useState(null),[d,c]=u.useState(null),[m,f]=u.useState(null),[h,b]=u.useState(!0),[g,p]=u.useState(""),w=u.useCallback(async()=>{b(!0),p("");try{const[v,y,k]=await Promise.allSettled([St.overview(),va.health(),va.stats()]);v.status==="fulfilled"&&r(v.value.data),y.status==="fulfilled"&&c(y.value),k.status==="fulfilled"&&f(k.value.data)}catch(v){p(v.message||"Failed to load overview")}finally{b(!1)}},[]);return u.useEffect(()=>{w()},[w]),h?t.jsx(Is,{}):g?t.jsx(Qa,{message:g,onRetry:w}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[t.jsx(Ns,{label:"Tenants",value:(n==null?void 0:n.tenants)??0,icon:Xd,color:"indigo"}),t.jsx(Ns,{label:"Users",value:(n==null?void 0:n.users)??0,icon:Qn,color:"blue"}),t.jsx(Ns,{label:"Agents",value:(n==null?void 0:n.agents)??0,icon:Zt,color:"green"}),t.jsx(Ns,{label:"Total Runs",value:(n==null?void 0:n.runs)??0,icon:Fd,color:"amber"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"System Health"}),t.jsxs("div",{className:"flex items-center gap-2",children:[(d==null?void 0:d.status)==="healthy"?t.jsx(Qd,{className:"h-5 w-5 text-green-400"}):t.jsx(dt,{className:"h-5 w-5 text-amber-400"}),t.jsx("span",{className:"text-sm text-zinc-200 capitalize",children:(d==null?void 0:d.status)??"Unknown"}),(d==null?void 0:d.uptime)!=null&&t.jsxs("span",{className:"ml-auto text-xs text-zinc-500",children:["Uptime: ",B0(d.uptime)]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Cost Summary"}),t.jsxs("p",{className:"text-2xl font-semibold text-white",children:["$",((n==null?void 0:n.totalCostUsd)??0).toFixed(4)]}),t.jsx("p",{className:"text-xs text-zinc-500",children:"Total cost across all tenants"})]})]}),m&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Run Statistics"}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-5",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Running"}),t.jsx("p",{className:"text-lg font-semibold text-indigo-400",children:m.runs.running})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Completed"}),t.jsx("p",{className:"text-lg font-semibold text-green-400",children:m.runs.completed})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Failed"}),t.jsx("p",{className:"text-lg font-semibold text-red-400",children:m.runs.failed})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Today"}),t.jsx("p",{className:"text-lg font-semibold text-amber-400",children:m.runs.today})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Pending Approvals"}),t.jsx("p",{className:"text-lg font-semibold text-zinc-300",children:m.approvals.pending})]})]})]})]})}function K1(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(!1),[g,p]=u.useState({name:"",slug:"",description:""}),[w,v]=u.useState(!1),y=u.useCallback(async()=>{c(!0),f("");try{const z=await St.tenants.list();r(z.data)}catch(z){f(z.message||"Failed to load tenants")}finally{c(!1)}},[]);u.useEffect(()=>{y()},[y]);const k=async()=>{if(!(!g.name||!g.slug)){v(!0);try{await St.tenants.create(g),b(!1),p({name:"",slug:"",description:""}),await y()}catch(z){f(z.message||"Failed to create tenant")}finally{v(!1)}}};return d?t.jsx(Is,{}):m&&n.length===0?t.jsx(Qa,{message:m,onRetry:y}):t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("p",{className:"text-sm text-zinc-400",children:[n.length," tenants"]}),t.jsxs("button",{onClick:()=>b(!0),className:"btn-primary btn-sm",children:[t.jsx(pt,{className:"h-4 w-4"})," Create Tenant"]})]}),m&&t.jsx(Qa,{message:m}),h&&t.jsxs("div",{className:"card p-4 space-y-3 border-indigo-500/30",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"New Tenant"}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsx("input",{className:"input",placeholder:"Tenant Name",value:g.name,onChange:z=>p({...g,name:z.target.value})}),t.jsx("input",{className:"input",placeholder:"slug (lowercase-with-dashes)",value:g.slug,onChange:z=>p({...g,slug:z.target.value})})]}),t.jsx("input",{className:"input",placeholder:"Description (optional)",value:g.description,onChange:z=>p({...g,description:z.target.value})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:k,disabled:w,className:"btn-primary btn-sm",children:w?"Creating...":"Create"}),t.jsx("button",{onClick:()=>b(!1),className:"btn-ghost btn-sm",children:"Cancel"})]})]}),t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Name"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Slug"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Description"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Created"})]})}),t.jsxs("tbody",{children:[n.map(z=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-white",children:z.name}),t.jsx("td",{className:"px-4 py-3 font-mono text-xs text-indigo-400",children:z.slug}),t.jsx("td",{className:"px-4 py-3 text-zinc-400 max-w-xs truncate",children:z.description||"-"}),t.jsx("td",{className:"px-4 py-3 text-zinc-500 text-xs",children:new Date(z.createdAt).toLocaleDateString()})]},z.id)),n.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-zinc-500",children:"No tenants found."})})]})]})})]})}function V1(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(""),[g,p]=u.useState(""),w=u.useCallback(async()=>{c(!0),f("");try{const z=await St.users.list(h?{role:h}:void 0);r(z.data)}catch(z){f(z.message||"Failed to load users")}finally{c(!1)}},[h]);u.useEffect(()=>{w()},[w]);const v=async(z,N)=>{f("");try{await St.users.updateRole(z,N),await w()}catch(S){f(S.message||"Failed to update role")}},y=async(z,N)=>{f("");try{N?await St.users.lock(z):await St.users.unlock(z),await w()}catch(S){f(S.message||"Failed to toggle lock status")}},k=n.filter(z=>{if(!g)return!0;const N=g.toLowerCase();return z.name.toLowerCase().includes(N)||z.email.toLowerCase().includes(N)});return d?t.jsx(Is,{}):t.jsxs("div",{className:"space-y-4",children:[m&&t.jsx(Qa,{message:m}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(ks,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),t.jsx("input",{className:"input pl-9",placeholder:"Search by name or email...",value:g,onChange:z=>p(z.target.value)})]}),t.jsxs("select",{className:"input w-auto",value:h,onChange:z=>b(z.target.value),children:[t.jsx("option",{value:"",children:"All Roles"}),t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"manager",children:"Manager"}),t.jsx("option",{value:"member",children:"Member"}),t.jsx("option",{value:"viewer",children:"Viewer"})]}),t.jsx("button",{onClick:w,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Name"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Role"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Status"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Last Login"}),t.jsx("th",{className:"px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400",children:"Actions"})]})}),t.jsxs("tbody",{children:[k.map(z=>t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-3 font-medium text-white",children:z.name}),t.jsx("td",{className:"px-4 py-3 text-zinc-300",children:z.email}),t.jsx("td",{className:"px-4 py-3",children:t.jsxs("select",{value:z.role,onChange:N=>v(z.id,N.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs text-white focus:outline-none",children:[t.jsx("option",{value:"admin",children:"Admin"}),t.jsx("option",{value:"manager",children:"Manager"}),t.jsx("option",{value:"member",children:"Member"}),t.jsx("option",{value:"viewer",children:"Viewer"})]})}),t.jsx("td",{className:"px-4 py-3",children:t.jsx("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium ${z.isActive?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:z.isActive?"Active":"Locked"})}),t.jsx("td",{className:"px-4 py-3 text-zinc-400 text-xs",children:z.lastLoginAt?new Date(z.lastLoginAt*1e3).toLocaleString():"Never"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsx("div",{className:"flex items-center justify-end gap-1",children:t.jsx("button",{onClick:()=>y(z.id,z.isActive),className:"rounded p-1.5 text-zinc-400 transition-colors hover:bg-zinc-700",title:z.isActive?"Lock account":"Unlock account",children:z.isActive?t.jsx(Dd,{className:"h-3.5 w-3.5"}):t.jsx(mv,{className:"h-3.5 w-3.5"})})})})]},z.id)),k.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-zinc-500",children:"No users found."})})]})]})})]})}function Y1(){const[n,r]=u.useState(null),[d,c]=u.useState(null),[m,f]=u.useState(null),[h,b]=u.useState(!0),[g,p]=u.useState(""),w=u.useCallback(async()=>{b(!0),p("");try{const[v,y,k]=await Promise.allSettled([St.system.info(),St.system.dbStats(),St.system.rateLimitStats()]);v.status==="fulfilled"&&r(v.value.data),y.status==="fulfilled"&&c(y.value.data),k.status==="fulfilled"&&f(k.value.data)}catch(v){p(v.message||"Failed to load system info")}finally{b(!1)}},[]);return u.useEffect(()=>{w()},[w]),h?t.jsx(Is,{}):g?t.jsx(Qa,{message:g,onRetry:w}):t.jsxs("div",{className:"space-y-6",children:[n&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Wd,{className:"h-4 w-4 text-indigo-400"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Server Information"}),t.jsx("button",{onClick:w,className:"ml-auto btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Version"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:n.version})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Node.js"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:n.nodeVersion})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Platform"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.platform," / ",n.arch]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Uptime"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:B0(n.uptime)})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 pt-2",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"RSS Memory"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.memory.rss," MB"]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Heap Used"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.memory.heapUsed," MB"]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"Heap Total"}),t.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:[n.memory.heapTotal," MB"]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-zinc-500",children:"PID"}),t.jsx("p",{className:"text-sm font-medium text-zinc-200",children:n.pid})]})]})]}),d&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(p0,{className:"h-4 w-4 text-green-400"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Database Statistics"}),t.jsx("span",{className:"ml-auto text-xs text-zinc-500",children:q1(d.totalSize)})]}),t.jsx("div",{className:"overflow-x-auto rounded border border-border/50",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Table"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Rows"})]})}),t.jsx("tbody",{children:d.tables.map(v=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300",children:v.name}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-400",children:v.rowCount.toLocaleString()})]},v.name))})]})})]}),m&&t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Zt,{className:"h-4 w-4 text-amber-400"}),t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Rate Limit Counters"}),t.jsxs("span",{className:"ml-auto text-xs text-zinc-500",children:[m.totalKeys," active keys"]})]}),m.entries.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50 max-h-60 overflow-y-auto",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background sticky top-0",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Key"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Count"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Reset"})]})}),t.jsx("tbody",{children:m.entries.slice(0,50).map((v,y)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300 max-w-xs truncate",children:v.key}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-400",children:v.count}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(v.resetAt).toLocaleTimeString()})]},y))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No active rate limit counters."})]})]})}function X1(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(""),[h,b]=u.useState(""),[g,p]=u.useState(""),w=u.useCallback(async()=>{c(!0),f("");try{const y=await St.audit.query({action:h||void 0,userId:g||void 0,limit:200});r(y.data)}catch(y){f(y.message||"Failed to load audit log")}finally{c(!1)}},[h,g]);u.useEffect(()=>{w()},[w]);const v=async y=>{try{const k=await St.audit.export(y),z=y==="json"?JSON.stringify(k.data,null,2):Q1(k.data),N=new Blob([z],{type:y==="json"?"application/json":"text/csv"}),S=URL.createObjectURL(N),C=document.createElement("a");C.href=S,C.download=`audit-log.${y}`,C.click(),URL.revokeObjectURL(S)}catch(k){f(k.message||"Export failed")}};return d?t.jsx(Is,{}):t.jsxs("div",{className:"space-y-4",children:[m&&t.jsx(Qa,{message:m}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("input",{className:"input flex-1 min-w-[150px]",placeholder:"Filter by action...",value:h,onChange:y=>b(y.target.value)}),t.jsx("input",{className:"input flex-1 min-w-[150px]",placeholder:"Filter by actor ID...",value:g,onChange:y=>p(y.target.value)}),t.jsx("button",{onClick:w,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})}),t.jsxs("button",{onClick:()=>v("json"),className:"btn-ghost btn-sm",children:[t.jsx(Wl,{className:"h-4 w-4"})," JSON"]}),t.jsxs("button",{onClick:()=>v("csv"),className:"btn-ghost btn-sm",children:[t.jsx(Wl,{className:"h-4 w-4"})," CSV"]})]}),t.jsx("div",{className:"overflow-x-auto rounded-lg border border-border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border bg-surface",children:[t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Time"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Actor"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Action"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Resource"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400",children:"Details"})]})}),t.jsxs("tbody",{children:[n.map(y=>{var k;return t.jsxs("tr",{className:"border-b border-border/50 hover:bg-surface-hover",children:[t.jsx("td",{className:"px-4 py-2.5 text-zinc-400 text-xs whitespace-nowrap",children:new Date(y.createdAt*1e3).toLocaleString()}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-300 text-xs font-mono",children:((k=y.userId)==null?void 0:k.slice(0,8))||"-"}),t.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-indigo-400",children:y.action}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-300 text-xs",children:y.resourceType?`${y.resourceType}${y.resourceId?`/${y.resourceId.slice(0,8)}`:""}`:"-"}),t.jsx("td",{className:"px-4 py-2.5 text-zinc-500 text-xs",children:y.ipAddress||"-"}),t.jsx("td",{className:"px-4 py-2.5 text-xs text-zinc-500 max-w-[200px] truncate",children:y.details?JSON.stringify(y.details):"-"})]},y.id)}),n.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-zinc-500",children:"No audit entries found."})})]})]})})]})}function Q1(n){const r="id,userId,action,resourceType,resourceId,ipAddress,createdAt,details",d=n.map(c=>[c.id,c.userId??"",c.action,c.resourceType??"",c.resourceId??"",c.ipAddress??"",new Date(c.createdAt*1e3).toISOString(),c.details?JSON.stringify(c.details).replace(/"/g,'""'):""].map(m=>`"${m}"`).join(","));return[r,...d].join(`
585
+ `)}function Z1(){const[n,r]=u.useState([]),[d,c]=u.useState([]),[m,f]=u.useState([]),[h,b]=u.useState([]),[g,p]=u.useState(!0),[w,v]=u.useState(""),y=u.useCallback(async()=>{p(!0),v("");try{const[k,z,N,S]=await Promise.allSettled([St.security.failedLogins(24),St.security.lockedAccounts(),St.security.activeSessions(),St.security.rateLimitViolations(50)]);k.status==="fulfilled"&&r(k.value.data),z.status==="fulfilled"&&c(z.value.data),N.status==="fulfilled"&&f(N.value.data),S.status==="fulfilled"&&b(S.value.data)}catch(k){v(k.message||"Failed to load security data")}finally{p(!1)}},[]);return u.useEffect(()=>{y()},[y]),g?t.jsx(Is,{}):w?t.jsx(Qa,{message:w,onRetry:y}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[t.jsx(Ns,{label:"Failed Logins (24h)",value:n.reduce((k,z)=>k+z.count,0),icon:At,color:"red"}),t.jsx(Ns,{label:"Locked Accounts",value:d.length,icon:Dd,color:"amber"}),t.jsx(Ns,{label:"Active Sessions",value:m.length,icon:Qn,color:"green"}),t.jsx(Ns,{label:"Rate Violations",value:h.length,icon:Na,color:"red"})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(At,{className:"h-4 w-4 text-red-400"})," Failed Login Attempts (Last 24h)"]}),n.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Attempts"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"First Seen"})]})}),t.jsx("tbody",{children:n.map((k,z)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-300",children:k.email}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-400",children:k.ip}),t.jsx("td",{className:"px-3 py-1.5 text-right font-semibold text-red-400",children:k.count}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.timestamp).toLocaleString()})]},z))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No failed login attempts in the last 24 hours."})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Dd,{className:"h-4 w-4 text-amber-400"})," Locked Accounts"]}),d.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Reason"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Locked At"})]})}),t.jsx("tbody",{children:d.map((k,z)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-300",children:k.email}),t.jsx("td",{className:"px-3 py-1.5 text-zinc-400",children:k.reason}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.lockedAt).toLocaleString()})]},z))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No locked accounts."})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(qn,{className:"h-4 w-4 text-green-400"})," Active Sessions (",m.length,")"]}),m.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50 max-h-60 overflow-y-auto",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background sticky top-0",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Email"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Created"}),t.jsx("th",{className:"px-3 py-2 text-right font-medium text-zinc-400",children:"Expires"})]})}),t.jsx("tbody",{children:m.map((k,z)=>t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-300",children:k.email}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-400",children:k.ip}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.createdAt).toLocaleString()}),t.jsx("td",{className:"px-3 py-1.5 text-right text-zinc-500",children:new Date(k.expiresAt).toLocaleString()})]},z))})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No active sessions."})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Na,{className:"h-4 w-4 text-red-400"})," Recent Rate Limit Violations"]}),h.length>0?t.jsx("div",{className:"overflow-x-auto rounded border border-border/50 max-h-60 overflow-y-auto",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-border/50 bg-background sticky top-0",children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Time"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Tier"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"IP"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"User"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-400",children:"Endpoint"})]})}),t.jsx("tbody",{children:h.map((k,z)=>{var N;return t.jsxs("tr",{className:"border-b border-border/30",children:[t.jsx("td",{className:"px-3 py-1.5 text-zinc-400 whitespace-nowrap",children:new Date(k.timestamp).toLocaleString()}),t.jsx("td",{className:"px-3 py-1.5",children:t.jsx("span",{className:"rounded-full bg-red-500/10 px-1.5 py-0.5 text-red-400",children:k.tier})}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-400",children:k.ip}),t.jsx("td",{className:"px-3 py-1.5 text-zinc-400",children:((N=k.userId)==null?void 0:N.slice(0,8))||"-"}),t.jsx("td",{className:"px-3 py-1.5 font-mono text-zinc-300 max-w-[200px] truncate",children:k.endpoint})]},z)})})]})}):t.jsx("p",{className:"text-xs text-zinc-500",children:"No rate limit violations recorded."})]})]})}function J1(){const[n,r]=u.useState(null),[d,c]=u.useState(null),[m,f]=u.useState(!0),[h,b]=u.useState(!1),[g,p]=u.useState(""),[w,v]=u.useState(""),[y,k]=u.useState(!1),z=u.useCallback(async()=>{f(!0),p(""),v("");try{const O=await va.getConfig();r(O.data),c(O.data),k(!1)}catch(O){p(O.message||"Failed to load configuration")}finally{f(!1)}},[]);u.useEffect(()=>{z()},[z]);const N=(O,D,E)=>{d&&(c({...d,[O]:{...d[O],[D]:E}}),k(!0),v(""))},S=async()=>{if(d){b(!0),p(""),v("");try{const O=await va.updateConfig(d);r(O.data),c(O.data),k(!1),v("Configuration saved successfully.")}catch(O){p(O.message||"Failed to save configuration")}finally{b(!1)}}},C=()=>{n&&(c({...n}),k(!1),v(""))};return m?t.jsx(Is,{}):g&&!d?t.jsx(Qa,{message:g,onRetry:z}):t.jsxs("div",{className:"space-y-6",children:[g&&t.jsx(Qa,{message:g}),w&&t.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 px-4 py-3 text-sm text-green-400 flex items-center gap-2",children:[t.jsx(Qd,{className:"h-4 w-4 flex-shrink-0"}),w]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-sm text-zinc-400",children:"Runtime configuration (changes apply immediately)"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{onClick:z,className:"btn-ghost btn-sm",children:t.jsx(Ct,{className:"h-4 w-4"})}),t.jsx("button",{onClick:C,disabled:!y,className:"btn-secondary btn-sm",children:"Reset"}),t.jsxs("button",{onClick:S,disabled:!y||h,className:"btn-primary btn-sm",children:[t.jsx(Qr,{className:"h-4 w-4"})," ",h?"Saving...":"Save"]})]})]}),d&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Wd,{className:"h-4 w-4 text-indigo-400"})," Server"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Host"}),t.jsx("input",{className:"input",value:d.server.host,onChange:O=>N("server","host",O.target.value)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Port"}),t.jsx("input",{className:"input",type:"number",value:d.server.port,onChange:O=>N("server","port",parseInt(O.target.value)||0)})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Na,{className:"h-4 w-4 text-amber-400"})," Security"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Default Trust Level"}),t.jsxs("select",{className:"input",value:d.security.defaultTrustLevel,onChange:O=>N("security","defaultTrustLevel",O.target.value),children:[t.jsx("option",{value:"builtin",children:"Builtin"}),t.jsx("option",{value:"official",children:"Official"}),t.jsx("option",{value:"trusted",children:"Trusted"}),t.jsx("option",{value:"community",children:"Community"}),t.jsx("option",{value:"local",children:"Local"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Approval Mode"}),t.jsxs("select",{className:"input",value:d.security.approvalMode,onChange:O=>N("security","approvalMode",O.target.value),children:[t.jsx("option",{value:"manual",children:"Manual"}),t.jsx("option",{value:"smart",children:"Smart"}),t.jsx("option",{value:"off",children:"Off"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Concurrent Runs"}),t.jsx("input",{className:"input",type:"number",min:1,max:100,value:d.security.maxConcurrentRuns,onChange:O=>N("security","maxConcurrentRuns",parseInt(O.target.value)||1)})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Zt,{className:"h-4 w-4 text-green-400"})," Budget"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Enabled"}),t.jsxs("select",{className:"input",value:d.budget.enabled?"true":"false",onChange:O=>N("budget","enabled",O.target.value==="true"),children:[t.jsx("option",{value:"true",children:"Yes"}),t.jsx("option",{value:"false",children:"No"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Cost/Run (USD)"}),t.jsx("input",{className:"input",type:"number",step:"0.01",min:0,value:d.budget.defaultMaxCostPerRunUsd,onChange:O=>N("budget","defaultMaxCostPerRunUsd",parseFloat(O.target.value)||0)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Max Tokens/Run"}),t.jsx("input",{className:"input",type:"number",min:0,value:d.budget.defaultMaxTokensPerRun,onChange:O=>N("budget","defaultMaxTokensPerRun",parseInt(O.target.value)||0)})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Warning Threshold %"}),t.jsx("input",{className:"input",type:"number",min:0,max:100,value:d.budget.warningThresholdPercent,onChange:O=>N("budget","warningThresholdPercent",parseInt(O.target.value)||0)})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsxs("h3",{className:"text-sm font-medium text-zinc-200 flex items-center gap-2",children:[t.jsx(Fs,{className:"h-4 w-4 text-blue-400"})," Logging"]}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Level"}),t.jsxs("select",{className:"input",value:d.logging.level,onChange:O=>N("logging","level",O.target.value),children:[t.jsx("option",{value:"debug",children:"Debug"}),t.jsx("option",{value:"info",children:"Info"}),t.jsx("option",{value:"warn",children:"Warn"}),t.jsx("option",{value:"error",children:"Error"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"label",children:"Format"}),t.jsxs("select",{className:"input",value:d.logging.format,onChange:O=>N("logging","format",O.target.value),children:[t.jsx("option",{value:"json",children:"JSON"}),t.jsx("option",{value:"pretty",children:"Pretty"})]})]})]})]}),t.jsxs("div",{className:"card p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-medium text-zinc-200",children:"Current Configuration (JSON)"}),t.jsx("pre",{className:"overflow-x-auto rounded border border-border/50 bg-background p-3 text-xs text-zinc-400 max-h-60 overflow-y-auto",children:JSON.stringify(d,null,2)})]})]})]})}function Is(){return t.jsx("div",{className:"flex items-center justify-center py-16",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-500 border-t-transparent"})})}function Qa({message:n,onRetry:r}){return t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3 text-sm text-red-400",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(dt,{className:"h-4 w-4 flex-shrink-0"}),t.jsx("span",{children:n}),r&&t.jsx("button",{onClick:r,className:"ml-auto text-xs underline hover:text-red-300",children:"Retry"})]})})}const F1=[{key:"overview",label:"Overview",icon:Fd},{key:"tenants",label:"Tenants",icon:Xd},{key:"users",label:"Users",icon:Qn},{key:"system",label:"System",icon:Wd},{key:"audit",label:"Audit Log",icon:Fs},{key:"security",label:"Security",icon:Na},{key:"config",label:"Config",icon:Xn}];function I1(){const{isAdmin:n}=li(),[r,d]=u.useState("overview");return n?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Admin Dashboard"}),t.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Multi-tenant administration and system monitoring."})]}),t.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:F1.map(({key:c,label:m,icon:f})=>t.jsxs("button",{onClick:()=>d(c),className:`flex items-center gap-2 whitespace-nowrap px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${r===c?"border-indigo-500 text-indigo-400":"border-transparent text-zinc-400 hover:text-zinc-200"}`,children:[t.jsx(f,{className:"h-4 w-4"}),m]},c))}),r==="overview"&&t.jsx(G1,{}),r==="tenants"&&t.jsx(K1,{}),r==="users"&&t.jsx(V1,{}),r==="system"&&t.jsx(Y1,{}),r==="audit"&&t.jsx(X1,{}),r==="security"&&t.jsx(Z1,{}),r==="config"&&t.jsx(J1,{})]}):t.jsxs("div",{className:"flex h-64 items-center justify-center text-zinc-400",children:[t.jsx(Na,{className:"mr-2 h-5 w-5"})," Admin access required."]})}function P1(n){switch(n){case"claude":return"claude-sonnet-4-20250514";case"openai":return"gpt-4o";case"gemini":return"gemini-2.5-flash";case"grok":return"grok-3";case"mistral":return"mistral-large-latest";case"ollama":return"llama3.1";default:return"claude-sonnet-4-20250514"}}function W1(n){return n.startsWith("file_")?t.jsx(Fs,{className:"h-3 w-3"}):n==="shell_exec"?t.jsx(v0,{className:"h-3 w-3"}):n==="web_fetch"?t.jsx(Jd,{className:"h-3 w-3"}):t.jsx(Zn,{className:"h-3 w-3"})}function $0(n,r){return n==="file_read"&&r.path?`Reading: ${r.path}`:n==="file_write"&&r.path?`Writing: ${r.path}`:n==="file_list"&&r.path?`Listing: ${r.path||"."}`:n==="shell_exec"&&r.command?`Running: ${String(r.command).substring(0,80)}`:n==="web_fetch"&&r.url?`Fetching: ${String(r.url).substring(0,80)}`:Object.entries(r).map(([c,m])=>`${c}=${JSON.stringify(m)}`).join(", ").substring(0,100)||"No arguments"}function eN(n,r=500){return n.length<=r?n:n.substring(0,r)+`
586
+ ... (${n.length} chars total)`}function tN({tc:n}){const[r,d]=u.useState(!1),c=n.pending&&!n.output;return t.jsxs("div",{className:"mb-2 rounded-lg text-xs border border-border/50 overflow-hidden",children:[t.jsxs("button",{onClick:()=>d(!r),className:"w-full flex items-center gap-2 px-3 py-2 bg-zinc-800/50 hover:bg-zinc-800/80 transition-colors text-left",children:[r?t.jsx(Xa,{className:"h-3 w-3 text-zinc-500 flex-shrink-0"}):t.jsx(ra,{className:"h-3 w-3 text-zinc-500 flex-shrink-0"}),t.jsx("span",{className:"text-amber-400 flex-shrink-0",children:W1(n.name)}),t.jsx("span",{className:"text-amber-300 font-mono font-medium",children:n.name}),t.jsx("span",{className:"text-zinc-500 truncate flex-1 ml-1",children:$0(n.name,n.args)}),c?t.jsx(ht,{className:"h-3 w-3 animate-spin text-blue-400 flex-shrink-0"}):n.success?t.jsx("span",{className:"text-green-400 flex-shrink-0 text-[10px] font-medium",children:"OK"}):t.jsx("span",{className:"text-red-400 flex-shrink-0 text-[10px] font-medium",children:"FAIL"})]}),r&&t.jsxs("div",{className:"px-3 py-2 bg-zinc-900/50 border-t border-border/30",children:[t.jsxs("div",{className:"mb-1.5",children:[t.jsx("span",{className:"text-zinc-500 text-[10px] uppercase tracking-wider",children:"Arguments"}),t.jsx("pre",{className:"mt-0.5 text-zinc-400 overflow-x-auto whitespace-pre-wrap text-[11px] font-mono",children:JSON.stringify(n.args,null,2)})]}),n.output&&t.jsxs("div",{children:[t.jsx("span",{className:"text-zinc-500 text-[10px] uppercase tracking-wider",children:"Output"}),t.jsx("pre",{className:`mt-0.5 overflow-x-auto whitespace-pre-wrap text-[11px] font-mono ${n.success?"text-zinc-400":"text-red-400"}`,children:eN(n.output)})]}),c&&t.jsxs("div",{className:"flex items-center gap-1.5 text-blue-400 mt-1",children:[t.jsx(ht,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-[11px]",children:"Executing..."})]})]})]})}function aN(n){return n==="critical"?"text-red-500 bg-red-500/10":n==="high"?"text-orange-400 bg-orange-400/10":n==="medium"?"text-yellow-400 bg-yellow-400/10":"text-green-400 bg-green-400/10"}function sN({steps:n}){const[r,d]=u.useState(!0);return t.jsxs("div",{className:"mb-3 rounded-lg border border-indigo-500/30 overflow-hidden",children:[t.jsxs("button",{onClick:()=>d(!r),className:"w-full flex items-center gap-2 px-3 py-2 bg-indigo-500/10 hover:bg-indigo-500/15 transition-colors text-left text-sm",children:[r?t.jsx(Xa,{className:"h-3 w-3 text-indigo-400"}):t.jsx(ra,{className:"h-3 w-3 text-indigo-400"}),t.jsx("span",{className:"text-indigo-300 font-medium",children:"Dry-Run Plan"}),t.jsxs("span",{className:"text-zinc-500 text-xs",children:[n.length," step",n.length!==1?"s":""]})]}),r&&t.jsx("div",{className:"px-3 py-2 space-y-1.5 bg-zinc-900/30",children:n.map(c=>t.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"text-zinc-500 font-mono w-4 text-right flex-shrink-0",children:[c.index+1,"."]}),t.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium flex-shrink-0 ${aN(c.riskLevel)}`,children:c.riskLevel.toUpperCase()}),t.jsx("span",{className:"text-amber-300 font-mono",children:c.toolName}),t.jsx("span",{className:"text-zinc-500 truncate",children:$0(c.toolName,c.args)})]},c.index))})]})}function nN({agent:n,onClose:r,onSave:d}){const[c,m]=u.useState(n.description||""),[f,h]=u.useState(!1),[b,g]=u.useState(""),p=u.useRef(null);u.useEffect(()=>{var v;(v=p.current)==null||v.focus()},[]);const w=async()=>{h(!0),g("");try{const v=await fetch(`/api/agents/${n.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:c})});if(!v.ok){const k=await v.json().catch(()=>({error:"Failed to save"}));throw new Error(k.error||`HTTP ${v.status}`)}const y=await v.json();d(y.data)}catch(v){g(v instanceof Error?v.message:"Failed to save")}h(!1)};return u.useEffect(()=>{const v=y=>{y.key==="Escape"&&r()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[r]),t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:r,children:t.jsxs("div",{className:"bg-surface border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col",onClick:v=>v.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-zinc-200",children:"System Prompt"}),t.jsxs("p",{className:"text-xs text-zinc-500 mt-0.5",children:[n.name," (",n.adapterType,")"]})]}),t.jsx("button",{onClick:r,className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-400 hover:text-zinc-200",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex-1 p-5 overflow-hidden",children:t.jsx("textarea",{ref:p,value:c,onChange:v=>m(v.target.value),className:"w-full h-full min-h-[300px] bg-background border border-border rounded-lg px-4 py-3 resize-none focus:outline-none focus:border-indigo-500 text-zinc-200 text-sm font-mono placeholder-zinc-600",placeholder:"You are a helpful AI assistant...",spellCheck:!1})}),t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[t.jsxs("div",{className:"text-xs text-zinc-500",children:[c.length.toLocaleString()," chars",b&&t.jsx("span",{className:"text-red-400 ml-3",children:b})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{onClick:r,className:"px-3 py-1.5 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",children:"Cancel"}),t.jsxs("button",{onClick:w,disabled:f,className:"flex items-center gap-1.5 px-4 py-1.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-lg text-sm font-medium transition-colors text-white",children:[f?t.jsx(ht,{className:"h-3 w-3 animate-spin"}):t.jsx(Qr,{className:"h-3 w-3"}),"Save"]})]})]})]})})}function lN(){var re;const n=Et(),[r,d]=u.useState([]),[c,m]=u.useState(null),[f,h]=u.useState([]),[b,g]=u.useState(null),[p,w]=u.useState([]),[v,y]=u.useState(""),[k,z]=u.useState(!1),[N,S]=u.useState(!0),[C,O]=u.useState(!1),[D,E]=u.useState([]),[ae,oe]=u.useState(!1),[B,q]=u.useState(null),[I,W]=u.useState(null),[Y,le]=u.useState(""),J=u.useRef(null),ce=u.useRef(null),he=u.useRef(null);u.useEffect(()=>{var $;($=J.current)==null||$.scrollIntoView({behavior:"smooth"})},[p]),u.useEffect(()=>{const $=ce.current;$&&($.style.height="48px",$.style.height=Math.min($.scrollHeight,200)+"px")},[v]);const G=u.useCallback($=>{const de=$?`/api/chat/conversations?agentId=${encodeURIComponent($)}`:"/api/chat/conversations";fetch(de).then(xe=>xe.json()).then(xe=>h(xe.data||[])).catch(()=>{})},[]);u.useEffect(()=>{fetch("/api/agents").then($=>$.json()).then($=>{const de=$.data||[];d(de),de.length>0&&!c?(m(de[0]),G(de[0].id)):G()}).catch(()=>{})},[]),u.useEffect(()=>{c&&G(c.id)},[c==null?void 0:c.id,G]);const ie=u.useCallback($=>{g($),fetch(`/api/chat/conversations/${$.id}`).then(de=>de.json()).then(de=>{var be;w(((be=de.data)==null?void 0:be.messages)||[]);const xe=r.find(Ce=>{var ve;return Ce.id===((ve=de.data)==null?void 0:ve.agentId)});xe&&m(xe)}).catch(()=>{})},[r]),me=u.useCallback(()=>{var $;g(null),w([]),O(!1),E([]),($=ce.current)==null||$.focus()},[]),ne=u.useCallback(($,de)=>{$.stopPropagation(),fetch(`/api/chat/conversations/${de}`,{method:"DELETE"}).then(()=>{h(xe=>xe.filter(be=>be.id!==de)),(b==null?void 0:b.id)===de&&me()}).catch(()=>{})},[b,me]),we=u.useCallback(async()=>{var be;if(!v.trim()||!c||k)return;const $={role:"user",content:v.trim(),timestamp:Date.now()};le(v.trim()),W(null),w(Ce=>[...Ce,$]),y(""),z(!0);const de={role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0,toolCalls:[]};w(Ce=>[...Ce,de]);const xe=new AbortController;he.current=xe;try{const Ce=await fetch(`/api/chat/${c.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:v.trim(),conversationId:b==null?void 0:b.id}),signal:xe.signal});if(!Ce.body)throw new Error("No response body");const ve=Ce.body.getReader(),Q=new TextDecoder;let ee="";for(;;){const{done:ke,value:ze}=await ve.read();if(ke)break;ee+=Q.decode(ze,{stream:!0});const Ue=ee.split(`
587
+ `);ee=Ue.pop()||"";for(const Ie of Ue){if(!Ie.startsWith("data: "))continue;let De;try{De=JSON.parse(Ie.slice(6))}catch{continue}switch(De.type){case"system":O(!0),E(De.tools||[]);break;case"token":w(tt=>{const M=[...tt],P=M[M.length-1];return P&&P.role==="assistant"&&(M[M.length-1]={...P,content:P.content+De.text}),M});break;case"thinking":w(tt=>{const M=[...tt],P=M[M.length-1];return P&&P.role==="assistant"&&(M[M.length-1]={...P,thinking:(P.thinking||"")+De.text}),M});break;case"tool_start":w(tt=>{const M=[...tt],P=M[M.length-1];return P&&P.role==="assistant"&&(M[M.length-1]={...P,toolCalls:[...P.toolCalls||[],{name:De.name,args:De.args||{},output:"",success:!0,pending:!0}]}),M});break;case"tool_result":w(tt=>{var ye;const M=[...tt],P=M[M.length-1];if(P&&P.role==="assistant"&&((ye=P.toolCalls)!=null&&ye.length)){const Ye=[...P.toolCalls];let Bt=-1;for(let Ft=Ye.length-1;Ft>=0;Ft--)if(Ye[Ft].name===De.name&&Ye[Ft].pending){Bt=Ft;break}Bt===-1&&(Bt=Ye.length-1),Ye[Bt]={...Ye[Bt],output:De.output,success:De.success,pending:!1},M[M.length-1]={...P,toolCalls:Ye}}return M});break;case"done":w(tt=>{const M=[...tt],P=M[M.length-1];return P&&P.role==="assistant"&&(M[M.length-1]={...P,isStreaming:!1,usage:De.usage}),M}),De.conversationId&&!b&&(g({id:De.conversationId}),G(c==null?void 0:c.id));break;case"plan":De.plan&&De.plan.steps&&q(De.plan.steps);break;case"mission_suggestion":W({message:De.message,objective:Y});break;case"error":w(tt=>{const M=[...tt],P=M[M.length-1];return P&&P.role==="assistant"&&(M[M.length-1]={...P,content:P.content?P.content+`
588
+
589
+ Error: ${De.message}`:`Error: ${De.message}`,isStreaming:!1}),M});break;case"reasoning":break}}}}catch(Ce){if(Ce instanceof DOMException&&Ce.name==="AbortError")w(ve=>{const Q=[...ve],ee=Q[Q.length-1];return ee&&ee.role==="assistant"&&(Q[Q.length-1]={...ee,isStreaming:!1}),Q});else{const ve=Ce instanceof Error?Ce.message:"Connection error";w(Q=>{const ee=[...Q],ke=ee[ee.length-1];return ke&&ke.role==="assistant"&&(ee[ee.length-1]={...ke,content:`Connection error: ${ve}`,isStreaming:!1}),ee})}}he.current=null,z(!1),(be=ce.current)==null||be.focus()},[v,c,k,b,G]),T=u.useCallback(()=>{var $;($=he.current)==null||$.abort()},[]),X=$=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),we())};return t.jsxs("div",{className:"flex h-full bg-background",children:[N&&t.jsxs("div",{className:"w-64 border-r border-border flex flex-col bg-surface flex-shrink-0",children:[t.jsx("div",{className:"p-3 border-b border-border",children:t.jsxs("button",{onClick:me,className:"w-full flex items-center justify-center gap-2 px-3 py-2 bg-indigo-600 hover:bg-indigo-700 rounded-lg text-sm font-medium transition-colors text-white",children:[t.jsx(pt,{className:"h-4 w-4"}),"New Chat"]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto",children:[f.length===0&&t.jsx("p",{className:"px-3 py-4 text-xs text-zinc-500 text-center",children:"No conversations yet"}),f.map($=>t.jsxs("button",{onClick:()=>ie($),className:`group w-full text-left px-3 py-2.5 text-sm hover:bg-surface-hover transition-colors flex items-center gap-2 ${(b==null?void 0:b.id)===$.id?"bg-indigo-500/10 text-indigo-400":"text-zinc-400"}`,children:[t.jsx(Ss,{className:"h-3.5 w-3.5 flex-shrink-0"}),t.jsx("span",{className:"truncate flex-1",children:$.title||"Untitled"}),t.jsx("button",{onClick:de=>ne(de,$.id),className:"opacity-0 group-hover:opacity-100 p-0.5 hover:text-red-400 transition-opacity",title:"Delete conversation",children:t.jsx(Ut,{className:"h-3 w-3"})})]},$.id))]})]}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border bg-surface",children:[t.jsx("button",{onClick:()=>S(!N),className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-400 hover:text-zinc-200",title:N?"Hide sidebar":"Show sidebar",children:N?t.jsx(bv,{className:"h-4 w-4"}):t.jsx(yv,{className:"h-4 w-4"})}),t.jsx("select",{value:(c==null?void 0:c.id)||"",onChange:$=>{const de=r.find(xe=>xe.id===$.target.value);de&&m(de)},className:"bg-background border border-border rounded-lg px-3 py-1.5 text-sm text-zinc-200 focus:outline-none focus:border-indigo-500",children:r.map($=>t.jsxs("option",{value:$.id,children:[$.name," (",$.adapterType,")"]},$.id))}),c&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-zinc-500",children:((re=c.adapterConfig)==null?void 0:re.model)||P1(c.adapterType)}),t.jsx("button",{onClick:()=>oe(!0),className:"p-1.5 hover:bg-surface-hover rounded-lg transition-colors text-zinc-500 hover:text-zinc-200",title:"Edit system prompt",children:t.jsx(Xn,{className:"h-3.5 w-3.5"})})]}),C&&t.jsxs("div",{className:"ml-auto flex items-center gap-1.5 text-xs text-amber-400/80",title:`Available tools: ${D.join(", ")}`,children:[t.jsx(Zn,{className:"h-3 w-3"}),t.jsxs("span",{children:[D.length," tools"]})]})]}),C&&t.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 bg-amber-500/10 border-b border-amber-500/20 text-amber-400 text-xs",children:[t.jsx(dt,{className:"h-3 w-3 flex-shrink-0"}),t.jsx("span",{children:"Tools are auto-approved in chat mode. Shell commands and file operations execute without confirmation."})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[p.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-zinc-500",children:[t.jsx(Ss,{className:"h-12 w-12 mb-4 text-indigo-500/40"}),t.jsx("h2",{className:"text-xl font-semibold text-zinc-200 mb-2",children:"Start a conversation"}),t.jsxs("p",{className:"text-sm mb-6",children:["Type a message to chat with ",(c==null?void 0:c.name)||"your agent"]}),t.jsx("div",{className:"grid grid-cols-2 gap-2 max-w-md",children:["Review my code for bugs","Explain this codebase","Write unit tests","Help me refactor"].map($=>t.jsx("button",{onClick:()=>y($),className:"px-3 py-2 text-sm bg-surface hover:bg-surface-hover border border-border rounded-lg text-left text-zinc-300 transition-colors",children:$},$))})]}),p.map(($,de)=>{var xe,be,Ce;return t.jsx("div",{className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:t.jsxs("div",{className:`max-w-[80%] rounded-2xl px-4 py-3 ${$.role==="user"?"bg-indigo-600 text-white":"bg-surface border border-border text-zinc-100"}`,children:[$.thinking&&t.jsxs("div",{className:"mb-2 px-2 py-1.5 bg-zinc-800/30 rounded-lg text-[11px] text-zinc-500 italic border border-zinc-700/30",children:[t.jsx("span",{className:"text-zinc-600 text-[10px] uppercase tracking-wider block mb-0.5",children:"Thinking"}),$.thinking.substring(0,300),$.thinking.length>300&&"..."]}),(xe=$.toolCalls)==null?void 0:xe.map((ve,Q)=>t.jsx(tN,{tc:ve},Q)),$.content&&((/(?:API[_\s]?KEY|api[_\s]?key).*(?:not set|not configured|missing|invalid|required)/i.test($.content)||/(?:ANTHROPIC|OPENAI|GEMINI|XAI|MISTRAL|GROK)_API_KEY/i.test($.content))&&$.role==="assistant"?t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"whitespace-pre-wrap break-words",children:$.content}),t.jsxs(Ga,{to:"/keys",className:"inline-flex items-center gap-2 rounded-lg border border-purple-500/30 bg-purple-500/10 px-3 py-2 text-sm text-purple-400 hover:bg-purple-500/20 transition-colors",children:[t.jsx(ni,{className:"h-4 w-4"}),"Set up your API key"]})]}):t.jsx("div",{className:"whitespace-pre-wrap break-words",children:$.content})),$.isStreaming&&!$.content&&!((be=$.toolCalls)!=null&&be.length)&&t.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400",children:[t.jsx(ht,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-xs",children:"Thinking..."})]}),$.isStreaming&&!$.content&&(((Ce=$.toolCalls)==null?void 0:Ce.length)??0)>0&&t.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400 mt-1",children:[t.jsx(ht,{className:"h-3 w-3 animate-spin"}),t.jsx("span",{className:"text-xs",children:"Processing tools..."})]}),$.isStreaming&&$.content&&t.jsx("span",{className:"inline-block w-1.5 h-4 bg-indigo-400 animate-pulse ml-0.5 rounded-sm"}),$.usage&&($.usage.inputTokens>0||$.usage.outputTokens>0)&&t.jsxs("div",{className:"mt-1.5 text-[10px] text-zinc-500 flex items-center gap-2",children:[t.jsxs("span",{children:[$.usage.inputTokens+$.usage.outputTokens," tokens"]}),$.usage.costUsd>0&&t.jsxs("span",{children:["$",$.usage.costUsd.toFixed(4)]}),$.toolCalls&&$.toolCalls.length>0&&t.jsxs("span",{children:[$.toolCalls.length," tool call",$.toolCalls.length>1?"s":""]})]})]})},de)}),B&&B.length>0&&t.jsx("div",{className:"flex justify-start",children:t.jsx("div",{className:"max-w-[80%]",children:t.jsx(sN,{steps:B})})}),I&&t.jsxs("div",{className:"mx-4 my-2 p-4 bg-purple-900/30 border border-purple-500/50 rounded-lg",children:[t.jsxs("p",{className:"text-sm text-purple-300",children:[t.jsx(Zs,{className:"inline h-4 w-4 mr-1.5 -mt-0.5"}),I.message]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx("button",{onClick:()=>n(`/missions?objective=${encodeURIComponent(I.objective)}`),className:"px-3 py-1.5 bg-purple-600 hover:bg-purple-500 rounded text-sm text-white transition-colors",children:"Run as Mission"}),t.jsx("button",{onClick:()=>W(null),className:"px-3 py-1.5 bg-gray-700 hover:bg-gray-600 rounded text-sm text-zinc-200 transition-colors",children:"Continue in Chat"})]})]}),t.jsx("div",{ref:J})]}),t.jsxs("div",{className:"border-t border-border px-4 py-3 bg-surface",children:[t.jsxs("div",{className:"flex gap-2 items-end max-w-4xl mx-auto",children:[t.jsx("textarea",{ref:ce,value:v,onChange:$=>y($.target.value),onKeyDown:X,placeholder:`Message ${(c==null?void 0:c.name)||"agent"}...`,rows:1,className:"flex-1 bg-background border border-border rounded-xl px-4 py-3 resize-none focus:outline-none focus:border-indigo-500 placeholder-zinc-500 text-zinc-200 text-sm",style:{minHeight:"48px",maxHeight:"200px"},disabled:k||!c}),k?t.jsx("button",{onClick:T,className:"px-4 py-3 bg-red-600 hover:bg-red-700 rounded-xl transition-colors text-white flex-shrink-0",title:"Stop generation",children:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}):t.jsx("button",{onClick:we,disabled:!v.trim()||!c,className:"px-4 py-3 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors text-white flex-shrink-0",title:"Send message",children:t.jsx(Pd,{className:"h-5 w-5"})})]}),!c&&r.length===0&&t.jsx("p",{className:"text-xs text-yellow-500 mt-2 text-center",children:"No agents configured. Create one first in the Agents page."})]})]}),ae&&c&&t.jsx(nN,{agent:c,onClose:()=>oe(!1),onSave:$=>{m($),d(de=>de.map(xe=>xe.id===$.id?$:xe)),oe(!1)}})]})}function iN(n){switch(n){case"osint":return t.jsx(Vr,{className:"h-4 w-4"});case"research":return t.jsx(ks,{className:"h-4 w-4"});case"code":return t.jsx(rv,{className:"h-4 w-4"});case"audit":return t.jsx(zs,{className:"h-4 w-4"});case"analysis":return t.jsx(ja,{className:"h-4 w-4"});case"creation":return t.jsx(Fs,{className:"h-4 w-4"});default:return t.jsx(ws,{className:"h-4 w-4"})}}function rN(n){switch(n){case"completed":return t.jsx(Qd,{className:"h-4 w-4 text-green-400"});case"in_progress":return t.jsx(ht,{className:"h-4 w-4 text-amber-400 animate-spin"});case"failed":return t.jsx(At,{className:"h-4 w-4 text-red-400"});case"pending":return t.jsx(jd,{className:"h-4 w-4 text-zinc-600"});case"skipped":return t.jsx(jd,{className:"h-4 w-4 text-zinc-700"});default:return t.jsx(jd,{className:"h-4 w-4 text-zinc-600"})}}function ou(n){return n>=.8?"text-green-400":n>=.6?"text-amber-400":"text-red-400"}function H0(n){return n>=.8?"bg-green-500/10 border-green-500/20":n>=.6?"bg-amber-500/10 border-amber-500/20":"bg-red-500/10 border-red-500/20"}function Bd(n){switch(n){case"search":return"bg-blue-500/10 text-blue-400 border-blue-500/20";case"scrape":return"bg-emerald-500/10 text-emerald-400 border-emerald-500/20";case"analyze":return"bg-purple-500/10 text-purple-400 border-purple-500/20";case"create":return"bg-amber-500/10 text-amber-400 border-amber-500/20";case"validate":return"bg-cyan-500/10 text-cyan-400 border-cyan-500/20";default:return"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"}}const cN=[{label:"OSINT investigation",prompt:"OSINT investigation on "},{label:"Security audit",prompt:"Security audit of "},{label:"Market analysis",prompt:"Market analysis of "},{label:"Build a landing page",prompt:"Build a landing page for "},{label:"Competitive research",prompt:"Competitive research on "},{label:"Code review",prompt:"Review all PRs from this week on "}];function Or({label:n,score:r}){const d=Math.round(r*100);return t.jsxs("div",{className:`flex flex-col items-center rounded-lg border px-4 py-3 ${H0(r)}`,children:[t.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1",children:n}),t.jsxs("span",{className:`text-2xl font-bold tabular-nums ${ou(r)}`,children:[d,"%"]})]})}function oN({finding:n}){const[r,d]=u.useState(!1),c=Math.round(n.confidence*100);return t.jsxs("div",{className:"rounded-lg border border-border/50 bg-zinc-900/50 overflow-hidden",children:[t.jsxs("button",{onClick:()=>d(!r),className:"w-full flex items-start gap-2 px-3 py-2.5 text-left hover:bg-zinc-800/30 transition-colors",children:[t.jsx("span",{className:"mt-0.5 flex-shrink-0",children:r?t.jsx(Xa,{className:"h-3.5 w-3.5 text-zinc-500"}):t.jsx(ra,{className:"h-3.5 w-3.5 text-zinc-500"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border font-medium ${Bd(n.type)}`,children:n.type}),t.jsx("span",{className:"text-sm font-medium text-zinc-200 truncate",children:n.title})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-1 text-[11px] text-zinc-500",children:[t.jsxs("span",{className:ou(n.confidence),children:[c,"% confidence"]}),n.source&&t.jsxs("span",{children:["via ",n.source]})]})]})]}),r&&t.jsxs("div",{className:"px-3 pb-3 pt-0 border-t border-border/30",children:[t.jsx("p",{className:"text-xs text-zinc-400 whitespace-pre-wrap mt-2",children:n.content}),n.sourceUrl&&t.jsx("a",{href:n.sourceUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-block mt-2 text-[11px] text-purple-400 hover:text-purple-300 underline",children:n.sourceUrl})]})]})}function dN({content:n}){const r=n.split(`
590
+ `),d=[];for(let c=0;c<r.length;c++){const m=r[c];if(c===0&&m==="---"){const f=r.indexOf("---",1);if(f>0){c=f;continue}}if(m.startsWith("# "))d.push(t.jsx("h1",{className:"text-xl font-bold text-zinc-100 mt-6 mb-2",children:m.slice(2)},c));else if(m.startsWith("## "))d.push(t.jsx("h2",{className:"text-lg font-semibold text-zinc-200 mt-5 mb-2",children:m.slice(3)},c));else if(m.startsWith("### "))d.push(t.jsx("h3",{className:"text-base font-semibold text-zinc-300 mt-4 mb-1",children:m.slice(4)},c));else if(m.startsWith("#### "))d.push(t.jsx("h4",{className:"text-sm font-semibold text-zinc-300 mt-3 mb-1",children:m.slice(5)},c));else if(m.startsWith("- ")||m.startsWith("* "))d.push(t.jsxs("div",{className:"flex gap-2 text-sm text-zinc-400 ml-2 my-0.5",children:[t.jsx("span",{className:"text-zinc-600 flex-shrink-0",children:"-"}),t.jsx("span",{children:Cd(m.slice(2))})]},c));else if(/^\d+\.\s/.test(m)){const f=m.match(/^(\d+)\.\s(.*)$/);f&&d.push(t.jsxs("div",{className:"flex gap-2 text-sm text-zinc-400 ml-2 my-0.5",children:[t.jsxs("span",{className:"text-zinc-600 flex-shrink-0 tabular-nums",children:[f[1],"."]}),t.jsx("span",{children:Cd(f[2])})]},c))}else m.startsWith("---")||m.startsWith("***")?d.push(t.jsx("hr",{className:"border-border/50 my-4"},c)):m.trim()===""?d.push(t.jsx("div",{className:"h-2"},c)):d.push(t.jsx("p",{className:"text-sm text-zinc-400 my-1",children:Cd(m)},c))}return t.jsx("div",{className:"space-y-0",children:d})}function Cd(n){return n.split(/(\*\*[^*]+\*\*)/g).map((d,c)=>{if(d.startsWith("**")&&d.endsWith("**"))return t.jsx("strong",{className:"text-zinc-200 font-semibold",children:d.slice(2,-2)},c);const m=/\[([^\]]+)\]\(([^)]+)\)/g,f=[];let h=0,b;for(;(b=m.exec(d))!==null;)b.index>h&&f.push(d.slice(h,b.index)),f.push(t.jsx("a",{href:b[2],target:"_blank",rel:"noopener noreferrer",className:"text-purple-400 hover:text-purple-300 underline",children:b[1]},`${c}-${b.index}`)),h=b.index+b[0].length;return h<d.length&&f.push(d.slice(h)),f.length>0?t.jsx("span",{children:f},c):d})}function uN({missions:n,selectedId:r,onSelect:d}){const[c,m]=u.useState(""),[f,h]=u.useState("all"),[b,g]=u.useState("all"),[p,w]=u.useState("recent"),v=u.useMemo(()=>{let y=[...n];if(c){const k=c.toLowerCase();y=y.filter(z=>{var N,S,C;return((N=z.title)==null?void 0:N.toLowerCase().includes(k))||((S=z.objective)==null?void 0:S.toLowerCase().includes(k))||((C=z.type)==null?void 0:C.toLowerCase().includes(k))})}switch(f!=="all"&&(y=y.filter(k=>k.type===f)),b!=="all"&&(y=y.filter(k=>k.status===b)),p){case"recent":y.sort((k,z)=>(z.createdAt||0)-(k.createdAt||0));break;case"cost":y.sort((k,z)=>(z.spentUsd||0)-(k.spentUsd||0));break;case"quality":y.sort((k,z)=>{var N,S;return(((N=z.evaluation)==null?void 0:N.overall)||0)-(((S=k.evaluation)==null?void 0:S.overall)||0)});break;case"findings":y.sort((k,z)=>{var N,S;return(((N=z.findings)==null?void 0:N.length)||0)-(((S=k.findings)==null?void 0:S.length)||0)});break}return y},[n,c,f,b,p]);return n.length===0?null:t.jsxs("div",{className:"border-b border-border/50 pb-4 mb-4",children:[t.jsx("h3",{className:"text-[10px] uppercase tracking-wider text-zinc-600 px-1 mb-3",children:"Missions"}),t.jsxs("div",{className:"grid grid-cols-4 gap-2 mb-4 text-center",children:[t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsx("div",{className:"text-lg font-bold text-white",children:n.length}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Total"})]}),t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsx("div",{className:"text-lg font-bold text-green-400",children:n.filter(y=>y.status==="completed").length}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Completed"})]}),t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsxs("div",{className:"text-lg font-bold text-white",children:["$",n.reduce((y,k)=>y+(k.spentUsd||0),0).toFixed(2)]}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Total Cost"})]}),t.jsxs("div",{className:"bg-zinc-800/70 rounded p-2",children:[t.jsx("div",{className:"text-lg font-bold text-white",children:n.reduce((y,k)=>{var z;return y+(((z=k.findings)==null?void 0:z.length)||0)},0)}),t.jsx("div",{className:"text-[10px] text-zinc-500",children:"Findings"})]})]}),t.jsx("div",{className:"mb-3",children:t.jsx("input",{type:"text",placeholder:"Search missions...",value:c,onChange:y=>m(y.target.value),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-sm text-white placeholder-zinc-500 focus:outline-none focus:border-purple-500"})}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:["all","osint","research","code","audit","creation","analysis"].map(y=>t.jsx("button",{onClick:()=>h(y),className:`px-2.5 py-1 rounded-full text-[10px] font-medium transition-colors ${f===y?"bg-purple-600 text-white":"bg-zinc-800 text-zinc-400 hover:bg-zinc-700"}`,children:y==="all"?"All":y.charAt(0).toUpperCase()+y.slice(1)},y))}),t.jsx("div",{className:"flex gap-1.5 mb-3",children:["all","completed","executing","failed","interrupted"].map(y=>t.jsxs("button",{onClick:()=>g(y),className:`px-2 py-1 rounded text-[10px] transition-colors ${b===y?"bg-zinc-700 text-white":"text-zinc-500 hover:text-zinc-300"}`,children:[y==="all"?"All":y,y!=="all"&&` (${n.filter(k=>k.status===y).length})`]},y))}),t.jsxs("div",{className:"flex items-center gap-2 mb-2 text-[10px] text-zinc-500",children:[t.jsx("span",{children:"Sort:"}),["recent","cost","quality","findings"].map(y=>t.jsx("button",{onClick:()=>w(y),className:`transition-colors ${p===y?"text-purple-400":"hover:text-zinc-300"}`,children:y},y))]}),t.jsxs("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:[v.map(y=>{var k,z;return t.jsx("button",{onClick:()=>d(y),className:`w-full text-left rounded-lg transition-colors ${r===y.id?"bg-purple-500/10 border border-purple-500/20":"hover:bg-zinc-800/50"}`,children:t.jsxs("div",{className:"flex items-center gap-3 p-3",children:[t.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${y.status==="completed"?"bg-green-500":y.status==="executing"?"bg-blue-500 animate-pulse":y.status==="failed"?"bg-red-500":y.status==="interrupted"?"bg-yellow-500":"bg-gray-500"}`}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-white truncate",children:y.title}),t.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-zinc-800 text-zinc-400",children:y.type}),t.jsxs("span",{className:"text-[10px] text-zinc-500",children:["$",(y.spentUsd||0).toFixed(2)]}),t.jsxs("span",{className:"text-[10px] text-zinc-500",children:[((k=y.findings)==null?void 0:k.length)||0," findings"]}),((z=y.evaluation)==null?void 0:z.overall)!=null&&t.jsxs("span",{className:`text-[10px] font-medium ${y.evaluation.overall>=.8?"text-green-400":y.evaluation.overall>=.5?"text-yellow-400":"text-red-400"}`,children:[Math.round(y.evaluation.overall*100),"%"]})]})]}),t.jsx("span",{className:"text-[10px] text-zinc-600 flex-shrink-0",children:new Date(y.createdAt).toLocaleDateString()})]})},y.id)}),v.length===0&&t.jsx("p",{className:"text-xs text-zinc-600 text-center py-4",children:"No missions match filters"})]})]})}function mN(){var Ce,ve;const[n,r]=Xy(),[d,c]=u.useState("empty"),[m,f]=u.useState(""),[h,b]=u.useState(null),[g,p]=u.useState([]),[w,v]=u.useState(""),[y,k]=u.useState([]),[z,N]=u.useState(!1),[S,C]=u.useState(null),O=u.useRef(null),D=u.useRef(null),E=u.useRef(null),ae=u.useRef(!1);u.useEffect(()=>{ys.list().then(Q=>{k(Q.data||[])}).catch(()=>{})},[]),u.useEffect(()=>{D.current&&(D.current.scrollTop=D.current.scrollHeight)},[g]),u.useEffect(()=>()=>{var Q;(Q=O.current)==null||Q.close()},[]);const oe=u.useCallback(async Q=>{var ke,ze;const ee=Q??m;if(ee.trim()){c("planning"),v(""),p([]),b(null),N(!1);try{const Ue=await ys.plan(ee.trim());b(Ue.data),c("planned")}catch(Ue){v(((ze=(ke=Ue==null?void 0:Ue.body)==null?void 0:ke.error)==null?void 0:ze.message)||Ue.message||"Planning failed"),c("error")}}},[m]);u.useEffect(()=>{if(ae.current)return;const Q=n.get("objective");Q&&!h&&(ae.current=!0,f(Q),r({},{replace:!0}),oe(Q))},[n,h,oe,r]);const B=u.useCallback(async()=>{var Ue;if(!h)return;c("executing"),p([]),N(!1),C(null);const Q=localStorage.getItem("nestor_token"),ee=(Ue=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:Ue[1],ke=localStorage.getItem("nestor_tenant_id"),ze={"Content-Type":"application/json"};Q&&(ze.Authorization=`Bearer ${Q}`),ee&&(ze["X-CSRF-Token"]=decodeURIComponent(ee)),ke&&(ze["X-Tenant-ID"]=ke);try{const Ie=await fetch(`/api/missions/${h.id}/execute`,{method:"POST",headers:ze});if(!Ie.ok||!Ie.body){v("Failed to start execution"),c("error");return}const De=Ie.body.getReader(),tt=new TextDecoder;let M="";const P=Ye=>{if(Ye.startsWith("data: "))try{const Bt=JSON.parse(Ye.slice(6));q(Bt)}catch{}};await(async()=>{for(;;){const{done:Ye,value:Bt}=await De.read();if(Ye)break;M+=tt.decode(Bt,{stream:!0});const Ft=M.split(`
591
+ `);M=Ft.pop()||"";for(const ut of Ft)P(ut.trim())}M.trim()&&P(M.trim())})()}catch(Ie){v(Ie.message||"Execution failed"),c("error")}},[h]),q=u.useCallback(Q=>{switch(Q.type){case"status":b(ee=>ee&&{...ee,status:Q.status}),Q.status==="evaluating"&&c("evaluating");break;case"sub_objective_start":C(Q.id),b(ee=>{if(!ee)return ee;const ke=ee.subObjectives.map(ze=>ze.id===Q.id?{...ze,status:"in_progress"}:ze);return{...ee,subObjectives:ke}});break;case"sub_objective_complete":b(ee=>{if(!ee)return ee;const ke=ee.subObjectives.map(ze=>ze.id===Q.id?{...ze,status:Q.status}:ze);return{...ee,subObjectives:ke}});break;case"finding":p(ee=>[...ee,Q]);break;case"evaluation":b(ee=>ee&&{...ee,evaluation:{completeness:Q.completeness,accuracy:Q.accuracy,depth:Q.depth,relevance:Q.relevance,overall:Q.overall,gaps:Q.gaps||[],recommendation:Q.recommendation||"deliver",suggestedActions:Q.suggestedActions||[]}});break;case"iteration":b(ee=>ee&&{...ee,iteration:Q.iteration});break;case"budget_exhausted":break;case"complete":b(ee=>ee&&{...ee,status:Q.status||"completed",spentUsd:Q.cost||ee.spentUsd,iteration:Q.iterations||ee.iteration}),Q.missionId&&ys.get(Q.missionId).then(ee=>{b(ee.data)}).catch(()=>{}),c("complete"),ys.list().then(ee=>k(ee.data||[])).catch(()=>{});break;case"error":v(Q.message),c("error");break}},[]),I=u.useCallback(async()=>{if(h)try{await ys.cancel(h.id),b(Q=>Q&&{...Q,status:"cancelled"}),c("empty")}catch{}},[h]),W=u.useCallback(()=>{var Q,ee;c("empty"),f(""),b(null),p([]),v(""),N(!1),C(null),(Q=O.current)==null||Q.close(),(ee=E.current)==null||ee.focus()},[]),Y=u.useCallback(Q=>{b(Q),f(Q.objective),p((Q.findings||[]).map(ee=>({id:ee.id,type:ee.type,title:ee.title,content:ee.content,confidence:ee.confidence,source:ee.source,sourceUrl:ee.sourceUrl}))),Q.status==="completed"||Q.status==="failed"?c("complete"):(Q.status,c("planned"))},[]),le=u.useCallback(()=>{if(!(h!=null&&h.report))return;const Q=new Blob([h.report],{type:"text/markdown"}),ee=URL.createObjectURL(Q),ke=document.createElement("a");ke.href=ee,ke.download=`${h.title.replace(/[^a-zA-Z0-9]/g,"_")}_report.md`,ke.click(),URL.revokeObjectURL(ee)},[h]),J=u.useCallback(Q=>{var ee;f(Q),(ee=E.current)==null||ee.focus()},[]),ce=Et(),[he,G]=u.useState(!1),[ie,me]=u.useState(null),ne=u.useCallback(Q=>{me(Q),setTimeout(()=>me(null),3e3)},[]),we=u.useCallback(async Q=>{var ee,ke;G(!0);try{const ze=localStorage.getItem("nestor_token"),Ue=(ee=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:ee[1],Ie=localStorage.getItem("nestor_tenant_id"),De={"Content-Type":"application/json"};ze&&(De.Authorization=`Bearer ${ze}`),Ue&&(De["X-CSRF-Token"]=decodeURIComponent(Ue)),Ie&&(De["X-Tenant-ID"]=Ie);const tt=await fetch(`/api/missions/${Q}/iterate`,{method:"POST",headers:De});if(!tt.ok){const P=await tt.json().catch(()=>({}));ne(((ke=P==null?void 0:P.error)==null?void 0:ke.message)||"Iterate request failed");return}ne("Mission queued for iteration. Executing...");const M=await ys.get(Q);b(M.data),c("planned"),setTimeout(()=>{B()},500)}catch(ze){ne(ze instanceof Error?ze.message:"Iterate failed")}finally{G(!1)}},[B,ne]),T=u.useCallback(async Q=>{var ee;if(!(!((ee=Q.evaluation)!=null&&ee.gaps)||Q.evaluation.gaps.length===0)){G(!0);try{const ke=`Deep dive follow-up for mission "${Q.title}". Focus ONLY on these gaps identified in the evaluation:
592
+ ${Q.evaluation.gaps.map(Ue=>`- ${Ue}`).join(`
593
+ `)}
594
+
595
+ Previous findings are available in the knowledge graph. Do NOT repeat what was already found. Use different approaches and sources than the original mission.`,ze=await ys.plan(ke,{maxBudget:3});ze.data&&(b(ze.data),f(ke),p([]),c("planned"),ne("Deep-dive mission planned. Review and execute."))}catch(ke){ne(ke instanceof Error?ke.message:"Deep dive planning failed")}finally{G(!1)}}},[ne]),X=u.useCallback(async Q=>{var ee;G(!0);try{const ke=localStorage.getItem("nestor_token"),ze=(ee=document.cookie.match(/(?:^|; )nestor-csrf=([^;]*)/))==null?void 0:ee[1],Ue=localStorage.getItem("nestor_tenant_id"),Ie={"Content-Type":"application/json"};ke&&(Ie.Authorization=`Bearer ${ke}`),ze&&(Ie["X-CSRF-Token"]=decodeURIComponent(ze)),Ue&&(Ie["X-Tenant-ID"]=Ue),(await fetch(`/api/brain/reindex/${Q}`,{method:"POST",headers:Ie})).ok?ne("Mission findings archived to Brain knowledge graph."):ne("Archive failed — brain endpoint may not be available.")}catch{ne("Archive failed — brain endpoint may not be available.")}finally{G(!1)}},[ne]),re=u.useCallback(async Q=>{G(!0);try{const ee=await ys.plan(Q.objective,{maxBudget:Q.maxBudgetUsd});ee.data&&(b(ee.data),f(Q.objective),p([]),c("planned"),ne("Fresh mission planned. Review and execute."))}catch(ee){ne(ee instanceof Error?ee.message:"Re-run planning failed")}finally{G(!1)}},[ne]),$=u.useCallback(Q=>{const ee=new Blob([JSON.stringify(Q,null,2)],{type:"application/json"}),ke=URL.createObjectURL(ee),ze=document.createElement("a");ze.href=ke,ze.download=`mission-${Q.id.substring(0,8)}-${(Q.title||"export").replace(/[^a-z0-9]/gi,"-").substring(0,30)}.json`,ze.click(),URL.revokeObjectURL(ke)},[]),de=(h==null?void 0:h.subObjectives.filter(Q=>Q.status==="completed").length)||0,xe=(h==null?void 0:h.subObjectives.length)||1,be=Math.round(de/xe*100);return t.jsx("div",{className:"flex h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-3 h-14 px-6 border-b border-border bg-surface flex-shrink-0",children:[t.jsx(Ka,{className:"h-5 w-5 text-purple-400"}),t.jsx("h1",{className:"text-lg font-semibold text-zinc-100",children:"Missions"}),h&&d!=="empty"&&t.jsxs("div",{className:"flex items-center gap-2 ml-auto text-xs text-zinc-500",children:[h.type&&t.jsxs("span",{className:`flex items-center gap-1 px-2 py-0.5 rounded border ${Bd(h.type)}`,children:[iN(h.type),h.type]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(wa,{className:"h-3 w-3"}),"$",h.spentUsd.toFixed(4)," / $",h.maxBudgetUsd.toFixed(2)]}),h.iteration>0&&t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(Ct,{className:"h-3 w-3"}),"Iteration ",h.iteration,"/",h.maxIterations]}),t.jsx("button",{onClick:W,className:"ml-2 p-1 rounded text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800 transition-colors",title:"New mission",children:t.jsx(et,{className:"h-4 w-4"})})]})]}),d==="empty"&&t.jsx("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:t.jsxs("div",{className:"w-full max-w-2xl",children:[t.jsx("div",{className:"flex items-center justify-center mb-6",children:t.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-purple-600/20 border border-purple-500/20",children:t.jsx(Ka,{className:"h-8 w-8 text-purple-400"})})}),t.jsx("h2",{className:"text-2xl font-bold text-zinc-100 text-center mb-2",children:"What's your mission?"}),t.jsx("p",{className:"text-sm text-zinc-500 text-center mb-8",children:"Autonomous AI agents will plan, execute, and deliver results."}),t.jsx(uN,{missions:y,selectedId:null,onSelect:Y}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{ref:E,type:"text",value:m,onChange:Q=>f(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&oe(),placeholder:"Describe your mission objective...",className:"flex-1 rounded-lg border border-border bg-zinc-900 px-4 py-3 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:ring-2 focus:ring-purple-500/40 focus:border-purple-500/40",autoFocus:!0}),t.jsxs("button",{onClick:()=>oe(),disabled:!m.trim(),className:"flex items-center gap-2 rounded-lg bg-purple-600 px-5 py-3 text-sm font-medium text-white hover:bg-purple-500 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[t.jsx(Zs,{className:"h-4 w-4"}),"Plan"]})]}),t.jsx("div",{className:"flex flex-wrap gap-2 mt-4 justify-center",children:cN.map(Q=>t.jsx("button",{onClick:()=>J(Q.prompt),className:"px-3 py-1.5 rounded-full border border-border/50 text-xs text-zinc-500 hover:text-zinc-300 hover:border-purple-500/30 hover:bg-purple-500/5 transition-colors",children:Q.label},Q.label))})]})}),d==="planning"&&t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[t.jsx(ht,{className:"h-10 w-10 text-purple-400 animate-spin mb-4"}),t.jsx("h2",{className:"text-lg font-semibold text-zinc-200 mb-1",children:"Analyzing objective..."}),t.jsx("p",{className:"text-sm text-zinc-500",children:"Decomposing into sub-objectives"})]}),d==="error"&&t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[t.jsx(dt,{className:"h-10 w-10 text-red-400 mb-4"}),t.jsx("h2",{className:"text-lg font-semibold text-zinc-200 mb-1",children:"Something went wrong"}),t.jsx("p",{className:"text-sm text-red-400/80 mb-4 max-w-md text-center",children:w}),t.jsx("button",{onClick:W,className:"px-4 py-2 rounded-lg border border-border text-sm text-zinc-300 hover:bg-zinc-800 transition-colors",children:"Try again"})]}),h&&(d==="planned"||d==="executing"||d==="evaluating"||d==="complete")&&t.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[t.jsxs("div",{className:"w-[420px] flex-shrink-0 border-r border-border overflow-y-auto p-4",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("h2",{className:"text-base font-semibold text-zinc-100 mb-1",children:h.title}),t.jsx("p",{className:"text-xs text-zinc-500 leading-relaxed",children:h.objective})]}),(d==="executing"||d==="evaluating")&&t.jsxs("div",{className:"mb-4",children:[t.jsxs("div",{className:"flex justify-between text-[10px] text-zinc-500 mb-1",children:[t.jsx("span",{children:"Progress"}),t.jsxs("span",{children:[be,"%"]})]}),t.jsx("div",{className:"h-1.5 bg-zinc-800 rounded-full overflow-hidden",children:t.jsx("div",{className:"h-full bg-purple-500 rounded-full transition-all duration-500",style:{width:`${be}%`}})})]}),t.jsx("div",{className:"space-y-1",children:h.subObjectives.map((Q,ee)=>t.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-lg transition-colors ${S===Q.id?"bg-purple-500/10 border border-purple-500/20":"hover:bg-zinc-800/30"}`,children:[t.jsxs("div",{className:"flex flex-col items-center flex-shrink-0",children:[rN(Q.status),ee<h.subObjectives.length-1&&t.jsx("div",{className:"w-px h-6 bg-border/50 mt-1"})]}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium text-zinc-200 truncate",children:Q.name}),t.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${Bd(Q.type)}`,children:Q.type})]}),t.jsx("p",{className:"text-[11px] text-zinc-500 mt-0.5 line-clamp-2",children:Q.description}),Q.findings.length>0&&t.jsxs("span",{className:"text-[10px] text-zinc-600 mt-1 inline-block",children:[Q.findings.length," finding",Q.findings.length!==1?"s":""]})]})]},Q.id))}),t.jsxs("div",{className:"mt-6 space-y-2",children:[d==="planned"&&t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("button",{onClick:B,className:"flex-1 flex items-center justify-center gap-2 rounded-lg bg-purple-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-purple-500 transition-colors",children:[t.jsx(Ka,{className:"h-4 w-4"}),"Execute Mission"]}),t.jsx("button",{onClick:I,className:"rounded-lg border border-border px-4 py-2.5 text-sm text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800 transition-colors",children:"Cancel"})]}),d==="executing"&&t.jsxs("button",{onClick:I,className:"w-full flex items-center justify-center gap-2 rounded-lg border border-red-500/30 px-4 py-2.5 text-sm text-red-400 hover:bg-red-500/10 transition-colors",children:[t.jsx(At,{className:"h-4 w-4"}),"Cancel Execution"]}),d==="evaluating"&&t.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-amber-400 py-2",children:[t.jsx(ht,{className:"h-4 w-4 animate-spin"}),"Evaluating results..."]})]}),h.evaluation&&(d==="complete"||d==="evaluating")&&t.jsxs("div",{className:"mt-6",children:[t.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500 mb-3",children:"Quality Evaluation"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(Or,{label:"Completeness",score:h.evaluation.completeness}),t.jsx(Or,{label:"Accuracy",score:h.evaluation.accuracy}),t.jsx(Or,{label:"Depth",score:h.evaluation.depth}),t.jsx(Or,{label:"Relevance",score:h.evaluation.relevance})]}),t.jsxs("div",{className:`mt-2 rounded-lg border p-3 text-center ${H0(h.evaluation.overall)}`,children:[t.jsx("span",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:"Overall"}),t.jsxs("div",{className:`text-3xl font-bold tabular-nums ${ou(h.evaluation.overall)}`,children:[Math.round(h.evaluation.overall*100),"%"]}),t.jsxs("div",{className:"text-xs text-zinc-500 mt-1 capitalize",children:["Recommendation: ",t.jsx("span",{className:h.evaluation.recommendation==="deliver"?"text-green-400":h.evaluation.recommendation==="iterate"?"text-amber-400":"text-red-400",children:h.evaluation.recommendation})]})]}),h.evaluation.gaps.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsx("h4",{className:"text-[10px] uppercase tracking-wider text-zinc-600 mb-1",children:"Gaps"}),h.evaluation.gaps.map((Q,ee)=>t.jsxs("p",{className:"text-[11px] text-zinc-500 flex items-start gap-1 mt-0.5",children:[t.jsx(dt,{className:"h-3 w-3 text-amber-500/60 flex-shrink-0 mt-0.5"}),Q]},ee))]})]}),d==="complete"&&h.report&&t.jsxs("div",{className:"mt-4 flex gap-2",children:[t.jsxs("button",{onClick:()=>N(!z),className:"flex-1 flex items-center justify-center gap-2 rounded-lg border border-border px-3 py-2 text-sm text-zinc-300 hover:bg-zinc-800 transition-colors",children:[t.jsx(Fs,{className:"h-4 w-4"}),z?"Hide Report":"View Report"]}),t.jsx("button",{onClick:le,className:"flex items-center justify-center gap-2 rounded-lg border border-border px-3 py-2 text-sm text-zinc-300 hover:bg-zinc-800 transition-colors",title:"Download as Markdown",children:t.jsx(Wl,{className:"h-4 w-4"})})]}),d==="complete"&&t.jsxs("button",{onClick:W,className:"mt-3 w-full flex items-center justify-center gap-2 rounded-lg bg-purple-600/20 border border-purple-500/20 px-4 py-2.5 text-sm text-purple-400 hover:bg-purple-600/30 transition-colors",children:[t.jsx(x0,{className:"h-4 w-4"}),"New Mission"]}),ie&&t.jsx("div",{className:"mt-4 rounded-lg bg-purple-600/20 border border-purple-500/50 px-4 py-3 text-sm text-purple-200 text-center font-medium shadow-lg shadow-purple-900/20 transition-all",children:t.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.jsx("span",{className:"animate-bounce",children:"⚡"}),t.jsx("span",{children:ie})]})}),he&&t.jsxs("div",{className:"mt-3 flex items-center justify-center gap-2 text-sm text-zinc-400",children:[t.jsx("div",{className:"w-4 h-4 border-2 border-purple-500 border-t-transparent rounded-full animate-spin"}),"Processing..."]}),(d==="complete"||(h==null?void 0:h.status)==="completed"||(h==null?void 0:h.status)==="failed")&&h&&t.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-4",children:[((Ce=h.evaluation)==null?void 0:Ce.recommendation)==="iterate"&&t.jsxs("button",{onClick:()=>we(h.id),disabled:he,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-yellow-600 hover:bg-yellow-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(Ct,{className:"h-3.5 w-3.5"}),"Iterate on Gaps"]}),((ve=h.evaluation)==null?void 0:ve.gaps)&&h.evaluation.gaps.length>0&&t.jsxs("button",{onClick:()=>T(h),disabled:he,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-blue-600 hover:bg-blue-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(ks,{className:"h-3.5 w-3.5"}),"Deep Dive Gaps"]}),t.jsxs("button",{onClick:()=>X(h.id),disabled:he,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-green-600 hover:bg-green-500 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(ws,{className:"h-3.5 w-3.5"}),"Archive to Brain"]}),t.jsxs("button",{onClick:()=>ce(`/chat?context=mission:${h.id}`),className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-purple-600 hover:bg-purple-500 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(Pd,{className:"h-3.5 w-3.5"}),"Chat About This"]}),t.jsxs("button",{onClick:()=>re(h),disabled:he,className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-zinc-700 hover:bg-zinc-600 disabled:opacity-50 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(Ct,{className:"h-3.5 w-3.5"}),"Re-run Fresh"]}),t.jsxs("button",{onClick:()=>$(h),className:"flex items-center justify-center gap-2 px-3 py-2.5 bg-zinc-700 hover:bg-zinc-600 text-white rounded-lg text-xs font-medium transition-colors",children:[t.jsx(Wl,{className:"h-3.5 w-3.5"}),"Export Full Data"]})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4",ref:D,children:z&&h.report?t.jsxs("div",{className:"max-w-3xl mx-auto",children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-zinc-300",children:"Mission Report"}),t.jsx("button",{onClick:()=>N(!1),className:"text-zinc-500 hover:text-zinc-300",children:t.jsx(et,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"rounded-lg border border-border bg-zinc-900/50 p-6",children:t.jsx(dN,{content:h.report})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider text-zinc-500 mb-3",children:["Findings",g.length>0&&t.jsxs("span",{className:"ml-2 text-zinc-600",children:["(",g.length,")"]})]}),g.length===0&&d==="planned"&&t.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-zinc-600",children:[t.jsx(ks,{className:"h-8 w-8 mb-2 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Findings will appear here during execution"})]}),g.length===0&&d==="executing"&&t.jsxs("div",{className:"flex flex-col items-center justify-center h-64 text-zinc-600",children:[t.jsx(ht,{className:"h-8 w-8 mb-2 animate-spin opacity-40"}),t.jsx("p",{className:"text-sm",children:"Agents are working..."})]}),t.jsx("div",{className:"space-y-2",children:g.map(Q=>t.jsx(oN,{finding:Q},Q.id))})]})})]})]})})}const Qh=[{id:"claude",name:"Claude",provider:"Anthropic",emoji:"🟣",color:"text-purple-400",bgColor:"bg-purple-500/10",borderColor:"border-purple-500/30",keyUrl:"https://console.anthropic.com/settings/keys",keyUrlLabel:"console.anthropic.com",envVar:"ANTHROPIC_API_KEY",needsKey:!0},{id:"openai",name:"OpenAI",provider:"OpenAI",emoji:"🟢",color:"text-green-400",bgColor:"bg-green-500/10",borderColor:"border-green-500/30",keyUrl:"https://platform.openai.com/api-keys",keyUrlLabel:"platform.openai.com",envVar:"OPENAI_API_KEY",needsKey:!0},{id:"gemini",name:"Google Gemini",provider:"Google",emoji:"🔵",color:"text-blue-400",bgColor:"bg-blue-500/10",borderColor:"border-blue-500/30",keyUrl:"https://aistudio.google.com/apikey",keyUrlLabel:"aistudio.google.com",envVar:"GEMINI_API_KEY",needsKey:!0},{id:"grok",name:"Grok",provider:"xAI",emoji:"⚪",color:"text-zinc-300",bgColor:"bg-zinc-500/10",borderColor:"border-zinc-500/30",keyUrl:"https://console.x.ai/team/default/api-keys",keyUrlLabel:"console.x.ai",envVar:"XAI_API_KEY",needsKey:!0},{id:"mistral",name:"Mistral AI",provider:"Mistral",emoji:"🟠",color:"text-orange-400",bgColor:"bg-orange-500/10",borderColor:"border-orange-500/30",keyUrl:"https://console.mistral.ai/api-keys",keyUrlLabel:"console.mistral.ai",envVar:"MISTRAL_API_KEY",needsKey:!0},{id:"ollama",name:"Ollama",provider:"Local",emoji:"🟤",color:"text-amber-400",bgColor:"bg-amber-500/10",borderColor:"border-amber-500/30",keyUrl:"https://ollama.ai/download",keyUrlLabel:"ollama.ai",envVar:"",needsKey:!1}];function xN(n){if(!n)return"";const r=Date.now()-new Date(n+"Z").getTime(),d=Math.floor(r/6e4);if(d<1)return"Just now";if(d<60)return`${d}m ago`;const c=Math.floor(d/60);if(c<24)return`${c}h ago`;const m=Math.floor(c/24);return m<30?`${m}d ago`:new Date(n).toLocaleDateString()}function fN({entry:n}){return n.configured&&n.source==="db"?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-green-500/10 px-2.5 py-0.5 text-xs font-medium text-green-400",children:[t.jsx(Nt,{className:"h-3 w-3"}),"Configured"]}):n.configured&&n.source==="env"?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-yellow-500/10 px-2.5 py-0.5 text-xs font-medium text-yellow-400",children:[t.jsx(dt,{className:"h-3 w-3"}),"From env"]}):n.provider==="ollama"&&n.configured?t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-blue-500/10 px-2.5 py-0.5 text-xs font-medium text-blue-400",children:[t.jsx(Nt,{className:"h-3 w-3"}),"Local"]}):t.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-red-500/10 px-2.5 py-0.5 text-xs font-medium text-red-400",children:[t.jsx(et,{className:"h-3 w-3"}),"Not configured"]})}function hN({provider:n,onClose:r,onSaved:d}){const[c,m]=u.useState(""),[f,h]=u.useState(""),[b,g]=u.useState(!1),[p,w]=u.useState(!1),[v,y]=u.useState(!1),[k,z]=u.useState(null),[N,S]=u.useState(null),C=async()=>{if(c.trim()){y(!0),z(null),S(null);try{await xa.set(n.id,c.trim(),f||void 0);const D=await xa.test(n.id);z(D.data)}catch(D){S(D instanceof Error?D.message:"Test failed")}finally{y(!1)}}},O=async()=>{if(c.trim()){w(!0),S(null);try{await xa.set(n.id,c.trim(),f||void 0),d()}catch(D){S(D instanceof Error?D.message:"Failed to save")}finally{w(!1)}}};return t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:t.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-surface p-6 shadow-2xl",children:[t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:n.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-semibold text-white",children:n.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:n.provider})]})]}),t.jsx("button",{onClick:r,className:"rounded-lg p-2 text-zinc-400 hover:bg-surface-hover hover:text-zinc-200",children:t.jsx(et,{className:"h-5 w-5"})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"API Key"}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:b?"text":"password",value:c,onChange:D=>m(D.target.value),placeholder:`Enter your ${n.provider} API key`,className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 pr-10 text-sm text-zinc-200 focus:border-purple-500 focus:outline-none placeholder:text-zinc-600",autoFocus:!0}),t.jsx("button",{type:"button",onClick:()=>g(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:b?t.jsx(Zd,{className:"h-4 w-4"}):t.jsx(Vr,{className:"h-4 w-4"})})]}),n.envVar&&t.jsxs("p",{className:"mt-1 text-xs text-zinc-600",children:["Env var: ",t.jsx("code",{className:"text-zinc-500",children:n.envVar})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:["Label ",t.jsx("span",{className:"text-zinc-600",children:"(optional)"})]}),t.jsx("input",{type:"text",value:f,onChange:D=>h(D.target.value),placeholder:"e.g. Production key, Personal key",className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm text-zinc-200 focus:border-purple-500 focus:outline-none placeholder:text-zinc-600"})]}),k&&t.jsxs("div",{className:`rounded-lg border p-3 ${k.valid?"border-green-500/30 bg-green-500/5 text-green-400":"border-red-500/30 bg-red-500/5 text-red-400"}`,children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[k.valid?t.jsx(Nt,{className:"h-4 w-4"}):t.jsx(et,{className:"h-4 w-4"}),k.valid?"Key is valid":"Key validation failed"]}),t.jsx("p",{className:"mt-1 text-xs opacity-80",children:k.message}),k.models&&k.models.length>0&&t.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[k.models.slice(0,6).map(D=>t.jsx("span",{className:"rounded-md bg-white/5 px-2 py-0.5 text-[10px] font-mono",children:D},D)),k.models.length>6&&t.jsxs("span",{className:"rounded-md bg-white/5 px-2 py-0.5 text-[10px]",children:["+",k.models.length-6," more"]})]})]}),N&&t.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-400",children:N}),t.jsxs("a",{href:n.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:[t.jsx($n,{className:"h-3 w-3"}),"Get API key at ",n.keyUrlLabel]})]}),t.jsxs("div",{className:"mt-6 flex items-center justify-end gap-3",children:[t.jsxs("button",{onClick:C,disabled:!c.trim()||v,className:"inline-flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium text-zinc-300 transition-colors hover:bg-surface-hover disabled:opacity-50 disabled:cursor-not-allowed",children:[v?t.jsx(ht,{className:"h-4 w-4 animate-spin"}):t.jsx(ei,{className:"h-4 w-4"}),"Test Key"]}),t.jsxs("button",{onClick:O,disabled:!c.trim()||p,className:"inline-flex items-center gap-2 rounded-lg bg-purple-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed",children:[p?t.jsx(ht,{className:"h-4 w-4 animate-spin"}):t.jsx(Nt,{className:"h-4 w-4"}),"Save"]})]})]})})}function pN({meta:n,entry:r,onAdd:d,onTest:c,onRemove:m,testingProvider:f,testResult:h}){const b=(r==null?void 0:r.configured)??!1,g=f===n.id,p=(h==null?void 0:h.provider)===n.id?h.result:null;return t.jsxs("div",{className:`rounded-xl border ${b?n.borderColor:"border-border"} bg-surface p-5 transition-all hover:shadow-lg hover:shadow-black/20`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-2xl",children:n.emoji}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm font-semibold text-white",children:n.name}),t.jsx("p",{className:"text-xs text-zinc-500",children:n.provider})]})]}),r&&t.jsx(fN,{entry:r})]}),b&&(r==null?void 0:r.maskedKey)&&t.jsxs("div",{className:"mb-3 rounded-lg bg-background/50 px-3 py-2",children:[t.jsx("p",{className:"font-mono text-xs text-zinc-400",children:r.maskedKey}),r.label&&r.source==="db"&&t.jsx("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:r.label}),r.updatedAt&&r.source==="db"&&t.jsxs("p",{className:"text-[10px] text-zinc-600 mt-0.5",children:["Updated ",xN(r.updatedAt)]}),r.source==="env"&&t.jsxs("p",{className:"text-[10px] text-yellow-500/80 mt-0.5",children:["Set via ",t.jsx("code",{className:"font-mono",children:n.envVar})," environment variable"]})]}),p&&t.jsxs("div",{className:`mb-3 rounded-lg border p-2.5 text-xs ${p.valid?"border-green-500/20 bg-green-500/5 text-green-400":"border-red-500/20 bg-red-500/5 text-red-400"}`,children:[t.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[p.valid?t.jsx(Nt,{className:"h-3 w-3"}):t.jsx(et,{className:"h-3 w-3"}),p.valid?"Working":"Failed"]}),t.jsx("p",{className:"mt-0.5 text-[10px] opacity-80",children:p.message}),p.models&&p.models.length>0&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[p.models.slice(0,4).map(w=>t.jsx("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px] font-mono",children:w},w)),p.models.length>4&&t.jsxs("span",{className:"rounded bg-white/5 px-1.5 py-0.5 text-[9px]",children:["+",p.models.length-4]})]})]}),t.jsx("div",{className:"flex items-center gap-2",children:b?t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:c,disabled:g,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200 disabled:opacity-50",children:[g?t.jsx(ht,{className:"h-3 w-3 animate-spin"}):t.jsx(ei,{className:"h-3 w-3"}),"Test"]}),n.needsKey&&t.jsxs("button",{onClick:d,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-zinc-400 transition-colors hover:bg-surface-hover hover:text-zinc-200",children:[t.jsx(ni,{className:"h-3 w-3"}),"Edit"]}),(r==null?void 0:r.source)==="db"&&t.jsxs("button",{onClick:m,className:"inline-flex items-center gap-1.5 rounded-lg border border-red-500/20 px-3 py-1.5 text-xs font-medium text-red-400 transition-colors hover:bg-red-500/10",children:[t.jsx(Ut,{className:"h-3 w-3"}),"Remove"]})]}):t.jsxs("button",{onClick:d,className:"inline-flex items-center gap-1.5 rounded-lg bg-purple-600 px-4 py-1.5 text-xs font-medium text-white transition-colors hover:bg-purple-700",children:[t.jsx(pt,{className:"h-3 w-3"}),"Add Key"]})}),t.jsx("div",{className:"mt-3 border-t border-border/50 pt-2.5",children:t.jsxs("a",{href:n.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[10px] text-zinc-600 hover:text-zinc-400 transition-colors",children:[t.jsx($n,{className:"h-2.5 w-2.5"}),n.keyUrlLabel]})})]})}function gN(){const[n,r]=u.useState([]),[d,c]=u.useState(!0),[m,f]=u.useState(null),[h,b]=u.useState(null),[g,p]=u.useState(null),w=u.useCallback(async()=>{try{const N=await xa.list();r(N.data)}catch{}finally{c(!1)}},[]);u.useEffect(()=>{w()},[w]);const v=async N=>{b(N),p(null);try{const S=await xa.test(N);p({provider:N,result:S.data})}catch(S){p({provider:N,result:{valid:!1,message:S instanceof Error?S.message:"Test failed"}})}finally{b(null)}},y=async N=>{try{await xa.remove(N),await w(),(g==null?void 0:g.provider)===N&&p(null)}catch{}},k=N=>n.find(S=>S.provider===N)||null,z=n.filter(N=>N.configured).length;return d?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-purple-500 border-t-transparent"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-purple-500/10",children:t.jsx(ni,{className:"h-5 w-5 text-purple-400"})}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"API Keys"}),t.jsx("p",{className:"text-sm text-zinc-500",children:"Manage your LLM provider credentials securely."})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-surface px-3 py-1.5 border border-border",children:[t.jsx(zs,{className:"h-3.5 w-3.5 text-green-400"}),t.jsxs("span",{className:"text-xs text-zinc-400",children:[z,"/",Qh.length," configured"]})]}),t.jsxs("button",{onClick:()=>{c(!0),w()},className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-zinc-400 hover:bg-surface-hover hover:text-zinc-200 transition-colors",children:[t.jsx(Ct,{className:"h-3 w-3"}),"Refresh"]})]})]}),t.jsx("div",{className:"rounded-xl border border-border bg-surface/50 p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(zs,{className:"h-5 w-5 text-purple-400 mt-0.5 flex-shrink-0"}),t.jsxs("div",{className:"text-xs text-zinc-400 space-y-1",children:[t.jsxs("p",{children:["API keys are encrypted with AES-256-GCM and stored locally in the Nestor database. The encryption key is derived from a master secret in ",t.jsx("code",{className:"text-zinc-300",children:"~/.nestor/.vault-key"}),"."]}),t.jsx("p",{children:"Keys set via environment variables take precedence over database-stored keys."})]})]})}),t.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Qh.map(N=>t.jsx(pN,{meta:N,entry:k(N.id),onAdd:()=>f(N),onTest:()=>v(N.id),onRemove:()=>y(N.id),testingProvider:h,testResult:g},N.id))}),m&&t.jsx(hN,{provider:m,onClose:()=>f(null),onSaved:()=>{f(null),w()}})]})}const Ad=[{id:"gemini",name:"Gemini",provider:"Google",description:"Multimodal AI with large context window",defaultModel:"gemini-2.5-flash",keyUrl:"https://aistudio.google.com/apikey",keyUrlLabel:"aistudio.google.com",emoji:"🔵",needsApiKey:!0},{id:"claude",name:"Claude",provider:"Anthropic",description:"Best for reasoning, analysis, and code generation",defaultModel:"claude-sonnet-4-6",keyUrl:"https://console.anthropic.com/settings/keys",keyUrlLabel:"console.anthropic.com",emoji:"🟣",needsApiKey:!0},{id:"openai",name:"GPT-4o",provider:"OpenAI",description:"Versatile model with strong general capabilities",defaultModel:"gpt-4o",keyUrl:"https://platform.openai.com/api-keys",keyUrlLabel:"platform.openai.com",emoji:"🟢",needsApiKey:!0},{id:"grok",name:"Grok",provider:"xAI",description:"Real-time knowledge with web access",defaultModel:"grok-3",keyUrl:"https://console.x.ai/",keyUrlLabel:"console.x.ai",emoji:"⚪",needsApiKey:!0},{id:"mistral",name:"Mistral",provider:"Mistral AI",description:"Efficient European AI with strong multilingual support",defaultModel:"mistral-large-latest",keyUrl:"https://console.mistral.ai/api-keys",keyUrlLabel:"console.mistral.ai",emoji:"🟠",needsApiKey:!0},{id:"ollama",name:"Ollama",provider:"Local",description:"Run open-source models locally, no API key needed",defaultModel:"llama3.1",keyUrl:"https://ollama.ai/download",keyUrlLabel:"ollama.ai",emoji:"🦙",needsApiKey:!1,note:"Free, runs on your machine"}];function bN(){var me;const n=Et(),[r,d]=u.useState(0),[c,m]=u.useState("gemini"),[f,h]=u.useState("gemini-2.5-flash"),[b,g]=u.useState(""),[p,w]=u.useState(!1),[v,y]=u.useState({}),[k,z]=u.useState(!0),[N,S]=u.useState(!1),[C,O]=u.useState(null),[D,E]=u.useState("my-agent"),[ae,oe]=u.useState("My first Nestor agent"),[B,q]=u.useState(!1),[I,W]=u.useState("");u.useEffect(()=>{Rh.status().then(ne=>{y(ne.data)}).catch(()=>{}).finally(()=>z(!1))},[]);const Y=u.useCallback(ne=>{m(ne);const we=Ad.find(T=>T.id===ne);we&&h(we.defaultModel),g(""),w(!1),O(null)},[]),le=u.useCallback(()=>{d(ne=>Math.min(ne+1,2))},[]),J=u.useCallback(()=>{d(ne=>Math.max(ne-1,0))},[]),ce=Ad.find(ne=>ne.id===c),he=((me=v[c])==null?void 0:me.configured)??!1,G=u.useCallback(async()=>{S(!0),O(null);try{const ne=await Rh.test({provider:c,apiKey:b.trim()||void 0,model:f});O(ne)}catch(ne){O({success:!1,message:ne instanceof Error?ne.message:"Connection test failed"})}finally{S(!1)}},[c,b,f]),ie=u.useCallback(async()=>{if(!D.trim()){W("Please enter an agent name.");return}q(!0),W("");try{b.trim()&&(ce!=null&&ce.needsApiKey)&&await xa.set(c,b.trim(),"Onboarding key"),await Cs.create({name:D.trim(),description:ae.trim()||void 0,adapterType:c,adapterConfig:{model:f},trustLevel:"trusted"}),localStorage.setItem("nestor_onboarding_complete","true"),n("/chat")}catch(ne){W(ne instanceof Error?ne.message:"Failed to create agent")}finally{q(!1)}},[D,ae,c,f,b,ce,n]);return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-2xl",children:[t.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:[0,1,2].map(ne=>t.jsx("div",{className:`h-1.5 rounded-full transition-all duration-500 ${ne===r?"w-10 bg-purple-500":ne<r?"w-10 bg-purple-500/40":"w-10 bg-zinc-700"}`},ne))}),t.jsx("div",{className:"relative overflow-hidden",children:t.jsxs("div",{className:"transition-all duration-500 ease-out",style:{transform:`translateX(${-r*100}%)`,width:"300%",display:"flex"},children:[t.jsx("div",{className:"w-1/3 flex-shrink-0 px-4",children:t.jsxs("div",{className:`text-center transition-opacity duration-300 ${r===0?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("div",{className:"flex justify-center mb-6",children:t.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-2xl bg-purple-600 text-white shadow-lg shadow-purple-500/30",children:t.jsx(Ka,{className:"h-10 w-10"})})}),t.jsx("h1",{className:"text-4xl font-bold text-white mb-3",children:"Welcome to Nestor"}),t.jsx("p",{className:"text-zinc-400 text-lg mb-2",children:"Your AI agent platform is ready."}),t.jsx("p",{className:"text-zinc-500 mb-12",children:"Let's create your first agent in 30 seconds."}),t.jsxs("button",{onClick:le,className:"inline-flex items-center gap-2 px-8 py-3.5 bg-purple-600 hover:bg-purple-700 text-white rounded-xl font-medium transition-all text-lg shadow-lg shadow-purple-500/25 hover:shadow-purple-500/40 hover:scale-[1.02] active:scale-[0.98]",children:["Get Started",t.jsx(ra,{className:"h-5 w-5"})]})]})}),t.jsx("div",{className:"w-1/3 flex-shrink-0 px-4",children:t.jsxs("div",{className:`transition-opacity duration-300 ${r===1?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("h2",{className:"text-2xl font-bold text-white mb-1 text-center",children:"Choose your AI provider"}),t.jsx("p",{className:"text-zinc-500 mb-6 text-center text-sm",children:"Select which LLM to power your agent"}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 mb-6",children:Ad.map(ne=>{var X;const we=c===ne.id,T=((X=v[ne.id])==null?void 0:X.configured)??!1;return t.jsxs("button",{onClick:()=>Y(ne.id),className:`relative text-left p-4 rounded-xl border-2 transition-all duration-200 hover:scale-[1.02] ${we?"border-purple-500 bg-purple-500/10 shadow-lg shadow-purple-500/10":"border-border bg-surface hover:border-zinc-600 hover:bg-surface-hover"}`,children:[T&&t.jsx("span",{className:"absolute top-2 right-2 text-green-400",title:"API key configured",children:t.jsx(Nt,{className:"h-3.5 w-3.5"})}),t.jsx("div",{className:"text-lg mb-1",children:ne.emoji}),t.jsx("div",{className:"font-semibold text-sm text-zinc-100",children:ne.name}),t.jsx("div",{className:"text-[11px] text-zinc-500",children:ne.provider}),ne.note&&t.jsx("div",{className:"text-[10px] text-green-400/80 mt-1",children:ne.note}),ne.needsApiKey&&t.jsxs("a",{href:ne.keyUrl,target:"_blank",rel:"noopener noreferrer",onClick:re=>re.stopPropagation(),className:"inline-flex items-center gap-1 text-[10px] text-purple-400 hover:text-purple-300 mt-1.5 transition-colors",children:["Get API Key ",t.jsx($n,{className:"h-2.5 w-2.5"})]})]},ne.id)})}),t.jsxs("div",{className:"space-y-3",children:[(ce==null?void 0:ce.needsApiKey)&&t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:["API Key",he&&t.jsxs("span",{className:"ml-2 text-xs text-green-400 font-normal",children:[t.jsx(Nt,{className:"inline h-3 w-3 mr-0.5"}),"Already configured"]})]}),he?t.jsx("p",{className:"text-xs text-zinc-500 mb-2",children:"Your API key is already set. You can skip this field or enter a new key to update it."}):null,t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:p?"text":"password",value:b,onChange:ne=>{g(ne.target.value),O(null)},className:"w-full bg-background border border-border rounded-lg px-3 py-2.5 pr-10 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 transition-colors",placeholder:`Enter your ${ce.provider} API key`}),t.jsx("button",{type:"button",onClick:()=>w(!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300 transition-colors",children:p?t.jsx(Zd,{className:"h-4 w-4"}):t.jsx(Vr,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"flex items-center justify-between mt-1.5",children:t.jsxs("a",{href:ce.keyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 transition-colors",children:["Get your API key ",t.jsx($n,{className:"h-3 w-3"})]})})]}),c==="ollama"&&t.jsxs("div",{className:"bg-surface border border-border rounded-lg p-4",children:[t.jsx("p",{className:"text-sm text-zinc-300 font-medium mb-1",children:"No API key needed"}),t.jsxs("p",{className:"text-xs text-zinc-400",children:["Make sure Ollama is running on ",t.jsx("code",{className:"text-zinc-300",children:"localhost:11434"})]}),t.jsxs("a",{href:"https://ollama.ai/download",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-purple-400 hover:text-purple-300 mt-2 transition-colors",children:["Download Ollama ",t.jsx($n,{className:"h-3 w-3"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Model"}),t.jsx("input",{type:"text",value:f,onChange:ne=>h(ne.target.value),className:"w-full bg-background border border-border rounded-lg px-3 py-2 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 transition-colors",placeholder:"e.g. gemini-2.5-flash"})]}),t.jsx("button",{onClick:G,disabled:N||!b.trim()&&(ce==null?void 0:ce.needsApiKey)&&!he,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg border border-border text-sm font-medium text-zinc-300 transition-all hover:bg-surface-hover hover:text-white disabled:opacity-40 disabled:cursor-not-allowed",children:N?t.jsxs(t.Fragment,{children:[t.jsx(ht,{className:"h-4 w-4 animate-spin"}),"Testing connection..."]}):t.jsxs(t.Fragment,{children:[t.jsx(ei,{className:"h-4 w-4"}),"Test Connection"]})}),C&&t.jsx("div",{className:`rounded-lg border p-3 text-sm transition-all ${C.success?"border-green-500/30 bg-green-500/5 text-green-400":"border-red-500/30 bg-red-500/5 text-red-400"}`,children:t.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[C.success?t.jsx(Nt,{className:"h-4 w-4"}):t.jsx(Il,{className:"h-4 w-4"}),C.message]})})]}),t.jsxs("div",{className:"flex justify-between mt-8",children:[t.jsxs("button",{onClick:J,className:"flex items-center gap-1 px-4 py-2 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",children:[t.jsx(zh,{className:"h-4 w-4"}),"Back"]}),t.jsxs("button",{onClick:le,className:"flex items-center gap-2 px-6 py-2.5 bg-purple-600 hover:bg-purple-700 text-white rounded-xl font-medium transition-all text-sm hover:shadow-lg hover:shadow-purple-500/20",children:["Continue",t.jsx(ra,{className:"h-4 w-4"})]})]})]})}),t.jsx("div",{className:"w-1/3 flex-shrink-0 px-4",children:t.jsxs("div",{className:`transition-opacity duration-300 ${r===2?"opacity-100":"opacity-0 pointer-events-none"}`,children:[t.jsx("h2",{className:"text-2xl font-bold text-white mb-1 text-center",children:"Name your agent"}),t.jsx("p",{className:"text-zinc-500 mb-6 text-center text-sm",children:"Almost there! Give your agent a name."}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Agent name"}),t.jsx("input",{type:"text",value:D,onChange:ne=>E(ne.target.value),className:"w-full bg-background border border-border rounded-lg px-3 py-2.5 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 transition-colors",placeholder:"e.g. my-agent"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1",children:"Description"}),t.jsx("textarea",{value:ae,onChange:ne=>oe(ne.target.value),rows:2,className:"w-full bg-background border border-border rounded-lg px-3 py-2.5 text-sm text-zinc-200 focus:outline-none focus:border-purple-500 placeholder-zinc-600 resize-none transition-colors",placeholder:"What does this agent do?"})]}),t.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4",children:[t.jsx("p",{className:"text-xs text-zinc-500 mb-2 font-medium uppercase tracking-wider",children:"Summary"}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("p",{className:"text-sm text-zinc-300",children:[t.jsx("span",{className:"text-zinc-500",children:"Agent:"})," ",t.jsx("span",{className:"font-medium text-zinc-100",children:D||"—"})]}),t.jsxs("p",{className:"text-sm text-zinc-300",children:[t.jsx("span",{className:"text-zinc-500",children:"Provider:"})," ",t.jsx("span",{className:"text-purple-400",children:ce==null?void 0:ce.name})," ",t.jsxs("span",{className:"text-zinc-500",children:["(",f,")"]})]}),b.trim()&&(ce==null?void 0:ce.needsApiKey)&&t.jsxs("p",{className:"text-sm text-zinc-300",children:[t.jsx("span",{className:"text-zinc-500",children:"API Key:"})," ",t.jsx("span",{className:"text-green-400",children:"Will be saved securely"})]})]})]}),I&&t.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-400",children:[t.jsx(Il,{className:"h-4 w-4 flex-shrink-0"}),I]})]}),t.jsxs("div",{className:"flex justify-between mt-8",children:[t.jsxs("button",{onClick:J,className:"flex items-center gap-1 px-4 py-2 text-sm text-zinc-400 hover:text-zinc-200 transition-colors",children:[t.jsx(zh,{className:"h-4 w-4"}),"Back"]}),t.jsx("button",{onClick:ie,disabled:B||!D.trim(),className:"flex items-center gap-2 px-6 py-2.5 bg-purple-600 hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed text-white rounded-xl font-medium transition-all text-sm shadow-lg shadow-purple-500/20 hover:shadow-purple-500/40 hover:scale-[1.02] active:scale-[0.98]",children:B?t.jsxs(t.Fragment,{children:[t.jsx(ht,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):t.jsxs(t.Fragment,{children:["Create & Start Chatting",t.jsx(ra,{className:"h-4 w-4"})]})})]})]})})]})}),t.jsx("div",{className:"text-center mt-12",children:t.jsx("p",{className:"text-xs text-zinc-600",children:"You can always add more agents and change settings later."})})]})})}function yN({children:n}){const[r,d]=u.useState(!1),c=Et(),m=fa();return u.useEffect(()=>{if(m.pathname==="/onboarding"){d(!0);return}if(localStorage.getItem("nestor_onboarding_complete")==="true"||localStorage.getItem("nestor_onboarded")==="true"){d(!0);return}Cs.list().then(f=>{!f.data||f.data.length===0?c("/onboarding"):localStorage.setItem("nestor_onboarding_complete","true"),d(!0)}).catch(()=>d(!0))},[m.pathname,c]),r?t.jsx(t.Fragment,{children:n}):t.jsx("div",{className:"flex items-center justify-center h-screen bg-background",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-purple-500 border-t-transparent"})})}function Xe(n){return t.jsx(ij,{fallback:t.jsx(rj,{}),children:n})}function vN(){const{user:n,loading:r}=li();return r?t.jsx("div",{className:"flex h-screen items-center justify-center bg-background text-zinc-400",children:"Loading..."}):n?t.jsx(yN,{children:t.jsxs(r0,{children:[t.jsx(Oe,{path:"/onboarding",element:t.jsx(bN,{})}),t.jsxs(Oe,{element:t.jsx(lj,{}),children:[t.jsx(Oe,{path:"/",element:t.jsx(Sh,{to:"/missions",replace:!0})}),t.jsx(Oe,{path:"/missions",element:Xe(t.jsx(mN,{}))}),t.jsx(Oe,{path:"/chat",element:Xe(t.jsx(lN,{}))}),t.jsx(Oe,{path:"/dashboard",element:Xe(t.jsx(uj,{}))}),t.jsx(Oe,{path:"/agents",element:Xe(t.jsx(gj,{}))}),t.jsx(Oe,{path:"/agents/:id",element:Xe(t.jsx(wj,{}))}),t.jsx(Oe,{path:"/agents/:id/prompts",element:Xe(t.jsx(m1,{}))}),t.jsx(Oe,{path:"/agents/:id/memory-store",element:Xe(t.jsx(H1,{}))}),t.jsx(Oe,{path:"/workflows",element:Xe(t.jsx(zj,{}))}),t.jsx(Oe,{path:"/workflows/:id/edit",element:Xe(t.jsx(Aj,{}))}),t.jsx(Oe,{path:"/skills",element:Xe(t.jsx(Rj,{}))}),t.jsx(Oe,{path:"/runs",element:Xe(t.jsx(Mj,{}))}),t.jsx(Oe,{path:"/runs/:id",element:Xe(t.jsx(Gj,{}))}),t.jsx(Oe,{path:"/goals",element:Xe(t.jsx(z1,{}))}),t.jsx(Oe,{path:"/approvals",element:Xe(t.jsx(Qj,{}))}),t.jsx(Oe,{path:"/handoffs",element:Xe(t.jsx(C1,{}))}),t.jsx(Oe,{path:"/analytics",element:Xe(t.jsx(l1,{}))}),t.jsx(Oe,{path:"/budget",element:Xe(t.jsx(j1,{}))}),t.jsx(Oe,{path:"/traces",element:Xe(t.jsx(d1,{}))}),t.jsx(Oe,{path:"/memory",element:Xe(t.jsx(p1,{}))}),t.jsx(Oe,{path:"/users",element:Xe(t.jsx(u1,{}))}),t.jsx(Oe,{path:"/plans",element:Xe(t.jsx(M1,{}))}),t.jsx(Oe,{path:"/plans/:id",element:Xe(t.jsx(D1,{}))}),t.jsx(Oe,{path:"/guardrails",element:Xe(t.jsx($1,{}))}),t.jsx(Oe,{path:"/admin",element:Xe(t.jsx(I1,{}))}),t.jsx(Oe,{path:"/settings",element:Xe(t.jsx(Kj,{}))}),t.jsx(Oe,{path:"/keys",element:Xe(t.jsx(gN,{}))}),t.jsx(Oe,{path:"*",element:t.jsx(Sh,{to:"/missions",replace:!0})})]})]})}):t.jsx(R0,{})}function jN(){return t.jsx(Lv,{children:t.jsx($v,{children:t.jsxs(r0,{children:[t.jsx(Oe,{path:"/login",element:t.jsx(R0,{})}),t.jsx(Oe,{path:"/*",element:t.jsx(vN,{})})]})})})}const q0=document.getElementById("root");if(!q0)throw new Error("Root element not found");bb.createRoot(q0).render(t.jsx(u.StrictMode,{children:t.jsx(Gy,{children:t.jsx(jN,{})})}));
596
+ //# sourceMappingURL=index-BFlEVRQQ.js.map