From 093e77c8c0d8fcbd25d264a81ce289af3c6d16c4 Mon Sep 17 00:00:00 2001 From: Finessse Date: Mon, 5 Jan 2026 12:59:29 +0700 Subject: [PATCH] feat: add priority/usage APIs, WebUI dashboard, config options - PATCH /v0/management/auth/:id/priority endpoint - GET /v0/management/auth/:id/usage endpoint - AccountUsage.tsx dashboard component - AutoRefreshBuffer, DailyResetHour config fields - Conductor wiring for refresh config --- cmd/proxypilotui/assets/assets/index.js | 66 ++-- config.example.yaml | 5 + .../api/handlers/management/auth_priority.go | 50 +++ .../api/handlers/management/auth_usage.go | 34 ++ internal/api/server.go | 2 + internal/config/sdk_config.go | 42 ++ sdk/cliproxy/auth/conductor.go | 75 +++- sdk/config/config.go | 122 +++--- webui/src/App.tsx | 6 +- .../src/components/dashboard/AccountUsage.tsx | 367 ++++++++++++++++++ webui/src/components/dashboard/index.ts | 1 + 11 files changed, 671 insertions(+), 99 deletions(-) create mode 100644 internal/api/handlers/management/auth_priority.go create mode 100644 internal/api/handlers/management/auth_usage.go create mode 100644 webui/src/components/dashboard/AccountUsage.tsx diff --git a/cmd/proxypilotui/assets/assets/index.js b/cmd/proxypilotui/assets/assets/index.js index 611fcd1f..622bce25 100644 --- a/cmd/proxypilotui/assets/assets/index.js +++ b/cmd/proxypilotui/assets/assets/index.js @@ -1,36 +1,36 @@ -function xv(l,o){for(var c=0;cu[f]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const m of f)if(m.type==="childList")for(const g of m.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&u(g)}).observe(document,{childList:!0,subtree:!0});function c(f){const m={};return f.integrity&&(m.integrity=f.integrity),f.referrerPolicy&&(m.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?m.credentials="include":f.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(f){if(f.ep)return;f.ep=!0;const m=c(f);fetch(f.href,m)}})();function Lp(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var cu={exports:{}},tr={};var Zh;function vv(){if(Zh)return tr;Zh=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,f,m){var g=null;if(m!==void 0&&(g=""+m),f.key!==void 0&&(g=""+f.key),"key"in f){m={};for(var v in f)v!=="key"&&(m[v]=f[v])}else m=f;return f=m.ref,{$$typeof:l,type:u,key:g,ref:f!==void 0?f:null,props:m}}return tr.Fragment=o,tr.jsx=c,tr.jsxs=c,tr}var Kh;function yv(){return Kh||(Kh=1,cu.exports=vv()),cu.exports}var s=yv(),uu={exports:{}},_e={};var Jh;function bv(){if(Jh)return _e;Jh=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),g=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),N=Symbol.iterator;function E(S){return S===null||typeof S!="object"?null:(S=N&&S[N]||S["@@iterator"],typeof S=="function"?S:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,G={};function T(S,Q,$){this.props=S,this.context=Q,this.refs=G,this.updater=$||A}T.prototype.isReactComponent={},T.prototype.setState=function(S,Q){if(typeof S!="object"&&typeof S!="function"&&S!=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,S,Q,"setState")},T.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function K(){}K.prototype=T.prototype;function q(S,Q,$){this.props=S,this.context=Q,this.refs=G,this.updater=$||A}var F=q.prototype=new K;F.constructor=q,U(F,T.prototype),F.isPureReactComponent=!0;var ae=Array.isArray;function te(){}var _={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function Y(S,Q,$){var ee=$.ref;return{$$typeof:l,type:S,key:Q,ref:ee!==void 0?ee:null,props:$}}function z(S,Q){return Y(S.type,Q,S.props)}function se(S){return typeof S=="object"&&S!==null&&S.$$typeof===l}function ie(S){var Q={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function($){return Q[$]})}var O=/\/+/g;function ne(S,Q){return typeof S=="object"&&S!==null&&S.key!=null?ie(""+S.key):Q.toString(36)}function oe(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(te,te):(S.status="pending",S.then(function(Q){S.status==="pending"&&(S.status="fulfilled",S.value=Q)},function(Q){S.status==="pending"&&(S.status="rejected",S.reason=Q)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function k(S,Q,$,ee,re){var xe=typeof S;(xe==="undefined"||xe==="boolean")&&(S=null);var ue=!1;if(S===null)ue=!0;else switch(xe){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(S.$$typeof){case l:case o:ue=!0;break;case b:return ue=S._init,k(ue(S._payload),Q,$,ee,re)}}if(ue)return re=re(S),ue=ee===""?"."+ne(S,0):ee,ae(re)?($="",ue!=null&&($=ue.replace(O,"$&/")+"/"),k(re,Q,$,"",function(We){return We})):re!=null&&(se(re)&&(re=z(re,$+(re.key==null||S&&S.key===re.key?"":(""+re.key).replace(O,"$&/")+"/")+ue)),Q.push(re)),1;ue=0;var we=ee===""?".":ee+":";if(ae(S))for(var Te=0;Te>>1,ge=k[ce];if(0>>1;cef($,B))eef(re,$)?(k[ce]=re,k[ee]=B,ce=ee):(k[ce]=$,k[Q]=B,ce=Q);else if(eef(re,B))k[ce]=re,k[ee]=B,ce=ee;else break e}}return V}function f(k,V){var B=k.sortIndex-V.sortIndex;return B!==0?B:k.id-V.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;l.unstable_now=function(){return m.now()}}else{var g=Date,v=g.now();l.unstable_now=function(){return g.now()-v}}var x=[],p=[],b=1,h=null,N=3,E=!1,A=!1,U=!1,G=!1,T=typeof setTimeout=="function"?setTimeout:null,K=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function F(k){for(var V=c(p);V!==null;){if(V.callback===null)u(p);else if(V.startTime<=k)u(p),V.sortIndex=V.expirationTime,o(x,V);else break;V=c(p)}}function ae(k){if(U=!1,F(k),!A)if(c(x)!==null)A=!0,te||(te=!0,ie());else{var V=c(p);V!==null&&oe(ae,V.startTime-k)}}var te=!1,_=-1,L=5,Y=-1;function z(){return G?!0:!(l.unstable_now()-Yk&&z());){var ce=h.callback;if(typeof ce=="function"){h.callback=null,N=h.priorityLevel;var ge=ce(h.expirationTime<=k);if(k=l.unstable_now(),typeof ge=="function"){h.callback=ge,F(k),V=!0;break t}h===c(x)&&u(x),F(k)}else u(x);h=c(x)}if(h!==null)V=!0;else{var S=c(p);S!==null&&oe(ae,S.startTime-k),V=!1}}break e}finally{h=null,N=B,E=!1}V=void 0}}finally{V?ie():te=!1}}}var ie;if(typeof q=="function")ie=function(){q(se)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,ne=O.port2;O.port1.onmessage=se,ie=function(){ne.postMessage(null)}}else ie=function(){T(se,0)};function oe(k,V){_=T(function(){k(l.unstable_now())},V)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(k){k.callback=null},l.unstable_forceFrameRate=function(k){0>k||125ce?(k.sortIndex=B,o(p,k),c(x)===null&&k===c(p)&&(U?(K(_),_=-1):U=!0,oe(ae,B-ce))):(k.sortIndex=ge,o(x,k),A||E||(A=!0,te||(te=!0,ie()))),k},l.unstable_shouldYield=z,l.unstable_wrapCallback=function(k){var V=N;return function(){var B=N;N=V;try{return k.apply(this,arguments)}finally{N=B}}}})(mu)),mu}var Ph;function Nv(){return Ph||(Ph=1,fu.exports=wv()),fu.exports}var hu={exports:{}},Nt={};var Ih;function jv(){if(Ih)return Nt;Ih=1;var l=Lu();function o(x){var p="https://react.dev/errors/"+x;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),hu.exports=jv(),hu.exports}var tp;function Sv(){if(tp)return ar;tp=1;var l=Nv(),o=Lu(),c=Up();function u(e){var t="https://react.dev/errors/"+e;if(1ge||(e.current=ce[ge],ce[ge]=null,ge--)}function $(e,t){ge++,ce[ge]=e.current,e.current=t}var ee=S(null),re=S(null),xe=S(null),ue=S(null);function we(e,t){switch($(xe,t),$(re,e),$(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?gh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=gh(t),e=xh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(ee),$(ee,e)}function Te(){Q(ee),Q(re),Q(xe)}function We(e){e.memoizedState!==null&&$(ue,e);var t=ee.current,a=xh(t,e.type);t!==a&&($(re,e),$(ee,a))}function it(e){re.current===e&&(Q(ee),Q(re)),ue.current===e&&(Q(ue),Wl._currentValue=B)}var qe,P;function Ye(e){if(qe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);qe=t&&t[1]||"",P=-1u[d]})}}}return Object.freeze(Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const g of m.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&u(g)}).observe(document,{childList:!0,subtree:!0});function c(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function u(d){if(d.ep)return;d.ep=!0;const m=c(d);fetch(d.href,m)}})();function Hp(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var du={exports:{}},ar={};var Jh;function wv(){if(Jh)return ar;Jh=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,d,m){var g=null;if(m!==void 0&&(g=""+m),d.key!==void 0&&(g=""+d.key),"key"in d){m={};for(var v in d)v!=="key"&&(m[v]=d[v])}else m=d;return d=m.ref,{$$typeof:l,type:u,key:g,ref:d!==void 0?d:null,props:m}}return ar.Fragment=o,ar.jsx=c,ar.jsxs=c,ar}var Fh;function Nv(){return Fh||(Fh=1,du.exports=wv()),du.exports}var s=Nv(),fu={exports:{}},_e={};var Wh;function jv(){if(Wh)return _e;Wh=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),g=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),N=Symbol.iterator;function _(S){return S===null||typeof S!="object"?null:(S=N&&S[N]||S["@@iterator"],typeof S=="function"?S:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,G={};function k(S,Q,$){this.props=S,this.context=Q,this.refs=G,this.updater=$||A}k.prototype.isReactComponent={},k.prototype.setState=function(S,Q){if(typeof S!="object"&&typeof S!="function"&&S!=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,S,Q,"setState")},k.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function K(){}K.prototype=k.prototype;function q(S,Q,$){this.props=S,this.context=Q,this.refs=G,this.updater=$||A}var F=q.prototype=new K;F.constructor=q,U(F,k.prototype),F.isPureReactComponent=!0;var ae=Array.isArray;function te(){}var E={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function Y(S,Q,$){var ee=$.ref;return{$$typeof:l,type:S,key:Q,ref:ee!==void 0?ee:null,props:$}}function z(S,Q){return Y(S.type,Q,S.props)}function se(S){return typeof S=="object"&&S!==null&&S.$$typeof===l}function ie(S){var Q={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function($){return Q[$]})}var O=/\/+/g;function ne(S,Q){return typeof S=="object"&&S!==null&&S.key!=null?ie(""+S.key):Q.toString(36)}function oe(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(te,te):(S.status="pending",S.then(function(Q){S.status==="pending"&&(S.status="fulfilled",S.value=Q)},function(Q){S.status==="pending"&&(S.status="rejected",S.reason=Q)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function T(S,Q,$,ee,re){var xe=typeof S;(xe==="undefined"||xe==="boolean")&&(S=null);var ue=!1;if(S===null)ue=!0;else switch(xe){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(S.$$typeof){case l:case o:ue=!0;break;case b:return ue=S._init,T(ue(S._payload),Q,$,ee,re)}}if(ue)return re=re(S),ue=ee===""?"."+ne(S,0):ee,ae(re)?($="",ue!=null&&($=ue.replace(O,"$&/")+"/"),T(re,Q,$,"",function(We){return We})):re!=null&&(se(re)&&(re=z(re,$+(re.key==null||S&&S.key===re.key?"":(""+re.key).replace(O,"$&/")+"/")+ue)),Q.push(re)),1;ue=0;var we=ee===""?".":ee+":";if(ae(S))for(var ke=0;ke>>1,ge=T[ce];if(0>>1;ced($,B))eed(re,$)?(T[ce]=re,T[ee]=B,ce=ee):(T[ce]=$,T[Q]=B,ce=Q);else if(eed(re,B))T[ce]=re,T[ee]=B,ce=ee;else break e}}return V}function d(T,V){var B=T.sortIndex-V.sortIndex;return B!==0?B:T.id-V.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;l.unstable_now=function(){return m.now()}}else{var g=Date,v=g.now();l.unstable_now=function(){return g.now()-v}}var x=[],p=[],b=1,h=null,N=3,_=!1,A=!1,U=!1,G=!1,k=typeof setTimeout=="function"?setTimeout:null,K=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function F(T){for(var V=c(p);V!==null;){if(V.callback===null)u(p);else if(V.startTime<=T)u(p),V.sortIndex=V.expirationTime,o(x,V);else break;V=c(p)}}function ae(T){if(U=!1,F(T),!A)if(c(x)!==null)A=!0,te||(te=!0,ie());else{var V=c(p);V!==null&&oe(ae,V.startTime-T)}}var te=!1,E=-1,L=5,Y=-1;function z(){return G?!0:!(l.unstable_now()-YT&&z());){var ce=h.callback;if(typeof ce=="function"){h.callback=null,N=h.priorityLevel;var ge=ce(h.expirationTime<=T);if(T=l.unstable_now(),typeof ge=="function"){h.callback=ge,F(T),V=!0;break t}h===c(x)&&u(x),F(T)}else u(x);h=c(x)}if(h!==null)V=!0;else{var S=c(p);S!==null&&oe(ae,S.startTime-T),V=!1}}break e}finally{h=null,N=B,_=!1}V=void 0}}finally{V?ie():te=!1}}}var ie;if(typeof q=="function")ie=function(){q(se)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,ne=O.port2;O.port1.onmessage=se,ie=function(){ne.postMessage(null)}}else ie=function(){k(se,0)};function oe(T,V){E=k(function(){T(l.unstable_now())},V)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(T){T.callback=null},l.unstable_forceFrameRate=function(T){0>T||125ce?(T.sortIndex=B,o(p,T),c(x)===null&&T===c(p)&&(U?(K(E),E=-1):U=!0,oe(ae,B-ce))):(T.sortIndex=ge,o(x,T),A||_||(A=!0,te||(te=!0,ie()))),T},l.unstable_shouldYield=z,l.unstable_wrapCallback=function(T){var V=N;return function(){var B=N;N=V;try{return T.apply(this,arguments)}finally{N=B}}}})(pu)),pu}var ep;function _v(){return ep||(ep=1,hu.exports=Sv()),hu.exports}var gu={exports:{}},_t={};var tp;function Ev(){if(tp)return _t;tp=1;var l=Hu();function o(x){var p="https://react.dev/errors/"+x;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),gu.exports=Ev(),gu.exports}var np;function Cv(){if(np)return nr;np=1;var l=_v(),o=Hu(),c=Bp();function u(e){var t="https://react.dev/errors/"+e;if(1ge||(e.current=ce[ge],ce[ge]=null,ge--)}function $(e,t){ge++,ce[ge]=e.current,e.current=t}var ee=S(null),re=S(null),xe=S(null),ue=S(null);function we(e,t){switch($(xe,t),$(re,e),$(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?vh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=vh(t),e=yh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Q(ee),$(ee,e)}function ke(){Q(ee),Q(re),Q(xe)}function We(e){e.memoizedState!==null&&$(ue,e);var t=ee.current,a=yh(t,e.type);t!==a&&($(re,e),$(ee,a))}function it(e){re.current===e&&(Q(ee),Q(re)),ue.current===e&&(Q(ue),Pl._currentValue=B)}var qe,P;function Ye(e){if(qe===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);qe=t&&t[1]||"",P=-1)":-1r||j[n]!==D[r]){var J=` -`+j[n].replace(" at new "," at ");return e.displayName&&J.includes("")&&(J=J.replace("",e.displayName)),J}while(1<=n&&0<=r);break}}}finally{Z=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ye(a):""}function at(e,t){switch(e.tag){case 26:case 27:case 5:return Ye(e.type);case 16:return Ye("Lazy");case 13:return e.child!==t&&t!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return Ye("Activity");default:return""}}function _t(e){try{var t="",a=null;do t+=at(e,a),a=e,e=e.return;while(e);return t}catch(n){return` +`+j[n].replace(" at new "," at ");return e.displayName&&J.includes("")&&(J=J.replace("",e.displayName)),J}while(1<=n&&0<=r);break}}}finally{Z=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ye(a):""}function at(e,t){switch(e.tag){case 26:case 27:case 5:return Ye(e.type);case 16:return Ye("Lazy");case 13:return e.child!==t&&t!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return Ye("Activity");default:return""}}function Ct(e){try{var t="",a=null;do t+=at(e,a),a=e,e=e.return;while(e);return t}catch(n){return` Error generating stack: `+n.message+` -`+n.stack}}var Xt=Object.prototype.hasOwnProperty,il=l.unstable_scheduleCallback,cl=l.unstable_cancelCallback,Et=l.unstable_shouldYield,ln=l.unstable_requestPaint,Ct=l.unstable_now,Wo=l.unstable_getCurrentPriorityLevel,Un=l.unstable_ImmediatePriority,cr=l.unstable_UserBlockingPriority,Hn=l.unstable_NormalPriority,ul=l.unstable_LowPriority,La=l.unstable_IdlePriority,ur=l.log,rn=l.unstable_setDisableYieldValue,Bn=null,Tt=null;function fa(e){if(typeof ur=="function"&&rn(e),Tt&&typeof Tt.setStrictMode=="function")try{Tt.setStrictMode(Bn,e)}catch{}}var bt=Math.clz32?Math.clz32:ja,Po=Math.log,dl=Math.LN2;function ja(e){return e>>>=0,e===0?32:31-(Po(e)/dl|0)|0}var cs=256,us=262144,qn=4194304;function Sa(e){var t=e&42;if(t!==0)return t;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 Se(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,d=e.pingedLanes;e=e.warmLanes;var y=n&134217727;return y!==0?(n=y&~i,n!==0?r=Sa(n):(d&=y,d!==0?r=Sa(d):a||(a=y&~e,a!==0&&(r=Sa(a))))):(y=n&~i,y!==0?r=Sa(y):d!==0?r=Sa(d):a||(a=n&~e,a!==0&&(r=Sa(a)))),r===0?0:t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===32&&(a&4194048)!==0)?t:r}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function dt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 wt(){var e=qn;return qn<<=1,(qn&62914560)===0&&(qn=4194304),e}function on(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Fe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ot(e,t,a,n,r,i){var d=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var y=e.entanglements,j=e.expirationTimes,D=e.hiddenUpdates;for(a=d&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var dg=/[\n"\\]/g;function ta(e){return e.replace(dg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ni(e,t,a,n,r,i,d,y){e.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?e.type=d:e.removeAttribute("type"),t!=null?d==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ea(t)):e.value!==""+ea(t)&&(e.value=""+ea(t)):d!=="submit"&&d!=="reset"||e.removeAttribute("value"),t!=null?si(e,d,ea(t)):a!=null?si(e,d,ea(a)):n!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+ea(y):e.removeAttribute("name")}function cd(e,t,a,n,r,i,d,y){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||a!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){ai(e);return}a=a!=null?""+ea(a):"",t=t!=null?""+ea(t):a,y||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=y?e.checked:!!n,e.defaultChecked=!!n,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.name=d),ai(e)}function si(e,t,a){t==="number"&&mr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function xs(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ci=!1;if(Ba)try{var pl={};Object.defineProperty(pl,"passive",{get:function(){ci=!0}}),window.addEventListener("test",pl,pl),window.removeEventListener("test",pl,pl)}catch{ci=!1}var un=null,ui=null,pr=null;function gd(){if(pr)return pr;var e,t=ui,a=t.length,n,r="value"in un?un.value:un.textContent,i=r.length;for(e=0;e=vl),Nd=" ",jd=!1;function Sd(e,t){switch(e){case"keyup":return Bg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _d(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ws=!1;function Yg(e,t){switch(e){case"compositionend":return _d(t);case"keypress":return t.which!==32?null:(jd=!0,Nd);case"textInput":return e=t.data,e===Nd&&jd?null:e;default:return null}}function Gg(e,t){if(ws)return e==="compositionend"||!pi&&Sd(e,t)?(e=gd(),pr=ui=un=null,ws=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=zd(a)}}function Dd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ld(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=mr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=mr(e.document)}return t}function vi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Fg=Ba&&"documentMode"in document&&11>=document.documentMode,Ns=null,yi=null,Nl=null,bi=!1;function Ud(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;bi||Ns==null||Ns!==mr(n)||(n=Ns,"selectionStart"in n&&vi(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Nl&&wl(Nl,n)||(Nl=n,n=io(yi,"onSelect"),0>=d,r-=d,_a=1<<32-bt(t)+r|a<Ce?(ze=pe,pe=null):ze=pe.sibling;var Le=H(M,pe,R[Ce],W);if(Le===null){pe===null&&(pe=ze);break}e&&pe&&Le.alternate===null&&t(M,pe),C=i(Le,C,Ce),De===null?ye=Le:De.sibling=Le,De=Le,pe=ze}if(Ce===R.length)return a(M,pe),Re&&Ya(M,Ce),ye;if(pe===null){for(;CeCe?(ze=pe,pe=null):ze=pe.sibling;var On=H(M,pe,Le.value,W);if(On===null){pe===null&&(pe=ze);break}e&&pe&&On.alternate===null&&t(M,pe),C=i(On,C,Ce),De===null?ye=On:De.sibling=On,De=On,pe=ze}if(Le.done)return a(M,pe),Re&&Ya(M,Ce),ye;if(pe===null){for(;!Le.done;Ce++,Le=R.next())Le=I(M,Le.value,W),Le!==null&&(C=i(Le,C,Ce),De===null?ye=Le:De.sibling=Le,De=Le);return Re&&Ya(M,Ce),ye}for(pe=n(pe);!Le.done;Ce++,Le=R.next())Le=X(pe,M,Ce,Le.value,W),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ce:Le.key),C=i(Le,C,Ce),De===null?ye=Le:De.sibling=Le,De=Le);return e&&pe.forEach(function(gv){return t(M,gv)}),Re&&Ya(M,Ce),ye}function Xe(M,C,R,W){if(typeof R=="object"&&R!==null&&R.type===U&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case E:e:{for(var ye=R.key;C!==null;){if(C.key===ye){if(ye=R.type,ye===U){if(C.tag===7){a(M,C.sibling),W=r(C,R.props.children),W.return=M,M=W;break e}}else if(C.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===L&&Pn(ye)===C.type){a(M,C.sibling),W=r(C,R.props),Tl(W,R),W.return=M,M=W;break e}a(M,C);break}else t(M,C);C=C.sibling}R.type===U?(W=Zn(R.props.children,M.mode,W,R.key),W.return=M,M=W):(W=_r(R.type,R.key,R.props,null,M.mode,W),Tl(W,R),W.return=M,M=W)}return d(M);case A:e:{for(ye=R.key;C!==null;){if(C.key===ye)if(C.tag===4&&C.stateNode.containerInfo===R.containerInfo&&C.stateNode.implementation===R.implementation){a(M,C.sibling),W=r(C,R.children||[]),W.return=M,M=W;break e}else{a(M,C);break}else t(M,C);C=C.sibling}W=Ci(R,M.mode,W),W.return=M,M=W}return d(M);case L:return R=Pn(R),Xe(M,C,R,W)}if(oe(R))return de(M,C,R,W);if(ie(R)){if(ye=ie(R),typeof ye!="function")throw Error(u(150));return R=ye.call(R),be(M,C,R,W)}if(typeof R.then=="function")return Xe(M,C,Or(R),W);if(R.$$typeof===q)return Xe(M,C,Tr(M,R),W);zr(M,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,C!==null&&C.tag===6?(a(M,C.sibling),W=r(C,R),W.return=M,M=W):(a(M,C),W=Ei(R,M.mode,W),W.return=M,M=W),d(M)):a(M,C)}return function(M,C,R,W){try{Cl=0;var ye=Xe(M,C,R,W);return zs=null,ye}catch(pe){if(pe===Os||pe===Ar)throw pe;var De=Qt(29,pe,null,M.mode);return De.lanes=W,De.return=M,De}}}var es=rf(!0),of=rf(!1),pn=!1;function Bi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function gn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xn(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ue&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Sr(e),Xd(e,null,a),t}return jr(e,n,t,a),Sr(e)}function kl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,zt(e,a)}}function Yi(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var r=null,i=null;if(a=a.firstBaseUpdate,a!==null){do{var d={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};i===null?r=i=d:i=i.next=d,a=a.next}while(a!==null);i===null?r=i=t:i=i.next=t}else r=i=t;a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Gi=!1;function Al(){if(Gi){var e=Ms;if(e!==null)throw e}}function Ml(e,t,a,n){Gi=!1;var r=e.updateQueue;pn=!1;var i=r.firstBaseUpdate,d=r.lastBaseUpdate,y=r.shared.pending;if(y!==null){r.shared.pending=null;var j=y,D=j.next;j.next=null,d===null?i=D:d.next=D,d=j;var J=e.alternate;J!==null&&(J=J.updateQueue,y=J.lastBaseUpdate,y!==d&&(y===null?J.firstBaseUpdate=D:y.next=D,J.lastBaseUpdate=j))}if(i!==null){var I=r.baseState;d=0,J=D=j=null,y=i;do{var H=y.lane&-536870913,X=H!==y.lane;if(X?(Oe&H)===H:(n&H)===H){H!==0&&H===As&&(Gi=!0),J!==null&&(J=J.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var de=e,be=y;H=t;var Xe=a;switch(be.tag){case 1:if(de=be.payload,typeof de=="function"){I=de.call(Xe,I,H);break e}I=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=be.payload,H=typeof de=="function"?de.call(Xe,I,H):de,H==null)break e;I=h({},I,H);break e;case 2:pn=!0}}H=y.callback,H!==null&&(e.flags|=64,X&&(e.flags|=8192),X=r.callbacks,X===null?r.callbacks=[H]:X.push(H))}else X={lane:H,tag:y.tag,payload:y.payload,callback:y.callback,next:null},J===null?(D=J=X,j=I):J=J.next=X,d|=H;if(y=y.next,y===null){if(y=r.shared.pending,y===null)break;X=y,y=X.next,X.next=null,r.lastBaseUpdate=X,r.shared.pending=null}}while(!0);J===null&&(j=I),r.baseState=j,r.firstBaseUpdate=D,r.lastBaseUpdate=J,i===null&&(r.shared.lanes=0),Nn|=d,e.lanes=d,e.memoizedState=I}}function cf(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function uf(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ei?i:8;var d=k.T,y={};k.T=y,oc(e,!1,t,a);try{var j=r(),D=k.S;if(D!==null&&D(y,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var J=lx(j,n);Rl(e,t,J,Wt(e))}else Rl(e,t,n,Wt(e))}catch(I){Rl(e,t,{then:function(){},status:"rejected",reason:I},Wt())}finally{V.p=i,d!==null&&y.types!==null&&(d.types=y.types),k.T=d}}function dx(){}function lc(e,t,a,n){if(e.tag!==5)throw Error(u(476));var r=Gf(e).queue;Yf(e,r,t,B,a===null?dx:function(){return Vf(e),a(n)})}function Gf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$a,lastRenderedState:B},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$a,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Vf(e){var t=Gf(e);t.next===null&&(t=e.alternate.memoizedState),Rl(e,t.next.queue,{},Wt())}function rc(){return gt(Wl)}function Xf(){return tt().memoizedState}function $f(){return tt().memoizedState}function fx(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Wt();e=gn(a);var n=xn(t,e,a);n!==null&&(Yt(n,t,a),kl(n,t,a)),t={cache:Di()},e.payload=t;return}t=t.return}}function mx(e,t,a){var n=Wt();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Vr(e)?Zf(t,a):(a=Si(e,t,a,n),a!==null&&(Yt(a,e,n),Kf(a,t,n)))}function Qf(e,t,a){var n=Wt();Rl(e,t,a,n)}function Rl(e,t,a,n){var r={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Vr(e))Zf(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,y=i(d,a);if(r.hasEagerState=!0,r.eagerState=y,$t(y,d))return jr(e,t,r,0),$e===null&&Nr(),!1}catch{}if(a=Si(e,t,r,n),a!==null)return Yt(a,e,n),Kf(a,t,n),!0}return!1}function oc(e,t,a,n){if(n={lane:2,revertLane:Bc(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Vr(e)){if(t)throw Error(u(479))}else t=Si(e,a,n,2),t!==null&&Yt(t,e,2)}function Vr(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function Zf(e,t){Ds=Lr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Kf(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,zt(e,a)}}var Dl={readContext:gt,use:Br,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};Dl.useEffectEvent=Pe;var Jf={readContext:gt,use:Br,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:Of,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Yr(4194308,4,Lf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Yr(4194308,4,e,t)},useInsertionEffect:function(e,t){Yr(4,2,e,t)},useMemo:function(e,t){var a=kt();t=t===void 0?null:t;var n=e();if(ts){fa(!0);try{e()}finally{fa(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=kt();if(a!==void 0){var r=a(t);if(ts){fa(!0);try{a(t)}finally{fa(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=mx.bind(null,Ee,e),[n.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:function(e){e=ec(e);var t=e.queue,a=Qf.bind(null,Ee,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:nc,useDeferredValue:function(e,t){var a=kt();return sc(a,e,t)},useTransition:function(){var e=ec(!1);return e=Yf.bind(null,Ee,e.queue,!0,!1),kt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Ee,r=kt();if(Re){if(a===void 0)throw Error(u(407));a=a()}else{if(a=t(),$e===null)throw Error(u(349));(Oe&127)!==0||gf(n,t,a)}r.memoizedState=a;var i={value:a,getSnapshot:t};return r.queue=i,Of(vf.bind(null,n,i,e),[e]),n.flags|=2048,Us(9,{destroy:void 0},xf.bind(null,n,i,a,t),null),a},useId:function(){var e=kt(),t=$e.identifierPrefix;if(Re){var a=Ea,n=_a;a=(n&~(1<<32-bt(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Ur++,0<\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof n.is=="string"?d.createElement("select",{is:n.is}):d.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i=typeof n.is=="string"?d.createElement(r,{is:n.is}):d.createElement(r)}}i[ht]=t,i[Dt]=n;e:for(d=t.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}t.stateNode=i;e:switch(vt(i,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Za(t)}}return Ze(t),wc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Za(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=xe.current,Ts(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,r=pt,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[ht]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||hh(e.nodeValue,a)),e||mn(t,!0)}else e=co(e).createTextNode(n),e[ht]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Ts(t),a!==null){if(e===null){if(!n)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[ht]=t}else Kn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=Mi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Kt(t),t):(Kt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Ze(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Ts(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[ht]=t}else Kn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),r=!1}else r=Mi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Kt(t),t):(Kt(t),null)}return Kt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Kr(t,t.updateQueue),Ze(t),null);case 4:return Te(),e===null&&Vc(t.stateNode.containerInfo),Ze(t),null;case 10:return Va(t.type),Ze(t),null;case 19:if(Q(et),n=t.memoizedState,n===null)return Ze(t),null;if(r=(t.flags&128)!==0,i=n.rendering,i===null)if(r)Ul(n,!1);else{if(Ie!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Dr(e),i!==null){for(t.flags|=128,Ul(n,!1),e=i.updateQueue,t.updateQueue=e,Kr(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)$d(a,e),a=a.sibling;return $(et,et.current&1|2),Re&&Ya(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&Ct()>Ir&&(t.flags|=128,r=!0,Ul(n,!1),t.lanes=4194304)}else{if(!r)if(e=Dr(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Kr(t,e),Ul(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!Re)return Ze(t),null}else 2*Ct()-n.renderingStartTime>Ir&&a!==536870912&&(t.flags|=128,r=!0,Ul(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(e=n.last,e!==null?e.sibling=i:t.child=i,n.last=i)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Ct(),e.sibling=null,a=et.current,$(et,r?a&1|2:a&1),Re&&Ya(t,n.treeForkCount),e):(Ze(t),null);case 22:case 23:return Kt(t),Xi(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),a=t.updateQueue,a!==null&&Kr(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&Q(Wn),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Va(nt),Ze(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function vx(e,t){switch(ki(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Va(nt),Te(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return it(t),null;case 31:if(t.memoizedState!==null){if(Kt(t),t.alternate===null)throw Error(u(340));Kn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Kt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));Kn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Q(et),null;case 4:return Te(),null;case 10:return Va(t.type),null;case 22:case 23:return Kt(t),Xi(),e!==null&&Q(Wn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Va(nt),null;case 25:return null;default:return null}}function ym(e,t){switch(ki(t),t.tag){case 3:Va(nt),Te();break;case 26:case 27:case 5:it(t);break;case 4:Te();break;case 31:t.memoizedState!==null&&Kt(t);break;case 13:Kt(t);break;case 19:Q(et);break;case 10:Va(t.type);break;case 22:case 23:Kt(t),Xi(),e!==null&&Q(Wn);break;case 24:Va(nt)}}function Hl(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var r=n.next;a=r;do{if((a.tag&e)===e){n=void 0;var i=a.create,d=a.inst;n=i(),d.destroy=n}a=a.next}while(a!==r)}}catch(y){Be(t,t.return,y)}}function bn(e,t,a){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){var d=n.inst,y=d.destroy;if(y!==void 0){d.destroy=void 0,r=t;var j=a,D=y;try{D()}catch(J){Be(r,j,J)}}}n=n.next}while(n!==i)}}catch(J){Be(t,t.return,J)}}function bm(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{uf(t,a)}catch(n){Be(e,e.return,n)}}}function wm(e,t,a){a.props=as(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){Be(e,t,n)}}function Bl(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(r){Be(e,t,r)}}function Ca(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(r){Be(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(r){Be(e,t,r)}else a.current=null}function Nm(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(r){Be(e,e.return,r)}}function Nc(e,t,a){try{var n=e.stateNode;qx(n,e.type,a,t),n[Dt]=t}catch(r){Be(e,e.return,r)}}function jm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Cn(e.type)||e.tag===4}function jc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||jm(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&&Cn(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 Sc(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ha));else if(n!==4&&(n===27&&Cn(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Sc(e,t,a),e=e.sibling;e!==null;)Sc(e,t,a),e=e.sibling}function Jr(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Cn(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Jr(e,t,a),e=e.sibling;e!==null;)Jr(e,t,a),e=e.sibling}function Sm(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);vt(t,n,a),t[ht]=e,t[Dt]=a}catch(i){Be(e,e.return,i)}}var Ka=!1,rt=!1,_c=!1,_m=typeof WeakSet=="function"?WeakSet:Set,mt=null;function yx(e,t){if(e=e.containerInfo,Qc=xo,e=Ld(e),vi(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var r=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{a.nodeType,i.nodeType}catch{a=null;break e}var d=0,y=-1,j=-1,D=0,J=0,I=e,H=null;t:for(;;){for(var X;I!==a||r!==0&&I.nodeType!==3||(y=d+r),I!==i||n!==0&&I.nodeType!==3||(j=d+n),I.nodeType===3&&(d+=I.nodeValue.length),(X=I.firstChild)!==null;)H=I,I=X;for(;;){if(I===e)break t;if(H===a&&++D===r&&(y=d),H===i&&++J===n&&(j=d),(X=I.nextSibling)!==null)break;I=H,H=I.parentNode}I=X}a=y===-1||j===-1?null:{start:y,end:j}}else a=null}a=a||{start:0,end:0}}else a=null;for(Zc={focusedElem:e,selectionRange:a},xo=!1,mt=t;mt!==null;)if(t=mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,mt=e;else for(;mt!==null;){switch(t=mt,i=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),vt(i,n,a),i[ht]=e,ft(i),n=i;break e;case"link":var d=Mh("link","href",r).get(n+(a.href||""));if(d){for(var y=0;yXe&&(d=Xe,Xe=be,be=d);var M=Rd(y,be),C=Rd(y,Xe);if(M&&C&&(X.rangeCount!==1||X.anchorNode!==M.node||X.anchorOffset!==M.offset||X.focusNode!==C.node||X.focusOffset!==C.offset)){var R=I.createRange();R.setStart(M.node,M.offset),X.removeAllRanges(),be>Xe?(X.addRange(R),X.extend(C.node,C.offset)):(R.setEnd(C.node,C.offset),X.addRange(R))}}}}for(I=[],X=y;X=X.parentNode;)X.nodeType===1&&I.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;ya?32:a,k.T=null,a=Oc,Oc=null;var i=Sn,d=Ia;if(ct=0,Gs=Sn=null,Ia=0,(Ue&6)!==0)throw Error(u(331));var y=Ue;if(Ue|=4,Lm(i.current),zm(i,i.current,d,a),Ue=y,$l(0,!1),Tt&&typeof Tt.onPostCommitFiberRoot=="function")try{Tt.onPostCommitFiberRoot(Bn,i)}catch{}return!0}finally{V.p=r,k.T=n,eh(e,t)}}function ah(e,t,a){t=na(a,t),t=dc(e.stateNode,t,2),e=xn(e,t,2),e!==null&&(Fe(e,2),Ta(e))}function Be(e,t,a){if(e.tag===3)ah(e,e,a);else for(;t!==null;){if(t.tag===3){ah(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(jn===null||!jn.has(n))){e=na(a,e),a=nm(2),n=xn(t,a,2),n!==null&&(sm(a,n,t,e),Fe(n,2),Ta(n));break}}t=t.return}}function Lc(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new Nx;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(a)||(Tc=!0,r.add(a),e=Cx.bind(null,e,t,a),t.then(e,e))}function Cx(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,$e===e&&(Oe&a)===a&&(Ie===4||Ie===3&&(Oe&62914560)===Oe&&300>Ct()-Pr?(Ue&2)===0&&Vs(e,0):kc|=a,Ys===Oe&&(Ys=0)),Ta(e)}function nh(e,t){t===0&&(t=wt()),e=Qn(e,t),e!==null&&(Fe(e,t),Ta(e))}function Tx(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),nh(e,a)}function kx(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(a=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(u(314))}n!==null&&n.delete(t),nh(e,a)}function Ax(e,t){return il(e,t)}var lo=null,$s=null,Uc=!1,ro=!1,Hc=!1,En=0;function Ta(e){e!==$s&&e.next===null&&($s===null?lo=$s=e:$s=$s.next=e),ro=!0,Uc||(Uc=!0,Ox())}function $l(e,t){if(!Hc&&ro){Hc=!0;do for(var a=!1,n=lo;n!==null;){if(e!==0){var r=n.pendingLanes;if(r===0)var i=0;else{var d=n.suspendedLanes,y=n.pingedLanes;i=(1<<31-bt(42|e)+1)-1,i&=r&~(d&~y),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(a=!0,oh(n,i))}else i=Oe,i=Se(n,n===$e?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||Ke(n,i)||(a=!0,oh(n,i));n=n.next}while(a);Hc=!1}}function Mx(){sh()}function sh(){ro=Uc=!1;var e=0;En!==0&&Gx()&&(e=En);for(var t=Ct(),a=null,n=lo;n!==null;){var r=n.next,i=lh(n,t);i===0?(n.next=null,a===null?lo=r:a.next=r,r===null&&($s=a)):(a=n,(e!==0||(i&3)!==0)&&(ro=!0)),n=r}ct!==0&&ct!==5||$l(e),En!==0&&(En=0)}function lh(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0y)break;var J=j.transferSize,I=j.initiatorType;J&&ph(I)&&(j=j.responseEnd,d+=J*(j"u"?null:document;function Ch(e,t,a){var n=Qs;if(n&&typeof t=="string"&&t){var r=ta(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof a=="string"&&(r+='[crossorigin="'+a+'"]'),Eh.has(r)||(Eh.add(r),e={rel:e,crossOrigin:a,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),vt(t,"link",e),ft(t),n.head.appendChild(t)))}}function Wx(e){en.D(e),Ch("dns-prefetch",e,null)}function Px(e,t){en.C(e,t),Ch("preconnect",e,t)}function Ix(e,t,a){en.L(e,t,a);var n=Qs;if(n&&e&&t){var r='link[rel="preload"][as="'+ta(t)+'"]';t==="image"&&a&&a.imageSrcSet?(r+='[imagesrcset="'+ta(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(r+='[imagesizes="'+ta(a.imageSizes)+'"]')):r+='[href="'+ta(e)+'"]';var i=r;switch(t){case"style":i=Zs(e);break;case"script":i=Ks(e)}ca.has(i)||(e=h({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ca.set(i,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(Jl(i))||t==="script"&&n.querySelector(Fl(i))||(t=n.createElement("link"),vt(t,"link",e),ft(t),n.head.appendChild(t)))}}function ev(e,t){en.m(e,t);var a=Qs;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+ta(n)+'"][href="'+ta(e)+'"]',i=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Ks(e)}if(!ca.has(i)&&(e=h({rel:"modulepreload",href:e},t),ca.set(i,e),a.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Fl(i)))return}n=a.createElement("link"),vt(n,"link",e),ft(n),a.head.appendChild(n)}}}function tv(e,t,a){en.S(e,t,a);var n=Qs;if(n&&e){var r=ps(n).hoistableStyles,i=Zs(e);t=t||"default";var d=r.get(i);if(!d){var y={loading:0,preload:null};if(d=n.querySelector(Jl(i)))y.loading=5;else{e=h({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ca.get(i))&&eu(e,a);var j=d=n.createElement("link");ft(j),vt(j,"link",e),j._p=new Promise(function(D,J){j.onload=D,j.onerror=J}),j.addEventListener("load",function(){y.loading|=1}),j.addEventListener("error",function(){y.loading|=2}),y.loading|=4,fo(d,t,n)}d={type:"stylesheet",instance:d,count:1,state:y},r.set(i,d)}}}function av(e,t){en.X(e,t);var a=Qs;if(a&&e){var n=ps(a).hoistableScripts,r=Ks(e),i=n.get(r);i||(i=a.querySelector(Fl(r)),i||(e=h({src:e,async:!0},t),(t=ca.get(r))&&tu(e,t),i=a.createElement("script"),ft(i),vt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function nv(e,t){en.M(e,t);var a=Qs;if(a&&e){var n=ps(a).hoistableScripts,r=Ks(e),i=n.get(r);i||(i=a.querySelector(Fl(r)),i||(e=h({src:e,async:!0,type:"module"},t),(t=ca.get(r))&&tu(e,t),i=a.createElement("script"),ft(i),vt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function Th(e,t,a,n){var r=(r=xe.current)?uo(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Zs(a.href),a=ps(r).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Zs(a.href);var i=ps(r).hoistableStyles,d=i.get(e);if(d||(r=r.ownerDocument||r,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,d),(i=r.querySelector(Jl(e)))&&!i._p&&(d.instance=i,d.state.loading=5),ca.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ca.set(e,a),i||sv(r,e,a,d.state))),t&&n===null)throw Error(u(528,""));return d}if(t&&n!==null)throw Error(u(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ks(a),a=ps(r).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function Zs(e){return'href="'+ta(e)+'"'}function Jl(e){return'link[rel="stylesheet"]['+e+"]"}function kh(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function sv(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),vt(t,"link",a),ft(t),e.head.appendChild(t))}function Ks(e){return'[src="'+ta(e)+'"]'}function Fl(e){return"script[async]"+e}function Ah(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+ta(a.href)+'"]');if(n)return t.instance=n,ft(n),n;var r=h({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ft(n),vt(n,"style",r),fo(n,a.precedence,e),t.instance=n;case"stylesheet":r=Zs(a.href);var i=e.querySelector(Jl(r));if(i)return t.state.loading|=4,t.instance=i,ft(i),i;n=kh(a),(r=ca.get(r))&&eu(n,r),i=(e.ownerDocument||e).createElement("link"),ft(i);var d=i;return d._p=new Promise(function(y,j){d.onload=y,d.onerror=j}),vt(i,"link",n),t.state.loading|=4,fo(i,a.precedence,e),t.instance=i;case"script":return i=Ks(a.src),(r=e.querySelector(Fl(i)))?(t.instance=r,ft(r),r):(n=a,(r=ca.get(i))&&(n=h({},a),tu(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),ft(r),vt(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,fo(n,a.precedence,e));return t.instance}function fo(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,i=r,d=0;d title"):null)}function lv(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function zh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function rv(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var r=Zs(n.href),i=t.querySelector(Jl(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ho.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,ft(i);return}i=t.ownerDocument||t,n=kh(n),(r=ca.get(r))&&eu(n,r),i=i.createElement("link"),ft(i);var d=i;d._p=new Promise(function(y,j){d.onload=y,d.onerror=j}),vt(i,"link",n),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=ho.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var au=0;function ov(e,t){return e.stylesheets&&e.count===0&&go(e,e.stylesheets),0au?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function ho(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var po=null;function go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,po=new Map,t.forEach(iv,e),po=null,ho.call(e))}function iv(e,t){if(!(t.state.loading&4)){var a=po.get(e);if(a)var n=a.get(null);else{a=new Map,po.set(e,a);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),du.exports=Sv(),du.exports}var Ev=_v();function Aa(l,o,{checkForDefaultPrevented:c=!0}={}){return function(f){if(l?.(f),c===!1||!f.defaultPrevented)return o?.(f)}}function np(l,o){if(typeof l=="function")return l(o);l!=null&&(l.current=o)}function Hu(...l){return o=>{let c=!1;const u=l.map(f=>{const m=np(f,o);return!c&&typeof m=="function"&&(c=!0),m});if(c)return()=>{for(let f=0;f{const{scope:N,children:E,...A}=h,U=N?.[l]?.[x]||v,G=w.useMemo(()=>A,Object.values(A));return s.jsx(U.Provider,{value:G,children:E})};p.displayName=m+"Provider";function b(h,N){const E=N?.[l]?.[x]||v,A=w.useContext(E);if(A)return A;if(g!==void 0)return g;throw new Error(`\`${h}\` must be used within \`${m}\``)}return[p,b]}const f=()=>{const m=c.map(g=>w.createContext(g));return function(v){const x=v?.[l]||m;return w.useMemo(()=>({[`__scope${l}`]:{...v,[l]:x}}),[v,x])}};return f.scopeName=l,[u,Cv(f,...o)]}function Cv(...l){const o=l[0];if(l.length===1)return o;const c=()=>{const u=l.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(m){const g=u.reduce((v,{useScope:x,scopeName:p})=>{const h=x(m)[`__scope${p}`];return{...v,...h}},{});return w.useMemo(()=>({[`__scope${o.scopeName}`]:g}),[g])}};return c.scopeName=o.scopeName,c}var qu=Up();const Hp=Lp(qu);function Tv(l){const o=kv(l),c=w.forwardRef((u,f)=>{const{children:m,...g}=u,v=w.Children.toArray(m),x=v.find(Mv);if(x){const p=x.props.children,b=v.map(h=>h===x?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:h);return s.jsx(o,{...g,ref:f,children:w.isValidElement(p)?w.cloneElement(p,void 0,b):null})}return s.jsx(o,{...g,ref:f,children:m})});return c.displayName=`${l}.Slot`,c}function kv(l){const o=w.forwardRef((c,u)=>{const{children:f,...m}=c;if(w.isValidElement(f)){const g=zv(f),v=Ov(m,f.props);return f.type!==w.Fragment&&(v.ref=u?Hu(u,g):g),w.cloneElement(f,v)}return w.Children.count(f)>1?w.Children.only(null):null});return o.displayName=`${l}.SlotClone`,o}var Av=Symbol("radix.slottable");function Mv(l){return w.isValidElement(l)&&typeof l.type=="function"&&"__radixId"in l.type&&l.type.__radixId===Av}function Ov(l,o){const c={...o};for(const u in o){const f=l[u],m=o[u];/^on[A-Z]/.test(u)?f&&m?c[u]=(...v)=>{const x=m(...v);return f(...v),x}:f&&(c[u]=f):u==="style"?c[u]={...f,...m}:u==="className"&&(c[u]=[f,m].filter(Boolean).join(" "))}return{...l,...c}}function zv(l){let o=Object.getOwnPropertyDescriptor(l.props,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning;return c?l.ref:(o=Object.getOwnPropertyDescriptor(l,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}var Rv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ra=Rv.reduce((l,o)=>{const c=Tv(`Primitive.${o}`),u=w.forwardRef((f,m)=>{const{asChild:g,...v}=f,x=g?c:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(x,{...v,ref:m})});return u.displayName=`Primitive.${o}`,{...l,[o]:u}},{});function Dv(l,o){l&&qu.flushSync(()=>l.dispatchEvent(o))}function Yo(l){const o=w.useRef(l);return w.useEffect(()=>{o.current=l}),w.useMemo(()=>(...c)=>o.current?.(...c),[])}function Lv(l,o=globalThis?.document){const c=Yo(l);w.useEffect(()=>{const u=f=>{f.key==="Escape"&&c(f)};return o.addEventListener("keydown",u,{capture:!0}),()=>o.removeEventListener("keydown",u,{capture:!0})},[c,o])}var Uv="DismissableLayer",Nu="dismissableLayer.update",Hv="dismissableLayer.pointerDownOutside",Bv="dismissableLayer.focusOutside",sp,Bp=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qp=w.forwardRef((l,o)=>{const{disableOutsidePointerEvents:c=!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:v,...x}=l,p=w.useContext(Bp),[b,h]=w.useState(null),N=b?.ownerDocument??globalThis?.document,[,E]=w.useState({}),A=sn(o,_=>h(_)),U=Array.from(p.layers),[G]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),T=U.indexOf(G),K=b?U.indexOf(b):-1,q=p.layersWithOutsidePointerEventsDisabled.size>0,F=K>=T,ae=Gv(_=>{const L=_.target,Y=[...p.branches].some(z=>z.contains(L));!F||Y||(f?.(_),g?.(_),_.defaultPrevented||v?.())},N),te=Vv(_=>{const L=_.target;[...p.branches].some(z=>z.contains(L))||(m?.(_),g?.(_),_.defaultPrevented||v?.())},N);return Lv(_=>{K===p.layers.size-1&&(u?.(_),!_.defaultPrevented&&v&&(_.preventDefault(),v()))},N),w.useEffect(()=>{if(b)return c&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(sp=N.body.style.pointerEvents,N.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(b)),p.layers.add(b),lp(),()=>{c&&p.layersWithOutsidePointerEventsDisabled.size===1&&(N.body.style.pointerEvents=sp)}},[b,N,c,p]),w.useEffect(()=>()=>{b&&(p.layers.delete(b),p.layersWithOutsidePointerEventsDisabled.delete(b),lp())},[b,p]),w.useEffect(()=>{const _=()=>E({});return document.addEventListener(Nu,_),()=>document.removeEventListener(Nu,_)},[]),s.jsx(Ra.div,{...x,ref:A,style:{pointerEvents:q?F?"auto":"none":void 0,...l.style},onFocusCapture:Aa(l.onFocusCapture,te.onFocusCapture),onBlurCapture:Aa(l.onBlurCapture,te.onBlurCapture),onPointerDownCapture:Aa(l.onPointerDownCapture,ae.onPointerDownCapture)})});qp.displayName=Uv;var qv="DismissableLayerBranch",Yv=w.forwardRef((l,o)=>{const c=w.useContext(Bp),u=w.useRef(null),f=sn(o,u);return w.useEffect(()=>{const m=u.current;if(m)return c.branches.add(m),()=>{c.branches.delete(m)}},[c.branches]),s.jsx(Ra.div,{...l,ref:f})});Yv.displayName=qv;function Gv(l,o=globalThis?.document){const c=Yo(l),u=w.useRef(!1),f=w.useRef(()=>{});return w.useEffect(()=>{const m=v=>{if(v.target&&!u.current){let x=function(){Yp(Hv,c,p,{discrete:!0})};const p={originalEvent:v};v.pointerType==="touch"?(o.removeEventListener("click",f.current),f.current=x,o.addEventListener("click",f.current,{once:!0})):x()}else o.removeEventListener("click",f.current);u.current=!1},g=window.setTimeout(()=>{o.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(g),o.removeEventListener("pointerdown",m),o.removeEventListener("click",f.current)}},[o,c]),{onPointerDownCapture:()=>u.current=!0}}function Vv(l,o=globalThis?.document){const c=Yo(l),u=w.useRef(!1);return w.useEffect(()=>{const f=m=>{m.target&&!u.current&&Yp(Bv,c,{originalEvent:m},{discrete:!1})};return o.addEventListener("focusin",f),()=>o.removeEventListener("focusin",f)},[o,c]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function lp(){const l=new CustomEvent(Nu);document.dispatchEvent(l)}function Yp(l,o,c,{discrete:u}){const f=c.originalEvent.target,m=new CustomEvent(l,{bubbles:!1,cancelable:!0,detail:c});o&&f.addEventListener(l,o,{once:!0}),u?Dv(f,m):f.dispatchEvent(m)}var Rn=globalThis?.document?w.useLayoutEffect:()=>{},Xv=Uu[" useId ".trim().toString()]||(()=>{}),$v=0;function Qv(l){const[o,c]=w.useState(Xv());return Rn(()=>{c(u=>u??String($v++))},[l]),o?`radix-${o}`:""}const Zv=["top","right","bottom","left"],Dn=Math.min,Pt=Math.max,Oo=Math.round,So=Math.floor,Oa=l=>({x:l,y:l}),Kv={left:"right",right:"left",bottom:"top",top:"bottom"},Jv={start:"end",end:"start"};function ju(l,o,c){return Pt(l,Dn(o,c))}function an(l,o){return typeof l=="function"?l(o):l}function nn(l){return l.split("-")[0]}function sl(l){return l.split("-")[1]}function Yu(l){return l==="x"?"y":"x"}function Gu(l){return l==="y"?"height":"width"}const Fv=new Set(["top","bottom"]);function Ma(l){return Fv.has(nn(l))?"y":"x"}function Vu(l){return Yu(Ma(l))}function Wv(l,o,c){c===void 0&&(c=!1);const u=sl(l),f=Vu(l),m=Gu(f);let g=f==="x"?u===(c?"end":"start")?"right":"left":u==="start"?"bottom":"top";return o.reference[m]>o.floating[m]&&(g=zo(g)),[g,zo(g)]}function Pv(l){const o=zo(l);return[Su(l),o,Su(o)]}function Su(l){return l.replace(/start|end/g,o=>Jv[o])}const rp=["left","right"],op=["right","left"],Iv=["top","bottom"],ey=["bottom","top"];function ty(l,o,c){switch(l){case"top":case"bottom":return c?o?op:rp:o?rp:op;case"left":case"right":return o?Iv:ey;default:return[]}}function ay(l,o,c,u){const f=sl(l);let m=ty(nn(l),c==="start",u);return f&&(m=m.map(g=>g+"-"+f),o&&(m=m.concat(m.map(Su)))),m}function zo(l){return l.replace(/left|right|bottom|top/g,o=>Kv[o])}function ny(l){return{top:0,right:0,bottom:0,left:0,...l}}function Gp(l){return typeof l!="number"?ny(l):{top:l,right:l,bottom:l,left:l}}function Ro(l){const{x:o,y:c,width:u,height:f}=l;return{width:u,height:f,top:c,left:o,right:o+u,bottom:c+f,x:o,y:c}}function ip(l,o,c){let{reference:u,floating:f}=l;const m=Ma(o),g=Vu(o),v=Gu(g),x=nn(o),p=m==="y",b=u.x+u.width/2-f.width/2,h=u.y+u.height/2-f.height/2,N=u[v]/2-f[v]/2;let E;switch(x){case"top":E={x:b,y:u.y-f.height};break;case"bottom":E={x:b,y:u.y+u.height};break;case"right":E={x:u.x+u.width,y:h};break;case"left":E={x:u.x-f.width,y:h};break;default:E={x:u.x,y:u.y}}switch(sl(o)){case"start":E[g]-=N*(c&&p?-1:1);break;case"end":E[g]+=N*(c&&p?-1:1);break}return E}const sy=async(l,o,c)=>{const{placement:u="bottom",strategy:f="absolute",middleware:m=[],platform:g}=c,v=m.filter(Boolean),x=await(g.isRTL==null?void 0:g.isRTL(o));let p=await g.getElementRects({reference:l,floating:o,strategy:f}),{x:b,y:h}=ip(p,u,x),N=u,E={},A=0;for(let U=0;U({name:"arrow",options:l,async fn(o){const{x:c,y:u,placement:f,rects:m,platform:g,elements:v,middlewareData:x}=o,{element:p,padding:b=0}=an(l,o)||{};if(p==null)return{};const h=Gp(b),N={x:c,y:u},E=Vu(f),A=Gu(E),U=await g.getDimensions(p),G=E==="y",T=G?"top":"left",K=G?"bottom":"right",q=G?"clientHeight":"clientWidth",F=m.reference[A]+m.reference[E]-N[E]-m.floating[A],ae=N[E]-m.reference[E],te=await(g.getOffsetParent==null?void 0:g.getOffsetParent(p));let _=te?te[q]:0;(!_||!await(g.isElement==null?void 0:g.isElement(te)))&&(_=v.floating[q]||m.floating[A]);const L=F/2-ae/2,Y=_/2-U[A]/2-1,z=Dn(h[T],Y),se=Dn(h[K],Y),ie=z,O=_-U[A]-se,ne=_/2-U[A]/2+L,oe=ju(ie,ne,O),k=!x.arrow&&sl(f)!=null&&ne!==oe&&m.reference[A]/2-(nene<=0)){var se,ie;const ne=(((se=m.flip)==null?void 0:se.index)||0)+1,oe=_[ne];if(oe&&(!(h==="alignment"?K!==Ma(oe):!1)||z.every(B=>Ma(B.placement)===K?B.overflows[0]>0:!0)))return{data:{index:ne,overflows:z},reset:{placement:oe}};let k=(ie=z.filter(V=>V.overflows[0]<=0).sort((V,B)=>V.overflows[1]-B.overflows[1])[0])==null?void 0:ie.placement;if(!k)switch(E){case"bestFit":{var O;const V=(O=z.filter(B=>{if(te){const ce=Ma(B.placement);return ce===K||ce==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(ce=>ce>0).reduce((ce,ge)=>ce+ge,0)]).sort((B,ce)=>B[1]-ce[1])[0])==null?void 0:O[0];V&&(k=V);break}case"initialPlacement":k=v;break}if(f!==k)return{reset:{placement:k}}}return{}}}};function cp(l,o){return{top:l.top-o.height,right:l.right-o.width,bottom:l.bottom-o.height,left:l.left-o.width}}function up(l){return Zv.some(o=>l[o]>=0)}const oy=function(l){return l===void 0&&(l={}),{name:"hide",options:l,async fn(o){const{rects:c}=o,{strategy:u="referenceHidden",...f}=an(l,o);switch(u){case"referenceHidden":{const m=await sr(o,{...f,elementContext:"reference"}),g=cp(m,c.reference);return{data:{referenceHiddenOffsets:g,referenceHidden:up(g)}}}case"escaped":{const m=await sr(o,{...f,altBoundary:!0}),g=cp(m,c.floating);return{data:{escapedOffsets:g,escaped:up(g)}}}default:return{}}}}},Vp=new Set(["left","top"]);async function iy(l,o){const{placement:c,platform:u,elements:f}=l,m=await(u.isRTL==null?void 0:u.isRTL(f.floating)),g=nn(c),v=sl(c),x=Ma(c)==="y",p=Vp.has(g)?-1:1,b=m&&x?-1:1,h=an(o,l);let{mainAxis:N,crossAxis:E,alignmentAxis:A}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return v&&typeof A=="number"&&(E=v==="end"?A*-1:A),x?{x:E*b,y:N*p}:{x:N*p,y:E*b}}const cy=function(l){return l===void 0&&(l=0),{name:"offset",options:l,async fn(o){var c,u;const{x:f,y:m,placement:g,middlewareData:v}=o,x=await iy(o,l);return g===((c=v.offset)==null?void 0:c.placement)&&(u=v.arrow)!=null&&u.alignmentOffset?{}:{x:f+x.x,y:m+x.y,data:{...x,placement:g}}}}},uy=function(l){return l===void 0&&(l={}),{name:"shift",options:l,async fn(o){const{x:c,y:u,placement:f}=o,{mainAxis:m=!0,crossAxis:g=!1,limiter:v={fn:G=>{let{x:T,y:K}=G;return{x:T,y:K}}},...x}=an(l,o),p={x:c,y:u},b=await sr(o,x),h=Ma(nn(f)),N=Yu(h);let E=p[N],A=p[h];if(m){const G=N==="y"?"top":"left",T=N==="y"?"bottom":"right",K=E+b[G],q=E-b[T];E=ju(K,E,q)}if(g){const G=h==="y"?"top":"left",T=h==="y"?"bottom":"right",K=A+b[G],q=A-b[T];A=ju(K,A,q)}const U=v.fn({...o,[N]:E,[h]:A});return{...U,data:{x:U.x-c,y:U.y-u,enabled:{[N]:m,[h]:g}}}}}},dy=function(l){return l===void 0&&(l={}),{options:l,fn(o){const{x:c,y:u,placement:f,rects:m,middlewareData:g}=o,{offset:v=0,mainAxis:x=!0,crossAxis:p=!0}=an(l,o),b={x:c,y:u},h=Ma(f),N=Yu(h);let E=b[N],A=b[h];const U=an(v,o),G=typeof U=="number"?{mainAxis:U,crossAxis:0}:{mainAxis:0,crossAxis:0,...U};if(x){const q=N==="y"?"height":"width",F=m.reference[N]-m.floating[q]+G.mainAxis,ae=m.reference[N]+m.reference[q]-G.mainAxis;Eae&&(E=ae)}if(p){var T,K;const q=N==="y"?"width":"height",F=Vp.has(nn(f)),ae=m.reference[h]-m.floating[q]+(F&&((T=g.offset)==null?void 0:T[h])||0)+(F?0:G.crossAxis),te=m.reference[h]+m.reference[q]+(F?0:((K=g.offset)==null?void 0:K[h])||0)-(F?G.crossAxis:0);Ate&&(A=te)}return{[N]:E,[h]:A}}}},fy=function(l){return l===void 0&&(l={}),{name:"size",options:l,async fn(o){var c,u;const{placement:f,rects:m,platform:g,elements:v}=o,{apply:x=()=>{},...p}=an(l,o),b=await sr(o,p),h=nn(f),N=sl(f),E=Ma(f)==="y",{width:A,height:U}=m.floating;let G,T;h==="top"||h==="bottom"?(G=h,T=N===(await(g.isRTL==null?void 0:g.isRTL(v.floating))?"start":"end")?"left":"right"):(T=h,G=N==="end"?"top":"bottom");const K=U-b.top-b.bottom,q=A-b.left-b.right,F=Dn(U-b[G],K),ae=Dn(A-b[T],q),te=!o.middlewareData.shift;let _=F,L=ae;if((c=o.middlewareData.shift)!=null&&c.enabled.x&&(L=q),(u=o.middlewareData.shift)!=null&&u.enabled.y&&(_=K),te&&!N){const z=Pt(b.left,0),se=Pt(b.right,0),ie=Pt(b.top,0),O=Pt(b.bottom,0);E?L=A-2*(z!==0||se!==0?z+se:Pt(b.left,b.right)):_=U-2*(ie!==0||O!==0?ie+O:Pt(b.top,b.bottom))}await x({...o,availableWidth:L,availableHeight:_});const Y=await g.getDimensions(v.floating);return A!==Y.width||U!==Y.height?{reset:{rects:!0}}:{}}}};function Go(){return typeof window<"u"}function ll(l){return Xp(l)?(l.nodeName||"").toLowerCase():"#document"}function It(l){var o;return(l==null||(o=l.ownerDocument)==null?void 0:o.defaultView)||window}function Da(l){var o;return(o=(Xp(l)?l.ownerDocument:l.document)||window.document)==null?void 0:o.documentElement}function Xp(l){return Go()?l instanceof Node||l instanceof It(l).Node:!1}function wa(l){return Go()?l instanceof Element||l instanceof It(l).Element:!1}function za(l){return Go()?l instanceof HTMLElement||l instanceof It(l).HTMLElement:!1}function dp(l){return!Go()||typeof ShadowRoot>"u"?!1:l instanceof ShadowRoot||l instanceof It(l).ShadowRoot}const my=new Set(["inline","contents"]);function or(l){const{overflow:o,overflowX:c,overflowY:u,display:f}=Na(l);return/auto|scroll|overlay|hidden|clip/.test(o+u+c)&&!my.has(f)}const hy=new Set(["table","td","th"]);function py(l){return hy.has(ll(l))}const gy=[":popover-open",":modal"];function Vo(l){return gy.some(o=>{try{return l.matches(o)}catch{return!1}})}const xy=["transform","translate","scale","rotate","perspective"],vy=["transform","translate","scale","rotate","perspective","filter"],yy=["paint","layout","strict","content"];function Xu(l){const o=$u(),c=wa(l)?Na(l):l;return xy.some(u=>c[u]?c[u]!=="none":!1)||(c.containerType?c.containerType!=="normal":!1)||!o&&(c.backdropFilter?c.backdropFilter!=="none":!1)||!o&&(c.filter?c.filter!=="none":!1)||vy.some(u=>(c.willChange||"").includes(u))||yy.some(u=>(c.contain||"").includes(u))}function by(l){let o=Ln(l);for(;za(o)&&!Is(o);){if(Xu(o))return o;if(Vo(o))return null;o=Ln(o)}return null}function $u(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wy=new Set(["html","body","#document"]);function Is(l){return wy.has(ll(l))}function Na(l){return It(l).getComputedStyle(l)}function Xo(l){return wa(l)?{scrollLeft:l.scrollLeft,scrollTop:l.scrollTop}:{scrollLeft:l.scrollX,scrollTop:l.scrollY}}function Ln(l){if(ll(l)==="html")return l;const o=l.assignedSlot||l.parentNode||dp(l)&&l.host||Da(l);return dp(o)?o.host:o}function $p(l){const o=Ln(l);return Is(o)?l.ownerDocument?l.ownerDocument.body:l.body:za(o)&&or(o)?o:$p(o)}function lr(l,o,c){var u;o===void 0&&(o=[]),c===void 0&&(c=!0);const f=$p(l),m=f===((u=l.ownerDocument)==null?void 0:u.body),g=It(f);if(m){const v=_u(g);return o.concat(g,g.visualViewport||[],or(f)?f:[],v&&c?lr(v):[])}return o.concat(f,lr(f,[],c))}function _u(l){return l.parent&&Object.getPrototypeOf(l.parent)?l.frameElement:null}function Qp(l){const o=Na(l);let c=parseFloat(o.width)||0,u=parseFloat(o.height)||0;const f=za(l),m=f?l.offsetWidth:c,g=f?l.offsetHeight:u,v=Oo(c)!==m||Oo(u)!==g;return v&&(c=m,u=g),{width:c,height:u,$:v}}function Qu(l){return wa(l)?l:l.contextElement}function Ws(l){const o=Qu(l);if(!za(o))return Oa(1);const c=o.getBoundingClientRect(),{width:u,height:f,$:m}=Qp(o);let g=(m?Oo(c.width):c.width)/u,v=(m?Oo(c.height):c.height)/f;return(!g||!Number.isFinite(g))&&(g=1),(!v||!Number.isFinite(v))&&(v=1),{x:g,y:v}}const Ny=Oa(0);function Zp(l){const o=It(l);return!$u()||!o.visualViewport?Ny:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function jy(l,o,c){return o===void 0&&(o=!1),!c||o&&c!==It(l)?!1:o}function os(l,o,c,u){o===void 0&&(o=!1),c===void 0&&(c=!1);const f=l.getBoundingClientRect(),m=Qu(l);let g=Oa(1);o&&(u?wa(u)&&(g=Ws(u)):g=Ws(l));const v=jy(m,c,u)?Zp(m):Oa(0);let x=(f.left+v.x)/g.x,p=(f.top+v.y)/g.y,b=f.width/g.x,h=f.height/g.y;if(m){const N=It(m),E=u&&wa(u)?It(u):u;let A=N,U=_u(A);for(;U&&u&&E!==A;){const G=Ws(U),T=U.getBoundingClientRect(),K=Na(U),q=T.left+(U.clientLeft+parseFloat(K.paddingLeft))*G.x,F=T.top+(U.clientTop+parseFloat(K.paddingTop))*G.y;x*=G.x,p*=G.y,b*=G.x,h*=G.y,x+=q,p+=F,A=It(U),U=_u(A)}}return Ro({width:b,height:h,x,y:p})}function $o(l,o){const c=Xo(l).scrollLeft;return o?o.left+c:os(Da(l)).left+c}function Kp(l,o){const c=l.getBoundingClientRect(),u=c.left+o.scrollLeft-$o(l,c),f=c.top+o.scrollTop;return{x:u,y:f}}function Sy(l){let{elements:o,rect:c,offsetParent:u,strategy:f}=l;const m=f==="fixed",g=Da(u),v=o?Vo(o.floating):!1;if(u===g||v&&m)return c;let x={scrollLeft:0,scrollTop:0},p=Oa(1);const b=Oa(0),h=za(u);if((h||!h&&!m)&&((ll(u)!=="body"||or(g))&&(x=Xo(u)),za(u))){const E=os(u);p=Ws(u),b.x=E.x+u.clientLeft,b.y=E.y+u.clientTop}const N=g&&!h&&!m?Kp(g,x):Oa(0);return{width:c.width*p.x,height:c.height*p.y,x:c.x*p.x-x.scrollLeft*p.x+b.x+N.x,y:c.y*p.y-x.scrollTop*p.y+b.y+N.y}}function _y(l){return Array.from(l.getClientRects())}function Ey(l){const o=Da(l),c=Xo(l),u=l.ownerDocument.body,f=Pt(o.scrollWidth,o.clientWidth,u.scrollWidth,u.clientWidth),m=Pt(o.scrollHeight,o.clientHeight,u.scrollHeight,u.clientHeight);let g=-c.scrollLeft+$o(l);const v=-c.scrollTop;return Na(u).direction==="rtl"&&(g+=Pt(o.clientWidth,u.clientWidth)-f),{width:f,height:m,x:g,y:v}}const fp=25;function Cy(l,o){const c=It(l),u=Da(l),f=c.visualViewport;let m=u.clientWidth,g=u.clientHeight,v=0,x=0;if(f){m=f.width,g=f.height;const b=$u();(!b||b&&o==="fixed")&&(v=f.offsetLeft,x=f.offsetTop)}const p=$o(u);if(p<=0){const b=u.ownerDocument,h=b.body,N=getComputedStyle(h),E=b.compatMode==="CSS1Compat"&&parseFloat(N.marginLeft)+parseFloat(N.marginRight)||0,A=Math.abs(u.clientWidth-h.clientWidth-E);A<=fp&&(m-=A)}else p<=fp&&(m+=p);return{width:m,height:g,x:v,y:x}}const Ty=new Set(["absolute","fixed"]);function ky(l,o){const c=os(l,!0,o==="fixed"),u=c.top+l.clientTop,f=c.left+l.clientLeft,m=za(l)?Ws(l):Oa(1),g=l.clientWidth*m.x,v=l.clientHeight*m.y,x=f*m.x,p=u*m.y;return{width:g,height:v,x,y:p}}function mp(l,o,c){let u;if(o==="viewport")u=Cy(l,c);else if(o==="document")u=Ey(Da(l));else if(wa(o))u=ky(o,c);else{const f=Zp(l);u={x:o.x-f.x,y:o.y-f.y,width:o.width,height:o.height}}return Ro(u)}function Jp(l,o){const c=Ln(l);return c===o||!wa(c)||Is(c)?!1:Na(c).position==="fixed"||Jp(c,o)}function Ay(l,o){const c=o.get(l);if(c)return c;let u=lr(l,[],!1).filter(v=>wa(v)&&ll(v)!=="body"),f=null;const m=Na(l).position==="fixed";let g=m?Ln(l):l;for(;wa(g)&&!Is(g);){const v=Na(g),x=Xu(g);!x&&v.position==="fixed"&&(f=null),(m?!x&&!f:!x&&v.position==="static"&&!!f&&Ty.has(f.position)||or(g)&&!x&&Jp(l,g))?u=u.filter(b=>b!==g):f=v,g=Ln(g)}return o.set(l,u),u}function My(l){let{element:o,boundary:c,rootBoundary:u,strategy:f}=l;const g=[...c==="clippingAncestors"?Vo(o)?[]:Ay(o,this._c):[].concat(c),u],v=g[0],x=g.reduce((p,b)=>{const h=mp(o,b,f);return p.top=Pt(h.top,p.top),p.right=Dn(h.right,p.right),p.bottom=Dn(h.bottom,p.bottom),p.left=Pt(h.left,p.left),p},mp(o,v,f));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function Oy(l){const{width:o,height:c}=Qp(l);return{width:o,height:c}}function zy(l,o,c){const u=za(o),f=Da(o),m=c==="fixed",g=os(l,!0,m,o);let v={scrollLeft:0,scrollTop:0};const x=Oa(0);function p(){x.x=$o(f)}if(u||!u&&!m)if((ll(o)!=="body"||or(f))&&(v=Xo(o)),u){const E=os(o,!0,m,o);x.x=E.x+o.clientLeft,x.y=E.y+o.clientTop}else f&&p();m&&!u&&f&&p();const b=f&&!u&&!m?Kp(f,v):Oa(0),h=g.left+v.scrollLeft-x.x-b.x,N=g.top+v.scrollTop-x.y-b.y;return{x:h,y:N,width:g.width,height:g.height}}function pu(l){return Na(l).position==="static"}function hp(l,o){if(!za(l)||Na(l).position==="fixed")return null;if(o)return o(l);let c=l.offsetParent;return Da(l)===c&&(c=c.ownerDocument.body),c}function Fp(l,o){const c=It(l);if(Vo(l))return c;if(!za(l)){let f=Ln(l);for(;f&&!Is(f);){if(wa(f)&&!pu(f))return f;f=Ln(f)}return c}let u=hp(l,o);for(;u&&py(u)&&pu(u);)u=hp(u,o);return u&&Is(u)&&pu(u)&&!Xu(u)?c:u||by(l)||c}const Ry=async function(l){const o=this.getOffsetParent||Fp,c=this.getDimensions,u=await c(l.floating);return{reference:zy(l.reference,await o(l.floating),l.strategy),floating:{x:0,y:0,width:u.width,height:u.height}}};function Dy(l){return Na(l).direction==="rtl"}const Ly={convertOffsetParentRelativeRectToViewportRelativeRect:Sy,getDocumentElement:Da,getClippingRect:My,getOffsetParent:Fp,getElementRects:Ry,getClientRects:_y,getDimensions:Oy,getScale:Ws,isElement:wa,isRTL:Dy};function Wp(l,o){return l.x===o.x&&l.y===o.y&&l.width===o.width&&l.height===o.height}function Uy(l,o){let c=null,u;const f=Da(l);function m(){var v;clearTimeout(u),(v=c)==null||v.disconnect(),c=null}function g(v,x){v===void 0&&(v=!1),x===void 0&&(x=1),m();const p=l.getBoundingClientRect(),{left:b,top:h,width:N,height:E}=p;if(v||o(),!N||!E)return;const A=So(h),U=So(f.clientWidth-(b+N)),G=So(f.clientHeight-(h+E)),T=So(b),q={rootMargin:-A+"px "+-U+"px "+-G+"px "+-T+"px",threshold:Pt(0,Dn(1,x))||1};let F=!0;function ae(te){const _=te[0].intersectionRatio;if(_!==x){if(!F)return g();_?g(!1,_):u=setTimeout(()=>{g(!1,1e-7)},1e3)}_===1&&!Wp(p,l.getBoundingClientRect())&&g(),F=!1}try{c=new IntersectionObserver(ae,{...q,root:f.ownerDocument})}catch{c=new IntersectionObserver(ae,q)}c.observe(l)}return g(!0),m}function Hy(l,o,c,u){u===void 0&&(u={});const{ancestorScroll:f=!0,ancestorResize:m=!0,elementResize:g=typeof ResizeObserver=="function",layoutShift:v=typeof IntersectionObserver=="function",animationFrame:x=!1}=u,p=Qu(l),b=f||m?[...p?lr(p):[],...lr(o)]:[];b.forEach(T=>{f&&T.addEventListener("scroll",c,{passive:!0}),m&&T.addEventListener("resize",c)});const h=p&&v?Uy(p,c):null;let N=-1,E=null;g&&(E=new ResizeObserver(T=>{let[K]=T;K&&K.target===p&&E&&(E.unobserve(o),cancelAnimationFrame(N),N=requestAnimationFrame(()=>{var q;(q=E)==null||q.observe(o)})),c()}),p&&!x&&E.observe(p),E.observe(o));let A,U=x?os(l):null;x&&G();function G(){const T=os(l);U&&!Wp(U,T)&&c(),U=T,A=requestAnimationFrame(G)}return c(),()=>{var T;b.forEach(K=>{f&&K.removeEventListener("scroll",c),m&&K.removeEventListener("resize",c)}),h?.(),(T=E)==null||T.disconnect(),E=null,x&&cancelAnimationFrame(A)}}const By=cy,qy=uy,Yy=ry,Gy=fy,Vy=oy,pp=ly,Xy=dy,$y=(l,o,c)=>{const u=new Map,f={platform:Ly,...c},m={...f.platform,_c:u};return sy(l,o,{...f,platform:m})};var Qy=typeof document<"u",Zy=function(){},Ao=Qy?w.useLayoutEffect:Zy;function Do(l,o){if(l===o)return!0;if(typeof l!=typeof o)return!1;if(typeof l=="function"&&l.toString()===o.toString())return!0;let c,u,f;if(l&&o&&typeof l=="object"){if(Array.isArray(l)){if(c=l.length,c!==o.length)return!1;for(u=c;u--!==0;)if(!Do(l[u],o[u]))return!1;return!0}if(f=Object.keys(l),c=f.length,c!==Object.keys(o).length)return!1;for(u=c;u--!==0;)if(!{}.hasOwnProperty.call(o,f[u]))return!1;for(u=c;u--!==0;){const m=f[u];if(!(m==="_owner"&&l.$$typeof)&&!Do(l[m],o[m]))return!1}return!0}return l!==l&&o!==o}function Pp(l){return typeof window>"u"?1:(l.ownerDocument.defaultView||window).devicePixelRatio||1}function gp(l,o){const c=Pp(l);return Math.round(o*c)/c}function gu(l){const o=w.useRef(l);return Ao(()=>{o.current=l}),o}function Ky(l){l===void 0&&(l={});const{placement:o="bottom",strategy:c="absolute",middleware:u=[],platform:f,elements:{reference:m,floating:g}={},transform:v=!0,whileElementsMounted:x,open:p}=l,[b,h]=w.useState({x:0,y:0,strategy:c,placement:o,middlewareData:{},isPositioned:!1}),[N,E]=w.useState(u);Do(N,u)||E(u);const[A,U]=w.useState(null),[G,T]=w.useState(null),K=w.useCallback(B=>{B!==te.current&&(te.current=B,U(B))},[]),q=w.useCallback(B=>{B!==_.current&&(_.current=B,T(B))},[]),F=m||A,ae=g||G,te=w.useRef(null),_=w.useRef(null),L=w.useRef(b),Y=x!=null,z=gu(x),se=gu(f),ie=gu(p),O=w.useCallback(()=>{if(!te.current||!_.current)return;const B={placement:o,strategy:c,middleware:N};se.current&&(B.platform=se.current),$y(te.current,_.current,B).then(ce=>{const ge={...ce,isPositioned:ie.current!==!1};ne.current&&!Do(L.current,ge)&&(L.current=ge,qu.flushSync(()=>{h(ge)}))})},[N,o,c,se,ie]);Ao(()=>{p===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[p]);const ne=w.useRef(!1);Ao(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Ao(()=>{if(F&&(te.current=F),ae&&(_.current=ae),F&&ae){if(z.current)return z.current(F,ae,O);O()}},[F,ae,O,z,Y]);const oe=w.useMemo(()=>({reference:te,floating:_,setReference:K,setFloating:q}),[K,q]),k=w.useMemo(()=>({reference:F,floating:ae}),[F,ae]),V=w.useMemo(()=>{const B={position:c,left:0,top:0};if(!k.floating)return B;const ce=gp(k.floating,b.x),ge=gp(k.floating,b.y);return v?{...B,transform:"translate("+ce+"px, "+ge+"px)",...Pp(k.floating)>=1.5&&{willChange:"transform"}}:{position:c,left:ce,top:ge}},[c,v,k.floating,b.x,b.y]);return w.useMemo(()=>({...b,update:O,refs:oe,elements:k,floatingStyles:V}),[b,O,oe,k,V])}const Jy=l=>{function o(c){return{}.hasOwnProperty.call(c,"current")}return{name:"arrow",options:l,fn(c){const{element:u,padding:f}=typeof l=="function"?l(c):l;return u&&o(u)?u.current!=null?pp({element:u.current,padding:f}).fn(c):{}:u?pp({element:u,padding:f}).fn(c):{}}}},Fy=(l,o)=>({...By(l),options:[l,o]}),Wy=(l,o)=>({...qy(l),options:[l,o]}),Py=(l,o)=>({...Xy(l),options:[l,o]}),Iy=(l,o)=>({...Yy(l),options:[l,o]}),eb=(l,o)=>({...Gy(l),options:[l,o]}),tb=(l,o)=>({...Vy(l),options:[l,o]}),ab=(l,o)=>({...Jy(l),options:[l,o]});var nb="Arrow",Ip=w.forwardRef((l,o)=>{const{children:c,width:u=10,height:f=5,...m}=l;return s.jsx(Ra.svg,{...m,ref:o,width:u,height:f,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:l.asChild?c:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ip.displayName=nb;var sb=Ip;function e0(l){const[o,c]=w.useState(void 0);return Rn(()=>{if(l){c({width:l.offsetWidth,height:l.offsetHeight});const u=new ResizeObserver(f=>{if(!Array.isArray(f)||!f.length)return;const m=f[0];let g,v;if("borderBoxSize"in m){const x=m.borderBoxSize,p=Array.isArray(x)?x[0]:x;g=p.inlineSize,v=p.blockSize}else g=l.offsetWidth,v=l.offsetHeight;c({width:g,height:v})});return u.observe(l,{box:"border-box"}),()=>u.unobserve(l)}else c(void 0)},[l]),o}var Zu="Popper",[t0,a0]=Bu(Zu),[lb,n0]=t0(Zu),s0=l=>{const{__scopePopper:o,children:c}=l,[u,f]=w.useState(null);return s.jsx(lb,{scope:o,anchor:u,onAnchorChange:f,children:c})};s0.displayName=Zu;var l0="PopperAnchor",r0=w.forwardRef((l,o)=>{const{__scopePopper:c,virtualRef:u,...f}=l,m=n0(l0,c),g=w.useRef(null),v=sn(o,g),x=w.useRef(null);return w.useEffect(()=>{const p=x.current;x.current=u?.current||g.current,p!==x.current&&m.onAnchorChange(x.current)}),u?null:s.jsx(Ra.div,{...f,ref:v})});r0.displayName=l0;var Ku="PopperContent",[rb,ob]=t0(Ku),o0=w.forwardRef((l,o)=>{const{__scopePopper:c,side:u="bottom",sideOffset:f=0,align:m="center",alignOffset:g=0,arrowPadding:v=0,avoidCollisions:x=!0,collisionBoundary:p=[],collisionPadding:b=0,sticky:h="partial",hideWhenDetached:N=!1,updatePositionStrategy:E="optimized",onPlaced:A,...U}=l,G=n0(Ku,c),[T,K]=w.useState(null),q=sn(o,ue=>K(ue)),[F,ae]=w.useState(null),te=e0(F),_=te?.width??0,L=te?.height??0,Y=u+(m!=="center"?"-"+m:""),z=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},se=Array.isArray(p)?p:[p],ie=se.length>0,O={padding:z,boundary:se.filter(cb),altBoundary:ie},{refs:ne,floatingStyles:oe,placement:k,isPositioned:V,middlewareData:B}=Ky({strategy:"fixed",placement:Y,whileElementsMounted:(...ue)=>Hy(...ue,{animationFrame:E==="always"}),elements:{reference:G.anchor},middleware:[Fy({mainAxis:f+L,alignmentAxis:g}),x&&Wy({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Py():void 0,...O}),x&&Iy({...O}),eb({...O,apply:({elements:ue,rects:we,availableWidth:Te,availableHeight:We})=>{const{width:it,height:qe}=we.reference,P=ue.floating.style;P.setProperty("--radix-popper-available-width",`${Te}px`),P.setProperty("--radix-popper-available-height",`${We}px`),P.setProperty("--radix-popper-anchor-width",`${it}px`),P.setProperty("--radix-popper-anchor-height",`${qe}px`)}}),F&&ab({element:F,padding:v}),ub({arrowWidth:_,arrowHeight:L}),N&&tb({strategy:"referenceHidden",...O})]}),[ce,ge]=u0(k),S=Yo(A);Rn(()=>{V&&S?.()},[V,S]);const Q=B.arrow?.x,$=B.arrow?.y,ee=B.arrow?.centerOffset!==0,[re,xe]=w.useState();return Rn(()=>{T&&xe(window.getComputedStyle(T).zIndex)},[T]),s.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:V?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:l.dir,children:s.jsx(rb,{scope:c,placedSide:ce,onArrowChange:ae,arrowX:Q,arrowY:$,shouldHideArrow:ee,children:s.jsx(Ra.div,{"data-side":ce,"data-align":ge,...U,ref:q,style:{...U.style,animation:V?void 0:"none"}})})})});o0.displayName=Ku;var i0="PopperArrow",ib={top:"bottom",right:"left",bottom:"top",left:"right"},c0=w.forwardRef(function(o,c){const{__scopePopper:u,...f}=o,m=ob(i0,u),g=ib[m.placedSide];return s.jsx("span",{ref:m.onArrowChange,style:{position:"absolute",left:m.arrowX,top:m.arrowY,[g]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[m.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[m.placedSide],visibility:m.shouldHideArrow?"hidden":void 0},children:s.jsx(sb,{...f,ref:c,style:{...f.style,display:"block"}})})});c0.displayName=i0;function cb(l){return l!==null}var ub=l=>({name:"transformOrigin",options:l,fn(o){const{placement:c,rects:u,middlewareData:f}=o,g=f.arrow?.centerOffset!==0,v=g?0:l.arrowWidth,x=g?0:l.arrowHeight,[p,b]=u0(c),h={start:"0%",center:"50%",end:"100%"}[b],N=(f.arrow?.x??0)+v/2,E=(f.arrow?.y??0)+x/2;let A="",U="";return p==="bottom"?(A=g?h:`${N}px`,U=`${-x}px`):p==="top"?(A=g?h:`${N}px`,U=`${u.floating.height+x}px`):p==="right"?(A=`${-x}px`,U=g?h:`${E}px`):p==="left"&&(A=`${u.floating.width+x}px`,U=g?h:`${E}px`),{data:{x:A,y:U}}}});function u0(l){const[o,c="center"]=l.split("-");return[o,c]}var db=s0,fb=r0,mb=o0,hb=c0,pb="Portal",d0=w.forwardRef((l,o)=>{const{container:c,...u}=l,[f,m]=w.useState(!1);Rn(()=>m(!0),[]);const g=c||f&&globalThis?.document?.body;return g?Hp.createPortal(s.jsx(Ra.div,{...u,ref:o}),g):null});d0.displayName=pb;function gb(l,o){return w.useReducer((c,u)=>o[c][u]??c,l)}var Ju=l=>{const{present:o,children:c}=l,u=xb(o),f=typeof c=="function"?c({present:u.isPresent}):w.Children.only(c),m=sn(u.ref,vb(f));return typeof c=="function"||u.isPresent?w.cloneElement(f,{ref:m}):null};Ju.displayName="Presence";function xb(l){const[o,c]=w.useState(),u=w.useRef(null),f=w.useRef(l),m=w.useRef("none"),g=l?"mounted":"unmounted",[v,x]=gb(g,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=_o(u.current);m.current=v==="mounted"?p:"none"},[v]),Rn(()=>{const p=u.current,b=f.current;if(b!==l){const N=m.current,E=_o(p);l?x("MOUNT"):E==="none"||p?.display==="none"?x("UNMOUNT"):x(b&&N!==E?"ANIMATION_OUT":"UNMOUNT"),f.current=l}},[l,x]),Rn(()=>{if(o){let p;const b=o.ownerDocument.defaultView??window,h=E=>{const U=_o(u.current).includes(CSS.escape(E.animationName));if(E.target===o&&U&&(x("ANIMATION_END"),!f.current)){const G=o.style.animationFillMode;o.style.animationFillMode="forwards",p=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=G)})}},N=E=>{E.target===o&&(m.current=_o(u.current))};return o.addEventListener("animationstart",N),o.addEventListener("animationcancel",h),o.addEventListener("animationend",h),()=>{b.clearTimeout(p),o.removeEventListener("animationstart",N),o.removeEventListener("animationcancel",h),o.removeEventListener("animationend",h)}}else x("ANIMATION_END")},[o,x]),{isPresent:["mounted","unmountSuspended"].includes(v),ref:w.useCallback(p=>{u.current=p?getComputedStyle(p):null,c(p)},[])}}function _o(l){return l?.animationName||"none"}function vb(l){let o=Object.getOwnPropertyDescriptor(l.props,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning;return c?l.ref:(o=Object.getOwnPropertyDescriptor(l,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}var yb=Symbol("radix.slottable");function bb(l){const o=({children:c})=>s.jsx(s.Fragment,{children:c});return o.displayName=`${l}.Slottable`,o.__radixId=yb,o}var wb=Uu[" useInsertionEffect ".trim().toString()]||Rn;function f0({prop:l,defaultProp:o,onChange:c=()=>{},caller:u}){const[f,m,g]=Nb({defaultProp:o,onChange:c}),v=l!==void 0,x=v?l:f;{const b=w.useRef(l!==void 0);w.useEffect(()=>{const h=b.current;h!==v&&console.warn(`${u} is changing from ${h?"controlled":"uncontrolled"} to ${v?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=v},[v,u])}const p=w.useCallback(b=>{if(v){const h=jb(b)?b(l):b;h!==l&&g.current?.(h)}else m(b)},[v,l,m,g]);return[x,p]}function Nb({defaultProp:l,onChange:o}){const[c,u]=w.useState(l),f=w.useRef(c),m=w.useRef(o);return wb(()=>{m.current=o},[o]),w.useEffect(()=>{f.current!==c&&(m.current?.(c),f.current=c)},[c,f]),[c,u,m]}function jb(l){return typeof l=="function"}var Sb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),_b="VisuallyHidden",m0=w.forwardRef((l,o)=>s.jsx(Ra.span,{...l,ref:o,style:{...Sb,...l.style}}));m0.displayName=_b;var Eb=m0,[Qo]=Bu("Tooltip",[a0]),Zo=a0(),h0="TooltipProvider",Cb=700,Eu="tooltip.open",[Tb,Fu]=Qo(h0),p0=l=>{const{__scopeTooltip:o,delayDuration:c=Cb,skipDelayDuration:u=300,disableHoverableContent:f=!1,children:m}=l,g=w.useRef(!0),v=w.useRef(!1),x=w.useRef(0);return w.useEffect(()=>{const p=x.current;return()=>window.clearTimeout(p)},[]),s.jsx(Tb,{scope:o,isOpenDelayedRef:g,delayDuration:c,onOpen:w.useCallback(()=>{window.clearTimeout(x.current),g.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>g.current=!0,u)},[u]),isPointerInTransitRef:v,onPointerInTransitChange:w.useCallback(p=>{v.current=p},[]),disableHoverableContent:f,children:m})};p0.displayName=h0;var rr="Tooltip",[kb,ir]=Qo(rr),g0=l=>{const{__scopeTooltip:o,children:c,open:u,defaultOpen:f,onOpenChange:m,disableHoverableContent:g,delayDuration:v}=l,x=Fu(rr,l.__scopeTooltip),p=Zo(o),[b,h]=w.useState(null),N=Qv(),E=w.useRef(0),A=g??x.disableHoverableContent,U=v??x.delayDuration,G=w.useRef(!1),[T,K]=f0({prop:u,defaultProp:f??!1,onChange:_=>{_?(x.onOpen(),document.dispatchEvent(new CustomEvent(Eu))):x.onClose(),m?.(_)},caller:rr}),q=w.useMemo(()=>T?G.current?"delayed-open":"instant-open":"closed",[T]),F=w.useCallback(()=>{window.clearTimeout(E.current),E.current=0,G.current=!1,K(!0)},[K]),ae=w.useCallback(()=>{window.clearTimeout(E.current),E.current=0,K(!1)},[K]),te=w.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{G.current=!0,K(!0),E.current=0},U)},[U,K]);return w.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),s.jsx(db,{...p,children:s.jsx(kb,{scope:o,contentId:N,open:T,stateAttribute:q,trigger:b,onTriggerChange:h,onTriggerEnter:w.useCallback(()=>{x.isOpenDelayedRef.current?te():F()},[x.isOpenDelayedRef,te,F]),onTriggerLeave:w.useCallback(()=>{A?ae():(window.clearTimeout(E.current),E.current=0)},[ae,A]),onOpen:F,onClose:ae,disableHoverableContent:A,children:c})})};g0.displayName=rr;var Cu="TooltipTrigger",x0=w.forwardRef((l,o)=>{const{__scopeTooltip:c,...u}=l,f=ir(Cu,c),m=Fu(Cu,c),g=Zo(c),v=w.useRef(null),x=sn(o,v,f.onTriggerChange),p=w.useRef(!1),b=w.useRef(!1),h=w.useCallback(()=>p.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(fb,{asChild:!0,...g,children:s.jsx(Ra.button,{"aria-describedby":f.open?f.contentId:void 0,"data-state":f.stateAttribute,...u,ref:x,onPointerMove:Aa(l.onPointerMove,N=>{N.pointerType!=="touch"&&!b.current&&!m.isPointerInTransitRef.current&&(f.onTriggerEnter(),b.current=!0)}),onPointerLeave:Aa(l.onPointerLeave,()=>{f.onTriggerLeave(),b.current=!1}),onPointerDown:Aa(l.onPointerDown,()=>{f.open&&f.onClose(),p.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Aa(l.onFocus,()=>{p.current||f.onOpen()}),onBlur:Aa(l.onBlur,f.onClose),onClick:Aa(l.onClick,f.onClose)})})});x0.displayName=Cu;var Wu="TooltipPortal",[Ab,Mb]=Qo(Wu,{forceMount:void 0}),v0=l=>{const{__scopeTooltip:o,forceMount:c,children:u,container:f}=l,m=ir(Wu,o);return s.jsx(Ab,{scope:o,forceMount:c,children:s.jsx(Ju,{present:c||m.open,children:s.jsx(d0,{asChild:!0,container:f,children:u})})})};v0.displayName=Wu;var el="TooltipContent",y0=w.forwardRef((l,o)=>{const c=Mb(el,l.__scopeTooltip),{forceMount:u=c.forceMount,side:f="top",...m}=l,g=ir(el,l.__scopeTooltip);return s.jsx(Ju,{present:u||g.open,children:g.disableHoverableContent?s.jsx(b0,{side:f,...m,ref:o}):s.jsx(Ob,{side:f,...m,ref:o})})}),Ob=w.forwardRef((l,o)=>{const c=ir(el,l.__scopeTooltip),u=Fu(el,l.__scopeTooltip),f=w.useRef(null),m=sn(o,f),[g,v]=w.useState(null),{trigger:x,onClose:p}=c,b=f.current,{onPointerInTransitChange:h}=u,N=w.useCallback(()=>{v(null),h(!1)},[h]),E=w.useCallback((A,U)=>{const G=A.currentTarget,T={x:A.clientX,y:A.clientY},K=Lb(T,G.getBoundingClientRect()),q=Ub(T,K),F=Hb(U.getBoundingClientRect()),ae=qb([...q,...F]);v(ae),h(!0)},[h]);return w.useEffect(()=>()=>N(),[N]),w.useEffect(()=>{if(x&&b){const A=G=>E(G,b),U=G=>E(G,x);return x.addEventListener("pointerleave",A),b.addEventListener("pointerleave",U),()=>{x.removeEventListener("pointerleave",A),b.removeEventListener("pointerleave",U)}}},[x,b,E,N]),w.useEffect(()=>{if(g){const A=U=>{const G=U.target,T={x:U.clientX,y:U.clientY},K=x?.contains(G)||b?.contains(G),q=!Bb(T,g);K?N():q&&(N(),p())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[x,b,g,p,N]),s.jsx(b0,{...l,ref:m})}),[zb,Rb]=Qo(rr,{isInside:!1}),Db=bb("TooltipContent"),b0=w.forwardRef((l,o)=>{const{__scopeTooltip:c,children:u,"aria-label":f,onEscapeKeyDown:m,onPointerDownOutside:g,...v}=l,x=ir(el,c),p=Zo(c),{onClose:b}=x;return w.useEffect(()=>(document.addEventListener(Eu,b),()=>document.removeEventListener(Eu,b)),[b]),w.useEffect(()=>{if(x.trigger){const h=N=>{N.target?.contains(x.trigger)&&b()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[x.trigger,b]),s.jsx(qp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:m,onPointerDownOutside:g,onFocusOutside:h=>h.preventDefault(),onDismiss:b,children:s.jsxs(mb,{"data-state":x.stateAttribute,...p,...v,ref:o,style:{...v.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(Db,{children:u}),s.jsx(zb,{scope:c,isInside:!0,children:s.jsx(Eb,{id:x.contentId,role:"tooltip",children:f||u})})]})})});y0.displayName=el;var w0="TooltipArrow",N0=w.forwardRef((l,o)=>{const{__scopeTooltip:c,...u}=l,f=Zo(c);return Rb(w0,c).isInside?null:s.jsx(hb,{...f,...u,ref:o})});N0.displayName=w0;function Lb(l,o){const c=Math.abs(o.top-l.y),u=Math.abs(o.bottom-l.y),f=Math.abs(o.right-l.x),m=Math.abs(o.left-l.x);switch(Math.min(c,u,f,m)){case m:return"left";case f:return"right";case c:return"top";case u:return"bottom";default:throw new Error("unreachable")}}function Ub(l,o,c=5){const u=[];switch(o){case"top":u.push({x:l.x-c,y:l.y+c},{x:l.x+c,y:l.y+c});break;case"bottom":u.push({x:l.x-c,y:l.y-c},{x:l.x+c,y:l.y-c});break;case"left":u.push({x:l.x+c,y:l.y-c},{x:l.x+c,y:l.y+c});break;case"right":u.push({x:l.x-c,y:l.y-c},{x:l.x-c,y:l.y+c});break}return u}function Hb(l){const{top:o,right:c,bottom:u,left:f}=l;return[{x:f,y:o},{x:c,y:o},{x:c,y:u},{x:f,y:u}]}function Bb(l,o){const{x:c,y:u}=l;let f=!1;for(let m=0,g=o.length-1;mu!=N>u&&c<(h-p)*(u-b)/(N-b)+p&&(f=!f)}return f}function qb(l){const o=l.slice();return o.sort((c,u)=>c.xu.x?1:c.yu.y?1:0),Yb(o)}function Yb(l){if(l.length<=1)return l.slice();const o=[];for(let u=0;u=2;){const m=o[o.length-1],g=o[o.length-2];if((m.x-g.x)*(f.y-g.y)>=(m.y-g.y)*(f.x-g.x))o.pop();else break}o.push(f)}o.pop();const c=[];for(let u=l.length-1;u>=0;u--){const f=l[u];for(;c.length>=2;){const m=c[c.length-1],g=c[c.length-2];if((m.x-g.x)*(f.y-g.y)>=(m.y-g.y)*(f.x-g.x))c.pop();else break}c.push(f)}return c.pop(),o.length===1&&c.length===1&&o[0].x===c[0].x&&o[0].y===c[0].y?o:o.concat(c)}var Gb=p0,Vb=g0,Xb=x0,$b=v0,Qb=y0,Zb=N0;function j0(l){var o,c,u="";if(typeof l=="string"||typeof l=="number")u+=l;else if(typeof l=="object")if(Array.isArray(l)){var f=l.length;for(o=0;o{const c=new Array(l.length+o.length);for(let u=0;u({classGroupId:l,validator:o}),_0=(l=new Map,o=null,c)=>({nextPart:l,validators:o,classGroupId:c}),Lo="-",xp=[],Fb="arbitrary..",Wb=l=>{const o=Ib(l),{conflictingClassGroups:c,conflictingClassGroupModifiers:u}=l;return{getClassGroupId:g=>{if(g.startsWith("[")&&g.endsWith("]"))return Pb(g);const v=g.split(Lo),x=v[0]===""&&v.length>1?1:0;return E0(v,x,o)},getConflictingClassGroupIds:(g,v)=>{if(v){const x=u[g],p=c[g];return x?p?Kb(p,x):x:p||xp}return c[g]||xp}}},E0=(l,o,c)=>{if(l.length-o===0)return c.classGroupId;const f=l[o],m=c.nextPart.get(f);if(m){const p=E0(l,o+1,m);if(p)return p}const g=c.validators;if(g===null)return;const v=o===0?l.join(Lo):l.slice(o).join(Lo),x=g.length;for(let p=0;pl.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=l.slice(1,-1),c=o.indexOf(":"),u=o.slice(0,c);return u?Fb+u:void 0})(),Ib=l=>{const{theme:o,classGroups:c}=l;return e1(c,o)},e1=(l,o)=>{const c=_0();for(const u in l){const f=l[u];Pu(f,c,u,o)}return c},Pu=(l,o,c,u)=>{const f=l.length;for(let m=0;m{if(typeof l=="string"){a1(l,o,c);return}if(typeof l=="function"){n1(l,o,c,u);return}s1(l,o,c,u)},a1=(l,o,c)=>{const u=l===""?o:C0(o,l);u.classGroupId=c},n1=(l,o,c,u)=>{if(l1(l)){Pu(l(u),o,c,u);return}o.validators===null&&(o.validators=[]),o.validators.push(Jb(c,l))},s1=(l,o,c,u)=>{const f=Object.entries(l),m=f.length;for(let g=0;g{let c=l;const u=o.split(Lo),f=u.length;for(let m=0;m"isThemeGetter"in l&&l.isThemeGetter===!0,r1=l=>{if(l<1)return{get:()=>{},set:()=>{}};let o=0,c=Object.create(null),u=Object.create(null);const f=(m,g)=>{c[m]=g,o++,o>l&&(o=0,u=c,c=Object.create(null))};return{get(m){let g=c[m];if(g!==void 0)return g;if((g=u[m])!==void 0)return f(m,g),g},set(m,g){m in c?c[m]=g:f(m,g)}}},Tu="!",vp=":",o1=[],yp=(l,o,c,u,f)=>({modifiers:l,hasImportantModifier:o,baseClassName:c,maybePostfixModifierPosition:u,isExternal:f}),i1=l=>{const{prefix:o,experimentalParseClassName:c}=l;let u=f=>{const m=[];let g=0,v=0,x=0,p;const b=f.length;for(let U=0;Ux?p-x:void 0;return yp(m,E,N,A)};if(o){const f=o+vp,m=u;u=g=>g.startsWith(f)?m(g.slice(f.length)):yp(o1,!1,g,void 0,!0)}if(c){const f=u;u=m=>c({className:m,parseClassName:f})}return u},c1=l=>{const o=new Map;return l.orderSensitiveModifiers.forEach((c,u)=>{o.set(c,1e6+u)}),c=>{const u=[];let f=[];for(let m=0;m0&&(f.sort(),u.push(...f),f=[]),u.push(g)):f.push(g)}return f.length>0&&(f.sort(),u.push(...f)),u}},u1=l=>({cache:r1(l.cacheSize),parseClassName:i1(l),sortModifiers:c1(l),...Wb(l)}),d1=/\s+/,f1=(l,o)=>{const{parseClassName:c,getClassGroupId:u,getConflictingClassGroupIds:f,sortModifiers:m}=o,g=[],v=l.trim().split(d1);let x="";for(let p=v.length-1;p>=0;p-=1){const b=v[p],{isExternal:h,modifiers:N,hasImportantModifier:E,baseClassName:A,maybePostfixModifierPosition:U}=c(b);if(h){x=b+(x.length>0?" "+x:x);continue}let G=!!U,T=u(G?A.substring(0,U):A);if(!T){if(!G){x=b+(x.length>0?" "+x:x);continue}if(T=u(A),!T){x=b+(x.length>0?" "+x:x);continue}G=!1}const K=N.length===0?"":N.length===1?N[0]:m(N).join(":"),q=E?K+Tu:K,F=q+T;if(g.indexOf(F)>-1)continue;g.push(F);const ae=f(T,G);for(let te=0;te0?" "+x:x)}return x},m1=(...l)=>{let o=0,c,u,f="";for(;o{if(typeof l=="string")return l;let o,c="";for(let u=0;u{let c,u,f,m;const g=x=>{const p=o.reduce((b,h)=>h(b),l());return c=u1(p),u=c.cache.get,f=c.cache.set,m=v,v(x)},v=x=>{const p=u(x);if(p)return p;const b=f1(x,c);return f(x,b),b};return m=g,(...x)=>m(m1(...x))},p1=[],ut=l=>{const o=c=>c[l]||p1;return o.isThemeGetter=!0,o},k0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,A0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,g1=/^\d+\/\d+$/,x1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,v1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,y1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,b1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,w1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fs=l=>g1.test(l),ke=l=>!!l&&!Number.isNaN(Number(l)),zn=l=>!!l&&Number.isInteger(Number(l)),xu=l=>l.endsWith("%")&&ke(l.slice(0,-1)),tn=l=>x1.test(l),N1=()=>!0,j1=l=>v1.test(l)&&!y1.test(l),M0=()=>!1,S1=l=>b1.test(l),_1=l=>w1.test(l),E1=l=>!me(l)&&!he(l),C1=l=>rl(l,R0,M0),me=l=>k0.test(l),ls=l=>rl(l,D0,j1),vu=l=>rl(l,O1,ke),bp=l=>rl(l,O0,M0),T1=l=>rl(l,z0,_1),Eo=l=>rl(l,L0,S1),he=l=>A0.test(l),nr=l=>ol(l,D0),k1=l=>ol(l,z1),wp=l=>ol(l,O0),A1=l=>ol(l,R0),M1=l=>ol(l,z0),Co=l=>ol(l,L0,!0),rl=(l,o,c)=>{const u=k0.exec(l);return u?u[1]?o(u[1]):c(u[2]):!1},ol=(l,o,c=!1)=>{const u=A0.exec(l);return u?u[1]?o(u[1]):c:!1},O0=l=>l==="position"||l==="percentage",z0=l=>l==="image"||l==="url",R0=l=>l==="length"||l==="size"||l==="bg-size",D0=l=>l==="length",O1=l=>l==="number",z1=l=>l==="family-name",L0=l=>l==="shadow",R1=()=>{const l=ut("color"),o=ut("font"),c=ut("text"),u=ut("font-weight"),f=ut("tracking"),m=ut("leading"),g=ut("breakpoint"),v=ut("container"),x=ut("spacing"),p=ut("radius"),b=ut("shadow"),h=ut("inset-shadow"),N=ut("text-shadow"),E=ut("drop-shadow"),A=ut("blur"),U=ut("perspective"),G=ut("aspect"),T=ut("ease"),K=ut("animate"),q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ae=()=>[...F(),he,me],te=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],L=()=>[he,me,x],Y=()=>[Fs,"full","auto",...L()],z=()=>[zn,"none","subgrid",he,me],se=()=>["auto",{span:["full",zn,he,me]},zn,he,me],ie=()=>[zn,"auto",he,me],O=()=>["auto","min","max","fr",he,me],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],oe=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...L()],V=()=>[Fs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],B=()=>[l,he,me],ce=()=>[...F(),wp,bp,{position:[he,me]}],ge=()=>["no-repeat",{repeat:["","x","y","space","round"]}],S=()=>["auto","cover","contain",A1,C1,{size:[he,me]}],Q=()=>[xu,nr,ls],$=()=>["","none","full",p,he,me],ee=()=>["",ke,nr,ls],re=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[ke,xu,wp,bp],we=()=>["","none",A,he,me],Te=()=>["none",ke,he,me],We=()=>["none",ke,he,me],it=()=>[ke,he,me],qe=()=>[Fs,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tn],breakpoint:[tn],color:[N1],container:[tn],"drop-shadow":[tn],ease:["in","out","in-out"],font:[E1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tn],shadow:[tn],spacing:["px",ke],text:[tn],"text-shadow":[tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Fs,me,he,G]}],container:["container"],columns:[{columns:[ke,me,he,v]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:ae()}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{start:Y()}],end:[{end:Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[zn,"auto",he,me]}],basis:[{basis:[Fs,"full","auto",v,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ke,Fs,"auto","initial","none",me]}],grow:[{grow:["",ke,he,me]}],shrink:[{shrink:["",ke,he,me]}],order:[{order:[zn,"first","last","none",he,me]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:se()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:se()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...oe()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...oe(),"baseline"]}],"place-self":[{"place-self":["auto",...oe()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[v,"screen",...V()]}],"min-w":[{"min-w":[v,"screen","none",...V()]}],"max-w":[{"max-w":[v,"screen","none","prose",{screen:[g]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",c,nr,ls]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[u,he,vu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xu,me]}],"font-family":[{font:[k1,me,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[f,he,me]}],"line-clamp":[{"line-clamp":[ke,"none",he,vu]}],leading:[{leading:[m,...L()]}],"list-image":[{"list-image":["none",he,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[ke,"from-font","auto",he,ls]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[ke,"auto",he,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",he,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:ge()}],"bg-size":[{bg:S()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zn,he,me],radial:["",he,me],conic:[zn,he,me]},M1,T1]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ke,he,me]}],"outline-w":[{outline:["",ke,nr,ls]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",b,Co,Eo]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",h,Co,Eo]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[ke,ls]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",N,Co,Eo]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[ke,he,me]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[he,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":F()}],"mask-image-conic-pos":[{"mask-conic":[ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:ge()}],"mask-size":[{mask:S()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,me]}],filter:[{filter:["","none",he,me]}],blur:[{blur:we()}],brightness:[{brightness:[ke,he,me]}],contrast:[{contrast:[ke,he,me]}],"drop-shadow":[{"drop-shadow":["","none",E,Co,Eo]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",ke,he,me]}],"hue-rotate":[{"hue-rotate":[ke,he,me]}],invert:[{invert:["",ke,he,me]}],saturate:[{saturate:[ke,he,me]}],sepia:[{sepia:["",ke,he,me]}],"backdrop-filter":[{"backdrop-filter":["","none",he,me]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[ke,he,me]}],"backdrop-contrast":[{"backdrop-contrast":[ke,he,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ke,he,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ke,he,me]}],"backdrop-invert":[{"backdrop-invert":["",ke,he,me]}],"backdrop-opacity":[{"backdrop-opacity":[ke,he,me]}],"backdrop-saturate":[{"backdrop-saturate":[ke,he,me]}],"backdrop-sepia":[{"backdrop-sepia":["",ke,he,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ke,"initial",he,me]}],ease:[{ease:["linear","initial",T,he,me]}],delay:[{delay:[ke,he,me]}],animate:[{animate:["none",K,he,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[U,he,me]}],"perspective-origin":[{"perspective-origin":ae()}],rotate:[{rotate:Te()}],"rotate-x":[{"rotate-x":Te()}],"rotate-y":[{"rotate-y":Te()}],"rotate-z":[{"rotate-z":Te()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:it()}],"skew-x":[{"skew-x":it()}],"skew-y":[{"skew-y":it()}],transform:[{transform:[he,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:ae()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",he,me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,me]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[ke,nr,ls,vu]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},D1=h1(R1);function je(...l){return D1(S0(l))}function U0({delayDuration:l=0,...o}){return s.jsx(Gb,{"data-slot":"tooltip-provider",delayDuration:l,...o})}function xa({...l}){return s.jsx(U0,{children:s.jsx(Vb,{"data-slot":"tooltip",...l})})}function va({...l}){return s.jsx(Xb,{"data-slot":"tooltip-trigger",...l})}function ya({className:l,sideOffset:o=0,children:c,...u}){return s.jsx($b,{children:s.jsxs(Qb,{"data-slot":"tooltip-content",sideOffset:o,className:je("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",l),...u,children:[c,s.jsx(Zb,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function L1(l){if(typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css",o.appendChild(c),c.styleSheet?c.styleSheet.cssText=l:c.appendChild(document.createTextNode(l))}const U1=l=>{switch(l){case"success":return q1;case"info":return G1;case"warning":return Y1;case"error":return V1;default:return null}},H1=Array(12).fill(0),B1=({visible:l,className:o})=>le.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":l},le.createElement("div",{className:"sonner-spinner"},H1.map((c,u)=>le.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${u}`})))),q1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Y1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),G1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),V1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),X1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},le.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),le.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),$1=()=>{const[l,o]=le.useState(document.hidden);return le.useEffect(()=>{const c=()=>{o(document.hidden)};return document.addEventListener("visibilitychange",c),()=>window.removeEventListener("visibilitychange",c)},[]),l};let ku=1;class Q1{constructor(){this.subscribe=o=>(this.subscribers.push(o),()=>{const c=this.subscribers.indexOf(o);this.subscribers.splice(c,1)}),this.publish=o=>{this.subscribers.forEach(c=>c(o))},this.addToast=o=>{this.publish(o),this.toasts=[...this.toasts,o]},this.create=o=>{var c;const{message:u,...f}=o,m=typeof o?.id=="number"||((c=o.id)==null?void 0:c.length)>0?o.id:ku++,g=this.toasts.find(x=>x.id===m),v=o.dismissible===void 0?!0:o.dismissible;return this.dismissedToasts.has(m)&&this.dismissedToasts.delete(m),g?this.toasts=this.toasts.map(x=>x.id===m?(this.publish({...x,...o,id:m,title:u}),{...x,...o,id:m,dismissible:v,title:u}):x):this.addToast({title:u,...f,dismissible:v,id:m}),m},this.dismiss=o=>(o?(this.dismissedToasts.add(o),requestAnimationFrame(()=>this.subscribers.forEach(c=>c({id:o,dismiss:!0})))):this.toasts.forEach(c=>{this.subscribers.forEach(u=>u({id:c.id,dismiss:!0}))}),o),this.message=(o,c)=>this.create({...c,message:o}),this.error=(o,c)=>this.create({...c,message:o,type:"error"}),this.success=(o,c)=>this.create({...c,type:"success",message:o}),this.info=(o,c)=>this.create({...c,type:"info",message:o}),this.warning=(o,c)=>this.create({...c,type:"warning",message:o}),this.loading=(o,c)=>this.create({...c,type:"loading",message:o}),this.promise=(o,c)=>{if(!c)return;let u;c.loading!==void 0&&(u=this.create({...c,promise:o,type:"loading",message:c.loading,description:typeof c.description!="function"?c.description:void 0}));const f=Promise.resolve(o instanceof Function?o():o);let m=u!==void 0,g;const v=f.then(async p=>{if(g=["resolve",p],le.isValidElement(p))m=!1,this.create({id:u,type:"default",message:p});else if(K1(p)&&!p.ok){m=!1;const h=typeof c.error=="function"?await c.error(`HTTP error! status: ${p.status}`):c.error,N=typeof c.description=="function"?await c.description(`HTTP error! status: ${p.status}`):c.description,A=typeof h=="object"&&!le.isValidElement(h)?h:{message:h};this.create({id:u,type:"error",description:N,...A})}else if(p instanceof Error){m=!1;const h=typeof c.error=="function"?await c.error(p):c.error,N=typeof c.description=="function"?await c.description(p):c.description,A=typeof h=="object"&&!le.isValidElement(h)?h:{message:h};this.create({id:u,type:"error",description:N,...A})}else if(c.success!==void 0){m=!1;const h=typeof c.success=="function"?await c.success(p):c.success,N=typeof c.description=="function"?await c.description(p):c.description,A=typeof h=="object"&&!le.isValidElement(h)?h:{message:h};this.create({id:u,type:"success",description:N,...A})}}).catch(async p=>{if(g=["reject",p],c.error!==void 0){m=!1;const b=typeof c.error=="function"?await c.error(p):c.error,h=typeof c.description=="function"?await c.description(p):c.description,E=typeof b=="object"&&!le.isValidElement(b)?b:{message:b};this.create({id:u,type:"error",description:h,...E})}}).finally(()=>{m&&(this.dismiss(u),u=void 0),c.finally==null||c.finally.call(c)}),x=()=>new Promise((p,b)=>v.then(()=>g[0]==="reject"?b(g[1]):p(g[1])).catch(b));return typeof u!="string"&&typeof u!="number"?{unwrap:x}:Object.assign(u,{unwrap:x})},this.custom=(o,c)=>{const u=c?.id||ku++;return this.create({jsx:o(u),id:u,...c}),u},this.getActiveToasts=()=>this.toasts.filter(o=>!this.dismissedToasts.has(o.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Gt=new Q1,Z1=(l,o)=>{const c=o?.id||ku++;return Gt.addToast({title:l,...o,id:c}),c},K1=l=>l&&typeof l=="object"&&"ok"in l&&typeof l.ok=="boolean"&&"status"in l&&typeof l.status=="number",J1=Z1,F1=()=>Gt.toasts,W1=()=>Gt.getActiveToasts(),yt=Object.assign(J1,{success:Gt.success,info:Gt.info,warning:Gt.warning,error:Gt.error,custom:Gt.custom,message:Gt.message,promise:Gt.promise,dismiss:Gt.dismiss,loading:Gt.loading},{getHistory:F1,getToasts:W1});L1("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function To(l){return l.label!==void 0}const P1=3,I1="24px",e2="16px",Np=4e3,t2=356,a2=14,n2=45,s2=200;function ka(...l){return l.filter(Boolean).join(" ")}function l2(l){const[o,c]=l.split("-"),u=[];return o&&u.push(o),c&&u.push(c),u}const r2=l=>{var o,c,u,f,m,g,v,x,p;const{invert:b,toast:h,unstyled:N,interacting:E,setHeights:A,visibleToasts:U,heights:G,index:T,toasts:K,expanded:q,removeToast:F,defaultRichColors:ae,closeButton:te,style:_,cancelButtonStyle:L,actionButtonStyle:Y,className:z="",descriptionClassName:se="",duration:ie,position:O,gap:ne,expandByDefault:oe,classNames:k,icons:V,closeButtonAriaLabel:B="Close toast"}=l,[ce,ge]=le.useState(null),[S,Q]=le.useState(null),[$,ee]=le.useState(!1),[re,xe]=le.useState(!1),[ue,we]=le.useState(!1),[Te,We]=le.useState(!1),[it,qe]=le.useState(!1),[P,Ye]=le.useState(0),[Z,ve]=le.useState(0),at=le.useRef(h.duration||ie||Np),_t=le.useRef(null),Xt=le.useRef(null),il=T===0,cl=T+1<=U,Et=h.type,ln=h.dismissible!==!1,Ct=h.className||"",Wo=h.descriptionClassName||"",Un=le.useMemo(()=>G.findIndex(Se=>Se.toastId===h.id)||0,[G,h.id]),cr=le.useMemo(()=>{var Se;return(Se=h.closeButton)!=null?Se:te},[h.closeButton,te]),Hn=le.useMemo(()=>h.duration||ie||Np,[h.duration,ie]),ul=le.useRef(0),La=le.useRef(0),ur=le.useRef(0),rn=le.useRef(null),[Bn,Tt]=O.split("-"),fa=le.useMemo(()=>G.reduce((Se,Ke,dt)=>dt>=Un?Se:Se+Ke.height,0),[G,Un]),bt=$1(),Po=h.invert||b,dl=Et==="loading";La.current=le.useMemo(()=>Un*ne+fa,[Un,fa]),le.useEffect(()=>{at.current=Hn},[Hn]),le.useEffect(()=>{ee(!0)},[]),le.useEffect(()=>{const Se=Xt.current;if(Se){const Ke=Se.getBoundingClientRect().height;return ve(Ke),A(dt=>[{toastId:h.id,height:Ke,position:h.position},...dt]),()=>A(dt=>dt.filter(wt=>wt.toastId!==h.id))}},[A,h.id]),le.useLayoutEffect(()=>{if(!$)return;const Se=Xt.current,Ke=Se.style.height;Se.style.height="auto";const dt=Se.getBoundingClientRect().height;Se.style.height=Ke,ve(dt),A(wt=>wt.find(Fe=>Fe.toastId===h.id)?wt.map(Fe=>Fe.toastId===h.id?{...Fe,height:dt}:Fe):[{toastId:h.id,height:dt,position:h.position},...wt])},[$,h.title,h.description,A,h.id,h.jsx,h.action,h.cancel]);const ja=le.useCallback(()=>{xe(!0),Ye(La.current),A(Se=>Se.filter(Ke=>Ke.toastId!==h.id)),setTimeout(()=>{F(h)},s2)},[h,F,A,La]);le.useEffect(()=>{if(h.promise&&Et==="loading"||h.duration===1/0||h.type==="loading")return;let Se;return q||E||bt?(()=>{if(ur.current{h.onAutoClose==null||h.onAutoClose.call(h,h),ja()},at.current)),()=>clearTimeout(Se)},[q,E,h,Et,bt,ja]),le.useEffect(()=>{h.delete&&(ja(),h.onDismiss==null||h.onDismiss.call(h,h))},[ja,h.delete]);function cs(){var Se;if(V?.loading){var Ke;return le.createElement("div",{className:ka(k?.loader,h==null||(Ke=h.classNames)==null?void 0:Ke.loader,"sonner-loader"),"data-visible":Et==="loading"},V.loading)}return le.createElement(B1,{className:ka(k?.loader,h==null||(Se=h.classNames)==null?void 0:Se.loader),visible:Et==="loading"})}const us=h.icon||V?.[Et]||U1(Et);var qn,Sa;return le.createElement("li",{tabIndex:0,ref:Xt,className:ka(z,Ct,k?.toast,h==null||(o=h.classNames)==null?void 0:o.toast,k?.default,k?.[Et],h==null||(c=h.classNames)==null?void 0:c[Et]),"data-sonner-toast":"","data-rich-colors":(qn=h.richColors)!=null?qn:ae,"data-styled":!(h.jsx||h.unstyled||N),"data-mounted":$,"data-promise":!!h.promise,"data-swiped":it,"data-removed":re,"data-visible":cl,"data-y-position":Bn,"data-x-position":Tt,"data-index":T,"data-front":il,"data-swiping":ue,"data-dismissible":ln,"data-type":Et,"data-invert":Po,"data-swipe-out":Te,"data-swipe-direction":S,"data-expanded":!!(q||oe&&$),"data-testid":h.testId,style:{"--index":T,"--toasts-before":T,"--z-index":K.length-T,"--offset":`${re?P:La.current}px`,"--initial-height":oe?"auto":`${Z}px`,..._,...h.style},onDragEnd:()=>{we(!1),ge(null),rn.current=null},onPointerDown:Se=>{Se.button!==2&&(dl||!ln||(_t.current=new Date,Ye(La.current),Se.target.setPointerCapture(Se.pointerId),Se.target.tagName!=="BUTTON"&&(we(!0),rn.current={x:Se.clientX,y:Se.clientY})))},onPointerUp:()=>{var Se,Ke,dt;if(Te||!ln)return;rn.current=null;const wt=Number(((Se=Xt.current)==null?void 0:Se.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),on=Number(((Ke=Xt.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Fe=new Date().getTime()-((dt=_t.current)==null?void 0:dt.getTime()),Ot=ce==="x"?wt:on,Yn=Math.abs(Ot)/Fe;if(Math.abs(Ot)>=n2||Yn>.11){Ye(La.current),h.onDismiss==null||h.onDismiss.call(h,h),Q(ce==="x"?wt>0?"right":"left":on>0?"down":"up"),ja(),We(!0);return}else{var zt,Rt;(zt=Xt.current)==null||zt.style.setProperty("--swipe-amount-x","0px"),(Rt=Xt.current)==null||Rt.style.setProperty("--swipe-amount-y","0px")}qe(!1),we(!1),ge(null)},onPointerMove:Se=>{var Ke,dt,wt;if(!rn.current||!ln||((Ke=window.getSelection())==null?void 0:Ke.toString().length)>0)return;const Fe=Se.clientY-rn.current.y,Ot=Se.clientX-rn.current.x;var Yn;const zt=(Yn=l.swipeDirections)!=null?Yn:l2(O);!ce&&(Math.abs(Ot)>1||Math.abs(Fe)>1)&&ge(Math.abs(Ot)>Math.abs(Fe)?"x":"y");let Rt={x:0,y:0};const ds=ma=>1/(1.5+Math.abs(ma)/20);if(ce==="y"){if(zt.includes("top")||zt.includes("bottom"))if(zt.includes("top")&&Fe<0||zt.includes("bottom")&&Fe>0)Rt.y=Fe;else{const ma=Fe*ds(Fe);Rt.y=Math.abs(ma)0)Rt.x=Ot;else{const ma=Ot*ds(Ot);Rt.x=Math.abs(ma)0||Math.abs(Rt.y)>0)&&qe(!0),(dt=Xt.current)==null||dt.style.setProperty("--swipe-amount-x",`${Rt.x}px`),(wt=Xt.current)==null||wt.style.setProperty("--swipe-amount-y",`${Rt.y}px`)}},cr&&!h.jsx&&Et!=="loading"?le.createElement("button",{"aria-label":B,"data-disabled":dl,"data-close-button":!0,onClick:dl||!ln?()=>{}:()=>{ja(),h.onDismiss==null||h.onDismiss.call(h,h)},className:ka(k?.closeButton,h==null||(u=h.classNames)==null?void 0:u.closeButton)},(Sa=V?.close)!=null?Sa:X1):null,(Et||h.icon||h.promise)&&h.icon!==null&&(V?.[Et]!==null||h.icon)?le.createElement("div",{"data-icon":"",className:ka(k?.icon,h==null||(f=h.classNames)==null?void 0:f.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||cs():null,h.type!=="loading"?us:null):null,le.createElement("div",{"data-content":"",className:ka(k?.content,h==null||(m=h.classNames)==null?void 0:m.content)},le.createElement("div",{"data-title":"",className:ka(k?.title,h==null||(g=h.classNames)==null?void 0:g.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?le.createElement("div",{"data-description":"",className:ka(se,Wo,k?.description,h==null||(v=h.classNames)==null?void 0:v.description)},typeof h.description=="function"?h.description():h.description):null),le.isValidElement(h.cancel)?h.cancel:h.cancel&&To(h.cancel)?le.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||L,onClick:Se=>{To(h.cancel)&&ln&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Se),ja())},className:ka(k?.cancelButton,h==null||(x=h.classNames)==null?void 0:x.cancelButton)},h.cancel.label):null,le.isValidElement(h.action)?h.action:h.action&&To(h.action)?le.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||Y,onClick:Se=>{To(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Se),!Se.defaultPrevented&&ja())},className:ka(k?.actionButton,h==null||(p=h.classNames)==null?void 0:p.actionButton)},h.action.label):null)};function jp(){if(typeof window>"u"||typeof document>"u")return"ltr";const l=document.documentElement.getAttribute("dir");return l==="auto"||!l?window.getComputedStyle(document.documentElement).direction:l}function o2(l,o){const c={};return[l,o].forEach((u,f)=>{const m=f===1,g=m?"--mobile-offset":"--offset",v=m?e2:I1;function x(p){["top","right","bottom","left"].forEach(b=>{c[`${g}-${b}`]=typeof p=="number"?`${p}px`:p})}typeof u=="number"||typeof u=="string"?x(u):typeof u=="object"?["top","right","bottom","left"].forEach(p=>{u[p]===void 0?c[`${g}-${p}`]=v:c[`${g}-${p}`]=typeof u[p]=="number"?`${u[p]}px`:u[p]}):x(v)}),c}const i2=le.forwardRef(function(o,c){const{id:u,invert:f,position:m="bottom-right",hotkey:g=["altKey","KeyT"],expand:v,closeButton:x,className:p,offset:b,mobileOffset:h,theme:N="light",richColors:E,duration:A,style:U,visibleToasts:G=P1,toastOptions:T,dir:K=jp(),gap:q=a2,icons:F,containerAriaLabel:ae="Notifications"}=o,[te,_]=le.useState([]),L=le.useMemo(()=>u?te.filter($=>$.toasterId===u):te.filter($=>!$.toasterId),[te,u]),Y=le.useMemo(()=>Array.from(new Set([m].concat(L.filter($=>$.position).map($=>$.position)))),[L,m]),[z,se]=le.useState([]),[ie,O]=le.useState(!1),[ne,oe]=le.useState(!1),[k,V]=le.useState(N!=="system"?N:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=le.useRef(null),ce=g.join("+").replace(/Key/g,"").replace(/Digit/g,""),ge=le.useRef(null),S=le.useRef(!1),Q=le.useCallback($=>{_(ee=>{var re;return(re=ee.find(xe=>xe.id===$.id))!=null&&re.delete||Gt.dismiss($.id),ee.filter(({id:xe})=>xe!==$.id)})},[]);return le.useEffect(()=>Gt.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{_(ee=>ee.map(re=>re.id===$.id?{...re,delete:!0}:re))});return}setTimeout(()=>{Hp.flushSync(()=>{_(ee=>{const re=ee.findIndex(xe=>xe.id===$.id);return re!==-1?[...ee.slice(0,re),{...ee[re],...$},...ee.slice(re+1)]:[$,...ee]})})})}),[te]),le.useEffect(()=>{if(N!=="system"){V(N);return}if(N==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:ee})=>{V(ee?"dark":"light")})}catch{$.addListener(({matches:re})=>{try{V(re?"dark":"light")}catch(xe){console.error(xe)}})}},[N]),le.useEffect(()=>{te.length<=1&&O(!1)},[te]),le.useEffect(()=>{const $=ee=>{var re;if(g.every(we=>ee[we]||ee.code===we)){var ue;O(!0),(ue=B.current)==null||ue.focus()}ee.code==="Escape"&&(document.activeElement===B.current||(re=B.current)!=null&&re.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[g]),le.useEffect(()=>{if(B.current)return()=>{ge.current&&(ge.current.focus({preventScroll:!0}),ge.current=null,S.current=!1)}},[B.current]),le.createElement("section",{ref:c,"aria-label":`${ae} ${ce}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Y.map(($,ee)=>{var re;const[xe,ue]=$.split("-");return L.length?le.createElement("ol",{key:$,dir:K==="auto"?jp():K,tabIndex:-1,ref:B,className:p,"data-sonner-toaster":!0,"data-sonner-theme":k,"data-y-position":xe,"data-x-position":ue,style:{"--front-toast-height":`${((re=z[0])==null?void 0:re.height)||0}px`,"--width":`${t2}px`,"--gap":`${q}px`,...U,...o2(b,h)},onBlur:we=>{S.current&&!we.currentTarget.contains(we.relatedTarget)&&(S.current=!1,ge.current&&(ge.current.focus({preventScroll:!0}),ge.current=null))},onFocus:we=>{we.target instanceof HTMLElement&&we.target.dataset.dismissible==="false"||S.current||(S.current=!0,ge.current=we.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{ne||O(!1)},onDragEnd:()=>O(!1),onPointerDown:we=>{we.target instanceof HTMLElement&&we.target.dataset.dismissible==="false"||oe(!0)},onPointerUp:()=>oe(!1)},L.filter(we=>!we.position&&ee===0||we.position===$).map((we,Te)=>{var We,it;return le.createElement(r2,{key:we.id,icons:F,index:Te,toast:we,defaultRichColors:E,duration:(We=T?.duration)!=null?We:A,className:T?.className,descriptionClassName:T?.descriptionClassName,invert:f,visibleToasts:G,closeButton:(it=T?.closeButton)!=null?it:x,interacting:ne,position:$,style:T?.style,unstyled:T?.unstyled,classNames:T?.classNames,cancelButtonStyle:T?.cancelButtonStyle,actionButtonStyle:T?.actionButtonStyle,closeButtonAriaLabel:T?.closeButtonAriaLabel,removeToast:Q,toasts:L.filter(qe=>qe.position==we.position),heights:z.filter(qe=>qe.position==we.position),setHeights:se,expandByDefault:v,gap:q,expanded:ie,swipeDirections:o.swipeDirections})})):null}))});class ot extends Error{constructor(){super("Engine Offline"),this.name="EngineOfflineError"}}const H0=w.createContext(null);function Mt(){const l=w.useContext(H0);if(!l)throw new Error("useProxyContext must be used within ProxyProvider");return l}function c2({children:l}){const[o,c]=w.useState(null),u=w.useRef(null),[f,m]=w.useState(null),[g,v]=w.useState([]),[x,p]=w.useState(null),[b,h]=w.useState(!1),[N,E]=w.useState(1200),[A,U]=w.useState(!1),[G,T]=w.useState(!1),K=typeof window.pp_status=="function",q=w.useCallback((_,L="success")=>{L==="success"?yt.success(_):yt.error(_)},[]),F=w.useCallback(async()=>{try{let _=!1;if(window.pp_status){const L=await window.pp_status();c(L),u.current=L,_=L.running}else try{const L=await fetch("/healthz");if(L.ok){const z={running:!0,port:(await L.json().catch(()=>({}))).port||0,base_url:location.origin,last_error:""};c(z),u.current=z,_=!0}else{const Y={running:!1,port:0,base_url:location.origin,last_error:L.statusText};c(Y),u.current=Y}}catch(L){const Y={running:!1,port:0,base_url:location.origin,last_error:String(L)};c(Y),u.current=Y,_=!1}if(_){if(U(!0),T(!1),E(1200),f)try{const Y=await fetch("/v0/management/auth-files",{headers:{"X-Management-Key":f}});if(Y.ok){const z=await Y.json();Array.isArray(z)&&v(z)}}catch(L){console.error("Auth files error:",L)}}else A&&!G&&K&&window.pp_start&&(console.log("Unexpected stop detected, attempting auto-reconnect..."),window.pp_start().catch(L=>console.error("Auto-reconnect failed:",L))),v([]),E(L=>Math.min(L*1.5,1e4))}catch(_){console.error("Status error:",_),E(L=>Math.min(L*1.5,1e4))}},[f]),ae=w.useCallback(async(_,L={})=>{if(!u.current?.running)throw new ot;if(!f)throw new Error("Missing management key");h(!0);try{const z=Object.assign({},L.headers||{},{"X-Management-Key":f}),se=await fetch(_,{...L,headers:z}),O=(se.headers.get("content-type")||"").toLowerCase().includes("application/json")?await se.json():await se.text();if(!se.ok){const ne=u.current;if(se.status===404&&(!ne||!ne.running))throw new ot;const oe=typeof O=="string"?O:O?.error?O.error:JSON.stringify(O);throw new Error(`${se.status} ${se.statusText}: ${oe}`)}return O}catch(z){throw z instanceof TypeError?new ot:z}finally{h(!1)}},[f]),te=w.useCallback(async(_,L,Y)=>{if(_){L==="stop"&&T(!0),(L==="start"||L==="restart")&&T(!1),p(L);try{await _(),q(Y,"success"),await F()}catch(z){q(z instanceof Error?z.message:String(z),"error")}finally{p(null)}}},[q,F]);return w.useEffect(()=>{F();let _;const L=()=>{_=setTimeout(async()=>{await F(),L()},N)};return L(),(async()=>{try{if(window.pp_get_management_key){const Y=await window.pp_get_management_key();m(Y)}else if(!K){const Y=document.querySelector('meta[name="pp-mgmt-key"]');m(Y?Y.getAttribute("content"):null)}}catch(Y){console.error("Management key error:",Y)}})(),()=>clearTimeout(_)},[F,K,N]),s.jsx(H0.Provider,{value:{status:o,isDesktop:K,mgmtKey:f,authFiles:g,loading:x,isMgmtLoading:b,setLoading:p,refreshStatus:F,showToast:q,mgmtFetch:ae,handleAction:te,pp_get_usage:window.pp_get_usage,pp_detect_agents:window.pp_detect_agents,pp_configure_agent:window.pp_configure_agent,pp_unconfigure_agent:window.pp_unconfigure_agent,pp_check_updates:window.pp_check_updates,pp_download_update:window.pp_download_update},children:l})}const u2=l=>l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d2=l=>l.replace(/^([A-Z])|[\s-_]+(\w)/g,(o,c,u)=>u?u.toUpperCase():c.toLowerCase()),Sp=l=>{const o=d2(l);return o.charAt(0).toUpperCase()+o.slice(1)},B0=(...l)=>l.filter((o,c,u)=>!!o&&o.trim()!==""&&u.indexOf(o)===c).join(" ").trim(),f2=l=>{for(const o in l)if(o.startsWith("aria-")||o==="role"||o==="title")return!0};var m2={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"};const h2=w.forwardRef(({color:l="currentColor",size:o=24,strokeWidth:c=2,absoluteStrokeWidth:u,className:f="",children:m,iconNode:g,...v},x)=>w.createElement("svg",{ref:x,...m2,width:o,height:o,stroke:l,strokeWidth:u?Number(c)*24/Number(o):c,className:B0("lucide",f),...!m&&!f2(v)&&{"aria-hidden":"true"},...v},[...g.map(([p,b])=>w.createElement(p,b)),...Array.isArray(m)?m:[m]]));const fe=(l,o)=>{const c=w.forwardRef(({className:u,...f},m)=>w.createElement(h2,{ref:m,iconNode:o,className:B0(`lucide-${u2(Sp(l))}`,`lucide-${l}`,u),...f}));return c.displayName=Sp(l),c};const p2=[["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"}]],Ko=fe("activity",p2);const g2=[["path",{d:"M12 6v16",key:"nqf5sj"}],["path",{d:"m19 13 2-1a9 9 0 0 1-18 0l2 1",key:"y7qv08"}],["path",{d:"M9 11h6",key:"1fldmi"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}]],_p=fe("anchor",g2);const x2=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Au=fe("brain",x2);const v2=[["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"}]],Mu=fe("chart-column",v2);const y2=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],b2=fe("chart-pie",y2);const w2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tl=fe("check",w2);const N2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],al=fe("chevron-down",N2);const j2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],S2=fe("chevron-left",j2);const _2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ou=fe("chevron-right",_2);const E2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],C2=fe("chevrons-left",E2);const T2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],k2=fe("chevrons-right",T2);const A2=[["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"}]],Uo=fe("circle-alert",A2);const M2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],q0=fe("circle-check",M2);const O2=[["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"}]],z2=fe("circle-x",O2);const R2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ho=fe("circle",R2);const D2=[["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"}]],L2=fe("clipboard",D2);const U2=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],H2=fe("clock",U2);const B2=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ep=fe("code-xml",B2);const q2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],nl=fe("copy",q2);const Y2=[["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"}]],Y0=fe("database",Y2);const G2=[["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"}]],V2=fe("dollar-sign",G2);const X2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],is=fe("download",X2);const $2=[["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"}]],G0=fe("external-link",$2);const Q2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Z2=fe("file-code",Q2);const K2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],V0=fe("file-text",K2);const J2=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],zu=fe("folder-open",J2);const F2=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],W2=fe("funnel",F2);const P2=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],I2=fe("gauge",P2);const ew=[["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"}]],tw=fe("git-branch",ew);const aw=[["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"}]],nw=fe("history",aw);const sw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],lw=fe("info",sw);const rw=[["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"}]],ow=fe("key",rw);const iw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Vt=fe("loader-circle",iw);const cw=[["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"}]],X0=fe("lock-open",cw);const uw=[["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"}]],$0=fe("lock",uw);const dw=[["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"}]],fw=fe("monitor",dw);const mw=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],hw=fe("moon",mw);const pw=[["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"}]],gw=fe("pencil",pw);const xw=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],vw=fe("pin",xw);const yw=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Q0=fe("play",yw);const bw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ww=fe("plus",bw);const Nw=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],yu=fe("radar",Nw);const jw=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Z0=fe("radio",jw);const Sw=[["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"}]],ba=fe("refresh-cw",Sw);const _w=[["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"}]],Ew=fe("rotate-ccw",_w);const Cw=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Tw=fe("rotate-cw",Cw);const kw=[["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"}]],Ps=fe("save",kw);const Aw=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],Mw=fe("scissors",Aw);const Ow=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],zw=fe("scroll-text",Ow);const Rw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Dw=fe("search",Rw);const Lw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Mo=fe("settings",Lw);const Uw=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Hw=fe("settings-2",Uw);const Bw=[["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"}]],qw=fe("shield",Bw);const Yw=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],K0=fe("sparkles",Yw);const Gw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Vw=fe("square",Gw);const Xw=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],$w=fe("sun",Xw);const Qw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ru=fe("terminal",Qw);const Zw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Jo=fe("trash-2",Zw);const Kw=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Jw=fe("trending-down",Kw);const Fw=[["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"}]],Iu=fe("triangle-alert",Fw);const Ww=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Pw=fe("undo-2",Ww);const Iw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],eN=fe("upload",Iw);const tN=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],J0=fe("wrench",tN);const aN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ed=fe("x",aN);const nN=[["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"}]],Du=fe("zap",nN);function sN(l){const o=Math.floor(l/3600),c=Math.floor(l%3600/60),u=l%60;return o>0?`${o}h ${c}m`:c>0?`${c}m ${u}s`:`${u}s`}function lN(){const{status:l,loading:o,handleAction:c,showToast:u,isDesktop:f}=Mt(),[m,g]=w.useState(0),[v,x]=w.useState(!1),p=w.useRef(null),b=l?.running??!1;w.useEffect(()=>{if(b){p.current===null&&(p.current=Date.now());const N=setInterval(()=>{p.current&&g(Math.floor((Date.now()-p.current)/1e3))},1e3);return()=>clearInterval(N)}p.current=null,g(0)},[b]);const h=async()=>{if(l?.base_url)try{await navigator.clipboard.writeText(l.base_url),x(!0),u("URL copied to clipboard","success"),setTimeout(()=>x(!1),2e3)}catch{u("Failed to copy URL","error")}};return s.jsxs("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-panel)] shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-[var(--bg-elevated)] border-b border-[var(--border-default)]",children:[s.jsx(Z0,{className:"h-4 w-4 text-[var(--accent-primary)]"}),s.jsx("span",{className:"font-mono text-xs font-bold uppercase tracking-widest text-[var(--text-secondary)]",children:"Engine Control"}),s.jsx("div",{className:"flex-1"}),s.jsx("div",{className:`h-2 w-2 rounded-full ${b?"bg-[var(--status-online)] animate-pulse":"bg-[var(--status-offline)]"}`})]}),s.jsxs("div",{className:"p-6 flex flex-col items-center",children:[s.jsxs("div",{className:"relative w-48 h-48 mb-6",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-[var(--status-online)] opacity-0",style:{animation:"radar-pulse 2s ease-out infinite"}}),s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-[var(--status-online)] opacity-0",style:{animation:"radar-pulse 2s ease-out infinite 0.5s"}}),s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-[var(--status-online)] opacity-0",style:{animation:"radar-pulse 2s ease-out infinite 1s"}})]}),s.jsx("div",{className:`absolute inset-4 rounded-full border-2 transition-colors duration-300 ${b?"border-[var(--status-online)]/30":"border-[var(--border-subtle)]"}`}),s.jsx("div",{className:`absolute inset-8 rounded-full border transition-colors duration-300 ${b?"border-[var(--status-online)]/20":"border-[var(--border-subtle)]/50"}`}),s.jsx("div",{className:`absolute inset-12 rounded-full flex flex-col items-center justify-center transition-all duration-500 ${b?"bg-gradient-to-br from-[var(--accent-primary)] to-[var(--accent-secondary)] shadow-[0_0_30px_var(--status-online)]":"bg-gradient-to-br from-[var(--bg-elevated)] to-[var(--bg-active)] border border-[var(--border-default)]"}`,children:s.jsx("span",{className:`font-mono text-xs font-bold tracking-wider ${b?"text-white":"text-[var(--text-muted)]"}`,children:b?"ONLINE":"OFFLINE"})}),b&&s.jsx("div",{className:"absolute inset-0 rounded-full overflow-hidden",style:{animation:"radar-sweep 3s linear infinite"},children:s.jsx("div",{className:"absolute top-1/2 left-1/2 w-1/2 h-0.5 origin-left",style:{background:"linear-gradient(90deg, var(--status-online) 0%, transparent 100%)"}})})]}),s.jsxs("div",{className:"w-full grid grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-[var(--bg-void)] rounded-md border border-[var(--border-subtle)] p-3",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:"Port"}),s.jsx("div",{className:`font-mono text-lg font-bold ${b?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"}`,children:b&&l?.port||"---"})]}),s.jsxs("div",{className:"bg-[var(--bg-void)] rounded-md border border-[var(--border-subtle)] p-3",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:"Uptime"}),s.jsx("div",{className:`font-mono text-lg font-bold ${b?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"}`,children:b?sN(m):"--:--"})]})]}),l?.last_error&&s.jsx("div",{className:"w-full mb-6 rounded-md border-2 border-[var(--status-warning)] bg-[var(--status-warning)]/10 p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"p-1.5 rounded bg-[var(--status-warning)]/20",children:s.jsx(Iu,{className:"h-4 w-4 text-[var(--status-warning)]"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--status-warning)] mb-1",children:"Caution"}),s.jsx("div",{className:"font-mono text-sm text-[var(--status-warning)] break-all",children:l.last_error})]})]})}),s.jsxs("div",{className:"w-full grid grid-cols-3 gap-3 mb-6",children:[s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:b||o==="start",onClick:()=>c(window.pp_start,"start","Proxy started"),className:` +`+n.stack}}var $t=Object.prototype.hasOwnProperty,cl=l.unstable_scheduleCallback,ul=l.unstable_cancelCallback,kt=l.unstable_shouldYield,rn=l.unstable_requestPaint,Tt=l.unstable_now,Io=l.unstable_getCurrentPriorityLevel,Hn=l.unstable_ImmediatePriority,dr=l.unstable_UserBlockingPriority,Bn=l.unstable_NormalPriority,dl=l.unstable_LowPriority,Ua=l.unstable_IdlePriority,fr=l.log,on=l.unstable_setDisableYieldValue,qn=null,At=null;function ma(e){if(typeof fr=="function"&&on(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(qn,e)}catch{}}var jt=Math.clz32?Math.clz32:ja,ei=Math.log,fl=Math.LN2;function ja(e){return e>>>=0,e===0?32:31-(ei(e)/fl|0)|0}var cs=256,us=262144,Yn=4194304;function Sa(e){var t=e&42;if(t!==0)return t;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 Se(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var y=n&134217727;return y!==0?(n=y&~i,n!==0?r=Sa(n):(f&=y,f!==0?r=Sa(f):a||(a=y&~e,a!==0&&(r=Sa(a))))):(y=n&~i,y!==0?r=Sa(y):f!==0?r=Sa(f):a||(a=n&~e,a!==0&&(r=Sa(a)))),r===0?0:t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===32&&(a&4194048)!==0)?t:r}function Ke(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 St(){var e=Yn;return Yn<<=1,(Yn&62914560)===0&&(Yn=4194304),e}function cn(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Fe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Rt(e,t,a,n,r,i){var f=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var y=e.entanglements,j=e.expirationTimes,D=e.hiddenUpdates;for(a=f&~a;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var hg=/[\n"\\]/g;function aa(e){return e.replace(hg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function li(e,t,a,n,r,i,f,y){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+ta(t)):e.value!==""+ta(t)&&(e.value=""+ta(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?ri(e,f,ta(t)):a!=null?ri(e,f,ta(a)):n!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+ta(y):e.removeAttribute("name")}function dd(e,t,a,n,r,i,f,y){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||a!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){si(e);return}a=a!=null?""+ta(a):"",t=t!=null?""+ta(t):a,y||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=y?e.checked:!!n,e.defaultChecked=!!n,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),si(e)}function ri(e,t,a){t==="number"&&pr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function xs(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),di=!1;if(qa)try{var gl={};Object.defineProperty(gl,"passive",{get:function(){di=!0}}),window.addEventListener("test",gl,gl),window.removeEventListener("test",gl,gl)}catch{di=!1}var dn=null,fi=null,xr=null;function vd(){if(xr)return xr;var e,t=fi,a=t.length,n,r="value"in dn?dn.value:dn.textContent,i=r.length;for(e=0;e=yl),Sd=" ",_d=!1;function Ed(e,t){switch(e){case"keyup":return Gg.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ws=!1;function Xg(e,t){switch(e){case"compositionend":return Cd(t);case"keypress":return t.which!==32?null:(_d=!0,Sd);case"textInput":return e=t.data,e===Sd&&_d?null:e;default:return null}}function $g(e,t){if(ws)return e==="compositionend"||!xi&&Ed(e,t)?(e=vd(),xr=fi=dn=null,ws=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Dd(a)}}function Ud(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ud(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=pr(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=pr(e.document)}return t}function bi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Ig=qa&&"documentMode"in document&&11>=document.documentMode,Ns=null,wi=null,jl=null,Ni=!1;function Bd(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ni||Ns==null||Ns!==pr(n)||(n=Ns,"selectionStart"in n&&bi(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),jl&&Nl(jl,n)||(jl=n,n=uo(wi,"onSelect"),0>=f,r-=f,_a=1<<32-jt(t)+r|a<Ce?(ze=pe,pe=null):ze=pe.sibling;var Le=H(M,pe,R[Ce],W);if(Le===null){pe===null&&(pe=ze);break}e&&pe&&Le.alternate===null&&t(M,pe),C=i(Le,C,Ce),De===null?ye=Le:De.sibling=Le,De=Le,pe=ze}if(Ce===R.length)return a(M,pe),Re&&Ga(M,Ce),ye;if(pe===null){for(;CeCe?(ze=pe,pe=null):ze=pe.sibling;var zn=H(M,pe,Le.value,W);if(zn===null){pe===null&&(pe=ze);break}e&&pe&&zn.alternate===null&&t(M,pe),C=i(zn,C,Ce),De===null?ye=zn:De.sibling=zn,De=zn,pe=ze}if(Le.done)return a(M,pe),Re&&Ga(M,Ce),ye;if(pe===null){for(;!Le.done;Ce++,Le=R.next())Le=I(M,Le.value,W),Le!==null&&(C=i(Le,C,Ce),De===null?ye=Le:De.sibling=Le,De=Le);return Re&&Ga(M,Ce),ye}for(pe=n(pe);!Le.done;Ce++,Le=R.next())Le=X(pe,M,Ce,Le.value,W),Le!==null&&(e&&Le.alternate!==null&&pe.delete(Le.key===null?Ce:Le.key),C=i(Le,C,Ce),De===null?ye=Le:De.sibling=Le,De=Le);return e&&pe.forEach(function(yv){return t(M,yv)}),Re&&Ga(M,Ce),ye}function Xe(M,C,R,W){if(typeof R=="object"&&R!==null&&R.type===U&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case _:e:{for(var ye=R.key;C!==null;){if(C.key===ye){if(ye=R.type,ye===U){if(C.tag===7){a(M,C.sibling),W=r(C,R.props.children),W.return=M,M=W;break e}}else if(C.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===L&&In(ye)===C.type){a(M,C.sibling),W=r(C,R.props),Tl(W,R),W.return=M,M=W;break e}a(M,C);break}else t(M,C);C=C.sibling}R.type===U?(W=Kn(R.props.children,M.mode,W,R.key),W.return=M,M=W):(W=Cr(R.type,R.key,R.props,null,M.mode,W),Tl(W,R),W.return=M,M=W)}return f(M);case A:e:{for(ye=R.key;C!==null;){if(C.key===ye)if(C.tag===4&&C.stateNode.containerInfo===R.containerInfo&&C.stateNode.implementation===R.implementation){a(M,C.sibling),W=r(C,R.children||[]),W.return=M,M=W;break e}else{a(M,C);break}else t(M,C);C=C.sibling}W=Ti(R,M.mode,W),W.return=M,M=W}return f(M);case L:return R=In(R),Xe(M,C,R,W)}if(oe(R))return fe(M,C,R,W);if(ie(R)){if(ye=ie(R),typeof ye!="function")throw Error(u(150));return R=ye.call(R),be(M,C,R,W)}if(typeof R.then=="function")return Xe(M,C,Rr(R),W);if(R.$$typeof===q)return Xe(M,C,Ar(M,R),W);Dr(M,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,C!==null&&C.tag===6?(a(M,C.sibling),W=r(C,R),W.return=M,M=W):(a(M,C),W=ki(R,M.mode,W),W.return=M,M=W),f(M)):a(M,C)}return function(M,C,R,W){try{kl=0;var ye=Xe(M,C,R,W);return zs=null,ye}catch(pe){if(pe===Os||pe===Or)throw pe;var De=Zt(29,pe,null,M.mode);return De.lanes=W,De.return=M,De}}}var ts=cf(!0),uf=cf(!1),gn=!1;function Yi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function xn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vn(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ue&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Er(e),Qd(e,null,a),t}return _r(e,n,t,a),Er(e)}function Al(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Dt(e,a)}}function Vi(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var r=null,i=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};i===null?r=i=f:i=i.next=f,a=a.next}while(a!==null);i===null?r=i=t:i=i.next=t}else r=i=t;a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Xi=!1;function Ml(){if(Xi){var e=Ms;if(e!==null)throw e}}function Ol(e,t,a,n){Xi=!1;var r=e.updateQueue;gn=!1;var i=r.firstBaseUpdate,f=r.lastBaseUpdate,y=r.shared.pending;if(y!==null){r.shared.pending=null;var j=y,D=j.next;j.next=null,f===null?i=D:f.next=D,f=j;var J=e.alternate;J!==null&&(J=J.updateQueue,y=J.lastBaseUpdate,y!==f&&(y===null?J.firstBaseUpdate=D:y.next=D,J.lastBaseUpdate=j))}if(i!==null){var I=r.baseState;f=0,J=D=j=null,y=i;do{var H=y.lane&-536870913,X=H!==y.lane;if(X?(Oe&H)===H:(n&H)===H){H!==0&&H===As&&(Xi=!0),J!==null&&(J=J.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var fe=e,be=y;H=t;var Xe=a;switch(be.tag){case 1:if(fe=be.payload,typeof fe=="function"){I=fe.call(Xe,I,H);break e}I=fe;break e;case 3:fe.flags=fe.flags&-65537|128;case 0:if(fe=be.payload,H=typeof fe=="function"?fe.call(Xe,I,H):fe,H==null)break e;I=h({},I,H);break e;case 2:gn=!0}}H=y.callback,H!==null&&(e.flags|=64,X&&(e.flags|=8192),X=r.callbacks,X===null?r.callbacks=[H]:X.push(H))}else X={lane:H,tag:y.tag,payload:y.payload,callback:y.callback,next:null},J===null?(D=J=X,j=I):J=J.next=X,f|=H;if(y=y.next,y===null){if(y=r.shared.pending,y===null)break;X=y,y=X.next,X.next=null,r.lastBaseUpdate=X,r.shared.pending=null}}while(!0);J===null&&(j=I),r.baseState=j,r.firstBaseUpdate=D,r.lastBaseUpdate=J,i===null&&(r.shared.lanes=0),jn|=f,e.lanes=f,e.memoizedState=I}}function df(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function ff(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;ei?i:8;var f=T.T,y={};T.T=y,cc(e,!1,t,a);try{var j=r(),D=T.S;if(D!==null&&D(y,j),j!==null&&typeof j=="object"&&typeof j.then=="function"){var J=ix(j,n);Dl(e,t,J,Pt(e))}else Dl(e,t,n,Pt(e))}catch(I){Dl(e,t,{then:function(){},status:"rejected",reason:I},Pt())}finally{V.p=i,f!==null&&y.types!==null&&(f.types=y.types),T.T=f}}function hx(){}function oc(e,t,a,n){if(e.tag!==5)throw Error(u(476));var r=Xf(e).queue;Vf(e,r,t,B,a===null?hx:function(){return $f(e),a(n)})}function Xf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:B,baseState:B,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:B},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function $f(e){var t=Xf(e);t.next===null&&(t=e.alternate.memoizedState),Dl(e,t.next.queue,{},Pt())}function ic(){return yt(Pl)}function Qf(){return tt().memoizedState}function Zf(){return tt().memoizedState}function px(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Pt();e=xn(a);var n=vn(t,e,a);n!==null&&(Vt(n,t,a),Al(n,t,a)),t={cache:Ui()},e.payload=t;return}t=t.return}}function gx(e,t,a){var n=Pt();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$r(e)?Jf(t,a):(a=Ei(e,t,a,n),a!==null&&(Vt(a,e,n),Ff(a,t,n)))}function Kf(e,t,a){var n=Pt();Dl(e,t,a,n)}function Dl(e,t,a,n){var r={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($r(e))Jf(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var f=t.lastRenderedState,y=i(f,a);if(r.hasEagerState=!0,r.eagerState=y,Qt(y,f))return _r(e,t,r,0),$e===null&&Sr(),!1}catch{}if(a=Ei(e,t,r,n),a!==null)return Vt(a,e,n),Ff(a,t,n),!0}return!1}function cc(e,t,a,n){if(n={lane:2,revertLane:Yc(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},$r(e)){if(t)throw Error(u(479))}else t=Ei(e,a,n,2),t!==null&&Vt(t,e,2)}function $r(e){var t=e.alternate;return e===Ee||t!==null&&t===Ee}function Jf(e,t){Ds=Hr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Ff(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,Dt(e,a)}}var Ll={readContext:yt,use:Yr,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};Ll.useEffectEvent=Pe;var Wf={readContext:yt,use:Yr,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:Rf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Vr(4194308,4,Hf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Vr(4194308,4,e,t)},useInsertionEffect:function(e,t){Vr(4,2,e,t)},useMemo:function(e,t){var a=Mt();t=t===void 0?null:t;var n=e();if(as){ma(!0);try{e()}finally{ma(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=Mt();if(a!==void 0){var r=a(t);if(as){ma(!0);try{a(t)}finally{ma(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=gx.bind(null,Ee,e),[n.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:function(e){e=ac(e);var t=e.queue,a=Kf.bind(null,Ee,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:lc,useDeferredValue:function(e,t){var a=Mt();return rc(a,e,t)},useTransition:function(){var e=ac(!1);return e=Vf.bind(null,Ee,e.queue,!0,!1),Mt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Ee,r=Mt();if(Re){if(a===void 0)throw Error(u(407));a=a()}else{if(a=t(),$e===null)throw Error(u(349));(Oe&127)!==0||vf(n,t,a)}r.memoizedState=a;var i={value:a,getSnapshot:t};return r.queue=i,Rf(bf.bind(null,n,i,e),[e]),n.flags|=2048,Us(9,{destroy:void 0},yf.bind(null,n,i,a,t),null),a},useId:function(){var e=Mt(),t=$e.identifierPrefix;if(Re){var a=Ea,n=_a;a=(n&~(1<<32-jt(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Br++,0<\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof n.is=="string"?f.createElement("select",{is:n.is}):f.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i=typeof n.is=="string"?f.createElement(r,{is:n.is}):f.createElement(r)}}i[xt]=t,i[Ut]=n;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=i;e:switch(wt(i,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Ka(t)}}return Ze(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Ka(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(u(166));if(e=xe.current,ks(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,r=vt,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[xt]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||gh(e.nodeValue,a)),e||hn(t,!0)}else e=fo(e).createTextNode(n),e[xt]=t,t.stateNode=e}return Ze(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=ks(t),a!==null){if(e===null){if(!n)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[xt]=t}else Jn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),e=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Jt(t),t):(Jt(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Ze(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=ks(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(u(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(u(317));r[xt]=t}else Jn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ze(t),r=!1}else r=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Jt(t),t):(Jt(t),null)}return Jt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),i=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),i!==r&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Fr(t,t.updateQueue),Ze(t),null);case 4:return ke(),e===null&&$c(t.stateNode.containerInfo),Ze(t),null;case 10:return Xa(t.type),Ze(t),null;case 19:if(Q(et),n=t.memoizedState,n===null)return Ze(t),null;if(r=(t.flags&128)!==0,i=n.rendering,i===null)if(r)Hl(n,!1);else{if(Ie!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=Ur(e),i!==null){for(t.flags|=128,Hl(n,!1),e=i.updateQueue,t.updateQueue=e,Fr(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Zd(a,e),a=a.sibling;return $(et,et.current&1|2),Re&&Ga(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&Tt()>to&&(t.flags|=128,r=!0,Hl(n,!1),t.lanes=4194304)}else{if(!r)if(e=Ur(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Fr(t,e),Hl(n,!0),n.tail===null&&n.tailMode==="hidden"&&!i.alternate&&!Re)return Ze(t),null}else 2*Tt()-n.renderingStartTime>to&&a!==536870912&&(t.flags|=128,r=!0,Hl(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(e=n.last,e!==null?e.sibling=i:t.child=i,n.last=i)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=Tt(),e.sibling=null,a=et.current,$(et,r?a&1|2:a&1),Re&&Ga(t,n.treeForkCount),e):(Ze(t),null);case 22:case 23:return Jt(t),Qi(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(Ze(t),t.subtreeFlags&6&&(t.flags|=8192)):Ze(t),a=t.updateQueue,a!==null&&Fr(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&Q(Pn),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Xa(nt),Ze(t),null;case 25:return null;case 30:return null}throw Error(u(156,t.tag))}function wx(e,t){switch(Mi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xa(nt),ke(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return it(t),null;case 31:if(t.memoizedState!==null){if(Jt(t),t.alternate===null)throw Error(u(340));Jn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));Jn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Q(et),null;case 4:return ke(),null;case 10:return Xa(t.type),null;case 22:case 23:return Jt(t),Qi(),e!==null&&Q(Pn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xa(nt),null;case 25:return null;default:return null}}function wm(e,t){switch(Mi(t),t.tag){case 3:Xa(nt),ke();break;case 26:case 27:case 5:it(t);break;case 4:ke();break;case 31:t.memoizedState!==null&&Jt(t);break;case 13:Jt(t);break;case 19:Q(et);break;case 10:Xa(t.type);break;case 22:case 23:Jt(t),Qi(),e!==null&&Q(Pn);break;case 24:Xa(nt)}}function Bl(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var r=n.next;a=r;do{if((a.tag&e)===e){n=void 0;var i=a.create,f=a.inst;n=i(),f.destroy=n}a=a.next}while(a!==r)}}catch(y){Be(t,t.return,y)}}function wn(e,t,a){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){var f=n.inst,y=f.destroy;if(y!==void 0){f.destroy=void 0,r=t;var j=a,D=y;try{D()}catch(J){Be(r,j,J)}}}n=n.next}while(n!==i)}}catch(J){Be(t,t.return,J)}}function Nm(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{ff(t,a)}catch(n){Be(e,e.return,n)}}}function jm(e,t,a){a.props=ns(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){Be(e,t,n)}}function ql(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(r){Be(e,t,r)}}function Ca(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(r){Be(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(r){Be(e,t,r)}else a.current=null}function Sm(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(r){Be(e,e.return,r)}}function Sc(e,t,a){try{var n=e.stateNode;Vx(n,e.type,a,t),n[Ut]=t}catch(r){Be(e,e.return,r)}}function _m(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&kn(e.type)||e.tag===4}function _c(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_m(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&&kn(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 Ec(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Ba));else if(n!==4&&(n===27&&kn(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Ec(e,t,a),e=e.sibling;e!==null;)Ec(e,t,a),e=e.sibling}function Wr(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&kn(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Wr(e,t,a),e=e.sibling;e!==null;)Wr(e,t,a),e=e.sibling}function Em(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);wt(t,n,a),t[xt]=e,t[Ut]=a}catch(i){Be(e,e.return,i)}}var Ja=!1,rt=!1,Cc=!1,Cm=typeof WeakSet=="function"?WeakSet:Set,pt=null;function Nx(e,t){if(e=e.containerInfo,Kc=yo,e=Hd(e),bi(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var r=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{a.nodeType,i.nodeType}catch{a=null;break e}var f=0,y=-1,j=-1,D=0,J=0,I=e,H=null;t:for(;;){for(var X;I!==a||r!==0&&I.nodeType!==3||(y=f+r),I!==i||n!==0&&I.nodeType!==3||(j=f+n),I.nodeType===3&&(f+=I.nodeValue.length),(X=I.firstChild)!==null;)H=I,I=X;for(;;){if(I===e)break t;if(H===a&&++D===r&&(y=f),H===i&&++J===n&&(j=f),(X=I.nextSibling)!==null)break;I=H,H=I.parentNode}I=X}a=y===-1||j===-1?null:{start:y,end:j}}else a=null}a=a||{start:0,end:0}}else a=null;for(Jc={focusedElem:e,selectionRange:a},yo=!1,pt=t;pt!==null;)if(t=pt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pt=e;else for(;pt!==null;){switch(t=pt,i=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a title"))),wt(i,n,a),i[xt]=e,ht(i),n=i;break e;case"link":var f=zh("link","href",r).get(n+(a.href||""));if(f){for(var y=0;yXe&&(f=Xe,Xe=be,be=f);var M=Ld(y,be),C=Ld(y,Xe);if(M&&C&&(X.rangeCount!==1||X.anchorNode!==M.node||X.anchorOffset!==M.offset||X.focusNode!==C.node||X.focusOffset!==C.offset)){var R=I.createRange();R.setStart(M.node,M.offset),X.removeAllRanges(),be>Xe?(X.addRange(R),X.extend(C.node,C.offset)):(R.setEnd(C.node,C.offset),X.addRange(R))}}}}for(I=[],X=y;X=X.parentNode;)X.nodeType===1&&I.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;ya?32:a,T.T=null,a=Rc,Rc=null;var i=_n,f=en;if(ct=0,Gs=_n=null,en=0,(Ue&6)!==0)throw Error(u(331));var y=Ue;if(Ue|=4,Hm(i.current),Dm(i,i.current,f,a),Ue=y,Ql(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(qn,i)}catch{}return!0}finally{V.p=r,T.T=n,ah(e,t)}}function sh(e,t,a){t=sa(a,t),t=mc(e.stateNode,t,2),e=vn(e,t,2),e!==null&&(Fe(e,2),ka(e))}function Be(e,t,a){if(e.tag===3)sh(e,e,a);else for(;t!==null;){if(t.tag===3){sh(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Sn===null||!Sn.has(n))){e=sa(a,e),a=lm(2),n=vn(t,a,2),n!==null&&(rm(a,n,t,e),Fe(n,2),ka(n));break}}t=t.return}}function Hc(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new _x;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(a)||(Ac=!0,r.add(a),e=Ax.bind(null,e,t,a),t.then(e,e))}function Ax(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,$e===e&&(Oe&a)===a&&(Ie===4||Ie===3&&(Oe&62914560)===Oe&&300>Tt()-eo?(Ue&2)===0&&Vs(e,0):Mc|=a,Ys===Oe&&(Ys=0)),ka(e)}function lh(e,t){t===0&&(t=St()),e=Zn(e,t),e!==null&&(Fe(e,t),ka(e))}function Mx(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),lh(e,a)}function Ox(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(a=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(u(314))}n!==null&&n.delete(t),lh(e,a)}function zx(e,t){return cl(e,t)}var oo=null,$s=null,Bc=!1,io=!1,qc=!1,Cn=0;function ka(e){e!==$s&&e.next===null&&($s===null?oo=$s=e:$s=$s.next=e),io=!0,Bc||(Bc=!0,Dx())}function Ql(e,t){if(!qc&&io){qc=!0;do for(var a=!1,n=oo;n!==null;){if(e!==0){var r=n.pendingLanes;if(r===0)var i=0;else{var f=n.suspendedLanes,y=n.pingedLanes;i=(1<<31-jt(42|e)+1)-1,i&=r&~(f&~y),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(a=!0,ch(n,i))}else i=Oe,i=Se(n,n===$e?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(i&3)===0||Ke(n,i)||(a=!0,ch(n,i));n=n.next}while(a);qc=!1}}function Rx(){rh()}function rh(){io=Bc=!1;var e=0;Cn!==0&&$x()&&(e=Cn);for(var t=Tt(),a=null,n=oo;n!==null;){var r=n.next,i=oh(n,t);i===0?(n.next=null,a===null?oo=r:a.next=r,r===null&&($s=a)):(a=n,(e!==0||(i&3)!==0)&&(io=!0)),n=r}ct!==0&&ct!==5||Ql(e),Cn!==0&&(Cn=0)}function oh(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0y)break;var J=j.transferSize,I=j.initiatorType;J&&xh(I)&&(j=j.responseEnd,f+=J*(j"u"?null:document;function Th(e,t,a){var n=Qs;if(n&&typeof t=="string"&&t){var r=aa(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof a=="string"&&(r+='[crossorigin="'+a+'"]'),kh.has(r)||(kh.add(r),e={rel:e,crossOrigin:a,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),wt(t,"link",e),ht(t),n.head.appendChild(t)))}}function ev(e){tn.D(e),Th("dns-prefetch",e,null)}function tv(e,t){tn.C(e,t),Th("preconnect",e,t)}function av(e,t,a){tn.L(e,t,a);var n=Qs;if(n&&e&&t){var r='link[rel="preload"][as="'+aa(t)+'"]';t==="image"&&a&&a.imageSrcSet?(r+='[imagesrcset="'+aa(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(r+='[imagesizes="'+aa(a.imageSizes)+'"]')):r+='[href="'+aa(e)+'"]';var i=r;switch(t){case"style":i=Zs(e);break;case"script":i=Ks(e)}ua.has(i)||(e=h({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ua.set(i,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(Fl(i))||t==="script"&&n.querySelector(Wl(i))||(t=n.createElement("link"),wt(t,"link",e),ht(t),n.head.appendChild(t)))}}function nv(e,t){tn.m(e,t);var a=Qs;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+aa(n)+'"][href="'+aa(e)+'"]',i=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Ks(e)}if(!ua.has(i)&&(e=h({rel:"modulepreload",href:e},t),ua.set(i,e),a.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Wl(i)))return}n=a.createElement("link"),wt(n,"link",e),ht(n),a.head.appendChild(n)}}}function sv(e,t,a){tn.S(e,t,a);var n=Qs;if(n&&e){var r=ps(n).hoistableStyles,i=Zs(e);t=t||"default";var f=r.get(i);if(!f){var y={loading:0,preload:null};if(f=n.querySelector(Fl(i)))y.loading=5;else{e=h({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ua.get(i))&&au(e,a);var j=f=n.createElement("link");ht(j),wt(j,"link",e),j._p=new Promise(function(D,J){j.onload=D,j.onerror=J}),j.addEventListener("load",function(){y.loading|=1}),j.addEventListener("error",function(){y.loading|=2}),y.loading|=4,ho(f,t,n)}f={type:"stylesheet",instance:f,count:1,state:y},r.set(i,f)}}}function lv(e,t){tn.X(e,t);var a=Qs;if(a&&e){var n=ps(a).hoistableScripts,r=Ks(e),i=n.get(r);i||(i=a.querySelector(Wl(r)),i||(e=h({src:e,async:!0},t),(t=ua.get(r))&&nu(e,t),i=a.createElement("script"),ht(i),wt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function rv(e,t){tn.M(e,t);var a=Qs;if(a&&e){var n=ps(a).hoistableScripts,r=Ks(e),i=n.get(r);i||(i=a.querySelector(Wl(r)),i||(e=h({src:e,async:!0,type:"module"},t),(t=ua.get(r))&&nu(e,t),i=a.createElement("script"),ht(i),wt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},n.set(r,i))}}function Ah(e,t,a,n){var r=(r=xe.current)?mo(r):null;if(!r)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Zs(a.href),a=ps(r).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Zs(a.href);var i=ps(r).hoistableStyles,f=i.get(e);if(f||(r=r.ownerDocument||r,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,f),(i=r.querySelector(Fl(e)))&&!i._p&&(f.instance=i,f.state.loading=5),ua.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ua.set(e,a),i||ov(r,e,a,f.state))),t&&n===null)throw Error(u(528,""));return f}if(t&&n!==null)throw Error(u(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ks(a),a=ps(r).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function Zs(e){return'href="'+aa(e)+'"'}function Fl(e){return'link[rel="stylesheet"]['+e+"]"}function Mh(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function ov(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),wt(t,"link",a),ht(t),e.head.appendChild(t))}function Ks(e){return'[src="'+aa(e)+'"]'}function Wl(e){return"script[async]"+e}function Oh(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+aa(a.href)+'"]');if(n)return t.instance=n,ht(n),n;var r=h({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),ht(n),wt(n,"style",r),ho(n,a.precedence,e),t.instance=n;case"stylesheet":r=Zs(a.href);var i=e.querySelector(Fl(r));if(i)return t.state.loading|=4,t.instance=i,ht(i),i;n=Mh(a),(r=ua.get(r))&&au(n,r),i=(e.ownerDocument||e).createElement("link"),ht(i);var f=i;return f._p=new Promise(function(y,j){f.onload=y,f.onerror=j}),wt(i,"link",n),t.state.loading|=4,ho(i,a.precedence,e),t.instance=i;case"script":return i=Ks(a.src),(r=e.querySelector(Wl(i)))?(t.instance=r,ht(r),r):(n=a,(r=ua.get(i))&&(n=h({},a),nu(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),ht(r),wt(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,ho(n,a.precedence,e));return t.instance}function ho(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,i=r,f=0;f title"):null)}function iv(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Dh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function cv(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var r=Zs(n.href),i=t.querySelector(Fl(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=go.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,ht(i);return}i=t.ownerDocument||t,n=Mh(n),(r=ua.get(r))&&au(n,r),i=i.createElement("link"),ht(i);var f=i;f._p=new Promise(function(y,j){f.onload=y,f.onerror=j}),wt(i,"link",n),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=go.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var su=0;function uv(e,t){return e.stylesheets&&e.count===0&&vo(e,e.stylesheets),0su?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function go(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var xo=null;function vo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,xo=new Map,t.forEach(dv,e),xo=null,go.call(e))}function dv(e,t){if(!(t.state.loading&4)){var a=xo.get(e);if(a)var n=a.get(null);else{a=new Map,xo.set(e,a);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),mu.exports=Cv(),mu.exports}var Tv=kv();function Aa(l,o,{checkForDefaultPrevented:c=!0}={}){return function(d){if(l?.(d),c===!1||!d.defaultPrevented)return o?.(d)}}function lp(l,o){if(typeof l=="function")return l(o);l!=null&&(l.current=o)}function qu(...l){return o=>{let c=!1;const u=l.map(d=>{const m=lp(d,o);return!c&&typeof m=="function"&&(c=!0),m});if(c)return()=>{for(let d=0;d{const{scope:N,children:_,...A}=h,U=N?.[l]?.[x]||v,G=w.useMemo(()=>A,Object.values(A));return s.jsx(U.Provider,{value:G,children:_})};p.displayName=m+"Provider";function b(h,N){const _=N?.[l]?.[x]||v,A=w.useContext(_);if(A)return A;if(g!==void 0)return g;throw new Error(`\`${h}\` must be used within \`${m}\``)}return[p,b]}const d=()=>{const m=c.map(g=>w.createContext(g));return function(v){const x=v?.[l]||m;return w.useMemo(()=>({[`__scope${l}`]:{...v,[l]:x}}),[v,x])}};return d.scopeName=l,[u,Av(d,...o)]}function Av(...l){const o=l[0];if(l.length===1)return o;const c=()=>{const u=l.map(d=>({useScope:d(),scopeName:d.scopeName}));return function(m){const g=u.reduce((v,{useScope:x,scopeName:p})=>{const h=x(m)[`__scope${p}`];return{...v,...h}},{});return w.useMemo(()=>({[`__scope${o.scopeName}`]:g}),[g])}};return c.scopeName=o.scopeName,c}var Gu=Bp();const qp=Hp(Gu);function Mv(l){const o=Ov(l),c=w.forwardRef((u,d)=>{const{children:m,...g}=u,v=w.Children.toArray(m),x=v.find(Rv);if(x){const p=x.props.children,b=v.map(h=>h===x?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:h);return s.jsx(o,{...g,ref:d,children:w.isValidElement(p)?w.cloneElement(p,void 0,b):null})}return s.jsx(o,{...g,ref:d,children:m})});return c.displayName=`${l}.Slot`,c}function Ov(l){const o=w.forwardRef((c,u)=>{const{children:d,...m}=c;if(w.isValidElement(d)){const g=Lv(d),v=Dv(m,d.props);return d.type!==w.Fragment&&(v.ref=u?qu(u,g):g),w.cloneElement(d,v)}return w.Children.count(d)>1?w.Children.only(null):null});return o.displayName=`${l}.SlotClone`,o}var zv=Symbol("radix.slottable");function Rv(l){return w.isValidElement(l)&&typeof l.type=="function"&&"__radixId"in l.type&&l.type.__radixId===zv}function Dv(l,o){const c={...o};for(const u in o){const d=l[u],m=o[u];/^on[A-Z]/.test(u)?d&&m?c[u]=(...v)=>{const x=m(...v);return d(...v),x}:d&&(c[u]=d):u==="style"?c[u]={...d,...m}:u==="className"&&(c[u]=[d,m].filter(Boolean).join(" "))}return{...l,...c}}function Lv(l){let o=Object.getOwnPropertyDescriptor(l.props,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning;return c?l.ref:(o=Object.getOwnPropertyDescriptor(l,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}var Uv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Da=Uv.reduce((l,o)=>{const c=Mv(`Primitive.${o}`),u=w.forwardRef((d,m)=>{const{asChild:g,...v}=d,x=g?c:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(x,{...v,ref:m})});return u.displayName=`Primitive.${o}`,{...l,[o]:u}},{});function Hv(l,o){l&&Gu.flushSync(()=>l.dispatchEvent(o))}function Xo(l){const o=w.useRef(l);return w.useEffect(()=>{o.current=l}),w.useMemo(()=>(...c)=>o.current?.(...c),[])}function Bv(l,o=globalThis?.document){const c=Xo(l);w.useEffect(()=>{const u=d=>{d.key==="Escape"&&c(d)};return o.addEventListener("keydown",u,{capture:!0}),()=>o.removeEventListener("keydown",u,{capture:!0})},[c,o])}var qv="DismissableLayer",_u="dismissableLayer.update",Yv="dismissableLayer.pointerDownOutside",Gv="dismissableLayer.focusOutside",rp,Yp=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gp=w.forwardRef((l,o)=>{const{disableOutsidePointerEvents:c=!1,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:m,onInteractOutside:g,onDismiss:v,...x}=l,p=w.useContext(Yp),[b,h]=w.useState(null),N=b?.ownerDocument??globalThis?.document,[,_]=w.useState({}),A=ln(o,E=>h(E)),U=Array.from(p.layers),[G]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),k=U.indexOf(G),K=b?U.indexOf(b):-1,q=p.layersWithOutsidePointerEventsDisabled.size>0,F=K>=k,ae=$v(E=>{const L=E.target,Y=[...p.branches].some(z=>z.contains(L));!F||Y||(d?.(E),g?.(E),E.defaultPrevented||v?.())},N),te=Qv(E=>{const L=E.target;[...p.branches].some(z=>z.contains(L))||(m?.(E),g?.(E),E.defaultPrevented||v?.())},N);return Bv(E=>{K===p.layers.size-1&&(u?.(E),!E.defaultPrevented&&v&&(E.preventDefault(),v()))},N),w.useEffect(()=>{if(b)return c&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(rp=N.body.style.pointerEvents,N.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(b)),p.layers.add(b),op(),()=>{c&&p.layersWithOutsidePointerEventsDisabled.size===1&&(N.body.style.pointerEvents=rp)}},[b,N,c,p]),w.useEffect(()=>()=>{b&&(p.layers.delete(b),p.layersWithOutsidePointerEventsDisabled.delete(b),op())},[b,p]),w.useEffect(()=>{const E=()=>_({});return document.addEventListener(_u,E),()=>document.removeEventListener(_u,E)},[]),s.jsx(Da.div,{...x,ref:A,style:{pointerEvents:q?F?"auto":"none":void 0,...l.style},onFocusCapture:Aa(l.onFocusCapture,te.onFocusCapture),onBlurCapture:Aa(l.onBlurCapture,te.onBlurCapture),onPointerDownCapture:Aa(l.onPointerDownCapture,ae.onPointerDownCapture)})});Gp.displayName=qv;var Vv="DismissableLayerBranch",Xv=w.forwardRef((l,o)=>{const c=w.useContext(Yp),u=w.useRef(null),d=ln(o,u);return w.useEffect(()=>{const m=u.current;if(m)return c.branches.add(m),()=>{c.branches.delete(m)}},[c.branches]),s.jsx(Da.div,{...l,ref:d})});Xv.displayName=Vv;function $v(l,o=globalThis?.document){const c=Xo(l),u=w.useRef(!1),d=w.useRef(()=>{});return w.useEffect(()=>{const m=v=>{if(v.target&&!u.current){let x=function(){Vp(Yv,c,p,{discrete:!0})};const p={originalEvent:v};v.pointerType==="touch"?(o.removeEventListener("click",d.current),d.current=x,o.addEventListener("click",d.current,{once:!0})):x()}else o.removeEventListener("click",d.current);u.current=!1},g=window.setTimeout(()=>{o.addEventListener("pointerdown",m)},0);return()=>{window.clearTimeout(g),o.removeEventListener("pointerdown",m),o.removeEventListener("click",d.current)}},[o,c]),{onPointerDownCapture:()=>u.current=!0}}function Qv(l,o=globalThis?.document){const c=Xo(l),u=w.useRef(!1);return w.useEffect(()=>{const d=m=>{m.target&&!u.current&&Vp(Gv,c,{originalEvent:m},{discrete:!1})};return o.addEventListener("focusin",d),()=>o.removeEventListener("focusin",d)},[o,c]),{onFocusCapture:()=>u.current=!0,onBlurCapture:()=>u.current=!1}}function op(){const l=new CustomEvent(_u);document.dispatchEvent(l)}function Vp(l,o,c,{discrete:u}){const d=c.originalEvent.target,m=new CustomEvent(l,{bubbles:!1,cancelable:!0,detail:c});o&&d.addEventListener(l,o,{once:!0}),u?Hv(d,m):d.dispatchEvent(m)}var Dn=globalThis?.document?w.useLayoutEffect:()=>{},Zv=Bu[" useId ".trim().toString()]||(()=>{}),Kv=0;function Jv(l){const[o,c]=w.useState(Zv());return Dn(()=>{c(u=>u??String(Kv++))},[l]),o?`radix-${o}`:""}const Fv=["top","right","bottom","left"],Ln=Math.min,It=Math.max,Ro=Math.round,Eo=Math.floor,za=l=>({x:l,y:l}),Wv={left:"right",right:"left",bottom:"top",top:"bottom"},Pv={start:"end",end:"start"};function Eu(l,o,c){return It(l,Ln(o,c))}function nn(l,o){return typeof l=="function"?l(o):l}function sn(l){return l.split("-")[0]}function ll(l){return l.split("-")[1]}function Vu(l){return l==="x"?"y":"x"}function Xu(l){return l==="y"?"height":"width"}const Iv=new Set(["top","bottom"]);function Ma(l){return Iv.has(sn(l))?"y":"x"}function $u(l){return Vu(Ma(l))}function ey(l,o,c){c===void 0&&(c=!1);const u=ll(l),d=$u(l),m=Xu(d);let g=d==="x"?u===(c?"end":"start")?"right":"left":u==="start"?"bottom":"top";return o.reference[m]>o.floating[m]&&(g=Do(g)),[g,Do(g)]}function ty(l){const o=Do(l);return[Cu(l),o,Cu(o)]}function Cu(l){return l.replace(/start|end/g,o=>Pv[o])}const ip=["left","right"],cp=["right","left"],ay=["top","bottom"],ny=["bottom","top"];function sy(l,o,c){switch(l){case"top":case"bottom":return c?o?cp:ip:o?ip:cp;case"left":case"right":return o?ay:ny;default:return[]}}function ly(l,o,c,u){const d=ll(l);let m=sy(sn(l),c==="start",u);return d&&(m=m.map(g=>g+"-"+d),o&&(m=m.concat(m.map(Cu)))),m}function Do(l){return l.replace(/left|right|bottom|top/g,o=>Wv[o])}function ry(l){return{top:0,right:0,bottom:0,left:0,...l}}function Xp(l){return typeof l!="number"?ry(l):{top:l,right:l,bottom:l,left:l}}function Lo(l){const{x:o,y:c,width:u,height:d}=l;return{width:u,height:d,top:c,left:o,right:o+u,bottom:c+d,x:o,y:c}}function up(l,o,c){let{reference:u,floating:d}=l;const m=Ma(o),g=$u(o),v=Xu(g),x=sn(o),p=m==="y",b=u.x+u.width/2-d.width/2,h=u.y+u.height/2-d.height/2,N=u[v]/2-d[v]/2;let _;switch(x){case"top":_={x:b,y:u.y-d.height};break;case"bottom":_={x:b,y:u.y+u.height};break;case"right":_={x:u.x+u.width,y:h};break;case"left":_={x:u.x-d.width,y:h};break;default:_={x:u.x,y:u.y}}switch(ll(o)){case"start":_[g]-=N*(c&&p?-1:1);break;case"end":_[g]+=N*(c&&p?-1:1);break}return _}const oy=async(l,o,c)=>{const{placement:u="bottom",strategy:d="absolute",middleware:m=[],platform:g}=c,v=m.filter(Boolean),x=await(g.isRTL==null?void 0:g.isRTL(o));let p=await g.getElementRects({reference:l,floating:o,strategy:d}),{x:b,y:h}=up(p,u,x),N=u,_={},A=0;for(let U=0;U({name:"arrow",options:l,async fn(o){const{x:c,y:u,placement:d,rects:m,platform:g,elements:v,middlewareData:x}=o,{element:p,padding:b=0}=nn(l,o)||{};if(p==null)return{};const h=Xp(b),N={x:c,y:u},_=$u(d),A=Xu(_),U=await g.getDimensions(p),G=_==="y",k=G?"top":"left",K=G?"bottom":"right",q=G?"clientHeight":"clientWidth",F=m.reference[A]+m.reference[_]-N[_]-m.floating[A],ae=N[_]-m.reference[_],te=await(g.getOffsetParent==null?void 0:g.getOffsetParent(p));let E=te?te[q]:0;(!E||!await(g.isElement==null?void 0:g.isElement(te)))&&(E=v.floating[q]||m.floating[A]);const L=F/2-ae/2,Y=E/2-U[A]/2-1,z=Ln(h[k],Y),se=Ln(h[K],Y),ie=z,O=E-U[A]-se,ne=E/2-U[A]/2+L,oe=Eu(ie,ne,O),T=!x.arrow&&ll(d)!=null&&ne!==oe&&m.reference[A]/2-(nene<=0)){var se,ie;const ne=(((se=m.flip)==null?void 0:se.index)||0)+1,oe=E[ne];if(oe&&(!(h==="alignment"?K!==Ma(oe):!1)||z.every(B=>Ma(B.placement)===K?B.overflows[0]>0:!0)))return{data:{index:ne,overflows:z},reset:{placement:oe}};let T=(ie=z.filter(V=>V.overflows[0]<=0).sort((V,B)=>V.overflows[1]-B.overflows[1])[0])==null?void 0:ie.placement;if(!T)switch(_){case"bestFit":{var O;const V=(O=z.filter(B=>{if(te){const ce=Ma(B.placement);return ce===K||ce==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(ce=>ce>0).reduce((ce,ge)=>ce+ge,0)]).sort((B,ce)=>B[1]-ce[1])[0])==null?void 0:O[0];V&&(T=V);break}case"initialPlacement":T=v;break}if(d!==T)return{reset:{placement:T}}}return{}}}};function dp(l,o){return{top:l.top-o.height,right:l.right-o.width,bottom:l.bottom-o.height,left:l.left-o.width}}function fp(l){return Fv.some(o=>l[o]>=0)}const uy=function(l){return l===void 0&&(l={}),{name:"hide",options:l,async fn(o){const{rects:c}=o,{strategy:u="referenceHidden",...d}=nn(l,o);switch(u){case"referenceHidden":{const m=await lr(o,{...d,elementContext:"reference"}),g=dp(m,c.reference);return{data:{referenceHiddenOffsets:g,referenceHidden:fp(g)}}}case"escaped":{const m=await lr(o,{...d,altBoundary:!0}),g=dp(m,c.floating);return{data:{escapedOffsets:g,escaped:fp(g)}}}default:return{}}}}},$p=new Set(["left","top"]);async function dy(l,o){const{placement:c,platform:u,elements:d}=l,m=await(u.isRTL==null?void 0:u.isRTL(d.floating)),g=sn(c),v=ll(c),x=Ma(c)==="y",p=$p.has(g)?-1:1,b=m&&x?-1:1,h=nn(o,l);let{mainAxis:N,crossAxis:_,alignmentAxis:A}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return v&&typeof A=="number"&&(_=v==="end"?A*-1:A),x?{x:_*b,y:N*p}:{x:N*p,y:_*b}}const fy=function(l){return l===void 0&&(l=0),{name:"offset",options:l,async fn(o){var c,u;const{x:d,y:m,placement:g,middlewareData:v}=o,x=await dy(o,l);return g===((c=v.offset)==null?void 0:c.placement)&&(u=v.arrow)!=null&&u.alignmentOffset?{}:{x:d+x.x,y:m+x.y,data:{...x,placement:g}}}}},my=function(l){return l===void 0&&(l={}),{name:"shift",options:l,async fn(o){const{x:c,y:u,placement:d}=o,{mainAxis:m=!0,crossAxis:g=!1,limiter:v={fn:G=>{let{x:k,y:K}=G;return{x:k,y:K}}},...x}=nn(l,o),p={x:c,y:u},b=await lr(o,x),h=Ma(sn(d)),N=Vu(h);let _=p[N],A=p[h];if(m){const G=N==="y"?"top":"left",k=N==="y"?"bottom":"right",K=_+b[G],q=_-b[k];_=Eu(K,_,q)}if(g){const G=h==="y"?"top":"left",k=h==="y"?"bottom":"right",K=A+b[G],q=A-b[k];A=Eu(K,A,q)}const U=v.fn({...o,[N]:_,[h]:A});return{...U,data:{x:U.x-c,y:U.y-u,enabled:{[N]:m,[h]:g}}}}}},hy=function(l){return l===void 0&&(l={}),{options:l,fn(o){const{x:c,y:u,placement:d,rects:m,middlewareData:g}=o,{offset:v=0,mainAxis:x=!0,crossAxis:p=!0}=nn(l,o),b={x:c,y:u},h=Ma(d),N=Vu(h);let _=b[N],A=b[h];const U=nn(v,o),G=typeof U=="number"?{mainAxis:U,crossAxis:0}:{mainAxis:0,crossAxis:0,...U};if(x){const q=N==="y"?"height":"width",F=m.reference[N]-m.floating[q]+G.mainAxis,ae=m.reference[N]+m.reference[q]-G.mainAxis;_ae&&(_=ae)}if(p){var k,K;const q=N==="y"?"width":"height",F=$p.has(sn(d)),ae=m.reference[h]-m.floating[q]+(F&&((k=g.offset)==null?void 0:k[h])||0)+(F?0:G.crossAxis),te=m.reference[h]+m.reference[q]+(F?0:((K=g.offset)==null?void 0:K[h])||0)-(F?G.crossAxis:0);Ate&&(A=te)}return{[N]:_,[h]:A}}}},py=function(l){return l===void 0&&(l={}),{name:"size",options:l,async fn(o){var c,u;const{placement:d,rects:m,platform:g,elements:v}=o,{apply:x=()=>{},...p}=nn(l,o),b=await lr(o,p),h=sn(d),N=ll(d),_=Ma(d)==="y",{width:A,height:U}=m.floating;let G,k;h==="top"||h==="bottom"?(G=h,k=N===(await(g.isRTL==null?void 0:g.isRTL(v.floating))?"start":"end")?"left":"right"):(k=h,G=N==="end"?"top":"bottom");const K=U-b.top-b.bottom,q=A-b.left-b.right,F=Ln(U-b[G],K),ae=Ln(A-b[k],q),te=!o.middlewareData.shift;let E=F,L=ae;if((c=o.middlewareData.shift)!=null&&c.enabled.x&&(L=q),(u=o.middlewareData.shift)!=null&&u.enabled.y&&(E=K),te&&!N){const z=It(b.left,0),se=It(b.right,0),ie=It(b.top,0),O=It(b.bottom,0);_?L=A-2*(z!==0||se!==0?z+se:It(b.left,b.right)):E=U-2*(ie!==0||O!==0?ie+O:It(b.top,b.bottom))}await x({...o,availableWidth:L,availableHeight:E});const Y=await g.getDimensions(v.floating);return A!==Y.width||U!==Y.height?{reset:{rects:!0}}:{}}}};function $o(){return typeof window<"u"}function rl(l){return Qp(l)?(l.nodeName||"").toLowerCase():"#document"}function ea(l){var o;return(l==null||(o=l.ownerDocument)==null?void 0:o.defaultView)||window}function La(l){var o;return(o=(Qp(l)?l.ownerDocument:l.document)||window.document)==null?void 0:o.documentElement}function Qp(l){return $o()?l instanceof Node||l instanceof ea(l).Node:!1}function wa(l){return $o()?l instanceof Element||l instanceof ea(l).Element:!1}function Ra(l){return $o()?l instanceof HTMLElement||l instanceof ea(l).HTMLElement:!1}function mp(l){return!$o()||typeof ShadowRoot>"u"?!1:l instanceof ShadowRoot||l instanceof ea(l).ShadowRoot}const gy=new Set(["inline","contents"]);function ir(l){const{overflow:o,overflowX:c,overflowY:u,display:d}=Na(l);return/auto|scroll|overlay|hidden|clip/.test(o+u+c)&&!gy.has(d)}const xy=new Set(["table","td","th"]);function vy(l){return xy.has(rl(l))}const yy=[":popover-open",":modal"];function Qo(l){return yy.some(o=>{try{return l.matches(o)}catch{return!1}})}const by=["transform","translate","scale","rotate","perspective"],wy=["transform","translate","scale","rotate","perspective","filter"],Ny=["paint","layout","strict","content"];function Qu(l){const o=Zu(),c=wa(l)?Na(l):l;return by.some(u=>c[u]?c[u]!=="none":!1)||(c.containerType?c.containerType!=="normal":!1)||!o&&(c.backdropFilter?c.backdropFilter!=="none":!1)||!o&&(c.filter?c.filter!=="none":!1)||wy.some(u=>(c.willChange||"").includes(u))||Ny.some(u=>(c.contain||"").includes(u))}function jy(l){let o=Un(l);for(;Ra(o)&&!el(o);){if(Qu(o))return o;if(Qo(o))return null;o=Un(o)}return null}function Zu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Sy=new Set(["html","body","#document"]);function el(l){return Sy.has(rl(l))}function Na(l){return ea(l).getComputedStyle(l)}function Zo(l){return wa(l)?{scrollLeft:l.scrollLeft,scrollTop:l.scrollTop}:{scrollLeft:l.scrollX,scrollTop:l.scrollY}}function Un(l){if(rl(l)==="html")return l;const o=l.assignedSlot||l.parentNode||mp(l)&&l.host||La(l);return mp(o)?o.host:o}function Zp(l){const o=Un(l);return el(o)?l.ownerDocument?l.ownerDocument.body:l.body:Ra(o)&&ir(o)?o:Zp(o)}function rr(l,o,c){var u;o===void 0&&(o=[]),c===void 0&&(c=!0);const d=Zp(l),m=d===((u=l.ownerDocument)==null?void 0:u.body),g=ea(d);if(m){const v=ku(g);return o.concat(g,g.visualViewport||[],ir(d)?d:[],v&&c?rr(v):[])}return o.concat(d,rr(d,[],c))}function ku(l){return l.parent&&Object.getPrototypeOf(l.parent)?l.frameElement:null}function Kp(l){const o=Na(l);let c=parseFloat(o.width)||0,u=parseFloat(o.height)||0;const d=Ra(l),m=d?l.offsetWidth:c,g=d?l.offsetHeight:u,v=Ro(c)!==m||Ro(u)!==g;return v&&(c=m,u=g),{width:c,height:u,$:v}}function Ku(l){return wa(l)?l:l.contextElement}function Ps(l){const o=Ku(l);if(!Ra(o))return za(1);const c=o.getBoundingClientRect(),{width:u,height:d,$:m}=Kp(o);let g=(m?Ro(c.width):c.width)/u,v=(m?Ro(c.height):c.height)/d;return(!g||!Number.isFinite(g))&&(g=1),(!v||!Number.isFinite(v))&&(v=1),{x:g,y:v}}const _y=za(0);function Jp(l){const o=ea(l);return!Zu()||!o.visualViewport?_y:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function Ey(l,o,c){return o===void 0&&(o=!1),!c||o&&c!==ea(l)?!1:o}function os(l,o,c,u){o===void 0&&(o=!1),c===void 0&&(c=!1);const d=l.getBoundingClientRect(),m=Ku(l);let g=za(1);o&&(u?wa(u)&&(g=Ps(u)):g=Ps(l));const v=Ey(m,c,u)?Jp(m):za(0);let x=(d.left+v.x)/g.x,p=(d.top+v.y)/g.y,b=d.width/g.x,h=d.height/g.y;if(m){const N=ea(m),_=u&&wa(u)?ea(u):u;let A=N,U=ku(A);for(;U&&u&&_!==A;){const G=Ps(U),k=U.getBoundingClientRect(),K=Na(U),q=k.left+(U.clientLeft+parseFloat(K.paddingLeft))*G.x,F=k.top+(U.clientTop+parseFloat(K.paddingTop))*G.y;x*=G.x,p*=G.y,b*=G.x,h*=G.y,x+=q,p+=F,A=ea(U),U=ku(A)}}return Lo({width:b,height:h,x,y:p})}function Ko(l,o){const c=Zo(l).scrollLeft;return o?o.left+c:os(La(l)).left+c}function Fp(l,o){const c=l.getBoundingClientRect(),u=c.left+o.scrollLeft-Ko(l,c),d=c.top+o.scrollTop;return{x:u,y:d}}function Cy(l){let{elements:o,rect:c,offsetParent:u,strategy:d}=l;const m=d==="fixed",g=La(u),v=o?Qo(o.floating):!1;if(u===g||v&&m)return c;let x={scrollLeft:0,scrollTop:0},p=za(1);const b=za(0),h=Ra(u);if((h||!h&&!m)&&((rl(u)!=="body"||ir(g))&&(x=Zo(u)),Ra(u))){const _=os(u);p=Ps(u),b.x=_.x+u.clientLeft,b.y=_.y+u.clientTop}const N=g&&!h&&!m?Fp(g,x):za(0);return{width:c.width*p.x,height:c.height*p.y,x:c.x*p.x-x.scrollLeft*p.x+b.x+N.x,y:c.y*p.y-x.scrollTop*p.y+b.y+N.y}}function ky(l){return Array.from(l.getClientRects())}function Ty(l){const o=La(l),c=Zo(l),u=l.ownerDocument.body,d=It(o.scrollWidth,o.clientWidth,u.scrollWidth,u.clientWidth),m=It(o.scrollHeight,o.clientHeight,u.scrollHeight,u.clientHeight);let g=-c.scrollLeft+Ko(l);const v=-c.scrollTop;return Na(u).direction==="rtl"&&(g+=It(o.clientWidth,u.clientWidth)-d),{width:d,height:m,x:g,y:v}}const hp=25;function Ay(l,o){const c=ea(l),u=La(l),d=c.visualViewport;let m=u.clientWidth,g=u.clientHeight,v=0,x=0;if(d){m=d.width,g=d.height;const b=Zu();(!b||b&&o==="fixed")&&(v=d.offsetLeft,x=d.offsetTop)}const p=Ko(u);if(p<=0){const b=u.ownerDocument,h=b.body,N=getComputedStyle(h),_=b.compatMode==="CSS1Compat"&&parseFloat(N.marginLeft)+parseFloat(N.marginRight)||0,A=Math.abs(u.clientWidth-h.clientWidth-_);A<=hp&&(m-=A)}else p<=hp&&(m+=p);return{width:m,height:g,x:v,y:x}}const My=new Set(["absolute","fixed"]);function Oy(l,o){const c=os(l,!0,o==="fixed"),u=c.top+l.clientTop,d=c.left+l.clientLeft,m=Ra(l)?Ps(l):za(1),g=l.clientWidth*m.x,v=l.clientHeight*m.y,x=d*m.x,p=u*m.y;return{width:g,height:v,x,y:p}}function pp(l,o,c){let u;if(o==="viewport")u=Ay(l,c);else if(o==="document")u=Ty(La(l));else if(wa(o))u=Oy(o,c);else{const d=Jp(l);u={x:o.x-d.x,y:o.y-d.y,width:o.width,height:o.height}}return Lo(u)}function Wp(l,o){const c=Un(l);return c===o||!wa(c)||el(c)?!1:Na(c).position==="fixed"||Wp(c,o)}function zy(l,o){const c=o.get(l);if(c)return c;let u=rr(l,[],!1).filter(v=>wa(v)&&rl(v)!=="body"),d=null;const m=Na(l).position==="fixed";let g=m?Un(l):l;for(;wa(g)&&!el(g);){const v=Na(g),x=Qu(g);!x&&v.position==="fixed"&&(d=null),(m?!x&&!d:!x&&v.position==="static"&&!!d&&My.has(d.position)||ir(g)&&!x&&Wp(l,g))?u=u.filter(b=>b!==g):d=v,g=Un(g)}return o.set(l,u),u}function Ry(l){let{element:o,boundary:c,rootBoundary:u,strategy:d}=l;const g=[...c==="clippingAncestors"?Qo(o)?[]:zy(o,this._c):[].concat(c),u],v=g[0],x=g.reduce((p,b)=>{const h=pp(o,b,d);return p.top=It(h.top,p.top),p.right=Ln(h.right,p.right),p.bottom=Ln(h.bottom,p.bottom),p.left=It(h.left,p.left),p},pp(o,v,d));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function Dy(l){const{width:o,height:c}=Kp(l);return{width:o,height:c}}function Ly(l,o,c){const u=Ra(o),d=La(o),m=c==="fixed",g=os(l,!0,m,o);let v={scrollLeft:0,scrollTop:0};const x=za(0);function p(){x.x=Ko(d)}if(u||!u&&!m)if((rl(o)!=="body"||ir(d))&&(v=Zo(o)),u){const _=os(o,!0,m,o);x.x=_.x+o.clientLeft,x.y=_.y+o.clientTop}else d&&p();m&&!u&&d&&p();const b=d&&!u&&!m?Fp(d,v):za(0),h=g.left+v.scrollLeft-x.x-b.x,N=g.top+v.scrollTop-x.y-b.y;return{x:h,y:N,width:g.width,height:g.height}}function xu(l){return Na(l).position==="static"}function gp(l,o){if(!Ra(l)||Na(l).position==="fixed")return null;if(o)return o(l);let c=l.offsetParent;return La(l)===c&&(c=c.ownerDocument.body),c}function Pp(l,o){const c=ea(l);if(Qo(l))return c;if(!Ra(l)){let d=Un(l);for(;d&&!el(d);){if(wa(d)&&!xu(d))return d;d=Un(d)}return c}let u=gp(l,o);for(;u&&vy(u)&&xu(u);)u=gp(u,o);return u&&el(u)&&xu(u)&&!Qu(u)?c:u||jy(l)||c}const Uy=async function(l){const o=this.getOffsetParent||Pp,c=this.getDimensions,u=await c(l.floating);return{reference:Ly(l.reference,await o(l.floating),l.strategy),floating:{x:0,y:0,width:u.width,height:u.height}}};function Hy(l){return Na(l).direction==="rtl"}const By={convertOffsetParentRelativeRectToViewportRelativeRect:Cy,getDocumentElement:La,getClippingRect:Ry,getOffsetParent:Pp,getElementRects:Uy,getClientRects:ky,getDimensions:Dy,getScale:Ps,isElement:wa,isRTL:Hy};function Ip(l,o){return l.x===o.x&&l.y===o.y&&l.width===o.width&&l.height===o.height}function qy(l,o){let c=null,u;const d=La(l);function m(){var v;clearTimeout(u),(v=c)==null||v.disconnect(),c=null}function g(v,x){v===void 0&&(v=!1),x===void 0&&(x=1),m();const p=l.getBoundingClientRect(),{left:b,top:h,width:N,height:_}=p;if(v||o(),!N||!_)return;const A=Eo(h),U=Eo(d.clientWidth-(b+N)),G=Eo(d.clientHeight-(h+_)),k=Eo(b),q={rootMargin:-A+"px "+-U+"px "+-G+"px "+-k+"px",threshold:It(0,Ln(1,x))||1};let F=!0;function ae(te){const E=te[0].intersectionRatio;if(E!==x){if(!F)return g();E?g(!1,E):u=setTimeout(()=>{g(!1,1e-7)},1e3)}E===1&&!Ip(p,l.getBoundingClientRect())&&g(),F=!1}try{c=new IntersectionObserver(ae,{...q,root:d.ownerDocument})}catch{c=new IntersectionObserver(ae,q)}c.observe(l)}return g(!0),m}function Yy(l,o,c,u){u===void 0&&(u={});const{ancestorScroll:d=!0,ancestorResize:m=!0,elementResize:g=typeof ResizeObserver=="function",layoutShift:v=typeof IntersectionObserver=="function",animationFrame:x=!1}=u,p=Ku(l),b=d||m?[...p?rr(p):[],...rr(o)]:[];b.forEach(k=>{d&&k.addEventListener("scroll",c,{passive:!0}),m&&k.addEventListener("resize",c)});const h=p&&v?qy(p,c):null;let N=-1,_=null;g&&(_=new ResizeObserver(k=>{let[K]=k;K&&K.target===p&&_&&(_.unobserve(o),cancelAnimationFrame(N),N=requestAnimationFrame(()=>{var q;(q=_)==null||q.observe(o)})),c()}),p&&!x&&_.observe(p),_.observe(o));let A,U=x?os(l):null;x&&G();function G(){const k=os(l);U&&!Ip(U,k)&&c(),U=k,A=requestAnimationFrame(G)}return c(),()=>{var k;b.forEach(K=>{d&&K.removeEventListener("scroll",c),m&&K.removeEventListener("resize",c)}),h?.(),(k=_)==null||k.disconnect(),_=null,x&&cancelAnimationFrame(A)}}const Gy=fy,Vy=my,Xy=cy,$y=py,Qy=uy,xp=iy,Zy=hy,Ky=(l,o,c)=>{const u=new Map,d={platform:By,...c},m={...d.platform,_c:u};return oy(l,o,{...d,platform:m})};var Jy=typeof document<"u",Fy=function(){},Oo=Jy?w.useLayoutEffect:Fy;function Uo(l,o){if(l===o)return!0;if(typeof l!=typeof o)return!1;if(typeof l=="function"&&l.toString()===o.toString())return!0;let c,u,d;if(l&&o&&typeof l=="object"){if(Array.isArray(l)){if(c=l.length,c!==o.length)return!1;for(u=c;u--!==0;)if(!Uo(l[u],o[u]))return!1;return!0}if(d=Object.keys(l),c=d.length,c!==Object.keys(o).length)return!1;for(u=c;u--!==0;)if(!{}.hasOwnProperty.call(o,d[u]))return!1;for(u=c;u--!==0;){const m=d[u];if(!(m==="_owner"&&l.$$typeof)&&!Uo(l[m],o[m]))return!1}return!0}return l!==l&&o!==o}function e0(l){return typeof window>"u"?1:(l.ownerDocument.defaultView||window).devicePixelRatio||1}function vp(l,o){const c=e0(l);return Math.round(o*c)/c}function vu(l){const o=w.useRef(l);return Oo(()=>{o.current=l}),o}function Wy(l){l===void 0&&(l={});const{placement:o="bottom",strategy:c="absolute",middleware:u=[],platform:d,elements:{reference:m,floating:g}={},transform:v=!0,whileElementsMounted:x,open:p}=l,[b,h]=w.useState({x:0,y:0,strategy:c,placement:o,middlewareData:{},isPositioned:!1}),[N,_]=w.useState(u);Uo(N,u)||_(u);const[A,U]=w.useState(null),[G,k]=w.useState(null),K=w.useCallback(B=>{B!==te.current&&(te.current=B,U(B))},[]),q=w.useCallback(B=>{B!==E.current&&(E.current=B,k(B))},[]),F=m||A,ae=g||G,te=w.useRef(null),E=w.useRef(null),L=w.useRef(b),Y=x!=null,z=vu(x),se=vu(d),ie=vu(p),O=w.useCallback(()=>{if(!te.current||!E.current)return;const B={placement:o,strategy:c,middleware:N};se.current&&(B.platform=se.current),Ky(te.current,E.current,B).then(ce=>{const ge={...ce,isPositioned:ie.current!==!1};ne.current&&!Uo(L.current,ge)&&(L.current=ge,Gu.flushSync(()=>{h(ge)}))})},[N,o,c,se,ie]);Oo(()=>{p===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,h(B=>({...B,isPositioned:!1})))},[p]);const ne=w.useRef(!1);Oo(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Oo(()=>{if(F&&(te.current=F),ae&&(E.current=ae),F&&ae){if(z.current)return z.current(F,ae,O);O()}},[F,ae,O,z,Y]);const oe=w.useMemo(()=>({reference:te,floating:E,setReference:K,setFloating:q}),[K,q]),T=w.useMemo(()=>({reference:F,floating:ae}),[F,ae]),V=w.useMemo(()=>{const B={position:c,left:0,top:0};if(!T.floating)return B;const ce=vp(T.floating,b.x),ge=vp(T.floating,b.y);return v?{...B,transform:"translate("+ce+"px, "+ge+"px)",...e0(T.floating)>=1.5&&{willChange:"transform"}}:{position:c,left:ce,top:ge}},[c,v,T.floating,b.x,b.y]);return w.useMemo(()=>({...b,update:O,refs:oe,elements:T,floatingStyles:V}),[b,O,oe,T,V])}const Py=l=>{function o(c){return{}.hasOwnProperty.call(c,"current")}return{name:"arrow",options:l,fn(c){const{element:u,padding:d}=typeof l=="function"?l(c):l;return u&&o(u)?u.current!=null?xp({element:u.current,padding:d}).fn(c):{}:u?xp({element:u,padding:d}).fn(c):{}}}},Iy=(l,o)=>({...Gy(l),options:[l,o]}),eb=(l,o)=>({...Vy(l),options:[l,o]}),tb=(l,o)=>({...Zy(l),options:[l,o]}),ab=(l,o)=>({...Xy(l),options:[l,o]}),nb=(l,o)=>({...$y(l),options:[l,o]}),sb=(l,o)=>({...Qy(l),options:[l,o]}),lb=(l,o)=>({...Py(l),options:[l,o]});var rb="Arrow",t0=w.forwardRef((l,o)=>{const{children:c,width:u=10,height:d=5,...m}=l;return s.jsx(Da.svg,{...m,ref:o,width:u,height:d,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:l.asChild?c:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});t0.displayName=rb;var ob=t0;function a0(l){const[o,c]=w.useState(void 0);return Dn(()=>{if(l){c({width:l.offsetWidth,height:l.offsetHeight});const u=new ResizeObserver(d=>{if(!Array.isArray(d)||!d.length)return;const m=d[0];let g,v;if("borderBoxSize"in m){const x=m.borderBoxSize,p=Array.isArray(x)?x[0]:x;g=p.inlineSize,v=p.blockSize}else g=l.offsetWidth,v=l.offsetHeight;c({width:g,height:v})});return u.observe(l,{box:"border-box"}),()=>u.unobserve(l)}else c(void 0)},[l]),o}var Ju="Popper",[n0,s0]=Yu(Ju),[ib,l0]=n0(Ju),r0=l=>{const{__scopePopper:o,children:c}=l,[u,d]=w.useState(null);return s.jsx(ib,{scope:o,anchor:u,onAnchorChange:d,children:c})};r0.displayName=Ju;var o0="PopperAnchor",i0=w.forwardRef((l,o)=>{const{__scopePopper:c,virtualRef:u,...d}=l,m=l0(o0,c),g=w.useRef(null),v=ln(o,g),x=w.useRef(null);return w.useEffect(()=>{const p=x.current;x.current=u?.current||g.current,p!==x.current&&m.onAnchorChange(x.current)}),u?null:s.jsx(Da.div,{...d,ref:v})});i0.displayName=o0;var Fu="PopperContent",[cb,ub]=n0(Fu),c0=w.forwardRef((l,o)=>{const{__scopePopper:c,side:u="bottom",sideOffset:d=0,align:m="center",alignOffset:g=0,arrowPadding:v=0,avoidCollisions:x=!0,collisionBoundary:p=[],collisionPadding:b=0,sticky:h="partial",hideWhenDetached:N=!1,updatePositionStrategy:_="optimized",onPlaced:A,...U}=l,G=l0(Fu,c),[k,K]=w.useState(null),q=ln(o,ue=>K(ue)),[F,ae]=w.useState(null),te=a0(F),E=te?.width??0,L=te?.height??0,Y=u+(m!=="center"?"-"+m:""),z=typeof b=="number"?b:{top:0,right:0,bottom:0,left:0,...b},se=Array.isArray(p)?p:[p],ie=se.length>0,O={padding:z,boundary:se.filter(fb),altBoundary:ie},{refs:ne,floatingStyles:oe,placement:T,isPositioned:V,middlewareData:B}=Wy({strategy:"fixed",placement:Y,whileElementsMounted:(...ue)=>Yy(...ue,{animationFrame:_==="always"}),elements:{reference:G.anchor},middleware:[Iy({mainAxis:d+L,alignmentAxis:g}),x&&eb({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?tb():void 0,...O}),x&&ab({...O}),nb({...O,apply:({elements:ue,rects:we,availableWidth:ke,availableHeight:We})=>{const{width:it,height:qe}=we.reference,P=ue.floating.style;P.setProperty("--radix-popper-available-width",`${ke}px`),P.setProperty("--radix-popper-available-height",`${We}px`),P.setProperty("--radix-popper-anchor-width",`${it}px`),P.setProperty("--radix-popper-anchor-height",`${qe}px`)}}),F&&lb({element:F,padding:v}),mb({arrowWidth:E,arrowHeight:L}),N&&sb({strategy:"referenceHidden",...O})]}),[ce,ge]=f0(T),S=Xo(A);Dn(()=>{V&&S?.()},[V,S]);const Q=B.arrow?.x,$=B.arrow?.y,ee=B.arrow?.centerOffset!==0,[re,xe]=w.useState();return Dn(()=>{k&&xe(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:V?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:l.dir,children:s.jsx(cb,{scope:c,placedSide:ce,onArrowChange:ae,arrowX:Q,arrowY:$,shouldHideArrow:ee,children:s.jsx(Da.div,{"data-side":ce,"data-align":ge,...U,ref:q,style:{...U.style,animation:V?void 0:"none"}})})})});c0.displayName=Fu;var u0="PopperArrow",db={top:"bottom",right:"left",bottom:"top",left:"right"},d0=w.forwardRef(function(o,c){const{__scopePopper:u,...d}=o,m=ub(u0,u),g=db[m.placedSide];return s.jsx("span",{ref:m.onArrowChange,style:{position:"absolute",left:m.arrowX,top:m.arrowY,[g]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[m.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[m.placedSide],visibility:m.shouldHideArrow?"hidden":void 0},children:s.jsx(ob,{...d,ref:c,style:{...d.style,display:"block"}})})});d0.displayName=u0;function fb(l){return l!==null}var mb=l=>({name:"transformOrigin",options:l,fn(o){const{placement:c,rects:u,middlewareData:d}=o,g=d.arrow?.centerOffset!==0,v=g?0:l.arrowWidth,x=g?0:l.arrowHeight,[p,b]=f0(c),h={start:"0%",center:"50%",end:"100%"}[b],N=(d.arrow?.x??0)+v/2,_=(d.arrow?.y??0)+x/2;let A="",U="";return p==="bottom"?(A=g?h:`${N}px`,U=`${-x}px`):p==="top"?(A=g?h:`${N}px`,U=`${u.floating.height+x}px`):p==="right"?(A=`${-x}px`,U=g?h:`${_}px`):p==="left"&&(A=`${u.floating.width+x}px`,U=g?h:`${_}px`),{data:{x:A,y:U}}}});function f0(l){const[o,c="center"]=l.split("-");return[o,c]}var hb=r0,pb=i0,gb=c0,xb=d0,vb="Portal",m0=w.forwardRef((l,o)=>{const{container:c,...u}=l,[d,m]=w.useState(!1);Dn(()=>m(!0),[]);const g=c||d&&globalThis?.document?.body;return g?qp.createPortal(s.jsx(Da.div,{...u,ref:o}),g):null});m0.displayName=vb;function yb(l,o){return w.useReducer((c,u)=>o[c][u]??c,l)}var Wu=l=>{const{present:o,children:c}=l,u=bb(o),d=typeof c=="function"?c({present:u.isPresent}):w.Children.only(c),m=ln(u.ref,wb(d));return typeof c=="function"||u.isPresent?w.cloneElement(d,{ref:m}):null};Wu.displayName="Presence";function bb(l){const[o,c]=w.useState(),u=w.useRef(null),d=w.useRef(l),m=w.useRef("none"),g=l?"mounted":"unmounted",[v,x]=yb(g,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=Co(u.current);m.current=v==="mounted"?p:"none"},[v]),Dn(()=>{const p=u.current,b=d.current;if(b!==l){const N=m.current,_=Co(p);l?x("MOUNT"):_==="none"||p?.display==="none"?x("UNMOUNT"):x(b&&N!==_?"ANIMATION_OUT":"UNMOUNT"),d.current=l}},[l,x]),Dn(()=>{if(o){let p;const b=o.ownerDocument.defaultView??window,h=_=>{const U=Co(u.current).includes(CSS.escape(_.animationName));if(_.target===o&&U&&(x("ANIMATION_END"),!d.current)){const G=o.style.animationFillMode;o.style.animationFillMode="forwards",p=b.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=G)})}},N=_=>{_.target===o&&(m.current=Co(u.current))};return o.addEventListener("animationstart",N),o.addEventListener("animationcancel",h),o.addEventListener("animationend",h),()=>{b.clearTimeout(p),o.removeEventListener("animationstart",N),o.removeEventListener("animationcancel",h),o.removeEventListener("animationend",h)}}else x("ANIMATION_END")},[o,x]),{isPresent:["mounted","unmountSuspended"].includes(v),ref:w.useCallback(p=>{u.current=p?getComputedStyle(p):null,c(p)},[])}}function Co(l){return l?.animationName||"none"}function wb(l){let o=Object.getOwnPropertyDescriptor(l.props,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning;return c?l.ref:(o=Object.getOwnPropertyDescriptor(l,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}var Nb=Symbol("radix.slottable");function jb(l){const o=({children:c})=>s.jsx(s.Fragment,{children:c});return o.displayName=`${l}.Slottable`,o.__radixId=Nb,o}var Sb=Bu[" useInsertionEffect ".trim().toString()]||Dn;function h0({prop:l,defaultProp:o,onChange:c=()=>{},caller:u}){const[d,m,g]=_b({defaultProp:o,onChange:c}),v=l!==void 0,x=v?l:d;{const b=w.useRef(l!==void 0);w.useEffect(()=>{const h=b.current;h!==v&&console.warn(`${u} is changing from ${h?"controlled":"uncontrolled"} to ${v?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),b.current=v},[v,u])}const p=w.useCallback(b=>{if(v){const h=Eb(b)?b(l):b;h!==l&&g.current?.(h)}else m(b)},[v,l,m,g]);return[x,p]}function _b({defaultProp:l,onChange:o}){const[c,u]=w.useState(l),d=w.useRef(c),m=w.useRef(o);return Sb(()=>{m.current=o},[o]),w.useEffect(()=>{d.current!==c&&(m.current?.(c),d.current=c)},[c,d]),[c,u,m]}function Eb(l){return typeof l=="function"}var Cb=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),kb="VisuallyHidden",p0=w.forwardRef((l,o)=>s.jsx(Da.span,{...l,ref:o,style:{...Cb,...l.style}}));p0.displayName=kb;var Tb=p0,[Jo]=Yu("Tooltip",[s0]),Fo=s0(),g0="TooltipProvider",Ab=700,Tu="tooltip.open",[Mb,Pu]=Jo(g0),x0=l=>{const{__scopeTooltip:o,delayDuration:c=Ab,skipDelayDuration:u=300,disableHoverableContent:d=!1,children:m}=l,g=w.useRef(!0),v=w.useRef(!1),x=w.useRef(0);return w.useEffect(()=>{const p=x.current;return()=>window.clearTimeout(p)},[]),s.jsx(Mb,{scope:o,isOpenDelayedRef:g,delayDuration:c,onOpen:w.useCallback(()=>{window.clearTimeout(x.current),g.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>g.current=!0,u)},[u]),isPointerInTransitRef:v,onPointerInTransitChange:w.useCallback(p=>{v.current=p},[]),disableHoverableContent:d,children:m})};x0.displayName=g0;var or="Tooltip",[Ob,cr]=Jo(or),v0=l=>{const{__scopeTooltip:o,children:c,open:u,defaultOpen:d,onOpenChange:m,disableHoverableContent:g,delayDuration:v}=l,x=Pu(or,l.__scopeTooltip),p=Fo(o),[b,h]=w.useState(null),N=Jv(),_=w.useRef(0),A=g??x.disableHoverableContent,U=v??x.delayDuration,G=w.useRef(!1),[k,K]=h0({prop:u,defaultProp:d??!1,onChange:E=>{E?(x.onOpen(),document.dispatchEvent(new CustomEvent(Tu))):x.onClose(),m?.(E)},caller:or}),q=w.useMemo(()=>k?G.current?"delayed-open":"instant-open":"closed",[k]),F=w.useCallback(()=>{window.clearTimeout(_.current),_.current=0,G.current=!1,K(!0)},[K]),ae=w.useCallback(()=>{window.clearTimeout(_.current),_.current=0,K(!1)},[K]),te=w.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>{G.current=!0,K(!0),_.current=0},U)},[U,K]);return w.useEffect(()=>()=>{_.current&&(window.clearTimeout(_.current),_.current=0)},[]),s.jsx(hb,{...p,children:s.jsx(Ob,{scope:o,contentId:N,open:k,stateAttribute:q,trigger:b,onTriggerChange:h,onTriggerEnter:w.useCallback(()=>{x.isOpenDelayedRef.current?te():F()},[x.isOpenDelayedRef,te,F]),onTriggerLeave:w.useCallback(()=>{A?ae():(window.clearTimeout(_.current),_.current=0)},[ae,A]),onOpen:F,onClose:ae,disableHoverableContent:A,children:c})})};v0.displayName=or;var Au="TooltipTrigger",y0=w.forwardRef((l,o)=>{const{__scopeTooltip:c,...u}=l,d=cr(Au,c),m=Pu(Au,c),g=Fo(c),v=w.useRef(null),x=ln(o,v,d.onTriggerChange),p=w.useRef(!1),b=w.useRef(!1),h=w.useCallback(()=>p.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(pb,{asChild:!0,...g,children:s.jsx(Da.button,{"aria-describedby":d.open?d.contentId:void 0,"data-state":d.stateAttribute,...u,ref:x,onPointerMove:Aa(l.onPointerMove,N=>{N.pointerType!=="touch"&&!b.current&&!m.isPointerInTransitRef.current&&(d.onTriggerEnter(),b.current=!0)}),onPointerLeave:Aa(l.onPointerLeave,()=>{d.onTriggerLeave(),b.current=!1}),onPointerDown:Aa(l.onPointerDown,()=>{d.open&&d.onClose(),p.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Aa(l.onFocus,()=>{p.current||d.onOpen()}),onBlur:Aa(l.onBlur,d.onClose),onClick:Aa(l.onClick,d.onClose)})})});y0.displayName=Au;var Iu="TooltipPortal",[zb,Rb]=Jo(Iu,{forceMount:void 0}),b0=l=>{const{__scopeTooltip:o,forceMount:c,children:u,container:d}=l,m=cr(Iu,o);return s.jsx(zb,{scope:o,forceMount:c,children:s.jsx(Wu,{present:c||m.open,children:s.jsx(m0,{asChild:!0,container:d,children:u})})})};b0.displayName=Iu;var tl="TooltipContent",w0=w.forwardRef((l,o)=>{const c=Rb(tl,l.__scopeTooltip),{forceMount:u=c.forceMount,side:d="top",...m}=l,g=cr(tl,l.__scopeTooltip);return s.jsx(Wu,{present:u||g.open,children:g.disableHoverableContent?s.jsx(N0,{side:d,...m,ref:o}):s.jsx(Db,{side:d,...m,ref:o})})}),Db=w.forwardRef((l,o)=>{const c=cr(tl,l.__scopeTooltip),u=Pu(tl,l.__scopeTooltip),d=w.useRef(null),m=ln(o,d),[g,v]=w.useState(null),{trigger:x,onClose:p}=c,b=d.current,{onPointerInTransitChange:h}=u,N=w.useCallback(()=>{v(null),h(!1)},[h]),_=w.useCallback((A,U)=>{const G=A.currentTarget,k={x:A.clientX,y:A.clientY},K=Bb(k,G.getBoundingClientRect()),q=qb(k,K),F=Yb(U.getBoundingClientRect()),ae=Vb([...q,...F]);v(ae),h(!0)},[h]);return w.useEffect(()=>()=>N(),[N]),w.useEffect(()=>{if(x&&b){const A=G=>_(G,b),U=G=>_(G,x);return x.addEventListener("pointerleave",A),b.addEventListener("pointerleave",U),()=>{x.removeEventListener("pointerleave",A),b.removeEventListener("pointerleave",U)}}},[x,b,_,N]),w.useEffect(()=>{if(g){const A=U=>{const G=U.target,k={x:U.clientX,y:U.clientY},K=x?.contains(G)||b?.contains(G),q=!Gb(k,g);K?N():q&&(N(),p())};return document.addEventListener("pointermove",A),()=>document.removeEventListener("pointermove",A)}},[x,b,g,p,N]),s.jsx(N0,{...l,ref:m})}),[Lb,Ub]=Jo(or,{isInside:!1}),Hb=jb("TooltipContent"),N0=w.forwardRef((l,o)=>{const{__scopeTooltip:c,children:u,"aria-label":d,onEscapeKeyDown:m,onPointerDownOutside:g,...v}=l,x=cr(tl,c),p=Fo(c),{onClose:b}=x;return w.useEffect(()=>(document.addEventListener(Tu,b),()=>document.removeEventListener(Tu,b)),[b]),w.useEffect(()=>{if(x.trigger){const h=N=>{N.target?.contains(x.trigger)&&b()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[x.trigger,b]),s.jsx(Gp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:m,onPointerDownOutside:g,onFocusOutside:h=>h.preventDefault(),onDismiss:b,children:s.jsxs(gb,{"data-state":x.stateAttribute,...p,...v,ref:o,style:{...v.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(Hb,{children:u}),s.jsx(Lb,{scope:c,isInside:!0,children:s.jsx(Tb,{id:x.contentId,role:"tooltip",children:d||u})})]})})});w0.displayName=tl;var j0="TooltipArrow",S0=w.forwardRef((l,o)=>{const{__scopeTooltip:c,...u}=l,d=Fo(c);return Ub(j0,c).isInside?null:s.jsx(xb,{...d,...u,ref:o})});S0.displayName=j0;function Bb(l,o){const c=Math.abs(o.top-l.y),u=Math.abs(o.bottom-l.y),d=Math.abs(o.right-l.x),m=Math.abs(o.left-l.x);switch(Math.min(c,u,d,m)){case m:return"left";case d:return"right";case c:return"top";case u:return"bottom";default:throw new Error("unreachable")}}function qb(l,o,c=5){const u=[];switch(o){case"top":u.push({x:l.x-c,y:l.y+c},{x:l.x+c,y:l.y+c});break;case"bottom":u.push({x:l.x-c,y:l.y-c},{x:l.x+c,y:l.y-c});break;case"left":u.push({x:l.x+c,y:l.y-c},{x:l.x+c,y:l.y+c});break;case"right":u.push({x:l.x-c,y:l.y-c},{x:l.x-c,y:l.y+c});break}return u}function Yb(l){const{top:o,right:c,bottom:u,left:d}=l;return[{x:d,y:o},{x:c,y:o},{x:c,y:u},{x:d,y:u}]}function Gb(l,o){const{x:c,y:u}=l;let d=!1;for(let m=0,g=o.length-1;mu!=N>u&&c<(h-p)*(u-b)/(N-b)+p&&(d=!d)}return d}function Vb(l){const o=l.slice();return o.sort((c,u)=>c.xu.x?1:c.yu.y?1:0),Xb(o)}function Xb(l){if(l.length<=1)return l.slice();const o=[];for(let u=0;u=2;){const m=o[o.length-1],g=o[o.length-2];if((m.x-g.x)*(d.y-g.y)>=(m.y-g.y)*(d.x-g.x))o.pop();else break}o.push(d)}o.pop();const c=[];for(let u=l.length-1;u>=0;u--){const d=l[u];for(;c.length>=2;){const m=c[c.length-1],g=c[c.length-2];if((m.x-g.x)*(d.y-g.y)>=(m.y-g.y)*(d.x-g.x))c.pop();else break}c.push(d)}return c.pop(),o.length===1&&c.length===1&&o[0].x===c[0].x&&o[0].y===c[0].y?o:o.concat(c)}var $b=x0,Qb=v0,Zb=y0,Kb=b0,Jb=w0,Fb=S0;function _0(l){var o,c,u="";if(typeof l=="string"||typeof l=="number")u+=l;else if(typeof l=="object")if(Array.isArray(l)){var d=l.length;for(o=0;o{const c=new Array(l.length+o.length);for(let u=0;u({classGroupId:l,validator:o}),C0=(l=new Map,o=null,c)=>({nextPart:l,validators:o,classGroupId:c}),Ho="-",yp=[],Ib="arbitrary..",e1=l=>{const o=a1(l),{conflictingClassGroups:c,conflictingClassGroupModifiers:u}=l;return{getClassGroupId:g=>{if(g.startsWith("[")&&g.endsWith("]"))return t1(g);const v=g.split(Ho),x=v[0]===""&&v.length>1?1:0;return k0(v,x,o)},getConflictingClassGroupIds:(g,v)=>{if(v){const x=u[g],p=c[g];return x?p?Wb(p,x):x:p||yp}return c[g]||yp}}},k0=(l,o,c)=>{if(l.length-o===0)return c.classGroupId;const d=l[o],m=c.nextPart.get(d);if(m){const p=k0(l,o+1,m);if(p)return p}const g=c.validators;if(g===null)return;const v=o===0?l.join(Ho):l.slice(o).join(Ho),x=g.length;for(let p=0;pl.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=l.slice(1,-1),c=o.indexOf(":"),u=o.slice(0,c);return u?Ib+u:void 0})(),a1=l=>{const{theme:o,classGroups:c}=l;return n1(c,o)},n1=(l,o)=>{const c=C0();for(const u in l){const d=l[u];ed(d,c,u,o)}return c},ed=(l,o,c,u)=>{const d=l.length;for(let m=0;m{if(typeof l=="string"){l1(l,o,c);return}if(typeof l=="function"){r1(l,o,c,u);return}o1(l,o,c,u)},l1=(l,o,c)=>{const u=l===""?o:T0(o,l);u.classGroupId=c},r1=(l,o,c,u)=>{if(i1(l)){ed(l(u),o,c,u);return}o.validators===null&&(o.validators=[]),o.validators.push(Pb(c,l))},o1=(l,o,c,u)=>{const d=Object.entries(l),m=d.length;for(let g=0;g{let c=l;const u=o.split(Ho),d=u.length;for(let m=0;m"isThemeGetter"in l&&l.isThemeGetter===!0,c1=l=>{if(l<1)return{get:()=>{},set:()=>{}};let o=0,c=Object.create(null),u=Object.create(null);const d=(m,g)=>{c[m]=g,o++,o>l&&(o=0,u=c,c=Object.create(null))};return{get(m){let g=c[m];if(g!==void 0)return g;if((g=u[m])!==void 0)return d(m,g),g},set(m,g){m in c?c[m]=g:d(m,g)}}},Mu="!",bp=":",u1=[],wp=(l,o,c,u,d)=>({modifiers:l,hasImportantModifier:o,baseClassName:c,maybePostfixModifierPosition:u,isExternal:d}),d1=l=>{const{prefix:o,experimentalParseClassName:c}=l;let u=d=>{const m=[];let g=0,v=0,x=0,p;const b=d.length;for(let U=0;Ux?p-x:void 0;return wp(m,_,N,A)};if(o){const d=o+bp,m=u;u=g=>g.startsWith(d)?m(g.slice(d.length)):wp(u1,!1,g,void 0,!0)}if(c){const d=u;u=m=>c({className:m,parseClassName:d})}return u},f1=l=>{const o=new Map;return l.orderSensitiveModifiers.forEach((c,u)=>{o.set(c,1e6+u)}),c=>{const u=[];let d=[];for(let m=0;m0&&(d.sort(),u.push(...d),d=[]),u.push(g)):d.push(g)}return d.length>0&&(d.sort(),u.push(...d)),u}},m1=l=>({cache:c1(l.cacheSize),parseClassName:d1(l),sortModifiers:f1(l),...e1(l)}),h1=/\s+/,p1=(l,o)=>{const{parseClassName:c,getClassGroupId:u,getConflictingClassGroupIds:d,sortModifiers:m}=o,g=[],v=l.trim().split(h1);let x="";for(let p=v.length-1;p>=0;p-=1){const b=v[p],{isExternal:h,modifiers:N,hasImportantModifier:_,baseClassName:A,maybePostfixModifierPosition:U}=c(b);if(h){x=b+(x.length>0?" "+x:x);continue}let G=!!U,k=u(G?A.substring(0,U):A);if(!k){if(!G){x=b+(x.length>0?" "+x:x);continue}if(k=u(A),!k){x=b+(x.length>0?" "+x:x);continue}G=!1}const K=N.length===0?"":N.length===1?N[0]:m(N).join(":"),q=_?K+Mu:K,F=q+k;if(g.indexOf(F)>-1)continue;g.push(F);const ae=d(k,G);for(let te=0;te0?" "+x:x)}return x},g1=(...l)=>{let o=0,c,u,d="";for(;o{if(typeof l=="string")return l;let o,c="";for(let u=0;u{let c,u,d,m;const g=x=>{const p=o.reduce((b,h)=>h(b),l());return c=m1(p),u=c.cache.get,d=c.cache.set,m=v,v(x)},v=x=>{const p=u(x);if(p)return p;const b=p1(x,c);return d(x,b),b};return m=g,(...x)=>m(g1(...x))},v1=[],ut=l=>{const o=c=>c[l]||v1;return o.isThemeGetter=!0,o},M0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,O0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,y1=/^\d+\/\d+$/,b1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,w1=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,N1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,j1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,S1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fs=l=>y1.test(l),Te=l=>!!l&&!Number.isNaN(Number(l)),Rn=l=>!!l&&Number.isInteger(Number(l)),yu=l=>l.endsWith("%")&&Te(l.slice(0,-1)),an=l=>b1.test(l),_1=()=>!0,E1=l=>w1.test(l)&&!N1.test(l),z0=()=>!1,C1=l=>j1.test(l),k1=l=>S1.test(l),T1=l=>!me(l)&&!he(l),A1=l=>ol(l,L0,z0),me=l=>M0.test(l),rs=l=>ol(l,U0,E1),bu=l=>ol(l,D1,Te),Np=l=>ol(l,R0,z0),M1=l=>ol(l,D0,k1),ko=l=>ol(l,H0,C1),he=l=>O0.test(l),sr=l=>il(l,U0),O1=l=>il(l,L1),jp=l=>il(l,R0),z1=l=>il(l,L0),R1=l=>il(l,D0),To=l=>il(l,H0,!0),ol=(l,o,c)=>{const u=M0.exec(l);return u?u[1]?o(u[1]):c(u[2]):!1},il=(l,o,c=!1)=>{const u=O0.exec(l);return u?u[1]?o(u[1]):c:!1},R0=l=>l==="position"||l==="percentage",D0=l=>l==="image"||l==="url",L0=l=>l==="length"||l==="size"||l==="bg-size",U0=l=>l==="length",D1=l=>l==="number",L1=l=>l==="family-name",H0=l=>l==="shadow",U1=()=>{const l=ut("color"),o=ut("font"),c=ut("text"),u=ut("font-weight"),d=ut("tracking"),m=ut("leading"),g=ut("breakpoint"),v=ut("container"),x=ut("spacing"),p=ut("radius"),b=ut("shadow"),h=ut("inset-shadow"),N=ut("text-shadow"),_=ut("drop-shadow"),A=ut("blur"),U=ut("perspective"),G=ut("aspect"),k=ut("ease"),K=ut("animate"),q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ae=()=>[...F(),he,me],te=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],L=()=>[he,me,x],Y=()=>[Fs,"full","auto",...L()],z=()=>[Rn,"none","subgrid",he,me],se=()=>["auto",{span:["full",Rn,he,me]},Rn,he,me],ie=()=>[Rn,"auto",he,me],O=()=>["auto","min","max","fr",he,me],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],oe=()=>["start","end","center","stretch","center-safe","end-safe"],T=()=>["auto",...L()],V=()=>[Fs,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],B=()=>[l,he,me],ce=()=>[...F(),jp,Np,{position:[he,me]}],ge=()=>["no-repeat",{repeat:["","x","y","space","round"]}],S=()=>["auto","cover","contain",z1,A1,{size:[he,me]}],Q=()=>[yu,sr,rs],$=()=>["","none","full",p,he,me],ee=()=>["",Te,sr,rs],re=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[Te,yu,jp,Np],we=()=>["","none",A,he,me],ke=()=>["none",Te,he,me],We=()=>["none",Te,he,me],it=()=>[Te,he,me],qe=()=>[Fs,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[_1],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[T1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[an],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[an],shadow:[an],spacing:["px",Te],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Fs,me,he,G]}],container:["container"],columns:[{columns:[Te,me,he,v]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:ae()}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{start:Y()}],end:[{end:Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[Rn,"auto",he,me]}],basis:[{basis:[Fs,"full","auto",v,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Fs,"auto","initial","none",me]}],grow:[{grow:["",Te,he,me]}],shrink:[{shrink:["",Te,he,me]}],order:[{order:[Rn,"first","last","none",he,me]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:se()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:se()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...oe()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...oe(),"baseline"]}],"place-self":[{"place-self":["auto",...oe()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:T()}],mx:[{mx:T()}],my:[{my:T()}],ms:[{ms:T()}],me:[{me:T()}],mt:[{mt:T()}],mr:[{mr:T()}],mb:[{mb:T()}],ml:[{ml:T()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],w:[{w:[v,"screen",...V()]}],"min-w":[{"min-w":[v,"screen","none",...V()]}],"max-w":[{"max-w":[v,"screen","none","prose",{screen:[g]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh",...V()]}],"font-size":[{text:["base",c,sr,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[u,he,bu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yu,me]}],"font-family":[{font:[O1,me,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[d,he,me]}],"line-clamp":[{"line-clamp":[Te,"none",he,bu]}],leading:[{leading:[m,...L()]}],"list-image":[{"list-image":["none",he,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",he,rs]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Te,"auto",he,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",he,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:ge()}],"bg-size":[{bg:S()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Rn,he,me],radial:["",he,me],conic:[Rn,he,me]},R1,M1]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,he,me]}],"outline-w":[{outline:["",Te,sr,rs]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",b,To,ko]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",h,To,ko]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Te,rs]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",N,To,ko]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Te,he,me]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[he,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":F()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:ge()}],"mask-size":[{mask:S()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,me]}],filter:[{filter:["","none",he,me]}],blur:[{blur:we()}],brightness:[{brightness:[Te,he,me]}],contrast:[{contrast:[Te,he,me]}],"drop-shadow":[{"drop-shadow":["","none",_,To,ko]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Te,he,me]}],"hue-rotate":[{"hue-rotate":[Te,he,me]}],invert:[{invert:["",Te,he,me]}],saturate:[{saturate:[Te,he,me]}],sepia:[{sepia:["",Te,he,me]}],"backdrop-filter":[{"backdrop-filter":["","none",he,me]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[Te,he,me]}],"backdrop-contrast":[{"backdrop-contrast":[Te,he,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,he,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,he,me]}],"backdrop-invert":[{"backdrop-invert":["",Te,he,me]}],"backdrop-opacity":[{"backdrop-opacity":[Te,he,me]}],"backdrop-saturate":[{"backdrop-saturate":[Te,he,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,he,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",he,me]}],ease:[{ease:["linear","initial",k,he,me]}],delay:[{delay:[Te,he,me]}],animate:[{animate:["none",K,he,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[U,he,me]}],"perspective-origin":[{"perspective-origin":ae()}],rotate:[{rotate:ke()}],"rotate-x":[{"rotate-x":ke()}],"rotate-y":[{"rotate-y":ke()}],"rotate-z":[{"rotate-z":ke()}],scale:[{scale:We()}],"scale-x":[{"scale-x":We()}],"scale-y":[{"scale-y":We()}],"scale-z":[{"scale-z":We()}],"scale-3d":["scale-3d"],skew:[{skew:it()}],"skew-x":[{"skew-x":it()}],"skew-y":[{"skew-y":it()}],transform:[{transform:[he,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:ae()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",he,me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,me]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Te,sr,rs,bu]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},H1=x1(U1);function Ne(...l){return H1(E0(l))}function B0({delayDuration:l=0,...o}){return s.jsx($b,{"data-slot":"tooltip-provider",delayDuration:l,...o})}function va({...l}){return s.jsx(B0,{children:s.jsx(Qb,{"data-slot":"tooltip",...l})})}function ya({...l}){return s.jsx(Zb,{"data-slot":"tooltip-trigger",...l})}function ba({className:l,sideOffset:o=0,children:c,...u}){return s.jsx(Kb,{children:s.jsxs(Jb,{"data-slot":"tooltip-content",sideOffset:o,className:Ne("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",l),...u,children:[c,s.jsx(Fb,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function B1(l){if(typeof document>"u")return;let o=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css",o.appendChild(c),c.styleSheet?c.styleSheet.cssText=l:c.appendChild(document.createTextNode(l))}const q1=l=>{switch(l){case"success":return V1;case"info":return $1;case"warning":return X1;case"error":return Q1;default:return null}},Y1=Array(12).fill(0),G1=({visible:l,className:o})=>le.createElement("div",{className:["sonner-loading-wrapper",o].filter(Boolean).join(" "),"data-visible":l},le.createElement("div",{className:"sonner-spinner"},Y1.map((c,u)=>le.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${u}`})))),V1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),X1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),$1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Q1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},le.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Z1=le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},le.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),le.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),K1=()=>{const[l,o]=le.useState(document.hidden);return le.useEffect(()=>{const c=()=>{o(document.hidden)};return document.addEventListener("visibilitychange",c),()=>window.removeEventListener("visibilitychange",c)},[]),l};let Ou=1;class J1{constructor(){this.subscribe=o=>(this.subscribers.push(o),()=>{const c=this.subscribers.indexOf(o);this.subscribers.splice(c,1)}),this.publish=o=>{this.subscribers.forEach(c=>c(o))},this.addToast=o=>{this.publish(o),this.toasts=[...this.toasts,o]},this.create=o=>{var c;const{message:u,...d}=o,m=typeof o?.id=="number"||((c=o.id)==null?void 0:c.length)>0?o.id:Ou++,g=this.toasts.find(x=>x.id===m),v=o.dismissible===void 0?!0:o.dismissible;return this.dismissedToasts.has(m)&&this.dismissedToasts.delete(m),g?this.toasts=this.toasts.map(x=>x.id===m?(this.publish({...x,...o,id:m,title:u}),{...x,...o,id:m,dismissible:v,title:u}):x):this.addToast({title:u,...d,dismissible:v,id:m}),m},this.dismiss=o=>(o?(this.dismissedToasts.add(o),requestAnimationFrame(()=>this.subscribers.forEach(c=>c({id:o,dismiss:!0})))):this.toasts.forEach(c=>{this.subscribers.forEach(u=>u({id:c.id,dismiss:!0}))}),o),this.message=(o,c)=>this.create({...c,message:o}),this.error=(o,c)=>this.create({...c,message:o,type:"error"}),this.success=(o,c)=>this.create({...c,type:"success",message:o}),this.info=(o,c)=>this.create({...c,type:"info",message:o}),this.warning=(o,c)=>this.create({...c,type:"warning",message:o}),this.loading=(o,c)=>this.create({...c,type:"loading",message:o}),this.promise=(o,c)=>{if(!c)return;let u;c.loading!==void 0&&(u=this.create({...c,promise:o,type:"loading",message:c.loading,description:typeof c.description!="function"?c.description:void 0}));const d=Promise.resolve(o instanceof Function?o():o);let m=u!==void 0,g;const v=d.then(async p=>{if(g=["resolve",p],le.isValidElement(p))m=!1,this.create({id:u,type:"default",message:p});else if(W1(p)&&!p.ok){m=!1;const h=typeof c.error=="function"?await c.error(`HTTP error! status: ${p.status}`):c.error,N=typeof c.description=="function"?await c.description(`HTTP error! status: ${p.status}`):c.description,A=typeof h=="object"&&!le.isValidElement(h)?h:{message:h};this.create({id:u,type:"error",description:N,...A})}else if(p instanceof Error){m=!1;const h=typeof c.error=="function"?await c.error(p):c.error,N=typeof c.description=="function"?await c.description(p):c.description,A=typeof h=="object"&&!le.isValidElement(h)?h:{message:h};this.create({id:u,type:"error",description:N,...A})}else if(c.success!==void 0){m=!1;const h=typeof c.success=="function"?await c.success(p):c.success,N=typeof c.description=="function"?await c.description(p):c.description,A=typeof h=="object"&&!le.isValidElement(h)?h:{message:h};this.create({id:u,type:"success",description:N,...A})}}).catch(async p=>{if(g=["reject",p],c.error!==void 0){m=!1;const b=typeof c.error=="function"?await c.error(p):c.error,h=typeof c.description=="function"?await c.description(p):c.description,_=typeof b=="object"&&!le.isValidElement(b)?b:{message:b};this.create({id:u,type:"error",description:h,..._})}}).finally(()=>{m&&(this.dismiss(u),u=void 0),c.finally==null||c.finally.call(c)}),x=()=>new Promise((p,b)=>v.then(()=>g[0]==="reject"?b(g[1]):p(g[1])).catch(b));return typeof u!="string"&&typeof u!="number"?{unwrap:x}:Object.assign(u,{unwrap:x})},this.custom=(o,c)=>{const u=c?.id||Ou++;return this.create({jsx:o(u),id:u,...c}),u},this.getActiveToasts=()=>this.toasts.filter(o=>!this.dismissedToasts.has(o.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Xt=new J1,F1=(l,o)=>{const c=o?.id||Ou++;return Xt.addToast({title:l,...o,id:c}),c},W1=l=>l&&typeof l=="object"&&"ok"in l&&typeof l.ok=="boolean"&&"status"in l&&typeof l.status=="number",P1=F1,I1=()=>Xt.toasts,e2=()=>Xt.getActiveToasts(),Nt=Object.assign(P1,{success:Xt.success,info:Xt.info,warning:Xt.warning,error:Xt.error,custom:Xt.custom,message:Xt.message,promise:Xt.promise,dismiss:Xt.dismiss,loading:Xt.loading},{getHistory:I1,getToasts:e2});B1("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ao(l){return l.label!==void 0}const t2=3,a2="24px",n2="16px",Sp=4e3,s2=356,l2=14,r2=45,o2=200;function Ta(...l){return l.filter(Boolean).join(" ")}function i2(l){const[o,c]=l.split("-"),u=[];return o&&u.push(o),c&&u.push(c),u}const c2=l=>{var o,c,u,d,m,g,v,x,p;const{invert:b,toast:h,unstyled:N,interacting:_,setHeights:A,visibleToasts:U,heights:G,index:k,toasts:K,expanded:q,removeToast:F,defaultRichColors:ae,closeButton:te,style:E,cancelButtonStyle:L,actionButtonStyle:Y,className:z="",descriptionClassName:se="",duration:ie,position:O,gap:ne,expandByDefault:oe,classNames:T,icons:V,closeButtonAriaLabel:B="Close toast"}=l,[ce,ge]=le.useState(null),[S,Q]=le.useState(null),[$,ee]=le.useState(!1),[re,xe]=le.useState(!1),[ue,we]=le.useState(!1),[ke,We]=le.useState(!1),[it,qe]=le.useState(!1),[P,Ye]=le.useState(0),[Z,ve]=le.useState(0),at=le.useRef(h.duration||ie||Sp),Ct=le.useRef(null),$t=le.useRef(null),cl=k===0,ul=k+1<=U,kt=h.type,rn=h.dismissible!==!1,Tt=h.className||"",Io=h.descriptionClassName||"",Hn=le.useMemo(()=>G.findIndex(Se=>Se.toastId===h.id)||0,[G,h.id]),dr=le.useMemo(()=>{var Se;return(Se=h.closeButton)!=null?Se:te},[h.closeButton,te]),Bn=le.useMemo(()=>h.duration||ie||Sp,[h.duration,ie]),dl=le.useRef(0),Ua=le.useRef(0),fr=le.useRef(0),on=le.useRef(null),[qn,At]=O.split("-"),ma=le.useMemo(()=>G.reduce((Se,Ke,mt)=>mt>=Hn?Se:Se+Ke.height,0),[G,Hn]),jt=K1(),ei=h.invert||b,fl=kt==="loading";Ua.current=le.useMemo(()=>Hn*ne+ma,[Hn,ma]),le.useEffect(()=>{at.current=Bn},[Bn]),le.useEffect(()=>{ee(!0)},[]),le.useEffect(()=>{const Se=$t.current;if(Se){const Ke=Se.getBoundingClientRect().height;return ve(Ke),A(mt=>[{toastId:h.id,height:Ke,position:h.position},...mt]),()=>A(mt=>mt.filter(St=>St.toastId!==h.id))}},[A,h.id]),le.useLayoutEffect(()=>{if(!$)return;const Se=$t.current,Ke=Se.style.height;Se.style.height="auto";const mt=Se.getBoundingClientRect().height;Se.style.height=Ke,ve(mt),A(St=>St.find(Fe=>Fe.toastId===h.id)?St.map(Fe=>Fe.toastId===h.id?{...Fe,height:mt}:Fe):[{toastId:h.id,height:mt,position:h.position},...St])},[$,h.title,h.description,A,h.id,h.jsx,h.action,h.cancel]);const ja=le.useCallback(()=>{xe(!0),Ye(Ua.current),A(Se=>Se.filter(Ke=>Ke.toastId!==h.id)),setTimeout(()=>{F(h)},o2)},[h,F,A,Ua]);le.useEffect(()=>{if(h.promise&&kt==="loading"||h.duration===1/0||h.type==="loading")return;let Se;return q||_||jt?(()=>{if(fr.current{h.onAutoClose==null||h.onAutoClose.call(h,h),ja()},at.current)),()=>clearTimeout(Se)},[q,_,h,kt,jt,ja]),le.useEffect(()=>{h.delete&&(ja(),h.onDismiss==null||h.onDismiss.call(h,h))},[ja,h.delete]);function cs(){var Se;if(V?.loading){var Ke;return le.createElement("div",{className:Ta(T?.loader,h==null||(Ke=h.classNames)==null?void 0:Ke.loader,"sonner-loader"),"data-visible":kt==="loading"},V.loading)}return le.createElement(G1,{className:Ta(T?.loader,h==null||(Se=h.classNames)==null?void 0:Se.loader),visible:kt==="loading"})}const us=h.icon||V?.[kt]||q1(kt);var Yn,Sa;return le.createElement("li",{tabIndex:0,ref:$t,className:Ta(z,Tt,T?.toast,h==null||(o=h.classNames)==null?void 0:o.toast,T?.default,T?.[kt],h==null||(c=h.classNames)==null?void 0:c[kt]),"data-sonner-toast":"","data-rich-colors":(Yn=h.richColors)!=null?Yn:ae,"data-styled":!(h.jsx||h.unstyled||N),"data-mounted":$,"data-promise":!!h.promise,"data-swiped":it,"data-removed":re,"data-visible":ul,"data-y-position":qn,"data-x-position":At,"data-index":k,"data-front":cl,"data-swiping":ue,"data-dismissible":rn,"data-type":kt,"data-invert":ei,"data-swipe-out":ke,"data-swipe-direction":S,"data-expanded":!!(q||oe&&$),"data-testid":h.testId,style:{"--index":k,"--toasts-before":k,"--z-index":K.length-k,"--offset":`${re?P:Ua.current}px`,"--initial-height":oe?"auto":`${Z}px`,...E,...h.style},onDragEnd:()=>{we(!1),ge(null),on.current=null},onPointerDown:Se=>{Se.button!==2&&(fl||!rn||(Ct.current=new Date,Ye(Ua.current),Se.target.setPointerCapture(Se.pointerId),Se.target.tagName!=="BUTTON"&&(we(!0),on.current={x:Se.clientX,y:Se.clientY})))},onPointerUp:()=>{var Se,Ke,mt;if(ke||!rn)return;on.current=null;const St=Number(((Se=$t.current)==null?void 0:Se.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),cn=Number(((Ke=$t.current)==null?void 0:Ke.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Fe=new Date().getTime()-((mt=Ct.current)==null?void 0:mt.getTime()),Rt=ce==="x"?St:cn,Gn=Math.abs(Rt)/Fe;if(Math.abs(Rt)>=r2||Gn>.11){Ye(Ua.current),h.onDismiss==null||h.onDismiss.call(h,h),Q(ce==="x"?St>0?"right":"left":cn>0?"down":"up"),ja(),We(!0);return}else{var Dt,Lt;(Dt=$t.current)==null||Dt.style.setProperty("--swipe-amount-x","0px"),(Lt=$t.current)==null||Lt.style.setProperty("--swipe-amount-y","0px")}qe(!1),we(!1),ge(null)},onPointerMove:Se=>{var Ke,mt,St;if(!on.current||!rn||((Ke=window.getSelection())==null?void 0:Ke.toString().length)>0)return;const Fe=Se.clientY-on.current.y,Rt=Se.clientX-on.current.x;var Gn;const Dt=(Gn=l.swipeDirections)!=null?Gn:i2(O);!ce&&(Math.abs(Rt)>1||Math.abs(Fe)>1)&&ge(Math.abs(Rt)>Math.abs(Fe)?"x":"y");let Lt={x:0,y:0};const ds=ha=>1/(1.5+Math.abs(ha)/20);if(ce==="y"){if(Dt.includes("top")||Dt.includes("bottom"))if(Dt.includes("top")&&Fe<0||Dt.includes("bottom")&&Fe>0)Lt.y=Fe;else{const ha=Fe*ds(Fe);Lt.y=Math.abs(ha)0)Lt.x=Rt;else{const ha=Rt*ds(Rt);Lt.x=Math.abs(ha)0||Math.abs(Lt.y)>0)&&qe(!0),(mt=$t.current)==null||mt.style.setProperty("--swipe-amount-x",`${Lt.x}px`),(St=$t.current)==null||St.style.setProperty("--swipe-amount-y",`${Lt.y}px`)}},dr&&!h.jsx&&kt!=="loading"?le.createElement("button",{"aria-label":B,"data-disabled":fl,"data-close-button":!0,onClick:fl||!rn?()=>{}:()=>{ja(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Ta(T?.closeButton,h==null||(u=h.classNames)==null?void 0:u.closeButton)},(Sa=V?.close)!=null?Sa:Z1):null,(kt||h.icon||h.promise)&&h.icon!==null&&(V?.[kt]!==null||h.icon)?le.createElement("div",{"data-icon":"",className:Ta(T?.icon,h==null||(d=h.classNames)==null?void 0:d.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||cs():null,h.type!=="loading"?us:null):null,le.createElement("div",{"data-content":"",className:Ta(T?.content,h==null||(m=h.classNames)==null?void 0:m.content)},le.createElement("div",{"data-title":"",className:Ta(T?.title,h==null||(g=h.classNames)==null?void 0:g.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?le.createElement("div",{"data-description":"",className:Ta(se,Io,T?.description,h==null||(v=h.classNames)==null?void 0:v.description)},typeof h.description=="function"?h.description():h.description):null),le.isValidElement(h.cancel)?h.cancel:h.cancel&&Ao(h.cancel)?le.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||L,onClick:Se=>{Ao(h.cancel)&&rn&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Se),ja())},className:Ta(T?.cancelButton,h==null||(x=h.classNames)==null?void 0:x.cancelButton)},h.cancel.label):null,le.isValidElement(h.action)?h.action:h.action&&Ao(h.action)?le.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||Y,onClick:Se=>{Ao(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Se),!Se.defaultPrevented&&ja())},className:Ta(T?.actionButton,h==null||(p=h.classNames)==null?void 0:p.actionButton)},h.action.label):null)};function _p(){if(typeof window>"u"||typeof document>"u")return"ltr";const l=document.documentElement.getAttribute("dir");return l==="auto"||!l?window.getComputedStyle(document.documentElement).direction:l}function u2(l,o){const c={};return[l,o].forEach((u,d)=>{const m=d===1,g=m?"--mobile-offset":"--offset",v=m?n2:a2;function x(p){["top","right","bottom","left"].forEach(b=>{c[`${g}-${b}`]=typeof p=="number"?`${p}px`:p})}typeof u=="number"||typeof u=="string"?x(u):typeof u=="object"?["top","right","bottom","left"].forEach(p=>{u[p]===void 0?c[`${g}-${p}`]=v:c[`${g}-${p}`]=typeof u[p]=="number"?`${u[p]}px`:u[p]}):x(v)}),c}const d2=le.forwardRef(function(o,c){const{id:u,invert:d,position:m="bottom-right",hotkey:g=["altKey","KeyT"],expand:v,closeButton:x,className:p,offset:b,mobileOffset:h,theme:N="light",richColors:_,duration:A,style:U,visibleToasts:G=t2,toastOptions:k,dir:K=_p(),gap:q=l2,icons:F,containerAriaLabel:ae="Notifications"}=o,[te,E]=le.useState([]),L=le.useMemo(()=>u?te.filter($=>$.toasterId===u):te.filter($=>!$.toasterId),[te,u]),Y=le.useMemo(()=>Array.from(new Set([m].concat(L.filter($=>$.position).map($=>$.position)))),[L,m]),[z,se]=le.useState([]),[ie,O]=le.useState(!1),[ne,oe]=le.useState(!1),[T,V]=le.useState(N!=="system"?N:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=le.useRef(null),ce=g.join("+").replace(/Key/g,"").replace(/Digit/g,""),ge=le.useRef(null),S=le.useRef(!1),Q=le.useCallback($=>{E(ee=>{var re;return(re=ee.find(xe=>xe.id===$.id))!=null&&re.delete||Xt.dismiss($.id),ee.filter(({id:xe})=>xe!==$.id)})},[]);return le.useEffect(()=>Xt.subscribe($=>{if($.dismiss){requestAnimationFrame(()=>{E(ee=>ee.map(re=>re.id===$.id?{...re,delete:!0}:re))});return}setTimeout(()=>{qp.flushSync(()=>{E(ee=>{const re=ee.findIndex(xe=>xe.id===$.id);return re!==-1?[...ee.slice(0,re),{...ee[re],...$},...ee.slice(re+1)]:[$,...ee]})})})}),[te]),le.useEffect(()=>{if(N!=="system"){V(N);return}if(N==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;const $=window.matchMedia("(prefers-color-scheme: dark)");try{$.addEventListener("change",({matches:ee})=>{V(ee?"dark":"light")})}catch{$.addListener(({matches:re})=>{try{V(re?"dark":"light")}catch(xe){console.error(xe)}})}},[N]),le.useEffect(()=>{te.length<=1&&O(!1)},[te]),le.useEffect(()=>{const $=ee=>{var re;if(g.every(we=>ee[we]||ee.code===we)){var ue;O(!0),(ue=B.current)==null||ue.focus()}ee.code==="Escape"&&(document.activeElement===B.current||(re=B.current)!=null&&re.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[g]),le.useEffect(()=>{if(B.current)return()=>{ge.current&&(ge.current.focus({preventScroll:!0}),ge.current=null,S.current=!1)}},[B.current]),le.createElement("section",{ref:c,"aria-label":`${ae} ${ce}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Y.map(($,ee)=>{var re;const[xe,ue]=$.split("-");return L.length?le.createElement("ol",{key:$,dir:K==="auto"?_p():K,tabIndex:-1,ref:B,className:p,"data-sonner-toaster":!0,"data-sonner-theme":T,"data-y-position":xe,"data-x-position":ue,style:{"--front-toast-height":`${((re=z[0])==null?void 0:re.height)||0}px`,"--width":`${s2}px`,"--gap":`${q}px`,...U,...u2(b,h)},onBlur:we=>{S.current&&!we.currentTarget.contains(we.relatedTarget)&&(S.current=!1,ge.current&&(ge.current.focus({preventScroll:!0}),ge.current=null))},onFocus:we=>{we.target instanceof HTMLElement&&we.target.dataset.dismissible==="false"||S.current||(S.current=!0,ge.current=we.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{ne||O(!1)},onDragEnd:()=>O(!1),onPointerDown:we=>{we.target instanceof HTMLElement&&we.target.dataset.dismissible==="false"||oe(!0)},onPointerUp:()=>oe(!1)},L.filter(we=>!we.position&&ee===0||we.position===$).map((we,ke)=>{var We,it;return le.createElement(c2,{key:we.id,icons:F,index:ke,toast:we,defaultRichColors:_,duration:(We=k?.duration)!=null?We:A,className:k?.className,descriptionClassName:k?.descriptionClassName,invert:d,visibleToasts:G,closeButton:(it=k?.closeButton)!=null?it:x,interacting:ne,position:$,style:k?.style,unstyled:k?.unstyled,classNames:k?.classNames,cancelButtonStyle:k?.cancelButtonStyle,actionButtonStyle:k?.actionButtonStyle,closeButtonAriaLabel:k?.closeButtonAriaLabel,removeToast:Q,toasts:L.filter(qe=>qe.position==we.position),heights:z.filter(qe=>qe.position==we.position),setHeights:se,expandByDefault:v,gap:q,expanded:ie,swipeDirections:o.swipeDirections})})):null}))});class ot extends Error{constructor(){super("Engine Offline"),this.name="EngineOfflineError"}}const q0=w.createContext(null);function Et(){const l=w.useContext(q0);if(!l)throw new Error("useProxyContext must be used within ProxyProvider");return l}function f2({children:l}){const[o,c]=w.useState(null),u=w.useRef(null),[d,m]=w.useState(null),[g,v]=w.useState([]),[x,p]=w.useState(null),[b,h]=w.useState(!1),[N,_]=w.useState(1200),[A,U]=w.useState(!1),[G,k]=w.useState(!1),K=typeof window.pp_status=="function",q=w.useCallback((E,L="success")=>{L==="success"?Nt.success(E):Nt.error(E)},[]),F=w.useCallback(async()=>{try{let E=!1;if(window.pp_status){const L=await window.pp_status();c(L),u.current=L,E=L.running}else try{const L=await fetch("/healthz");if(L.ok){const z={running:!0,port:(await L.json().catch(()=>({}))).port||0,base_url:location.origin,last_error:""};c(z),u.current=z,E=!0}else{const Y={running:!1,port:0,base_url:location.origin,last_error:L.statusText};c(Y),u.current=Y}}catch(L){const Y={running:!1,port:0,base_url:location.origin,last_error:String(L)};c(Y),u.current=Y,E=!1}if(E){if(U(!0),k(!1),_(1200),d)try{const Y=await fetch("/v0/management/auth-files",{headers:{"X-Management-Key":d}});if(Y.ok){const z=await Y.json();Array.isArray(z)&&v(z)}}catch(L){console.error("Auth files error:",L)}}else A&&!G&&K&&window.pp_start&&(console.log("Unexpected stop detected, attempting auto-reconnect..."),window.pp_start().catch(L=>console.error("Auto-reconnect failed:",L))),v([]),_(L=>Math.min(L*1.5,1e4))}catch(E){console.error("Status error:",E),_(L=>Math.min(L*1.5,1e4))}},[d]),ae=w.useCallback(async(E,L={})=>{if(!u.current?.running)throw new ot;if(!d)throw new Error("Missing management key");h(!0);try{const z=Object.assign({},L.headers||{},{"X-Management-Key":d}),se=await fetch(E,{...L,headers:z}),O=(se.headers.get("content-type")||"").toLowerCase().includes("application/json")?await se.json():await se.text();if(!se.ok){const ne=u.current;if(se.status===404&&(!ne||!ne.running))throw new ot;const oe=typeof O=="string"?O:O?.error?O.error:JSON.stringify(O);throw new Error(`${se.status} ${se.statusText}: ${oe}`)}return O}catch(z){throw z instanceof TypeError?new ot:z}finally{h(!1)}},[d]),te=w.useCallback(async(E,L,Y)=>{if(E){L==="stop"&&k(!0),(L==="start"||L==="restart")&&k(!1),p(L);try{await E(),q(Y,"success"),await F()}catch(z){q(z instanceof Error?z.message:String(z),"error")}finally{p(null)}}},[q,F]);return w.useEffect(()=>{F();let E;const L=()=>{E=setTimeout(async()=>{await F(),L()},N)};return L(),(async()=>{try{if(window.pp_get_management_key){const Y=await window.pp_get_management_key();m(Y)}else if(!K){const Y=document.querySelector('meta[name="pp-mgmt-key"]');m(Y?Y.getAttribute("content"):null)}}catch(Y){console.error("Management key error:",Y)}})(),()=>clearTimeout(E)},[F,K,N]),s.jsx(q0.Provider,{value:{status:o,isDesktop:K,mgmtKey:d,authFiles:g,loading:x,isMgmtLoading:b,setLoading:p,refreshStatus:F,showToast:q,mgmtFetch:ae,handleAction:te,pp_get_usage:window.pp_get_usage,pp_detect_agents:window.pp_detect_agents,pp_configure_agent:window.pp_configure_agent,pp_unconfigure_agent:window.pp_unconfigure_agent,pp_check_updates:window.pp_check_updates,pp_download_update:window.pp_download_update},children:l})}const m2=l=>l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),h2=l=>l.replace(/^([A-Z])|[\s-_]+(\w)/g,(o,c,u)=>u?u.toUpperCase():c.toLowerCase()),Ep=l=>{const o=h2(l);return o.charAt(0).toUpperCase()+o.slice(1)},Y0=(...l)=>l.filter((o,c,u)=>!!o&&o.trim()!==""&&u.indexOf(o)===c).join(" ").trim(),p2=l=>{for(const o in l)if(o.startsWith("aria-")||o==="role"||o==="title")return!0};var g2={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"};const x2=w.forwardRef(({color:l="currentColor",size:o=24,strokeWidth:c=2,absoluteStrokeWidth:u,className:d="",children:m,iconNode:g,...v},x)=>w.createElement("svg",{ref:x,...g2,width:o,height:o,stroke:l,strokeWidth:u?Number(c)*24/Number(o):c,className:Y0("lucide",d),...!m&&!p2(v)&&{"aria-hidden":"true"},...v},[...g.map(([p,b])=>w.createElement(p,b)),...Array.isArray(m)?m:[m]]));const de=(l,o)=>{const c=w.forwardRef(({className:u,...d},m)=>w.createElement(x2,{ref:m,iconNode:o,className:Y0(`lucide-${m2(Ep(l))}`,`lucide-${l}`,u),...d}));return c.displayName=Ep(l),c};const v2=[["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"}]],ur=de("activity",v2);const y2=[["path",{d:"M12 6v16",key:"nqf5sj"}],["path",{d:"m19 13 2-1a9 9 0 0 1-18 0l2 1",key:"y7qv08"}],["path",{d:"M9 11h6",key:"1fldmi"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}]],Cp=de("anchor",y2);const b2=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],zu=de("brain",b2);const w2=[["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"}]],Ru=de("chart-column",w2);const N2=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],j2=de("chart-pie",N2);const S2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],al=de("check",S2);const _2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],nl=de("chevron-down",_2);const E2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],C2=de("chevron-left",E2);const k2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Du=de("chevron-right",k2);const T2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],A2=de("chevrons-left",T2);const M2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],O2=de("chevrons-right",M2);const z2=[["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"}]],Bo=de("circle-alert",z2);const R2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],G0=de("circle-check",R2);const D2=[["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"}]],L2=de("circle-x",D2);const U2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qo=de("circle",U2);const H2=[["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"}]],B2=de("clipboard",H2);const q2=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],V0=de("clock",q2);const Y2=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],kp=de("code-xml",Y2);const G2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],sl=de("copy",G2);const V2=[["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"}]],X0=de("database",V2);const X2=[["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"}]],$2=de("dollar-sign",X2);const Q2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],is=de("download",Q2);const Z2=[["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"}]],$0=de("external-link",Z2);const K2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],J2=de("file-code",K2);const F2=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Q0=de("file-text",F2);const W2=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Lu=de("folder-open",W2);const P2=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],I2=de("funnel",P2);const ew=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],tw=de("gauge",ew);const aw=[["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"}]],nw=de("git-branch",aw);const sw=[["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"}]],lw=de("history",sw);const rw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ow=de("info",rw);const iw=[["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"}]],cw=de("key",iw);const uw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],zt=de("loader-circle",uw);const dw=[["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"}]],Z0=de("lock-open",dw);const fw=[["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"}]],K0=de("lock",fw);const mw=[["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"}]],hw=de("monitor",mw);const pw=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],gw=de("moon",pw);const xw=[["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"}]],vw=de("pencil",xw);const yw=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],bw=de("pin",yw);const ww=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],J0=de("play",ww);const Nw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],jw=de("plus",Nw);const Sw=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],wu=de("radar",Sw);const _w=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],F0=de("radio",_w);const Ew=[["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"}]],fa=de("refresh-cw",Ew);const Cw=[["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"}]],kw=de("rotate-ccw",Cw);const Tw=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Aw=de("rotate-cw",Tw);const Mw=[["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"}]],Is=de("save",Mw);const Ow=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],zw=de("scissors",Ow);const Rw=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Dw=de("scroll-text",Rw);const Lw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Uw=de("search",Lw);const Hw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],zo=de("settings",Hw);const Bw=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],qw=de("settings-2",Bw);const Yw=[["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"}]],Gw=de("shield",Yw);const Vw=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],W0=de("sparkles",Vw);const Xw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],$w=de("square",Xw);const Qw=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Zw=de("sun",Qw);const Kw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Uu=de("terminal",Kw);const Jw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Wo=de("trash-2",Jw);const Fw=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Ww=de("trending-down",Fw);const Pw=[["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"}]],td=de("triangle-alert",Pw);const Iw=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],eN=de("undo-2",Iw);const tN=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],aN=de("upload",tN);const nN=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Nu=de("users",nN);const sN=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],P0=de("wrench",sN);const lN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ad=de("x",lN);const rN=[["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"}]],Yo=de("zap",rN);function oN(l){const o=Math.floor(l/3600),c=Math.floor(l%3600/60),u=l%60;return o>0?`${o}h ${c}m`:c>0?`${c}m ${u}s`:`${u}s`}function iN(){const{status:l,loading:o,handleAction:c,showToast:u,isDesktop:d}=Et(),[m,g]=w.useState(0),[v,x]=w.useState(!1),p=w.useRef(null),b=l?.running??!1;w.useEffect(()=>{if(b){p.current===null&&(p.current=Date.now());const N=setInterval(()=>{p.current&&g(Math.floor((Date.now()-p.current)/1e3))},1e3);return()=>clearInterval(N)}p.current=null,g(0)},[b]);const h=async()=>{if(l?.base_url)try{await navigator.clipboard.writeText(l.base_url),x(!0),u("URL copied to clipboard","success"),setTimeout(()=>x(!1),2e3)}catch{u("Failed to copy URL","error")}};return s.jsxs("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-panel)] shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-[var(--bg-elevated)] border-b border-[var(--border-default)]",children:[s.jsx(F0,{className:"h-4 w-4 text-[var(--accent-primary)]"}),s.jsx("span",{className:"font-mono text-xs font-bold uppercase tracking-widest text-[var(--text-secondary)]",children:"Engine Control"}),s.jsx("div",{className:"flex-1"}),s.jsx("div",{className:`h-2 w-2 rounded-full ${b?"bg-[var(--status-online)] animate-pulse":"bg-[var(--status-offline)]"}`})]}),s.jsxs("div",{className:"p-6 flex flex-col items-center",children:[s.jsxs("div",{className:"relative w-48 h-48 mb-6",children:[b&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-[var(--status-online)] opacity-0",style:{animation:"radar-pulse 2s ease-out infinite"}}),s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-[var(--status-online)] opacity-0",style:{animation:"radar-pulse 2s ease-out infinite 0.5s"}}),s.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-[var(--status-online)] opacity-0",style:{animation:"radar-pulse 2s ease-out infinite 1s"}})]}),s.jsx("div",{className:`absolute inset-4 rounded-full border-2 transition-colors duration-300 ${b?"border-[var(--status-online)]/30":"border-[var(--border-subtle)]"}`}),s.jsx("div",{className:`absolute inset-8 rounded-full border transition-colors duration-300 ${b?"border-[var(--status-online)]/20":"border-[var(--border-subtle)]/50"}`}),s.jsx("div",{className:`absolute inset-12 rounded-full flex flex-col items-center justify-center transition-all duration-500 ${b?"bg-gradient-to-br from-[var(--accent-primary)] to-[var(--accent-secondary)] shadow-[0_0_30px_var(--status-online)]":"bg-gradient-to-br from-[var(--bg-elevated)] to-[var(--bg-active)] border border-[var(--border-default)]"}`,children:s.jsx("span",{className:`font-mono text-xs font-bold tracking-wider ${b?"text-white":"text-[var(--text-muted)]"}`,children:b?"ONLINE":"OFFLINE"})}),b&&s.jsx("div",{className:"absolute inset-0 rounded-full overflow-hidden",style:{animation:"radar-sweep 3s linear infinite"},children:s.jsx("div",{className:"absolute top-1/2 left-1/2 w-1/2 h-0.5 origin-left",style:{background:"linear-gradient(90deg, var(--status-online) 0%, transparent 100%)"}})})]}),s.jsxs("div",{className:"w-full grid grid-cols-2 gap-3 mb-6",children:[s.jsxs("div",{className:"bg-[var(--bg-void)] rounded-md border border-[var(--border-subtle)] p-3",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:"Port"}),s.jsx("div",{className:`font-mono text-lg font-bold ${b?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"}`,children:b&&l?.port||"---"})]}),s.jsxs("div",{className:"bg-[var(--bg-void)] rounded-md border border-[var(--border-subtle)] p-3",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:"Uptime"}),s.jsx("div",{className:`font-mono text-lg font-bold ${b?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"}`,children:b?oN(m):"--:--"})]})]}),l?.last_error&&s.jsx("div",{className:"w-full mb-6 rounded-md border-2 border-[var(--status-warning)] bg-[var(--status-warning)]/10 p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"p-1.5 rounded bg-[var(--status-warning)]/20",children:s.jsx(td,{className:"h-4 w-4 text-[var(--status-warning)]"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--status-warning)] mb-1",children:"Caution"}),s.jsx("div",{className:"font-mono text-sm text-[var(--status-warning)] break-all",children:l.last_error})]})]})}),s.jsxs("div",{className:"w-full grid grid-cols-3 gap-3 mb-6",children:[s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:b||o==="start",onClick:()=>c(window.pp_start,"start","Proxy started"),className:` relative flex flex-col items-center justify-center gap-1 py-4 px-3 rounded-lg font-mono text-xs font-bold uppercase tracking-wider border-2 transition-all duration-150 ${b||o==="start"?"opacity-40 cursor-not-allowed border-[var(--border-subtle)] bg-[var(--bg-elevated)] text-[var(--text-muted)]":"border-[var(--status-online)] bg-gradient-to-b from-[var(--bg-elevated)] to-[var(--bg-panel)] text-[var(--status-online)] hover:shadow-[0_0_15px_var(--status-online)] active:translate-y-0.5 active:shadow-none cursor-pointer"} shadow-[inset_0_1px_0_rgba(255,255,255,0.1),0_2px_4px_rgba(0,0,0,0.3)] - `,children:[s.jsx(Q0,{className:"h-5 w-5 fill-current"}),s.jsx("span",{children:"Start"})]})}),s.jsx(ya,{children:"Start the proxy server"})]}),s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:!b||o==="stop",onClick:()=>c(window.pp_stop,"stop","Proxy stopped"),className:` + `,children:[s.jsx(J0,{className:"h-5 w-5 fill-current"}),s.jsx("span",{children:"Start"})]})}),s.jsx(ba,{children:"Start the proxy server"})]}),s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:!b||o==="stop",onClick:()=>c(window.pp_stop,"stop","Proxy stopped"),className:` relative flex flex-col items-center justify-center gap-1 py-4 px-3 rounded-lg font-mono text-xs font-bold uppercase tracking-wider border-2 transition-all duration-150 ${!b||o==="stop"?"opacity-40 cursor-not-allowed border-[var(--border-subtle)] bg-[var(--bg-elevated)] text-[var(--text-muted)]":"border-[var(--status-offline)] bg-gradient-to-b from-[var(--bg-elevated)] to-[var(--bg-panel)] text-[var(--status-offline)] hover:shadow-[0_0_15px_var(--status-offline)] active:translate-y-0.5 active:shadow-none cursor-pointer"} shadow-[inset_0_1px_0_rgba(255,255,255,0.1),0_2px_4px_rgba(0,0,0,0.3)] - `,children:[s.jsx(Vw,{className:"h-5 w-5 fill-current"}),s.jsx("span",{children:"Stop"})]})}),s.jsx(ya,{children:"Stop the proxy server"})]}),s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:!b||o==="restart",onClick:()=>c(window.pp_restart,"restart","Proxy restarted"),className:` + `,children:[s.jsx($w,{className:"h-5 w-5 fill-current"}),s.jsx("span",{children:"Stop"})]})}),s.jsx(ba,{children:"Stop the proxy server"})]}),s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:!b||o==="restart",onClick:()=>c(window.pp_restart,"restart","Proxy restarted"),className:` relative flex flex-col items-center justify-center gap-1 py-4 px-3 rounded-lg font-mono text-xs font-bold uppercase tracking-wider border-2 transition-all duration-150 ${!b||o==="restart"?"opacity-40 cursor-not-allowed border-[var(--border-subtle)] bg-[var(--bg-elevated)] text-[var(--text-muted)]":"border-[var(--accent-primary)] bg-gradient-to-b from-[var(--bg-elevated)] to-[var(--bg-panel)] text-[var(--accent-primary)] hover:shadow-[0_0_15px_var(--accent-primary)] active:translate-y-0.5 active:shadow-none cursor-pointer"} shadow-[inset_0_1px_0_rgba(255,255,255,0.1),0_2px_4px_rgba(0,0,0,0.3)] - `,children:[s.jsx(Tw,{className:`h-5 w-5 ${o==="restart"?"animate-spin":""}`}),s.jsx("span",{children:"Restart"})]})}),s.jsx(ya,{children:"Restart the proxy server"})]})]}),l?.base_url&&s.jsx("div",{className:"w-full bg-[var(--bg-void)] rounded-md border border-[var(--border-subtle)] p-3",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:"Base URL"}),s.jsx("div",{className:"font-mono text-sm text-[var(--text-accent)] truncate",children:l.base_url})]}),s.jsxs("button",{type:"button",onClick:h,className:` + `,children:[s.jsx(Aw,{className:`h-5 w-5 ${o==="restart"?"animate-spin":""}`}),s.jsx("span",{children:"Restart"})]})}),s.jsx(ba,{children:"Restart the proxy server"})]})]}),l?.base_url&&s.jsx("div",{className:"w-full bg-[var(--bg-void)] rounded-md border border-[var(--border-subtle)] p-3",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:"Base URL"}),s.jsx("div",{className:"font-mono text-sm text-[var(--text-accent)] truncate",children:l.base_url})]}),s.jsxs("button",{type:"button",onClick:h,className:` flex items-center gap-1.5 px-3 py-1.5 rounded font-mono text-xs uppercase tracking-wider border transition-all duration-150 ${v?"border-[var(--status-online)] bg-[var(--status-online)]/10 text-[var(--status-online)]":"border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)]"} active:translate-y-0.5 cursor-pointer - `,children:[v?s.jsx(tl,{className:"h-3.5 w-3.5"}):s.jsx(nl,{className:"h-3.5 w-3.5"}),v?"Copied":"Copy"]})]})}),f&&s.jsxs("div",{className:"w-full mt-4 pt-4 border-t border-[var(--border-subtle)]",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-3",children:"Quick Actions"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>c(window.pp_open_logs,"logs","Opened logs"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] font-mono text-xs hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-colors active:translate-y-0.5 cursor-pointer",children:[s.jsx(V0,{className:"h-3.5 w-3.5"}),"Logs"]}),s.jsxs("button",{type:"button",onClick:()=>c(window.pp_open_auth_folder,"auth","Opened auth folder"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] font-mono text-xs hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-colors active:translate-y-0.5 cursor-pointer",children:[s.jsx(zu,{className:"h-3.5 w-3.5"}),"Auth"]}),s.jsxs("button",{type:"button",disabled:!b,onClick:()=>c(window.pp_open_diagnostics,"diag-open","Opened diagnostics"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded border font-mono text-xs transition-colors active:translate-y-0.5 cursor-pointer ${b?"border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)]":"opacity-40 cursor-not-allowed border-[var(--border-subtle)] bg-[var(--bg-elevated)] text-[var(--text-muted)]"}`,children:[s.jsx(Ko,{className:"h-3.5 w-3.5"}),"Diagnostics"]})]})]}),!f&&!l?.base_url&&s.jsx("div",{className:"w-full mt-4 pt-4 border-t border-[var(--border-subtle)]",children:s.jsxs("button",{type:"button",onClick:h,disabled:!l?.base_url,className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] font-mono text-xs hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed active:translate-y-0.5 cursor-pointer",children:[v?s.jsx(tl,{className:"h-3.5 w-3.5"}):s.jsx(nl,{className:"h-3.5 w-3.5"}),v?"Copied":"Copy URL"]})})]}),s.jsx("style",{children:` + `,children:[v?s.jsx(al,{className:"h-3.5 w-3.5"}):s.jsx(sl,{className:"h-3.5 w-3.5"}),v?"Copied":"Copy"]})]})}),d&&s.jsxs("div",{className:"w-full mt-4 pt-4 border-t border-[var(--border-subtle)]",children:[s.jsx("div",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-3",children:"Quick Actions"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>c(window.pp_open_logs,"logs","Opened logs"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] font-mono text-xs hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-colors active:translate-y-0.5 cursor-pointer",children:[s.jsx(Q0,{className:"h-3.5 w-3.5"}),"Logs"]}),s.jsxs("button",{type:"button",onClick:()=>c(window.pp_open_auth_folder,"auth","Opened auth folder"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] font-mono text-xs hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-colors active:translate-y-0.5 cursor-pointer",children:[s.jsx(Lu,{className:"h-3.5 w-3.5"}),"Auth"]}),s.jsxs("button",{type:"button",disabled:!b,onClick:()=>c(window.pp_open_diagnostics,"diag-open","Opened diagnostics"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded border font-mono text-xs transition-colors active:translate-y-0.5 cursor-pointer ${b?"border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)]":"opacity-40 cursor-not-allowed border-[var(--border-subtle)] bg-[var(--bg-elevated)] text-[var(--text-muted)]"}`,children:[s.jsx(ur,{className:"h-3.5 w-3.5"}),"Diagnostics"]})]})]}),!d&&!l?.base_url&&s.jsx("div",{className:"w-full mt-4 pt-4 border-t border-[var(--border-subtle)]",children:s.jsxs("button",{type:"button",onClick:h,disabled:!l?.base_url,className:"flex items-center gap-1.5 px-3 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-secondary)] font-mono text-xs hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed active:translate-y-0.5 cursor-pointer",children:[v?s.jsx(al,{className:"h-3.5 w-3.5"}):s.jsx(sl,{className:"h-3.5 w-3.5"}),v?"Copied":"Copy URL"]})})]}),s.jsx("style",{children:` @keyframes radar-pulse { 0% { transform: scale(0.8); @@ -50,7 +50,7 @@ Error generating stack: `+n.message+` transform: rotate(360deg); } } - `})]})}function rN(l){const o=w.useRef({value:l,previous:l});return w.useMemo(()=>(o.current.value!==l&&(o.current.previous=o.current.value,o.current.value=l),o.current.previous),[l])}var Fo="Switch",[oN]=Bu(Fo),[iN,cN]=oN(Fo),F0=w.forwardRef((l,o)=>{const{__scopeSwitch:c,name:u,checked:f,defaultChecked:m,required:g,disabled:v,value:x="on",onCheckedChange:p,form:b,...h}=l,[N,E]=w.useState(null),A=sn(o,q=>E(q)),U=w.useRef(!1),G=N?b||!!N.closest("form"):!0,[T,K]=f0({prop:f,defaultProp:m??!1,onChange:p,caller:Fo});return s.jsxs(iN,{scope:c,checked:T,disabled:v,children:[s.jsx(Ra.button,{type:"button",role:"switch","aria-checked":T,"aria-required":g,"data-state":eg(T),"data-disabled":v?"":void 0,disabled:v,value:x,...h,ref:A,onClick:Aa(l.onClick,q=>{K(F=>!F),G&&(U.current=q.isPropagationStopped(),U.current||q.stopPropagation())})}),G&&s.jsx(I0,{control:N,bubbles:!U.current,name:u,value:x,checked:T,required:g,disabled:v,form:b,style:{transform:"translateX(-100%)"}})]})});F0.displayName=Fo;var W0="SwitchThumb",P0=w.forwardRef((l,o)=>{const{__scopeSwitch:c,...u}=l,f=cN(W0,c);return s.jsx(Ra.span,{"data-state":eg(f.checked),"data-disabled":f.disabled?"":void 0,...u,ref:o})});P0.displayName=W0;var uN="SwitchBubbleInput",I0=w.forwardRef(({__scopeSwitch:l,control:o,checked:c,bubbles:u=!0,...f},m)=>{const g=w.useRef(null),v=sn(g,m),x=rN(c),p=e0(o);return w.useEffect(()=>{const b=g.current;if(!b)return;const h=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(h,"checked").set;if(x!==c&&E){const A=new Event("click",{bubbles:u});E.call(b,c),b.dispatchEvent(A)}},[x,c,u]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...f,tabIndex:-1,ref:v,style:{...f.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});I0.displayName=uN;function eg(l){return l?"checked":"unchecked"}var dN=F0,fN=P0;function Bo({className:l,...o}){return s.jsx(dN,{"data-slot":"switch",className:je("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",l),...o,children:s.jsx(fN,{"data-slot":"switch-thumb",className:je("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var mN=Symbol.for("react.lazy"),qo=Uu[" use ".trim().toString()];function hN(l){return typeof l=="object"&&l!==null&&"then"in l}function tg(l){return l!=null&&typeof l=="object"&&"$$typeof"in l&&l.$$typeof===mN&&"_payload"in l&&hN(l._payload)}function ag(l){const o=pN(l),c=w.forwardRef((u,f)=>{let{children:m,...g}=u;tg(m)&&typeof qo=="function"&&(m=qo(m._payload));const v=w.Children.toArray(m),x=v.find(xN);if(x){const p=x.props.children,b=v.map(h=>h===x?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:h);return s.jsx(o,{...g,ref:f,children:w.isValidElement(p)?w.cloneElement(p,void 0,b):null})}return s.jsx(o,{...g,ref:f,children:m})});return c.displayName=`${l}.Slot`,c}var ng=ag("Slot");function pN(l){const o=w.forwardRef((c,u)=>{let{children:f,...m}=c;if(tg(f)&&typeof qo=="function"&&(f=qo(f._payload)),w.isValidElement(f)){const g=yN(f),v=vN(m,f.props);return f.type!==w.Fragment&&(v.ref=u?Hu(u,g):g),w.cloneElement(f,v)}return w.Children.count(f)>1?w.Children.only(null):null});return o.displayName=`${l}.SlotClone`,o}var gN=Symbol("radix.slottable");function xN(l){return w.isValidElement(l)&&typeof l.type=="function"&&"__radixId"in l.type&&l.type.__radixId===gN}function vN(l,o){const c={...o};for(const u in o){const f=l[u],m=o[u];/^on[A-Z]/.test(u)?f&&m?c[u]=(...v)=>{const x=m(...v);return f(...v),x}:f&&(c[u]=f):u==="style"?c[u]={...f,...m}:u==="className"&&(c[u]=[f,m].filter(Boolean).join(" "))}return{...l,...c}}function yN(l){let o=Object.getOwnPropertyDescriptor(l.props,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning;return c?l.ref:(o=Object.getOwnPropertyDescriptor(l,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}var bN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wN=bN.reduce((l,o)=>{const c=ag(`Primitive.${o}`),u=w.forwardRef((f,m)=>{const{asChild:g,...v}=f,x=g?c:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(x,{...v,ref:m})});return u.displayName=`Primitive.${o}`,{...l,[o]:u}},{}),NN="Label",sg=w.forwardRef((l,o)=>s.jsx(wN.label,{...l,ref:o,onMouseDown:c=>{c.target.closest("button, input, select, textarea")||(l.onMouseDown?.(c),!c.defaultPrevented&&c.detail>1&&c.preventDefault())}}));sg.displayName=NN;var jN=sg;function ua({className:l,...o}){return s.jsx(jN,{"data-slot":"label",className:je("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",l),...o})}const SN=[{id:"claude",name:"Claude",color:"oklch(0.60 0.15 35)",icon:"🤖"},{id:"gemini",name:"Gemini",color:"oklch(0.55 0.18 250)",icon:"✨"},{id:"gemini-cli",name:"Gemini CLI",color:"oklch(0.58 0.16 240)",icon:"🌐"},{id:"codex",name:"Codex",color:"oklch(0.60 0.16 145)",icon:"💻"},{id:"qwen",name:"Qwen",color:"oklch(0.60 0.14 280)",icon:"🔮"},{id:"antigravity",name:"Antigravity",color:"oklch(0.65 0.20 320)",icon:"🚀"},{id:"kiro",name:"Kiro",color:"oklch(0.58 0.17 200)",icon:"🛸"},{id:"amazonq",name:"Amazon Q",color:"oklch(0.55 0.16 30)",icon:"📦",isImport:!0},{id:"minimax",name:"MiniMax",color:"oklch(0.60 0.18 60)",icon:"🔶",isApiKey:!0},{id:"zhipu",name:"Zhipu",color:"oklch(0.55 0.15 180)",icon:"🧠",isApiKey:!0}],_N=[20,40,60,80,100];function EN({isConnected:l,color:o}){return s.jsx("div",{className:"flex items-end justify-center gap-[3px] h-5",children:_N.map((c,u)=>s.jsx("div",{className:je("w-[5px] rounded-sm transition-all duration-300",l&&"animate-signal-pulse"),style:{height:`${c}%`,background:l?o:"var(--border-subtle)",boxShadow:l?`0 0 6px ${o}`:"none",animationDelay:l?`${u*100}ms`:"0ms"}},u))})}function CN({provider:l,isAuthenticated:o,isLoading:c,isDisabled:u,onClick:f,index:m}){const g=`delay-${m%6*100}`;return s.jsxs("div",{className:je("group relative flex flex-col items-center p-5","bg-[var(--bg-panel)] border border-[var(--border-subtle)] rounded-lg","transition-all duration-300 ease-out","hover:border-transparent","animate-fade-in-up",g,c&&"animate-connecting-pulse",u&&"opacity-50 grayscale pointer-events-none"),style:{"--provider-color":l.color},children:[s.jsx("div",{className:"absolute inset-0 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",style:{boxShadow:`0 0 30px color-mix(in oklch, ${l.color} 25%, transparent), inset 0 0 20px color-mix(in oklch, ${l.color} 8%, transparent)`}}),s.jsx("div",{className:"absolute inset-0 rounded-lg border-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",style:{borderColor:l.color,boxShadow:`inset 0 0 15px color-mix(in oklch, ${l.color} 15%, transparent)`}}),s.jsxs("div",{className:je("relative w-14 h-14 rounded-xl flex items-center justify-center text-2xl","transition-all duration-300","group-hover:scale-110"),style:{background:`linear-gradient(135deg, color-mix(in oklch, ${l.color} 20%, transparent), color-mix(in oklch, ${l.color} 10%, transparent))`,border:`1px solid color-mix(in oklch, ${l.color} 40%, transparent)`,boxShadow:o?`0 0 20px color-mix(in oklch, ${l.color} 40%, transparent), inset 0 0 10px color-mix(in oklch, ${l.color} 15%, transparent)`:`0 0 10px color-mix(in oklch, ${l.color} 20%, transparent)`},children:[o&&s.jsx("div",{className:"absolute inset-0 rounded-xl animate-pulse-glow",style:{boxShadow:`0 0 25px ${l.color}`}}),s.jsx("span",{className:"relative z-10",children:l.icon})]}),s.jsx("div",{className:"mt-4 font-bold uppercase tracking-[0.15em] text-[var(--text-primary)] text-center text-xs",style:{fontFamily:"var(--font-display)"},children:l.name}),s.jsx("div",{className:"mt-4",children:s.jsx(EN,{isConnected:o,color:l.color})}),s.jsx("div",{className:je("mt-2 text-[0.65rem] uppercase tracking-wider",o?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:o?"Connected":"Offline"}),s.jsx("button",{onClick:f,disabled:c||u,className:je("mt-4 px-5 py-1.5 rounded text-[0.7rem] uppercase tracking-wider font-semibold","border transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-panel)]","disabled:opacity-50 disabled:cursor-wait",o?"bg-transparent hover:bg-[var(--bg-elevated)]":"hover:scale-105"),style:{fontFamily:"var(--font-mono)",borderColor:l.color,color:l.color,boxShadow:`0 0 10px color-mix(in oklch, ${l.color} 30%, transparent)`},children:c?s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}),"Linking"]}):o?"Relink":"Login"})]})}function TN(){return s.jsxs("div",{className:"flex flex-col items-center p-5 bg-[var(--bg-panel)] border border-[var(--border-subtle)] rounded-lg animate-pulse",children:[s.jsx("div",{className:"w-14 h-14 rounded-xl bg-[var(--bg-elevated)]"}),s.jsx("div",{className:"mt-4 h-3 w-16 bg-[var(--bg-elevated)] rounded"}),s.jsx("div",{className:"mt-4 h-5 w-12 bg-[var(--bg-elevated)] rounded"}),s.jsx("div",{className:"mt-2 h-2 w-10 bg-[var(--bg-elevated)] rounded"}),s.jsx("div",{className:"mt-4 h-8 w-20 bg-[var(--bg-elevated)] rounded"})]})}function kN(){const{loading:l,setLoading:o,showToast:c,authFiles:u,status:f,isMgmtLoading:m,mgmtKey:g,mgmtFetch:v}=Mt(),[x,p]=w.useState(!1),[b,h]=w.useState(!1),[N,E]=w.useState([]),[A,U]=w.useState(null),G=f?.running??!1,T={claude:u.some(z=>z.toLowerCase().includes("claude")),gemini:u.some(z=>z.toLowerCase().includes("gemini")&&!z.toLowerCase().includes("gemini-")),"gemini-cli":u.some(z=>z.toLowerCase().includes("gemini-")&&!z.toLowerCase().includes("antigravity")),codex:u.some(z=>z.toLowerCase().includes("codex")),qwen:u.some(z=>z.toLowerCase().includes("qwen")),antigravity:u.some(z=>z.toLowerCase().includes("antigravity")),kiro:u.some(z=>z.toLowerCase().includes("kiro")),amazonq:u.some(z=>z.toLowerCase().includes("amazonq")),minimax:u.some(z=>z.toLowerCase().includes("minimax")),zhipu:u.some(z=>z.toLowerCase().includes("zhipu"))};w.useEffect(()=>{(async()=>{try{if(window.pp_get_oauth_private){const z=await window.pp_get_oauth_private();p(z)}}catch(z){console.error("OAuth private error:",z)}})()},[]),w.useEffect(()=>{!g||!G||(async()=>{try{const z=await v("/v0/management/config");U(z);const se=await v("/v0/management/auth-files");E(se.files||[])}catch(z){z instanceof ot||console.error("Config load error:",z)}})()},[g,G]);const K=async z=>{try{window.pp_set_oauth_private&&(await window.pp_set_oauth_private(z),p(z),c("Encryption mode updated","success"))}catch(se){c(se instanceof Error?se.message:String(se),"error")}},q=async z=>{o(`oauth-${z}`);try{window.pp_oauth&&(await window.pp_oauth(z),c(`Establishing uplink to ${z}...`,"success"))}catch(se){c(se instanceof Error?se.message:String(se),"error")}finally{o(null)}},F=async z=>{o(`oauth-${z}`);try{if(z==="amazonq"){const se=await v("/v0/management/amazonq-import",{method:"POST"});if(se.success){c(`Amazon Q CLI token imported: ${se.email||"success"}`,"success");const ie=await v("/v0/management/auth-files");E(ie.files||[])}else c(se.message||"Import failed","error")}}catch(se){c(se instanceof Error?se.message:String(se),"error")}finally{o(null)}},ae=async z=>{const se=window.prompt(`Enter your ${z==="minimax"?"MiniMax":"Zhipu AI"} API key:`);if(se){o(`oauth-${z}`);try{const O=await v(z==="minimax"?"/v0/management/minimax-api-key":"/v0/management/zhipu-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:se})});if(O.success){c(`${z==="minimax"?"MiniMax":"Zhipu"} API key saved`,"success");const ne=await v("/v0/management/auth-files");E(ne.files||[])}else c(O.message||"Save failed","error")}catch(ie){c(ie instanceof Error?ie.message:String(ie),"error")}finally{o(null)}}},te=z=>{"isImport"in z&&z.isImport?F(z.id):"isApiKey"in z&&z.isApiKey?ae(z.id):q(z.id)},_=async()=>{try{const z=await v("/v0/management/debug");await v("/v0/management/debug",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:!z.value})});const se=await v("/v0/management/config");U(se)}catch(z){console.error(z)}},L=async z=>{try{await v("/v0/management/auth/reset-cooldown",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z?{auth_id:z}:{})});const se=await v("/v0/management/auth-files");E(se.files||[]),c("Cooldowns reset","success")}catch(se){c(se instanceof Error?se.message:String(se),"error")}},Y=!!A?.debug;return s.jsxs("div",{className:je("bg-[var(--bg-panel)] border border-[var(--border-subtle)] rounded-lg","shadow-lg overflow-hidden"),children:[s.jsxs("div",{className:je("flex items-center justify-between px-5 py-3","border-b border-[var(--border-subtle)]","bg-gradient-to-r from-[var(--bg-elevated)] to-transparent"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[var(--accent-glow)] text-sm tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"::"}),s.jsx("span",{className:"text-[var(--text-primary)] text-sm font-bold uppercase tracking-[0.15em]",style:{fontFamily:"var(--font-display)"},children:"Providers"})]}),s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{className:je("flex items-center gap-2 px-3 py-1 rounded-full border transition-all duration-200",x?"border-[var(--accent-glow)] bg-[color-mix(in_oklch,var(--accent-glow)_10%,transparent)]":"border-[var(--border-subtle)] bg-transparent"),children:[x?s.jsx($0,{className:"h-3.5 w-3.5 text-[var(--accent-glow)]"}):s.jsx(X0,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),s.jsx(ua,{htmlFor:"private-oauth-providers",className:je("text-[0.65rem] cursor-pointer uppercase tracking-wider",x?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:x?"Encrypted":"Private"}),s.jsx(Bo,{id:"private-oauth-providers",checked:x,onCheckedChange:K,className:"scale-75 data-[state=checked]:bg-[var(--accent-glow)]"})]})})]}),s.jsxs("div",{className:"p-5",children:[!G&&s.jsx("div",{className:"mb-6 p-4 rounded-lg border border-yellow-500/30 bg-yellow-500/5 text-yellow-500 text-xs text-center uppercase tracking-widest font-mono",children:"⚠️ Please start the proxy engine to manage providers"}),s.jsx("div",{className:"grid gap-5",style:{gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))"},children:m&&u.length===0?Array.from({length:6}).map((z,se)=>s.jsx(TN,{},se)):SN.map((z,se)=>s.jsx(CN,{index:se,provider:z,isAuthenticated:T[z.id],isLoading:l===`oauth-${z.id}`,isDisabled:!G,onClick:()=>te(z)},z.id))}),g&&G&&s.jsxs("div",{className:"mt-6 pt-5 border-t border-[var(--border-subtle)]",children:[s.jsxs("button",{onClick:()=>h(!b),className:"flex items-center justify-between w-full text-left group",children:[s.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)] group-hover:text-[var(--text-primary)] transition-colors",style:{fontFamily:"var(--font-mono)"},children:"Configuration & Accounts"}),s.jsx(al,{className:je("h-4 w-4 text-[var(--text-muted)] transition-transform",b&&"rotate-180")})]}),b&&s.jsxs("div",{className:"mt-4 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("button",{onClick:()=>_().catch(console.error),className:je("px-3 py-1.5 rounded-md text-xs font-semibold uppercase tracking-wider border transition-all",Y?"border-[var(--accent-primary)] bg-[var(--accent-primary)]/10 text-[var(--accent-primary)] shadow-[0_0_10px_var(--accent-primary)/20]":"border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"),style:{fontFamily:"var(--font-mono)"},children:["Debug: ",Y?"ON":"OFF"]}),s.jsxs("button",{onClick:()=>L().catch(console.error),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold uppercase tracking-wider border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",style:{fontFamily:"var(--font-mono)"},children:[s.jsx(ba,{className:"h-3 w-3"}),"Reset Cooldowns"]})]}),N.length>0&&s.jsx("div",{className:"rounded-lg border border-[var(--border-subtle)] overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"bg-[var(--bg-elevated)]",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)] font-semibold uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"Provider"}),s.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)] font-semibold uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"Account"}),s.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)] font-semibold uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"Status"})]})}),s.jsx("tbody",{children:N.map(z=>s.jsxs("tr",{className:"border-t border-[var(--border-subtle)]",children:[s.jsx("td",{className:"px-3 py-2 font-mono text-[var(--text-primary)]",children:z.provider||z.type||"—"}),s.jsx("td",{className:"px-3 py-2 text-[var(--text-secondary)]",children:z.email||z.label||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx("span",{className:je("inline-flex px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",z.status==="active"||z.status==="ok"?"bg-[var(--status-online)]/15 text-[var(--status-online)]":"bg-[var(--text-muted)]/15 text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:z.status||"unknown"})})]},z.id))})]})})]})]})]}),s.jsx("style",{children:` + `})]})}function cN(l){const o=w.useRef({value:l,previous:l});return w.useMemo(()=>(o.current.value!==l&&(o.current.previous=o.current.value,o.current.value=l),o.current.previous),[l])}var Po="Switch",[uN]=Yu(Po),[dN,fN]=uN(Po),I0=w.forwardRef((l,o)=>{const{__scopeSwitch:c,name:u,checked:d,defaultChecked:m,required:g,disabled:v,value:x="on",onCheckedChange:p,form:b,...h}=l,[N,_]=w.useState(null),A=ln(o,q=>_(q)),U=w.useRef(!1),G=N?b||!!N.closest("form"):!0,[k,K]=h0({prop:d,defaultProp:m??!1,onChange:p,caller:Po});return s.jsxs(dN,{scope:c,checked:k,disabled:v,children:[s.jsx(Da.button,{type:"button",role:"switch","aria-checked":k,"aria-required":g,"data-state":ng(k),"data-disabled":v?"":void 0,disabled:v,value:x,...h,ref:A,onClick:Aa(l.onClick,q=>{K(F=>!F),G&&(U.current=q.isPropagationStopped(),U.current||q.stopPropagation())})}),G&&s.jsx(ag,{control:N,bubbles:!U.current,name:u,value:x,checked:k,required:g,disabled:v,form:b,style:{transform:"translateX(-100%)"}})]})});I0.displayName=Po;var eg="SwitchThumb",tg=w.forwardRef((l,o)=>{const{__scopeSwitch:c,...u}=l,d=fN(eg,c);return s.jsx(Da.span,{"data-state":ng(d.checked),"data-disabled":d.disabled?"":void 0,...u,ref:o})});tg.displayName=eg;var mN="SwitchBubbleInput",ag=w.forwardRef(({__scopeSwitch:l,control:o,checked:c,bubbles:u=!0,...d},m)=>{const g=w.useRef(null),v=ln(g,m),x=cN(c),p=a0(o);return w.useEffect(()=>{const b=g.current;if(!b)return;const h=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(h,"checked").set;if(x!==c&&_){const A=new Event("click",{bubbles:u});_.call(b,c),b.dispatchEvent(A)}},[x,c,u]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...d,tabIndex:-1,ref:v,style:{...d.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ag.displayName=mN;function ng(l){return l?"checked":"unchecked"}var hN=I0,pN=tg;function Go({className:l,...o}){return s.jsx(hN,{"data-slot":"switch",className:Ne("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",l),...o,children:s.jsx(pN,{"data-slot":"switch-thumb",className:Ne("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}var gN=Symbol.for("react.lazy"),Vo=Bu[" use ".trim().toString()];function xN(l){return typeof l=="object"&&l!==null&&"then"in l}function sg(l){return l!=null&&typeof l=="object"&&"$$typeof"in l&&l.$$typeof===gN&&"_payload"in l&&xN(l._payload)}function lg(l){const o=vN(l),c=w.forwardRef((u,d)=>{let{children:m,...g}=u;sg(m)&&typeof Vo=="function"&&(m=Vo(m._payload));const v=w.Children.toArray(m),x=v.find(bN);if(x){const p=x.props.children,b=v.map(h=>h===x?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:h);return s.jsx(o,{...g,ref:d,children:w.isValidElement(p)?w.cloneElement(p,void 0,b):null})}return s.jsx(o,{...g,ref:d,children:m})});return c.displayName=`${l}.Slot`,c}var rg=lg("Slot");function vN(l){const o=w.forwardRef((c,u)=>{let{children:d,...m}=c;if(sg(d)&&typeof Vo=="function"&&(d=Vo(d._payload)),w.isValidElement(d)){const g=NN(d),v=wN(m,d.props);return d.type!==w.Fragment&&(v.ref=u?qu(u,g):g),w.cloneElement(d,v)}return w.Children.count(d)>1?w.Children.only(null):null});return o.displayName=`${l}.SlotClone`,o}var yN=Symbol("radix.slottable");function bN(l){return w.isValidElement(l)&&typeof l.type=="function"&&"__radixId"in l.type&&l.type.__radixId===yN}function wN(l,o){const c={...o};for(const u in o){const d=l[u],m=o[u];/^on[A-Z]/.test(u)?d&&m?c[u]=(...v)=>{const x=m(...v);return d(...v),x}:d&&(c[u]=d):u==="style"?c[u]={...d,...m}:u==="className"&&(c[u]=[d,m].filter(Boolean).join(" "))}return{...l,...c}}function NN(l){let o=Object.getOwnPropertyDescriptor(l.props,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning;return c?l.ref:(o=Object.getOwnPropertyDescriptor(l,"ref")?.get,c=o&&"isReactWarning"in o&&o.isReactWarning,c?l.props.ref:l.props.ref||l.ref)}var jN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],SN=jN.reduce((l,o)=>{const c=lg(`Primitive.${o}`),u=w.forwardRef((d,m)=>{const{asChild:g,...v}=d,x=g?c:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(x,{...v,ref:m})});return u.displayName=`Primitive.${o}`,{...l,[o]:u}},{}),_N="Label",og=w.forwardRef((l,o)=>s.jsx(SN.label,{...l,ref:o,onMouseDown:c=>{c.target.closest("button, input, select, textarea")||(l.onMouseDown?.(c),!c.defaultPrevented&&c.detail>1&&c.preventDefault())}}));og.displayName=_N;var EN=og;function da({className:l,...o}){return s.jsx(EN,{"data-slot":"label",className:Ne("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",l),...o})}const CN=[{id:"claude",name:"Claude",color:"oklch(0.60 0.15 35)",icon:"🤖"},{id:"gemini",name:"Gemini",color:"oklch(0.55 0.18 250)",icon:"✨"},{id:"gemini-cli",name:"Gemini CLI",color:"oklch(0.58 0.16 240)",icon:"🌐"},{id:"codex",name:"Codex",color:"oklch(0.60 0.16 145)",icon:"💻"},{id:"qwen",name:"Qwen",color:"oklch(0.60 0.14 280)",icon:"🔮"},{id:"antigravity",name:"Antigravity",color:"oklch(0.65 0.20 320)",icon:"🚀"},{id:"kiro",name:"Kiro",color:"oklch(0.58 0.17 200)",icon:"🛸"},{id:"amazonq",name:"Amazon Q",color:"oklch(0.55 0.16 30)",icon:"📦",isImport:!0},{id:"minimax",name:"MiniMax",color:"oklch(0.60 0.18 60)",icon:"🔶",isApiKey:!0},{id:"zhipu",name:"Zhipu",color:"oklch(0.55 0.15 180)",icon:"🧠",isApiKey:!0}],kN=[20,40,60,80,100];function TN({isConnected:l,color:o}){return s.jsx("div",{className:"flex items-end justify-center gap-[3px] h-5",children:kN.map((c,u)=>s.jsx("div",{className:Ne("w-[5px] rounded-sm transition-all duration-300",l&&"animate-signal-pulse"),style:{height:`${c}%`,background:l?o:"var(--border-subtle)",boxShadow:l?`0 0 6px ${o}`:"none",animationDelay:l?`${u*100}ms`:"0ms"}},u))})}function AN({provider:l,isAuthenticated:o,isLoading:c,isDisabled:u,onClick:d,index:m}){const g=`delay-${m%6*100}`;return s.jsxs("div",{className:Ne("group relative flex flex-col items-center p-5","bg-[var(--bg-panel)] border border-[var(--border-subtle)] rounded-lg","transition-all duration-300 ease-out","hover:border-transparent","animate-fade-in-up",g,c&&"animate-connecting-pulse",u&&"opacity-50 grayscale pointer-events-none"),style:{"--provider-color":l.color},children:[s.jsx("div",{className:"absolute inset-0 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",style:{boxShadow:`0 0 30px color-mix(in oklch, ${l.color} 25%, transparent), inset 0 0 20px color-mix(in oklch, ${l.color} 8%, transparent)`}}),s.jsx("div",{className:"absolute inset-0 rounded-lg border-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",style:{borderColor:l.color,boxShadow:`inset 0 0 15px color-mix(in oklch, ${l.color} 15%, transparent)`}}),s.jsxs("div",{className:Ne("relative w-14 h-14 rounded-xl flex items-center justify-center text-2xl","transition-all duration-300","group-hover:scale-110"),style:{background:`linear-gradient(135deg, color-mix(in oklch, ${l.color} 20%, transparent), color-mix(in oklch, ${l.color} 10%, transparent))`,border:`1px solid color-mix(in oklch, ${l.color} 40%, transparent)`,boxShadow:o?`0 0 20px color-mix(in oklch, ${l.color} 40%, transparent), inset 0 0 10px color-mix(in oklch, ${l.color} 15%, transparent)`:`0 0 10px color-mix(in oklch, ${l.color} 20%, transparent)`},children:[o&&s.jsx("div",{className:"absolute inset-0 rounded-xl animate-pulse-glow",style:{boxShadow:`0 0 25px ${l.color}`}}),s.jsx("span",{className:"relative z-10",children:l.icon})]}),s.jsx("div",{className:"mt-4 font-bold uppercase tracking-[0.15em] text-[var(--text-primary)] text-center text-xs",style:{fontFamily:"var(--font-display)"},children:l.name}),s.jsx("div",{className:"mt-4",children:s.jsx(TN,{isConnected:o,color:l.color})}),s.jsx("div",{className:Ne("mt-2 text-[0.65rem] uppercase tracking-wider",o?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:o?"Connected":"Offline"}),s.jsx("button",{onClick:d,disabled:c||u,className:Ne("mt-4 px-5 py-1.5 rounded text-[0.7rem] uppercase tracking-wider font-semibold","border transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-panel)]","disabled:opacity-50 disabled:cursor-wait",o?"bg-transparent hover:bg-[var(--bg-elevated)]":"hover:scale-105"),style:{fontFamily:"var(--font-mono)",borderColor:l.color,color:l.color,boxShadow:`0 0 10px color-mix(in oklch, ${l.color} 30%, transparent)`},children:c?s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}),"Linking"]}):o?"Relink":"Login"})]})}function MN(){return s.jsxs("div",{className:"flex flex-col items-center p-5 bg-[var(--bg-panel)] border border-[var(--border-subtle)] rounded-lg animate-pulse",children:[s.jsx("div",{className:"w-14 h-14 rounded-xl bg-[var(--bg-elevated)]"}),s.jsx("div",{className:"mt-4 h-3 w-16 bg-[var(--bg-elevated)] rounded"}),s.jsx("div",{className:"mt-4 h-5 w-12 bg-[var(--bg-elevated)] rounded"}),s.jsx("div",{className:"mt-2 h-2 w-10 bg-[var(--bg-elevated)] rounded"}),s.jsx("div",{className:"mt-4 h-8 w-20 bg-[var(--bg-elevated)] rounded"})]})}function ON(){const{loading:l,setLoading:o,showToast:c,authFiles:u,status:d,isMgmtLoading:m,mgmtKey:g,mgmtFetch:v}=Et(),[x,p]=w.useState(!1),[b,h]=w.useState(!1),[N,_]=w.useState([]),[A,U]=w.useState(null),G=d?.running??!1,k={claude:u.some(z=>z.toLowerCase().includes("claude")),gemini:u.some(z=>z.toLowerCase().includes("gemini")&&!z.toLowerCase().includes("gemini-")),"gemini-cli":u.some(z=>z.toLowerCase().includes("gemini-")&&!z.toLowerCase().includes("antigravity")),codex:u.some(z=>z.toLowerCase().includes("codex")),qwen:u.some(z=>z.toLowerCase().includes("qwen")),antigravity:u.some(z=>z.toLowerCase().includes("antigravity")),kiro:u.some(z=>z.toLowerCase().includes("kiro")),amazonq:u.some(z=>z.toLowerCase().includes("amazonq")),minimax:u.some(z=>z.toLowerCase().includes("minimax")),zhipu:u.some(z=>z.toLowerCase().includes("zhipu"))};w.useEffect(()=>{(async()=>{try{if(window.pp_get_oauth_private){const z=await window.pp_get_oauth_private();p(z)}}catch(z){console.error("OAuth private error:",z)}})()},[]),w.useEffect(()=>{!g||!G||(async()=>{try{const z=await v("/v0/management/config");U(z);const se=await v("/v0/management/auth-files");_(se.files||[])}catch(z){z instanceof ot||console.error("Config load error:",z)}})()},[g,G]);const K=async z=>{try{window.pp_set_oauth_private&&(await window.pp_set_oauth_private(z),p(z),c("Encryption mode updated","success"))}catch(se){c(se instanceof Error?se.message:String(se),"error")}},q=async z=>{o(`oauth-${z}`);try{window.pp_oauth&&(await window.pp_oauth(z),c(`Establishing uplink to ${z}...`,"success"))}catch(se){c(se instanceof Error?se.message:String(se),"error")}finally{o(null)}},F=async z=>{o(`oauth-${z}`);try{if(z==="amazonq"){const se=await v("/v0/management/amazonq-import",{method:"POST"});if(se.success){c(`Amazon Q CLI token imported: ${se.email||"success"}`,"success");const ie=await v("/v0/management/auth-files");_(ie.files||[])}else c(se.message||"Import failed","error")}}catch(se){c(se instanceof Error?se.message:String(se),"error")}finally{o(null)}},ae=async z=>{const se=window.prompt(`Enter your ${z==="minimax"?"MiniMax":"Zhipu AI"} API key:`);if(se){o(`oauth-${z}`);try{const O=await v(z==="minimax"?"/v0/management/minimax-api-key":"/v0/management/zhipu-api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_key:se})});if(O.success){c(`${z==="minimax"?"MiniMax":"Zhipu"} API key saved`,"success");const ne=await v("/v0/management/auth-files");_(ne.files||[])}else c(O.message||"Save failed","error")}catch(ie){c(ie instanceof Error?ie.message:String(ie),"error")}finally{o(null)}}},te=z=>{"isImport"in z&&z.isImport?F(z.id):"isApiKey"in z&&z.isApiKey?ae(z.id):q(z.id)},E=async()=>{try{const z=await v("/v0/management/debug");await v("/v0/management/debug",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:!z.value})});const se=await v("/v0/management/config");U(se)}catch(z){console.error(z)}},L=async z=>{try{await v("/v0/management/auth/reset-cooldown",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z?{auth_id:z}:{})});const se=await v("/v0/management/auth-files");_(se.files||[]),c("Cooldowns reset","success")}catch(se){c(se instanceof Error?se.message:String(se),"error")}},Y=!!A?.debug;return s.jsxs("div",{className:Ne("bg-[var(--bg-panel)] border border-[var(--border-subtle)] rounded-lg","shadow-lg overflow-hidden"),children:[s.jsxs("div",{className:Ne("flex items-center justify-between px-5 py-3","border-b border-[var(--border-subtle)]","bg-gradient-to-r from-[var(--bg-elevated)] to-transparent"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[var(--accent-glow)] text-sm tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"::"}),s.jsx("span",{className:"text-[var(--text-primary)] text-sm font-bold uppercase tracking-[0.15em]",style:{fontFamily:"var(--font-display)"},children:"Providers"})]}),s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{className:Ne("flex items-center gap-2 px-3 py-1 rounded-full border transition-all duration-200",x?"border-[var(--accent-glow)] bg-[color-mix(in_oklch,var(--accent-glow)_10%,transparent)]":"border-[var(--border-subtle)] bg-transparent"),children:[x?s.jsx(K0,{className:"h-3.5 w-3.5 text-[var(--accent-glow)]"}):s.jsx(Z0,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}),s.jsx(da,{htmlFor:"private-oauth-providers",className:Ne("text-[0.65rem] cursor-pointer uppercase tracking-wider",x?"text-[var(--accent-glow)]":"text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:x?"Encrypted":"Private"}),s.jsx(Go,{id:"private-oauth-providers",checked:x,onCheckedChange:K,className:"scale-75 data-[state=checked]:bg-[var(--accent-glow)]"})]})})]}),s.jsxs("div",{className:"p-5",children:[!G&&s.jsx("div",{className:"mb-6 p-4 rounded-lg border border-yellow-500/30 bg-yellow-500/5 text-yellow-500 text-xs text-center uppercase tracking-widest font-mono",children:"⚠️ Please start the proxy engine to manage providers"}),s.jsx("div",{className:"grid gap-5",style:{gridTemplateColumns:"repeat(auto-fill, minmax(160px, 1fr))"},children:m&&u.length===0?Array.from({length:6}).map((z,se)=>s.jsx(MN,{},se)):CN.map((z,se)=>s.jsx(AN,{index:se,provider:z,isAuthenticated:k[z.id],isLoading:l===`oauth-${z.id}`,isDisabled:!G,onClick:()=>te(z)},z.id))}),g&&G&&s.jsxs("div",{className:"mt-6 pt-5 border-t border-[var(--border-subtle)]",children:[s.jsxs("button",{onClick:()=>h(!b),className:"flex items-center justify-between w-full text-left group",children:[s.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)] group-hover:text-[var(--text-primary)] transition-colors",style:{fontFamily:"var(--font-mono)"},children:"Configuration & Accounts"}),s.jsx(nl,{className:Ne("h-4 w-4 text-[var(--text-muted)] transition-transform",b&&"rotate-180")})]}),b&&s.jsxs("div",{className:"mt-4 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("button",{onClick:()=>E().catch(console.error),className:Ne("px-3 py-1.5 rounded-md text-xs font-semibold uppercase tracking-wider border transition-all",Y?"border-[var(--accent-primary)] bg-[var(--accent-primary)]/10 text-[var(--accent-primary)] shadow-[0_0_10px_var(--accent-primary)/20]":"border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"),style:{fontFamily:"var(--font-mono)"},children:["Debug: ",Y?"ON":"OFF"]}),s.jsxs("button",{onClick:()=>L().catch(console.error),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold uppercase tracking-wider border border-[var(--border-default)] bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",style:{fontFamily:"var(--font-mono)"},children:[s.jsx(fa,{className:"h-3 w-3"}),"Reset Cooldowns"]})]}),N.length>0&&s.jsx("div",{className:"rounded-lg border border-[var(--border-subtle)] overflow-hidden",children:s.jsxs("table",{className:"w-full text-xs",children:[s.jsx("thead",{className:"bg-[var(--bg-elevated)]",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)] font-semibold uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"Provider"}),s.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)] font-semibold uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"Account"}),s.jsx("th",{className:"px-3 py-2 text-left text-[var(--text-muted)] font-semibold uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:"Status"})]})}),s.jsx("tbody",{children:N.map(z=>s.jsxs("tr",{className:"border-t border-[var(--border-subtle)]",children:[s.jsx("td",{className:"px-3 py-2 font-mono text-[var(--text-primary)]",children:z.provider||z.type||"—"}),s.jsx("td",{className:"px-3 py-2 text-[var(--text-secondary)]",children:z.email||z.label||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx("span",{className:Ne("inline-flex px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",z.status==="active"||z.status==="ok"?"bg-[var(--status-online)]/15 text-[var(--status-online)]":"bg-[var(--text-muted)]/15 text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:z.status||"unknown"})})]},z.id))})]})})]})]})]}),s.jsx("style",{children:` @keyframes pulse-glow { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } @@ -59,43 +59,43 @@ Error generating stack: `+n.message+` .animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; } - `})]})}const Cp=l=>typeof l=="boolean"?`${l}`:l===0?"0":l,Tp=S0,lg=(l,o)=>c=>{var u;if(o?.variants==null)return Tp(l,c?.class,c?.className);const{variants:f,defaultVariants:m}=o,g=Object.keys(f).map(p=>{const b=c?.[p],h=m?.[p];if(b===null)return null;const N=Cp(b)||Cp(h);return f[p][N]}),v=c&&Object.entries(c).reduce((p,b)=>{let[h,N]=b;return N===void 0||(p[h]=N),p},{}),x=o==null||(u=o.compoundVariants)===null||u===void 0?void 0:u.reduce((p,b)=>{let{class:h,className:N,...E}=b;return Object.entries(E).every(A=>{let[U,G]=A;return Array.isArray(G)?G.includes({...m,...v}[U]):{...m,...v}[U]===G})?[...p,h,N]:p},[]);return Tp(l,g,x,c?.class,c?.className)},AN=lg(["inline-flex items-center justify-center gap-2 whitespace-nowrap","text-sm font-semibold uppercase tracking-wide","rounded-md","border border-transparent","transition-[transform,box-shadow] duration-50 ease-out","active:translate-y-0.5 active:shadow-none","outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0"].join(" "),{variants:{variant:{default:["bg-[oklch(0.75_0.18_55)] text-[oklch(0.15_0.02_55)]","shadow-[0_2px_0_0_oklch(0_0_0/0.25)]","hover:bg-[oklch(0.78_0.19_55)] hover:border-[oklch(0.65_0.2_55)]","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" "),secondary:["bg-[oklch(0.18_0.04_260)] text-[oklch(0.85_0.02_260)]","border-[oklch(0.30_0.05_260)]","shadow-[0_2px_0_0_oklch(0_0_0/0.3)]","hover:bg-[oklch(0.22_0.05_260)] hover:border-[oklch(0.75_0.18_55)]","focus-visible:ring-[oklch(0.45_0.08_260)]"].join(" "),destructive:["bg-[oklch(0.35_0.12_25)] text-[oklch(0.90_0.02_25)]","border-[oklch(0.40_0.15_25)]","shadow-[0_2px_0_0_oklch(0_0_0/0.3)]","hover:bg-[oklch(0.40_0.14_25)] hover:border-[oklch(0.50_0.18_25)]","focus-visible:ring-[oklch(0.45_0.15_25)]"].join(" "),outline:["bg-transparent text-foreground","border-[oklch(0.35_0.05_260)]","shadow-[0_2px_0_0_oklch(0_0_0/0.1)]","hover:border-[oklch(0.75_0.18_55)] hover:text-[oklch(0.75_0.18_55)]","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" "),ghost:["bg-transparent text-foreground","shadow-none","hover:bg-[oklch(0.25_0.04_260)] hover:text-[oklch(0.85_0.02_260)]","active:translate-y-0 active:bg-[oklch(0.20_0.04_260)]","focus-visible:ring-[oklch(0.45_0.08_260)]"].join(" "),command:["bg-[oklch(0.20_0.05_260)] text-[oklch(0.75_0.18_55)]","border-[oklch(0.75_0.18_55)]","shadow-[0_2px_0_0_oklch(0.75_0.18_55/0.4),0_0_12px_0_oklch(0.75_0.18_55/0.2)]","hover:bg-[oklch(0.25_0.06_260)] hover:shadow-[0_2px_0_0_oklch(0.75_0.18_55/0.6),0_0_20px_0_oklch(0.75_0.18_55/0.35)]","hover:text-[oklch(0.80_0.20_55)]","active:shadow-[0_0_8px_0_oklch(0.75_0.18_55/0.4)]","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" "),link:["text-[oklch(0.75_0.18_55)] underline-offset-4","shadow-none","hover:underline hover:text-[oklch(0.80_0.20_55)]","active:translate-y-0","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" ")},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 text-xs has-[>svg]:px-2.5",lg:"h-11 rounded-md px-6 text-base has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Ne({className:l,variant:o="default",size:c="default",asChild:u=!1,...f}){const m=u?ng:"button";return s.jsx(m,{"data-slot":"button","data-variant":o,"data-size":c,className:je(AN({variant:o,size:c,className:l})),...f})}function MN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u,pp_detect_agents:f,pp_configure_agent:m,pp_unconfigure_agent:g,isDesktop:v}=Mt(),[x,p]=w.useState([]),[b,h]=w.useState(!1),[N,E]=w.useState(null),[A,U]=w.useState(null),[G,T]=w.useState(null),K=c?.running??!1,q=w.useCallback(async()=>{if(K){h(!0);try{let Y=[];v&&f?Y=await f():Y=(await l("/v0/management/agents")).agents||[],p(Y)}catch(Y){Y instanceof ot||console.error("Failed to fetch agents:",Y)}h(!1)}},[l,K,v,f]);w.useEffect(()=>{K?q():p([])},[K,q]);const F=(Y,z)=>{navigator.clipboard.writeText(Y),o(`${z} copied to clipboard`,"success")},ae=Y=>{const z=Object.entries(Y).map(([se,ie])=>`${se}=${ie}`).join(` -`);F(z,"Environment variables")},te=Y=>["claude-code","gemini-cli"].includes(Y),_=async Y=>{if(Y.id){E(Y.id);try{v&&m?await m(Y.id):await l(`/v0/management/agents/${Y.id}/configure`,{method:"POST"});const z=te(Y.id)?`${Y.name} configured! Restart shell to apply.`:`${Y.name} configured!`;o(z,"success"),await q()}catch(z){o(z instanceof Error?z.message:String(z),"error")}E(null)}},L=async Y=>{if(Y.id){U(Y.id);try{v&&g?await g(Y.id):await l(`/v0/management/agents/${Y.id}/unconfigure`,{method:"POST"});const z=te(Y.id)?`${Y.name} configuration removed. Restart shell to apply.`:`${Y.name} configuration removed.`;o(z,"success"),await q()}catch(z){o(z instanceof Error?z.message:String(z),"error")}U(null)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-panel)] shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-[var(--bg-elevated)] border-b border-[var(--border-default)]",children:[s.jsx(Ru,{className:`h-4 w-4 text-[var(--accent-primary)] ${b?"animate-pulse":""}`}),s.jsx("span",{className:"font-mono text-xs font-bold uppercase tracking-widest text-[var(--text-secondary)]",children:"CLI Agent Detection"}),u&&s.jsx(Vt,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsx("div",{className:"flex-1"}),s.jsx("button",{onClick:q,disabled:b||!K,className:"p-1.5 rounded hover:bg-[var(--bg-void)] text-[var(--text-muted)] hover:text-[var(--accent-primary)] transition-colors disabled:opacity-50",children:s.jsx(ba,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),s.jsx("div",{className:"p-4",children:K?x.length===0&&!b?s.jsx("div",{className:"text-center py-8 text-[var(--text-muted)] font-mono text-xs uppercase",children:"No agents detected"}):s.jsx("div",{className:"grid gap-3",children:x.map(Y=>s.jsxs("div",{className:` + `})]})}const Tp=l=>typeof l=="boolean"?`${l}`:l===0?"0":l,Ap=E0,ig=(l,o)=>c=>{var u;if(o?.variants==null)return Ap(l,c?.class,c?.className);const{variants:d,defaultVariants:m}=o,g=Object.keys(d).map(p=>{const b=c?.[p],h=m?.[p];if(b===null)return null;const N=Tp(b)||Tp(h);return d[p][N]}),v=c&&Object.entries(c).reduce((p,b)=>{let[h,N]=b;return N===void 0||(p[h]=N),p},{}),x=o==null||(u=o.compoundVariants)===null||u===void 0?void 0:u.reduce((p,b)=>{let{class:h,className:N,..._}=b;return Object.entries(_).every(A=>{let[U,G]=A;return Array.isArray(G)?G.includes({...m,...v}[U]):{...m,...v}[U]===G})?[...p,h,N]:p},[]);return Ap(l,g,x,c?.class,c?.className)},zN=ig(["inline-flex items-center justify-center gap-2 whitespace-nowrap","text-sm font-semibold uppercase tracking-wide","rounded-md","border border-transparent","transition-[transform,box-shadow] duration-50 ease-out","active:translate-y-0.5 active:shadow-none","outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50","[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0"].join(" "),{variants:{variant:{default:["bg-[oklch(0.75_0.18_55)] text-[oklch(0.15_0.02_55)]","shadow-[0_2px_0_0_oklch(0_0_0/0.25)]","hover:bg-[oklch(0.78_0.19_55)] hover:border-[oklch(0.65_0.2_55)]","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" "),secondary:["bg-[oklch(0.18_0.04_260)] text-[oklch(0.85_0.02_260)]","border-[oklch(0.30_0.05_260)]","shadow-[0_2px_0_0_oklch(0_0_0/0.3)]","hover:bg-[oklch(0.22_0.05_260)] hover:border-[oklch(0.75_0.18_55)]","focus-visible:ring-[oklch(0.45_0.08_260)]"].join(" "),destructive:["bg-[oklch(0.35_0.12_25)] text-[oklch(0.90_0.02_25)]","border-[oklch(0.40_0.15_25)]","shadow-[0_2px_0_0_oklch(0_0_0/0.3)]","hover:bg-[oklch(0.40_0.14_25)] hover:border-[oklch(0.50_0.18_25)]","focus-visible:ring-[oklch(0.45_0.15_25)]"].join(" "),outline:["bg-transparent text-foreground","border-[oklch(0.35_0.05_260)]","shadow-[0_2px_0_0_oklch(0_0_0/0.1)]","hover:border-[oklch(0.75_0.18_55)] hover:text-[oklch(0.75_0.18_55)]","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" "),ghost:["bg-transparent text-foreground","shadow-none","hover:bg-[oklch(0.25_0.04_260)] hover:text-[oklch(0.85_0.02_260)]","active:translate-y-0 active:bg-[oklch(0.20_0.04_260)]","focus-visible:ring-[oklch(0.45_0.08_260)]"].join(" "),command:["bg-[oklch(0.20_0.05_260)] text-[oklch(0.75_0.18_55)]","border-[oklch(0.75_0.18_55)]","shadow-[0_2px_0_0_oklch(0.75_0.18_55/0.4),0_0_12px_0_oklch(0.75_0.18_55/0.2)]","hover:bg-[oklch(0.25_0.06_260)] hover:shadow-[0_2px_0_0_oklch(0.75_0.18_55/0.6),0_0_20px_0_oklch(0.75_0.18_55/0.35)]","hover:text-[oklch(0.80_0.20_55)]","active:shadow-[0_0_8px_0_oklch(0.75_0.18_55/0.4)]","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" "),link:["text-[oklch(0.75_0.18_55)] underline-offset-4","shadow-none","hover:underline hover:text-[oklch(0.80_0.20_55)]","active:translate-y-0","focus-visible:ring-[oklch(0.75_0.18_55)]"].join(" ")},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 text-xs has-[>svg]:px-2.5",lg:"h-11 rounded-md px-6 text-base has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function je({className:l,variant:o="default",size:c="default",asChild:u=!1,...d}){const m=u?rg:"button";return s.jsx(m,{"data-slot":"button","data-variant":o,"data-size":c,className:Ne(zN({variant:o,size:c,className:l})),...d})}function RN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u,pp_detect_agents:d,pp_configure_agent:m,pp_unconfigure_agent:g,isDesktop:v}=Et(),[x,p]=w.useState([]),[b,h]=w.useState(!1),[N,_]=w.useState(null),[A,U]=w.useState(null),[G,k]=w.useState(null),K=c?.running??!1,q=w.useCallback(async()=>{if(K){h(!0);try{let Y=[];v&&d?Y=await d():Y=(await l("/v0/management/agents")).agents||[],p(Y)}catch(Y){Y instanceof ot||console.error("Failed to fetch agents:",Y)}h(!1)}},[l,K,v,d]);w.useEffect(()=>{K?q():p([])},[K,q]);const F=(Y,z)=>{navigator.clipboard.writeText(Y),o(`${z} copied to clipboard`,"success")},ae=Y=>{const z=Object.entries(Y).map(([se,ie])=>`${se}=${ie}`).join(` +`);F(z,"Environment variables")},te=Y=>["claude-code","gemini-cli"].includes(Y),E=async Y=>{if(Y.id){_(Y.id);try{v&&m?await m(Y.id):await l(`/v0/management/agents/${Y.id}/configure`,{method:"POST"});const z=te(Y.id)?`${Y.name} configured! Restart shell to apply.`:`${Y.name} configured!`;o(z,"success"),await q()}catch(z){o(z instanceof Error?z.message:String(z),"error")}_(null)}},L=async Y=>{if(Y.id){U(Y.id);try{v&&g?await g(Y.id):await l(`/v0/management/agents/${Y.id}/unconfigure`,{method:"POST"});const z=te(Y.id)?`${Y.name} configuration removed. Restart shell to apply.`:`${Y.name} configuration removed.`;o(z,"success"),await q()}catch(z){o(z instanceof Error?z.message:String(z),"error")}U(null)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-panel)] shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-[var(--bg-elevated)] border-b border-[var(--border-default)]",children:[s.jsx(Uu,{className:`h-4 w-4 text-[var(--accent-primary)] ${b?"animate-pulse":""}`}),s.jsx("span",{className:"font-mono text-xs font-bold uppercase tracking-widest text-[var(--text-secondary)]",children:"CLI Agent Detection"}),u&&s.jsx(zt,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsx("div",{className:"flex-1"}),s.jsx("button",{onClick:q,disabled:b||!K,className:"p-1.5 rounded hover:bg-[var(--bg-void)] text-[var(--text-muted)] hover:text-[var(--accent-primary)] transition-colors disabled:opacity-50",children:s.jsx(fa,{className:`h-3.5 w-3.5 ${b?"animate-spin":""}`})})]}),s.jsx("div",{className:"p-4",children:K?x.length===0&&!b?s.jsx("div",{className:"text-center py-8 text-[var(--text-muted)] font-mono text-xs uppercase",children:"No agents detected"}):s.jsx("div",{className:"grid gap-3",children:x.map(Y=>s.jsxs("div",{className:` flex items-center gap-4 p-3 rounded border transition-all ${Y.detected?"bg-[var(--bg-elevated)]/50 border-[var(--border-default)]":"bg-[var(--bg-void)]/30 border-[var(--border-subtle)] opacity-60"} - `,children:[s.jsx("div",{className:"shrink-0",children:Y.configured?s.jsx("div",{className:"p-1.5 rounded-full bg-[var(--status-online)]/10 text-[var(--status-online)]",children:s.jsx(tl,{className:"h-4 w-4"})}):Y.detected?s.jsx("div",{className:"p-1.5 rounded-full bg-[var(--status-warning)]/10 text-[var(--status-warning)]",children:s.jsx(Iu,{className:"h-4 w-4"})}):s.jsx("div",{className:"p-1.5 rounded-full bg-[var(--bg-void)] text-[var(--text-muted)]",children:s.jsx(Ru,{className:"h-4 w-4"})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono text-sm font-bold text-[var(--text-primary)]",children:Y.name}),Y.detected&&!Y.configured&&s.jsx("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-[var(--status-warning)]/10 text-[var(--status-warning)] border border-[var(--status-warning)]/20",children:"Needs Config"})]}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] truncate",children:Y.detected?Y.configured?"Fully configured and ready":"Detected but not configured":"Not found on this system"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Y.detected&&Y.shell_config&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{onClick:()=>T(Y),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-all font-mono text-xs uppercase tracking-wider",children:[s.jsx(Ep,{className:"h-3.5 w-3.5"}),"Shell"]})}),s.jsx(ya,{children:"View Shell Profile Configuration"})]}),Y.detected&&!Y.configured&&Y.canAutoConfigure&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{onClick:()=>_(Y),disabled:N===Y.id,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border border-[var(--accent-primary)] bg-[var(--accent-primary)]/10 text-[var(--accent-primary)] hover:bg-[var(--accent-primary)]/20 transition-all disabled:opacity-50 font-mono text-xs uppercase tracking-wider",children:[N===Y.id?s.jsx(Vt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(J0,{className:"h-3.5 w-3.5"}),"Configure"]})}),s.jsxs(ya,{children:["Auto-configure ",Y.name," for ProxyPilot"]})]}),Y.detected&&Y.configured&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{onClick:()=>L(Y),disabled:A===Y.id,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border border-[var(--status-error)] bg-[var(--status-error)]/10 text-[var(--status-error)] hover:bg-[var(--status-error)]/20 transition-all disabled:opacity-50 font-mono text-xs uppercase tracking-wider",children:[A===Y.id?s.jsx(Vt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(Pw,{className:"h-3.5 w-3.5"}),"Reset"]})}),s.jsxs(ya,{children:["Remove ProxyPilot configuration from ",Y.name]})]}),Y.envVars&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsx("button",{onClick:()=>ae(Y.envVars),className:"p-2 rounded border border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-all",children:s.jsx(nl,{className:"h-3.5 w-3.5"})})}),s.jsx(ya,{children:"Copy Environment Variables"})]}),Y.configInstructions&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsx("button",{onClick:()=>{o(Y.configInstructions,"success")},className:"p-2 rounded border border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-all",children:s.jsx(lw,{className:"h-3.5 w-3.5"})})}),s.jsx(ya,{children:"View Setup Instructions"})]})]})]},Y.name))}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx("div",{className:"font-mono text-sm text-[var(--text-muted)] uppercase tracking-wider mb-1",children:"Engine Offline"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Start the proxy engine to detect agents"})]})})]}),G&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.jsxs("div",{className:"bg-[var(--bg-panel)] border border-[var(--border-default)] rounded-lg shadow-2xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border-subtle)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ep,{className:"h-4 w-4 text-[var(--accent-primary)]"}),s.jsxs("span",{className:"font-mono text-sm font-bold",children:[G.name," - Shell Configuration"]})]}),s.jsx("button",{onClick:()=>T(null),className:"p-1 rounded hover:bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(ed,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s.jsx("div",{className:"mb-3",children:s.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Add these lines to your shell profile (",s.jsx("code",{className:"text-[var(--accent-primary)]",children:"~/.bashrc"}),", ",s.jsx("code",{className:"text-[var(--accent-primary)]",children:"~/.zshrc"}),", or ",s.jsx("code",{className:"text-[var(--accent-primary)]",children:"~/.profile"}),"):"]})}),s.jsx("pre",{className:"bg-[var(--bg-void)] border border-[var(--border-subtle)] rounded-lg p-4 text-xs font-mono text-[var(--text-secondary)] overflow-x-auto whitespace-pre-wrap",children:G.shell_config})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-[var(--border-subtle)]",children:[s.jsx(Ne,{size:"sm",variant:"outline",onClick:()=>T(null),className:"text-xs font-mono",children:"Close"}),s.jsxs(Ne,{size:"sm",onClick:()=>{F(G.shell_config||"","Shell configuration")},className:"text-xs font-mono gap-1",children:[s.jsx(nl,{className:"h-3 w-3"}),"Copy to Clipboard"]})]})]})})]})}function ON(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:f}=Mt(),[m,g]=w.useState([]),[v,x]=w.useState(!1),[p,b]=w.useState(null),[h,N]=w.useState(0),E=u?.running??!1,A=w.useCallback(async()=>{if(!(!l||!E)){x(!0),N(T=>T+1);try{const K=((await o("/v0/management/integrations/status")).integrations||[]).map(q=>({...q,detected:q.installed??q.detected??!1}));g(K)}catch(T){T instanceof ot||console.error("Failed to fetch integrations:",T)}x(!1)}},[l,o,E]),U=async T=>{b(T);try{await o(`/v0/management/integrations/${T}/configure`,{method:"POST"}),await A(),c(`Configured ${T}`,"success")}catch(K){c(K instanceof Error?K.message:String(K),"error")}b(null)};w.useEffect(()=>{l&&E?A():E||g([])},[l,E,A]);const G=(T,K=35)=>{if(T.length<=K)return T;const q=T.slice(0,15),F=T.slice(-17);return`${q}...${F}`};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-panel)] shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-[var(--bg-elevated)] border-b border-[var(--border-default)]",children:[s.jsxs("div",{className:"relative",children:[s.jsx(yu,{className:`h-4 w-4 text-[var(--accent-primary)] ${v||f?"animate-spin":""}`}),(v||f)&&s.jsx("div",{className:"absolute inset-0 rounded-full border border-[var(--accent-primary)] animate-ping opacity-50"})]}),s.jsx("span",{className:"font-mono text-xs font-bold uppercase tracking-widest text-[var(--text-secondary)]",children:"Ground Control"}),f&&s.jsx(Vt,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsx("div",{className:"flex-1"}),s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:A,disabled:v||!E,className:` + `,children:[s.jsx("div",{className:"shrink-0",children:Y.configured?s.jsx("div",{className:"p-1.5 rounded-full bg-[var(--status-online)]/10 text-[var(--status-online)]",children:s.jsx(al,{className:"h-4 w-4"})}):Y.detected?s.jsx("div",{className:"p-1.5 rounded-full bg-[var(--status-warning)]/10 text-[var(--status-warning)]",children:s.jsx(td,{className:"h-4 w-4"})}):s.jsx("div",{className:"p-1.5 rounded-full bg-[var(--bg-void)] text-[var(--text-muted)]",children:s.jsx(Uu,{className:"h-4 w-4"})})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-mono text-sm font-bold text-[var(--text-primary)]",children:Y.name}),Y.detected&&!Y.configured&&s.jsx("span",{className:"text-[10px] font-mono uppercase px-1.5 py-0.5 rounded bg-[var(--status-warning)]/10 text-[var(--status-warning)] border border-[var(--status-warning)]/20",children:"Needs Config"})]}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] truncate",children:Y.detected?Y.configured?"Fully configured and ready":"Detected but not configured":"Not found on this system"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Y.detected&&Y.shell_config&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{onClick:()=>k(Y),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-all font-mono text-xs uppercase tracking-wider",children:[s.jsx(kp,{className:"h-3.5 w-3.5"}),"Shell"]})}),s.jsx(ba,{children:"View Shell Profile Configuration"})]}),Y.detected&&!Y.configured&&Y.canAutoConfigure&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{onClick:()=>E(Y),disabled:N===Y.id,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border border-[var(--accent-primary)] bg-[var(--accent-primary)]/10 text-[var(--accent-primary)] hover:bg-[var(--accent-primary)]/20 transition-all disabled:opacity-50 font-mono text-xs uppercase tracking-wider",children:[N===Y.id?s.jsx(zt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(P0,{className:"h-3.5 w-3.5"}),"Configure"]})}),s.jsxs(ba,{children:["Auto-configure ",Y.name," for ProxyPilot"]})]}),Y.detected&&Y.configured&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{onClick:()=>L(Y),disabled:A===Y.id,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded border border-[var(--status-error)] bg-[var(--status-error)]/10 text-[var(--status-error)] hover:bg-[var(--status-error)]/20 transition-all disabled:opacity-50 font-mono text-xs uppercase tracking-wider",children:[A===Y.id?s.jsx(zt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(eN,{className:"h-3.5 w-3.5"}),"Reset"]})}),s.jsxs(ba,{children:["Remove ProxyPilot configuration from ",Y.name]})]}),Y.envVars&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsx("button",{onClick:()=>ae(Y.envVars),className:"p-2 rounded border border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-all",children:s.jsx(sl,{className:"h-3.5 w-3.5"})})}),s.jsx(ba,{children:"Copy Environment Variables"})]}),Y.configInstructions&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsx("button",{onClick:()=>{o(Y.configInstructions,"success")},className:"p-2 rounded border border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] transition-all",children:s.jsx(ow,{className:"h-3.5 w-3.5"})})}),s.jsx(ba,{children:"View Setup Instructions"})]})]})]},Y.name))}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[s.jsx("div",{className:"font-mono text-sm text-[var(--text-muted)] uppercase tracking-wider mb-1",children:"Engine Offline"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Start the proxy engine to detect agents"})]})})]}),G&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.jsxs("div",{className:"bg-[var(--bg-panel)] border border-[var(--border-default)] rounded-lg shadow-2xl max-w-2xl w-full mx-4 max-h-[80vh] flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border-subtle)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(kp,{className:"h-4 w-4 text-[var(--accent-primary)]"}),s.jsxs("span",{className:"font-mono text-sm font-bold",children:[G.name," - Shell Configuration"]})]}),s.jsx("button",{onClick:()=>k(null),className:"p-1 rounded hover:bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(ad,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[s.jsx("div",{className:"mb-3",children:s.jsxs("p",{className:"text-xs text-[var(--text-muted)]",children:["Add these lines to your shell profile (",s.jsx("code",{className:"text-[var(--accent-primary)]",children:"~/.bashrc"}),", ",s.jsx("code",{className:"text-[var(--accent-primary)]",children:"~/.zshrc"}),", or ",s.jsx("code",{className:"text-[var(--accent-primary)]",children:"~/.profile"}),"):"]})}),s.jsx("pre",{className:"bg-[var(--bg-void)] border border-[var(--border-subtle)] rounded-lg p-4 text-xs font-mono text-[var(--text-secondary)] overflow-x-auto whitespace-pre-wrap",children:G.shell_config})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-[var(--border-subtle)]",children:[s.jsx(je,{size:"sm",variant:"outline",onClick:()=>k(null),className:"text-xs font-mono",children:"Close"}),s.jsxs(je,{size:"sm",onClick:()=>{F(G.shell_config||"","Shell configuration")},className:"text-xs font-mono gap-1",children:[s.jsx(sl,{className:"h-3 w-3"}),"Copy to Clipboard"]})]})]})})]})}function DN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:d}=Et(),[m,g]=w.useState([]),[v,x]=w.useState(!1),[p,b]=w.useState(null),[h,N]=w.useState(0),_=u?.running??!1,A=w.useCallback(async()=>{if(!(!l||!_)){x(!0),N(k=>k+1);try{const K=((await o("/v0/management/integrations/status")).integrations||[]).map(q=>({...q,detected:q.installed??q.detected??!1}));g(K)}catch(k){k instanceof ot||console.error("Failed to fetch integrations:",k)}x(!1)}},[l,o,_]),U=async k=>{b(k);try{await o(`/v0/management/integrations/${k}/configure`,{method:"POST"}),await A(),c(`Configured ${k}`,"success")}catch(K){c(K instanceof Error?K.message:String(K),"error")}b(null)};w.useEffect(()=>{l&&_?A():_||g([])},[l,_,A]);const G=(k,K=35)=>{if(k.length<=K)return k;const q=k.slice(0,15),F=k.slice(-17);return`${q}...${F}`};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-[var(--border-default)] bg-[var(--bg-panel)] shadow-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-[var(--bg-elevated)] border-b border-[var(--border-default)]",children:[s.jsxs("div",{className:"relative",children:[s.jsx(wu,{className:`h-4 w-4 text-[var(--accent-primary)] ${v||d?"animate-spin":""}`}),(v||d)&&s.jsx("div",{className:"absolute inset-0 rounded-full border border-[var(--accent-primary)] animate-ping opacity-50"})]}),s.jsx("span",{className:"font-mono text-xs font-bold uppercase tracking-widest text-[var(--text-secondary)]",children:"Ground Control"}),d&&s.jsx(zt,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsx("div",{className:"flex-1"}),s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:A,disabled:v||!_,className:` relative flex items-center gap-1.5 px-3 py-1.5 rounded font-mono text-[10px] uppercase tracking-wider font-bold border transition-all duration-150 - ${v?"border-[var(--status-processing)] bg-[var(--status-processing)]/10 text-[var(--status-processing)]":E?"border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] hover:shadow-[0_0_10px_var(--accent-primary)]":"border-[var(--border-subtle)] bg-transparent text-[var(--text-muted)] cursor-not-allowed opacity-50"} + ${v?"border-[var(--status-processing)] bg-[var(--status-processing)]/10 text-[var(--status-processing)]":_?"border-[var(--border-default)] bg-[var(--bg-panel)] text-[var(--text-secondary)] hover:border-[var(--accent-primary)] hover:text-[var(--accent-primary)] hover:shadow-[0_0_10px_var(--accent-primary)]":"border-[var(--border-subtle)] bg-transparent text-[var(--text-muted)] cursor-not-allowed opacity-50"} active:translate-y-0.5 cursor-pointer overflow-hidden - `,children:[v&&s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-[var(--status-processing)]/30 to-transparent",style:{animation:"scan-sweep 1s ease-in-out infinite"}}),s.jsx(yu,{className:`h-3 w-3 relative z-10 ${v?"animate-spin":""}`}),s.jsx("span",{className:"relative z-10",children:v?"Scanning":"Scan"})]})}),s.jsx(ya,{children:"Scan for CLI agent integrations"})]})]}),s.jsxs("div",{className:"p-4 relative",children:[v&&s.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-hidden",style:{background:"linear-gradient(90deg, transparent 0%, var(--accent-primary) 50%, transparent 100%)",opacity:.08,animation:"radar-scan-horizontal 1.5s ease-in-out"}}),E?m.length===0&&!v&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"relative mb-4",children:s.jsx("div",{className:"w-16 h-16 rounded-full border-2 border-dashed border-[var(--border-subtle)] flex items-center justify-center",children:s.jsx(yu,{className:"h-6 w-6 text-[var(--text-muted)]"})})}),s.jsx("div",{className:"font-mono text-sm text-[var(--text-muted)] uppercase tracking-wider mb-1",children:"No Signals Detected"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Click SCAN to search for CLI agents"})]}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"font-mono text-sm text-[var(--text-muted)] uppercase tracking-wider mb-1",children:"⚠️ Engine Offline"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Start the proxy engine to manage integrations"})]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:m.map((T,K)=>s.jsxs("div",{className:` + `,children:[v&&s.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-[var(--status-processing)]/30 to-transparent",style:{animation:"scan-sweep 1s ease-in-out infinite"}}),s.jsx(wu,{className:`h-3 w-3 relative z-10 ${v?"animate-spin":""}`}),s.jsx("span",{className:"relative z-10",children:v?"Scanning":"Scan"})]})}),s.jsx(ba,{children:"Scan for CLI agent integrations"})]})]}),s.jsxs("div",{className:"p-4 relative",children:[v&&s.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-hidden",style:{background:"linear-gradient(90deg, transparent 0%, var(--accent-primary) 50%, transparent 100%)",opacity:.08,animation:"radar-scan-horizontal 1.5s ease-in-out"}}),_?m.length===0&&!v&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"relative mb-4",children:s.jsx("div",{className:"w-16 h-16 rounded-full border-2 border-dashed border-[var(--border-subtle)] flex items-center justify-center",children:s.jsx(wu,{className:"h-6 w-6 text-[var(--text-muted)]"})})}),s.jsx("div",{className:"font-mono text-sm text-[var(--text-muted)] uppercase tracking-wider mb-1",children:"No Signals Detected"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Click SCAN to search for CLI agents"})]}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx("div",{className:"font-mono text-sm text-[var(--text-muted)] uppercase tracking-wider mb-1",children:"⚠️ Engine Offline"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Start the proxy engine to manage integrations"})]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:m.map((k,K)=>s.jsxs("div",{className:` group relative rounded-lg border overflow-hidden transition-all duration-300 - ${T.detected?"border-[var(--status-online)]/50 bg-gradient-to-b from-[var(--bg-elevated)] to-[var(--bg-panel)]":"border-[var(--border-subtle)] bg-[var(--bg-void)]"} + ${k.detected?"border-[var(--status-online)]/50 bg-gradient-to-b from-[var(--bg-elevated)] to-[var(--bg-panel)]":"border-[var(--border-subtle)] bg-[var(--bg-void)]"} hover:border-[var(--accent-primary)] hover:shadow-[0_0_20px_var(--accent-primary)/15] hover:translate-y-[-2px] `,style:{animation:`station-fade-in 0.4s ease-out ${K*.08}s both`},children:[s.jsxs("div",{className:` flex items-center gap-2 px-3 py-2 border-b - ${T.detected?"border-[var(--status-online)]/30 bg-[var(--status-online)]/5":"border-[var(--border-subtle)] bg-[var(--bg-elevated)]"} + ${k.detected?"border-[var(--status-online)]/30 bg-[var(--status-online)]/5":"border-[var(--border-subtle)] bg-[var(--bg-elevated)]"} `,children:[s.jsx("div",{className:"relative",children:s.jsx("div",{className:` w-3 h-3 rounded-full transition-all duration-300 - ${T.detected?"bg-[var(--status-online)] shadow-[0_0_8px_var(--status-online)]":"border-2 border-[var(--text-muted)] bg-transparent"} - `,children:T.detected&&s.jsx("div",{className:"absolute inset-0 rounded-full bg-[var(--status-online)]",style:{animation:"status-glow 2s ease-in-out infinite"}})})}),s.jsx("span",{className:` + ${k.detected?"bg-[var(--status-online)] shadow-[0_0_8px_var(--status-online)]":"border-2 border-[var(--text-muted)] bg-transparent"} + `,children:k.detected&&s.jsx("div",{className:"absolute inset-0 rounded-full bg-[var(--status-online)]",style:{animation:"status-glow 2s ease-in-out infinite"}})})}),s.jsx("span",{className:` font-mono text-xs font-bold uppercase tracking-wider flex-1 - ${T.detected?"text-[var(--text-primary)]":"text-[var(--text-muted)]"} - `,children:T.name||T.id})]}),s.jsxs("div",{className:"p-3 space-y-3",children:[s.jsx("div",{className:` + ${k.detected?"text-[var(--text-primary)]":"text-[var(--text-muted)]"} + `,children:k.name||k.id})]}),s.jsxs("div",{className:"p-3 space-y-3",children:[s.jsx("div",{className:` flex items-center gap-2 font-mono text-xs uppercase tracking-wider - ${T.detected?"text-[var(--status-online)]":"text-[var(--text-muted)]"} - `,children:T.detected?s.jsxs(s.Fragment,{children:[s.jsx(tl,{className:"h-3 w-3"}),s.jsx("span",{children:"Detected"})]}):s.jsxs(s.Fragment,{children:[s.jsx(Uo,{className:"h-3 w-3"}),s.jsx("span",{children:"Not Detected"})]})}),T.detected&&s.jsxs("div",{className:"space-y-1.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[T.binary_path&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-[var(--text-muted)] truncate cursor-help",children:[s.jsx(G0,{className:"h-2.5 w-2.5 shrink-0"}),s.jsx("span",{className:"truncate",children:G(T.binary_path)})]})}),s.jsx(ya,{side:"bottom",className:"max-w-xs",children:s.jsx("div",{className:"font-mono text-xs break-all",children:T.binary_path})})]}),T.config_path&&s.jsxs(xa,{children:[s.jsx(va,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-[var(--text-muted)] truncate cursor-help",children:[s.jsx(Mo,{className:"h-2.5 w-2.5 shrink-0"}),s.jsx("span",{className:"truncate",children:G(T.config_path)})]})}),s.jsx(ya,{side:"bottom",className:"max-w-xs",children:s.jsx("div",{className:"font-mono text-xs break-all",children:T.config_path})})]})]}),!T.detected&&s.jsx("div",{className:"h-[30px]"}),s.jsx("button",{type:"button",onClick:()=>T.detected&&U(T.id),disabled:!T.detected||p===T.id,className:` + ${k.detected?"text-[var(--status-online)]":"text-[var(--text-muted)]"} + `,children:k.detected?s.jsxs(s.Fragment,{children:[s.jsx(al,{className:"h-3 w-3"}),s.jsx("span",{children:"Detected"})]}):s.jsxs(s.Fragment,{children:[s.jsx(Bo,{className:"h-3 w-3"}),s.jsx("span",{children:"Not Detected"})]})}),k.detected&&s.jsxs("div",{className:"space-y-1.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[k.binary_path&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-[var(--text-muted)] truncate cursor-help",children:[s.jsx($0,{className:"h-2.5 w-2.5 shrink-0"}),s.jsx("span",{className:"truncate",children:G(k.binary_path)})]})}),s.jsx(ba,{side:"bottom",className:"max-w-xs",children:s.jsx("div",{className:"font-mono text-xs break-all",children:k.binary_path})})]}),k.config_path&&s.jsxs(va,{children:[s.jsx(ya,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-[var(--text-muted)] truncate cursor-help",children:[s.jsx(zo,{className:"h-2.5 w-2.5 shrink-0"}),s.jsx("span",{className:"truncate",children:G(k.config_path)})]})}),s.jsx(ba,{side:"bottom",className:"max-w-xs",children:s.jsx("div",{className:"font-mono text-xs break-all",children:k.config_path})})]})]}),!k.detected&&s.jsx("div",{className:"h-[30px]"}),s.jsx("button",{type:"button",onClick:()=>k.detected&&U(k.id),disabled:!k.detected||p===k.id,className:` w-full flex items-center justify-center gap-2 px-3 py-2 rounded font-mono text-xs font-bold uppercase tracking-wider border transition-all duration-150 - ${p===T.id?"border-[var(--status-processing)] bg-[var(--status-processing)]/10 text-[var(--status-processing)]":T.detected?"border-[var(--accent-primary)] bg-transparent text-[var(--accent-primary)] hover:bg-[var(--accent-primary)] hover:text-[var(--bg-panel)] hover:shadow-[0_0_15px_var(--accent-primary)]":"border-[var(--border-subtle)] bg-transparent text-[var(--text-muted)] cursor-not-allowed opacity-50"} + ${p===k.id?"border-[var(--status-processing)] bg-[var(--status-processing)]/10 text-[var(--status-processing)]":k.detected?"border-[var(--accent-primary)] bg-transparent text-[var(--accent-primary)] hover:bg-[var(--accent-primary)] hover:text-[var(--bg-panel)] hover:shadow-[0_0_15px_var(--accent-primary)]":"border-[var(--border-subtle)] bg-transparent text-[var(--text-muted)] cursor-not-allowed opacity-50"} active:translate-y-0.5 cursor-pointer disabled:active:translate-y-0 - `,children:p===T.id?s.jsxs(s.Fragment,{children:[s.jsx(Mo,{className:"h-3 w-3 animate-spin"}),s.jsx("span",{children:"Configuring"})]}):T.detected?s.jsxs(s.Fragment,{children:[s.jsx(Mo,{className:"h-3 w-3"}),s.jsx("span",{children:"Configure"})]}):s.jsxs(s.Fragment,{children:[s.jsx(is,{className:"h-3 w-3"}),s.jsx("span",{children:"Install"})]})})]}),p===T.id&&s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(180deg, transparent 0%, var(--status-processing) 50%, transparent 100%)",opacity:.1,animation:"config-scan 1s ease-in-out infinite"}})]},T.id))},h)]}),m.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[var(--bg-void)] border-t border-[var(--border-subtle)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-[var(--status-online)]"}),s.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:[m.filter(T=>T.detected).length," Online"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full border border-[var(--text-muted)]"}),s.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:[m.filter(T=>!T.detected).length," Offline"]})]})]})]}),s.jsx(MN,{}),s.jsx("style",{children:` + `,children:p===k.id?s.jsxs(s.Fragment,{children:[s.jsx(zo,{className:"h-3 w-3 animate-spin"}),s.jsx("span",{children:"Configuring"})]}):k.detected?s.jsxs(s.Fragment,{children:[s.jsx(zo,{className:"h-3 w-3"}),s.jsx("span",{children:"Configure"})]}):s.jsxs(s.Fragment,{children:[s.jsx(is,{className:"h-3 w-3"}),s.jsx("span",{children:"Install"})]})})]}),p===k.id&&s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"linear-gradient(180deg, transparent 0%, var(--status-processing) 50%, transparent 100%)",opacity:.1,animation:"config-scan 1s ease-in-out infinite"}})]},k.id))},h)]}),m.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[var(--bg-void)] border-t border-[var(--border-subtle)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-[var(--status-online)]"}),s.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:[m.filter(k=>k.detected).length," Online"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-2 h-2 rounded-full border border-[var(--text-muted)]"}),s.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:[m.filter(k=>!k.detected).length," Offline"]})]})]})]}),s.jsx(RN,{}),s.jsx("style",{children:` @keyframes station-fade-in { 0% { opacity: 0; @@ -144,10 +144,10 @@ Error generating stack: `+n.message+` transform: translateY(100%); } } - `})]})}function jt({className:l,...o}){return s.jsx("div",{"data-slot":"card",className:je("flex flex-col gap-6 rounded-md py-6","bg-[var(--bg-panel)] border border-[var(--border-subtle)]","text-card-foreground","shadow-[inset_0_1px_0_0_var(--border-subtle),inset_0_-1px_0_0_oklch(0_0_0/0.2),0_2px_0_0_oklch(0_0_0/0.1)]",l),...o})}function At({className:l,...o}){return s.jsx("div",{"data-slot":"card-header",className:je("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6","has-data-[slot=card-action]:grid-cols-[1fr_auto]","border-b border-[var(--border-subtle)] pb-4 mb-2",l),...o})}function da({className:l,...o}){return s.jsx("div",{"data-slot":"card-title",className:je("font-display text-lg font-bold leading-tight tracking-tight",l),...o})}function rs({className:l,...o}){return s.jsx("div",{"data-slot":"card-description",className:je("text-muted-foreground text-xs uppercase tracking-wider",l),...o})}function St({className:l,...o}){return s.jsx("div",{"data-slot":"card-content",className:je("px-6",l),...o})}function zN(l,o){const c=[/^\[?(\d{4}-\d{2}-\d{2}\s+)?(\d{2}:\d{2}:\d{2}(?:\.\d{3})?)\]?\s*\[?(ERROR|WARN(?:ING)?|INFO|DEBUG)\]?:?\s*(.*)$/i,/^\[?(ERROR|WARN(?:ING)?|INFO|DEBUG)\]?:?\s*(.*)$/i,/^(\d{2}:\d{2}:\d{2}(?:\.\d{3})?)\s+(ERROR|WARN(?:ING)?|INFO|DEBUG)\s+(.*)$/i],f=new Date().toTimeString().slice(0,12).replace(",",".");for(const m of c){const g=l.match(m);if(g){if(m===c[0]){const v=g[2]||f,x=bu(g[3]),p=g[4]||"";return{id:`log-${o}`,timestamp:kp(v),level:x,message:p,raw:l}}else if(m===c[1]){const v=bu(g[1]),x=g[2]||"";return{id:`log-${o}`,timestamp:f,level:v,message:x,raw:l}}else if(m===c[2]){const v=g[1],x=bu(g[2]),p=g[3]||"";return{id:`log-${o}`,timestamp:kp(v),level:x,message:p,raw:l}}}}return{id:`log-${o}`,timestamp:f,level:"INFO",message:l,raw:l}}function bu(l){const o=l.toUpperCase();return o==="WARNING"?"WARN":["ERROR","WARN","INFO","DEBUG"].includes(o)?o:"INFO"}function kp(l){if(l.includes(".")){const[o,c]=l.split(".");return`${o}.${c.padEnd(3,"0").slice(0,3)}`}return`${l}.000`}function RN(l){switch(l){case"ERROR":return"border-l-[var(--status-offline)]";case"WARN":return"border-l-[var(--status-warning)]";case"INFO":return"border-l-[var(--accent-glow)]";case"DEBUG":return"border-l-[var(--text-muted)]";default:return"border-l-[var(--text-muted)]"}}function Ap(l){switch(l){case"ERROR":return"bg-[var(--status-offline)]/20 text-[var(--status-offline)]";case"WARN":return"bg-[var(--status-warning)]/20 text-[var(--status-warning)]";case"INFO":return"bg-[var(--accent-glow)]/20 text-[var(--accent-glow)]";case"DEBUG":return"bg-[var(--text-muted)]/20 text-[var(--text-muted)]";default:return"bg-[var(--text-muted)]/20 text-[var(--text-muted)]"}}function DN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Mt(),[f,m]=w.useState(""),[g,v]=w.useState(""),[x,p]=w.useState("stdout"),[b,h]=w.useState("ALL"),[N,E]=w.useState(!1),[A,U]=w.useState(!0),G=w.useRef(null),T=w.useRef(null),K=c?.running??!1,q=async()=>{try{const O=await l("/v0/management/proxypilot/diagnostics?lines=120");m(O.text||"")}catch(O){O instanceof ot||o(O instanceof Error?O.message:String(O),"error")}},F=async()=>{if(!f){o("No diagnostics to copy","error");return}try{await navigator.clipboard.writeText(f),o("Copied diagnostics to clipboard","success")}catch(O){o(O instanceof Error?O.message:String(O),"error")}},ae=w.useCallback(async O=>{try{p(O);const ne=await l(`/v0/management/proxypilot/logs/tail?file=${O}&lines=200`);v((ne.lines||[]).join(` -`))}catch(ne){ne instanceof ot||o(ne instanceof Error?ne.message:String(ne),"error")}},[l,o]),te=async()=>{if(!g){o("No logs to copy","error");return}try{await navigator.clipboard.writeText(g),o("Copied logs to clipboard","success")}catch(O){o(O instanceof Error?O.message:String(O),"error")}},_=()=>{v(""),E(!1),T.current&&(clearInterval(T.current),T.current=null)},L=async()=>{try{const ne=((await l(`/v0/management/proxypilot/logs/tail?file=${x}&lines=2000`)).lines||[]).join(` -`);if(!ne){o("No logs available to download","error");return}const oe=new Blob([ne],{type:"text/plain"}),k=URL.createObjectURL(oe),V=document.createElement("a");V.href=k,V.download=`proxypilot-${x}-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.log`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(k),o("Logs download started","success")}catch(O){o(O instanceof Error?O.message:String(O),"error")}},Y=()=>{N?(E(!1),T.current&&(clearInterval(T.current),T.current=null)):(E(!0),ae(x),T.current=setInterval(()=>{ae(x)},2e3))};w.useEffect(()=>{A&&G.current&&(G.current.scrollTop=G.current.scrollHeight)},[g,A]),w.useEffect(()=>()=>{T.current&&clearInterval(T.current)},[]);const z=g?g.split(` -`).filter(Boolean).map((O,ne)=>zN(O,ne)):[],se=b==="ALL"?z:z.filter(O=>O.level===b),ie=["ALL","ERROR","WARN","INFO","DEBUG"];return s.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsx(At,{className:"pb-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-10 w-10 rounded-xl bg-blue-500/10 flex items-center justify-center",children:s.jsx(V0,{className:"h-5 w-5 text-blue-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Diagnostics"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Engine snapshot"})]})]}),u&&s.jsx(Vt,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),s.jsxs(St,{className:"space-y-3",children:[!K&&s.jsx("div",{className:"py-4 text-center text-muted-foreground",children:s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"})}),K&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(Ne,{size:"sm",variant:"outline",onClick:q,children:[s.jsx(is,{className:"h-4 w-4 mr-1"}),"Load"]}),s.jsxs(Ne,{size:"sm",variant:"outline",onClick:F,disabled:!f,className:"gap-2",children:[s.jsx(nl,{className:"h-4 w-4"}),"Copy"]})]}),s.jsx("pre",{className:"max-h-48 overflow-auto rounded-md border border-border/50 bg-muted/30 p-2 text-xs font-mono",children:f||"No diagnostics loaded."})]})]})]}),s.jsxs(jt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl overflow-hidden",children:[s.jsxs(At,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:[s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ho,{className:`h-3 w-3 fill-current ${N&&K?"text-[var(--status-offline)] animate-pulse":"text-[var(--text-muted)]"}`}),s.jsx("span",{className:"font-mono text-sm font-semibold tracking-wider text-[var(--text-primary)]",children:"FLIGHT RECORDER"})]}),u&&s.jsx(Vt,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsxs("button",{onClick:Y,disabled:!K,className:`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono transition-all ${N&&K?"bg-[var(--status-offline)]/20 text-[var(--status-offline)] animate-pulse":"bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-secondary)]"} ${K?"":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N&&K?"bg-[var(--status-offline)]":"bg-[var(--text-muted)]"}`}),"LIVE"]})]}),s.jsx("div",{className:"flex items-center gap-1",children:ie.map(O=>s.jsx("button",{onClick:()=>h(O),className:`px-2 py-0.5 rounded text-xs font-mono uppercase transition-all ${b===O?O==="ALL"?"bg-[var(--accent-primary)] text-[var(--primary-foreground)]":Ap(O).replace("/20","/40"):"bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:O==="ALL"?"ALL":O.slice(0,3)},O))})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[s.jsx(Ne,{size:"sm",variant:x==="stdout"?"default":"outline",onClick:()=>ae("stdout"),className:"text-xs h-7 font-mono",children:"STDOUT"}),s.jsx(Ne,{size:"sm",variant:x==="stderr"?"default":"outline",onClick:()=>ae("stderr"),className:"text-xs h-7 font-mono",children:"STDERR"}),s.jsx("div",{className:"flex-1"}),s.jsx(Ne,{size:"sm",variant:"ghost",onClick:te,disabled:!g,className:"text-xs h-7 gap-1 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(nl,{className:"h-3 w-3"})}),s.jsx(Ne,{size:"sm",variant:"ghost",onClick:L,disabled:!g,className:"text-xs h-7 gap-1 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(is,{className:"h-3 w-3"})}),s.jsx(Ne,{size:"sm",variant:"ghost",onClick:_,disabled:!g,className:"text-xs h-7 gap-1 text-[var(--text-muted)] hover:text-[var(--status-offline)]",children:s.jsx(Jo,{className:"h-3 w-3"})})]})]}),s.jsxs(St,{className:"p-0 relative",children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-hidden","aria-hidden":"true",children:s.jsx("div",{className:"absolute left-0 right-0 h-8 bg-gradient-to-b from-[var(--accent-glow)]/[0.07] to-transparent animate-scanline",style:{top:"-10%"}})}),s.jsx("div",{ref:G,className:"max-h-64 overflow-auto bg-[var(--bg-void)] font-mono text-xs",onScroll:O=>{const ne=O.target,oe=ne.scrollHeight-ne.scrollTop<=ne.clientHeight+50;U(oe)},children:K?se.length===0?s.jsx("div",{className:"p-4 text-center text-[var(--text-muted)]",children:g?"No matching log entries.":"No logs loaded. Click STDOUT or STDERR to load logs."}):s.jsx("div",{className:"divide-y divide-[var(--border-subtle)]/30",children:se.map(O=>s.jsxs("div",{className:`flex items-start gap-2 px-3 py-1.5 border-l-2 hover:bg-[var(--bg-panel)]/50 transition-colors ${RN(O.level)}`,children:[s.jsx("span",{className:"text-[var(--text-muted)] shrink-0 tabular-nums",children:O.timestamp}),s.jsx("span",{className:"text-[var(--border-default)]",children:"|"}),s.jsx("span",{className:`shrink-0 px-1.5 py-0 rounded text-[10px] font-semibold uppercase ${Ap(O.level)}`,children:O.level.padEnd(5)}),s.jsx("span",{className:"text-[var(--border-default)]",children:"|"}),s.jsx("span",{className:"text-[var(--text-primary)] break-all",children:O.message})]},O.id))}):s.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-[10px] mt-1",children:"Start the proxy engine to view logs"})]})}),!A&&se.length>0&&s.jsx("button",{onClick:()=>{U(!0),G.current&&(G.current.scrollTop=G.current.scrollHeight)},className:"absolute bottom-2 right-4 px-2 py-1 rounded bg-[var(--accent-primary)] text-[var(--primary-foreground)] text-xs font-mono shadow-lg hover:opacity-90 transition-opacity z-20",children:"SCROLL TO BOTTOM"})]}),s.jsxs("div",{className:"px-3 py-1.5 bg-[var(--bg-panel)] border-t border-[var(--border-subtle)] flex items-center justify-between text-[10px] font-mono text-[var(--text-muted)]",children:[s.jsxs("span",{children:[se.length," entries ",b!=="ALL"&&`(filtered: ${b})`]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:A?"text-[var(--status-online)]":"",children:A?"AUTO-SCROLL ON":"AUTO-SCROLL OFF"}),s.jsx("span",{children:"|"}),s.jsx("span",{children:x.toUpperCase()})]})]})]})]})}const Mp=["anthropic","google","openai","azure","bedrock","vertex","other"];function Op(l){const o=l.toLowerCase();return o.includes("anthropic")?"oklch(0.60 0.15 35)":o.includes("google")||o.includes("vertex")?"oklch(0.55 0.18 250)":o.includes("openai")||o.includes("azure")?"oklch(0.55 0.12 145)":o.includes("bedrock")||o.includes("aws")?"oklch(0.58 0.14 50)":"oklch(0.50 0.08 280)"}function zp(l){const o=l.toLowerCase();return o.includes("anthropic")?"oklch(0.60 0.15 35 / 0.15)":o.includes("google")||o.includes("vertex")?"oklch(0.55 0.18 250 / 0.15)":o.includes("openai")||o.includes("azure")?"oklch(0.55 0.12 145 / 0.15)":o.includes("bedrock")||o.includes("aws")?"oklch(0.58 0.14 50 / 0.15)":"oklch(0.50 0.08 280 / 0.15)"}function LN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:f}=Mt(),[m,g]=w.useState([]),[v,x]=w.useState(!1),[p,b]=w.useState({from:"",to:"",provider:""}),[h,N]=w.useState(null),[E,A]=w.useState({from:"",to:"",provider:""}),[U,G]=w.useState(""),[T,K]=w.useState(null),[q,F]=w.useState(null),[ae,te]=w.useState(null),_=u?.running??!1,L=async()=>{try{const O=await o("/v0/management/model-mappings");g(O.mappings||[])}catch(O){O instanceof ot||console.error("Failed to fetch model mappings:",O)}},Y=async()=>{if(!p.from.trim()||!p.to.trim()){c('Both "from" and "to" fields are required',"error");return}try{await o("/v0/management/model-mappings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)}),b({from:"",to:"",provider:""}),x(!1),await L(),te(m.length),setTimeout(()=>te(null),500),c("Route added to flight plan","success")}catch(O){c(O instanceof Error?O.message:String(O),"error")}},z=async(O,ne)=>{try{await o(`/v0/management/model-mappings/${O}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ne)}),N(null),await L(),c("Route updated","success")}catch(oe){c(oe instanceof Error?oe.message:String(oe),"error")}},se=async O=>{F(O);try{await o(`/v0/management/model-mappings/${O}`,{method:"DELETE"}),setTimeout(async()=>{await L(),F(null),c("Route removed","success")},300)}catch(ne){F(null),c(ne instanceof Error?ne.message:String(ne),"error")}},ie=async()=>{if(!U.trim()){K({matched:!1});return}try{const O=await o(`/v0/management/model-mappings/test?model=${encodeURIComponent(U.trim())}`);K({model:O.model||O.to||U,provider:O.provider,matched:O.model!==U||!!O.provider})}catch{K({matched:!1})}};return w.useEffect(()=>{l&&_?L():_||g([])},[l,_]),l?s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-border/50 bg-gradient-to-r from-orange-500/5 to-transparent",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:`h-3 w-3 rounded-full ${_?"bg-orange-500 animate-pulse":"bg-muted"}`}),_&&s.jsx("div",{className:"absolute inset-0 h-3 w-3 rounded-full bg-orange-500/50 animate-ping"})]}),s.jsx("h2",{className:"text-base font-semibold tracking-wide uppercase text-foreground/90",children:"Flight Plan"}),f&&s.jsx(Vt,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),s.jsxs(Ne,{size:"sm",variant:"outline",disabled:!_,onClick:()=>x(!v),className:"gap-1.5 text-xs border-orange-500/30 hover:border-orange-500/50 hover:bg-orange-500/10",children:[s.jsx(ww,{className:"h-3.5 w-3.5"}),"Add Route"]})]})}),s.jsxs(St,{className:"p-4 space-y-3",children:[!_&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[s.jsx("p",{className:"text-sm uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-xs mt-1",children:"Start the proxy engine to manage model mappings"})]}),_&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-out ${v?"max-h-48 opacity-100":"max-h-0 opacity-0"}`,children:s.jsxs("div",{className:"p-4 rounded-lg bg-orange-500/5 border border-orange-500/20 space-y-3 mb-3",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"From Model"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-orange-500/30 focus:border-orange-500/50 transition-all",placeholder:"gpt-4",value:p.from,onChange:O=>b({...p,from:O.target.value})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"To Model"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-orange-500/30 focus:border-orange-500/50 transition-all",placeholder:"claude-3-opus",value:p.to,onChange:O=>b({...p,to:O.target.value})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Provider"}),s.jsxs("div",{className:"relative",children:[s.jsxs("select",{className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-orange-500/30 focus:border-orange-500/50 transition-all",value:p.provider,onChange:O=>b({...p,provider:O.target.value}),children:[s.jsx("option",{value:"",children:"Select provider..."}),Mp.map(O=>s.jsx("option",{value:O,children:O.charAt(0).toUpperCase()+O.slice(1)},O))]}),s.jsx(al,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Ne,{size:"sm",variant:"ghost",onClick:()=>{x(!1),b({from:"",to:"",provider:""})},className:"text-xs",children:"Cancel"}),s.jsx(Ne,{size:"sm",onClick:()=>Y().catch(O=>c(String(O),"error")),className:"text-xs bg-orange-500 hover:bg-orange-600 text-white",children:"Save Route"})]})]})}),s.jsxs("div",{className:"space-y-2",children:[m.length===0&&!v&&!f&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[s.jsx("div",{className:"text-3xl mb-2",children:"---"}),s.jsx("p",{className:"text-sm",children:"No routes configured"}),s.jsx("p",{className:"text-xs mt-1",children:"Add a route to start mapping models"})]}),f&&m.length===0&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[s.jsx(Vt,{className:"h-8 w-8 animate-spin mx-auto mb-2 opacity-20"}),s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono opacity-50",children:"Loading Flight Plan..."})]}),m.map((O,ne)=>s.jsx("div",{className:`group relative rounded-lg border transition-all duration-300 ${q===ne?"opacity-0 scale-95 max-h-0 overflow-hidden border-transparent":ae===ne?"opacity-0 animate-fade-in border-border/50 bg-card/80 hover:bg-card hover:border-border":"border-border/50 bg-card/80 hover:bg-card hover:border-border"}`,style:{animation:ae===ne?"fadeIn 0.3s ease-out forwards":void 0},children:h===ne?s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"From"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",value:E.from,onChange:oe=>A(k=>({...k,from:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"To"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",value:E.to,onChange:oe=>A(k=>({...k,to:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Provider"}),s.jsxs("div",{className:"relative",children:[s.jsxs("select",{className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",value:E.provider,onChange:oe=>A(k=>({...k,provider:oe.target.value})),children:[s.jsx("option",{value:"",children:"None"}),Mp.map(oe=>s.jsx("option",{value:oe,children:oe.charAt(0).toUpperCase()+oe.slice(1)},oe))]}),s.jsx(al,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:()=>N(null),className:"h-8 px-3 text-xs",children:[s.jsx(ed,{className:"h-3.5 w-3.5 mr-1"}),"Cancel"]}),s.jsxs(Ne,{size:"sm",onClick:()=>z(ne,E).catch(oe=>c(String(oe),"error")),className:"h-8 px-3 text-xs bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(tl,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[s.jsx("div",{className:"flex-shrink-0 min-w-[100px]",children:s.jsx("code",{className:"text-sm font-mono font-medium text-foreground/90",children:O.from})}),s.jsxs("div",{className:"flex-shrink-0 flex items-center gap-0.5 text-orange-500/70 group-hover:text-orange-500 transition-colors",children:[s.jsx("span",{className:"inline-block w-8 h-[2px] bg-current rounded-full relative overflow-hidden",children:s.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-orange-300 to-transparent opacity-0 group-hover:opacity-100 group-hover:animate-flow"})}),s.jsx("span",{className:"inline-block w-8 h-[2px] bg-current rounded-full relative overflow-hidden",children:s.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-orange-300 to-transparent opacity-0 group-hover:opacity-100 group-hover:animate-flow animation-delay-100"})}),s.jsx("svg",{className:"h-4 w-4 -ml-0.5 transition-transform group-hover:translate-x-0.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})]}),s.jsx("div",{className:"flex-1 min-w-[100px]",children:s.jsx("code",{className:"text-sm font-mono font-medium text-orange-400",children:O.to})}),O.provider&&s.jsx("div",{className:"flex-shrink-0 px-2.5 py-1 rounded text-xs font-semibold uppercase tracking-wider",style:{color:Op(O.provider),backgroundColor:zp(O.provider)},children:O.provider}),s.jsxs("div",{className:"flex-shrink-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(Ne,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted",onClick:()=>{N(ne),A({from:O.from||"",to:O.to||"",provider:O.provider||""})},children:s.jsx(gw,{className:"h-3.5 w-3.5"})}),s.jsx(Ne,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 hover:bg-destructive/10 text-destructive",onClick:()=>se(ne).catch(oe=>c(String(oe),"error")),children:s.jsx(Jo,{className:"h-3.5 w-3.5"})})]})]})},ne))]}),s.jsx("div",{className:"mt-4 pt-4 border-t border-border/50",children:s.jsx("div",{className:"rounded-lg bg-muted/30 border border-border/50 p-4",children:s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[200px]",children:[s.jsx(Dw,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),s.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Test Route:"}),s.jsx("input",{type:"text",className:"flex-1 min-w-[120px] rounded-md border border-border bg-background/80 px-3 py-1.5 text-sm font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",placeholder:"Enter model name...",value:U,onChange:O=>{G(O.target.value),O.target.value.trim()||K(null)},onKeyDown:O=>{O.key==="Enter"&&ie().catch(ne=>c(String(ne),"error"))}}),s.jsx(Ne,{size:"sm",variant:"outline",onClick:()=>ie().catch(O=>c(String(O),"error")),className:"text-xs",children:"Lookup"})]}),T&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-orange-500",children:"---"}),T.matched?s.jsxs(s.Fragment,{children:[s.jsx("code",{className:"text-sm font-mono font-medium text-orange-400",children:T.model}),T.provider&&s.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-semibold uppercase",style:{color:Op(T.provider),backgroundColor:zp(T.provider)},children:T.provider})]}):s.jsx("span",{className:"text-sm text-muted-foreground italic",children:"No match found"})]})]})})})]})]}),s.jsx("style",{children:` + `})]})}function dt({className:l,...o}){return s.jsx("div",{"data-slot":"card",className:Ne("flex flex-col gap-6 rounded-md py-6","bg-[var(--bg-panel)] border border-[var(--border-subtle)]","text-card-foreground","shadow-[inset_0_1px_0_0_var(--border-subtle),inset_0_-1px_0_0_oklch(0_0_0/0.2),0_2px_0_0_oklch(0_0_0/0.1)]",l),...o})}function gt({className:l,...o}){return s.jsx("div",{"data-slot":"card-header",className:Ne("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6","has-data-[slot=card-action]:grid-cols-[1fr_auto]","border-b border-[var(--border-subtle)] pb-4 mb-2",l),...o})}function Ot({className:l,...o}){return s.jsx("div",{"data-slot":"card-title",className:Ne("font-display text-lg font-bold leading-tight tracking-tight",l),...o})}function Oa({className:l,...o}){return s.jsx("div",{"data-slot":"card-description",className:Ne("text-muted-foreground text-xs uppercase tracking-wider",l),...o})}function ft({className:l,...o}){return s.jsx("div",{"data-slot":"card-content",className:Ne("px-6",l),...o})}function LN(l,o){const c=[/^\[?(\d{4}-\d{2}-\d{2}\s+)?(\d{2}:\d{2}:\d{2}(?:\.\d{3})?)\]?\s*\[?(ERROR|WARN(?:ING)?|INFO|DEBUG)\]?:?\s*(.*)$/i,/^\[?(ERROR|WARN(?:ING)?|INFO|DEBUG)\]?:?\s*(.*)$/i,/^(\d{2}:\d{2}:\d{2}(?:\.\d{3})?)\s+(ERROR|WARN(?:ING)?|INFO|DEBUG)\s+(.*)$/i],d=new Date().toTimeString().slice(0,12).replace(",",".");for(const m of c){const g=l.match(m);if(g){if(m===c[0]){const v=g[2]||d,x=ju(g[3]),p=g[4]||"";return{id:`log-${o}`,timestamp:Mp(v),level:x,message:p,raw:l}}else if(m===c[1]){const v=ju(g[1]),x=g[2]||"";return{id:`log-${o}`,timestamp:d,level:v,message:x,raw:l}}else if(m===c[2]){const v=g[1],x=ju(g[2]),p=g[3]||"";return{id:`log-${o}`,timestamp:Mp(v),level:x,message:p,raw:l}}}}return{id:`log-${o}`,timestamp:d,level:"INFO",message:l,raw:l}}function ju(l){const o=l.toUpperCase();return o==="WARNING"?"WARN":["ERROR","WARN","INFO","DEBUG"].includes(o)?o:"INFO"}function Mp(l){if(l.includes(".")){const[o,c]=l.split(".");return`${o}.${c.padEnd(3,"0").slice(0,3)}`}return`${l}.000`}function UN(l){switch(l){case"ERROR":return"border-l-[var(--status-offline)]";case"WARN":return"border-l-[var(--status-warning)]";case"INFO":return"border-l-[var(--accent-glow)]";case"DEBUG":return"border-l-[var(--text-muted)]";default:return"border-l-[var(--text-muted)]"}}function Op(l){switch(l){case"ERROR":return"bg-[var(--status-offline)]/20 text-[var(--status-offline)]";case"WARN":return"bg-[var(--status-warning)]/20 text-[var(--status-warning)]";case"INFO":return"bg-[var(--accent-glow)]/20 text-[var(--accent-glow)]";case"DEBUG":return"bg-[var(--text-muted)]/20 text-[var(--text-muted)]";default:return"bg-[var(--text-muted)]/20 text-[var(--text-muted)]"}}function HN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Et(),[d,m]=w.useState(""),[g,v]=w.useState(""),[x,p]=w.useState("stdout"),[b,h]=w.useState("ALL"),[N,_]=w.useState(!1),[A,U]=w.useState(!0),G=w.useRef(null),k=w.useRef(null),K=c?.running??!1,q=async()=>{try{const O=await l("/v0/management/proxypilot/diagnostics?lines=120");m(O.text||"")}catch(O){O instanceof ot||o(O instanceof Error?O.message:String(O),"error")}},F=async()=>{if(!d){o("No diagnostics to copy","error");return}try{await navigator.clipboard.writeText(d),o("Copied diagnostics to clipboard","success")}catch(O){o(O instanceof Error?O.message:String(O),"error")}},ae=w.useCallback(async O=>{try{p(O);const ne=await l(`/v0/management/proxypilot/logs/tail?file=${O}&lines=200`);v((ne.lines||[]).join(` +`))}catch(ne){ne instanceof ot||o(ne instanceof Error?ne.message:String(ne),"error")}},[l,o]),te=async()=>{if(!g){o("No logs to copy","error");return}try{await navigator.clipboard.writeText(g),o("Copied logs to clipboard","success")}catch(O){o(O instanceof Error?O.message:String(O),"error")}},E=()=>{v(""),_(!1),k.current&&(clearInterval(k.current),k.current=null)},L=async()=>{try{const ne=((await l(`/v0/management/proxypilot/logs/tail?file=${x}&lines=2000`)).lines||[]).join(` +`);if(!ne){o("No logs available to download","error");return}const oe=new Blob([ne],{type:"text/plain"}),T=URL.createObjectURL(oe),V=document.createElement("a");V.href=T,V.download=`proxypilot-${x}-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.log`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(T),o("Logs download started","success")}catch(O){o(O instanceof Error?O.message:String(O),"error")}},Y=()=>{N?(_(!1),k.current&&(clearInterval(k.current),k.current=null)):(_(!0),ae(x),k.current=setInterval(()=>{ae(x)},2e3))};w.useEffect(()=>{A&&G.current&&(G.current.scrollTop=G.current.scrollHeight)},[g,A]),w.useEffect(()=>()=>{k.current&&clearInterval(k.current)},[]);const z=g?g.split(` +`).filter(Boolean).map((O,ne)=>LN(O,ne)):[],se=b==="ALL"?z:z.filter(O=>O.level===b),ie=["ALL","ERROR","WARN","INFO","DEBUG"];return s.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsx(gt,{className:"pb-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-10 w-10 rounded-xl bg-blue-500/10 flex items-center justify-center",children:s.jsx(Q0,{className:"h-5 w-5 text-blue-500"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold",children:"Diagnostics"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Engine snapshot"})]})]}),u&&s.jsx(zt,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),s.jsxs(ft,{className:"space-y-3",children:[!K&&s.jsx("div",{className:"py-4 text-center text-muted-foreground",children:s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"})}),K&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(je,{size:"sm",variant:"outline",onClick:q,children:[s.jsx(is,{className:"h-4 w-4 mr-1"}),"Load"]}),s.jsxs(je,{size:"sm",variant:"outline",onClick:F,disabled:!d,className:"gap-2",children:[s.jsx(sl,{className:"h-4 w-4"}),"Copy"]})]}),s.jsx("pre",{className:"max-h-48 overflow-auto rounded-md border border-border/50 bg-muted/30 p-2 text-xs font-mono",children:d||"No diagnostics loaded."})]})]})]}),s.jsxs(dt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl overflow-hidden",children:[s.jsxs(gt,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:[s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qo,{className:`h-3 w-3 fill-current ${N&&K?"text-[var(--status-offline)] animate-pulse":"text-[var(--text-muted)]"}`}),s.jsx("span",{className:"font-mono text-sm font-semibold tracking-wider text-[var(--text-primary)]",children:"FLIGHT RECORDER"})]}),u&&s.jsx(zt,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsxs("button",{onClick:Y,disabled:!K,className:`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono transition-all ${N&&K?"bg-[var(--status-offline)]/20 text-[var(--status-offline)] animate-pulse":"bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-secondary)]"} ${K?"":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${N&&K?"bg-[var(--status-offline)]":"bg-[var(--text-muted)]"}`}),"LIVE"]})]}),s.jsx("div",{className:"flex items-center gap-1",children:ie.map(O=>s.jsx("button",{onClick:()=>h(O),className:`px-2 py-0.5 rounded text-xs font-mono uppercase transition-all ${b===O?O==="ALL"?"bg-[var(--accent-primary)] text-[var(--primary-foreground)]":Op(O).replace("/20","/40"):"bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:O==="ALL"?"ALL":O.slice(0,3)},O))})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[s.jsx(je,{size:"sm",variant:x==="stdout"?"default":"outline",onClick:()=>ae("stdout"),className:"text-xs h-7 font-mono",children:"STDOUT"}),s.jsx(je,{size:"sm",variant:x==="stderr"?"default":"outline",onClick:()=>ae("stderr"),className:"text-xs h-7 font-mono",children:"STDERR"}),s.jsx("div",{className:"flex-1"}),s.jsx(je,{size:"sm",variant:"ghost",onClick:te,disabled:!g,className:"text-xs h-7 gap-1 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(sl,{className:"h-3 w-3"})}),s.jsx(je,{size:"sm",variant:"ghost",onClick:L,disabled:!g,className:"text-xs h-7 gap-1 text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(is,{className:"h-3 w-3"})}),s.jsx(je,{size:"sm",variant:"ghost",onClick:E,disabled:!g,className:"text-xs h-7 gap-1 text-[var(--text-muted)] hover:text-[var(--status-offline)]",children:s.jsx(Wo,{className:"h-3 w-3"})})]})]}),s.jsxs(ft,{className:"p-0 relative",children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-hidden","aria-hidden":"true",children:s.jsx("div",{className:"absolute left-0 right-0 h-8 bg-gradient-to-b from-[var(--accent-glow)]/[0.07] to-transparent animate-scanline",style:{top:"-10%"}})}),s.jsx("div",{ref:G,className:"max-h-64 overflow-auto bg-[var(--bg-void)] font-mono text-xs",onScroll:O=>{const ne=O.target,oe=ne.scrollHeight-ne.scrollTop<=ne.clientHeight+50;U(oe)},children:K?se.length===0?s.jsx("div",{className:"p-4 text-center text-[var(--text-muted)]",children:g?"No matching log entries.":"No logs loaded. Click STDOUT or STDERR to load logs."}):s.jsx("div",{className:"divide-y divide-[var(--border-subtle)]/30",children:se.map(O=>s.jsxs("div",{className:`flex items-start gap-2 px-3 py-1.5 border-l-2 hover:bg-[var(--bg-panel)]/50 transition-colors ${UN(O.level)}`,children:[s.jsx("span",{className:"text-[var(--text-muted)] shrink-0 tabular-nums",children:O.timestamp}),s.jsx("span",{className:"text-[var(--border-default)]",children:"|"}),s.jsx("span",{className:`shrink-0 px-1.5 py-0 rounded text-[10px] font-semibold uppercase ${Op(O.level)}`,children:O.level.padEnd(5)}),s.jsx("span",{className:"text-[var(--border-default)]",children:"|"}),s.jsx("span",{className:"text-[var(--text-primary)] break-all",children:O.message})]},O.id))}):s.jsxs("div",{className:"p-8 text-center text-[var(--text-muted)]",children:[s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-[10px] mt-1",children:"Start the proxy engine to view logs"})]})}),!A&&se.length>0&&s.jsx("button",{onClick:()=>{U(!0),G.current&&(G.current.scrollTop=G.current.scrollHeight)},className:"absolute bottom-2 right-4 px-2 py-1 rounded bg-[var(--accent-primary)] text-[var(--primary-foreground)] text-xs font-mono shadow-lg hover:opacity-90 transition-opacity z-20",children:"SCROLL TO BOTTOM"})]}),s.jsxs("div",{className:"px-3 py-1.5 bg-[var(--bg-panel)] border-t border-[var(--border-subtle)] flex items-center justify-between text-[10px] font-mono text-[var(--text-muted)]",children:[s.jsxs("span",{children:[se.length," entries ",b!=="ALL"&&`(filtered: ${b})`]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:A?"text-[var(--status-online)]":"",children:A?"AUTO-SCROLL ON":"AUTO-SCROLL OFF"}),s.jsx("span",{children:"|"}),s.jsx("span",{children:x.toUpperCase()})]})]})]})]})}const zp=["anthropic","google","openai","azure","bedrock","vertex","other"];function Rp(l){const o=l.toLowerCase();return o.includes("anthropic")?"oklch(0.60 0.15 35)":o.includes("google")||o.includes("vertex")?"oklch(0.55 0.18 250)":o.includes("openai")||o.includes("azure")?"oklch(0.55 0.12 145)":o.includes("bedrock")||o.includes("aws")?"oklch(0.58 0.14 50)":"oklch(0.50 0.08 280)"}function Dp(l){const o=l.toLowerCase();return o.includes("anthropic")?"oklch(0.60 0.15 35 / 0.15)":o.includes("google")||o.includes("vertex")?"oklch(0.55 0.18 250 / 0.15)":o.includes("openai")||o.includes("azure")?"oklch(0.55 0.12 145 / 0.15)":o.includes("bedrock")||o.includes("aws")?"oklch(0.58 0.14 50 / 0.15)":"oklch(0.50 0.08 280 / 0.15)"}function BN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:d}=Et(),[m,g]=w.useState([]),[v,x]=w.useState(!1),[p,b]=w.useState({from:"",to:"",provider:""}),[h,N]=w.useState(null),[_,A]=w.useState({from:"",to:"",provider:""}),[U,G]=w.useState(""),[k,K]=w.useState(null),[q,F]=w.useState(null),[ae,te]=w.useState(null),E=u?.running??!1,L=async()=>{try{const O=await o("/v0/management/model-mappings");g(O.mappings||[])}catch(O){O instanceof ot||console.error("Failed to fetch model mappings:",O)}},Y=async()=>{if(!p.from.trim()||!p.to.trim()){c('Both "from" and "to" fields are required',"error");return}try{await o("/v0/management/model-mappings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)}),b({from:"",to:"",provider:""}),x(!1),await L(),te(m.length),setTimeout(()=>te(null),500),c("Route added to flight plan","success")}catch(O){c(O instanceof Error?O.message:String(O),"error")}},z=async(O,ne)=>{try{await o(`/v0/management/model-mappings/${O}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ne)}),N(null),await L(),c("Route updated","success")}catch(oe){c(oe instanceof Error?oe.message:String(oe),"error")}},se=async O=>{F(O);try{await o(`/v0/management/model-mappings/${O}`,{method:"DELETE"}),setTimeout(async()=>{await L(),F(null),c("Route removed","success")},300)}catch(ne){F(null),c(ne instanceof Error?ne.message:String(ne),"error")}},ie=async()=>{if(!U.trim()){K({matched:!1});return}try{const O=await o(`/v0/management/model-mappings/test?model=${encodeURIComponent(U.trim())}`);K({model:O.model||O.to||U,provider:O.provider,matched:O.model!==U||!!O.provider})}catch{K({matched:!1})}};return w.useEffect(()=>{l&&E?L():E||g([])},[l,E]),l?s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl overflow-hidden",children:[s.jsx("div",{className:"px-6 py-4 border-b border-border/50 bg-gradient-to-r from-orange-500/5 to-transparent",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:`h-3 w-3 rounded-full ${E?"bg-orange-500 animate-pulse":"bg-muted"}`}),E&&s.jsx("div",{className:"absolute inset-0 h-3 w-3 rounded-full bg-orange-500/50 animate-ping"})]}),s.jsx("h2",{className:"text-base font-semibold tracking-wide uppercase text-foreground/90",children:"Flight Plan"}),d&&s.jsx(zt,{className:"h-4 w-4 animate-spin text-muted-foreground"})]}),s.jsxs(je,{size:"sm",variant:"outline",disabled:!E,onClick:()=>x(!v),className:"gap-1.5 text-xs border-orange-500/30 hover:border-orange-500/50 hover:bg-orange-500/10",children:[s.jsx(jw,{className:"h-3.5 w-3.5"}),"Add Route"]})]})}),s.jsxs(ft,{className:"p-4 space-y-3",children:[!E&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[s.jsx("p",{className:"text-sm uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-xs mt-1",children:"Start the proxy engine to manage model mappings"})]}),E&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-out ${v?"max-h-48 opacity-100":"max-h-0 opacity-0"}`,children:s.jsxs("div",{className:"p-4 rounded-lg bg-orange-500/5 border border-orange-500/20 space-y-3 mb-3",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"From Model"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-orange-500/30 focus:border-orange-500/50 transition-all",placeholder:"gpt-4",value:p.from,onChange:O=>b({...p,from:O.target.value})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"To Model"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-orange-500/30 focus:border-orange-500/50 transition-all",placeholder:"claude-3-opus",value:p.to,onChange:O=>b({...p,to:O.target.value})})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Provider"}),s.jsxs("div",{className:"relative",children:[s.jsxs("select",{className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-orange-500/30 focus:border-orange-500/50 transition-all",value:p.provider,onChange:O=>b({...p,provider:O.target.value}),children:[s.jsx("option",{value:"",children:"Select provider..."}),zp.map(O=>s.jsx("option",{value:O,children:O.charAt(0).toUpperCase()+O.slice(1)},O))]}),s.jsx(nl,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(je,{size:"sm",variant:"ghost",onClick:()=>{x(!1),b({from:"",to:"",provider:""})},className:"text-xs",children:"Cancel"}),s.jsx(je,{size:"sm",onClick:()=>Y().catch(O=>c(String(O),"error")),className:"text-xs bg-orange-500 hover:bg-orange-600 text-white",children:"Save Route"})]})]})}),s.jsxs("div",{className:"space-y-2",children:[m.length===0&&!v&&!d&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[s.jsx("div",{className:"text-3xl mb-2",children:"---"}),s.jsx("p",{className:"text-sm",children:"No routes configured"}),s.jsx("p",{className:"text-xs mt-1",children:"Add a route to start mapping models"})]}),d&&m.length===0&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[s.jsx(zt,{className:"h-8 w-8 animate-spin mx-auto mb-2 opacity-20"}),s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono opacity-50",children:"Loading Flight Plan..."})]}),m.map((O,ne)=>s.jsx("div",{className:`group relative rounded-lg border transition-all duration-300 ${q===ne?"opacity-0 scale-95 max-h-0 overflow-hidden border-transparent":ae===ne?"opacity-0 animate-fade-in border-border/50 bg-card/80 hover:bg-card hover:border-border":"border-border/50 bg-card/80 hover:bg-card hover:border-border"}`,style:{animation:ae===ne?"fadeIn 0.3s ease-out forwards":void 0},children:h===ne?s.jsxs("div",{className:"p-4 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"From"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",value:_.from,onChange:oe=>A(T=>({...T,from:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"To"}),s.jsx("input",{type:"text",className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",value:_.to,onChange:oe=>A(T=>({...T,to:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Provider"}),s.jsxs("div",{className:"relative",children:[s.jsxs("select",{className:"w-full rounded-md border border-border bg-background/80 px-3 py-2 text-sm font-mono appearance-none cursor-pointer focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",value:_.provider,onChange:oe=>A(T=>({...T,provider:oe.target.value})),children:[s.jsx("option",{value:"",children:"None"}),zp.map(oe=>s.jsx("option",{value:oe,children:oe.charAt(0).toUpperCase()+oe.slice(1)},oe))]}),s.jsx(nl,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsxs(je,{size:"sm",variant:"ghost",onClick:()=>N(null),className:"h-8 px-3 text-xs",children:[s.jsx(ad,{className:"h-3.5 w-3.5 mr-1"}),"Cancel"]}),s.jsxs(je,{size:"sm",onClick:()=>z(ne,_).catch(oe=>c(String(oe),"error")),className:"h-8 px-3 text-xs bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(al,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[s.jsx("div",{className:"flex-shrink-0 min-w-[100px]",children:s.jsx("code",{className:"text-sm font-mono font-medium text-foreground/90",children:O.from})}),s.jsxs("div",{className:"flex-shrink-0 flex items-center gap-0.5 text-orange-500/70 group-hover:text-orange-500 transition-colors",children:[s.jsx("span",{className:"inline-block w-8 h-[2px] bg-current rounded-full relative overflow-hidden",children:s.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-orange-300 to-transparent opacity-0 group-hover:opacity-100 group-hover:animate-flow"})}),s.jsx("span",{className:"inline-block w-8 h-[2px] bg-current rounded-full relative overflow-hidden",children:s.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-orange-300 to-transparent opacity-0 group-hover:opacity-100 group-hover:animate-flow animation-delay-100"})}),s.jsx("svg",{className:"h-4 w-4 -ml-0.5 transition-transform group-hover:translate-x-0.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})]}),s.jsx("div",{className:"flex-1 min-w-[100px]",children:s.jsx("code",{className:"text-sm font-mono font-medium text-orange-400",children:O.to})}),O.provider&&s.jsx("div",{className:"flex-shrink-0 px-2.5 py-1 rounded text-xs font-semibold uppercase tracking-wider",style:{color:Rp(O.provider),backgroundColor:Dp(O.provider)},children:O.provider}),s.jsxs("div",{className:"flex-shrink-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(je,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 hover:bg-muted",onClick:()=>{N(ne),A({from:O.from||"",to:O.to||"",provider:O.provider||""})},children:s.jsx(vw,{className:"h-3.5 w-3.5"})}),s.jsx(je,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0 hover:bg-destructive/10 text-destructive",onClick:()=>se(ne).catch(oe=>c(String(oe),"error")),children:s.jsx(Wo,{className:"h-3.5 w-3.5"})})]})]})},ne))]}),s.jsx("div",{className:"mt-4 pt-4 border-t border-border/50",children:s.jsx("div",{className:"rounded-lg bg-muted/30 border border-border/50 p-4",children:s.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-[200px]",children:[s.jsx(Uw,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),s.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Test Route:"}),s.jsx("input",{type:"text",className:"flex-1 min-w-[120px] rounded-md border border-border bg-background/80 px-3 py-1.5 text-sm font-mono placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-orange-500/30 transition-all",placeholder:"Enter model name...",value:U,onChange:O=>{G(O.target.value),O.target.value.trim()||K(null)},onKeyDown:O=>{O.key==="Enter"&&ie().catch(ne=>c(String(ne),"error"))}}),s.jsx(je,{size:"sm",variant:"outline",onClick:()=>ie().catch(O=>c(String(O),"error")),className:"text-xs",children:"Lookup"})]}),k&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-orange-500",children:"---"}),k.matched?s.jsxs(s.Fragment,{children:[s.jsx("code",{className:"text-sm font-mono font-medium text-orange-400",children:k.model}),k.provider&&s.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-semibold uppercase",style:{color:Rp(k.provider),backgroundColor:Dp(k.provider)},children:k.provider})]}):s.jsx("span",{className:"text-sm text-muted-foreground italic",children:"No match found"})]})]})})})]})]}),s.jsx("style",{children:` @keyframes fadeIn { from { opacity: 0; @@ -179,9 +179,9 @@ Error generating stack: `+n.message+` .animation-delay-100 { animation-delay: 0.15s; } - `})]}):null}const Rp=(l,o)=>{const c=URL.createObjectURL(l),u=document.createElement("a");u.href=c,u.download=o,u.click(),URL.revokeObjectURL(c)},wu=l=>{if(!l)return"--:--:--";try{return new Date(l).toTimeString().slice(0,8)}catch{return l.slice(11,19)||l}},UN=(l,o)=>{try{const c=new Date(l),f=new Date(o).getTime()-c.getTime(),m=Math.floor(f/36e5),g=Math.floor(f%36e5/6e4),v=Math.floor(f%6e4/1e3);return`${m.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}:${v.toString().padStart(2,"0")}`}catch{return"--:--:--"}};function ko({title:l,icon:o,count:c,children:u,defaultOpen:f=!1}){const[m,g]=w.useState(f),v=w.useRef(null),[x,p]=w.useState(f?void 0:0);return w.useEffect(()=>{if(m){const b=v.current;if(b){p(b.scrollHeight);const h=setTimeout(()=>p(void 0),300);return()=>clearTimeout(h)}}else p(0)},[m]),s.jsxs("div",{className:"border border-orange-500/30 rounded bg-black/40",children:[s.jsxs("button",{onClick:()=>g(!m),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-orange-500/10 transition-colors",children:[m?s.jsx(al,{className:"h-4 w-4 text-orange-400"}):s.jsx(Ou,{className:"h-4 w-4 text-orange-400"}),s.jsx(o,{className:"h-4 w-4 text-orange-400"}),s.jsx("span",{className:"text-xs font-mono text-orange-300 uppercase tracking-wider",children:l}),c!==void 0&&s.jsx("span",{className:"ml-auto text-xs font-mono bg-orange-500/20 text-orange-300 px-2 py-0.5 rounded",children:c})]}),s.jsx("div",{style:{height:x!==void 0?`${x}px`:"auto"},className:"overflow-hidden transition-[height] duration-300 ease-in-out",children:s.jsx("div",{ref:v,className:"px-3 pb-3",children:u})})]})}function HN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:f}=Mt(),[m,g]=w.useState([]),[v,x]=w.useState(""),[p,b]=w.useState(null),[h,N]=w.useState(""),[E,A]=w.useState(""),[U,G]=w.useState(""),[T,K]=w.useState(!0),[q,F]=w.useState([]),[ae,te]=w.useState([]),[_,L]=w.useState(120),[Y,z]=w.useState(20),[se,ie]=w.useState(!1),[O,ne]=w.useState({maxAgeDays:30,maxSessions:200,maxBytesPerSession:2e6,maxNamespaces:200,maxBytesPerNamespace:2e6}),[oe,k]=w.useState(!1),V=u?.running??!1,B=w.useCallback(async()=>{try{const ve=(await o("/v0/management/memory/sessions?limit=200")).sessions||[];g(ve),!v&&ve.length>0&&x(ve[0].key)}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[o,c,v]),ce=w.useCallback(async()=>{if(!v){b(null);return}try{const ve=(await o(`/v0/management/memory/session?session=${encodeURIComponent(v)}`)).session||null;b(ve),ve&&(N(ve.summary||""),A(ve.pinned||""),G(ve.todo||""),K(!ve.semantic_disabled))}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[v,o,c]),ge=w.useCallback(async()=>{if(!v){F([]);return}try{const ve=(await o(`/v0/management/memory/events?session=${encodeURIComponent(v)}&limit=${encodeURIComponent(_)}`)).events||[];if(!Array.isArray(ve)||ve.length===0){F([]);return}const at=ve.map(_t=>({ts:_t.ts||"",kind:_t.kind||"",role:_t.role||"",text:(_t.text||"").toString()}));F(at)}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[v,_,o,c]),S=w.useCallback(async()=>{if(!v){te([]);return}try{const ve=(await o(`/v0/management/memory/anchors?session=${encodeURIComponent(v)}&limit=${encodeURIComponent(Y)}`)).anchors||[];if(!Array.isArray(ve)||ve.length===0){te([]);return}const at=ve.map(_t=>({ts:_t.ts||"",summary:(_t.summary||"").toString()}));te(at)}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[v,Y,o,c]),Q=async()=>{if(v)try{await o("/v0/management/memory/todo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,value:U})}),await ce(),c("Saved TODO","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},$=async()=>{if(v)try{await o("/v0/management/memory/pinned",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,value:E})}),await ce(),c("Saved pinned context","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},ee=async()=>{if(v)try{await o("/v0/management/memory/summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,value:h})}),await ce(),c("Saved anchor summary","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},re=async Z=>{if(v)try{await o("/v0/management/memory/semantic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,enabled:Z})}),K(Z),await ce(),c(`Semantic ${Z?"enabled":"disabled"}`,"success")}catch(ve){c(ve instanceof Error?ve.message:String(ve),"error")}},xe=async()=>{if(v)try{await o(`/v0/management/memory/session?session=${encodeURIComponent(v)}`,{method:"DELETE"}),x(""),b(null),F([]),te([]),await B(),c("Deleted session","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},ue=async()=>{if(!(!v||!l))try{const Z=await fetch(`/v0/management/memory/export?session=${encodeURIComponent(v)}`,{headers:{"X-Management-Key":l}});if(!Z.ok){const at=await Z.text();throw new Error(at)}const ve=await Z.blob();Rp(ve,`flight-log-${v}.zip`)}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},we=async()=>{if(l)try{const Z=await fetch("/v0/management/memory/export-all",{headers:{"X-Management-Key":l}});if(!Z.ok){const at=await Z.text();throw new Error(at)}const ve=await Z.blob();Rp(ve,"flight-data-complete.zip")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},Te=async()=>{if(l&&window.confirm("PURGE ALL FLIGHT DATA? This action cannot be reversed."))try{await o("/v0/management/memory/delete-all?confirm=true",{method:"POST"}),x(""),b(null),F([]),te([]),await B(),c("All flight data purged","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},We=async Z=>{if(!(!Z||!v||!l))try{const ve=new FormData;ve.append("file",Z);const at=await fetch(`/v0/management/memory/import?session=${encodeURIComponent(v)}&replace=${se?"true":"false"}`,{method:"POST",headers:{"X-Management-Key":l},body:ve});if(!at.ok){const _t=await at.text();throw new Error(_t)}await ce(),c("Flight data imported","success")}catch(ve){c(ve instanceof Error?ve.message:String(ve),"error")}},it=async()=>{try{await o("/v0/management/memory/prune",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({max_age_days:O.maxAgeDays,max_sessions:O.maxSessions,max_bytes_per_session:O.maxBytesPerSession,max_namespaces:O.maxNamespaces,max_bytes_per_namespace:O.maxBytesPerNamespace})}),await B(),c("Maintenance complete","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}};if(w.useEffect(()=>{l&&V?B():V||(g([]),b(null),F([]),te([]))},[l,V,B]),w.useEffect(()=>{v&&V&&(ce(),S(),ge())},[v,V,ce,S,ge]),!l)return null;const qe=q.length>0?q[q.length-1]?.ts:"",P=q.length>0?q[0]?.ts:"",Ye=qe&&P?UN(qe,P):"--:--:--";return s.jsxs("div",{className:"bg-gradient-to-b from-zinc-900 to-black border border-orange-500/40 rounded-lg shadow-2xl shadow-orange-500/10 overflow-hidden",children:[s.jsx("div",{className:"bg-gradient-to-r from-orange-950/80 via-orange-900/60 to-orange-950/80 border-b border-orange-500/40 px-4 py-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Ho,{className:`h-4 w-4 ${V?"text-red-500 fill-red-500 animate-pulse":"text-muted"}`}),V&&s.jsx("div",{className:"absolute inset-0 h-4 w-4 bg-red-500 rounded-full blur-sm opacity-50 animate-pulse"})]}),s.jsx("span",{className:"text-sm font-mono font-bold text-orange-300 uppercase tracking-widest",children:"Black Box Recorder"}),f&&s.jsx(Vt,{className:"h-4 w-4 animate-spin text-orange-500/60"}),s.jsxs("span",{className:"text-xs font-mono text-orange-500/60",children:["[",m.length," LOGS]"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:ue,disabled:!v||!V,className:"gap-1.5 text-xs font-mono bg-orange-500/10 hover:bg-orange-500/20 text-orange-300 border border-orange-500/30",children:[s.jsx(is,{className:"h-3 w-3"}),"EXPORT"]}),s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:we,disabled:!V,className:"gap-1.5 text-xs font-mono bg-orange-500/10 hover:bg-orange-500/20 text-orange-300 border border-orange-500/30",children:[s.jsx(is,{className:"h-3 w-3"}),"EXPORT ALL"]}),s.jsxs("label",{className:je("cursor-pointer",!V&&"opacity-50 pointer-events-none"),children:[s.jsx("input",{type:"file",accept:".zip",className:"hidden",disabled:!V,onChange:Z=>We(Z.target.files?.[0]||null)}),s.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono bg-orange-500/10 hover:bg-orange-500/20 text-orange-300 border border-orange-500/30 px-3 py-1.5 rounded-md transition-colors",children:[s.jsx(eN,{className:"h-3 w-3"}),"IMPORT"]})]})]})]})}),s.jsxs("div",{className:"p-4 space-y-4",children:[!V&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground border border-dashed border-orange-500/20 rounded bg-black/20",children:[s.jsx("p",{className:"text-sm uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-xs mt-1",children:"Start the proxy engine to access flight data"})]}),V&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs font-mono text-orange-400 uppercase tracking-wider",children:"Session:"}),s.jsxs("div",{className:"relative flex-1",children:[s.jsxs("button",{onClick:()=>k(!oe),className:"w-full flex items-center justify-between px-3 py-2 bg-black/60 border border-orange-500/30 rounded text-left hover:border-orange-500/50 transition-colors",children:[s.jsx("span",{className:"font-mono text-sm text-orange-200",children:v||"(no session selected)"}),s.jsx(al,{className:`h-4 w-4 text-orange-400 transition-transform ${oe?"rotate-180":""}`})]}),oe&&s.jsx("div",{className:"absolute z-10 w-full mt-1 max-h-60 overflow-auto bg-zinc-900 border border-orange-500/30 rounded shadow-xl",children:m.length===0?s.jsx("div",{className:"px-3 py-2 text-xs font-mono text-orange-500/60",children:"(no sessions)"}):m.map(Z=>s.jsx("button",{onClick:()=>{x(Z.key),k(!1)},className:`w-full px-3 py-2 text-left text-sm font-mono hover:bg-orange-500/10 transition-colors ${Z.key===v?"bg-orange-500/20 text-orange-200":"text-orange-300/80"}`,children:Z.key},Z.key))})]}),s.jsx(Ne,{size:"sm",variant:"ghost",onClick:B,className:"text-orange-400 hover:text-orange-300 hover:bg-orange-500/10",children:s.jsx(ba,{className:"h-4 w-4"})})]}),v&&s.jsxs("div",{className:"bg-black/40 border border-orange-500/20 rounded p-3",children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-xs font-mono",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Started:"}),s.jsxs("div",{className:"text-orange-200",children:[wu(qe)," UTC"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Duration:"}),s.jsx("div",{className:"text-orange-200",children:Ye})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Anchors:"}),s.jsx("div",{className:"text-orange-200",children:ae.length})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Events:"}),s.jsx("div",{className:"text-orange-200",children:q.length})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mt-3 pt-3 border-t border-orange-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Au,{className:"h-4 w-4 text-orange-400"}),s.jsx(ua,{htmlFor:"semantic-toggle",className:"text-xs font-mono text-orange-300 cursor-pointer",children:"SEMANTIC"}),s.jsx(Bo,{id:"semantic-toggle",checked:T,disabled:!v,onCheckedChange:re})]}),s.jsx("span",{className:"text-xs font-mono text-orange-500/60",children:p?.updated_at?`Last update: ${p.updated_at}`:""})]})]})]}),s.jsx(ko,{title:"Anchors",icon:_p,count:ae.length,defaultOpen:!0,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Limit:"}),s.jsx("input",{type:"number",min:5,max:200,className:"w-16 rounded bg-black/60 border border-orange-500/30 px-2 py-1 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:Y,onChange:Z=>z(parseInt(Z.target.value||"20",10))}),s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:S,className:"text-xs font-mono text-orange-400 hover:bg-orange-500/10",children:[s.jsx(ba,{className:"h-3 w-3 mr-1"}),"Reload"]})]}),s.jsx("div",{className:"bg-black/60 border border-orange-500/20 rounded max-h-48 overflow-auto",children:ae.length===0?s.jsx("div",{className:"px-3 py-4 text-xs font-mono text-orange-500/50 text-center",children:"No anchors recorded."}):s.jsx("div",{className:"divide-y divide-orange-500/10",children:ae.map((Z,ve)=>s.jsx("div",{className:"px-3 py-2 hover:bg-orange-500/5",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-orange-400 shrink-0",children:wu(Z.ts)}),s.jsx("span",{className:"text-xs font-mono text-orange-500/30",children:"|"}),s.jsx("span",{className:"text-xs font-mono text-orange-200/80 break-words",children:Z.summary.length>100?Z.summary.slice(0,100)+"...":Z.summary})]})},ve))})}),s.jsxs("div",{className:"space-y-2 mt-3",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Anchor Summary:"}),s.jsx("textarea",{className:"w-full h-24 rounded bg-black/60 border border-orange-500/30 px-3 py-2 text-xs font-mono text-orange-200 resize-y focus:border-orange-500/50 focus:outline-none",value:h,onChange:Z=>N(Z.target.value),placeholder:"Session anchor summary..."}),s.jsxs(Ne,{size:"sm",onClick:ee,className:"gap-1 text-xs font-mono bg-orange-500/20 hover:bg-orange-500/30 text-orange-300 border border-orange-500/30",children:[s.jsx(Ps,{className:"h-3 w-3"}),"Save Summary"]})]})]})}),s.jsx(ko,{title:"Pinned Context",icon:vw,defaultOpen:!1,children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("textarea",{className:"w-full h-32 rounded bg-black/60 border border-orange-500/30 px-3 py-2 text-xs font-mono text-orange-200 resize-y focus:border-orange-500/50 focus:outline-none",value:E,onChange:Z=>A(Z.target.value),placeholder:"Pinned context that persists across turns..."}),s.jsxs(Ne,{size:"sm",onClick:$,className:"gap-1 text-xs font-mono bg-orange-500/20 hover:bg-orange-500/30 text-orange-300 border border-orange-500/30",children:[s.jsx(Ps,{className:"h-3 w-3"}),"Save Pinned"]})]})}),s.jsx(ko,{title:"TODO Log",icon:_p,defaultOpen:!1,children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("textarea",{className:"w-full h-32 rounded bg-black/60 border border-orange-500/30 px-3 py-2 text-xs font-mono text-orange-200 resize-y focus:border-orange-500/50 focus:outline-none",value:U,onChange:Z=>G(Z.target.value),placeholder:"Session TODO list..."}),s.jsxs(Ne,{size:"sm",onClick:Q,className:"gap-1 text-xs font-mono bg-orange-500/20 hover:bg-orange-500/30 text-orange-300 border border-orange-500/30",children:[s.jsx(Ps,{className:"h-3 w-3"}),"Save TODO"]})]})}),s.jsx(ko,{title:"Event Log",icon:Ho,count:q.length,defaultOpen:!1,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Limit:"}),s.jsx("input",{type:"number",min:10,max:500,className:"w-16 rounded bg-black/60 border border-orange-500/30 px-2 py-1 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:_,onChange:Z=>L(parseInt(Z.target.value||"120",10))}),s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:ge,className:"text-xs font-mono text-orange-400 hover:bg-orange-500/10",children:[s.jsx(ba,{className:"h-3 w-3 mr-1"}),"Reload"]})]}),s.jsx("div",{className:"bg-black/60 border border-orange-500/20 rounded max-h-64 overflow-auto",children:q.length===0?s.jsx("div",{className:"px-3 py-4 text-xs font-mono text-orange-500/50 text-center",children:"No events recorded."}):s.jsx("div",{className:"divide-y divide-orange-500/10",children:q.map((Z,ve)=>s.jsx("div",{className:"px-3 py-2 hover:bg-orange-500/5",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-orange-400 shrink-0",children:wu(Z.ts)}),s.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-orange-500/20 text-orange-300 shrink-0",children:Z.kind}),s.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-zinc-700/50 text-zinc-300 shrink-0",children:Z.role}),s.jsx("span",{className:"text-xs font-mono text-orange-200/70 break-words",children:Z.text.length>80?Z.text.slice(0,80)+"...":Z.text})]})},ve))})})]})}),s.jsxs("div",{className:"relative pt-6",children:[s.jsxs("div",{className:"absolute top-0 left-0 right-0 flex items-center",children:[s.jsx("div",{className:"flex-1 border-t border-dashed border-orange-500/30"}),s.jsxs("span",{className:"px-3 text-xs font-mono text-orange-500/60 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(J0,{className:"h-3 w-3"}),"Maintenance"]}),s.jsx("div",{className:"flex-1 border-t border-dashed border-orange-500/30"})]}),s.jsxs("div",{className:"bg-black/40 border border-orange-500/20 rounded p-4 space-y-4",children:[s.jsx("div",{className:"flex items-center gap-4 pb-3 border-b border-orange-500/20",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bo,{id:"import-replace",checked:se,onCheckedChange:ie}),s.jsx(ua,{htmlFor:"import-replace",className:"text-xs font-mono text-orange-300 cursor-pointer",children:"Replace on Import"})]})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Max Sessions"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxSessions,onChange:Z=>ne({...O,maxSessions:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Max Age (days)"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxAgeDays,onChange:Z=>ne({...O,maxAgeDays:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Max Namespaces"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxNamespaces,onChange:Z=>ne({...O,maxNamespaces:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Bytes/Session"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxBytesPerSession,onChange:Z=>ne({...O,maxBytesPerSession:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ua,{className:"text-xs font-mono text-orange-500/60",children:"Bytes/Namespace"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxBytesPerNamespace,onChange:Z=>ne({...O,maxBytesPerNamespace:parseInt(Z.target.value||"0",10)})})]})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[s.jsxs(Ne,{size:"sm",onClick:it,className:"gap-1.5 text-xs font-mono bg-amber-600/80 hover:bg-amber-600 text-black border border-amber-500",children:[s.jsx(Mw,{className:"h-3 w-3"}),"PRUNE NOW"]}),s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:xe,disabled:!v,className:"gap-1.5 text-xs font-mono bg-red-500/20 hover:bg-red-500/30 text-red-400 border border-red-500/30",children:[s.jsx(Jo,{className:"h-3 w-3"}),"Delete Session"]}),s.jsxs(Ne,{size:"sm",variant:"ghost",onClick:Te,className:"gap-1.5 text-xs font-mono bg-red-500/20 hover:bg-red-500/30 text-red-400 border border-red-500/30",children:[s.jsx(Iu,{className:"h-3 w-3"}),"Purge All Data"]})]})]})]})]})]})]})}const BN=lg("inline-flex items-center justify-center rounded-sm border px-1.5 py-0.5 w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden font-mono text-[0.65rem] uppercase tracking-wide",{variants:{variant:{default:"border-transparent bg-[hsl(var(--accent-primary))] text-[hsl(var(--bg-primary))] font-semibold [a&]:hover:bg-[hsl(var(--accent-primary))]/90",secondary:"border-[hsl(var(--border-primary))] bg-[hsl(var(--bg-secondary))] text-[hsl(var(--text-secondary))] [a&]:hover:bg-[hsl(var(--bg-tertiary))]",destructive:"border-transparent bg-[hsl(var(--status-offline))] text-white [a&]:hover:bg-[hsl(var(--status-offline))]/90 focus-visible:ring-[hsl(var(--status-offline))]/20",outline:"border-[hsl(var(--border-primary))] bg-transparent text-[hsl(var(--text-secondary))] [a&]:hover:bg-[hsl(var(--bg-tertiary))] [a&]:hover:text-[hsl(var(--text-primary))]",success:"border-transparent bg-[hsl(var(--status-online))] text-white font-semibold [a&]:hover:bg-[hsl(var(--status-online))]/90",warning:"border-transparent bg-[hsl(var(--status-warning))] text-[hsl(var(--bg-primary))] font-semibold [a&]:hover:bg-[hsl(var(--status-warning))]/90",processing:"border-transparent bg-[hsl(var(--status-processing))] text-white font-semibold [a&]:hover:bg-[hsl(var(--status-processing))]/90"}},defaultVariants:{variant:"default"}});function qN({className:l,variant:o,asChild:c=!1,...u}){const f=c?ng:"span";return s.jsx(f,{"data-slot":"badge",className:je(BN({variant:o}),l),...u})}function YN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:f}=Mt(),[m,g]=w.useState(null),[v,x]=w.useState([]),[p,b]=w.useState(""),[h,N]=w.useState(50),[E,A]=w.useState(""),U=u?.running??!1,G=w.useCallback(async()=>{try{const q=await o("/v0/management/semantic/health");g(q)}catch(q){q instanceof ot||c(q instanceof Error?q.message:String(q),"error")}},[o,c]),T=w.useCallback(async()=>{try{const F=(await o("/v0/management/semantic/namespaces")).namespaces||[];x(F),!p&&F.length>0&&b(F[0].key)}catch(q){q instanceof ot||c(q instanceof Error?q.message:String(q),"error")}},[o,c,p]),K=w.useCallback(async()=>{if(!p){A("Select a namespace.");return}try{const F=(await o(`/v0/management/semantic/items?namespace=${encodeURIComponent(p)}&limit=${encodeURIComponent(h)}`)).items||[];if(!Array.isArray(F)||F.length===0){A("No items.");return}const ae=F.map(te=>{const _=te.ts||"",L=te.source||"",Y=te.role||"",z=(te.text||"").toString();return`[${_}][${L}][${Y}] ${z}`});A(ae.join(` + `})]}):null}const Lp=(l,o)=>{const c=URL.createObjectURL(l),u=document.createElement("a");u.href=c,u.download=o,u.click(),URL.revokeObjectURL(c)},Su=l=>{if(!l)return"--:--:--";try{return new Date(l).toTimeString().slice(0,8)}catch{return l.slice(11,19)||l}},qN=(l,o)=>{try{const c=new Date(l),d=new Date(o).getTime()-c.getTime(),m=Math.floor(d/36e5),g=Math.floor(d%36e5/6e4),v=Math.floor(d%6e4/1e3);return`${m.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}:${v.toString().padStart(2,"0")}`}catch{return"--:--:--"}};function Mo({title:l,icon:o,count:c,children:u,defaultOpen:d=!1}){const[m,g]=w.useState(d),v=w.useRef(null),[x,p]=w.useState(d?void 0:0);return w.useEffect(()=>{if(m){const b=v.current;if(b){p(b.scrollHeight);const h=setTimeout(()=>p(void 0),300);return()=>clearTimeout(h)}}else p(0)},[m]),s.jsxs("div",{className:"border border-orange-500/30 rounded bg-black/40",children:[s.jsxs("button",{onClick:()=>g(!m),className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-orange-500/10 transition-colors",children:[m?s.jsx(nl,{className:"h-4 w-4 text-orange-400"}):s.jsx(Du,{className:"h-4 w-4 text-orange-400"}),s.jsx(o,{className:"h-4 w-4 text-orange-400"}),s.jsx("span",{className:"text-xs font-mono text-orange-300 uppercase tracking-wider",children:l}),c!==void 0&&s.jsx("span",{className:"ml-auto text-xs font-mono bg-orange-500/20 text-orange-300 px-2 py-0.5 rounded",children:c})]}),s.jsx("div",{style:{height:x!==void 0?`${x}px`:"auto"},className:"overflow-hidden transition-[height] duration-300 ease-in-out",children:s.jsx("div",{ref:v,className:"px-3 pb-3",children:u})})]})}function YN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:d}=Et(),[m,g]=w.useState([]),[v,x]=w.useState(""),[p,b]=w.useState(null),[h,N]=w.useState(""),[_,A]=w.useState(""),[U,G]=w.useState(""),[k,K]=w.useState(!0),[q,F]=w.useState([]),[ae,te]=w.useState([]),[E,L]=w.useState(120),[Y,z]=w.useState(20),[se,ie]=w.useState(!1),[O,ne]=w.useState({maxAgeDays:30,maxSessions:200,maxBytesPerSession:2e6,maxNamespaces:200,maxBytesPerNamespace:2e6}),[oe,T]=w.useState(!1),V=u?.running??!1,B=w.useCallback(async()=>{try{const ve=(await o("/v0/management/memory/sessions?limit=200")).sessions||[];g(ve),!v&&ve.length>0&&x(ve[0].key)}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[o,c,v]),ce=w.useCallback(async()=>{if(!v){b(null);return}try{const ve=(await o(`/v0/management/memory/session?session=${encodeURIComponent(v)}`)).session||null;b(ve),ve&&(N(ve.summary||""),A(ve.pinned||""),G(ve.todo||""),K(!ve.semantic_disabled))}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[v,o,c]),ge=w.useCallback(async()=>{if(!v){F([]);return}try{const ve=(await o(`/v0/management/memory/events?session=${encodeURIComponent(v)}&limit=${encodeURIComponent(E)}`)).events||[];if(!Array.isArray(ve)||ve.length===0){F([]);return}const at=ve.map(Ct=>({ts:Ct.ts||"",kind:Ct.kind||"",role:Ct.role||"",text:(Ct.text||"").toString()}));F(at)}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[v,E,o,c]),S=w.useCallback(async()=>{if(!v){te([]);return}try{const ve=(await o(`/v0/management/memory/anchors?session=${encodeURIComponent(v)}&limit=${encodeURIComponent(Y)}`)).anchors||[];if(!Array.isArray(ve)||ve.length===0){te([]);return}const at=ve.map(Ct=>({ts:Ct.ts||"",summary:(Ct.summary||"").toString()}));te(at)}catch(Z){Z instanceof ot||c(Z instanceof Error?Z.message:String(Z),"error")}},[v,Y,o,c]),Q=async()=>{if(v)try{await o("/v0/management/memory/todo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,value:U})}),await ce(),c("Saved TODO","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},$=async()=>{if(v)try{await o("/v0/management/memory/pinned",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,value:_})}),await ce(),c("Saved pinned context","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},ee=async()=>{if(v)try{await o("/v0/management/memory/summary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,value:h})}),await ce(),c("Saved anchor summary","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},re=async Z=>{if(v)try{await o("/v0/management/memory/semantic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:v,enabled:Z})}),K(Z),await ce(),c(`Semantic ${Z?"enabled":"disabled"}`,"success")}catch(ve){c(ve instanceof Error?ve.message:String(ve),"error")}},xe=async()=>{if(v)try{await o(`/v0/management/memory/session?session=${encodeURIComponent(v)}`,{method:"DELETE"}),x(""),b(null),F([]),te([]),await B(),c("Deleted session","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},ue=async()=>{if(!(!v||!l))try{const Z=await fetch(`/v0/management/memory/export?session=${encodeURIComponent(v)}`,{headers:{"X-Management-Key":l}});if(!Z.ok){const at=await Z.text();throw new Error(at)}const ve=await Z.blob();Lp(ve,`flight-log-${v}.zip`)}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},we=async()=>{if(l)try{const Z=await fetch("/v0/management/memory/export-all",{headers:{"X-Management-Key":l}});if(!Z.ok){const at=await Z.text();throw new Error(at)}const ve=await Z.blob();Lp(ve,"flight-data-complete.zip")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},ke=async()=>{if(l&&window.confirm("PURGE ALL FLIGHT DATA? This action cannot be reversed."))try{await o("/v0/management/memory/delete-all?confirm=true",{method:"POST"}),x(""),b(null),F([]),te([]),await B(),c("All flight data purged","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}},We=async Z=>{if(!(!Z||!v||!l))try{const ve=new FormData;ve.append("file",Z);const at=await fetch(`/v0/management/memory/import?session=${encodeURIComponent(v)}&replace=${se?"true":"false"}`,{method:"POST",headers:{"X-Management-Key":l},body:ve});if(!at.ok){const Ct=await at.text();throw new Error(Ct)}await ce(),c("Flight data imported","success")}catch(ve){c(ve instanceof Error?ve.message:String(ve),"error")}},it=async()=>{try{await o("/v0/management/memory/prune",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({max_age_days:O.maxAgeDays,max_sessions:O.maxSessions,max_bytes_per_session:O.maxBytesPerSession,max_namespaces:O.maxNamespaces,max_bytes_per_namespace:O.maxBytesPerNamespace})}),await B(),c("Maintenance complete","success")}catch(Z){c(Z instanceof Error?Z.message:String(Z),"error")}};if(w.useEffect(()=>{l&&V?B():V||(g([]),b(null),F([]),te([]))},[l,V,B]),w.useEffect(()=>{v&&V&&(ce(),S(),ge())},[v,V,ce,S,ge]),!l)return null;const qe=q.length>0?q[q.length-1]?.ts:"",P=q.length>0?q[0]?.ts:"",Ye=qe&&P?qN(qe,P):"--:--:--";return s.jsxs("div",{className:"bg-gradient-to-b from-zinc-900 to-black border border-orange-500/40 rounded-lg shadow-2xl shadow-orange-500/10 overflow-hidden",children:[s.jsx("div",{className:"bg-gradient-to-r from-orange-950/80 via-orange-900/60 to-orange-950/80 border-b border-orange-500/40 px-4 py-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(qo,{className:`h-4 w-4 ${V?"text-red-500 fill-red-500 animate-pulse":"text-muted"}`}),V&&s.jsx("div",{className:"absolute inset-0 h-4 w-4 bg-red-500 rounded-full blur-sm opacity-50 animate-pulse"})]}),s.jsx("span",{className:"text-sm font-mono font-bold text-orange-300 uppercase tracking-widest",children:"Black Box Recorder"}),d&&s.jsx(zt,{className:"h-4 w-4 animate-spin text-orange-500/60"}),s.jsxs("span",{className:"text-xs font-mono text-orange-500/60",children:["[",m.length," LOGS]"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(je,{size:"sm",variant:"ghost",onClick:ue,disabled:!v||!V,className:"gap-1.5 text-xs font-mono bg-orange-500/10 hover:bg-orange-500/20 text-orange-300 border border-orange-500/30",children:[s.jsx(is,{className:"h-3 w-3"}),"EXPORT"]}),s.jsxs(je,{size:"sm",variant:"ghost",onClick:we,disabled:!V,className:"gap-1.5 text-xs font-mono bg-orange-500/10 hover:bg-orange-500/20 text-orange-300 border border-orange-500/30",children:[s.jsx(is,{className:"h-3 w-3"}),"EXPORT ALL"]}),s.jsxs("label",{className:Ne("cursor-pointer",!V&&"opacity-50 pointer-events-none"),children:[s.jsx("input",{type:"file",accept:".zip",className:"hidden",disabled:!V,onChange:Z=>We(Z.target.files?.[0]||null)}),s.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono bg-orange-500/10 hover:bg-orange-500/20 text-orange-300 border border-orange-500/30 px-3 py-1.5 rounded-md transition-colors",children:[s.jsx(aN,{className:"h-3 w-3"}),"IMPORT"]})]})]})]})}),s.jsxs("div",{className:"p-4 space-y-4",children:[!V&&s.jsxs("div",{className:"py-8 text-center text-muted-foreground border border-dashed border-orange-500/20 rounded bg-black/20",children:[s.jsx("p",{className:"text-sm uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-xs mt-1",children:"Start the proxy engine to access flight data"})]}),V&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs font-mono text-orange-400 uppercase tracking-wider",children:"Session:"}),s.jsxs("div",{className:"relative flex-1",children:[s.jsxs("button",{onClick:()=>T(!oe),className:"w-full flex items-center justify-between px-3 py-2 bg-black/60 border border-orange-500/30 rounded text-left hover:border-orange-500/50 transition-colors",children:[s.jsx("span",{className:"font-mono text-sm text-orange-200",children:v||"(no session selected)"}),s.jsx(nl,{className:`h-4 w-4 text-orange-400 transition-transform ${oe?"rotate-180":""}`})]}),oe&&s.jsx("div",{className:"absolute z-10 w-full mt-1 max-h-60 overflow-auto bg-zinc-900 border border-orange-500/30 rounded shadow-xl",children:m.length===0?s.jsx("div",{className:"px-3 py-2 text-xs font-mono text-orange-500/60",children:"(no sessions)"}):m.map(Z=>s.jsx("button",{onClick:()=>{x(Z.key),T(!1)},className:`w-full px-3 py-2 text-left text-sm font-mono hover:bg-orange-500/10 transition-colors ${Z.key===v?"bg-orange-500/20 text-orange-200":"text-orange-300/80"}`,children:Z.key},Z.key))})]}),s.jsx(je,{size:"sm",variant:"ghost",onClick:B,className:"text-orange-400 hover:text-orange-300 hover:bg-orange-500/10",children:s.jsx(fa,{className:"h-4 w-4"})})]}),v&&s.jsxs("div",{className:"bg-black/40 border border-orange-500/20 rounded p-3",children:[s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-xs font-mono",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Started:"}),s.jsxs("div",{className:"text-orange-200",children:[Su(qe)," UTC"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Duration:"}),s.jsx("div",{className:"text-orange-200",children:Ye})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Anchors:"}),s.jsx("div",{className:"text-orange-200",children:ae.length})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-orange-500/60",children:"Events:"}),s.jsx("div",{className:"text-orange-200",children:q.length})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mt-3 pt-3 border-t border-orange-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zu,{className:"h-4 w-4 text-orange-400"}),s.jsx(da,{htmlFor:"semantic-toggle",className:"text-xs font-mono text-orange-300 cursor-pointer",children:"SEMANTIC"}),s.jsx(Go,{id:"semantic-toggle",checked:k,disabled:!v,onCheckedChange:re})]}),s.jsx("span",{className:"text-xs font-mono text-orange-500/60",children:p?.updated_at?`Last update: ${p.updated_at}`:""})]})]})]}),s.jsx(Mo,{title:"Anchors",icon:Cp,count:ae.length,defaultOpen:!0,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Limit:"}),s.jsx("input",{type:"number",min:5,max:200,className:"w-16 rounded bg-black/60 border border-orange-500/30 px-2 py-1 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:Y,onChange:Z=>z(parseInt(Z.target.value||"20",10))}),s.jsxs(je,{size:"sm",variant:"ghost",onClick:S,className:"text-xs font-mono text-orange-400 hover:bg-orange-500/10",children:[s.jsx(fa,{className:"h-3 w-3 mr-1"}),"Reload"]})]}),s.jsx("div",{className:"bg-black/60 border border-orange-500/20 rounded max-h-48 overflow-auto",children:ae.length===0?s.jsx("div",{className:"px-3 py-4 text-xs font-mono text-orange-500/50 text-center",children:"No anchors recorded."}):s.jsx("div",{className:"divide-y divide-orange-500/10",children:ae.map((Z,ve)=>s.jsx("div",{className:"px-3 py-2 hover:bg-orange-500/5",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-orange-400 shrink-0",children:Su(Z.ts)}),s.jsx("span",{className:"text-xs font-mono text-orange-500/30",children:"|"}),s.jsx("span",{className:"text-xs font-mono text-orange-200/80 break-words",children:Z.summary.length>100?Z.summary.slice(0,100)+"...":Z.summary})]})},ve))})}),s.jsxs("div",{className:"space-y-2 mt-3",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Anchor Summary:"}),s.jsx("textarea",{className:"w-full h-24 rounded bg-black/60 border border-orange-500/30 px-3 py-2 text-xs font-mono text-orange-200 resize-y focus:border-orange-500/50 focus:outline-none",value:h,onChange:Z=>N(Z.target.value),placeholder:"Session anchor summary..."}),s.jsxs(je,{size:"sm",onClick:ee,className:"gap-1 text-xs font-mono bg-orange-500/20 hover:bg-orange-500/30 text-orange-300 border border-orange-500/30",children:[s.jsx(Is,{className:"h-3 w-3"}),"Save Summary"]})]})]})}),s.jsx(Mo,{title:"Pinned Context",icon:bw,defaultOpen:!1,children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("textarea",{className:"w-full h-32 rounded bg-black/60 border border-orange-500/30 px-3 py-2 text-xs font-mono text-orange-200 resize-y focus:border-orange-500/50 focus:outline-none",value:_,onChange:Z=>A(Z.target.value),placeholder:"Pinned context that persists across turns..."}),s.jsxs(je,{size:"sm",onClick:$,className:"gap-1 text-xs font-mono bg-orange-500/20 hover:bg-orange-500/30 text-orange-300 border border-orange-500/30",children:[s.jsx(Is,{className:"h-3 w-3"}),"Save Pinned"]})]})}),s.jsx(Mo,{title:"TODO Log",icon:Cp,defaultOpen:!1,children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("textarea",{className:"w-full h-32 rounded bg-black/60 border border-orange-500/30 px-3 py-2 text-xs font-mono text-orange-200 resize-y focus:border-orange-500/50 focus:outline-none",value:U,onChange:Z=>G(Z.target.value),placeholder:"Session TODO list..."}),s.jsxs(je,{size:"sm",onClick:Q,className:"gap-1 text-xs font-mono bg-orange-500/20 hover:bg-orange-500/30 text-orange-300 border border-orange-500/30",children:[s.jsx(Is,{className:"h-3 w-3"}),"Save TODO"]})]})}),s.jsx(Mo,{title:"Event Log",icon:qo,count:q.length,defaultOpen:!1,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Limit:"}),s.jsx("input",{type:"number",min:10,max:500,className:"w-16 rounded bg-black/60 border border-orange-500/30 px-2 py-1 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:E,onChange:Z=>L(parseInt(Z.target.value||"120",10))}),s.jsxs(je,{size:"sm",variant:"ghost",onClick:ge,className:"text-xs font-mono text-orange-400 hover:bg-orange-500/10",children:[s.jsx(fa,{className:"h-3 w-3 mr-1"}),"Reload"]})]}),s.jsx("div",{className:"bg-black/60 border border-orange-500/20 rounded max-h-64 overflow-auto",children:q.length===0?s.jsx("div",{className:"px-3 py-4 text-xs font-mono text-orange-500/50 text-center",children:"No events recorded."}):s.jsx("div",{className:"divide-y divide-orange-500/10",children:q.map((Z,ve)=>s.jsx("div",{className:"px-3 py-2 hover:bg-orange-500/5",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-orange-400 shrink-0",children:Su(Z.ts)}),s.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-orange-500/20 text-orange-300 shrink-0",children:Z.kind}),s.jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-zinc-700/50 text-zinc-300 shrink-0",children:Z.role}),s.jsx("span",{className:"text-xs font-mono text-orange-200/70 break-words",children:Z.text.length>80?Z.text.slice(0,80)+"...":Z.text})]})},ve))})})]})}),s.jsxs("div",{className:"relative pt-6",children:[s.jsxs("div",{className:"absolute top-0 left-0 right-0 flex items-center",children:[s.jsx("div",{className:"flex-1 border-t border-dashed border-orange-500/30"}),s.jsxs("span",{className:"px-3 text-xs font-mono text-orange-500/60 uppercase tracking-widest flex items-center gap-2",children:[s.jsx(P0,{className:"h-3 w-3"}),"Maintenance"]}),s.jsx("div",{className:"flex-1 border-t border-dashed border-orange-500/30"})]}),s.jsxs("div",{className:"bg-black/40 border border-orange-500/20 rounded p-4 space-y-4",children:[s.jsx("div",{className:"flex items-center gap-4 pb-3 border-b border-orange-500/20",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Go,{id:"import-replace",checked:se,onCheckedChange:ie}),s.jsx(da,{htmlFor:"import-replace",className:"text-xs font-mono text-orange-300 cursor-pointer",children:"Replace on Import"})]})}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Max Sessions"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxSessions,onChange:Z=>ne({...O,maxSessions:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Max Age (days)"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxAgeDays,onChange:Z=>ne({...O,maxAgeDays:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Max Namespaces"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxNamespaces,onChange:Z=>ne({...O,maxNamespaces:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Bytes/Session"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxBytesPerSession,onChange:Z=>ne({...O,maxBytesPerSession:parseInt(Z.target.value||"0",10)})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(da,{className:"text-xs font-mono text-orange-500/60",children:"Bytes/Namespace"}),s.jsx("input",{type:"number",min:0,className:"w-full rounded bg-black/60 border border-orange-500/30 px-2 py-1.5 text-xs font-mono text-orange-200 focus:border-orange-500/50 focus:outline-none",value:O.maxBytesPerNamespace,onChange:Z=>ne({...O,maxBytesPerNamespace:parseInt(Z.target.value||"0",10)})})]})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[s.jsxs(je,{size:"sm",onClick:it,className:"gap-1.5 text-xs font-mono bg-amber-600/80 hover:bg-amber-600 text-black border border-amber-500",children:[s.jsx(zw,{className:"h-3 w-3"}),"PRUNE NOW"]}),s.jsxs(je,{size:"sm",variant:"ghost",onClick:xe,disabled:!v,className:"gap-1.5 text-xs font-mono bg-red-500/20 hover:bg-red-500/30 text-red-400 border border-red-500/30",children:[s.jsx(Wo,{className:"h-3 w-3"}),"Delete Session"]}),s.jsxs(je,{size:"sm",variant:"ghost",onClick:ke,className:"gap-1.5 text-xs font-mono bg-red-500/20 hover:bg-red-500/30 text-red-400 border border-red-500/30",children:[s.jsx(td,{className:"h-3 w-3"}),"Purge All Data"]})]})]})]})]})]})]})}const GN=ig("inline-flex items-center justify-center rounded-sm border px-1.5 py-0.5 w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden font-mono text-[0.65rem] uppercase tracking-wide",{variants:{variant:{default:"border-transparent bg-[hsl(var(--accent-primary))] text-[hsl(var(--bg-primary))] font-semibold [a&]:hover:bg-[hsl(var(--accent-primary))]/90",secondary:"border-[hsl(var(--border-primary))] bg-[hsl(var(--bg-secondary))] text-[hsl(var(--text-secondary))] [a&]:hover:bg-[hsl(var(--bg-tertiary))]",destructive:"border-transparent bg-[hsl(var(--status-offline))] text-white [a&]:hover:bg-[hsl(var(--status-offline))]/90 focus-visible:ring-[hsl(var(--status-offline))]/20",outline:"border-[hsl(var(--border-primary))] bg-transparent text-[hsl(var(--text-secondary))] [a&]:hover:bg-[hsl(var(--bg-tertiary))] [a&]:hover:text-[hsl(var(--text-primary))]",success:"border-transparent bg-[hsl(var(--status-online))] text-white font-semibold [a&]:hover:bg-[hsl(var(--status-online))]/90",warning:"border-transparent bg-[hsl(var(--status-warning))] text-[hsl(var(--bg-primary))] font-semibold [a&]:hover:bg-[hsl(var(--status-warning))]/90",processing:"border-transparent bg-[hsl(var(--status-processing))] text-white font-semibold [a&]:hover:bg-[hsl(var(--status-processing))]/90"}},defaultVariants:{variant:"default"}});function VN({className:l,variant:o,asChild:c=!1,...u}){const d=c?rg:"span";return s.jsx(d,{"data-slot":"badge",className:Ne(GN({variant:o}),l),...u})}function XN(){const{mgmtKey:l,mgmtFetch:o,showToast:c,status:u,isMgmtLoading:d}=Et(),[m,g]=w.useState(null),[v,x]=w.useState([]),[p,b]=w.useState(""),[h,N]=w.useState(50),[_,A]=w.useState(""),U=u?.running??!1,G=w.useCallback(async()=>{try{const q=await o("/v0/management/semantic/health");g(q)}catch(q){q instanceof ot||c(q instanceof Error?q.message:String(q),"error")}},[o,c]),k=w.useCallback(async()=>{try{const F=(await o("/v0/management/semantic/namespaces")).namespaces||[];x(F),!p&&F.length>0&&b(F[0].key)}catch(q){q instanceof ot||c(q instanceof Error?q.message:String(q),"error")}},[o,c,p]),K=w.useCallback(async()=>{if(!p){A("Select a namespace.");return}try{const F=(await o(`/v0/management/semantic/items?namespace=${encodeURIComponent(p)}&limit=${encodeURIComponent(h)}`)).items||[];if(!Array.isArray(F)||F.length===0){A("No items.");return}const ae=F.map(te=>{const E=te.ts||"",L=te.source||"",Y=te.role||"",z=(te.text||"").toString();return`[${E}][${L}][${Y}] ${z}`});A(ae.join(` -`))}catch(q){q instanceof ot||c(q instanceof Error?q.message:String(q),"error")}},[o,c,p,h]);return w.useEffect(()=>{l&&U?(G(),T()):U||(g(null),x([]),A(""))},[l,U,G,T]),l?s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsx(At,{className:"pb-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(da,{className:"text-lg",children:"Semantic Memory"}),s.jsx(rs,{children:"Ollama embeddings + per-repo namespaces"})]}),f&&s.jsx(Vt,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),s.jsxs(St,{className:"space-y-3",children:[!U&&s.jsx("div",{className:"py-4 text-center text-muted-foreground",children:s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"})}),U&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{size:"sm",variant:"outline",onClick:G,children:"Refresh"}),s.jsx(qN,{variant:m?.status==="ok"?"default":"secondary",children:m?.status||"unknown"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[m?.model," ",m?.version?`v${m.version}`:""]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:m?.model_present===!1?"model missing":""})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[m?.latency_ms?`latency ${m.latency_ms}ms`:"latency n/a",m?.queue?` · queue q${m.queue.queued} d${m.queue.dropped} p${m.queue.processed} f${m.queue.failed}`:""]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{className:"min-w-[200px] rounded-md border border-border bg-background/60 px-2 py-1 text-xs font-mono",value:p,onChange:q=>b(q.target.value),children:[v.length===0&&s.jsx("option",{value:"",children:"(no namespaces)"}),v.map(q=>s.jsx("option",{value:q.key,children:q.label||q.key},q.key))]}),s.jsx("input",{type:"number",min:10,max:200,className:"w-20 rounded-md border border-border bg-background/60 px-2 py-1 text-xs",value:h,onChange:q=>N(parseInt(q.target.value||"50",10))}),s.jsx(Ne,{size:"sm",variant:"outline",onClick:K,children:"Load"})]}),s.jsx("pre",{className:"max-h-56 overflow-auto rounded-md border border-border/50 bg-muted/30 p-2 text-xs",children:E||"No items loaded."})]})]})]}):null}function GN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Mt(),[f,m]=w.useState(""),[g,v]=w.useState(!1),x=c?.running??!1,p=async()=>{try{const h=await l("/v0/management/config.yaml");m(typeof h=="string"?h:JSON.stringify(h,null,2))}catch(h){h instanceof ot||o(h instanceof Error?h.message:String(h),"error")}},b=async()=>{v(!0);try{await l("/v0/management/config.yaml",{method:"PUT",headers:{"Content-Type":"application/yaml"},body:f}),o("Configuration saved successfully","success")}catch(h){o(h instanceof Error?h.message:String(h),"error")}finally{v(!1)}};return w.useEffect(()=>{x&&p()},[x]),s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl overflow-hidden",children:[s.jsx(At,{className:"pb-4 border-b border-border/50 bg-gradient-to-r from-purple-500/5 to-transparent",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-10 w-10 rounded-xl bg-purple-500/10 flex items-center justify-center",children:s.jsx(Z2,{className:"h-5 w-5 text-purple-500"})}),s.jsxs("div",{children:[s.jsx(da,{className:"text-lg",children:"Config Editor"}),s.jsx(rs,{children:"Edit config.yaml directly"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Ne,{size:"sm",variant:"outline",onClick:p,disabled:!x||u,className:"gap-1.5 text-xs",children:[s.jsx(Ew,{className:"h-3.5 w-3.5"}),"Reset"]}),s.jsxs(Ne,{size:"sm",onClick:b,disabled:!x||g||u,className:"gap-1.5 text-xs bg-purple-600 hover:bg-purple-700 text-white",children:[g?s.jsx(Vt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(Ps,{className:"h-3.5 w-3.5"}),"Save Changes"]})]})]})}),s.jsx(St,{className:"p-0",children:x?s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{value:f,onChange:h=>m(h.target.value),spellCheck:!1,className:"w-full h-[500px] p-6 bg-[var(--bg-void)] text-[var(--text-primary)] font-mono text-sm resize-none focus:outline-none selection:bg-purple-500/30",style:{fontFamily:'"JetBrains Mono", "Fira Code", monospace',lineHeight:"1.6"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{backgroundImage:"linear-gradient(var(--border-subtle) 1px, transparent 1px), linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px)",backgroundSize:"20px 20px"}})]}):s.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[s.jsx("p",{className:"text-sm uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-xs mt-1",children:"Start the proxy engine to edit configuration"})]})})]})}function VN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Mt(),[f,m]=w.useState([]),[g,v]=w.useState(null),[x,p]=w.useState(!1),[b,h]=w.useState("live"),[N,E]=w.useState(new Set),A=w.useRef(null),U=c?.running??!1,[G,T]=w.useState(!1),[K,q]=w.useState(""),[F,ae]=w.useState(""),[te,_]=w.useState("all"),[L,Y]=w.useState(""),[z,se]=w.useState(""),[ie,O]=w.useState(1),[ne]=w.useState(50),[oe,k]=w.useState(0),[V,B]=w.useState([]),[ce,ge]=w.useState([]),S=w.useCallback(async()=>{try{let P=[];window.pp_get_requests?P=await window.pp_get_requests():P=(await l("/v0/management/requests")).requests||[],m([...P].sort((ve,at)=>new Date(at.timestamp).getTime()-new Date(ve.timestamp).getTime()));const Ye=new Set,Z=new Set;P.forEach(ve=>{ve.model&&Ye.add(ve.model),ve.provider&&Z.add(ve.provider)}),B(Array.from(Ye).sort()),ge(Array.from(Z).sort())}catch(P){P instanceof ot||o(P instanceof Error?P.message:String(P),"error")}},[l,o]),Q=w.useCallback(async()=>{try{const P=new URLSearchParams;P.set("limit",String(ne)),P.set("offset",String((ie-1)*ne)),K&&P.set("model",K),F&&P.set("provider",F),L&&P.set("start_date",new Date(L).toISOString()),z&&P.set("end_date",new Date(z).toISOString()),te==="success"?(P.set("status_min","200"),P.set("status_max","299")):te==="error"&&P.set("errors_only","true");const Ye=await l(`/v0/management/request-history?${P.toString()}`);m(Ye.entries||[]),k(Ye.total||0);const Z=await l("/v0/management/request-history/stats");v(Z.stats||null),Z.stats?.by_model&&B(Object.keys(Z.stats.by_model).sort()),Z.stats?.by_provider&&ge(Object.keys(Z.stats.by_provider).sort())}catch(P){P instanceof ot||o(P instanceof Error?P.message:String(P),"error")}},[l,o,ie,ne,K,F,te,L,z]),$=()=>{x?(p(!1),A.current&&(clearInterval(A.current),A.current=null)):(p(!0),S(),A.current=setInterval(()=>{S()},2e3))},ee=P=>{const Ye=new Set(N);Ye.has(P)?Ye.delete(P):Ye.add(P),E(Ye)},re=async()=>{try{const P=await l("/v0/management/request-history/export"),Ye=new Blob([JSON.stringify(P,null,2)],{type:"application/json"}),Z=URL.createObjectURL(Ye),ve=document.createElement("a");ve.href=Z,ve.download=`proxypilot-request-history-${new Date().toISOString().split("T")[0]}.json`,ve.click(),URL.revokeObjectURL(Z),o("Request history exported","success")}catch(P){o(P instanceof Error?P.message:String(P),"error")}},xe=async()=>{if(confirm("Are you sure you want to clear all request history? This cannot be undone."))try{await l("/v0/management/request-history",{method:"DELETE"}),o("Request history cleared","success"),m([]),k(0),v(null)}catch(P){o(P instanceof Error?P.message:String(P),"error")}},ue=async()=>{try{await l("/v0/management/request-history/save",{method:"POST"}),o("Request history saved to disk","success")}catch(P){o(P instanceof Error?P.message:String(P),"error")}};w.useEffect(()=>(b==="live"?S():Q(),()=>{A.current&&clearInterval(A.current)}),[b,S,Q]),w.useEffect(()=>{O(1)},[K,F,te,L,z]);const we=P=>P>=200&&P<300?"text-[var(--status-online)]":P>=400&&P<500?"text-[var(--status-warning)]":P>=500?"text-[var(--status-offline)]":"text-[var(--text-muted)]",Te=P=>P>=200&&P<300?s.jsx(q0,{className:"h-3 w-3"}):P>=400&&P<500?s.jsx(Uo,{className:"h-3 w-3"}):P>=500?s.jsx(z2,{className:"h-3 w-3"}):s.jsx(Ho,{className:"h-3 w-3"}),We=P=>new Date(P).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),it=P=>new Date(P).toLocaleDateString([],{month:"short",day:"numeric"}),qe=Math.ceil(oe/ne);return s.jsxs(jt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl overflow-hidden",children:[s.jsxs(At,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:[s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ko,{className:`h-4 w-4 ${x&&U?"text-[var(--accent-glow)] animate-pulse":"text-[var(--text-muted)]"}`}),s.jsx("span",{className:"font-mono text-sm font-semibold tracking-wider text-[var(--text-primary)]",children:"REQUEST MONITOR"})]}),u&&s.jsx(ba,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsxs("div",{className:"flex items-center gap-1 bg-[var(--bg-elevated)] rounded p-0.5",children:[s.jsxs("button",{onClick:()=>{h("live"),p(!1)},className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono transition-all ${b==="live"?"bg-[var(--accent-primary)]/20 text-[var(--accent-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[s.jsx(Z0,{className:"h-3 w-3"}),"LIVE"]}),s.jsxs("button",{onClick:()=>{h("history"),p(!1),A.current&&(clearInterval(A.current),A.current=null)},className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono transition-all ${b==="history"?"bg-[var(--accent-primary)]/20 text-[var(--accent-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[s.jsx(nw,{className:"h-3 w-3"}),"HISTORY"]})]}),b==="live"&&s.jsxs("button",{onClick:$,disabled:!U,className:`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono transition-all ${x&&U?"bg-[var(--accent-glow)]/20 text-[var(--accent-glow)]":"bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-secondary)]"} ${U?"":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${x&&U?"bg-[var(--accent-glow)]":"bg-[var(--text-muted)]"}`}),"AUTO"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[b==="history"&&s.jsxs(s.Fragment,{children:[s.jsxs(Ne,{size:"sm",variant:"outline",onClick:()=>T(!G),className:`text-xs h-7 font-mono gap-1 ${G?"bg-[var(--accent-primary)]/10 border-[var(--accent-primary)]":""}`,children:[s.jsx(W2,{className:"h-3 w-3"}),"FILTER"]}),s.jsxs(Ne,{size:"sm",variant:"outline",onClick:ue,disabled:!U||u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(Ps,{className:"h-3 w-3"}),"SAVE"]}),s.jsxs(Ne,{size:"sm",variant:"outline",onClick:re,disabled:!U||u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(is,{className:"h-3 w-3"}),"EXPORT"]}),s.jsxs(Ne,{size:"sm",variant:"outline",onClick:xe,disabled:!U||u,className:"text-xs h-7 font-mono gap-1 text-[var(--status-offline)] hover:bg-[var(--status-offline)]/10",children:[s.jsx(Jo,{className:"h-3 w-3"}),"CLEAR"]})]}),s.jsxs(Ne,{size:"sm",variant:"outline",onClick:b==="live"?S:Q,disabled:!U||u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(ba,{className:"h-3 w-3"}),"REFRESH"]})]})]}),G&&b==="history"&&s.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)] grid grid-cols-2 md:grid-cols-5 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"Model"}),s.jsxs("select",{value:K,onChange:P=>q(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono",children:[s.jsx("option",{value:"",children:"All Models"}),V.map(P=>s.jsx("option",{value:P,children:P},P))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"Provider"}),s.jsxs("select",{value:F,onChange:P=>ae(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono",children:[s.jsx("option",{value:"",children:"All Providers"}),ce.map(P=>s.jsx("option",{value:P,children:P},P))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"Status"}),s.jsxs("select",{value:te,onChange:P=>_(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono",children:[s.jsx("option",{value:"all",children:"All"}),s.jsx("option",{value:"success",children:"Success (2xx)"}),s.jsx("option",{value:"error",children:"Errors"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"From"}),s.jsx("input",{type:"date",value:L,onChange:P=>Y(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"To"}),s.jsx("input",{type:"date",value:z,onChange:P=>se(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono"})]})]}),b==="history"&&g&&s.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)] grid grid-cols-3 md:grid-cols-6 gap-4 text-center",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--text-primary)]",children:g.total_requests}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Total"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--status-online)]",children:g.success_count}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Success"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--status-offline)]",children:g.failure_count}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Failed"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--text-primary)]",children:(g.total_tokens_in+g.total_tokens_out).toLocaleString()}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Tokens"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-lg font-bold text-emerald-400",children:["$",g.total_cost_usd.toFixed(2)]}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Cost"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-lg font-bold text-emerald-400",children:["$",g.savings.toFixed(2)]}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Saved"})]})]})]}),s.jsx(St,{className:"p-0",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left border-collapse font-mono text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[var(--bg-panel)]/50 text-[var(--text-muted)] border-b border-[var(--border-subtle)]",children:[s.jsx("th",{className:"px-4 py-2 font-medium",children:b==="history"?"DATE":"TIME"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"MODEL"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"PROVIDER"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"STATUS"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"LATENCY"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"TOKENS"}),s.jsx("th",{className:"px-4 py-2 font-medium w-10"})]})}),s.jsx("tbody",{className:"divide-y divide-[var(--border-subtle)]/30",children:U?f.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-8 text-center text-[var(--text-muted)]",children:b==="history"?"No request history found.":"No requests recorded yet."})}):f.map(P=>s.jsxs(le.Fragment,{children:[s.jsxs("tr",{className:"hover:bg-[var(--bg-panel)]/50 transition-colors cursor-pointer group",onClick:()=>ee(P.id),children:[s.jsx("td",{className:"px-4 py-2.5 text-[var(--text-muted)] tabular-nums",children:b==="history"?s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:it(P.timestamp)}),s.jsx("span",{className:"text-[10px]",children:We(P.timestamp)})]}):We(P.timestamp)}),s.jsx("td",{className:"px-4 py-2.5 text-[var(--text-primary)] font-medium",children:P.model||"-"}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-[var(--bg-elevated)] text-[var(--text-secondary)] text-[10px]",children:P.provider?.toUpperCase()||"UNKNOWN"})}),s.jsx("td",{className:`px-4 py-2.5 font-bold ${we(P.status)}`,children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[Te(P.status),P.status]})}),s.jsxs("td",{className:"px-4 py-2.5 text-[var(--text-secondary)] tabular-nums",children:[P.latencyMs,"ms"]}),s.jsx("td",{className:"px-4 py-2.5 text-[var(--text-muted)] tabular-nums",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("span",{children:["In: ",P.inputTokens]}),s.jsxs("span",{children:["Out: ",P.outputTokens]})]})}),s.jsx("td",{className:"px-4 py-2.5 text-right",children:N.has(P.id)?s.jsx(al,{className:"h-4 w-4 text-[var(--text-muted)]"}):s.jsx(Ou,{className:"h-4 w-4 text-[var(--text-muted)] group-hover:text-[var(--text-primary)]"})})]}),N.has(P.id)&&s.jsx("tr",{className:"bg-[var(--bg-panel)]/30",children:s.jsx("td",{colSpan:7,className:"px-4 py-4 border-l-2 border-l-[var(--accent-glow)]",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-muted)] text-[10px] uppercase tracking-wider",children:[s.jsx(H2,{className:"h-3 w-3"}),"Request Details"]}),s.jsxs("div",{className:"space-y-1 text-[var(--text-secondary)]",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Method:"}),s.jsx("span",{className:"text-[var(--text-primary)]",children:P.method})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Path:"}),s.jsx("span",{className:"text-[var(--text-primary)] break-all ml-4",children:P.path})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"ID:"}),s.jsx("span",{className:"text-[var(--text-primary)] text-[10px]",children:P.id})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-muted)] text-[10px] uppercase tracking-wider",children:[s.jsx(Y0,{className:"h-3 w-3"}),"Performance & Usage"]}),s.jsxs("div",{className:"space-y-1 text-[var(--text-secondary)]",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Latency:"}),s.jsxs("span",{className:"text-[var(--text-primary)]",children:[P.latencyMs,"ms"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Total Tokens:"}),s.jsx("span",{className:"text-[var(--text-primary)]",children:P.inputTokens+P.outputTokens})]}),P.error&&s.jsxs("div",{className:"mt-2 p-2 rounded bg-[var(--status-offline)]/10 border border-[var(--status-offline)]/20 text-[var(--status-offline)]",children:[s.jsxs("div",{className:"flex items-center gap-1 mb-1 font-bold",children:[s.jsx(Uo,{className:"h-3 w-3"}),"ERROR"]}),s.jsx("div",{className:"text-[10px] break-all",children:P.error})]})]})]})]})})})]},P.id)):s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-8 text-center text-[var(--text-muted)]",children:s.jsx("p",{className:"text-xs uppercase tracking-widest",children:"Engine Offline"})})})})]})})}),s.jsx("div",{className:"px-3 py-1.5 bg-[var(--bg-panel)] border-t border-[var(--border-subtle)] flex items-center justify-between text-[10px] font-mono text-[var(--text-muted)]",children:b==="live"?s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:[f.length," requests tracked"]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:x?"text-[var(--accent-glow)]":"",children:x?"AUTO REFRESH ON":"AUTO REFRESH OFF"}),s.jsx("span",{children:"|"}),s.jsx("span",{children:"2s INTERVAL"})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:["Showing ",f.length," of ",oe," entries"]}),qe>1&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>O(1),disabled:ie===1,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(C2,{className:"h-3 w-3"})}),s.jsx("button",{onClick:()=>O(P=>Math.max(1,P-1)),disabled:ie===1,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(S2,{className:"h-3 w-3"})}),s.jsxs("span",{className:"px-2",children:["Page ",ie," of ",qe]}),s.jsx("button",{onClick:()=>O(P=>Math.min(qe,P+1)),disabled:ie===qe,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(Ou,{className:"h-3 w-3"})}),s.jsx("button",{onClick:()=>O(qe),disabled:ie===qe,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(k2,{className:"h-3 w-3"})})]})]})})]})}function XN(){const{mgmtFetch:l}=Mt(),[o,c]=w.useState(null),[u,f]=w.useState(null),[m,g]=w.useState(!0),v=async()=>{try{let h;if(window.pp_get_usage)h=await window.pp_get_usage();else if(l)h=await l("/v0/management/usage");else throw new Error("No method available to fetch usage data");const N=h?.usage||h;N&&typeof N=="object"&&(c({total_requests:N.total_requests??N.totalRequests??0,success_count:N.success_count??N.successCount??0,failure_count:N.failure_count??N.failureCount??0,total_input_tokens:N.total_input_tokens??N.totalInputTokens??0,total_output_tokens:N.total_output_tokens??N.totalOutputTokens??0,estimated_cost_saved:N.estimated_cost_saved??N.estimatedCostSaved??0,actual_cost:N.actual_cost??N.actualCost??0,direct_api_cost:N.direct_api_cost??N.directApiCost??0,savings:N.savings??0,savings_percent:N.savings_percent??N.savingsPercent??0,by_model:N.by_model??N.byModel??{},by_provider:N.by_provider??N.byProvider??{},cost_by_model:N.cost_by_model??N.costByModel??{},cost_by_provider:N.cost_by_provider??N.costByProvider??{},daily:N.daily??[]}),f(null))}catch(h){console.error("Failed to fetch usage stats:",h),f(h instanceof Error?h.message:String(h))}finally{g(!1)}};if(w.useEffect(()=>{v();const h=setInterval(v,3e4);return()=>clearInterval(h)},[]),m&&!o)return s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(Vt,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(u&&!o)return s.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-6 text-center",children:[s.jsx("p",{className:"text-red-300",children:"Failed to load usage statistics"}),s.jsx("p",{className:"mt-2 text-xs text-red-400/70",children:u})]});if(!o)return s.jsxs("div",{className:"rounded-xl border border-[var(--border-subtle)] bg-[var(--bg-panel)] p-8 text-center",children:[s.jsx(Mu,{className:"mx-auto h-12 w-12 text-[var(--text-muted)] opacity-50"}),s.jsx("p",{className:"mt-4 text-[var(--text-primary)]",children:"No usage data available yet"}),s.jsx("p",{className:"mt-2 text-xs text-[var(--text-muted)]",children:"Start making requests through the proxy to see statistics here."})]});const x=Math.max(...o.daily.map(h=>h.requests),1),p=Object.entries(o.by_provider).sort((h,N)=>N[1]-h[1]),b=p.reduce((h,[N,E])=>h+E,0);return s.jsxs("div",{className:"space-y-6",children:[(o.direct_api_cost>0||o.actual_cost>0)&&s.jsxs(jt,{className:je("relative overflow-hidden","bg-gradient-to-br from-emerald-500/10 via-teal-500/5 to-cyan-500/10","border-emerald-500/30 shadow-xl shadow-emerald-500/5"),children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-emerald-400/10 via-transparent to-transparent"}),s.jsx(At,{className:"relative pb-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-emerald-500/20 ring-1 ring-emerald-500/30",children:s.jsx(Jw,{className:"h-5 w-5 text-emerald-400"})}),s.jsxs("div",{children:[s.jsx(da,{className:"text-lg text-emerald-100",children:"Cost Savings"}),s.jsx(rs,{className:"text-emerald-300/70",children:"ProxyPilot vs Direct API"})]})]})}),s.jsx(St,{className:"relative",children:s.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-emerald-300/60",children:"You Saved"}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-3xl font-bold text-emerald-400",children:["$",o.savings.toFixed(2)]}),o.savings_percent>0&&s.jsxs("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 text-xs font-medium text-emerald-300",children:[o.savings_percent.toFixed(0),"% off"]})]})]}),s.jsxs("div",{className:"md:col-span-2 space-y-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:"Direct API Cost"}),s.jsxs("span",{className:"font-medium text-red-400",children:["$",o.direct_api_cost.toFixed(2)]})]}),s.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-red-500/20",children:s.jsx("div",{className:"h-full bg-red-500/60",style:{width:"100%"}})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[s.jsx(K0,{className:"h-3 w-3 text-emerald-400"}),"ProxyPilot Cost"]}),s.jsxs("span",{className:"font-medium text-emerald-400",children:["$",o.actual_cost.toFixed(2)]})]}),s.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-emerald-500/20",children:s.jsx("div",{className:"h-full bg-emerald-500/60 transition-all",style:{width:o.direct_api_cost>0?`${o.actual_cost/o.direct_api_cost*100}%`:"0%"}})})]})]})]})})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(da,{className:"text-sm font-medium",children:"Total Requests"}),s.jsx(Ko,{className:"h-4 w-4 text-blue-400"})]}),s.jsxs(St,{children:[s.jsx("div",{className:"text-2xl font-bold",children:o.total_requests.toLocaleString()}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[o.success_count.toLocaleString()," successful"]})]})]}),s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(da,{className:"text-sm font-medium",children:"Input Tokens"}),s.jsx(Du,{className:"h-4 w-4 text-amber-400"})]}),s.jsxs(St,{children:[s.jsx("div",{className:"text-2xl font-bold",children:o.total_input_tokens.toLocaleString()}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Prompt tokens"})]})]}),s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(da,{className:"text-sm font-medium",children:"Output Tokens"}),s.jsx(Du,{className:"h-4 w-4 text-emerald-400"})]}),s.jsxs(St,{children:[s.jsx("div",{className:"text-2xl font-bold",children:o.total_output_tokens.toLocaleString()}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Completion tokens"})]})]}),s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(da,{className:"text-sm font-medium",children:"Total Cost"}),s.jsx(V2,{className:"h-4 w-4 text-purple-400"})]}),s.jsxs(St,{children:[s.jsxs("div",{className:"text-2xl font-bold",children:["$",o.actual_cost.toFixed(2)]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Based on model pricing"})]})]})]}),s.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Mu,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(da,{className:"text-lg",children:"Daily Activity"})]}),s.jsx(rs,{children:"Requests over the last 7 days"})]}),s.jsx(St,{children:s.jsx("div",{className:"flex h-48 items-end gap-2 pt-4",children:o.daily.map(h=>{const N=h.requests/x*100,E=new Date(h.date).toLocaleDateString(void 0,{weekday:"short"});return s.jsxs("div",{className:"group relative flex flex-1 flex-col items-center gap-2",children:[s.jsx("div",{className:"w-full rounded-t-sm bg-blue-500/40 transition-all hover:bg-blue-500/60",style:{height:`${Math.max(N,4)}%`},children:s.jsxs("div",{className:"absolute -top-8 left-1/2 -translate-x-1/2 rounded bg-popover px-2 py-1 text-[10px] opacity-0 transition-opacity group-hover:opacity-100",children:[h.requests," reqs"]})}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:E})]},h.date)})})})]}),s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(b2,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(da,{className:"text-lg",children:"Providers"})]}),s.jsx(rs,{children:"Requests by backend provider"})]}),s.jsx(St,{children:s.jsxs("div",{className:"space-y-4 pt-2",children:[p.length===0&&s.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No provider data available"}),p.map(([h,N])=>{const E=N/b*100;return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"font-medium capitalize",children:h}),s.jsxs("span",{className:"text-muted-foreground",children:[N," (",E.toFixed(1),"%)"]})]}),s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted/30",children:s.jsx("div",{className:"h-full bg-blue-500/50",style:{width:`${E}%`}})})]},h)})]})})]})]}),s.jsxs(jt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(At,{children:[s.jsx(da,{className:"text-lg",children:"Model Breakdown"}),s.jsx(rs,{children:"Usage and cost statistics per model"})]}),s.jsx(St,{children:s.jsx("div",{className:"overflow-hidden rounded-md border border-border/50",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-muted/40",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Model"}),s.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Requests"}),s.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Share"}),s.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Cost"})]})}),s.jsxs("tbody",{className:"divide-y divide-border/40",children:[Object.entries(o.by_model).sort((h,N)=>N[1]-h[1]).map(([h,N])=>{const E=o.cost_by_model?.[h]??0;return s.jsxs("tr",{className:"hover:bg-muted/20 transition-colors",children:[s.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:h}),s.jsx("td",{className:"px-4 py-3 text-right",children:N.toLocaleString()}),s.jsxs("td",{className:"px-4 py-3 text-right text-muted-foreground",children:[(N/o.total_requests*100).toFixed(1),"%"]}),s.jsxs("td",{className:"px-4 py-3 text-right font-medium text-emerald-400",children:["$",E.toFixed(4)]})]},h)}),Object.keys(o.by_model).length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No model usage recorded yet."})})]})]})})})]})]})}const $N={low:{icon:s.jsx(Du,{className:"h-4 w-4"}),label:"Low",description:"2,048 tokens - Fast, minimal reasoning",color:"text-amber-400"},medium:{icon:s.jsx(I2,{className:"h-4 w-4"}),label:"Medium",description:"8,192 tokens - Balanced reasoning",color:"text-blue-400"},high:{icon:s.jsx(K0,{className:"h-4 w-4"}),label:"High",description:"32,768 tokens - Deep reasoning",color:"text-purple-400"},custom:{icon:s.jsx(Hw,{className:"h-4 w-4"}),label:"Custom",description:"Set your own token budget",color:"text-emerald-400"}};function QN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Mt(),[f,m]=w.useState(null),[g,v]=w.useState("medium"),[x,p]=w.useState(16e3),[b,h]=w.useState(!0),[N,E]=w.useState(!1),[A,U]=w.useState(!1),G=c?.running??!1,T=w.useCallback(async()=>{try{const _=await l("/v0/management/thinking-budget");m(_),v(_.mode||"medium"),p(_.custom_tokens||16e3),h(_.enabled!==!1),E(!1)}catch(_){_ instanceof ot||console.error("Failed to fetch thinking budget:",_)}},[l]);w.useEffect(()=>{G&&T()},[G,T]);const K=_=>{v(_),E(!0)},q=_=>{const L=parseInt(_,10);!isNaN(L)&&L>0&&(p(L),E(!0))},F=()=>{h(!b),E(!0)},ae=async()=>{U(!0);try{await l("/v0/management/thinking-budget",{method:"PUT",body:JSON.stringify({mode:g,custom_tokens:x,enabled:b})}),o("Thinking budget settings saved","success"),E(!1),await T()}catch(_){o(_ instanceof Error?_.message:String(_),"error")}U(!1)},te=()=>g==="custom"?x:f?.presets?.[g]||8192;return G?s.jsxs(jt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl",children:[s.jsxs(At,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Au,{className:`h-4 w-4 ${b?"text-[var(--accent-primary)]":"text-[var(--text-muted)]"}`}),s.jsx(da,{className:"text-sm font-mono uppercase tracking-wider",children:"Thinking Budget"}),u&&s.jsx(ba,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Ne,{size:"sm",variant:"outline",onClick:T,disabled:u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(ba,{className:"h-3 w-3"}),"REFRESH"]}),s.jsxs(Ne,{size:"sm",onClick:ae,disabled:!N||A,className:`text-xs h-7 font-mono gap-1 ${N?"bg-[var(--accent-primary)] text-white":""}`,children:[A?s.jsx(ba,{className:"h-3 w-3 animate-spin"}):s.jsx(Ps,{className:"h-3 w-3"}),"SAVE"]})]})]}),s.jsx(rs,{className:"text-xs text-[var(--text-muted)]",children:"Configure default thinking budget for reasoning models (Claude, Gemini with thinking)"})]}),s.jsxs(St,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--bg-panel)] border border-[var(--border-subtle)]",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-sm text-[var(--text-primary)]",children:"Enable Thinking"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Allow models to use extended reasoning"})]}),s.jsx("button",{onClick:F,className:`relative w-12 h-6 rounded-full transition-colors ${b?"bg-[var(--accent-primary)]":"bg-[var(--bg-elevated)]"}`,children:s.jsx("span",{className:`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform ${b?"left-7":"left-1"}`})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase tracking-wider",children:"Budget Preset"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:Object.entries($N).map(([_,L])=>s.jsxs("button",{onClick:()=>K(_),disabled:!b,className:`relative p-3 rounded-lg border transition-all text-left ${g===_?"border-[var(--accent-primary)] bg-[var(--accent-primary)]/10":"border-[var(--border-subtle)] bg-[var(--bg-panel)] hover:border-[var(--border-default)]"} ${b?"":"opacity-50 cursor-not-allowed"}`,children:[g===_&&s.jsx("div",{className:"absolute top-2 right-2",children:s.jsx(tl,{className:"h-3 w-3 text-[var(--accent-primary)]"})}),s.jsxs("div",{className:`flex items-center gap-2 ${L.color}`,children:[L.icon,s.jsx("span",{className:"font-mono text-sm font-bold",children:L.label})]}),s.jsx("div",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:L.description})]},_))})]}),g==="custom"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase tracking-wider",children:"Custom Token Budget"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"number",value:x,onChange:_=>q(_.target.value),disabled:!b,min:1024,max:128e3,step:1024,className:"flex-1 px-3 py-2 rounded-lg border border-[var(--border-default)] bg-[var(--bg-elevated)] font-mono text-sm disabled:opacity-50"}),s.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"tokens"})]}),s.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:"Recommended range: 1,024 - 128,000 tokens"})]}),s.jsx("div",{className:"p-3 rounded-lg bg-[var(--bg-elevated)] border border-[var(--border-subtle)]",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Effective Thinking Budget"}),s.jsxs("div",{className:`font-mono text-lg font-bold ${b?"text-[var(--accent-primary)]":"text-[var(--text-muted)]"}`,children:[b?te().toLocaleString():"0"," ",s.jsx("span",{className:"text-xs font-normal",children:"tokens"})]})]})}),s.jsxs("div",{className:"text-xs text-[var(--text-muted)] p-3 rounded-lg bg-[var(--bg-panel)] border border-[var(--border-subtle)]",children:[s.jsx("strong",{children:"Note:"})," Thinking budget applies to models that support extended reasoning, including Claude with thinking mode and Gemini Pro/Flash with thinking enabled. Higher budgets allow for more thorough reasoning but consume more tokens."]})]})]}):s.jsxs(jt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl",children:[s.jsx(At,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Au,{className:"h-4 w-4 text-[var(--text-muted)]"}),s.jsx(da,{className:"text-sm font-mono uppercase tracking-wider",children:"Thinking Budget"})]})}),s.jsx(St,{className:"p-8 text-center text-[var(--text-muted)]",children:s.jsx("p",{className:"text-xs uppercase tracking-widest",children:"Engine Offline"})})]})}function ZN(){const[l,o]=w.useState(()=>typeof window>"u"?"dark":localStorage.getItem("pp-theme")||"dark");return w.useEffect(()=>{const u=document.documentElement,f=window.matchMedia("(prefers-color-scheme: dark)").matches,m=l==="system"?f?"dark":"light":l;u.classList.remove("light","dark"),u.classList.add(m),localStorage.setItem("pp-theme",l)},[l]),w.useEffect(()=>{if(l!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),f=m=>{const g=document.documentElement;g.classList.remove("light","dark"),g.classList.add(m.matches?"dark":"light")};return u.addEventListener("change",f),()=>u.removeEventListener("change",f)},[l]),{theme:l,setTheme:u=>{o(u)}}}function KN(){const{theme:l,setTheme:o}=ZN(),c=()=>{o(l==="dark"?"light":l==="light"?"system":"dark")};return s.jsxs(Ne,{variant:"ghost",size:"icon-sm",onClick:c,className:"text-muted-foreground hover:text-foreground",title:`Theme: ${l}`,children:[l==="dark"&&s.jsx(hw,{className:"h-4 w-4"}),l==="light"&&s.jsx($w,{className:"h-4 w-4"}),l==="system"&&s.jsx(fw,{className:"h-4 w-4"})]})}function JN({isOpen:l,onClose:o}){const{mgmtFetch:c}=Mt(),[u,f]=w.useState(!1),[m,g]=w.useState(!1),[v,x]=w.useState(null),[p,b]=w.useState("idle"),[h,N]=w.useState(0),[E,A]=w.useState(null);w.useEffect(()=>{(async()=>{try{if(window.pp_get_oauth_private){const _=await window.pp_get_oauth_private();f(_)}}catch(_){console.error("Failed to load OAuth private setting:",_)}})()},[]),w.useEffect(()=>{if(p!=="downloading")return;const L=setInterval(async()=>{try{let Y;if(c)Y=await c("/v0/management/updates/status");else return;if(Y.error){A(Y.error),b("available");return}Y.downloading?N(Y.progress?.percent||0):Y.ready&&(b("ready"),N(100))}catch(Y){console.error("Failed to poll update status:",Y)}},500);return()=>clearInterval(L)},[p,c]);const U=async _=>{try{window.pp_set_oauth_private&&(await window.pp_set_oauth_private(_),f(_),yt.success(_?"Private browsing enabled":"Private browsing disabled"))}catch(L){yt.error(L instanceof Error?L.message:String(L))}},G=async()=>{try{window.pp_open_logs&&(await window.pp_open_logs(),yt.success("Opened logs folder"))}catch(_){yt.error(_ instanceof Error?_.message:String(_))}},T=async()=>{try{window.pp_open_auth_folder&&(await window.pp_open_auth_folder(),yt.success("Opened auth folder"))}catch(_){yt.error(_ instanceof Error?_.message:String(_))}},K=async()=>{try{window.pp_copy_diagnostics&&(await window.pp_copy_diagnostics(),yt.success("Diagnostics copied to clipboard"))}catch(_){yt.error(_ instanceof Error?_.message:String(_))}},q=async()=>{g(!0),b("checking"),A(null);try{let _=null;window.pp_check_updates?_=await window.pp_check_updates():c&&(_=await c("/v0/management/updates/check")),x(_),_?.available?(b("available"),yt.success(`Update available: v${_.version}`)):(b("idle"),yt.success("You are on the latest version"))}catch(_){b("idle"),yt.error(_ instanceof Error?_.message:String(_))}finally{g(!1)}},F=async()=>{if(v?.version){b("downloading"),N(0),A(null);try{c?await c("/v0/management/updates/download",{method:"POST",body:JSON.stringify({version:v.version})}):window.pp_download_update&&(await window.pp_download_update(v.download_url),b("available"),yt.success("Opening download page..."))}catch(_){b("available"),A(_ instanceof Error?_.message:String(_)),yt.error(_ instanceof Error?_.message:String(_))}}},ae=async()=>{b("installing");try{if(c){const _=await c("/v0/management/updates/install",{method:"POST"});if(_?.success)yt.success(_.message||"Update installed! Restarting...");else throw new Error(_?.message||"Installation failed")}}catch(_){b("ready"),A(_ instanceof Error?_.message:String(_)),yt.error(_ instanceof Error?_.message:String(_))}},te=()=>{v?.download_url&&window.open(v.download_url,"_blank")};return l?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40 animate-in fade-in duration-200",onClick:o}),s.jsxs("div",{className:je("fixed right-0 top-0 bottom-0 w-80 z-50","bg-[var(--bg-panel)] border-l border-[var(--border-subtle)]","shadow-2xl","animate-in slide-in-from-right duration-300"),children:[s.jsxs("div",{className:je("flex items-center justify-between px-5 py-4","border-b border-[var(--border-subtle)]"),children:[s.jsx("h2",{className:"text-sm font-bold uppercase tracking-[0.15em] text-[var(--text-primary)]",style:{fontFamily:"var(--font-display)"},children:"Settings"}),s.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:o,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(ed,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"p-5 space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Authentication"}),s.jsxs("div",{className:je("flex items-center justify-between p-3 rounded-lg","bg-[var(--bg-elevated)] border border-[var(--border-subtle)]"),children:[s.jsxs("div",{className:"flex items-center gap-3",children:[u?s.jsx($0,{className:"h-4 w-4 text-[var(--accent-glow)]"}):s.jsx(X0,{className:"h-4 w-4 text-[var(--text-muted)]"}),s.jsxs("div",{children:[s.jsx(ua,{htmlFor:"private-oauth",className:"text-sm text-[var(--text-primary)] cursor-pointer",children:"Private Browsing"}),s.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Use InPrivate mode for OAuth"})]})]}),s.jsx(Bo,{id:"private-oauth",checked:u,onCheckedChange:U})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Folders"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Ne,{variant:"outline",className:"w-full justify-start gap-3",onClick:G,children:[s.jsx(zu,{className:"h-4 w-4"}),"Open Logs Folder"]}),s.jsxs(Ne,{variant:"outline",className:"w-full justify-start gap-3",onClick:T,children:[s.jsx(zu,{className:"h-4 w-4"}),"Open Auth Folder"]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Diagnostics"}),s.jsxs(Ne,{variant:"outline",className:"w-full justify-start gap-3",onClick:K,children:[s.jsx(L2,{className:"h-4 w-4"}),"Copy Diagnostics"]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Updates"}),s.jsxs(Ne,{variant:"outline",className:"w-full justify-start gap-3",onClick:q,disabled:m||p==="downloading"||p==="installing",children:[m?s.jsx(Vt,{className:"h-4 w-4 animate-spin"}):s.jsx(ba,{className:"h-4 w-4"}),"Check for Updates"]}),(v||p!=="idle")&&s.jsxs("div",{className:je("p-4 rounded-lg border text-sm space-y-3",p==="ready"||p==="installing"?"bg-emerald-500/10 border-emerald-500/30":v?.available?"bg-[var(--accent-primary)]/10 border-[var(--accent-primary)]/30":"bg-green-500/10 border-green-500/30"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[p==="ready"?s.jsx(qw,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0"}):p==="installing"?s.jsx(Vt,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0 animate-spin"}):v?.available?s.jsx(Uo,{className:"h-4 w-4 text-[var(--accent-primary)] mt-0.5 shrink-0"}):s.jsx(q0,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("p",{className:"font-medium text-[var(--text-primary)]",children:[p==="downloading"&&"Downloading...",p==="ready"&&`v${v?.version} ready to install`,p==="installing"&&"Installing update...",p==="available"&&`v${v?.version} available`,p==="idle"&&!v?.available&&"Up to date"]}),v?.release_notes&&!v?.available&&s.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1",children:v.release_notes})]})]}),p==="downloading"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-[var(--bg-void)]",children:s.jsx("div",{className:"h-full bg-[var(--accent-primary)] transition-all duration-300",style:{width:`${h}%`}})}),s.jsxs("p",{className:"text-xs text-[var(--text-muted)] text-center",children:[h.toFixed(0),"% complete"]})]}),E&&s.jsx("div",{className:"p-2 rounded bg-red-500/10 border border-red-500/30 text-red-400 text-xs",children:E}),s.jsxs("div",{className:"flex gap-2",children:[p==="available"&&s.jsxs(s.Fragment,{children:[s.jsxs(Ne,{size:"sm",onClick:F,className:"flex-1 gap-2",children:[s.jsx(is,{className:"h-3 w-3"}),"Download & Install"]}),s.jsx(Ne,{size:"sm",variant:"outline",onClick:te,className:"gap-2",children:s.jsx(G0,{className:"h-3 w-3"})})]}),p==="ready"&&s.jsxs(Ne,{size:"sm",onClick:ae,className:"flex-1 gap-2 bg-emerald-600 hover:bg-emerald-500",children:[s.jsx(Q0,{className:"h-3 w-3"}),"Install & Restart"]}),p==="installing"&&s.jsx("div",{className:"flex-1 text-center text-xs text-emerald-400",children:"Please wait, do not close the application..."})]})]})]}),s.jsx("div",{className:"pt-4 border-t border-[var(--border-subtle)]",children:s.jsx("p",{className:"text-xs text-center text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"ProxyPilot v0.1.0"})})]})]})]}):null}function FN({isVisible:l}){return s.jsxs("svg",{viewBox:"0 0 200 12",className:je("absolute left-0 bottom-0 w-full h-3 pointer-events-none","transition-opacity duration-300",l?"opacity-100":"opacity-0"),preserveAspectRatio:"none",children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"flightPathGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[s.jsx("stop",{offset:"0%",stopColor:"var(--accent-primary)",stopOpacity:"0"}),s.jsx("stop",{offset:"20%",stopColor:"var(--accent-primary)",stopOpacity:"0.6"}),s.jsx("stop",{offset:"80%",stopColor:"var(--accent-glow)",stopOpacity:"0.8"}),s.jsx("stop",{offset:"100%",stopColor:"var(--accent-glow)",stopOpacity:"0"})]})}),s.jsx("path",{d:"M0 6 Q25 2, 50 6 T100 6 T150 6 T200 6",fill:"none",stroke:"url(#flightPathGradient)",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"200",strokeDashoffset:l?"0":"200",className:"transition-all duration-1000 ease-out"}),[40,80,120,160].map(o=>s.jsx("circle",{cx:o,cy:"6",r:"1.5",fill:"var(--accent-glow)",className:je("transition-all duration-500",l?"opacity-60":"opacity-0"),style:{transitionDelay:`${o*3}ms`}},o))]})}function WN({isRunning:l,port:o=8318,version:c="v0.1.0"}){const[u,f]=w.useState(!1),[m,g]=w.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(JN,{isOpen:m,onClose:()=>g(!1)}),s.jsxs("header",{className:je("relative h-16 flex items-center justify-between px-6","bg-[var(--bg-panel)] border-b border-[var(--border-subtle)]","before:absolute before:inset-0 before:pointer-events-none","before:bg-gradient-to-b before:from-white/[0.02] before:to-transparent"),children:[s.jsxs("div",{className:"relative flex items-center gap-4",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[s.jsx("div",{className:je("relative w-11 h-11 flex items-center justify-center","rounded-lg overflow-hidden","shadow-[0_2px_0_0_oklch(0_0_0/0.2)]","transition-all duration-300",u&&"shadow-[0_0_20px_0_var(--accent-glow)]",l&&"animate-glow-pulse"),children:s.jsx("img",{src:"/logo.png",alt:"ProxyPilot",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"relative flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:je("text-xl font-bold uppercase tracking-[0.2em]","text-[var(--text-primary)]","transition-colors duration-300"),style:{fontFamily:"var(--font-display)"},children:"PROXYPILOT"}),s.jsx("span",{className:je("px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wider","bg-[var(--bg-elevated)] border border-[var(--border-subtle)]","text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:c})]}),s.jsx(FN,{isVisible:u})]})]}),s.jsx("div",{className:je("hidden md:block h-8 w-px mx-4","bg-gradient-to-b from-transparent via-[var(--border-default)] to-transparent")}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:je("flex items-center gap-2.5 px-4 py-2 rounded-lg","font-medium text-sm tracking-wide","border transition-all duration-300",l?["bg-[oklch(0.72_0.19_145/0.08)]","border-[oklch(0.72_0.19_145/0.4)]","text-[oklch(0.72_0.19_145)]","shadow-[0_0_16px_0_oklch(0.72_0.19_145/0.25),inset_0_1px_0_0_oklch(0.72_0.19_145/0.1)]"].join(" "):["bg-[var(--bg-elevated)]","border-[var(--border-subtle)]","text-[var(--text-muted)]"].join(" ")),children:[s.jsxs("span",{className:"relative flex items-center justify-center",children:[l&&s.jsx("span",{className:je("absolute w-4 h-4 rounded-full","bg-[oklch(0.72_0.19_145/0.3)]","animate-radar-pulse")}),s.jsx("span",{className:je("relative w-2.5 h-2.5 rounded-full",l?"bg-[oklch(0.72_0.19_145)] shadow-[0_0_8px_0_oklch(0.72_0.19_145)]":"bg-[var(--text-muted)]")})]}),s.jsx("span",{className:"uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:l?"ONLINE":"OFFLINE"}),l&&s.jsxs("span",{className:je("ml-1 px-1.5 py-0.5 rounded text-[10px]","bg-[oklch(0.72_0.19_145/0.15)]","text-[oklch(0.72_0.19_145/0.8)]"),style:{fontFamily:"var(--font-mono)"},children:[":",o]})]}),s.jsx("div",{className:je("h-6 w-px","bg-[var(--border-subtle)]")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(KN,{}),s.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:()=>g(!0),className:je("text-[var(--text-muted)]","hover:text-[var(--text-primary)]","hover:bg-[var(--bg-active)]"),title:"Settings",children:s.jsx(Mo,{className:"h-4 w-4"})})]})]}),s.jsx("div",{className:je("absolute bottom-0 left-0 right-0 h-px","bg-gradient-to-r from-transparent via-[var(--accent-primary)] to-transparent","opacity-20")})]})]})}const PN=[{id:"claude",name:"Claude"},{id:"gemini",name:"Gemini"},{id:"codex",name:"Codex"},{id:"qwen",name:"Qwen"},{id:"anthropic",name:"Anthropic"}];function IN(l){const o=Math.floor(l/3600),c=Math.floor(l%3600/60),u=l%60;return`${o.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}`}function ej(l){return l.toLocaleString()}const tj=({version:l="v0.1.0",requestCount:o=0,providerStatus:c})=>{const{status:u,authFiles:f}=Mt(),[m,g]=w.useState(0),[v]=w.useState(()=>Date.now()),x=w.useMemo(()=>c||{claude:f.some(h=>h.toLowerCase().includes("claude")),gemini:f.some(h=>h.toLowerCase().includes("gemini")),codex:f.some(h=>h.toLowerCase().includes("codex")),qwen:f.some(h=>h.toLowerCase().includes("qwen")),anthropic:f.some(h=>h.toLowerCase().includes("anthropic"))},[c,f]);w.useEffect(()=>{const h=setInterval(()=>{g(Math.floor((Date.now()-v)/1e3))},1e3);return()=>clearInterval(h)},[v]);const p=u?.running??!1,b=u?.port??8317;return s.jsxs("div",{className:"instrument-panel",children:[s.jsx("div",{className:"instrument-segment instrument-segment--providers",title:"Provider Status",children:s.jsx("div",{className:"provider-lights",children:PN.map(h=>s.jsx("span",{className:`provider-light ${x[h.id]?"provider-light--active":"provider-light--inactive"}`,title:`${h.name}: ${x[h.id]?"Connected":"Offline"}`},h.id))})}),s.jsxs("div",{className:"instrument-segment",title:"Proxy Port",children:[s.jsx("span",{className:"segment-label",children:"PORT"}),s.jsx("span",{className:"segment-value segment-value--accent",children:b})]}),s.jsxs("div",{className:"instrument-segment",title:"Session Uptime",children:[s.jsx("span",{className:"segment-label",children:"UPTIME"}),s.jsx("span",{className:"segment-value segment-value--uptime",children:IN(m)})]}),s.jsxs("div",{className:"instrument-segment",title:"Total Requests",children:[s.jsx("span",{className:"segment-label",children:"REQ"}),s.jsx("span",{className:"segment-value",children:ej(o)})]}),s.jsx("div",{className:"instrument-segment instrument-segment--version",title:"ProxyPilot Version",children:s.jsx("span",{className:"segment-value segment-value--muted",children:l})}),s.jsx("div",{className:"instrument-segment instrument-segment--status",title:"Proxy Status",children:s.jsxs("span",{className:`status-indicator ${p?"status-indicator--online":"status-indicator--offline"}`,children:[s.jsx("span",{className:"status-dot"}),s.jsx("span",{className:"status-text",children:p?"READY":"OFFLINE"})]})}),s.jsx("style",{children:` +`))}catch(q){q instanceof ot||c(q instanceof Error?q.message:String(q),"error")}},[o,c,p,h]);return w.useEffect(()=>{l&&U?(G(),k()):U||(g(null),x([]),A(""))},[l,U,G,k]),l?s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsx(gt,{className:"pb-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx(Ot,{className:"text-lg",children:"Semantic Memory"}),s.jsx(Oa,{children:"Ollama embeddings + per-repo namespaces"})]}),d&&s.jsx(zt,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),s.jsxs(ft,{className:"space-y-3",children:[!U&&s.jsx("div",{className:"py-4 text-center text-muted-foreground",children:s.jsx("p",{className:"text-xs uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"})}),U&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(je,{size:"sm",variant:"outline",onClick:G,children:"Refresh"}),s.jsx(VN,{variant:m?.status==="ok"?"default":"secondary",children:m?.status||"unknown"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[m?.model," ",m?.version?`v${m.version}`:""]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:m?.model_present===!1?"model missing":""})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[m?.latency_ms?`latency ${m.latency_ms}ms`:"latency n/a",m?.queue?` · queue q${m.queue.queued} d${m.queue.dropped} p${m.queue.processed} f${m.queue.failed}`:""]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{className:"min-w-[200px] rounded-md border border-border bg-background/60 px-2 py-1 text-xs font-mono",value:p,onChange:q=>b(q.target.value),children:[v.length===0&&s.jsx("option",{value:"",children:"(no namespaces)"}),v.map(q=>s.jsx("option",{value:q.key,children:q.label||q.key},q.key))]}),s.jsx("input",{type:"number",min:10,max:200,className:"w-20 rounded-md border border-border bg-background/60 px-2 py-1 text-xs",value:h,onChange:q=>N(parseInt(q.target.value||"50",10))}),s.jsx(je,{size:"sm",variant:"outline",onClick:K,children:"Load"})]}),s.jsx("pre",{className:"max-h-56 overflow-auto rounded-md border border-border/50 bg-muted/30 p-2 text-xs",children:_||"No items loaded."})]})]})]}):null}function $N(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Et(),[d,m]=w.useState(""),[g,v]=w.useState(!1),x=c?.running??!1,p=async()=>{try{const h=await l("/v0/management/config.yaml");m(typeof h=="string"?h:JSON.stringify(h,null,2))}catch(h){h instanceof ot||o(h instanceof Error?h.message:String(h),"error")}},b=async()=>{v(!0);try{await l("/v0/management/config.yaml",{method:"PUT",headers:{"Content-Type":"application/yaml"},body:d}),o("Configuration saved successfully","success")}catch(h){o(h instanceof Error?h.message:String(h),"error")}finally{v(!1)}};return w.useEffect(()=>{x&&p()},[x]),s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl overflow-hidden",children:[s.jsx(gt,{className:"pb-4 border-b border-border/50 bg-gradient-to-r from-purple-500/5 to-transparent",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-10 w-10 rounded-xl bg-purple-500/10 flex items-center justify-center",children:s.jsx(J2,{className:"h-5 w-5 text-purple-500"})}),s.jsxs("div",{children:[s.jsx(Ot,{className:"text-lg",children:"Config Editor"}),s.jsx(Oa,{children:"Edit config.yaml directly"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(je,{size:"sm",variant:"outline",onClick:p,disabled:!x||u,className:"gap-1.5 text-xs",children:[s.jsx(kw,{className:"h-3.5 w-3.5"}),"Reset"]}),s.jsxs(je,{size:"sm",onClick:b,disabled:!x||g||u,className:"gap-1.5 text-xs bg-purple-600 hover:bg-purple-700 text-white",children:[g?s.jsx(zt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(Is,{className:"h-3.5 w-3.5"}),"Save Changes"]})]})]})}),s.jsx(ft,{className:"p-0",children:x?s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{value:d,onChange:h=>m(h.target.value),spellCheck:!1,className:"w-full h-[500px] p-6 bg-[var(--bg-void)] text-[var(--text-primary)] font-mono text-sm resize-none focus:outline-none selection:bg-purple-500/30",style:{fontFamily:'"JetBrains Mono", "Fira Code", monospace',lineHeight:"1.6"}}),s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-[0.03]",style:{backgroundImage:"linear-gradient(var(--border-subtle) 1px, transparent 1px), linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px)",backgroundSize:"20px 20px"}})]}):s.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[s.jsx("p",{className:"text-sm uppercase tracking-widest font-mono",children:"⚠️ Engine Offline"}),s.jsx("p",{className:"text-xs mt-1",children:"Start the proxy engine to edit configuration"})]})})]})}function QN(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Et(),[d,m]=w.useState([]),[g,v]=w.useState(null),[x,p]=w.useState(!1),[b,h]=w.useState("live"),[N,_]=w.useState(new Set),A=w.useRef(null),U=c?.running??!1,[G,k]=w.useState(!1),[K,q]=w.useState(""),[F,ae]=w.useState(""),[te,E]=w.useState("all"),[L,Y]=w.useState(""),[z,se]=w.useState(""),[ie,O]=w.useState(1),[ne]=w.useState(50),[oe,T]=w.useState(0),[V,B]=w.useState([]),[ce,ge]=w.useState([]),S=w.useCallback(async()=>{try{let P=[];window.pp_get_requests?P=await window.pp_get_requests():P=(await l("/v0/management/requests")).requests||[],m([...P].sort((ve,at)=>new Date(at.timestamp).getTime()-new Date(ve.timestamp).getTime()));const Ye=new Set,Z=new Set;P.forEach(ve=>{ve.model&&Ye.add(ve.model),ve.provider&&Z.add(ve.provider)}),B(Array.from(Ye).sort()),ge(Array.from(Z).sort())}catch(P){P instanceof ot||o(P instanceof Error?P.message:String(P),"error")}},[l,o]),Q=w.useCallback(async()=>{try{const P=new URLSearchParams;P.set("limit",String(ne)),P.set("offset",String((ie-1)*ne)),K&&P.set("model",K),F&&P.set("provider",F),L&&P.set("start_date",new Date(L).toISOString()),z&&P.set("end_date",new Date(z).toISOString()),te==="success"?(P.set("status_min","200"),P.set("status_max","299")):te==="error"&&P.set("errors_only","true");const Ye=await l(`/v0/management/request-history?${P.toString()}`);m(Ye.entries||[]),T(Ye.total||0);const Z=await l("/v0/management/request-history/stats");v(Z.stats||null),Z.stats?.by_model&&B(Object.keys(Z.stats.by_model).sort()),Z.stats?.by_provider&&ge(Object.keys(Z.stats.by_provider).sort())}catch(P){P instanceof ot||o(P instanceof Error?P.message:String(P),"error")}},[l,o,ie,ne,K,F,te,L,z]),$=()=>{x?(p(!1),A.current&&(clearInterval(A.current),A.current=null)):(p(!0),S(),A.current=setInterval(()=>{S()},2e3))},ee=P=>{const Ye=new Set(N);Ye.has(P)?Ye.delete(P):Ye.add(P),_(Ye)},re=async()=>{try{const P=await l("/v0/management/request-history/export"),Ye=new Blob([JSON.stringify(P,null,2)],{type:"application/json"}),Z=URL.createObjectURL(Ye),ve=document.createElement("a");ve.href=Z,ve.download=`proxypilot-request-history-${new Date().toISOString().split("T")[0]}.json`,ve.click(),URL.revokeObjectURL(Z),o("Request history exported","success")}catch(P){o(P instanceof Error?P.message:String(P),"error")}},xe=async()=>{if(confirm("Are you sure you want to clear all request history? This cannot be undone."))try{await l("/v0/management/request-history",{method:"DELETE"}),o("Request history cleared","success"),m([]),T(0),v(null)}catch(P){o(P instanceof Error?P.message:String(P),"error")}},ue=async()=>{try{await l("/v0/management/request-history/save",{method:"POST"}),o("Request history saved to disk","success")}catch(P){o(P instanceof Error?P.message:String(P),"error")}};w.useEffect(()=>(b==="live"?S():Q(),()=>{A.current&&clearInterval(A.current)}),[b,S,Q]),w.useEffect(()=>{O(1)},[K,F,te,L,z]);const we=P=>P>=200&&P<300?"text-[var(--status-online)]":P>=400&&P<500?"text-[var(--status-warning)]":P>=500?"text-[var(--status-offline)]":"text-[var(--text-muted)]",ke=P=>P>=200&&P<300?s.jsx(G0,{className:"h-3 w-3"}):P>=400&&P<500?s.jsx(Bo,{className:"h-3 w-3"}):P>=500?s.jsx(L2,{className:"h-3 w-3"}):s.jsx(qo,{className:"h-3 w-3"}),We=P=>new Date(P).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),it=P=>new Date(P).toLocaleDateString([],{month:"short",day:"numeric"}),qe=Math.ceil(oe/ne);return s.jsxs(dt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl overflow-hidden",children:[s.jsxs(gt,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:[s.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ur,{className:`h-4 w-4 ${x&&U?"text-[var(--accent-glow)] animate-pulse":"text-[var(--text-muted)]"}`}),s.jsx("span",{className:"font-mono text-sm font-semibold tracking-wider text-[var(--text-primary)]",children:"REQUEST MONITOR"})]}),u&&s.jsx(fa,{className:"h-3 w-3 animate-spin text-muted-foreground"}),s.jsxs("div",{className:"flex items-center gap-1 bg-[var(--bg-elevated)] rounded p-0.5",children:[s.jsxs("button",{onClick:()=>{h("live"),p(!1)},className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono transition-all ${b==="live"?"bg-[var(--accent-primary)]/20 text-[var(--accent-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[s.jsx(F0,{className:"h-3 w-3"}),"LIVE"]}),s.jsxs("button",{onClick:()=>{h("history"),p(!1),A.current&&(clearInterval(A.current),A.current=null)},className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono transition-all ${b==="history"?"bg-[var(--accent-primary)]/20 text-[var(--accent-primary)]":"text-[var(--text-muted)] hover:text-[var(--text-secondary)]"}`,children:[s.jsx(lw,{className:"h-3 w-3"}),"HISTORY"]})]}),b==="live"&&s.jsxs("button",{onClick:$,disabled:!U,className:`flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono transition-all ${x&&U?"bg-[var(--accent-glow)]/20 text-[var(--accent-glow)]":"bg-[var(--bg-elevated)] text-[var(--text-muted)] hover:text-[var(--text-secondary)]"} ${U?"":"opacity-50 cursor-not-allowed"}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${x&&U?"bg-[var(--accent-glow)]":"bg-[var(--text-muted)]"}`}),"AUTO"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[b==="history"&&s.jsxs(s.Fragment,{children:[s.jsxs(je,{size:"sm",variant:"outline",onClick:()=>k(!G),className:`text-xs h-7 font-mono gap-1 ${G?"bg-[var(--accent-primary)]/10 border-[var(--accent-primary)]":""}`,children:[s.jsx(I2,{className:"h-3 w-3"}),"FILTER"]}),s.jsxs(je,{size:"sm",variant:"outline",onClick:ue,disabled:!U||u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(Is,{className:"h-3 w-3"}),"SAVE"]}),s.jsxs(je,{size:"sm",variant:"outline",onClick:re,disabled:!U||u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(is,{className:"h-3 w-3"}),"EXPORT"]}),s.jsxs(je,{size:"sm",variant:"outline",onClick:xe,disabled:!U||u,className:"text-xs h-7 font-mono gap-1 text-[var(--status-offline)] hover:bg-[var(--status-offline)]/10",children:[s.jsx(Wo,{className:"h-3 w-3"}),"CLEAR"]})]}),s.jsxs(je,{size:"sm",variant:"outline",onClick:b==="live"?S:Q,disabled:!U||u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(fa,{className:"h-3 w-3"}),"REFRESH"]})]})]}),G&&b==="history"&&s.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)] grid grid-cols-2 md:grid-cols-5 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"Model"}),s.jsxs("select",{value:K,onChange:P=>q(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono",children:[s.jsx("option",{value:"",children:"All Models"}),V.map(P=>s.jsx("option",{value:P,children:P},P))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"Provider"}),s.jsxs("select",{value:F,onChange:P=>ae(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono",children:[s.jsx("option",{value:"",children:"All Providers"}),ce.map(P=>s.jsx("option",{value:P,children:P},P))]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"Status"}),s.jsxs("select",{value:te,onChange:P=>E(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono",children:[s.jsx("option",{value:"all",children:"All"}),s.jsx("option",{value:"success",children:"Success (2xx)"}),s.jsx("option",{value:"error",children:"Errors"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"From"}),s.jsx("input",{type:"date",value:L,onChange:P=>Y(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase mb-1",children:"To"}),s.jsx("input",{type:"date",value:z,onChange:P=>se(P.target.value),className:"w-full px-2 py-1.5 rounded border border-[var(--border-default)] bg-[var(--bg-elevated)] text-xs font-mono"})]})]}),b==="history"&&g&&s.jsxs("div",{className:"mt-3 pt-3 border-t border-[var(--border-subtle)] grid grid-cols-3 md:grid-cols-6 gap-4 text-center",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--text-primary)]",children:g.total_requests}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Total"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--status-online)]",children:g.success_count}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Success"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--status-offline)]",children:g.failure_count}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Failed"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-lg font-bold text-[var(--text-primary)]",children:(g.total_tokens_in+g.total_tokens_out).toLocaleString()}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Tokens"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-lg font-bold text-emerald-400",children:["$",g.total_cost_usd.toFixed(2)]}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Cost"})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-lg font-bold text-emerald-400",children:["$",g.savings.toFixed(2)]}),s.jsx("div",{className:"text-[10px] font-mono text-[var(--text-muted)] uppercase",children:"Saved"})]})]})]}),s.jsx(ft,{className:"p-0",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-left border-collapse font-mono text-xs",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[var(--bg-panel)]/50 text-[var(--text-muted)] border-b border-[var(--border-subtle)]",children:[s.jsx("th",{className:"px-4 py-2 font-medium",children:b==="history"?"DATE":"TIME"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"MODEL"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"PROVIDER"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"STATUS"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"LATENCY"}),s.jsx("th",{className:"px-4 py-2 font-medium",children:"TOKENS"}),s.jsx("th",{className:"px-4 py-2 font-medium w-10"})]})}),s.jsx("tbody",{className:"divide-y divide-[var(--border-subtle)]/30",children:U?d.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-8 text-center text-[var(--text-muted)]",children:b==="history"?"No request history found.":"No requests recorded yet."})}):d.map(P=>s.jsxs(le.Fragment,{children:[s.jsxs("tr",{className:"hover:bg-[var(--bg-panel)]/50 transition-colors cursor-pointer group",onClick:()=>ee(P.id),children:[s.jsx("td",{className:"px-4 py-2.5 text-[var(--text-muted)] tabular-nums",children:b==="history"?s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:it(P.timestamp)}),s.jsx("span",{className:"text-[10px]",children:We(P.timestamp)})]}):We(P.timestamp)}),s.jsx("td",{className:"px-4 py-2.5 text-[var(--text-primary)] font-medium",children:P.model||"-"}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"px-1.5 py-0.5 rounded bg-[var(--bg-elevated)] text-[var(--text-secondary)] text-[10px]",children:P.provider?.toUpperCase()||"UNKNOWN"})}),s.jsx("td",{className:`px-4 py-2.5 font-bold ${we(P.status)}`,children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[ke(P.status),P.status]})}),s.jsxs("td",{className:"px-4 py-2.5 text-[var(--text-secondary)] tabular-nums",children:[P.latencyMs,"ms"]}),s.jsx("td",{className:"px-4 py-2.5 text-[var(--text-muted)] tabular-nums",children:s.jsxs("div",{className:"flex flex-col",children:[s.jsxs("span",{children:["In: ",P.inputTokens]}),s.jsxs("span",{children:["Out: ",P.outputTokens]})]})}),s.jsx("td",{className:"px-4 py-2.5 text-right",children:N.has(P.id)?s.jsx(nl,{className:"h-4 w-4 text-[var(--text-muted)]"}):s.jsx(Du,{className:"h-4 w-4 text-[var(--text-muted)] group-hover:text-[var(--text-primary)]"})})]}),N.has(P.id)&&s.jsx("tr",{className:"bg-[var(--bg-panel)]/30",children:s.jsx("td",{colSpan:7,className:"px-4 py-4 border-l-2 border-l-[var(--accent-glow)]",children:s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-muted)] text-[10px] uppercase tracking-wider",children:[s.jsx(V0,{className:"h-3 w-3"}),"Request Details"]}),s.jsxs("div",{className:"space-y-1 text-[var(--text-secondary)]",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Method:"}),s.jsx("span",{className:"text-[var(--text-primary)]",children:P.method})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Path:"}),s.jsx("span",{className:"text-[var(--text-primary)] break-all ml-4",children:P.path})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"ID:"}),s.jsx("span",{className:"text-[var(--text-primary)] text-[10px]",children:P.id})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-muted)] text-[10px] uppercase tracking-wider",children:[s.jsx(X0,{className:"h-3 w-3"}),"Performance & Usage"]}),s.jsxs("div",{className:"space-y-1 text-[var(--text-secondary)]",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Latency:"}),s.jsxs("span",{className:"text-[var(--text-primary)]",children:[P.latencyMs,"ms"]})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{children:"Total Tokens:"}),s.jsx("span",{className:"text-[var(--text-primary)]",children:P.inputTokens+P.outputTokens})]}),P.error&&s.jsxs("div",{className:"mt-2 p-2 rounded bg-[var(--status-offline)]/10 border border-[var(--status-offline)]/20 text-[var(--status-offline)]",children:[s.jsxs("div",{className:"flex items-center gap-1 mb-1 font-bold",children:[s.jsx(Bo,{className:"h-3 w-3"}),"ERROR"]}),s.jsx("div",{className:"text-[10px] break-all",children:P.error})]})]})]})]})})})]},P.id)):s.jsx("tr",{children:s.jsx("td",{colSpan:7,className:"p-8 text-center text-[var(--text-muted)]",children:s.jsx("p",{className:"text-xs uppercase tracking-widest",children:"Engine Offline"})})})})]})})}),s.jsx("div",{className:"px-3 py-1.5 bg-[var(--bg-panel)] border-t border-[var(--border-subtle)] flex items-center justify-between text-[10px] font-mono text-[var(--text-muted)]",children:b==="live"?s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:[d.length," requests tracked"]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:x?"text-[var(--accent-glow)]":"",children:x?"AUTO REFRESH ON":"AUTO REFRESH OFF"}),s.jsx("span",{children:"|"}),s.jsx("span",{children:"2s INTERVAL"})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:["Showing ",d.length," of ",oe," entries"]}),qe>1&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>O(1),disabled:ie===1,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(A2,{className:"h-3 w-3"})}),s.jsx("button",{onClick:()=>O(P=>Math.max(1,P-1)),disabled:ie===1,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(C2,{className:"h-3 w-3"})}),s.jsxs("span",{className:"px-2",children:["Page ",ie," of ",qe]}),s.jsx("button",{onClick:()=>O(P=>Math.min(qe,P+1)),disabled:ie===qe,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(Du,{className:"h-3 w-3"})}),s.jsx("button",{onClick:()=>O(qe),disabled:ie===qe,className:"p-1 rounded hover:bg-[var(--bg-elevated)] disabled:opacity-30",children:s.jsx(O2,{className:"h-3 w-3"})})]})]})})]})}function ZN(){const{mgmtFetch:l}=Et(),[o,c]=w.useState(null),[u,d]=w.useState(null),[m,g]=w.useState(!0),v=async()=>{try{let h;if(window.pp_get_usage)h=await window.pp_get_usage();else if(l)h=await l("/v0/management/usage");else throw new Error("No method available to fetch usage data");const N=h?.usage||h;N&&typeof N=="object"&&(c({total_requests:N.total_requests??N.totalRequests??0,success_count:N.success_count??N.successCount??0,failure_count:N.failure_count??N.failureCount??0,total_input_tokens:N.total_input_tokens??N.totalInputTokens??0,total_output_tokens:N.total_output_tokens??N.totalOutputTokens??0,estimated_cost_saved:N.estimated_cost_saved??N.estimatedCostSaved??0,actual_cost:N.actual_cost??N.actualCost??0,direct_api_cost:N.direct_api_cost??N.directApiCost??0,savings:N.savings??0,savings_percent:N.savings_percent??N.savingsPercent??0,by_model:N.by_model??N.byModel??{},by_provider:N.by_provider??N.byProvider??{},cost_by_model:N.cost_by_model??N.costByModel??{},cost_by_provider:N.cost_by_provider??N.costByProvider??{},daily:N.daily??[]}),d(null))}catch(h){console.error("Failed to fetch usage stats:",h),d(h instanceof Error?h.message:String(h))}finally{g(!1)}};if(w.useEffect(()=>{v();const h=setInterval(v,3e4);return()=>clearInterval(h)},[]),m&&!o)return s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(zt,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(u&&!o)return s.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-6 text-center",children:[s.jsx("p",{className:"text-red-300",children:"Failed to load usage statistics"}),s.jsx("p",{className:"mt-2 text-xs text-red-400/70",children:u})]});if(!o)return s.jsxs("div",{className:"rounded-xl border border-[var(--border-subtle)] bg-[var(--bg-panel)] p-8 text-center",children:[s.jsx(Ru,{className:"mx-auto h-12 w-12 text-[var(--text-muted)] opacity-50"}),s.jsx("p",{className:"mt-4 text-[var(--text-primary)]",children:"No usage data available yet"}),s.jsx("p",{className:"mt-2 text-xs text-[var(--text-muted)]",children:"Start making requests through the proxy to see statistics here."})]});const x=Math.max(...o.daily.map(h=>h.requests),1),p=Object.entries(o.by_provider).sort((h,N)=>N[1]-h[1]),b=p.reduce((h,[N,_])=>h+_,0);return s.jsxs("div",{className:"space-y-6",children:[(o.direct_api_cost>0||o.actual_cost>0)&&s.jsxs(dt,{className:Ne("relative overflow-hidden","bg-gradient-to-br from-emerald-500/10 via-teal-500/5 to-cyan-500/10","border-emerald-500/30 shadow-xl shadow-emerald-500/5"),children:[s.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-emerald-400/10 via-transparent to-transparent"}),s.jsx(gt,{className:"relative pb-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-emerald-500/20 ring-1 ring-emerald-500/30",children:s.jsx(Ww,{className:"h-5 w-5 text-emerald-400"})}),s.jsxs("div",{children:[s.jsx(Ot,{className:"text-lg text-emerald-100",children:"Cost Savings"}),s.jsx(Oa,{className:"text-emerald-300/70",children:"ProxyPilot vs Direct API"})]})]})}),s.jsx(ft,{className:"relative",children:s.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-emerald-300/60",children:"You Saved"}),s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsxs("span",{className:"text-3xl font-bold text-emerald-400",children:["$",o.savings.toFixed(2)]}),o.savings_percent>0&&s.jsxs("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 text-xs font-medium text-emerald-300",children:[o.savings_percent.toFixed(0),"% off"]})]})]}),s.jsxs("div",{className:"md:col-span-2 space-y-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:"Direct API Cost"}),s.jsxs("span",{className:"font-medium text-red-400",children:["$",o.direct_api_cost.toFixed(2)]})]}),s.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-red-500/20",children:s.jsx("div",{className:"h-full bg-red-500/60",style:{width:"100%"}})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[s.jsx(W0,{className:"h-3 w-3 text-emerald-400"}),"ProxyPilot Cost"]}),s.jsxs("span",{className:"font-medium text-emerald-400",children:["$",o.actual_cost.toFixed(2)]})]}),s.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-emerald-500/20",children:s.jsx("div",{className:"h-full bg-emerald-500/60 transition-all",style:{width:o.direct_api_cost>0?`${o.actual_cost/o.direct_api_cost*100}%`:"0%"}})})]})]})]})})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ot,{className:"text-sm font-medium",children:"Total Requests"}),s.jsx(ur,{className:"h-4 w-4 text-blue-400"})]}),s.jsxs(ft,{children:[s.jsx("div",{className:"text-2xl font-bold",children:o.total_requests.toLocaleString()}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[o.success_count.toLocaleString()," successful"]})]})]}),s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ot,{className:"text-sm font-medium",children:"Input Tokens"}),s.jsx(Yo,{className:"h-4 w-4 text-amber-400"})]}),s.jsxs(ft,{children:[s.jsx("div",{className:"text-2xl font-bold",children:o.total_input_tokens.toLocaleString()}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Prompt tokens"})]})]}),s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ot,{className:"text-sm font-medium",children:"Output Tokens"}),s.jsx(Yo,{className:"h-4 w-4 text-emerald-400"})]}),s.jsxs(ft,{children:[s.jsx("div",{className:"text-2xl font-bold",children:o.total_output_tokens.toLocaleString()}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Completion tokens"})]})]}),s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[s.jsx(Ot,{className:"text-sm font-medium",children:"Total Cost"}),s.jsx($2,{className:"h-4 w-4 text-purple-400"})]}),s.jsxs(ft,{children:[s.jsxs("div",{className:"text-2xl font-bold",children:["$",o.actual_cost.toFixed(2)]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Based on model pricing"})]})]})]}),s.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ru,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(Ot,{className:"text-lg",children:"Daily Activity"})]}),s.jsx(Oa,{children:"Requests over the last 7 days"})]}),s.jsx(ft,{children:s.jsx("div",{className:"flex h-48 items-end gap-2 pt-4",children:o.daily.map(h=>{const N=h.requests/x*100,_=new Date(h.date).toLocaleDateString(void 0,{weekday:"short"});return s.jsxs("div",{className:"group relative flex flex-1 flex-col items-center gap-2",children:[s.jsx("div",{className:"w-full rounded-t-sm bg-blue-500/40 transition-all hover:bg-blue-500/60",style:{height:`${Math.max(N,4)}%`},children:s.jsxs("div",{className:"absolute -top-8 left-1/2 -translate-x-1/2 rounded bg-popover px-2 py-1 text-[10px] opacity-0 transition-opacity group-hover:opacity-100",children:[h.requests," reqs"]})}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:_})]},h.date)})})})]}),s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(j2,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(Ot,{className:"text-lg",children:"Providers"})]}),s.jsx(Oa,{children:"Requests by backend provider"})]}),s.jsx(ft,{children:s.jsxs("div",{className:"space-y-4 pt-2",children:[p.length===0&&s.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No provider data available"}),p.map(([h,N])=>{const _=N/b*100;return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"font-medium capitalize",children:h}),s.jsxs("span",{className:"text-muted-foreground",children:[N," (",_.toFixed(1),"%)"]})]}),s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted/30",children:s.jsx("div",{className:"h-full bg-blue-500/50",style:{width:`${_}%`}})})]},h)})]})})]})]}),s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{children:[s.jsx(Ot,{className:"text-lg",children:"Model Breakdown"}),s.jsx(Oa,{children:"Usage and cost statistics per model"})]}),s.jsx(ft,{children:s.jsx("div",{className:"overflow-hidden rounded-md border border-border/50",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-muted/40",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Model"}),s.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Requests"}),s.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Share"}),s.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Cost"})]})}),s.jsxs("tbody",{className:"divide-y divide-border/40",children:[Object.entries(o.by_model).sort((h,N)=>N[1]-h[1]).map(([h,N])=>{const _=o.cost_by_model?.[h]??0;return s.jsxs("tr",{className:"hover:bg-muted/20 transition-colors",children:[s.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:h}),s.jsx("td",{className:"px-4 py-3 text-right",children:N.toLocaleString()}),s.jsxs("td",{className:"px-4 py-3 text-right text-muted-foreground",children:[(N/o.total_requests*100).toFixed(1),"%"]}),s.jsxs("td",{className:"px-4 py-3 text-right font-medium text-emerald-400",children:["$",_.toFixed(4)]})]},h)}),Object.keys(o.by_model).length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:4,className:"px-4 py-8 text-center text-muted-foreground",children:"No model usage recorded yet."})})]})]})})})]})]})}const KN={claude:"oklch(0.60 0.15 35)",anthropic:"oklch(0.60 0.15 35)",gemini:"oklch(0.55 0.18 250)","gemini-cli":"oklch(0.58 0.16 240)",codex:"oklch(0.60 0.16 145)",qwen:"oklch(0.60 0.14 280)",antigravity:"oklch(0.65 0.20 320)",kiro:"oklch(0.58 0.17 200)",amazonq:"oklch(0.55 0.16 30)",minimax:"oklch(0.60 0.18 60)",zhipu:"oklch(0.55 0.15 180)"};function JN(l){const o=l?.toLowerCase()||"";for(const[c,u]of Object.entries(KN))if(o.includes(c))return u;return"oklch(0.55 0.15 220)"}function Ws(l){return l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toString()}function FN(l){if(!l)return"N/A";const o=new Date(l),u=new Date().getTime()-o.getTime(),d=Math.floor(u/(1e3*60*60)),m=Math.floor(u/(1e3*60));return d>=24?`${Math.floor(d/24)}d ago`:d>0?`${d}h ago`:m>0?`${m}m ago`:"just now"}function WN({account:l,maxTotalTokens:o}){const c=l.usage,u=(c?.total_input_tokens||0)+(c?.total_output_tokens||0),d=(c?.daily_input_tokens||0)+(c?.daily_output_tokens||0),m=JN(l.provider||l.type||""),g=o>0?u/o*100:0,v=l.email||l.label||l.name||l.id,x=l.provider||l.type||"unknown";return s.jsxs("div",{className:Ne("relative p-4 rounded-lg border border-[var(--border-subtle)]","bg-[var(--bg-panel)] hover:border-transparent transition-all duration-200","group"),style:{"--provider-color":m},children:[s.jsx("div",{className:"absolute inset-0 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",style:{boxShadow:`0 0 20px color-mix(in oklch, ${m} 20%, transparent), inset 0 0 15px color-mix(in oklch, ${m} 5%, transparent)`}}),s.jsx("div",{className:"absolute inset-0 rounded-lg border-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none",style:{borderColor:m}}),s.jsx("div",{className:"relative flex items-start justify-between mb-3",children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"inline-flex px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",style:{background:`color-mix(in oklch, ${m} 20%, transparent)`,color:m},children:x}),l.status&&s.jsx("span",{className:Ne("inline-flex px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",l.status==="active"||l.status==="ok"?"bg-[var(--status-online)]/15 text-[var(--status-online)]":"bg-[var(--text-muted)]/15 text-[var(--text-muted)]"),children:l.status})]}),s.jsx("p",{className:"text-sm font-medium text-[var(--text-primary)] truncate",title:v,children:v})]})}),s.jsxs("div",{className:"relative grid grid-cols-2 gap-3 mb-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:[s.jsx(ur,{className:"h-3 w-3"}),"Requests"]}),s.jsx("div",{className:"text-lg font-bold text-[var(--text-primary)]",children:c?.request_count?.toLocaleString()||0})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:[s.jsx(Yo,{className:"h-3 w-3"}),"Total Tokens"]}),s.jsx("div",{className:"text-lg font-bold text-[var(--text-primary)]",children:Ws(u)})]})]}),s.jsxs("div",{className:"relative mb-3",children:[s.jsxs("div",{className:"flex justify-between text-[10px] text-[var(--text-muted)] mb-1",children:[s.jsxs("span",{children:["In: ",Ws(c?.total_input_tokens||0)]}),s.jsxs("span",{children:["Out: ",Ws(c?.total_output_tokens||0)]})]}),s.jsx("div",{className:"h-2 w-full rounded-full bg-[var(--bg-elevated)] overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(g,2)}%`,background:`linear-gradient(90deg, ${m}, color-mix(in oklch, ${m} 70%, white))`,boxShadow:`0 0 8px ${m}`}})})]}),s.jsx("div",{className:"relative border-t border-[var(--border-subtle)] pt-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[var(--text-muted)]",children:[s.jsx(V0,{className:"h-3 w-3"}),"Daily: ",c?.daily_request_count||0," reqs, ",Ws(d)," tokens"]}),s.jsxs("div",{className:"text-[10px] text-[var(--text-muted)]",children:["Reset ",FN(c?.day_started_at)]})]})})]})}function PN(){const{mgmtFetch:l,status:o}=Et(),[c,u]=w.useState([]),[d,m]=w.useState(!0),[g,v]=w.useState(null),x=o?.running??!1,p=async()=>{if(!x){u([]),m(!1);return}try{const _=(await l("/v0/management/auth-files")).files||[];u(_),v(null)}catch(N){console.error("Failed to fetch auth files:",N),v(N instanceof Error?N.message:String(N))}finally{m(!1)}};w.useEffect(()=>{p();const N=setInterval(p,3e4);return()=>clearInterval(N)},[x]);const b=Math.max(...c.map(N=>(N.usage?.total_input_tokens||0)+(N.usage?.total_output_tokens||0)),1),h=c.reduce((N,_)=>({requests:N.requests+(_.usage?.request_count||0),inputTokens:N.inputTokens+(_.usage?.total_input_tokens||0),outputTokens:N.outputTokens+(_.usage?.total_output_tokens||0),dailyRequests:N.dailyRequests+(_.usage?.daily_request_count||0)}),{requests:0,inputTokens:0,outputTokens:0,dailyRequests:0});return d&&c.length===0?s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(zt,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):x?g&&c.length===0?s.jsxs("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-6 text-center",children:[s.jsx("p",{className:"text-red-300",children:"Failed to load account usage"}),s.jsx("p",{className:"mt-2 text-xs text-red-400/70",children:g})]}):c.length===0?s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nu,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(Ot,{className:"text-lg",children:"Account Usage"})]}),s.jsx(Oa,{children:"Per-account usage statistics"})]}),s.jsx(ft,{children:s.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No accounts configured. Add providers in the Providers tab."})})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{className:"pb-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nu,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(Ot,{className:"text-lg",children:"Account Usage"})]}),s.jsx("button",{onClick:()=>{m(!0),p()},className:"p-1.5 rounded-md hover:bg-[var(--bg-elevated)] transition-colors",title:"Refresh",children:s.jsx(fa,{className:Ne("h-4 w-4 text-[var(--text-muted)]",d&&"animate-spin")})})]}),s.jsxs(Oa,{children:[c.length," account",c.length!==1?"s":""," across all providers"]})]}),s.jsx(ft,{children:s.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-[var(--text-muted)] uppercase tracking-wider",children:"Total Requests"}),s.jsx("p",{className:"text-2xl font-bold text-[var(--text-primary)]",children:h.requests.toLocaleString()})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-[var(--text-muted)] uppercase tracking-wider",children:"Input Tokens"}),s.jsx("p",{className:"text-2xl font-bold text-[var(--text-primary)]",children:Ws(h.inputTokens)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-[var(--text-muted)] uppercase tracking-wider",children:"Output Tokens"}),s.jsx("p",{className:"text-2xl font-bold text-[var(--text-primary)]",children:Ws(h.outputTokens)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-[var(--text-muted)] uppercase tracking-wider",children:"Today's Requests"}),s.jsx("p",{className:"text-2xl font-bold text-[var(--text-primary)]",children:h.dailyRequests.toLocaleString()})]})]})})]}),s.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))"},children:c.map(N=>s.jsx(WN,{account:N,maxTotalTokens:b},N.id))})]}):s.jsxs(dt,{className:"backdrop-blur-sm bg-card/60 border-border/50 shadow-xl",children:[s.jsxs(gt,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nu,{className:"h-4 w-4 text-muted-foreground"}),s.jsx(Ot,{className:"text-lg",children:"Account Usage"})]}),s.jsx(Oa,{children:"Per-account usage statistics"})]}),s.jsx(ft,{children:s.jsx("div",{className:"p-4 rounded-lg border border-yellow-500/30 bg-yellow-500/5 text-yellow-500 text-xs text-center uppercase tracking-widest font-mono",children:"Start the proxy engine to view account usage"})})]})}const IN={low:{icon:s.jsx(Yo,{className:"h-4 w-4"}),label:"Low",description:"2,048 tokens - Fast, minimal reasoning",color:"text-amber-400"},medium:{icon:s.jsx(tw,{className:"h-4 w-4"}),label:"Medium",description:"8,192 tokens - Balanced reasoning",color:"text-blue-400"},high:{icon:s.jsx(W0,{className:"h-4 w-4"}),label:"High",description:"32,768 tokens - Deep reasoning",color:"text-purple-400"},custom:{icon:s.jsx(qw,{className:"h-4 w-4"}),label:"Custom",description:"Set your own token budget",color:"text-emerald-400"}};function ej(){const{mgmtFetch:l,showToast:o,status:c,isMgmtLoading:u}=Et(),[d,m]=w.useState(null),[g,v]=w.useState("medium"),[x,p]=w.useState(16e3),[b,h]=w.useState(!0),[N,_]=w.useState(!1),[A,U]=w.useState(!1),G=c?.running??!1,k=w.useCallback(async()=>{try{const E=await l("/v0/management/thinking-budget");m(E),v(E.mode||"medium"),p(E.custom_tokens||16e3),h(E.enabled!==!1),_(!1)}catch(E){E instanceof ot||console.error("Failed to fetch thinking budget:",E)}},[l]);w.useEffect(()=>{G&&k()},[G,k]);const K=E=>{v(E),_(!0)},q=E=>{const L=parseInt(E,10);!isNaN(L)&&L>0&&(p(L),_(!0))},F=()=>{h(!b),_(!0)},ae=async()=>{U(!0);try{await l("/v0/management/thinking-budget",{method:"PUT",body:JSON.stringify({mode:g,custom_tokens:x,enabled:b})}),o("Thinking budget settings saved","success"),_(!1),await k()}catch(E){o(E instanceof Error?E.message:String(E),"error")}U(!1)},te=()=>g==="custom"?x:d?.presets?.[g]||8192;return G?s.jsxs(dt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl",children:[s.jsxs(gt,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zu,{className:`h-4 w-4 ${b?"text-[var(--accent-primary)]":"text-[var(--text-muted)]"}`}),s.jsx(Ot,{className:"text-sm font-mono uppercase tracking-wider",children:"Thinking Budget"}),u&&s.jsx(fa,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(je,{size:"sm",variant:"outline",onClick:k,disabled:u,className:"text-xs h-7 font-mono gap-1",children:[s.jsx(fa,{className:"h-3 w-3"}),"REFRESH"]}),s.jsxs(je,{size:"sm",onClick:ae,disabled:!N||A,className:`text-xs h-7 font-mono gap-1 ${N?"bg-[var(--accent-primary)] text-white":""}`,children:[A?s.jsx(fa,{className:"h-3 w-3 animate-spin"}):s.jsx(Is,{className:"h-3 w-3"}),"SAVE"]})]})]}),s.jsx(Oa,{className:"text-xs text-[var(--text-muted)]",children:"Configure default thinking budget for reasoning models (Claude, Gemini with thinking)"})]}),s.jsxs(ft,{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-[var(--bg-panel)] border border-[var(--border-subtle)]",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-mono text-sm text-[var(--text-primary)]",children:"Enable Thinking"}),s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Allow models to use extended reasoning"})]}),s.jsx("button",{onClick:F,className:`relative w-12 h-6 rounded-full transition-colors ${b?"bg-[var(--accent-primary)]":"bg-[var(--bg-elevated)]"}`,children:s.jsx("span",{className:`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform ${b?"left-7":"left-1"}`})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase tracking-wider",children:"Budget Preset"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:Object.entries(IN).map(([E,L])=>s.jsxs("button",{onClick:()=>K(E),disabled:!b,className:`relative p-3 rounded-lg border transition-all text-left ${g===E?"border-[var(--accent-primary)] bg-[var(--accent-primary)]/10":"border-[var(--border-subtle)] bg-[var(--bg-panel)] hover:border-[var(--border-default)]"} ${b?"":"opacity-50 cursor-not-allowed"}`,children:[g===E&&s.jsx("div",{className:"absolute top-2 right-2",children:s.jsx(al,{className:"h-3 w-3 text-[var(--accent-primary)]"})}),s.jsxs("div",{className:`flex items-center gap-2 ${L.color}`,children:[L.icon,s.jsx("span",{className:"font-mono text-sm font-bold",children:L.label})]}),s.jsx("div",{className:"text-[10px] text-[var(--text-muted)] mt-1",children:L.description})]},E))})]}),g==="custom"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-[10px] font-mono text-[var(--text-muted)] uppercase tracking-wider",children:"Custom Token Budget"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"number",value:x,onChange:E=>q(E.target.value),disabled:!b,min:1024,max:128e3,step:1024,className:"flex-1 px-3 py-2 rounded-lg border border-[var(--border-default)] bg-[var(--bg-elevated)] font-mono text-sm disabled:opacity-50"}),s.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"tokens"})]}),s.jsx("div",{className:"text-[10px] text-[var(--text-muted)]",children:"Recommended range: 1,024 - 128,000 tokens"})]}),s.jsx("div",{className:"p-3 rounded-lg bg-[var(--bg-elevated)] border border-[var(--border-subtle)]",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-xs text-[var(--text-muted)]",children:"Effective Thinking Budget"}),s.jsxs("div",{className:`font-mono text-lg font-bold ${b?"text-[var(--accent-primary)]":"text-[var(--text-muted)]"}`,children:[b?te().toLocaleString():"0"," ",s.jsx("span",{className:"text-xs font-normal",children:"tokens"})]})]})}),s.jsxs("div",{className:"text-xs text-[var(--text-muted)] p-3 rounded-lg bg-[var(--bg-panel)] border border-[var(--border-subtle)]",children:[s.jsx("strong",{children:"Note:"})," Thinking budget applies to models that support extended reasoning, including Claude with thinking mode and Gemini Pro/Flash with thinking enabled. Higher budgets allow for more thorough reasoning but consume more tokens."]})]})]}):s.jsxs(dt,{className:"backdrop-blur-sm bg-[var(--bg-void)] border-[var(--border-default)] shadow-xl",children:[s.jsx(gt,{className:"pb-3 border-b border-[var(--border-subtle)] bg-[var(--bg-panel)]",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zu,{className:"h-4 w-4 text-[var(--text-muted)]"}),s.jsx(Ot,{className:"text-sm font-mono uppercase tracking-wider",children:"Thinking Budget"})]})}),s.jsx(ft,{className:"p-8 text-center text-[var(--text-muted)]",children:s.jsx("p",{className:"text-xs uppercase tracking-widest",children:"Engine Offline"})})]})}function tj(){const[l,o]=w.useState(()=>typeof window>"u"?"dark":localStorage.getItem("pp-theme")||"dark");return w.useEffect(()=>{const u=document.documentElement,d=window.matchMedia("(prefers-color-scheme: dark)").matches,m=l==="system"?d?"dark":"light":l;u.classList.remove("light","dark"),u.classList.add(m),localStorage.setItem("pp-theme",l)},[l]),w.useEffect(()=>{if(l!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),d=m=>{const g=document.documentElement;g.classList.remove("light","dark"),g.classList.add(m.matches?"dark":"light")};return u.addEventListener("change",d),()=>u.removeEventListener("change",d)},[l]),{theme:l,setTheme:u=>{o(u)}}}function aj(){const{theme:l,setTheme:o}=tj(),c=()=>{o(l==="dark"?"light":l==="light"?"system":"dark")};return s.jsxs(je,{variant:"ghost",size:"icon-sm",onClick:c,className:"text-muted-foreground hover:text-foreground",title:`Theme: ${l}`,children:[l==="dark"&&s.jsx(gw,{className:"h-4 w-4"}),l==="light"&&s.jsx(Zw,{className:"h-4 w-4"}),l==="system"&&s.jsx(hw,{className:"h-4 w-4"})]})}function nj({isOpen:l,onClose:o}){const{mgmtFetch:c}=Et(),[u,d]=w.useState(!1),[m,g]=w.useState(!1),[v,x]=w.useState(null),[p,b]=w.useState("idle"),[h,N]=w.useState(0),[_,A]=w.useState(null);w.useEffect(()=>{(async()=>{try{if(window.pp_get_oauth_private){const E=await window.pp_get_oauth_private();d(E)}}catch(E){console.error("Failed to load OAuth private setting:",E)}})()},[]),w.useEffect(()=>{if(p!=="downloading")return;const L=setInterval(async()=>{try{let Y;if(c)Y=await c("/v0/management/updates/status");else return;if(Y.error){A(Y.error),b("available");return}Y.downloading?N(Y.progress?.percent||0):Y.ready&&(b("ready"),N(100))}catch(Y){console.error("Failed to poll update status:",Y)}},500);return()=>clearInterval(L)},[p,c]);const U=async E=>{try{window.pp_set_oauth_private&&(await window.pp_set_oauth_private(E),d(E),Nt.success(E?"Private browsing enabled":"Private browsing disabled"))}catch(L){Nt.error(L instanceof Error?L.message:String(L))}},G=async()=>{try{window.pp_open_logs&&(await window.pp_open_logs(),Nt.success("Opened logs folder"))}catch(E){Nt.error(E instanceof Error?E.message:String(E))}},k=async()=>{try{window.pp_open_auth_folder&&(await window.pp_open_auth_folder(),Nt.success("Opened auth folder"))}catch(E){Nt.error(E instanceof Error?E.message:String(E))}},K=async()=>{try{window.pp_copy_diagnostics&&(await window.pp_copy_diagnostics(),Nt.success("Diagnostics copied to clipboard"))}catch(E){Nt.error(E instanceof Error?E.message:String(E))}},q=async()=>{g(!0),b("checking"),A(null);try{let E=null;window.pp_check_updates?E=await window.pp_check_updates():c&&(E=await c("/v0/management/updates/check")),x(E),E?.available?(b("available"),Nt.success(`Update available: v${E.version}`)):(b("idle"),Nt.success("You are on the latest version"))}catch(E){b("idle"),Nt.error(E instanceof Error?E.message:String(E))}finally{g(!1)}},F=async()=>{if(v?.version){b("downloading"),N(0),A(null);try{c?await c("/v0/management/updates/download",{method:"POST",body:JSON.stringify({version:v.version})}):window.pp_download_update&&(await window.pp_download_update(v.download_url),b("available"),Nt.success("Opening download page..."))}catch(E){b("available"),A(E instanceof Error?E.message:String(E)),Nt.error(E instanceof Error?E.message:String(E))}}},ae=async()=>{b("installing");try{if(c){const E=await c("/v0/management/updates/install",{method:"POST"});if(E?.success)Nt.success(E.message||"Update installed! Restarting...");else throw new Error(E?.message||"Installation failed")}}catch(E){b("ready"),A(E instanceof Error?E.message:String(E)),Nt.error(E instanceof Error?E.message:String(E))}},te=()=>{v?.download_url&&window.open(v.download_url,"_blank")};return l?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40 animate-in fade-in duration-200",onClick:o}),s.jsxs("div",{className:Ne("fixed right-0 top-0 bottom-0 w-80 z-50","bg-[var(--bg-panel)] border-l border-[var(--border-subtle)]","shadow-2xl","animate-in slide-in-from-right duration-300"),children:[s.jsxs("div",{className:Ne("flex items-center justify-between px-5 py-4","border-b border-[var(--border-subtle)]"),children:[s.jsx("h2",{className:"text-sm font-bold uppercase tracking-[0.15em] text-[var(--text-primary)]",style:{fontFamily:"var(--font-display)"},children:"Settings"}),s.jsx(je,{variant:"ghost",size:"icon-sm",onClick:o,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)]",children:s.jsx(ad,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"p-5 space-y-6",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Authentication"}),s.jsxs("div",{className:Ne("flex items-center justify-between p-3 rounded-lg","bg-[var(--bg-elevated)] border border-[var(--border-subtle)]"),children:[s.jsxs("div",{className:"flex items-center gap-3",children:[u?s.jsx(K0,{className:"h-4 w-4 text-[var(--accent-glow)]"}):s.jsx(Z0,{className:"h-4 w-4 text-[var(--text-muted)]"}),s.jsxs("div",{children:[s.jsx(da,{htmlFor:"private-oauth",className:"text-sm text-[var(--text-primary)] cursor-pointer",children:"Private Browsing"}),s.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"Use InPrivate mode for OAuth"})]})]}),s.jsx(Go,{id:"private-oauth",checked:u,onCheckedChange:U})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Folders"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(je,{variant:"outline",className:"w-full justify-start gap-3",onClick:G,children:[s.jsx(Lu,{className:"h-4 w-4"}),"Open Logs Folder"]}),s.jsxs(je,{variant:"outline",className:"w-full justify-start gap-3",onClick:k,children:[s.jsx(Lu,{className:"h-4 w-4"}),"Open Auth Folder"]})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Diagnostics"}),s.jsxs(je,{variant:"outline",className:"w-full justify-start gap-3",onClick:K,children:[s.jsx(B2,{className:"h-4 w-4"}),"Copy Diagnostics"]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"Updates"}),s.jsxs(je,{variant:"outline",className:"w-full justify-start gap-3",onClick:q,disabled:m||p==="downloading"||p==="installing",children:[m?s.jsx(zt,{className:"h-4 w-4 animate-spin"}):s.jsx(fa,{className:"h-4 w-4"}),"Check for Updates"]}),(v||p!=="idle")&&s.jsxs("div",{className:Ne("p-4 rounded-lg border text-sm space-y-3",p==="ready"||p==="installing"?"bg-emerald-500/10 border-emerald-500/30":v?.available?"bg-[var(--accent-primary)]/10 border-[var(--accent-primary)]/30":"bg-green-500/10 border-green-500/30"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[p==="ready"?s.jsx(Gw,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0"}):p==="installing"?s.jsx(zt,{className:"h-4 w-4 text-emerald-500 mt-0.5 shrink-0 animate-spin"}):v?.available?s.jsx(Bo,{className:"h-4 w-4 text-[var(--accent-primary)] mt-0.5 shrink-0"}):s.jsx(G0,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("p",{className:"font-medium text-[var(--text-primary)]",children:[p==="downloading"&&"Downloading...",p==="ready"&&`v${v?.version} ready to install`,p==="installing"&&"Installing update...",p==="available"&&`v${v?.version} available`,p==="idle"&&!v?.available&&"Up to date"]}),v?.release_notes&&!v?.available&&s.jsx("p",{className:"text-xs text-[var(--text-muted)] mt-1",children:v.release_notes})]})]}),p==="downloading"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-[var(--bg-void)]",children:s.jsx("div",{className:"h-full bg-[var(--accent-primary)] transition-all duration-300",style:{width:`${h}%`}})}),s.jsxs("p",{className:"text-xs text-[var(--text-muted)] text-center",children:[h.toFixed(0),"% complete"]})]}),_&&s.jsx("div",{className:"p-2 rounded bg-red-500/10 border border-red-500/30 text-red-400 text-xs",children:_}),s.jsxs("div",{className:"flex gap-2",children:[p==="available"&&s.jsxs(s.Fragment,{children:[s.jsxs(je,{size:"sm",onClick:F,className:"flex-1 gap-2",children:[s.jsx(is,{className:"h-3 w-3"}),"Download & Install"]}),s.jsx(je,{size:"sm",variant:"outline",onClick:te,className:"gap-2",children:s.jsx($0,{className:"h-3 w-3"})})]}),p==="ready"&&s.jsxs(je,{size:"sm",onClick:ae,className:"flex-1 gap-2 bg-emerald-600 hover:bg-emerald-500",children:[s.jsx(J0,{className:"h-3 w-3"}),"Install & Restart"]}),p==="installing"&&s.jsx("div",{className:"flex-1 text-center text-xs text-emerald-400",children:"Please wait, do not close the application..."})]})]})]}),s.jsx("div",{className:"pt-4 border-t border-[var(--border-subtle)]",children:s.jsx("p",{className:"text-xs text-center text-[var(--text-muted)]",style:{fontFamily:"var(--font-mono)"},children:"ProxyPilot v0.1.0"})})]})]})]}):null}function sj({isVisible:l}){return s.jsxs("svg",{viewBox:"0 0 200 12",className:Ne("absolute left-0 bottom-0 w-full h-3 pointer-events-none","transition-opacity duration-300",l?"opacity-100":"opacity-0"),preserveAspectRatio:"none",children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"flightPathGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[s.jsx("stop",{offset:"0%",stopColor:"var(--accent-primary)",stopOpacity:"0"}),s.jsx("stop",{offset:"20%",stopColor:"var(--accent-primary)",stopOpacity:"0.6"}),s.jsx("stop",{offset:"80%",stopColor:"var(--accent-glow)",stopOpacity:"0.8"}),s.jsx("stop",{offset:"100%",stopColor:"var(--accent-glow)",stopOpacity:"0"})]})}),s.jsx("path",{d:"M0 6 Q25 2, 50 6 T100 6 T150 6 T200 6",fill:"none",stroke:"url(#flightPathGradient)",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"200",strokeDashoffset:l?"0":"200",className:"transition-all duration-1000 ease-out"}),[40,80,120,160].map(o=>s.jsx("circle",{cx:o,cy:"6",r:"1.5",fill:"var(--accent-glow)",className:Ne("transition-all duration-500",l?"opacity-60":"opacity-0"),style:{transitionDelay:`${o*3}ms`}},o))]})}function lj({isRunning:l,port:o=8318,version:c="v0.1.0"}){const[u,d]=w.useState(!1),[m,g]=w.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx(nj,{isOpen:m,onClose:()=>g(!1)}),s.jsxs("header",{className:Ne("relative h-16 flex items-center justify-between px-6","bg-[var(--bg-panel)] border-b border-[var(--border-subtle)]","before:absolute before:inset-0 before:pointer-events-none","before:bg-gradient-to-b before:from-white/[0.02] before:to-transparent"),children:[s.jsxs("div",{className:"relative flex items-center gap-4",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[s.jsx("div",{className:Ne("relative w-11 h-11 flex items-center justify-center","rounded-lg overflow-hidden","shadow-[0_2px_0_0_oklch(0_0_0/0.2)]","transition-all duration-300",u&&"shadow-[0_0_20px_0_var(--accent-glow)]",l&&"animate-glow-pulse"),children:s.jsx("img",{src:"/logo.png",alt:"ProxyPilot",className:"w-full h-full object-cover"})}),s.jsxs("div",{className:"relative flex flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:Ne("text-xl font-bold uppercase tracking-[0.2em]","text-[var(--text-primary)]","transition-colors duration-300"),style:{fontFamily:"var(--font-display)"},children:"PROXYPILOT"}),s.jsx("span",{className:Ne("px-2 py-0.5 rounded text-[10px] font-medium uppercase tracking-wider","bg-[var(--bg-elevated)] border border-[var(--border-subtle)]","text-[var(--text-muted)]"),style:{fontFamily:"var(--font-mono)"},children:c})]}),s.jsx(sj,{isVisible:u})]})]}),s.jsx("div",{className:Ne("hidden md:block h-8 w-px mx-4","bg-gradient-to-b from-transparent via-[var(--border-default)] to-transparent")}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:Ne("flex items-center gap-2.5 px-4 py-2 rounded-lg","font-medium text-sm tracking-wide","border transition-all duration-300",l?["bg-[oklch(0.72_0.19_145/0.08)]","border-[oklch(0.72_0.19_145/0.4)]","text-[oklch(0.72_0.19_145)]","shadow-[0_0_16px_0_oklch(0.72_0.19_145/0.25),inset_0_1px_0_0_oklch(0.72_0.19_145/0.1)]"].join(" "):["bg-[var(--bg-elevated)]","border-[var(--border-subtle)]","text-[var(--text-muted)]"].join(" ")),children:[s.jsxs("span",{className:"relative flex items-center justify-center",children:[l&&s.jsx("span",{className:Ne("absolute w-4 h-4 rounded-full","bg-[oklch(0.72_0.19_145/0.3)]","animate-radar-pulse")}),s.jsx("span",{className:Ne("relative w-2.5 h-2.5 rounded-full",l?"bg-[oklch(0.72_0.19_145)] shadow-[0_0_8px_0_oklch(0.72_0.19_145)]":"bg-[var(--text-muted)]")})]}),s.jsx("span",{className:"uppercase tracking-wider",style:{fontFamily:"var(--font-mono)"},children:l?"ONLINE":"OFFLINE"}),l&&s.jsxs("span",{className:Ne("ml-1 px-1.5 py-0.5 rounded text-[10px]","bg-[oklch(0.72_0.19_145/0.15)]","text-[oklch(0.72_0.19_145/0.8)]"),style:{fontFamily:"var(--font-mono)"},children:[":",o]})]}),s.jsx("div",{className:Ne("h-6 w-px","bg-[var(--border-subtle)]")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(aj,{}),s.jsx(je,{variant:"ghost",size:"icon-sm",onClick:()=>g(!0),className:Ne("text-[var(--text-muted)]","hover:text-[var(--text-primary)]","hover:bg-[var(--bg-active)]"),title:"Settings",children:s.jsx(zo,{className:"h-4 w-4"})})]})]}),s.jsx("div",{className:Ne("absolute bottom-0 left-0 right-0 h-px","bg-gradient-to-r from-transparent via-[var(--accent-primary)] to-transparent","opacity-20")})]})]})}const rj=[{id:"claude",name:"Claude"},{id:"gemini",name:"Gemini"},{id:"codex",name:"Codex"},{id:"qwen",name:"Qwen"},{id:"anthropic",name:"Anthropic"}];function oj(l){const o=Math.floor(l/3600),c=Math.floor(l%3600/60),u=l%60;return`${o.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}`}function ij(l){return l.toLocaleString()}const cj=({version:l="v0.1.0",requestCount:o=0,providerStatus:c})=>{const{status:u,authFiles:d}=Et(),[m,g]=w.useState(0),[v]=w.useState(()=>Date.now()),x=w.useMemo(()=>c||{claude:d.some(h=>h.toLowerCase().includes("claude")),gemini:d.some(h=>h.toLowerCase().includes("gemini")),codex:d.some(h=>h.toLowerCase().includes("codex")),qwen:d.some(h=>h.toLowerCase().includes("qwen")),anthropic:d.some(h=>h.toLowerCase().includes("anthropic"))},[c,d]);w.useEffect(()=>{const h=setInterval(()=>{g(Math.floor((Date.now()-v)/1e3))},1e3);return()=>clearInterval(h)},[v]);const p=u?.running??!1,b=u?.port??8317;return s.jsxs("div",{className:"instrument-panel",children:[s.jsx("div",{className:"instrument-segment instrument-segment--providers",title:"Provider Status",children:s.jsx("div",{className:"provider-lights",children:rj.map(h=>s.jsx("span",{className:`provider-light ${x[h.id]?"provider-light--active":"provider-light--inactive"}`,title:`${h.name}: ${x[h.id]?"Connected":"Offline"}`},h.id))})}),s.jsxs("div",{className:"instrument-segment",title:"Proxy Port",children:[s.jsx("span",{className:"segment-label",children:"PORT"}),s.jsx("span",{className:"segment-value segment-value--accent",children:b})]}),s.jsxs("div",{className:"instrument-segment",title:"Session Uptime",children:[s.jsx("span",{className:"segment-label",children:"UPTIME"}),s.jsx("span",{className:"segment-value segment-value--uptime",children:oj(m)})]}),s.jsxs("div",{className:"instrument-segment",title:"Total Requests",children:[s.jsx("span",{className:"segment-label",children:"REQ"}),s.jsx("span",{className:"segment-value",children:ij(o)})]}),s.jsx("div",{className:"instrument-segment instrument-segment--version",title:"ProxyPilot Version",children:s.jsx("span",{className:"segment-value segment-value--muted",children:l})}),s.jsx("div",{className:"instrument-segment instrument-segment--status",title:"Proxy Status",children:s.jsxs("span",{className:`status-indicator ${p?"status-indicator--online":"status-indicator--offline"}`,children:[s.jsx("span",{className:"status-dot"}),s.jsx("span",{className:"status-text",children:p?"READY":"OFFLINE"})]})}),s.jsx("style",{children:` .instrument-panel { height: 30px; background: linear-gradient(to bottom, var(--bg-panel), var(--bg-void)); @@ -326,7 +326,7 @@ Error generating stack: `+n.message+` background: var(--border-default); opacity: 0.4; } - `})]})},Dp=[{id:"command",icon:Ru,label:"Command",color:"var(--accent-primary)",shortcut:"Ctrl+1"},{id:"providers",icon:ow,label:"Providers",color:"var(--accent-glow)",shortcut:"Ctrl+2"},{id:"routing",icon:tw,label:"Routing",color:"var(--status-processing)",shortcut:"Ctrl+3"},{id:"memory",icon:Y0,label:"Memory",color:"var(--accent-secondary)",shortcut:"Ctrl+4"},{id:"logs",icon:zw,label:"Logs",color:"var(--text-secondary)",shortcut:"Ctrl+5"},{id:"requests",icon:Ko,label:"Monitor",color:"var(--accent-glow)",shortcut:"Ctrl+6"},{id:"analytics",icon:Mu,label:"Analytics",color:"var(--accent-primary)",shortcut:"Ctrl+7"}];function aj({items:l,activeId:o,onSelect:c}){return s.jsxs("nav",{className:"relative flex flex-col items-center py-3 gap-1",style:{width:"64px",minWidth:"64px",height:"100%",backgroundColor:"var(--bg-panel)",borderRight:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-30",style:{backgroundImage:` + `})]})},Up=[{id:"command",icon:Uu,label:"Command",color:"var(--accent-primary)",shortcut:"Ctrl+1"},{id:"providers",icon:cw,label:"Providers",color:"var(--accent-glow)",shortcut:"Ctrl+2"},{id:"routing",icon:nw,label:"Routing",color:"var(--status-processing)",shortcut:"Ctrl+3"},{id:"memory",icon:X0,label:"Memory",color:"var(--accent-secondary)",shortcut:"Ctrl+4"},{id:"logs",icon:Dw,label:"Logs",color:"var(--text-secondary)",shortcut:"Ctrl+5"},{id:"requests",icon:ur,label:"Monitor",color:"var(--accent-glow)",shortcut:"Ctrl+6"},{id:"analytics",icon:Ru,label:"Analytics",color:"var(--accent-primary)",shortcut:"Ctrl+7"}];function uj({items:l,activeId:o,onSelect:c}){return s.jsxs("nav",{className:"relative flex flex-col items-center py-3 gap-1",style:{width:"64px",minWidth:"64px",height:"100%",backgroundColor:"var(--bg-panel)",borderRight:"1px solid var(--border-subtle)"},children:[s.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-30",style:{backgroundImage:` linear-gradient(to right, var(--border-subtle) 1px, transparent 1px), linear-gradient(to bottom, var(--border-subtle) 1px, transparent 1px) `,backgroundSize:"8px 8px"}}),s.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 pointer-events-none opacity-20",style:{top:"12px",bottom:"12px",width:"2px",background:`repeating-linear-gradient( @@ -335,4 +335,4 @@ Error generating stack: `+n.message+` var(--border-default) 8px, transparent 8px, transparent 16px - )`}}),l.map(u=>{const f=u.id===o,m=u.icon,g=u.color||"var(--text-muted)";return s.jsxs("div",{className:"relative group z-10",children:[s.jsxs("button",{onClick:()=>c(u.id),className:je("relative flex items-center justify-center transition-all duration-300 ease-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","group-hover:scale-105"),style:{width:"48px",height:"48px",borderRadius:"8px",backgroundColor:f?`color-mix(in srgb, ${g} 15%, transparent)`:"transparent",boxShadow:f?`inset 0 0 12px color-mix(in srgb, ${g} 20%, transparent)`:"none"},"aria-label":u.label,"aria-current":f?"page":void 0,children:[f&&s.jsx("span",{className:"absolute left-0 top-0 bottom-0 rounded-r-sm animate-glow-pulse",style:{width:"3px",backgroundColor:g,boxShadow:`0 0 8px ${g}, 0 0 16px ${g}`}}),s.jsx("div",{className:je("relative flex items-center justify-center transition-all duration-300",f&&"animate-signal-pulse","group-hover:scale-110"),style:{filter:f?`drop-shadow(0 0 8px ${g})`:"none"},children:s.jsx(m,{size:20,className:"transition-all duration-300",style:{color:f?g:"var(--text-muted)",filter:f?void 0:"drop-shadow(0 0 0px transparent)"}})}),s.jsx("span",{className:je("absolute inset-0 rounded-lg transition-all duration-300","opacity-0 group-hover:opacity-100",f&&"group-hover:opacity-0"),style:{backgroundColor:"var(--bg-elevated)",boxShadow:`0 0 15px color-mix(in srgb, ${g} 15%, transparent), inset 0 0 8px color-mix(in srgb, ${g} 10%, transparent)`}})]}),s.jsx("div",{className:je("absolute left-full top-1/2 -translate-y-1/2 ml-3","opacity-0 invisible group-hover:opacity-100 group-hover:visible","transition-all duration-200 ease-out","pointer-events-none z-50"),children:s.jsxs("div",{className:"relative px-3 py-2 rounded",style:{backgroundColor:"var(--bg-void)",border:"1px solid var(--accent-glow)",boxShadow:"0 0 12px color-mix(in srgb, var(--accent-glow) 30%, transparent), 0 4px 16px rgba(0, 0, 0, 0.4)"},children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",style:{fontFamily:"var(--font-mono)",fontSize:"11px",fontWeight:600,letterSpacing:"0.05em",color:"var(--text-primary)"},children:[s.jsx("span",{style:{color:g},children:"▸"}),s.jsx("span",{children:u.label.toUpperCase()})]}),u.shortcut&&s.jsx("div",{className:"whitespace-nowrap",style:{fontFamily:"var(--font-mono)",fontSize:"9px",color:"var(--text-muted)",letterSpacing:"0.02em",paddingLeft:"14px"},children:u.shortcut})]}),s.jsx("span",{className:"absolute right-full top-1/2 -translate-y-1/2",style:{width:0,height:0,borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:"6px solid var(--accent-glow)"}}),s.jsx("span",{className:"absolute right-full top-1/2 -translate-y-1/2",style:{width:0,height:0,marginRight:"-1px",borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:"5px solid var(--bg-void)"}})]})})]},u.id)})]})}function nj(){const{status:l,isDesktop:o,mgmtKey:c}=Mt(),[u,f]=w.useState("command"),m=l?.running??!1;w.useEffect(()=>{const v=x=>{if(x.ctrlKey&&x.key>="1"&&x.key<="7"){x.preventDefault();const p=parseInt(x.key,10)-1,b=Dp[p];b&&f(b.id)}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]);const g=()=>{switch(u){case"command":return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"grid gap-6 lg:grid-cols-2",children:s.jsx(lN,{})}),s.jsx(ON,{})]});case"providers":return s.jsxs("div",{className:"space-y-6",children:[s.jsx(kN,{}),!o&&!c&&s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key missing. Start ProxyPilot from the tray app to inject a local key, or set `MANAGEMENT_PASSWORD` before loading this page."})]});case"routing":return s.jsx("div",{className:"space-y-6",children:c?s.jsxs(s.Fragment,{children:[s.jsx(LN,{}),s.jsx(QN,{}),s.jsx(GN,{})]}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access routing settings."})});case"memory":return s.jsx("div",{className:"space-y-6",children:c?s.jsxs(s.Fragment,{children:[s.jsx(HN,{}),s.jsx(YN,{})]}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access memory settings."})});case"logs":return s.jsx("div",{className:"space-y-6",children:c?s.jsx(DN,{}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access logs."})});case"requests":return s.jsx("div",{className:"space-y-6",children:c?s.jsx(VN,{}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access request monitor."})});case"analytics":return s.jsx("div",{className:"space-y-6",children:c?s.jsx(XN,{}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access analytics."})});default:return null}};return s.jsxs("div",{className:"text-foreground transition-colors duration-500",style:{display:"grid",gridTemplateRows:"64px 1fr 32px",gridTemplateColumns:"64px 1fr",height:"100vh",background:"var(--bg-void)"},children:[s.jsx("div",{style:{gridColumn:"1 / -1"},children:s.jsx(WN,{isRunning:m,port:l?.port})}),s.jsx("div",{style:{gridRow:2},children:s.jsx(aj,{items:Dp,activeId:u,onSelect:v=>f(v)})}),s.jsx("main",{className:"animate-fade-in-up",style:{gridRow:2,overflow:"auto",padding:"24px"},children:g()},u),s.jsx("div",{style:{gridColumn:"1 / -1"},children:s.jsx(tj,{})}),s.jsx(i2,{position:"bottom-center",theme:"dark"})]})}function sj(){return s.jsx(U0,{children:s.jsx(c2,{children:s.jsx(nj,{})})})}Ev.createRoot(document.getElementById("root")).render(s.jsx(w.StrictMode,{children:s.jsx(sj,{})})); + )`}}),l.map(u=>{const d=u.id===o,m=u.icon,g=u.color||"var(--text-muted)";return s.jsxs("div",{className:"relative group z-10",children:[s.jsxs("button",{onClick:()=>c(u.id),className:Ne("relative flex items-center justify-center transition-all duration-300 ease-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","group-hover:scale-105"),style:{width:"48px",height:"48px",borderRadius:"8px",backgroundColor:d?`color-mix(in srgb, ${g} 15%, transparent)`:"transparent",boxShadow:d?`inset 0 0 12px color-mix(in srgb, ${g} 20%, transparent)`:"none"},"aria-label":u.label,"aria-current":d?"page":void 0,children:[d&&s.jsx("span",{className:"absolute left-0 top-0 bottom-0 rounded-r-sm animate-glow-pulse",style:{width:"3px",backgroundColor:g,boxShadow:`0 0 8px ${g}, 0 0 16px ${g}`}}),s.jsx("div",{className:Ne("relative flex items-center justify-center transition-all duration-300",d&&"animate-signal-pulse","group-hover:scale-110"),style:{filter:d?`drop-shadow(0 0 8px ${g})`:"none"},children:s.jsx(m,{size:20,className:"transition-all duration-300",style:{color:d?g:"var(--text-muted)",filter:d?void 0:"drop-shadow(0 0 0px transparent)"}})}),s.jsx("span",{className:Ne("absolute inset-0 rounded-lg transition-all duration-300","opacity-0 group-hover:opacity-100",d&&"group-hover:opacity-0"),style:{backgroundColor:"var(--bg-elevated)",boxShadow:`0 0 15px color-mix(in srgb, ${g} 15%, transparent), inset 0 0 8px color-mix(in srgb, ${g} 10%, transparent)`}})]}),s.jsx("div",{className:Ne("absolute left-full top-1/2 -translate-y-1/2 ml-3","opacity-0 invisible group-hover:opacity-100 group-hover:visible","transition-all duration-200 ease-out","pointer-events-none z-50"),children:s.jsxs("div",{className:"relative px-3 py-2 rounded",style:{backgroundColor:"var(--bg-void)",border:"1px solid var(--accent-glow)",boxShadow:"0 0 12px color-mix(in srgb, var(--accent-glow) 30%, transparent), 0 4px 16px rgba(0, 0, 0, 0.4)"},children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",style:{fontFamily:"var(--font-mono)",fontSize:"11px",fontWeight:600,letterSpacing:"0.05em",color:"var(--text-primary)"},children:[s.jsx("span",{style:{color:g},children:"▸"}),s.jsx("span",{children:u.label.toUpperCase()})]}),u.shortcut&&s.jsx("div",{className:"whitespace-nowrap",style:{fontFamily:"var(--font-mono)",fontSize:"9px",color:"var(--text-muted)",letterSpacing:"0.02em",paddingLeft:"14px"},children:u.shortcut})]}),s.jsx("span",{className:"absolute right-full top-1/2 -translate-y-1/2",style:{width:0,height:0,borderTop:"6px solid transparent",borderBottom:"6px solid transparent",borderRight:"6px solid var(--accent-glow)"}}),s.jsx("span",{className:"absolute right-full top-1/2 -translate-y-1/2",style:{width:0,height:0,marginRight:"-1px",borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:"5px solid var(--bg-void)"}})]})})]},u.id)})]})}function dj(){const{status:l,isDesktop:o,mgmtKey:c}=Et(),[u,d]=w.useState("command"),m=l?.running??!1;w.useEffect(()=>{const v=x=>{if(x.ctrlKey&&x.key>="1"&&x.key<="7"){x.preventDefault();const p=parseInt(x.key,10)-1,b=Up[p];b&&d(b.id)}};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[]);const g=()=>{switch(u){case"command":return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"grid gap-6 lg:grid-cols-2",children:s.jsx(iN,{})}),s.jsx(DN,{})]});case"providers":return s.jsxs("div",{className:"space-y-6",children:[s.jsx(ON,{}),!o&&!c&&s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key missing. Start ProxyPilot from the tray app to inject a local key, or set `MANAGEMENT_PASSWORD` before loading this page."})]});case"routing":return s.jsx("div",{className:"space-y-6",children:c?s.jsxs(s.Fragment,{children:[s.jsx(BN,{}),s.jsx(ej,{}),s.jsx($N,{})]}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access routing settings."})});case"memory":return s.jsx("div",{className:"space-y-6",children:c?s.jsxs(s.Fragment,{children:[s.jsx(YN,{}),s.jsx(XN,{})]}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access memory settings."})});case"logs":return s.jsx("div",{className:"space-y-6",children:c?s.jsx(HN,{}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access logs."})});case"requests":return s.jsx("div",{className:"space-y-6",children:c?s.jsx(QN,{}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access request monitor."})});case"analytics":return s.jsx("div",{className:"space-y-6",children:c?s.jsxs(s.Fragment,{children:[s.jsx(ZN,{}),s.jsx(PN,{})]}):s.jsx("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-sm text-amber-300",children:"Management key required to access analytics."})});default:return null}};return s.jsxs("div",{className:"text-foreground transition-colors duration-500",style:{display:"grid",gridTemplateRows:"64px 1fr 32px",gridTemplateColumns:"64px 1fr",height:"100vh",background:"var(--bg-void)"},children:[s.jsx("div",{style:{gridColumn:"1 / -1"},children:s.jsx(lj,{isRunning:m,port:l?.port})}),s.jsx("div",{style:{gridRow:2},children:s.jsx(uj,{items:Up,activeId:u,onSelect:v=>d(v)})}),s.jsx("main",{className:"animate-fade-in-up",style:{gridRow:2,overflow:"auto",padding:"24px"},children:g()},u),s.jsx("div",{style:{gridColumn:"1 / -1"},children:s.jsx(cj,{})}),s.jsx(d2,{position:"bottom-center",theme:"dark"})]})}function fj(){return s.jsx(B0,{children:s.jsx(f2,{children:s.jsx(dj,{})})})}Tv.createRoot(document.getElementById("root")).render(s.jsx(w.StrictMode,{children:s.jsx(fj,{})})); diff --git a/config.example.yaml b/config.example.yaml index c2d60f3a..45ef8523 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -115,6 +115,11 @@ ws-auth: false # summarization-timeout-seconds: 30 # Default: 30. Timeout for LLM summarization calls. # fallback-to-regex: true # Default: true. Use regex-based summary when LLM fails. +# Token refresh and usage tracking configuration. +# auto-refresh-buffer: 5m # Default: 5m. Refresh tokens this long before expiry. +# # Supports Go duration format: "5m", "10m", "1h", etc. +# daily-reset-hour: 0 # Default: 0 (midnight UTC). Hour (0-23, UTC) to reset daily usage stats. + # Token-aware compression (proactive trimming based on model context window). # Prevents "prompt too long" errors by trimming before hitting model limits. # Environment variables: diff --git a/internal/api/handlers/management/auth_priority.go b/internal/api/handlers/management/auth_priority.go new file mode 100644 index 00000000..b4893fac --- /dev/null +++ b/internal/api/handlers/management/auth_priority.go @@ -0,0 +1,50 @@ +package management + +import ( + "net/http" + "strings" + "time" + + "github.com/gin-gonic/gin" +) + +type setAuthPriorityRequest struct { + Priority *int `json:"priority"` +} + +// SetAuthPriority updates the priority field for an auth entry. +func (h *Handler) SetAuthPriority(c *gin.Context) { + authID := strings.TrimSpace(c.Param("id")) + if authID == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "missing auth id"}) + return + } + + var req setAuthPriorityRequest + if err := c.ShouldBindJSON(&req); err != nil || req.Priority == nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "invalid body"}) + return + } + + if h.authManager == nil { + c.JSON(http.StatusServiceUnavailable, gin.H{"error": "auth manager unavailable"}) + return + } + + auth, ok := h.authManager.GetByID(authID) + if !ok || auth == nil { + c.JSON(http.StatusNotFound, gin.H{"error": "auth not found"}) + return + } + + auth.Priority = *req.Priority + auth.UpdatedAt = time.Now() + + updated, err := h.authManager.Update(c.Request.Context(), auth) + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + + c.JSON(http.StatusOK, h.buildAuthFileEntry(updated)) +} diff --git a/internal/api/handlers/management/auth_usage.go b/internal/api/handlers/management/auth_usage.go new file mode 100644 index 00000000..c9b1794c --- /dev/null +++ b/internal/api/handlers/management/auth_usage.go @@ -0,0 +1,34 @@ +package management + +import ( + "net/http" + "strings" + + "github.com/gin-gonic/gin" +) + +// GetAuthUsage returns usage statistics for a specific auth entry. +func (h *Handler) GetAuthUsage(c *gin.Context) { + authID := strings.TrimSpace(c.Param("id")) + if authID == "" { + c.JSON(http.StatusBadRequest, gin.H{"error": "missing auth id"}) + return + } + if h.authManager == nil { + c.JSON(http.StatusServiceUnavailable, gin.H{"error": "auth manager unavailable"}) + return + } + auth, ok := h.authManager.GetByID(authID) + if !ok || auth == nil { + c.JSON(http.StatusNotFound, gin.H{"error": "auth not found"}) + return + } + c.JSON(http.StatusOK, gin.H{ + "total_input_tokens": auth.Usage.TotalInputTokens, + "total_output_tokens": auth.Usage.TotalOutputTokens, + "request_count": auth.Usage.RequestCount, + "daily_input_tokens": auth.Usage.DailyInputTokens, + "daily_output_tokens": auth.Usage.DailyOutputTokens, + "daily_request_count": auth.Usage.DailyRequestCount, + }) +} diff --git a/internal/api/server.go b/internal/api/server.go index f792801f..38ed7173 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -627,6 +627,8 @@ func (s *Server) registerManagementRoutes() { mgmt.GET("/auth-files/download", s.mgmt.DownloadAuthFile) mgmt.POST("/auth-files", s.mgmt.UploadAuthFile) mgmt.DELETE("/auth-files", s.mgmt.DeleteAuthFile) + mgmt.PATCH("/auth/:id/priority", s.mgmt.SetAuthPriority) + mgmt.GET("/auth/:id/usage", s.mgmt.GetAuthUsage) mgmt.POST("/vertex/import", s.mgmt.ImportVertexCredential) mgmt.GET("/anthropic-auth-url", s.mgmt.RequestAnthropicToken) diff --git a/internal/config/sdk_config.go b/internal/config/sdk_config.go index c1c438d8..d67dc489 100644 --- a/internal/config/sdk_config.go +++ b/internal/config/sdk_config.go @@ -4,6 +4,8 @@ // debug settings, proxy configuration, and API keys. package config +import "time" + // GlobalModelMapperFunc is a function type for looking up global model mappings. // It takes a model name and provider hint, and returns the mapped model name (or empty string if no mapping). type GlobalModelMapperFunc func(model string, provider string) string @@ -33,6 +35,14 @@ type SDKConfig struct { // Compression configures context compression behavior for long conversations. Compression CompressionConfig `yaml:"compression,omitempty" json:"compression,omitempty"` + // AutoRefreshBuffer is the duration before token expiry at which automatic refresh is triggered. + // Default is 5 minutes. Example: "5m", "10m", "1h". + AutoRefreshBuffer string `yaml:"auto-refresh-buffer,omitempty" json:"auto-refresh-buffer,omitempty"` + + // DailyResetHour is the hour (0-23, UTC) at which daily usage statistics are reset. + // Default is 0 (midnight UTC). + DailyResetHour *int `yaml:"daily-reset-hour,omitempty" json:"daily-reset-hour,omitempty"` + // GlobalModelMapper is an optional hook for looking up global model mappings. // This is set by the parent Config to enable cross-provider model aliasing. GlobalModelMapper GlobalModelMapperFunc `yaml:"-" json:"-"` @@ -108,6 +118,12 @@ const ( // DefaultAccessProviderName is applied when no provider name is supplied. DefaultAccessProviderName = "config-inline" + + // DefaultAutoRefreshBuffer is the default duration before token expiry for auto-refresh. + DefaultAutoRefreshBuffer = 5 * time.Minute + + // DefaultDailyResetHour is the default hour (UTC) for daily usage reset. + DefaultDailyResetHour = 0 ) // ConfigAPIKeyProvider returns the first inline API key provider if present. @@ -190,3 +206,29 @@ func (cfg *SDKConfig) LookupGlobalModelMapping(model string, provider string) st return cfg.GlobalModelMapper(model, provider) } +// GetAutoRefreshBuffer parses and returns the auto-refresh buffer duration. +// Returns DefaultAutoRefreshBuffer if not set or invalid. +func (cfg *SDKConfig) GetAutoRefreshBuffer() time.Duration { + if cfg == nil || cfg.AutoRefreshBuffer == "" { + return DefaultAutoRefreshBuffer + } + d, err := time.ParseDuration(cfg.AutoRefreshBuffer) + if err != nil || d <= 0 { + return DefaultAutoRefreshBuffer + } + return d +} + +// GetDailyResetHour returns the daily reset hour (0-23, UTC). +// Returns DefaultDailyResetHour if not set or out of range. +func (cfg *SDKConfig) GetDailyResetHour() int { + if cfg == nil || cfg.DailyResetHour == nil { + return DefaultDailyResetHour + } + h := *cfg.DailyResetHour + if h < 0 || h > 23 { + return DefaultDailyResetHour + } + return h +} + diff --git a/sdk/cliproxy/auth/conductor.go b/sdk/cliproxy/auth/conductor.go index 06a383ff..c92d1e69 100644 --- a/sdk/cliproxy/auth/conductor.go +++ b/sdk/cliproxy/auth/conductor.go @@ -115,6 +115,10 @@ type Manager struct { requestRetry atomic.Int32 maxRetryInterval atomic.Int64 + // Auto refresh configuration + autoRefreshBuffer atomic.Int64 // nanoseconds + dailyResetHour atomic.Int32 + // Optional HTTP RoundTripper provider injected by host. rtProvider RoundTripperProvider @@ -181,6 +185,21 @@ func (m *Manager) SetRetryConfig(retry int, maxRetryInterval time.Duration) { m.maxRetryInterval.Store(maxRetryInterval.Nanoseconds()) } +// SetRefreshConfig updates auto-refresh buffer and daily reset hour settings. +func (m *Manager) SetRefreshConfig(autoRefreshBuffer time.Duration, dailyResetHour int) { + if m == nil { + return + } + if autoRefreshBuffer <= 0 { + autoRefreshBuffer = 5 * time.Minute // default + } + if dailyResetHour < 0 || dailyResetHour > 23 { + dailyResetHour = 0 // default to midnight UTC + } + m.autoRefreshBuffer.Store(autoRefreshBuffer.Nanoseconds()) + m.dailyResetHour.Store(int32(dailyResetHour)) +} + // RegisterExecutor registers a provider executor with the manager. func (m *Manager) RegisterExecutor(executor ProviderExecutor) { if executor == nil { @@ -941,12 +960,12 @@ func (m *Manager) MarkResult(ctx context.Context, result Result) { auth.Usage.RequestCount++ auth.Usage.LastRequestAt = now - // Reset daily if new day - if time.Since(auth.Usage.DayStartedAt) > 24*time.Hour { + // Reset daily if past configured reset hour (default: midnight UTC) + if m.shouldResetDailyUsage(auth.Usage.DayStartedAt, now) { auth.Usage.DailyInputTokens = 0 auth.Usage.DailyOutputTokens = 0 auth.Usage.DailyRequestCount = 0 - auth.Usage.DayStartedAt = now.Truncate(24 * time.Hour) + auth.Usage.DayStartedAt = m.getDayStartTime(now) } auth.Usage.DailyInputTokens += result.Usage.InputTokens auth.Usage.DailyOutputTokens += result.Usage.OutputTokens @@ -1531,8 +1550,8 @@ func (m *Manager) shouldRefresh(a *Auth, now time.Time) bool { return evaluator.ShouldRefresh(now, a) } - // Check if token expires within buffer (5 minutes) - const refreshBuffer = 5 * time.Minute + // Check if token expires within buffer (configurable, default 5 minutes) + refreshBuffer := m.getAutoRefreshBuffer() if !a.TokenExpiresAt.IsZero() && a.TokenExpiresAt.Sub(now) < refreshBuffer { return true } @@ -1581,6 +1600,52 @@ func (m *Manager) shouldRefresh(a *Auth, now time.Time) bool { return true } +func (m *Manager) getAutoRefreshBuffer() time.Duration { + if m == nil { + return 5 * time.Minute + } + d := time.Duration(m.autoRefreshBuffer.Load()) + if d <= 0 { + return 5 * time.Minute // default + } + return d +} + +func (m *Manager) getDailyResetHour() int { + if m == nil { + return 0 + } + h := int(m.dailyResetHour.Load()) + if h < 0 || h > 23 { + return 0 + } + return h +} + +// shouldResetDailyUsage checks if daily usage stats should be reset based on configured reset hour. +func (m *Manager) shouldResetDailyUsage(dayStartedAt, now time.Time) bool { + if dayStartedAt.IsZero() { + return true + } + resetHour := m.getDailyResetHour() + // Calculate next reset time from dayStartedAt + nextReset := time.Date(dayStartedAt.Year(), dayStartedAt.Month(), dayStartedAt.Day(), resetHour, 0, 0, 0, time.UTC) + if !nextReset.After(dayStartedAt) { + nextReset = nextReset.Add(24 * time.Hour) + } + return now.After(nextReset) || now.Equal(nextReset) +} + +// getDayStartTime returns the start time for the current usage day based on configured reset hour. +func (m *Manager) getDayStartTime(now time.Time) time.Time { + resetHour := m.getDailyResetHour() + dayStart := time.Date(now.Year(), now.Month(), now.Day(), resetHour, 0, 0, 0, time.UTC) + if dayStart.After(now) { + dayStart = dayStart.Add(-24 * time.Hour) + } + return dayStart +} + func authPreferredInterval(a *Auth) time.Duration { if a == nil { return 0 diff --git a/sdk/config/config.go b/sdk/config/config.go index dc33aa9b..a18de273 100644 --- a/sdk/config/config.go +++ b/sdk/config/config.go @@ -1,60 +1,62 @@ -// Package config provides the public SDK configuration API. -// -// It re-exports the server configuration types and helpers so external projects can -// embed CLIProxyAPI without importing internal packages. -package config - -import internalconfig "github.com/router-for-me/CLIProxyAPI/v6/internal/config" - -type SDKConfig = internalconfig.SDKConfig -type AccessConfig = internalconfig.AccessConfig -type AccessProvider = internalconfig.AccessProvider - -type Config = internalconfig.Config - -type StreamingConfig = internalconfig.StreamingConfig -type TLSConfig = internalconfig.TLSConfig -type RemoteManagement = internalconfig.RemoteManagement -type PayloadConfig = internalconfig.PayloadConfig -type PayloadRule = internalconfig.PayloadRule -type PayloadModelRule = internalconfig.PayloadModelRule - -type GeminiKey = internalconfig.GeminiKey -type CodexKey = internalconfig.CodexKey -type ClaudeKey = internalconfig.ClaudeKey -type VertexCompatKey = internalconfig.VertexCompatKey -type VertexCompatModel = internalconfig.VertexCompatModel -type OpenAICompatibility = internalconfig.OpenAICompatibility -type OpenAICompatibilityAPIKey = internalconfig.OpenAICompatibilityAPIKey -type OpenAICompatibilityModel = internalconfig.OpenAICompatibilityModel -type GlobalModelMapping = internalconfig.GlobalModelMapping - -type TLS = internalconfig.TLSConfig - -const ( - AccessProviderTypeConfigAPIKey = internalconfig.AccessProviderTypeConfigAPIKey - DefaultAccessProviderName = internalconfig.DefaultAccessProviderName - DefaultPanelGitHubRepository = internalconfig.DefaultPanelGitHubRepository -) - -func MakeInlineAPIKeyProvider(keys []string) *AccessProvider { - return internalconfig.MakeInlineAPIKeyProvider(keys) -} - -func LoadConfig(configFile string) (*Config, error) { return internalconfig.LoadConfig(configFile) } - -func LoadConfigOptional(configFile string, optional bool) (*Config, error) { - return internalconfig.LoadConfigOptional(configFile, optional) -} - -func SaveConfigPreserveComments(configFile string, cfg *Config) error { - return internalconfig.SaveConfigPreserveComments(configFile, cfg) -} - -func SaveConfigPreserveCommentsUpdateNestedScalar(configFile string, path []string, value string) error { - return internalconfig.SaveConfigPreserveCommentsUpdateNestedScalar(configFile, path, value) -} - -func NormalizeCommentIndentation(data []byte) []byte { - return internalconfig.NormalizeCommentIndentation(data) -} +// Package config provides the public SDK configuration API. +// +// It re-exports the server configuration types and helpers so external projects can +// embed CLIProxyAPI without importing internal packages. +package config + +import internalconfig "github.com/router-for-me/CLIProxyAPI/v6/internal/config" + +type SDKConfig = internalconfig.SDKConfig +type AccessConfig = internalconfig.AccessConfig +type AccessProvider = internalconfig.AccessProvider + +type Config = internalconfig.Config + +type StreamingConfig = internalconfig.StreamingConfig +type TLSConfig = internalconfig.TLSConfig +type RemoteManagement = internalconfig.RemoteManagement +type PayloadConfig = internalconfig.PayloadConfig +type PayloadRule = internalconfig.PayloadRule +type PayloadModelRule = internalconfig.PayloadModelRule + +type GeminiKey = internalconfig.GeminiKey +type CodexKey = internalconfig.CodexKey +type ClaudeKey = internalconfig.ClaudeKey +type VertexCompatKey = internalconfig.VertexCompatKey +type VertexCompatModel = internalconfig.VertexCompatModel +type OpenAICompatibility = internalconfig.OpenAICompatibility +type OpenAICompatibilityAPIKey = internalconfig.OpenAICompatibilityAPIKey +type OpenAICompatibilityModel = internalconfig.OpenAICompatibilityModel +type GlobalModelMapping = internalconfig.GlobalModelMapping + +type TLS = internalconfig.TLSConfig + +const ( + AccessProviderTypeConfigAPIKey = internalconfig.AccessProviderTypeConfigAPIKey + DefaultAccessProviderName = internalconfig.DefaultAccessProviderName + DefaultPanelGitHubRepository = internalconfig.DefaultPanelGitHubRepository + DefaultAutoRefreshBuffer = internalconfig.DefaultAutoRefreshBuffer + DefaultDailyResetHour = internalconfig.DefaultDailyResetHour +) + +func MakeInlineAPIKeyProvider(keys []string) *AccessProvider { + return internalconfig.MakeInlineAPIKeyProvider(keys) +} + +func LoadConfig(configFile string) (*Config, error) { return internalconfig.LoadConfig(configFile) } + +func LoadConfigOptional(configFile string, optional bool) (*Config, error) { + return internalconfig.LoadConfigOptional(configFile, optional) +} + +func SaveConfigPreserveComments(configFile string, cfg *Config) error { + return internalconfig.SaveConfigPreserveComments(configFile, cfg) +} + +func SaveConfigPreserveCommentsUpdateNestedScalar(configFile string, path []string, value string) error { + return internalconfig.SaveConfigPreserveCommentsUpdateNestedScalar(configFile, path, value) +} + +func NormalizeCommentIndentation(data []byte) []byte { + return internalconfig.NormalizeCommentIndentation(data) +} diff --git a/webui/src/App.tsx b/webui/src/App.tsx index 6511d82d..422637a7 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -13,6 +13,7 @@ import { ConfigEditor, RequestMonitor, UsageStats, + AccountUsage, ThinkingBudgetSettings, } from '@/components/dashboard' import { Header } from '@/components/layout/Header' @@ -133,7 +134,10 @@ function DashboardContent() { return (
{mgmtKey ? ( - + <> + + + ) : (
Management key required to access analytics. diff --git a/webui/src/components/dashboard/AccountUsage.tsx b/webui/src/components/dashboard/AccountUsage.tsx new file mode 100644 index 00000000..29cd4a20 --- /dev/null +++ b/webui/src/components/dashboard/AccountUsage.tsx @@ -0,0 +1,367 @@ +import { useEffect, useState } from 'react' +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' +import { useProxyContext } from '@/hooks/useProxyContext' +import { Loader2, Users, Zap, Activity, RefreshCw, Clock } from 'lucide-react' +import { cn } from '@/lib/utils' + +interface AccountUsageData { + total_input_tokens: number + total_output_tokens: number + request_count: number + daily_input_tokens: number + daily_output_tokens: number + daily_request_count: number + day_started_at?: string +} + +interface AuthFileInfo { + id: string + name: string + provider?: string + type?: string + email?: string + label?: string + status?: string + usage?: AccountUsageData +} + +// Provider color mapping +const providerColors: Record = { + claude: 'oklch(0.60 0.15 35)', + anthropic: 'oklch(0.60 0.15 35)', + gemini: 'oklch(0.55 0.18 250)', + 'gemini-cli': 'oklch(0.58 0.16 240)', + codex: 'oklch(0.60 0.16 145)', + qwen: 'oklch(0.60 0.14 280)', + antigravity: 'oklch(0.65 0.20 320)', + kiro: 'oklch(0.58 0.17 200)', + amazonq: 'oklch(0.55 0.16 30)', + minimax: 'oklch(0.60 0.18 60)', + zhipu: 'oklch(0.55 0.15 180)', +} + +function getProviderColor(provider: string): string { + const p = provider?.toLowerCase() || '' + for (const [key, color] of Object.entries(providerColors)) { + if (p.includes(key)) return color + } + return 'oklch(0.55 0.15 220)' // default blue +} + +function formatTokens(n: number): string { + if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M` + if (n >= 1_000) return `${(n / 1_000).toFixed(1)}K` + return n.toString() +} + +function formatTimeAgo(dateStr?: string): string { + if (!dateStr) return 'N/A' + const date = new Date(dateStr) + const now = new Date() + const diffMs = now.getTime() - date.getTime() + const diffHours = Math.floor(diffMs / (1000 * 60 * 60)) + const diffMins = Math.floor(diffMs / (1000 * 60)) + + if (diffHours >= 24) { + const days = Math.floor(diffHours / 24) + return `${days}d ago` + } + if (diffHours > 0) return `${diffHours}h ago` + if (diffMins > 0) return `${diffMins}m ago` + return 'just now' +} + +interface AccountCardProps { + account: AuthFileInfo + maxTotalTokens: number +} + +function AccountCard({ account, maxTotalTokens }: AccountCardProps) { + const usage = account.usage + const totalTokens = (usage?.total_input_tokens || 0) + (usage?.total_output_tokens || 0) + const dailyTokens = (usage?.daily_input_tokens || 0) + (usage?.daily_output_tokens || 0) + const color = getProviderColor(account.provider || account.type || '') + const barWidth = maxTotalTokens > 0 ? (totalTokens / maxTotalTokens) * 100 : 0 + + const displayName = account.email || account.label || account.name || account.id + const providerName = account.provider || account.type || 'unknown' + + return ( +
+ {/* Hover glow */} +
+ {/* Hover border */} +
+ + {/* Header */} +
+
+
+ + {providerName} + + {account.status && ( + + {account.status} + + )} +
+

+ {displayName} +

+
+
+ + {/* Stats Grid */} +
+
+
+ + Requests +
+
+ {usage?.request_count?.toLocaleString() || 0} +
+
+
+
+ + Total Tokens +
+
+ {formatTokens(totalTokens)} +
+
+
+ + {/* Token Bar */} +
+
+ In: {formatTokens(usage?.total_input_tokens || 0)} + Out: {formatTokens(usage?.total_output_tokens || 0)} +
+
+
+
+
+ + {/* Daily Stats */} +
+
+
+ + Daily: {usage?.daily_request_count || 0} reqs, {formatTokens(dailyTokens)} tokens +
+
+ Reset {formatTimeAgo(usage?.day_started_at)} +
+
+
+
+ ) +} + +export function AccountUsage() { + const { mgmtFetch, status } = useProxyContext() + const [accounts, setAccounts] = useState([]) + const [loading, setLoading] = useState(true) + const [error, setError] = useState(null) + + const isRunning = status?.running ?? false + + const fetchData = async () => { + if (!isRunning) { + setAccounts([]) + setLoading(false) + return + } + try { + const res = await mgmtFetch('/v0/management/auth-files') + const files = res.files || [] + setAccounts(files) + setError(null) + } catch (e) { + console.error('Failed to fetch auth files:', e) + setError(e instanceof Error ? e.message : String(e)) + } finally { + setLoading(false) + } + } + + useEffect(() => { + fetchData() + const interval = setInterval(fetchData, 30000) + return () => clearInterval(interval) + }, [isRunning]) + + // Calculate max tokens for relative bar sizing + const maxTotalTokens = Math.max( + ...accounts.map(a => (a.usage?.total_input_tokens || 0) + (a.usage?.total_output_tokens || 0)), + 1 + ) + + // Aggregate totals + const totals = accounts.reduce( + (acc, a) => ({ + requests: acc.requests + (a.usage?.request_count || 0), + inputTokens: acc.inputTokens + (a.usage?.total_input_tokens || 0), + outputTokens: acc.outputTokens + (a.usage?.total_output_tokens || 0), + dailyRequests: acc.dailyRequests + (a.usage?.daily_request_count || 0), + }), + { requests: 0, inputTokens: 0, outputTokens: 0, dailyRequests: 0 } + ) + + if (loading && accounts.length === 0) { + return ( +
+ +
+ ) + } + + if (!isRunning) { + return ( + + +
+ + Account Usage +
+ Per-account usage statistics +
+ +
+ Start the proxy engine to view account usage +
+
+
+ ) + } + + if (error && accounts.length === 0) { + return ( +
+

Failed to load account usage

+

{error}

+
+ ) + } + + if (accounts.length === 0) { + return ( + + +
+ + Account Usage +
+ Per-account usage statistics +
+ +
+ No accounts configured. Add providers in the Providers tab. +
+
+
+ ) + } + + return ( +
+ {/* Summary Card */} + + +
+
+ + Account Usage +
+ +
+ + {accounts.length} account{accounts.length !== 1 ? 's' : ''} across all providers + +
+ +
+
+

Total Requests

+

+ {totals.requests.toLocaleString()} +

+
+
+

Input Tokens

+

+ {formatTokens(totals.inputTokens)} +

+
+
+

Output Tokens

+

+ {formatTokens(totals.outputTokens)} +

+
+
+

Today's Requests

+

+ {totals.dailyRequests.toLocaleString()} +

+
+
+
+
+ + {/* Account Grid */} +
+ {accounts.map((account) => ( + + ))} +
+
+ ) +} diff --git a/webui/src/components/dashboard/index.ts b/webui/src/components/dashboard/index.ts index 5e20cd55..7e80ee72 100644 --- a/webui/src/components/dashboard/index.ts +++ b/webui/src/components/dashboard/index.ts @@ -8,6 +8,7 @@ export { SemanticMemory } from './SemanticMemory' export { ConfigEditor } from './ConfigEditor' export { RequestMonitor } from './RequestMonitor' export { UsageStats } from './UsageStats' +export { AccountUsage } from './AccountUsage' export { ThinkingBudgetSettings } from './ThinkingBudgetSettings' export * from './Integrations' export * from './AgentSetup'