@agentprojectcontext/apx 1.39.0 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/package.json +1 -2
  2. package/src/core/agent/constants.js +7 -1
  3. package/src/core/agent/retry.js +9 -0
  4. package/src/core/agent/run-agent.js +56 -5
  5. package/src/core/agent/tools/pseudo-tools.js +13 -1
  6. package/src/core/channels/telegram/dispatch.js +23 -3
  7. package/src/core/engines/mock.js +33 -10
  8. package/src/core/i18n/en.js +2 -4
  9. package/src/core/i18n/es.js +1 -4
  10. package/src/core/i18n/index.js +5 -1
  11. package/src/core/i18n/pt.js +1 -3
  12. package/src/core/routines/runner.js +15 -3
  13. package/src/host/daemon/api/admin.js +29 -0
  14. package/src/interfaces/web/dist/assets/index-Cg-uHCex.js +646 -0
  15. package/src/interfaces/web/dist/assets/index-Cg-uHCex.js.map +1 -0
  16. package/src/interfaces/web/dist/assets/index-wrEbTJbc.css +1 -0
  17. package/src/interfaces/web/dist/index.html +2 -2
  18. package/src/interfaces/web/package-lock.json +11 -11
  19. package/src/interfaces/web/src/App.tsx +22 -11
  20. package/src/interfaces/web/src/components/AddProjectDialog.tsx +66 -34
  21. package/src/interfaces/web/src/components/ModelCombobox.tsx +6 -3
  22. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +28 -25
  23. package/src/interfaces/web/src/components/chat/ModelPicker.tsx +19 -17
  24. package/src/interfaces/web/src/components/deck/WidgetRow.tsx +9 -7
  25. package/src/interfaces/web/src/components/inputs/VarTokenInput.tsx +21 -19
  26. package/src/interfaces/web/src/components/layout/ProjectSidebar.tsx +3 -2
  27. package/src/interfaces/web/src/components/routines/AvailableVarsCard.tsx +23 -0
  28. package/src/interfaces/web/src/components/routines/ExecutionsList.tsx +189 -0
  29. package/src/interfaces/web/src/components/routines/ReadOnlyBlock.tsx +14 -0
  30. package/src/interfaces/web/src/components/routines/RoutineDetail.tsx +86 -0
  31. package/src/interfaces/web/src/components/routines/RoutineEditor.tsx +263 -0
  32. package/src/interfaces/web/src/components/routines/RoutineList.tsx +59 -0
  33. package/src/interfaces/web/src/components/routines/VarTextarea.tsx +70 -0
  34. package/src/interfaces/web/src/components/routines/shared.ts +89 -0
  35. package/src/interfaces/web/src/components/settings/PairDeviceDialog.tsx +19 -16
  36. package/src/interfaces/web/src/components/settings/TelegramContactsPanel.tsx +10 -8
  37. package/src/interfaces/web/src/components/settings/providers/ProviderModal.tsx +7 -4
  38. package/src/interfaces/web/src/components/ui/chat-input.tsx +24 -21
  39. package/src/interfaces/web/src/components/ui/sidebar.tsx +20 -18
  40. package/src/interfaces/web/src/components/ui.tsx +4 -0
  41. package/src/interfaces/web/src/i18n/en.ts +34 -11
  42. package/src/interfaces/web/src/i18n/es.ts +34 -11
  43. package/src/interfaces/web/src/lib/api/filesystem.ts +6 -0
  44. package/src/interfaces/web/src/screens/ApxAdminScreen.tsx +11 -3
  45. package/src/interfaces/web/src/screens/modules/DeckScreen.tsx +6 -3
  46. package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +8 -5
  47. package/src/interfaces/web/src/screens/project/McpsTab.tsx +16 -9
  48. package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +126 -373
  49. package/src/interfaces/web/src/styles.css +5 -0
  50. package/src/interfaces/web/dist/assets/index-CAKEYko0.css +0 -1
  51. package/src/interfaces/web/dist/assets/index-UzqHxD0B.js +0 -639
  52. package/src/interfaces/web/dist/assets/index-UzqHxD0B.js.map +0 -1
@@ -0,0 +1,646 @@
1
+ function ZR(e,t){for(var s=0;s<t.length;s++){const o=t[s];if(typeof o!="string"&&!Array.isArray(o)){for(const l in o)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(o,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>o[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();function jx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fg={exports:{}},Gi={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var o1;function WR(){if(o1)return Gi;o1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(o,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var p in l)p!=="key"&&(c[p]=l[p])}else c=l;return l=c.ref,{$$typeof:e,type:o,key:u,ref:l!==void 0?l:null,props:c}}return Gi.Fragment=t,Gi.jsx=s,Gi.jsxs=s,Gi}var l1;function JR(){return l1||(l1=1,fg.exports=WR()),fg.exports}var r=JR(),pg={exports:{}},it={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var i1;function eT(){if(i1)return it;i1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),_=Symbol.iterator;function k(H){return H===null||typeof H!="object"?null:(H=_&&H[_]||H["@@iterator"],typeof H=="function"?H:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,w={};function S(H,Q,Y){this.props=H,this.context=Q,this.refs=w,this.updater=Y||C}S.prototype.isReactComponent={},S.prototype.setState=function(H,Q){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,Q,"setState")},S.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function N(){}N.prototype=S.prototype;function E(H,Q,Y){this.props=H,this.context=Q,this.refs=w,this.updater=Y||C}var R=E.prototype=new N;R.constructor=E,y(R,S.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function T(){}var A={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function I(H,Q,Y){var J=Y.ref;return{$$typeof:e,type:H,key:Q,ref:J!==void 0?J:null,props:Y}}function D(H,Q){return I(H.type,Q,H.props)}function P(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function L(H){var Q={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(Y){return Q[Y]})}var U=/\/+/g;function q(H,Q){return typeof H=="object"&&H!==null&&H.key!=null?L(""+H.key):Q.toString(36)}function $(H){switch(H.status){case"fulfilled":return H.value;case"rejected":throw H.reason;default:switch(typeof H.status=="string"?H.then(T,T):(H.status="pending",H.then(function(Q){H.status==="pending"&&(H.status="fulfilled",H.value=Q)},function(Q){H.status==="pending"&&(H.status="rejected",H.reason=Q)})),H.status){case"fulfilled":return H.value;case"rejected":throw H.reason}}throw H}function V(H,Q,Y,J,oe){var ne=typeof H;(ne==="undefined"||ne==="boolean")&&(H=null);var te=!1;if(H===null)te=!0;else switch(ne){case"bigint":case"string":case"number":te=!0;break;case"object":switch(H.$$typeof){case e:case t:te=!0;break;case h:return te=H._init,V(te(H._payload),Q,Y,J,oe)}}if(te)return oe=oe(H),te=J===""?"."+q(H,0):J,M(oe)?(Y="",te!=null&&(Y=te.replace(U,"$&/")+"/"),V(oe,Q,Y,"",function(ze){return ze})):oe!=null&&(P(oe)&&(oe=D(oe,Y+(oe.key==null||H&&H.key===oe.key?"":(""+oe.key).replace(U,"$&/")+"/")+te)),Q.push(oe)),1;te=0;var le=J===""?".":J+":";if(M(H))for(var fe=0;fe<H.length;fe++)J=H[fe],ne=le+q(J,fe),te+=V(J,Q,Y,ne,oe);else if(fe=k(H),typeof fe=="function")for(H=fe.call(H),fe=0;!(J=H.next()).done;)J=J.value,ne=le+q(J,fe++),te+=V(J,Q,Y,ne,oe);else if(ne==="object"){if(typeof H.then=="function")return V($(H),Q,Y,J,oe);throw Q=String(H),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return te}function G(H,Q,Y){if(H==null)return H;var J=[],oe=0;return V(H,J,"","",function(ne){return Q.call(Y,ne,oe++)}),J}function K(H){if(H._status===-1){var Q=H._result;Q=Q(),Q.then(function(Y){(H._status===0||H._status===-1)&&(H._status=1,H._result=Y)},function(Y){(H._status===0||H._status===-1)&&(H._status=2,H._result=Y)}),H._status===-1&&(H._status=0,H._result=Q)}if(H._status===1)return H._result.default;throw H._result}var F=typeof reportError=="function"?reportError:function(H){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof H=="object"&&H!==null&&typeof H.message=="string"?String(H.message):String(H),error:H});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",H);return}console.error(H)},X={map:G,forEach:function(H,Q,Y){G(H,function(){Q.apply(this,arguments)},Y)},count:function(H){var Q=0;return G(H,function(){Q++}),Q},toArray:function(H){return G(H,function(Q){return Q})||[]},only:function(H){if(!P(H))throw Error("React.Children.only expected to receive a single React element child.");return H}};return it.Activity=b,it.Children=X,it.Component=S,it.Fragment=s,it.Profiler=l,it.PureComponent=E,it.StrictMode=o,it.Suspense=m,it.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,it.__COMPILER_RUNTIME={__proto__:null,c:function(H){return A.H.useMemoCache(H)}},it.cache=function(H){return function(){return H.apply(null,arguments)}},it.cacheSignal=function(){return null},it.cloneElement=function(H,Q,Y){if(H==null)throw Error("The argument must be a React element, but you passed "+H+".");var J=y({},H.props),oe=H.key;if(Q!=null)for(ne in Q.key!==void 0&&(oe=""+Q.key),Q)!z.call(Q,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&Q.ref===void 0||(J[ne]=Q[ne]);var ne=arguments.length-2;if(ne===1)J.children=Y;else if(1<ne){for(var te=Array(ne),le=0;le<ne;le++)te[le]=arguments[le+2];J.children=te}return I(H.type,oe,J)},it.createContext=function(H){return H={$$typeof:u,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null},H.Provider=H,H.Consumer={$$typeof:c,_context:H},H},it.createElement=function(H,Q,Y){var J,oe={},ne=null;if(Q!=null)for(J in Q.key!==void 0&&(ne=""+Q.key),Q)z.call(Q,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(oe[J]=Q[J]);var te=arguments.length-2;if(te===1)oe.children=Y;else if(1<te){for(var le=Array(te),fe=0;fe<te;fe++)le[fe]=arguments[fe+2];oe.children=le}if(H&&H.defaultProps)for(J in te=H.defaultProps,te)oe[J]===void 0&&(oe[J]=te[J]);return I(H,ne,oe)},it.createRef=function(){return{current:null}},it.forwardRef=function(H){return{$$typeof:p,render:H}},it.isValidElement=P,it.lazy=function(H){return{$$typeof:h,_payload:{_status:-1,_result:H},_init:K}},it.memo=function(H,Q){return{$$typeof:g,type:H,compare:Q===void 0?null:Q}},it.startTransition=function(H){var Q=A.T,Y={};A.T=Y;try{var J=H(),oe=A.S;oe!==null&&oe(Y,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(T,F)}catch(ne){F(ne)}finally{Q!==null&&Y.types!==null&&(Q.types=Y.types),A.T=Q}},it.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},it.use=function(H){return A.H.use(H)},it.useActionState=function(H,Q,Y){return A.H.useActionState(H,Q,Y)},it.useCallback=function(H,Q){return A.H.useCallback(H,Q)},it.useContext=function(H){return A.H.useContext(H)},it.useDebugValue=function(){},it.useDeferredValue=function(H,Q){return A.H.useDeferredValue(H,Q)},it.useEffect=function(H,Q){return A.H.useEffect(H,Q)},it.useEffectEvent=function(H){return A.H.useEffectEvent(H)},it.useId=function(){return A.H.useId()},it.useImperativeHandle=function(H,Q,Y){return A.H.useImperativeHandle(H,Q,Y)},it.useInsertionEffect=function(H,Q){return A.H.useInsertionEffect(H,Q)},it.useLayoutEffect=function(H,Q){return A.H.useLayoutEffect(H,Q)},it.useMemo=function(H,Q){return A.H.useMemo(H,Q)},it.useOptimistic=function(H,Q){return A.H.useOptimistic(H,Q)},it.useReducer=function(H,Q,Y){return A.H.useReducer(H,Q,Y)},it.useRef=function(H){return A.H.useRef(H)},it.useState=function(H){return A.H.useState(H)},it.useSyncExternalStore=function(H,Q,Y){return A.H.useSyncExternalStore(H,Q,Y)},it.useTransition=function(){return A.H.useTransition()},it.version="19.2.7",it}var c1;function Dc(){return c1||(c1=1,pg.exports=eT()),pg.exports}var x=Dc();const Pc=jx(x),tT=ZR({__proto__:null,default:Pc},[x]);var mg={exports:{}},Yi={},gg={exports:{}},hg={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var u1;function nT(){return u1||(u1=1,(function(e){function t(V,G){var K=V.length;V.push(G);e:for(;0<K;){var F=K-1>>>1,X=V[F];if(0<l(X,G))V[F]=G,V[K]=X,K=F;else break e}}function s(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var G=V[0],K=V.pop();if(K!==G){V[0]=K;e:for(var F=0,X=V.length,H=X>>>1;F<H;){var Q=2*(F+1)-1,Y=V[Q],J=Q+1,oe=V[J];if(0>l(Y,K))J<X&&0>l(oe,Y)?(V[F]=oe,V[J]=K,F=J):(V[F]=Y,V[Q]=K,F=Q);else if(J<X&&0>l(oe,K))V[F]=oe,V[J]=K,F=J;else break e}}return G}function l(V,G){var K=V.sortIndex-G.sortIndex;return K!==0?K:V.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,p=u.now();e.unstable_now=function(){return u.now()-p}}var m=[],g=[],h=1,b=null,_=3,k=!1,C=!1,y=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(V){for(var G=s(g);G!==null;){if(G.callback===null)o(g);else if(G.startTime<=V)o(g),G.sortIndex=G.expirationTime,t(m,G);else break;G=s(g)}}function M(V){if(y=!1,R(V),!C)if(s(m)!==null)C=!0,T||(T=!0,L());else{var G=s(g);G!==null&&$(M,G.startTime-V)}}var T=!1,A=-1,z=5,I=-1;function D(){return w?!0:!(e.unstable_now()-I<z)}function P(){if(w=!1,T){var V=e.unstable_now();I=V;var G=!0;try{e:{C=!1,y&&(y=!1,N(A),A=-1),k=!0;var K=_;try{t:{for(R(V),b=s(m);b!==null&&!(b.expirationTime>V&&D());){var F=b.callback;if(typeof F=="function"){b.callback=null,_=b.priorityLevel;var X=F(b.expirationTime<=V);if(V=e.unstable_now(),typeof X=="function"){b.callback=X,R(V),G=!0;break t}b===s(m)&&o(m),R(V)}else o(m);b=s(m)}if(b!==null)G=!0;else{var H=s(g);H!==null&&$(M,H.startTime-V),G=!1}}break e}finally{b=null,_=K,k=!1}G=void 0}}finally{G?L():T=!1}}}var L;if(typeof E=="function")L=function(){E(P)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,q=U.port2;U.port1.onmessage=P,L=function(){q.postMessage(null)}}else L=function(){S(P,0)};function $(V,G){A=S(function(){V(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(V){switch(_){case 1:case 2:case 3:var G=3;break;default:G=_}var K=_;_=G;try{return V()}finally{_=K}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(V,G){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var K=_;_=V;try{return G()}finally{_=K}},e.unstable_scheduleCallback=function(V,G,K){var F=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?F+K:F):K=F,V){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=K+X,V={id:h++,callback:G,priorityLevel:V,startTime:K,expirationTime:X,sortIndex:-1},K>F?(V.sortIndex=K,t(g,V),s(m)===null&&V===s(g)&&(y?(N(A),A=-1):y=!0,$(M,K-F))):(V.sortIndex=X,t(m,V),C||k||(C=!0,T||(T=!0,L()))),V},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(V){var G=_;return function(){var K=_;_=G;try{return V.apply(this,arguments)}finally{_=K}}}})(hg)),hg}var d1;function aT(){return d1||(d1=1,gg.exports=nT()),gg.exports}var xg={exports:{}},Bn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var f1;function sT(){if(f1)return Bn;f1=1;var e=Dc();function t(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)g+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,g,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:m,containerInfo:g,implementation:h}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Bn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Bn.createPortal=function(m,g){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return c(m,g,null,h)},Bn.flushSync=function(m){var g=u.T,h=o.p;try{if(u.T=null,o.p=2,m)return m()}finally{u.T=g,o.p=h,o.d.f()}},Bn.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,o.d.C(m,g))},Bn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Bn.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var h=g.as,b=p(h,g.crossOrigin),_=typeof g.integrity=="string"?g.integrity:void 0,k=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;h==="style"?o.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:_,fetchPriority:k}):h==="script"&&o.d.X(m,{crossOrigin:b,integrity:_,fetchPriority:k,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Bn.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var h=p(g.as,g.crossOrigin);o.d.M(m,{crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&o.d.M(m)},Bn.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var h=g.as,b=p(h,g.crossOrigin);o.d.L(m,h,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Bn.preloadModule=function(m,g){if(typeof m=="string")if(g){var h=p(g.as,g.crossOrigin);o.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else o.d.m(m)},Bn.requestFormReset=function(m){o.d.r(m)},Bn.unstable_batchedUpdates=function(m,g){return m(g)},Bn.useFormState=function(m,g,h){return u.H.useFormState(m,g,h)},Bn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Bn.version="19.2.7",Bn}var p1;function Qw(){if(p1)return xg.exports;p1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),xg.exports=sT(),xg.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var m1;function rT(){if(m1)return Yi;m1=1;var e=aT(),t=Dc(),s=Qw();function o(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){var a=n,i=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(i=a.return),n=a.return;while(n)}return a.tag===3?i:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function p(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(c(n)!==n)throw Error(o(188))}function g(n){var a=n.alternate;if(!a){if(a=c(n),a===null)throw Error(o(188));return a!==n?null:n}for(var i=n,d=a;;){var v=i.return;if(v===null)break;var j=v.alternate;if(j===null){if(d=v.return,d!==null){i=d;continue}break}if(v.child===j.child){for(j=v.child;j;){if(j===i)return m(v),n;if(j===d)return m(v),a;j=j.sibling}throw Error(o(188))}if(i.return!==d.return)i=v,d=j;else{for(var O=!1,B=v.child;B;){if(B===i){O=!0,i=v,d=j;break}if(B===d){O=!0,d=v,i=j;break}B=B.sibling}if(!O){for(B=j.child;B;){if(B===i){O=!0,i=j,d=v;break}if(B===d){O=!0,d=j,i=v;break}B=B.sibling}if(!O)throw Error(o(189))}}if(i.alternate!==d)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?n:a}function h(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=h(n),a!==null)return a;n=n.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),E=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function L(n){return n===null||typeof n!="object"?null:(n=P&&n[P]||n["@@iterator"],typeof n=="function"?n:null)}var U=Symbol.for("react.client.reference");function q(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===U?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case y:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case M:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case C:return"Portal";case E:return n.displayName||"Context";case N:return(n._context.displayName||"Context")+".Consumer";case R:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case A:return a=n.displayName||null,a!==null?a:q(n.type)||"Memo";case z:a=n._payload,n=n._init;try{return q(n(a))}catch{}}return null}var $=Array.isArray,V=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},F=[],X=-1;function H(n){return{current:n}}function Q(n){0>X||(n.current=F[X],F[X]=null,X--)}function Y(n,a){X++,F[X]=n.current,n.current=a}var J=H(null),oe=H(null),ne=H(null),te=H(null);function le(n,a){switch(Y(ne,a),Y(oe,n),Y(J,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?R0(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=R0(a),n=T0(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Q(J),Y(J,n)}function fe(){Q(J),Q(oe),Q(ne)}function ze(n){n.memoizedState!==null&&Y(te,n);var a=J.current,i=T0(a,n.type);a!==i&&(Y(oe,n),Y(J,i))}function be(n){oe.current===n&&(Q(J),Q(oe)),te.current===n&&(Q(te),Vi._currentValue=K)}var pe,je;function Ne(n){if(pe===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);pe=a&&a[1]||"",je=-1<i.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+pe+n+je}var Be=!1;function Ue(n,a){if(!n||Be)return"";Be=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var _e=function(){throw Error()};if(Object.defineProperty(_e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_e,[])}catch(ce){var re=ce}Reflect.construct(n,[],_e)}else{try{_e.call()}catch(ce){re=ce}n.call(_e.prototype)}}else{try{throw Error()}catch(ce){re=ce}(_e=n())&&typeof _e.catch=="function"&&_e.catch(function(){})}}catch(ce){if(ce&&re&&typeof ce.stack=="string")return[ce.stack,re.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=d.DetermineComponentFrameRoot(),O=j[0],B=j[1];if(O&&B){var Z=O.split(`
44
+ `),se=B.split(`
45
+ `);for(v=d=0;d<Z.length&&!Z[d].includes("DetermineComponentFrameRoot");)d++;for(;v<se.length&&!se[v].includes("DetermineComponentFrameRoot");)v++;if(d===Z.length||v===se.length)for(d=Z.length-1,v=se.length-1;1<=d&&0<=v&&Z[d]!==se[v];)v--;for(;1<=d&&0<=v;d--,v--)if(Z[d]!==se[v]){if(d!==1||v!==1)do if(d--,v--,0>v||Z[d]!==se[v]){var ge=`
46
+ `+Z[d].replace(" at new "," at ");return n.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",n.displayName)),ge}while(1<=d&&0<=v);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Ne(i):""}function ye(n,a){switch(n.tag){case 26:case 27:case 5:return Ne(n.type);case 16:return Ne("Lazy");case 13:return n.child!==a&&a!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ue(n.type,!1);case 11:return Ue(n.type.render,!1);case 1:return Ue(n.type,!0);case 31:return Ne("Activity");default:return""}}function De(n){try{var a="",i=null;do a+=ye(n,i),i=n,n=n.return;while(n);return a}catch(d){return`
47
+ Error generating stack: `+d.message+`
48
+ `+d.stack}}var ve=Object.prototype.hasOwnProperty,Re=e.unstable_scheduleCallback,Le=e.unstable_cancelCallback,$e=e.unstable_shouldYield,He=e.unstable_requestPaint,we=e.unstable_now,ie=e.unstable_getCurrentPriorityLevel,Ce=e.unstable_ImmediatePriority,Ee=e.unstable_UserBlockingPriority,Se=e.unstable_NormalPriority,qe=e.unstable_LowPriority,st=e.unstable_IdlePriority,Nt=e.log,me=e.unstable_setDisableYieldValue,Me=null,Pe=null;function Fe(n){if(typeof Nt=="function"&&me(n),Pe&&typeof Pe.setStrictMode=="function")try{Pe.setStrictMode(Me,n)}catch{}}var rt=Math.clz32?Math.clz32:xt,rn=Math.log,qt=Math.LN2;function xt(n){return n>>>=0,n===0?32:31-(rn(n)/qt|0)|0}var At=256,Jt=262144,Et=4194304;function on(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Yt(n,a,i){var d=n.pendingLanes;if(d===0)return 0;var v=0,j=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var B=d&134217727;return B!==0?(d=B&~j,d!==0?v=on(d):(O&=B,O!==0?v=on(O):i||(i=B&~n,i!==0&&(v=on(i))))):(B=d&~j,B!==0?v=on(B):O!==0?v=on(O):i||(i=d&~n,i!==0&&(v=on(i)))),v===0?0:a!==0&&a!==v&&(a&j)===0&&(j=v&-v,i=a&-a,j>=i||j===32&&(i&4194048)!==0)?a:v}function dn(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Ln(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Jn(){var n=Et;return Et<<=1,(Et&62914560)===0&&(Et=4194304),n}function da(n){for(var a=[],i=0;31>i;i++)a.push(n);return a}function ea(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function xs(n,a,i,d,v,j){var O=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var B=n.entanglements,Z=n.expirationTimes,se=n.hiddenUpdates;for(i=O&~i;0<i;){var ge=31-rt(i),_e=1<<ge;B[ge]=0,Z[ge]=-1;var re=se[ge];if(re!==null)for(se[ge]=null,ge=0;ge<re.length;ge++){var ce=re[ge];ce!==null&&(ce.lane&=-536870913)}i&=~_e}d!==0&&In(n,d,0),j!==0&&v===0&&n.tag!==0&&(n.suspendedLanes|=j&~(O&~a))}function In(n,a,i){n.pendingLanes|=a,n.suspendedLanes&=~a;var d=31-rt(a);n.entangledLanes|=a,n.entanglements[d]=n.entanglements[d]|1073741824|i&261930}function fa(n,a){var i=n.entangledLanes|=a;for(n=n.entanglements;i;){var d=31-rt(i),v=1<<d;v&a|n[d]&a&&(n[d]|=a),i&=~v}}function Ia(n,a){var i=a&-a;return i=(i&42)!==0?1:bs(i),(i&(n.suspendedLanes|a))!==0?0:i}function bs(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function ut(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Pt(){var n=G.p;return n!==0?n:(n=window.event,n===void 0?32:J0(n.type))}function Rn(n,a){var i=G.p;try{return G.p=n,a()}finally{G.p=i}}var ln=Math.random().toString(36).slice(2),Ot="__reactFiber$"+ln,hn="__reactProps$"+ln,$r="__reactContainer$"+ln,Zc="__reactEvents$"+ln,UN="__reactListeners$"+ln,HN="__reactHandles$"+ln,hv="__reactResources$"+ln,ai="__reactMarker$"+ln;function sp(n){delete n[Ot],delete n[hn],delete n[Zc],delete n[UN],delete n[HN]}function Do(n){var a=n[Ot];if(a)return a;for(var i=n.parentNode;i;){if(a=i[$r]||i[Ot]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(n=L0(n);n!==null;){if(i=n[Ot])return i;n=L0(n)}return a}n=i,i=n.parentNode}return null}function Po(n){if(n=n[Ot]||n[$r]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function si(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(o(33))}function Lo(n){var a=n[hv];return a||(a=n[hv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function kn(n){n[ai]=!0}var xv=new Set,bv={};function Fr(n,a){Io(n,a),Io(n+"Capture",a)}function Io(n,a){for(bv[n]=a,n=0;n<a.length;n++)xv.add(a[n])}var VN=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),vv={},_v={};function qN(n){return ve.call(_v,n)?!0:ve.call(vv,n)?!1:VN.test(n)?_v[n]=!0:(vv[n]=!0,!1)}function Wc(n,a,i){if(qN(a))if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+i)}}function Jc(n,a,i){if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+i)}}function vs(n,a,i,d){if(d===null)n.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(a,i,""+d)}}function ka(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function yv(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function $N(n,a,i){var d=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,j=d.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return v.call(this)},set:function(O){i=""+O,j.call(this,O)}}),Object.defineProperty(n,a,{enumerable:d.enumerable}),{getValue:function(){return i},setValue:function(O){i=""+O},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function rp(n){if(!n._valueTracker){var a=yv(n)?"checked":"value";n._valueTracker=$N(n,a,""+n[a])}}function jv(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),d="";return n&&(d=yv(n)?n.checked?"true":"false":n.value),n=d,n!==i?(a.setValue(n),!0):!1}function eu(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var FN=/[\n"\\]/g;function Sa(n){return n.replace(FN,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function op(n,a,i,d,v,j,O,B){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),a!=null?O==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+ka(a)):n.value!==""+ka(a)&&(n.value=""+ka(a)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),a!=null?lp(n,O,ka(a)):i!=null?lp(n,O,ka(i)):d!=null&&n.removeAttribute("value"),v==null&&j!=null&&(n.defaultChecked=!!j),v!=null&&(n.checked=v&&typeof v!="function"&&typeof v!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?n.name=""+ka(B):n.removeAttribute("name")}function wv(n,a,i,d,v,j,O,B){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(n.type=j),a!=null||i!=null){if(!(j!=="submit"&&j!=="reset"||a!=null)){rp(n);return}i=i!=null?""+ka(i):"",a=a!=null?""+ka(a):i,B||a===n.value||(n.value=a),n.defaultValue=a}d=d??v,d=typeof d!="function"&&typeof d!="symbol"&&!!d,n.checked=B?n.checked:!!d,n.defaultChecked=!!d,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),rp(n)}function lp(n,a,i){a==="number"&&eu(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Bo(n,a,i,d){if(n=n.options,a){a={};for(var v=0;v<i.length;v++)a["$"+i[v]]=!0;for(i=0;i<n.length;i++)v=a.hasOwnProperty("$"+n[i].value),n[i].selected!==v&&(n[i].selected=v),v&&d&&(n[i].defaultSelected=!0)}else{for(i=""+ka(i),a=null,v=0;v<n.length;v++){if(n[v].value===i){n[v].selected=!0,d&&(n[v].defaultSelected=!0);return}a!==null||n[v].disabled||(a=n[v])}a!==null&&(a.selected=!0)}}function kv(n,a,i){if(a!=null&&(a=""+ka(a),a!==n.value&&(n.value=a),i==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=i!=null?""+ka(i):""}function Sv(n,a,i,d){if(a==null){if(d!=null){if(i!=null)throw Error(o(92));if($(d)){if(1<d.length)throw Error(o(93));d=d[0]}i=d}i==null&&(i=""),a=i}i=ka(a),n.defaultValue=i,d=n.textContent,d===i&&d!==""&&d!==null&&(n.value=d),rp(n)}function Uo(n,a){if(a){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=a;return}}n.textContent=a}var GN=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Cv(n,a,i){var d=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?d?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":d?n.setProperty(a,i):typeof i!="number"||i===0||GN.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function Nv(n,a,i){if(a!=null&&typeof a!="object")throw Error(o(62));if(n=n.style,i!=null){for(var d in i)!i.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?n.setProperty(d,""):d==="float"?n.cssFloat="":n[d]="");for(var v in a)d=a[v],a.hasOwnProperty(v)&&i[v]!==d&&Cv(n,v,d)}else for(var j in a)a.hasOwnProperty(j)&&Cv(n,j,a[j])}function ip(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var YN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),XN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function tu(n){return XN.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function _s(){}var cp=null;function up(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ho=null,Vo=null;function Ev(n){var a=Po(n);if(a&&(n=a.stateNode)){var i=n[hn]||null;e:switch(n=a.stateNode,a.type){case"input":if(op(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Sa(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var d=i[a];if(d!==n&&d.form===n.form){var v=d[hn]||null;if(!v)throw Error(o(90));op(d,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(a=0;a<i.length;a++)d=i[a],d.form===n.form&&jv(d)}break e;case"textarea":kv(n,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Bo(n,!!i.multiple,a,!1)}}}var dp=!1;function Rv(n,a,i){if(dp)return n(a,i);dp=!0;try{var d=n(a);return d}finally{if(dp=!1,(Ho!==null||Vo!==null)&&(Vu(),Ho&&(a=Ho,n=Vo,Vo=Ho=null,Ev(a),n)))for(a=0;a<n.length;a++)Ev(n[a])}}function ri(n,a){var i=n.stateNode;if(i===null)return null;var d=i[hn]||null;if(d===null)return null;i=d[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(o(231,a,typeof i));return i}var ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fp=!1;if(ys)try{var oi={};Object.defineProperty(oi,"passive",{get:function(){fp=!0}}),window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{fp=!1}var Zs=null,pp=null,nu=null;function Tv(){if(nu)return nu;var n,a=pp,i=a.length,d,v="value"in Zs?Zs.value:Zs.textContent,j=v.length;for(n=0;n<i&&a[n]===v[n];n++);var O=i-n;for(d=1;d<=O&&a[i-d]===v[j-d];d++);return nu=v.slice(n,1<d?1-d:void 0)}function au(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function su(){return!0}function Mv(){return!1}function ta(n){function a(i,d,v,j,O){this._reactName=i,this._targetInst=v,this.type=d,this.nativeEvent=j,this.target=O,this.currentTarget=null;for(var B in n)n.hasOwnProperty(B)&&(i=n[B],this[B]=i?i(j):j[B]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?su:Mv,this.isPropagationStopped=Mv,this}return b(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=su)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=su)},persist:function(){},isPersistent:su}),a}var Gr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ru=ta(Gr),li=b({},Gr,{view:0,detail:0}),KN=ta(li),mp,gp,ii,ou=b({},li,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xp,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==ii&&(ii&&n.type==="mousemove"?(mp=n.screenX-ii.screenX,gp=n.screenY-ii.screenY):gp=mp=0,ii=n),mp)},movementY:function(n){return"movementY"in n?n.movementY:gp}}),Av=ta(ou),QN=b({},ou,{dataTransfer:0}),ZN=ta(QN),WN=b({},li,{relatedTarget:0}),hp=ta(WN),JN=b({},Gr,{animationName:0,elapsedTime:0,pseudoElement:0}),eE=ta(JN),tE=b({},Gr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),nE=ta(tE),aE=b({},Gr,{data:0}),Ov=ta(aE),sE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rE={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},oE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lE(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=oE[n])?!!a[n]:!1}function xp(){return lE}var iE=b({},li,{key:function(n){if(n.key){var a=sE[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=au(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?rE[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xp,charCode:function(n){return n.type==="keypress"?au(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?au(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),cE=ta(iE),uE=b({},ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zv=ta(uE),dE=b({},li,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xp}),fE=ta(dE),pE=b({},Gr,{propertyName:0,elapsedTime:0,pseudoElement:0}),mE=ta(pE),gE=b({},ou,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),hE=ta(gE),xE=b({},Gr,{newState:0,oldState:0}),bE=ta(xE),vE=[9,13,27,32],bp=ys&&"CompositionEvent"in window,ci=null;ys&&"documentMode"in document&&(ci=document.documentMode);var _E=ys&&"TextEvent"in window&&!ci,Dv=ys&&(!bp||ci&&8<ci&&11>=ci),Pv=" ",Lv=!1;function Iv(n,a){switch(n){case"keyup":return vE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var qo=!1;function yE(n,a){switch(n){case"compositionend":return Bv(a);case"keypress":return a.which!==32?null:(Lv=!0,Pv);case"textInput":return n=a.data,n===Pv&&Lv?null:n;default:return null}}function jE(n,a){if(qo)return n==="compositionend"||!bp&&Iv(n,a)?(n=Tv(),nu=pp=Zs=null,qo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Dv&&a.locale!=="ko"?null:a.data;default:return null}}var wE={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Uv(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!wE[n.type]:a==="textarea"}function Hv(n,a,i,d){Ho?Vo?Vo.push(d):Vo=[d]:Ho=d,a=Ku(a,"onChange"),0<a.length&&(i=new ru("onChange","change",null,i,d),n.push({event:i,listeners:a}))}var ui=null,di=null;function kE(n){w0(n,0)}function lu(n){var a=si(n);if(jv(a))return n}function Vv(n,a){if(n==="change")return a}var qv=!1;if(ys){var vp;if(ys){var _p="oninput"in document;if(!_p){var $v=document.createElement("div");$v.setAttribute("oninput","return;"),_p=typeof $v.oninput=="function"}vp=_p}else vp=!1;qv=vp&&(!document.documentMode||9<document.documentMode)}function Fv(){ui&&(ui.detachEvent("onpropertychange",Gv),di=ui=null)}function Gv(n){if(n.propertyName==="value"&&lu(di)){var a=[];Hv(a,di,n,up(n)),Rv(kE,a)}}function SE(n,a,i){n==="focusin"?(Fv(),ui=a,di=i,ui.attachEvent("onpropertychange",Gv)):n==="focusout"&&Fv()}function CE(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return lu(di)}function NE(n,a){if(n==="click")return lu(a)}function EE(n,a){if(n==="input"||n==="change")return lu(a)}function RE(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var pa=typeof Object.is=="function"?Object.is:RE;function fi(n,a){if(pa(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var i=Object.keys(n),d=Object.keys(a);if(i.length!==d.length)return!1;for(d=0;d<i.length;d++){var v=i[d];if(!ve.call(a,v)||!pa(n[v],a[v]))return!1}return!0}function Yv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Xv(n,a){var i=Yv(n);n=0;for(var d;i;){if(i.nodeType===3){if(d=n+i.textContent.length,n<=a&&d>=a)return{node:i,offset:a-n};n=d}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Yv(i)}}function Kv(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Kv(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Qv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=eu(n.document);a instanceof n.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)n=a.contentWindow;else break;a=eu(n.document)}return a}function yp(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var TE=ys&&"documentMode"in document&&11>=document.documentMode,$o=null,jp=null,pi=null,wp=!1;function Zv(n,a,i){var d=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;wp||$o==null||$o!==eu(d)||(d=$o,"selectionStart"in d&&yp(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),pi&&fi(pi,d)||(pi=d,d=Ku(jp,"onSelect"),0<d.length&&(a=new ru("onSelect","select",null,a,i),n.push({event:a,listeners:d}),a.target=$o)))}function Yr(n,a){var i={};return i[n.toLowerCase()]=a.toLowerCase(),i["Webkit"+n]="webkit"+a,i["Moz"+n]="moz"+a,i}var Fo={animationend:Yr("Animation","AnimationEnd"),animationiteration:Yr("Animation","AnimationIteration"),animationstart:Yr("Animation","AnimationStart"),transitionrun:Yr("Transition","TransitionRun"),transitionstart:Yr("Transition","TransitionStart"),transitioncancel:Yr("Transition","TransitionCancel"),transitionend:Yr("Transition","TransitionEnd")},kp={},Wv={};ys&&(Wv=document.createElement("div").style,"AnimationEvent"in window||(delete Fo.animationend.animation,delete Fo.animationiteration.animation,delete Fo.animationstart.animation),"TransitionEvent"in window||delete Fo.transitionend.transition);function Xr(n){if(kp[n])return kp[n];if(!Fo[n])return n;var a=Fo[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in Wv)return kp[n]=a[i];return n}var Jv=Xr("animationend"),e_=Xr("animationiteration"),t_=Xr("animationstart"),ME=Xr("transitionrun"),AE=Xr("transitionstart"),OE=Xr("transitioncancel"),n_=Xr("transitionend"),a_=new Map,Sp="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Sp.push("scrollEnd");function Ba(n,a){a_.set(n,a),Fr(a,[n])}var iu=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ca=[],Go=0,Cp=0;function cu(){for(var n=Go,a=Cp=Go=0;a<n;){var i=Ca[a];Ca[a++]=null;var d=Ca[a];Ca[a++]=null;var v=Ca[a];Ca[a++]=null;var j=Ca[a];if(Ca[a++]=null,d!==null&&v!==null){var O=d.pending;O===null?v.next=v:(v.next=O.next,O.next=v),d.pending=v}j!==0&&s_(i,v,j)}}function uu(n,a,i,d){Ca[Go++]=n,Ca[Go++]=a,Ca[Go++]=i,Ca[Go++]=d,Cp|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function Np(n,a,i,d){return uu(n,a,i,d),du(n)}function Kr(n,a){return uu(n,null,null,a),du(n)}function s_(n,a,i){n.lanes|=i;var d=n.alternate;d!==null&&(d.lanes|=i);for(var v=!1,j=n.return;j!==null;)j.childLanes|=i,d=j.alternate,d!==null&&(d.childLanes|=i),j.tag===22&&(n=j.stateNode,n===null||n._visibility&1||(v=!0)),n=j,j=j.return;return n.tag===3?(j=n.stateNode,v&&a!==null&&(v=31-rt(i),n=j.hiddenUpdates,d=n[v],d===null?n[v]=[a]:d.push(a),a.lane=i|536870912),j):null}function du(n){if(50<Di)throw Di=0,Pm=null,Error(o(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var Yo={};function zE(n,a,i,d){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ma(n,a,i,d){return new zE(n,a,i,d)}function Ep(n){return n=n.prototype,!(!n||!n.isReactComponent)}function js(n,a){var i=n.alternate;return i===null?(i=ma(n.tag,a,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=a,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,a=n.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function r_(n,a){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,a=i.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function fu(n,a,i,d,v,j){var O=0;if(d=n,typeof n=="function")Ep(n)&&(O=1);else if(typeof n=="string")O=BR(n,i,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=ma(31,i,a,v),n.elementType=I,n.lanes=j,n;case y:return Qr(i.children,v,j,a);case w:O=8,v|=24;break;case S:return n=ma(12,i,a,v|2),n.elementType=S,n.lanes=j,n;case M:return n=ma(13,i,a,v),n.elementType=M,n.lanes=j,n;case T:return n=ma(19,i,a,v),n.elementType=T,n.lanes=j,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case E:O=10;break e;case N:O=9;break e;case R:O=11;break e;case A:O=14;break e;case z:O=16,d=null;break e}O=29,i=Error(o(130,n===null?"null":typeof n,"")),d=null}return a=ma(O,i,a,v),a.elementType=n,a.type=d,a.lanes=j,a}function Qr(n,a,i,d){return n=ma(7,n,d,a),n.lanes=i,n}function Rp(n,a,i){return n=ma(6,n,null,a),n.lanes=i,n}function o_(n){var a=ma(18,null,null,0);return a.stateNode=n,a}function Tp(n,a,i){return a=ma(4,n.children!==null?n.children:[],n.key,a),a.lanes=i,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var l_=new WeakMap;function Na(n,a){if(typeof n=="object"&&n!==null){var i=l_.get(n);return i!==void 0?i:(a={value:n,source:a,stack:De(a)},l_.set(n,a),a)}return{value:n,source:a,stack:De(a)}}var Xo=[],Ko=0,pu=null,mi=0,Ea=[],Ra=0,Ws=null,Ka=1,Qa="";function ws(n,a){Xo[Ko++]=mi,Xo[Ko++]=pu,pu=n,mi=a}function i_(n,a,i){Ea[Ra++]=Ka,Ea[Ra++]=Qa,Ea[Ra++]=Ws,Ws=n;var d=Ka;n=Qa;var v=32-rt(d)-1;d&=~(1<<v),i+=1;var j=32-rt(a)+v;if(30<j){var O=v-v%5;j=(d&(1<<O)-1).toString(32),d>>=O,v-=O,Ka=1<<32-rt(a)+v|i<<v|d,Qa=j+n}else Ka=1<<j|i<<v|d,Qa=n}function Mp(n){n.return!==null&&(ws(n,1),i_(n,1,0))}function Ap(n){for(;n===pu;)pu=Xo[--Ko],Xo[Ko]=null,mi=Xo[--Ko],Xo[Ko]=null;for(;n===Ws;)Ws=Ea[--Ra],Ea[Ra]=null,Qa=Ea[--Ra],Ea[Ra]=null,Ka=Ea[--Ra],Ea[Ra]=null}function c_(n,a){Ea[Ra++]=Ka,Ea[Ra++]=Qa,Ea[Ra++]=Ws,Ka=a.id,Qa=a.overflow,Ws=n}var Tn=null,Xt=null,wt=!1,Js=null,Ta=!1,Op=Error(o(519));function er(n){var a=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gi(Na(a,n)),Op}function u_(n){var a=n.stateNode,i=n.type,d=n.memoizedProps;switch(a[Ot]=n,a[hn]=d,i){case"dialog":vt("cancel",a),vt("close",a);break;case"iframe":case"object":case"embed":vt("load",a);break;case"video":case"audio":for(i=0;i<Li.length;i++)vt(Li[i],a);break;case"source":vt("error",a);break;case"img":case"image":case"link":vt("error",a),vt("load",a);break;case"details":vt("toggle",a);break;case"input":vt("invalid",a),wv(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":vt("invalid",a);break;case"textarea":vt("invalid",a),Sv(a,d.value,d.defaultValue,d.children)}i=d.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||d.suppressHydrationWarning===!0||N0(a.textContent,i)?(d.popover!=null&&(vt("beforetoggle",a),vt("toggle",a)),d.onScroll!=null&&vt("scroll",a),d.onScrollEnd!=null&&vt("scrollend",a),d.onClick!=null&&(a.onclick=_s),a=!0):a=!1,a||er(n,!0)}function d_(n){for(Tn=n.return;Tn;)switch(Tn.tag){case 5:case 31:case 13:Ta=!1;return;case 27:case 3:Ta=!0;return;default:Tn=Tn.return}}function Qo(n){if(n!==Tn)return!1;if(!wt)return d_(n),wt=!0,!1;var a=n.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||Zm(n.type,n.memoizedProps)),i=!i),i&&Xt&&er(n),d_(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));Xt=P0(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));Xt=P0(n)}else a===27?(a=Xt,mr(n.type)?(n=ng,ng=null,Xt=n):Xt=a):Xt=Tn?Aa(n.stateNode.nextSibling):null;return!0}function Zr(){Xt=Tn=null,wt=!1}function zp(){var n=Js;return n!==null&&(ra===null?ra=n:ra.push.apply(ra,n),Js=null),n}function gi(n){Js===null?Js=[n]:Js.push(n)}var Dp=H(null),Wr=null,ks=null;function tr(n,a,i){Y(Dp,a._currentValue),a._currentValue=i}function Ss(n){n._currentValue=Dp.current,Q(Dp)}function Pp(n,a,i){for(;n!==null;){var d=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),n===i)break;n=n.return}}function Lp(n,a,i,d){var v=n.child;for(v!==null&&(v.return=n);v!==null;){var j=v.dependencies;if(j!==null){var O=v.child;j=j.firstContext;e:for(;j!==null;){var B=j;j=v;for(var Z=0;Z<a.length;Z++)if(B.context===a[Z]){j.lanes|=i,B=j.alternate,B!==null&&(B.lanes|=i),Pp(j.return,i,n),d||(O=null);break e}j=B.next}}else if(v.tag===18){if(O=v.return,O===null)throw Error(o(341));O.lanes|=i,j=O.alternate,j!==null&&(j.lanes|=i),Pp(O,i,n),O=null}else O=v.child;if(O!==null)O.return=v;else for(O=v;O!==null;){if(O===n){O=null;break}if(v=O.sibling,v!==null){v.return=O.return,O=v;break}O=O.return}v=O}}function Zo(n,a,i,d){n=null;for(var v=a,j=!1;v!==null;){if(!j){if((v.flags&524288)!==0)j=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var O=v.alternate;if(O===null)throw Error(o(387));if(O=O.memoizedProps,O!==null){var B=v.type;pa(v.pendingProps.value,O.value)||(n!==null?n.push(B):n=[B])}}else if(v===te.current){if(O=v.alternate,O===null)throw Error(o(387));O.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(n!==null?n.push(Vi):n=[Vi])}v=v.return}n!==null&&Lp(a,n,i,d),a.flags|=262144}function mu(n){for(n=n.firstContext;n!==null;){if(!pa(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Jr(n){Wr=n,ks=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Mn(n){return f_(Wr,n)}function gu(n,a){return Wr===null&&Jr(n),f_(n,a)}function f_(n,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},ks===null){if(n===null)throw Error(o(308));ks=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else ks=ks.next=a;return i}var DE=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(i,d){n.push(d)}};this.abort=function(){a.aborted=!0,n.forEach(function(i){return i()})}},PE=e.unstable_scheduleCallback,LE=e.unstable_NormalPriority,xn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ip(){return{controller:new DE,data:new Map,refCount:0}}function hi(n){n.refCount--,n.refCount===0&&PE(LE,function(){n.controller.abort()})}var xi=null,Bp=0,Wo=0,Jo=null;function IE(n,a){if(xi===null){var i=xi=[];Bp=0,Wo=Vm(),Jo={status:"pending",value:void 0,then:function(d){i.push(d)}}}return Bp++,a.then(p_,p_),a}function p_(){if(--Bp===0&&xi!==null){Jo!==null&&(Jo.status="fulfilled");var n=xi;xi=null,Wo=0,Jo=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function BE(n,a){var i=[],d={status:"pending",value:null,reason:null,then:function(v){i.push(v)}};return n.then(function(){d.status="fulfilled",d.value=a;for(var v=0;v<i.length;v++)(0,i[v])(a)},function(v){for(d.status="rejected",d.reason=v,v=0;v<i.length;v++)(0,i[v])(void 0)}),d}var m_=V.S;V.S=function(n,a){Zy=we(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&IE(n,a),m_!==null&&m_(n,a)};var eo=H(null);function Up(){var n=eo.current;return n!==null?n:$t.pooledCache}function hu(n,a){a===null?Y(eo,eo.current):Y(eo,a.pool)}function g_(){var n=Up();return n===null?null:{parent:xn._currentValue,pool:n}}var el=Error(o(460)),Hp=Error(o(474)),xu=Error(o(542)),bu={then:function(){}};function h_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function x_(n,a,i){switch(i=n[i],i===void 0?n.push(a):i!==a&&(a.then(_s,_s),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,v_(n),n;default:if(typeof a.status=="string")a.then(_s,_s);else{if(n=$t,n!==null&&100<n.shellSuspendCounter)throw Error(o(482));n=a,n.status="pending",n.then(function(d){if(a.status==="pending"){var v=a;v.status="fulfilled",v.value=d}},function(d){if(a.status==="pending"){var v=a;v.status="rejected",v.reason=d}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,v_(n),n}throw no=a,el}}function to(n){try{var a=n._init;return a(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(no=i,el):i}}var no=null;function b_(){if(no===null)throw Error(o(459));var n=no;return no=null,n}function v_(n){if(n===el||n===xu)throw Error(o(483))}var tl=null,bi=0;function vu(n){var a=bi;return bi+=1,tl===null&&(tl=[]),x_(tl,n,a)}function vi(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function _u(n,a){throw a.$$typeof===_?Error(o(525)):(n=Object.prototype.toString.call(a),Error(o(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function __(n){function a(ee,W){if(n){var ae=ee.deletions;ae===null?(ee.deletions=[W],ee.flags|=16):ae.push(W)}}function i(ee,W){if(!n)return null;for(;W!==null;)a(ee,W),W=W.sibling;return null}function d(ee){for(var W=new Map;ee!==null;)ee.key!==null?W.set(ee.key,ee):W.set(ee.index,ee),ee=ee.sibling;return W}function v(ee,W){return ee=js(ee,W),ee.index=0,ee.sibling=null,ee}function j(ee,W,ae){return ee.index=ae,n?(ae=ee.alternate,ae!==null?(ae=ae.index,ae<W?(ee.flags|=67108866,W):ae):(ee.flags|=67108866,W)):(ee.flags|=1048576,W)}function O(ee){return n&&ee.alternate===null&&(ee.flags|=67108866),ee}function B(ee,W,ae,xe){return W===null||W.tag!==6?(W=Rp(ae,ee.mode,xe),W.return=ee,W):(W=v(W,ae),W.return=ee,W)}function Z(ee,W,ae,xe){var We=ae.type;return We===y?ge(ee,W,ae.props.children,xe,ae.key):W!==null&&(W.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===z&&to(We)===W.type)?(W=v(W,ae.props),vi(W,ae),W.return=ee,W):(W=fu(ae.type,ae.key,ae.props,null,ee.mode,xe),vi(W,ae),W.return=ee,W)}function se(ee,W,ae,xe){return W===null||W.tag!==4||W.stateNode.containerInfo!==ae.containerInfo||W.stateNode.implementation!==ae.implementation?(W=Tp(ae,ee.mode,xe),W.return=ee,W):(W=v(W,ae.children||[]),W.return=ee,W)}function ge(ee,W,ae,xe,We){return W===null||W.tag!==7?(W=Qr(ae,ee.mode,xe,We),W.return=ee,W):(W=v(W,ae),W.return=ee,W)}function _e(ee,W,ae){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=Rp(""+W,ee.mode,ae),W.return=ee,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return ae=fu(W.type,W.key,W.props,null,ee.mode,ae),vi(ae,W),ae.return=ee,ae;case C:return W=Tp(W,ee.mode,ae),W.return=ee,W;case z:return W=to(W),_e(ee,W,ae)}if($(W)||L(W))return W=Qr(W,ee.mode,ae,null),W.return=ee,W;if(typeof W.then=="function")return _e(ee,vu(W),ae);if(W.$$typeof===E)return _e(ee,gu(ee,W),ae);_u(ee,W)}return null}function re(ee,W,ae,xe){var We=W!==null?W.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return We!==null?null:B(ee,W,""+ae,xe);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case k:return ae.key===We?Z(ee,W,ae,xe):null;case C:return ae.key===We?se(ee,W,ae,xe):null;case z:return ae=to(ae),re(ee,W,ae,xe)}if($(ae)||L(ae))return We!==null?null:ge(ee,W,ae,xe,null);if(typeof ae.then=="function")return re(ee,W,vu(ae),xe);if(ae.$$typeof===E)return re(ee,W,gu(ee,ae),xe);_u(ee,ae)}return null}function ce(ee,W,ae,xe,We){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return ee=ee.get(ae)||null,B(W,ee,""+xe,We);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case k:return ee=ee.get(xe.key===null?ae:xe.key)||null,Z(W,ee,xe,We);case C:return ee=ee.get(xe.key===null?ae:xe.key)||null,se(W,ee,xe,We);case z:return xe=to(xe),ce(ee,W,ae,xe,We)}if($(xe)||L(xe))return ee=ee.get(ae)||null,ge(W,ee,xe,We,null);if(typeof xe.then=="function")return ce(ee,W,ae,vu(xe),We);if(xe.$$typeof===E)return ce(ee,W,ae,gu(W,xe),We);_u(W,xe)}return null}function Ge(ee,W,ae,xe){for(var We=null,Rt=null,Xe=W,dt=W=0,yt=null;Xe!==null&&dt<ae.length;dt++){Xe.index>dt?(yt=Xe,Xe=null):yt=Xe.sibling;var Tt=re(ee,Xe,ae[dt],xe);if(Tt===null){Xe===null&&(Xe=yt);break}n&&Xe&&Tt.alternate===null&&a(ee,Xe),W=j(Tt,W,dt),Rt===null?We=Tt:Rt.sibling=Tt,Rt=Tt,Xe=yt}if(dt===ae.length)return i(ee,Xe),wt&&ws(ee,dt),We;if(Xe===null){for(;dt<ae.length;dt++)Xe=_e(ee,ae[dt],xe),Xe!==null&&(W=j(Xe,W,dt),Rt===null?We=Xe:Rt.sibling=Xe,Rt=Xe);return wt&&ws(ee,dt),We}for(Xe=d(Xe);dt<ae.length;dt++)yt=ce(Xe,ee,dt,ae[dt],xe),yt!==null&&(n&&yt.alternate!==null&&Xe.delete(yt.key===null?dt:yt.key),W=j(yt,W,dt),Rt===null?We=yt:Rt.sibling=yt,Rt=yt);return n&&Xe.forEach(function(vr){return a(ee,vr)}),wt&&ws(ee,dt),We}function tt(ee,W,ae,xe){if(ae==null)throw Error(o(151));for(var We=null,Rt=null,Xe=W,dt=W=0,yt=null,Tt=ae.next();Xe!==null&&!Tt.done;dt++,Tt=ae.next()){Xe.index>dt?(yt=Xe,Xe=null):yt=Xe.sibling;var vr=re(ee,Xe,Tt.value,xe);if(vr===null){Xe===null&&(Xe=yt);break}n&&Xe&&vr.alternate===null&&a(ee,Xe),W=j(vr,W,dt),Rt===null?We=vr:Rt.sibling=vr,Rt=vr,Xe=yt}if(Tt.done)return i(ee,Xe),wt&&ws(ee,dt),We;if(Xe===null){for(;!Tt.done;dt++,Tt=ae.next())Tt=_e(ee,Tt.value,xe),Tt!==null&&(W=j(Tt,W,dt),Rt===null?We=Tt:Rt.sibling=Tt,Rt=Tt);return wt&&ws(ee,dt),We}for(Xe=d(Xe);!Tt.done;dt++,Tt=ae.next())Tt=ce(Xe,ee,dt,Tt.value,xe),Tt!==null&&(n&&Tt.alternate!==null&&Xe.delete(Tt.key===null?dt:Tt.key),W=j(Tt,W,dt),Rt===null?We=Tt:Rt.sibling=Tt,Rt=Tt);return n&&Xe.forEach(function(QR){return a(ee,QR)}),wt&&ws(ee,dt),We}function Bt(ee,W,ae,xe){if(typeof ae=="object"&&ae!==null&&ae.type===y&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case k:e:{for(var We=ae.key;W!==null;){if(W.key===We){if(We=ae.type,We===y){if(W.tag===7){i(ee,W.sibling),xe=v(W,ae.props.children),xe.return=ee,ee=xe;break e}}else if(W.elementType===We||typeof We=="object"&&We!==null&&We.$$typeof===z&&to(We)===W.type){i(ee,W.sibling),xe=v(W,ae.props),vi(xe,ae),xe.return=ee,ee=xe;break e}i(ee,W);break}else a(ee,W);W=W.sibling}ae.type===y?(xe=Qr(ae.props.children,ee.mode,xe,ae.key),xe.return=ee,ee=xe):(xe=fu(ae.type,ae.key,ae.props,null,ee.mode,xe),vi(xe,ae),xe.return=ee,ee=xe)}return O(ee);case C:e:{for(We=ae.key;W!==null;){if(W.key===We)if(W.tag===4&&W.stateNode.containerInfo===ae.containerInfo&&W.stateNode.implementation===ae.implementation){i(ee,W.sibling),xe=v(W,ae.children||[]),xe.return=ee,ee=xe;break e}else{i(ee,W);break}else a(ee,W);W=W.sibling}xe=Tp(ae,ee.mode,xe),xe.return=ee,ee=xe}return O(ee);case z:return ae=to(ae),Bt(ee,W,ae,xe)}if($(ae))return Ge(ee,W,ae,xe);if(L(ae)){if(We=L(ae),typeof We!="function")throw Error(o(150));return ae=We.call(ae),tt(ee,W,ae,xe)}if(typeof ae.then=="function")return Bt(ee,W,vu(ae),xe);if(ae.$$typeof===E)return Bt(ee,W,gu(ee,ae),xe);_u(ee,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,W!==null&&W.tag===6?(i(ee,W.sibling),xe=v(W,ae),xe.return=ee,ee=xe):(i(ee,W),xe=Rp(ae,ee.mode,xe),xe.return=ee,ee=xe),O(ee)):i(ee,W)}return function(ee,W,ae,xe){try{bi=0;var We=Bt(ee,W,ae,xe);return tl=null,We}catch(Xe){if(Xe===el||Xe===xu)throw Xe;var Rt=ma(29,Xe,null,ee.mode);return Rt.lanes=xe,Rt.return=ee,Rt}finally{}}}var ao=__(!0),y_=__(!1),nr=!1;function Vp(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qp(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ar(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function sr(n,a,i){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(Mt&2)!==0){var v=d.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),d.pending=a,a=du(n),s_(n,null,i),a}return uu(n,d,a,i),du(n)}function _i(n,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var d=a.lanes;d&=n.pendingLanes,i|=d,a.lanes=i,fa(n,i)}}function $p(n,a){var i=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,i===d)){var v=null,j=null;if(i=i.firstBaseUpdate,i!==null){do{var O={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};j===null?v=j=O:j=j.next=O,i=i.next}while(i!==null);j===null?v=j=a:j=j.next=a}else v=j=a;i={baseState:d.baseState,firstBaseUpdate:v,lastBaseUpdate:j,shared:d.shared,callbacks:d.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=a:n.next=a,i.lastBaseUpdate=a}var Fp=!1;function yi(){if(Fp){var n=Jo;if(n!==null)throw n}}function ji(n,a,i,d){Fp=!1;var v=n.updateQueue;nr=!1;var j=v.firstBaseUpdate,O=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var Z=B,se=Z.next;Z.next=null,O===null?j=se:O.next=se,O=Z;var ge=n.alternate;ge!==null&&(ge=ge.updateQueue,B=ge.lastBaseUpdate,B!==O&&(B===null?ge.firstBaseUpdate=se:B.next=se,ge.lastBaseUpdate=Z))}if(j!==null){var _e=v.baseState;O=0,ge=se=Z=null,B=j;do{var re=B.lane&-536870913,ce=re!==B.lane;if(ce?(_t&re)===re:(d&re)===re){re!==0&&re===Wo&&(Fp=!0),ge!==null&&(ge=ge.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var Ge=n,tt=B;re=a;var Bt=i;switch(tt.tag){case 1:if(Ge=tt.payload,typeof Ge=="function"){_e=Ge.call(Bt,_e,re);break e}_e=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=tt.payload,re=typeof Ge=="function"?Ge.call(Bt,_e,re):Ge,re==null)break e;_e=b({},_e,re);break e;case 2:nr=!0}}re=B.callback,re!==null&&(n.flags|=64,ce&&(n.flags|=8192),ce=v.callbacks,ce===null?v.callbacks=[re]:ce.push(re))}else ce={lane:re,tag:B.tag,payload:B.payload,callback:B.callback,next:null},ge===null?(se=ge=ce,Z=_e):ge=ge.next=ce,O|=re;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;ce=B,B=ce.next,ce.next=null,v.lastBaseUpdate=ce,v.shared.pending=null}}while(!0);ge===null&&(Z=_e),v.baseState=Z,v.firstBaseUpdate=se,v.lastBaseUpdate=ge,j===null&&(v.shared.lanes=0),cr|=O,n.lanes=O,n.memoizedState=_e}}function j_(n,a){if(typeof n!="function")throw Error(o(191,n));n.call(a)}function w_(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)j_(i[n],a)}var nl=H(null),yu=H(0);function k_(n,a){n=zs,Y(yu,n),Y(nl,a),zs=n|a.baseLanes}function Gp(){Y(yu,zs),Y(nl,nl.current)}function Yp(){zs=yu.current,Q(nl),Q(yu)}var ga=H(null),Ma=null;function rr(n){var a=n.alternate;Y(fn,fn.current&1),Y(ga,n),Ma===null&&(a===null||nl.current!==null||a.memoizedState!==null)&&(Ma=n)}function Xp(n){Y(fn,fn.current),Y(ga,n),Ma===null&&(Ma=n)}function S_(n){n.tag===22?(Y(fn,fn.current),Y(ga,n),Ma===null&&(Ma=n)):or()}function or(){Y(fn,fn.current),Y(ga,ga.current)}function ha(n){Q(ga),Ma===n&&(Ma=null),Q(fn)}var fn=H(0);function ju(n){for(var a=n;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||eg(i)||tg(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Cs=0,ct=null,Lt=null,bn=null,wu=!1,al=!1,so=!1,ku=0,wi=0,sl=null,UE=0;function cn(){throw Error(o(321))}function Kp(n,a){if(a===null)return!1;for(var i=0;i<a.length&&i<n.length;i++)if(!pa(n[i],a[i]))return!1;return!0}function Qp(n,a,i,d,v,j){return Cs=j,ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,V.H=n===null||n.memoizedState===null?iy:dm,so=!1,j=i(d,v),so=!1,al&&(j=N_(a,i,d,v)),C_(n),j}function C_(n){V.H=Ci;var a=Lt!==null&&Lt.next!==null;if(Cs=0,bn=Lt=ct=null,wu=!1,wi=0,sl=null,a)throw Error(o(300));n===null||vn||(n=n.dependencies,n!==null&&mu(n)&&(vn=!0))}function N_(n,a,i,d){ct=n;var v=0;do{if(al&&(sl=null),wi=0,al=!1,25<=v)throw Error(o(301));if(v+=1,bn=Lt=null,n.updateQueue!=null){var j=n.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}V.H=cy,j=a(i,d)}while(al);return j}function HE(){var n=V.H,a=n.useState()[0];return a=typeof a.then=="function"?ki(a):a,n=n.useState()[0],(Lt!==null?Lt.memoizedState:null)!==n&&(ct.flags|=1024),a}function Zp(){var n=ku!==0;return ku=0,n}function Wp(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function Jp(n){if(wu){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}wu=!1}Cs=0,bn=Lt=ct=null,al=!1,wi=ku=0,sl=null}function Gn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?ct.memoizedState=bn=n:bn=bn.next=n,bn}function pn(){if(Lt===null){var n=ct.alternate;n=n!==null?n.memoizedState:null}else n=Lt.next;var a=bn===null?ct.memoizedState:bn.next;if(a!==null)bn=a,Lt=n;else{if(n===null)throw ct.alternate===null?Error(o(467)):Error(o(310));Lt=n,n={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},bn===null?ct.memoizedState=bn=n:bn=bn.next=n}return bn}function Su(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ki(n){var a=wi;return wi+=1,sl===null&&(sl=[]),n=x_(sl,n,a),a=ct,(bn===null?a.memoizedState:bn.next)===null&&(a=a.alternate,V.H=a===null||a.memoizedState===null?iy:dm),n}function Cu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ki(n);if(n.$$typeof===E)return Mn(n)}throw Error(o(438,String(n)))}function em(n){var a=null,i=ct.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var d=ct.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(a={data:d.data.map(function(v){return v.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=Su(),ct.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(n),d=0;d<n;d++)i[d]=D;return a.index++,i}function Ns(n,a){return typeof a=="function"?a(n):a}function Nu(n){var a=pn();return tm(a,Lt,n)}function tm(n,a,i){var d=n.queue;if(d===null)throw Error(o(311));d.lastRenderedReducer=i;var v=n.baseQueue,j=d.pending;if(j!==null){if(v!==null){var O=v.next;v.next=j.next,j.next=O}a.baseQueue=v=j,d.pending=null}if(j=n.baseState,v===null)n.memoizedState=j;else{a=v.next;var B=O=null,Z=null,se=a,ge=!1;do{var _e=se.lane&-536870913;if(_e!==se.lane?(_t&_e)===_e:(Cs&_e)===_e){var re=se.revertLane;if(re===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null}),_e===Wo&&(ge=!0);else if((Cs&re)===re){se=se.next,re===Wo&&(ge=!0);continue}else _e={lane:0,revertLane:se.revertLane,gesture:null,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},Z===null?(B=Z=_e,O=j):Z=Z.next=_e,ct.lanes|=re,cr|=re;_e=se.action,so&&i(j,_e),j=se.hasEagerState?se.eagerState:i(j,_e)}else re={lane:_e,revertLane:se.revertLane,gesture:se.gesture,action:se.action,hasEagerState:se.hasEagerState,eagerState:se.eagerState,next:null},Z===null?(B=Z=re,O=j):Z=Z.next=re,ct.lanes|=_e,cr|=_e;se=se.next}while(se!==null&&se!==a);if(Z===null?O=j:Z.next=B,!pa(j,n.memoizedState)&&(vn=!0,ge&&(i=Jo,i!==null)))throw i;n.memoizedState=j,n.baseState=O,n.baseQueue=Z,d.lastRenderedState=j}return v===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function nm(n){var a=pn(),i=a.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=n;var d=i.dispatch,v=i.pending,j=a.memoizedState;if(v!==null){i.pending=null;var O=v=v.next;do j=n(j,O.action),O=O.next;while(O!==v);pa(j,a.memoizedState)||(vn=!0),a.memoizedState=j,a.baseQueue===null&&(a.baseState=j),i.lastRenderedState=j}return[j,d]}function E_(n,a,i){var d=ct,v=pn(),j=wt;if(j){if(i===void 0)throw Error(o(407));i=i()}else i=a();var O=!pa((Lt||v).memoizedState,i);if(O&&(v.memoizedState=i,vn=!0),v=v.queue,rm(M_.bind(null,d,v,n),[n]),v.getSnapshot!==a||O||bn!==null&&bn.memoizedState.tag&1){if(d.flags|=2048,rl(9,{destroy:void 0},T_.bind(null,d,v,i,a),null),$t===null)throw Error(o(349));j||(Cs&127)!==0||R_(d,a,i)}return i}function R_(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=ct.updateQueue,a===null?(a=Su(),ct.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function T_(n,a,i,d){a.value=i,a.getSnapshot=d,A_(a)&&O_(n)}function M_(n,a,i){return i(function(){A_(a)&&O_(n)})}function A_(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!pa(n,i)}catch{return!0}}function O_(n){var a=Kr(n,2);a!==null&&oa(a,n,2)}function am(n){var a=Gn();if(typeof n=="function"){var i=n;if(n=i(),so){Fe(!0);try{i()}finally{Fe(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:n},a}function z_(n,a,i,d){return n.baseState=i,tm(n,Lt,typeof d=="function"?d:Ns)}function VE(n,a,i,d,v){if(Tu(n))throw Error(o(485));if(n=a.action,n!==null){var j={payload:v,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){j.listeners.push(O)}};V.T!==null?i(!0):j.isTransition=!1,d(j),i=a.pending,i===null?(j.next=a.pending=j,D_(a,j)):(j.next=i.next,a.pending=i.next=j)}}function D_(n,a){var i=a.action,d=a.payload,v=n.state;if(a.isTransition){var j=V.T,O={};V.T=O;try{var B=i(v,d),Z=V.S;Z!==null&&Z(O,B),P_(n,a,B)}catch(se){sm(n,a,se)}finally{j!==null&&O.types!==null&&(j.types=O.types),V.T=j}}else try{j=i(v,d),P_(n,a,j)}catch(se){sm(n,a,se)}}function P_(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(d){L_(n,a,d)},function(d){return sm(n,a,d)}):L_(n,a,i)}function L_(n,a,i){a.status="fulfilled",a.value=i,I_(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,D_(n,i)))}function sm(n,a,i){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=i,I_(a),a=a.next;while(a!==d)}n.action=null}function I_(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function B_(n,a){return a}function U_(n,a){if(wt){var i=$t.formState;if(i!==null){e:{var d=ct;if(wt){if(Xt){t:{for(var v=Xt,j=Ta;v.nodeType!==8;){if(!j){v=null;break t}if(v=Aa(v.nextSibling),v===null){v=null;break t}}j=v.data,v=j==="F!"||j==="F"?v:null}if(v){Xt=Aa(v.nextSibling),d=v.data==="F!";break e}}er(d)}d=!1}d&&(a=i[0])}}return i=Gn(),i.memoizedState=i.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:B_,lastRenderedState:a},i.queue=d,i=ry.bind(null,ct,d),d.dispatch=i,d=am(!1),j=um.bind(null,ct,!1,d.queue),d=Gn(),v={state:a,dispatch:null,action:n,pending:null},d.queue=v,i=VE.bind(null,ct,v,j,i),v.dispatch=i,d.memoizedState=n,[a,i,!1]}function H_(n){var a=pn();return V_(a,Lt,n)}function V_(n,a,i){if(a=tm(n,a,B_)[0],n=Nu(Ns)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=ki(a)}catch(O){throw O===el?xu:O}else d=a;a=pn();var v=a.queue,j=v.dispatch;return i!==a.memoizedState&&(ct.flags|=2048,rl(9,{destroy:void 0},qE.bind(null,v,i),null)),[d,j,n]}function qE(n,a){n.action=a}function q_(n){var a=pn(),i=Lt;if(i!==null)return V_(a,i,n);pn(),a=a.memoizedState,i=pn();var d=i.queue.dispatch;return i.memoizedState=n,[a,d,!1]}function rl(n,a,i,d){return n={tag:n,create:i,deps:d,inst:a,next:null},a=ct.updateQueue,a===null&&(a=Su(),ct.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=n.next=n:(d=i.next,i.next=n,n.next=d,a.lastEffect=n),n}function $_(){return pn().memoizedState}function Eu(n,a,i,d){var v=Gn();ct.flags|=n,v.memoizedState=rl(1|a,{destroy:void 0},i,d===void 0?null:d)}function Ru(n,a,i,d){var v=pn();d=d===void 0?null:d;var j=v.memoizedState.inst;Lt!==null&&d!==null&&Kp(d,Lt.memoizedState.deps)?v.memoizedState=rl(a,j,i,d):(ct.flags|=n,v.memoizedState=rl(1|a,j,i,d))}function F_(n,a){Eu(8390656,8,n,a)}function rm(n,a){Ru(2048,8,n,a)}function $E(n){ct.flags|=4;var a=ct.updateQueue;if(a===null)a=Su(),ct.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function G_(n){var a=pn().memoizedState;return $E({ref:a,nextImpl:n}),function(){if((Mt&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}function Y_(n,a){return Ru(4,2,n,a)}function X_(n,a){return Ru(4,4,n,a)}function K_(n,a){if(typeof a=="function"){n=n();var i=a(n);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Q_(n,a,i){i=i!=null?i.concat([n]):null,Ru(4,4,K_.bind(null,a,n),i)}function om(){}function Z_(n,a){var i=pn();a=a===void 0?null:a;var d=i.memoizedState;return a!==null&&Kp(a,d[1])?d[0]:(i.memoizedState=[n,a],n)}function W_(n,a){var i=pn();a=a===void 0?null:a;var d=i.memoizedState;if(a!==null&&Kp(a,d[1]))return d[0];if(d=n(),so){Fe(!0);try{n()}finally{Fe(!1)}}return i.memoizedState=[d,a],d}function lm(n,a,i){return i===void 0||(Cs&1073741824)!==0&&(_t&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=Jy(),ct.lanes|=n,cr|=n,i)}function J_(n,a,i,d){return pa(i,a)?i:nl.current!==null?(n=lm(n,i,d),pa(n,a)||(vn=!0),n):(Cs&42)===0||(Cs&1073741824)!==0&&(_t&261930)===0?(vn=!0,n.memoizedState=i):(n=Jy(),ct.lanes|=n,cr|=n,a)}function ey(n,a,i,d,v){var j=G.p;G.p=j!==0&&8>j?j:8;var O=V.T,B={};V.T=B,um(n,!1,a,i);try{var Z=v(),se=V.S;if(se!==null&&se(B,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var ge=BE(Z,d);Si(n,a,ge,va(n))}else Si(n,a,d,va(n))}catch(_e){Si(n,a,{then:function(){},status:"rejected",reason:_e},va())}finally{G.p=j,O!==null&&B.types!==null&&(O.types=B.types),V.T=O}}function FE(){}function im(n,a,i,d){if(n.tag!==5)throw Error(o(476));var v=ty(n).queue;ey(n,v,a,K,i===null?FE:function(){return ny(n),i(d)})}function ty(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:K},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ns,lastRenderedState:i},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function ny(n){var a=ty(n);a.next===null&&(a=n.alternate.memoizedState),Si(n,a.next.queue,{},va())}function cm(){return Mn(Vi)}function ay(){return pn().memoizedState}function sy(){return pn().memoizedState}function GE(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=va();n=ar(i);var d=sr(a,n,i);d!==null&&(oa(d,a,i),_i(d,a,i)),a={cache:Ip()},n.payload=a;return}a=a.return}}function YE(n,a,i){var d=va();i={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Tu(n)?oy(a,i):(i=Np(n,a,i,d),i!==null&&(oa(i,n,d),ly(i,a,d)))}function ry(n,a,i){var d=va();Si(n,a,i,d)}function Si(n,a,i,d){var v={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Tu(n))oy(a,v);else{var j=n.alternate;if(n.lanes===0&&(j===null||j.lanes===0)&&(j=a.lastRenderedReducer,j!==null))try{var O=a.lastRenderedState,B=j(O,i);if(v.hasEagerState=!0,v.eagerState=B,pa(B,O))return uu(n,a,v,0),$t===null&&cu(),!1}catch{}finally{}if(i=Np(n,a,v,d),i!==null)return oa(i,n,d),ly(i,a,d),!0}return!1}function um(n,a,i,d){if(d={lane:2,revertLane:Vm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Tu(n)){if(a)throw Error(o(479))}else a=Np(n,i,d,2),a!==null&&oa(a,n,2)}function Tu(n){var a=n.alternate;return n===ct||a!==null&&a===ct}function oy(n,a){al=wu=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function ly(n,a,i){if((i&4194048)!==0){var d=a.lanes;d&=n.pendingLanes,i|=d,a.lanes=i,fa(n,i)}}var Ci={readContext:Mn,use:Cu,useCallback:cn,useContext:cn,useEffect:cn,useImperativeHandle:cn,useLayoutEffect:cn,useInsertionEffect:cn,useMemo:cn,useReducer:cn,useRef:cn,useState:cn,useDebugValue:cn,useDeferredValue:cn,useTransition:cn,useSyncExternalStore:cn,useId:cn,useHostTransitionStatus:cn,useFormState:cn,useActionState:cn,useOptimistic:cn,useMemoCache:cn,useCacheRefresh:cn};Ci.useEffectEvent=cn;var iy={readContext:Mn,use:Cu,useCallback:function(n,a){return Gn().memoizedState=[n,a===void 0?null:a],n},useContext:Mn,useEffect:F_,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,Eu(4194308,4,K_.bind(null,a,n),i)},useLayoutEffect:function(n,a){return Eu(4194308,4,n,a)},useInsertionEffect:function(n,a){Eu(4,2,n,a)},useMemo:function(n,a){var i=Gn();a=a===void 0?null:a;var d=n();if(so){Fe(!0);try{n()}finally{Fe(!1)}}return i.memoizedState=[d,a],d},useReducer:function(n,a,i){var d=Gn();if(i!==void 0){var v=i(a);if(so){Fe(!0);try{i(a)}finally{Fe(!1)}}}else v=a;return d.memoizedState=d.baseState=v,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:v},d.queue=n,n=n.dispatch=YE.bind(null,ct,n),[d.memoizedState,n]},useRef:function(n){var a=Gn();return n={current:n},a.memoizedState=n},useState:function(n){n=am(n);var a=n.queue,i=ry.bind(null,ct,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:om,useDeferredValue:function(n,a){var i=Gn();return lm(i,n,a)},useTransition:function(){var n=am(!1);return n=ey.bind(null,ct,n.queue,!0,!1),Gn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var d=ct,v=Gn();if(wt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=a(),$t===null)throw Error(o(349));(_t&127)!==0||R_(d,a,i)}v.memoizedState=i;var j={value:i,getSnapshot:a};return v.queue=j,F_(M_.bind(null,d,j,n),[n]),d.flags|=2048,rl(9,{destroy:void 0},T_.bind(null,d,j,i,a),null),i},useId:function(){var n=Gn(),a=$t.identifierPrefix;if(wt){var i=Qa,d=Ka;i=(d&~(1<<32-rt(d)-1)).toString(32)+i,a="_"+a+"R_"+i,i=ku++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=UE++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:cm,useFormState:U_,useActionState:U_,useOptimistic:function(n){var a=Gn();a.memoizedState=a.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=um.bind(null,ct,!0,i),i.dispatch=a,[n,a]},useMemoCache:em,useCacheRefresh:function(){return Gn().memoizedState=GE.bind(null,ct)},useEffectEvent:function(n){var a=Gn(),i={impl:n};return a.memoizedState=i,function(){if((Mt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},dm={readContext:Mn,use:Cu,useCallback:Z_,useContext:Mn,useEffect:rm,useImperativeHandle:Q_,useInsertionEffect:Y_,useLayoutEffect:X_,useMemo:W_,useReducer:Nu,useRef:$_,useState:function(){return Nu(Ns)},useDebugValue:om,useDeferredValue:function(n,a){var i=pn();return J_(i,Lt.memoizedState,n,a)},useTransition:function(){var n=Nu(Ns)[0],a=pn().memoizedState;return[typeof n=="boolean"?n:ki(n),a]},useSyncExternalStore:E_,useId:ay,useHostTransitionStatus:cm,useFormState:H_,useActionState:H_,useOptimistic:function(n,a){var i=pn();return z_(i,Lt,n,a)},useMemoCache:em,useCacheRefresh:sy};dm.useEffectEvent=G_;var cy={readContext:Mn,use:Cu,useCallback:Z_,useContext:Mn,useEffect:rm,useImperativeHandle:Q_,useInsertionEffect:Y_,useLayoutEffect:X_,useMemo:W_,useReducer:nm,useRef:$_,useState:function(){return nm(Ns)},useDebugValue:om,useDeferredValue:function(n,a){var i=pn();return Lt===null?lm(i,n,a):J_(i,Lt.memoizedState,n,a)},useTransition:function(){var n=nm(Ns)[0],a=pn().memoizedState;return[typeof n=="boolean"?n:ki(n),a]},useSyncExternalStore:E_,useId:ay,useHostTransitionStatus:cm,useFormState:q_,useActionState:q_,useOptimistic:function(n,a){var i=pn();return Lt!==null?z_(i,Lt,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:em,useCacheRefresh:sy};cy.useEffectEvent=G_;function fm(n,a,i,d){a=n.memoizedState,i=i(d,a),i=i==null?a:b({},a,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var pm={enqueueSetState:function(n,a,i){n=n._reactInternals;var d=va(),v=ar(d);v.payload=a,i!=null&&(v.callback=i),a=sr(n,v,d),a!==null&&(oa(a,n,d),_i(a,n,d))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var d=va(),v=ar(d);v.tag=1,v.payload=a,i!=null&&(v.callback=i),a=sr(n,v,d),a!==null&&(oa(a,n,d),_i(a,n,d))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=va(),d=ar(i);d.tag=2,a!=null&&(d.callback=a),a=sr(n,d,i),a!==null&&(oa(a,n,i),_i(a,n,i))}};function uy(n,a,i,d,v,j,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,j,O):a.prototype&&a.prototype.isPureReactComponent?!fi(i,d)||!fi(v,j):!0}function dy(n,a,i,d){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,d),a.state!==n&&pm.enqueueReplaceState(a,a.state,null)}function ro(n,a){var i=a;if("ref"in a){i={};for(var d in a)d!=="ref"&&(i[d]=a[d])}if(n=n.defaultProps){i===a&&(i=b({},i));for(var v in n)i[v]===void 0&&(i[v]=n[v])}return i}function fy(n){iu(n)}function py(n){console.error(n)}function my(n){iu(n)}function Mu(n,a){try{var i=n.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function gy(n,a,i){try{var d=n.onCaughtError;d(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function mm(n,a,i){return i=ar(i),i.tag=3,i.payload={element:null},i.callback=function(){Mu(n,a)},i}function hy(n){return n=ar(n),n.tag=3,n}function xy(n,a,i,d){var v=i.type.getDerivedStateFromError;if(typeof v=="function"){var j=d.value;n.payload=function(){return v(j)},n.callback=function(){gy(a,i,d)}}var O=i.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){gy(a,i,d),typeof v!="function"&&(ur===null?ur=new Set([this]):ur.add(this));var B=d.stack;this.componentDidCatch(d.value,{componentStack:B!==null?B:""})})}function XE(n,a,i,d,v){if(i.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=i.alternate,a!==null&&Zo(a,i,v,!0),i=ga.current,i!==null){switch(i.tag){case 31:case 13:return Ma===null?qu():i.alternate===null&&un===0&&(un=3),i.flags&=-257,i.flags|=65536,i.lanes=v,d===bu?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([d]):a.add(d),Bm(n,d,v)),!1;case 22:return i.flags|=65536,d===bu?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([d]):i.add(d)),Bm(n,d,v)),!1}throw Error(o(435,i.tag))}return Bm(n,d,v),qu(),!1}if(wt)return a=ga.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=v,d!==Op&&(n=Error(o(422),{cause:d}),gi(Na(n,i)))):(d!==Op&&(a=Error(o(423),{cause:d}),gi(Na(a,i))),n=n.current.alternate,n.flags|=65536,v&=-v,n.lanes|=v,d=Na(d,i),v=mm(n.stateNode,d,v),$p(n,v),un!==4&&(un=2)),!1;var j=Error(o(520),{cause:d});if(j=Na(j,i),zi===null?zi=[j]:zi.push(j),un!==4&&(un=2),a===null)return!0;d=Na(d,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,n=v&-v,i.lanes|=n,n=mm(i.stateNode,d,n),$p(i,n),!1;case 1:if(a=i.type,j=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(ur===null||!ur.has(j))))return i.flags|=65536,v&=-v,i.lanes|=v,v=hy(v),xy(v,n,i,d),$p(i,v),!1}i=i.return}while(i!==null);return!1}var gm=Error(o(461)),vn=!1;function An(n,a,i,d){a.child=n===null?y_(a,null,i,d):ao(a,n.child,i,d)}function by(n,a,i,d,v){i=i.render;var j=a.ref;if("ref"in d){var O={};for(var B in d)B!=="ref"&&(O[B]=d[B])}else O=d;return Jr(a),d=Qp(n,a,i,O,j,v),B=Zp(),n!==null&&!vn?(Wp(n,a,v),Es(n,a,v)):(wt&&B&&Mp(a),a.flags|=1,An(n,a,d,v),a.child)}function vy(n,a,i,d,v){if(n===null){var j=i.type;return typeof j=="function"&&!Ep(j)&&j.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=j,_y(n,a,j,d,v)):(n=fu(i.type,null,d,a,a.mode,v),n.ref=a.ref,n.return=a,a.child=n)}if(j=n.child,!wm(n,v)){var O=j.memoizedProps;if(i=i.compare,i=i!==null?i:fi,i(O,d)&&n.ref===a.ref)return Es(n,a,v)}return a.flags|=1,n=js(j,d),n.ref=a.ref,n.return=a,a.child=n}function _y(n,a,i,d,v){if(n!==null){var j=n.memoizedProps;if(fi(j,d)&&n.ref===a.ref)if(vn=!1,a.pendingProps=d=j,wm(n,v))(n.flags&131072)!==0&&(vn=!0);else return a.lanes=n.lanes,Es(n,a,v)}return hm(n,a,i,d,v)}function yy(n,a,i,d){var v=d.children,j=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(j=j!==null?j.baseLanes|i:i,n!==null){for(d=a.child=n.child,v=0;d!==null;)v=v|d.lanes|d.childLanes,d=d.sibling;d=v&~j}else d=0,a.child=null;return jy(n,a,j,i,d)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&hu(a,j!==null?j.cachePool:null),j!==null?k_(a,j):Gp(),S_(a);else return d=a.lanes=536870912,jy(n,a,j!==null?j.baseLanes|i:i,i,d)}else j!==null?(hu(a,j.cachePool),k_(a,j),or(),a.memoizedState=null):(n!==null&&hu(a,null),Gp(),or());return An(n,a,v,i),a.child}function Ni(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function jy(n,a,i,d,v){var j=Up();return j=j===null?null:{parent:xn._currentValue,pool:j},a.memoizedState={baseLanes:i,cachePool:j},n!==null&&hu(a,null),Gp(),S_(a),n!==null&&Zo(n,a,d,!0),a.childLanes=v,null}function Au(n,a){return a=zu({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function wy(n,a,i){return ao(a,n.child,null,i),n=Au(a,a.pendingProps),n.flags|=2,ha(a),a.memoizedState=null,n}function KE(n,a,i){var d=a.pendingProps,v=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(wt){if(d.mode==="hidden")return n=Au(a,d),a.lanes=536870912,Ni(null,n);if(Xp(a),(n=Xt)?(n=D0(n,Ta),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ws!==null?{id:Ka,overflow:Qa}:null,retryLane:536870912,hydrationErrors:null},i=o_(n),i.return=a,a.child=i,Tn=a,Xt=null)):n=null,n===null)throw er(a);return a.lanes=536870912,null}return Au(a,d)}var j=n.memoizedState;if(j!==null){var O=j.dehydrated;if(Xp(a),v)if(a.flags&256)a.flags&=-257,a=wy(n,a,i);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(o(558));else if(vn||Zo(n,a,i,!1),v=(i&n.childLanes)!==0,vn||v){if(d=$t,d!==null&&(O=Ia(d,i),O!==0&&O!==j.retryLane))throw j.retryLane=O,Kr(n,O),oa(d,n,O),gm;qu(),a=wy(n,a,i)}else n=j.treeContext,Xt=Aa(O.nextSibling),Tn=a,wt=!0,Js=null,Ta=!1,n!==null&&c_(a,n),a=Au(a,d),a.flags|=4096;return a}return n=js(n.child,{mode:d.mode,children:d.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Ou(n,a){var i=a.ref;if(i===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(n===null||n.ref!==i)&&(a.flags|=4194816)}}function hm(n,a,i,d,v){return Jr(a),i=Qp(n,a,i,d,void 0,v),d=Zp(),n!==null&&!vn?(Wp(n,a,v),Es(n,a,v)):(wt&&d&&Mp(a),a.flags|=1,An(n,a,i,v),a.child)}function ky(n,a,i,d,v,j){return Jr(a),a.updateQueue=null,i=N_(a,d,i,v),C_(n),d=Zp(),n!==null&&!vn?(Wp(n,a,j),Es(n,a,j)):(wt&&d&&Mp(a),a.flags|=1,An(n,a,i,j),a.child)}function Sy(n,a,i,d,v){if(Jr(a),a.stateNode===null){var j=Yo,O=i.contextType;typeof O=="object"&&O!==null&&(j=Mn(O)),j=new i(d,j),a.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=pm,a.stateNode=j,j._reactInternals=a,j=a.stateNode,j.props=d,j.state=a.memoizedState,j.refs={},Vp(a),O=i.contextType,j.context=typeof O=="object"&&O!==null?Mn(O):Yo,j.state=a.memoizedState,O=i.getDerivedStateFromProps,typeof O=="function"&&(fm(a,i,O,d),j.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(O=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),O!==j.state&&pm.enqueueReplaceState(j,j.state,null),ji(a,d,j,v),yi(),j.state=a.memoizedState),typeof j.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(n===null){j=a.stateNode;var B=a.memoizedProps,Z=ro(i,B);j.props=Z;var se=j.context,ge=i.contextType;O=Yo,typeof ge=="object"&&ge!==null&&(O=Mn(ge));var _e=i.getDerivedStateFromProps;ge=typeof _e=="function"||typeof j.getSnapshotBeforeUpdate=="function",B=a.pendingProps!==B,ge||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(B||se!==O)&&dy(a,j,d,O),nr=!1;var re=a.memoizedState;j.state=re,ji(a,d,j,v),yi(),se=a.memoizedState,B||re!==se||nr?(typeof _e=="function"&&(fm(a,i,_e,d),se=a.memoizedState),(Z=nr||uy(a,i,Z,d,re,se,O))?(ge||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(a.flags|=4194308)):(typeof j.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=se),j.props=d,j.state=se,j.context=O,d=Z):(typeof j.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{j=a.stateNode,qp(n,a),O=a.memoizedProps,ge=ro(i,O),j.props=ge,_e=a.pendingProps,re=j.context,se=i.contextType,Z=Yo,typeof se=="object"&&se!==null&&(Z=Mn(se)),B=i.getDerivedStateFromProps,(se=typeof B=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(O!==_e||re!==Z)&&dy(a,j,d,Z),nr=!1,re=a.memoizedState,j.state=re,ji(a,d,j,v),yi();var ce=a.memoizedState;O!==_e||re!==ce||nr||n!==null&&n.dependencies!==null&&mu(n.dependencies)?(typeof B=="function"&&(fm(a,i,B,d),ce=a.memoizedState),(ge=nr||uy(a,i,ge,d,re,ce,Z)||n!==null&&n.dependencies!==null&&mu(n.dependencies))?(se||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(d,ce,Z),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(d,ce,Z)),typeof j.componentDidUpdate=="function"&&(a.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof j.componentDidUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(a.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=ce),j.props=d,j.state=ce,j.context=Z,d=ge):(typeof j.componentDidUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(a.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&re===n.memoizedState||(a.flags|=1024),d=!1)}return j=d,Ou(n,a),d=(a.flags&128)!==0,j||d?(j=a.stateNode,i=d&&typeof i.getDerivedStateFromError!="function"?null:j.render(),a.flags|=1,n!==null&&d?(a.child=ao(a,n.child,null,v),a.child=ao(a,null,i,v)):An(n,a,i,v),a.memoizedState=j.state,n=a.child):n=Es(n,a,v),n}function Cy(n,a,i,d){return Zr(),a.flags|=256,An(n,a,i,d),a.child}var xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bm(n){return{baseLanes:n,cachePool:g_()}}function vm(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=ba),n}function Ny(n,a,i){var d=a.pendingProps,v=!1,j=(a.flags&128)!==0,O;if((O=j)||(O=n!==null&&n.memoizedState===null?!1:(fn.current&2)!==0),O&&(v=!0,a.flags&=-129),O=(a.flags&32)!==0,a.flags&=-33,n===null){if(wt){if(v?rr(a):or(),(n=Xt)?(n=D0(n,Ta),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:Ws!==null?{id:Ka,overflow:Qa}:null,retryLane:536870912,hydrationErrors:null},i=o_(n),i.return=a,a.child=i,Tn=a,Xt=null)):n=null,n===null)throw er(a);return tg(n)?a.lanes=32:a.lanes=536870912,null}var B=d.children;return d=d.fallback,v?(or(),v=a.mode,B=zu({mode:"hidden",children:B},v),d=Qr(d,v,i,null),B.return=a,d.return=a,B.sibling=d,a.child=B,d=a.child,d.memoizedState=bm(i),d.childLanes=vm(n,O,i),a.memoizedState=xm,Ni(null,d)):(rr(a),_m(a,B))}var Z=n.memoizedState;if(Z!==null&&(B=Z.dehydrated,B!==null)){if(j)a.flags&256?(rr(a),a.flags&=-257,a=ym(n,a,i)):a.memoizedState!==null?(or(),a.child=n.child,a.flags|=128,a=null):(or(),B=d.fallback,v=a.mode,d=zu({mode:"visible",children:d.children},v),B=Qr(B,v,i,null),B.flags|=2,d.return=a,B.return=a,d.sibling=B,a.child=d,ao(a,n.child,null,i),d=a.child,d.memoizedState=bm(i),d.childLanes=vm(n,O,i),a.memoizedState=xm,a=Ni(null,d));else if(rr(a),tg(B)){if(O=B.nextSibling&&B.nextSibling.dataset,O)var se=O.dgst;O=se,d=Error(o(419)),d.stack="",d.digest=O,gi({value:d,source:null,stack:null}),a=ym(n,a,i)}else if(vn||Zo(n,a,i,!1),O=(i&n.childLanes)!==0,vn||O){if(O=$t,O!==null&&(d=Ia(O,i),d!==0&&d!==Z.retryLane))throw Z.retryLane=d,Kr(n,d),oa(O,n,d),gm;eg(B)||qu(),a=ym(n,a,i)}else eg(B)?(a.flags|=192,a.child=n.child,a=null):(n=Z.treeContext,Xt=Aa(B.nextSibling),Tn=a,wt=!0,Js=null,Ta=!1,n!==null&&c_(a,n),a=_m(a,d.children),a.flags|=4096);return a}return v?(or(),B=d.fallback,v=a.mode,Z=n.child,se=Z.sibling,d=js(Z,{mode:"hidden",children:d.children}),d.subtreeFlags=Z.subtreeFlags&65011712,se!==null?B=js(se,B):(B=Qr(B,v,i,null),B.flags|=2),B.return=a,d.return=a,d.sibling=B,a.child=d,Ni(null,d),d=a.child,B=n.child.memoizedState,B===null?B=bm(i):(v=B.cachePool,v!==null?(Z=xn._currentValue,v=v.parent!==Z?{parent:Z,pool:Z}:v):v=g_(),B={baseLanes:B.baseLanes|i,cachePool:v}),d.memoizedState=B,d.childLanes=vm(n,O,i),a.memoizedState=xm,Ni(n.child,d)):(rr(a),i=n.child,n=i.sibling,i=js(i,{mode:"visible",children:d.children}),i.return=a,i.sibling=null,n!==null&&(O=a.deletions,O===null?(a.deletions=[n],a.flags|=16):O.push(n)),a.child=i,a.memoizedState=null,i)}function _m(n,a){return a=zu({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function zu(n,a){return n=ma(22,n,null,a),n.lanes=0,n}function ym(n,a,i){return ao(a,n.child,null,i),n=_m(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function Ey(n,a,i){n.lanes|=a;var d=n.alternate;d!==null&&(d.lanes|=a),Pp(n.return,a,i)}function jm(n,a,i,d,v,j){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:i,tailMode:v,treeForkCount:j}:(O.isBackwards=a,O.rendering=null,O.renderingStartTime=0,O.last=d,O.tail=i,O.tailMode=v,O.treeForkCount=j)}function Ry(n,a,i){var d=a.pendingProps,v=d.revealOrder,j=d.tail;d=d.children;var O=fn.current,B=(O&2)!==0;if(B?(O=O&1|2,a.flags|=128):O&=1,Y(fn,O),An(n,a,d,i),d=wt?mi:0,!B&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Ey(n,i,a);else if(n.tag===19)Ey(n,i,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(v){case"forwards":for(i=a.child,v=null;i!==null;)n=i.alternate,n!==null&&ju(n)===null&&(v=i),i=i.sibling;i=v,i===null?(v=a.child,a.child=null):(v=i.sibling,i.sibling=null),jm(a,!1,v,i,j,d);break;case"backwards":case"unstable_legacy-backwards":for(i=null,v=a.child,a.child=null;v!==null;){if(n=v.alternate,n!==null&&ju(n)===null){a.child=v;break}n=v.sibling,v.sibling=i,i=v,v=n}jm(a,!0,i,null,j,d);break;case"together":jm(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Es(n,a,i){if(n!==null&&(a.dependencies=n.dependencies),cr|=a.lanes,(i&a.childLanes)===0)if(n!==null){if(Zo(n,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(o(153));if(a.child!==null){for(n=a.child,i=js(n,n.pendingProps),a.child=i,i.return=a;n.sibling!==null;)n=n.sibling,i=i.sibling=js(n,n.pendingProps),i.return=a;i.sibling=null}return a.child}function wm(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&mu(n)))}function QE(n,a,i){switch(a.tag){case 3:le(a,a.stateNode.containerInfo),tr(a,xn,n.memoizedState.cache),Zr();break;case 27:case 5:ze(a);break;case 4:le(a,a.stateNode.containerInfo);break;case 10:tr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Xp(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(rr(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Ny(n,a,i):(rr(a),n=Es(n,a,i),n!==null?n.sibling:null);rr(a);break;case 19:var v=(n.flags&128)!==0;if(d=(i&a.childLanes)!==0,d||(Zo(n,a,i,!1),d=(i&a.childLanes)!==0),v){if(d)return Ry(n,a,i);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Y(fn,fn.current),d)break;return null;case 22:return a.lanes=0,yy(n,a,i,a.pendingProps);case 24:tr(a,xn,n.memoizedState.cache)}return Es(n,a,i)}function Ty(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)vn=!0;else{if(!wm(n,i)&&(a.flags&128)===0)return vn=!1,QE(n,a,i);vn=(n.flags&131072)!==0}else vn=!1,wt&&(a.flags&1048576)!==0&&i_(a,mi,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(n=to(a.elementType),a.type=n,typeof n=="function")Ep(n)?(d=ro(n,d),a.tag=1,a=Sy(null,a,n,d,i)):(a.tag=0,a=hm(null,a,n,d,i));else{if(n!=null){var v=n.$$typeof;if(v===R){a.tag=11,a=by(null,a,n,d,i);break e}else if(v===A){a.tag=14,a=vy(null,a,n,d,i);break e}}throw a=q(n)||n,Error(o(306,a,""))}}return a;case 0:return hm(n,a,a.type,a.pendingProps,i);case 1:return d=a.type,v=ro(d,a.pendingProps),Sy(n,a,d,v,i);case 3:e:{if(le(a,a.stateNode.containerInfo),n===null)throw Error(o(387));d=a.pendingProps;var j=a.memoizedState;v=j.element,qp(n,a),ji(a,d,null,i);var O=a.memoizedState;if(d=O.cache,tr(a,xn,d),d!==j.cache&&Lp(a,[xn],i,!0),yi(),d=O.element,j.isDehydrated)if(j={element:d,isDehydrated:!1,cache:O.cache},a.updateQueue.baseState=j,a.memoizedState=j,a.flags&256){a=Cy(n,a,d,i);break e}else if(d!==v){v=Na(Error(o(424)),a),gi(v),a=Cy(n,a,d,i);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Xt=Aa(n.firstChild),Tn=a,wt=!0,Js=null,Ta=!0,i=y_(a,null,d,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Zr(),d===v){a=Es(n,a,i);break e}An(n,a,d,i)}a=a.child}return a;case 26:return Ou(n,a),n===null?(i=H0(a.type,null,a.pendingProps,null))?a.memoizedState=i:wt||(i=a.type,n=a.pendingProps,d=Qu(ne.current).createElement(i),d[Ot]=a,d[hn]=n,On(d,i,n),kn(d),a.stateNode=d):a.memoizedState=H0(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return ze(a),n===null&&wt&&(d=a.stateNode=I0(a.type,a.pendingProps,ne.current),Tn=a,Ta=!0,v=Xt,mr(a.type)?(ng=v,Xt=Aa(d.firstChild)):Xt=v),An(n,a,a.pendingProps.children,i),Ou(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&wt&&((v=d=Xt)&&(d=CR(d,a.type,a.pendingProps,Ta),d!==null?(a.stateNode=d,Tn=a,Xt=Aa(d.firstChild),Ta=!1,v=!0):v=!1),v||er(a)),ze(a),v=a.type,j=a.pendingProps,O=n!==null?n.memoizedProps:null,d=j.children,Zm(v,j)?d=null:O!==null&&Zm(v,O)&&(a.flags|=32),a.memoizedState!==null&&(v=Qp(n,a,HE,null,null,i),Vi._currentValue=v),Ou(n,a),An(n,a,d,i),a.child;case 6:return n===null&&wt&&((n=i=Xt)&&(i=NR(i,a.pendingProps,Ta),i!==null?(a.stateNode=i,Tn=a,Xt=null,n=!0):n=!1),n||er(a)),null;case 13:return Ny(n,a,i);case 4:return le(a,a.stateNode.containerInfo),d=a.pendingProps,n===null?a.child=ao(a,null,d,i):An(n,a,d,i),a.child;case 11:return by(n,a,a.type,a.pendingProps,i);case 7:return An(n,a,a.pendingProps,i),a.child;case 8:return An(n,a,a.pendingProps.children,i),a.child;case 12:return An(n,a,a.pendingProps.children,i),a.child;case 10:return d=a.pendingProps,tr(a,a.type,d.value),An(n,a,d.children,i),a.child;case 9:return v=a.type._context,d=a.pendingProps.children,Jr(a),v=Mn(v),d=d(v),a.flags|=1,An(n,a,d,i),a.child;case 14:return vy(n,a,a.type,a.pendingProps,i);case 15:return _y(n,a,a.type,a.pendingProps,i);case 19:return Ry(n,a,i);case 31:return KE(n,a,i);case 22:return yy(n,a,i,a.pendingProps);case 24:return Jr(a),d=Mn(xn),n===null?(v=Up(),v===null&&(v=$t,j=Ip(),v.pooledCache=j,j.refCount++,j!==null&&(v.pooledCacheLanes|=i),v=j),a.memoizedState={parent:d,cache:v},Vp(a),tr(a,xn,v)):((n.lanes&i)!==0&&(qp(n,a),ji(a,null,null,i),yi()),v=n.memoizedState,j=a.memoizedState,v.parent!==d?(v={parent:d,cache:d},a.memoizedState=v,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=v),tr(a,xn,d)):(d=j.cache,tr(a,xn,d),d!==v.cache&&Lp(a,[xn],i,!0))),An(n,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(o(156,a.tag))}function Rs(n){n.flags|=4}function km(n,a,i,d,v){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(v&335544128)===v)if(n.stateNode.complete)n.flags|=8192;else if(a0())n.flags|=8192;else throw no=bu,Hp}else n.flags&=-16777217}function My(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!G0(a))if(a0())n.flags|=8192;else throw no=bu,Hp}function Du(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?Jn():536870912,n.lanes|=a,cl|=a)}function Ei(n,a){if(!wt)switch(n.tailMode){case"hidden":a=n.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null}}function Kt(n){var a=n.alternate!==null&&n.alternate.child===n.child,i=0,d=0;if(a)for(var v=n.child;v!==null;)i|=v.lanes|v.childLanes,d|=v.subtreeFlags&65011712,d|=v.flags&65011712,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)i|=v.lanes|v.childLanes,d|=v.subtreeFlags,d|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=d,n.childLanes=i,a}function ZE(n,a,i){var d=a.pendingProps;switch(Ap(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(a),null;case 1:return Kt(a),null;case 3:return i=a.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Ss(xn),fe(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Qo(a)?Rs(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,zp())),Kt(a),null;case 26:var v=a.type,j=a.memoizedState;return n===null?(Rs(a),j!==null?(Kt(a),My(a,j)):(Kt(a),km(a,v,null,d,i))):j?j!==n.memoizedState?(Rs(a),Kt(a),My(a,j)):(Kt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==d&&Rs(a),Kt(a),km(a,v,n,d,i)),null;case 27:if(be(a),i=ne.current,v=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==d&&Rs(a);else{if(!d){if(a.stateNode===null)throw Error(o(166));return Kt(a),null}n=J.current,Qo(a)?u_(a):(n=I0(v,d,i),a.stateNode=n,Rs(a))}return Kt(a),null;case 5:if(be(a),v=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==d&&Rs(a);else{if(!d){if(a.stateNode===null)throw Error(o(166));return Kt(a),null}if(j=J.current,Qo(a))u_(a);else{var O=Qu(ne.current);switch(j){case 1:j=O.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:j=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":j=O.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":j=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":j=O.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof d.is=="string"?O.createElement("select",{is:d.is}):O.createElement("select"),d.multiple?j.multiple=!0:d.size&&(j.size=d.size);break;default:j=typeof d.is=="string"?O.createElement(v,{is:d.is}):O.createElement(v)}}j[Ot]=a,j[hn]=d;e:for(O=a.child;O!==null;){if(O.tag===5||O.tag===6)j.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===a)break e;for(;O.sibling===null;){if(O.return===null||O.return===a)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}a.stateNode=j;e:switch(On(j,v,d),v){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Rs(a)}}return Kt(a),km(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,i),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==d&&Rs(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(o(166));if(n=ne.current,Qo(a)){if(n=a.stateNode,i=a.memoizedProps,d=null,v=Tn,v!==null)switch(v.tag){case 27:case 5:d=v.memoizedProps}n[Ot]=a,n=!!(n.nodeValue===i||d!==null&&d.suppressHydrationWarning===!0||N0(n.nodeValue,i)),n||er(a,!0)}else n=Qu(n).createTextNode(d),n[Ot]=a,a.stateNode=n}return Kt(a),null;case 31:if(i=a.memoizedState,n===null||n.memoizedState!==null){if(d=Qo(a),i!==null){if(n===null){if(!d)throw Error(o(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Ot]=a}else Zr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),n=!1}else i=zp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return a.flags&256?(ha(a),a):(ha(a),null);if((a.flags&128)!==0)throw Error(o(558))}return Kt(a),null;case 13:if(d=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(v=Qo(a),d!==null&&d.dehydrated!==null){if(n===null){if(!v)throw Error(o(318));if(v=a.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(o(317));v[Ot]=a}else Zr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Kt(a),v=!1}else v=zp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=v),v=!0;if(!v)return a.flags&256?(ha(a),a):(ha(a),null)}return ha(a),(a.flags&128)!==0?(a.lanes=i,a):(i=d!==null,n=n!==null&&n.memoizedState!==null,i&&(d=a.child,v=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(v=d.alternate.memoizedState.cachePool.pool),j=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(j=d.memoizedState.cachePool.pool),j!==v&&(d.flags|=2048)),i!==n&&i&&(a.child.flags|=8192),Du(a,a.updateQueue),Kt(a),null);case 4:return fe(),n===null&&Gm(a.stateNode.containerInfo),Kt(a),null;case 10:return Ss(a.type),Kt(a),null;case 19:if(Q(fn),d=a.memoizedState,d===null)return Kt(a),null;if(v=(a.flags&128)!==0,j=d.rendering,j===null)if(v)Ei(d,!1);else{if(un!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(j=ju(n),j!==null){for(a.flags|=128,Ei(d,!1),n=j.updateQueue,a.updateQueue=n,Du(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)r_(i,n),i=i.sibling;return Y(fn,fn.current&1|2),wt&&ws(a,d.treeForkCount),a.child}n=n.sibling}d.tail!==null&&we()>Uu&&(a.flags|=128,v=!0,Ei(d,!1),a.lanes=4194304)}else{if(!v)if(n=ju(j),n!==null){if(a.flags|=128,v=!0,n=n.updateQueue,a.updateQueue=n,Du(a,n),Ei(d,!0),d.tail===null&&d.tailMode==="hidden"&&!j.alternate&&!wt)return Kt(a),null}else 2*we()-d.renderingStartTime>Uu&&i!==536870912&&(a.flags|=128,v=!0,Ei(d,!1),a.lanes=4194304);d.isBackwards?(j.sibling=a.child,a.child=j):(n=d.last,n!==null?n.sibling=j:a.child=j,d.last=j)}return d.tail!==null?(n=d.tail,d.rendering=n,d.tail=n.sibling,d.renderingStartTime=we(),n.sibling=null,i=fn.current,Y(fn,v?i&1|2:i&1),wt&&ws(a,d.treeForkCount),n):(Kt(a),null);case 22:case 23:return ha(a),Yp(),d=a.memoizedState!==null,n!==null?n.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(i&536870912)!==0&&(a.flags&128)===0&&(Kt(a),a.subtreeFlags&6&&(a.flags|=8192)):Kt(a),i=a.updateQueue,i!==null&&Du(a,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==i&&(a.flags|=2048),n!==null&&Q(eo),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Ss(xn),Kt(a),null;case 25:return null;case 30:return null}throw Error(o(156,a.tag))}function WE(n,a){switch(Ap(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Ss(xn),fe(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return be(a),null;case 31:if(a.memoizedState!==null){if(ha(a),a.alternate===null)throw Error(o(340));Zr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(ha(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(o(340));Zr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return Q(fn),null;case 4:return fe(),null;case 10:return Ss(a.type),null;case 22:case 23:return ha(a),Yp(),n!==null&&Q(eo),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Ss(xn),null;case 25:return null;default:return null}}function Ay(n,a){switch(Ap(a),a.tag){case 3:Ss(xn),fe();break;case 26:case 27:case 5:be(a);break;case 4:fe();break;case 31:a.memoizedState!==null&&ha(a);break;case 13:ha(a);break;case 19:Q(fn);break;case 10:Ss(a.type);break;case 22:case 23:ha(a),Yp(),n!==null&&Q(eo);break;case 24:Ss(xn)}}function Ri(n,a){try{var i=a.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var v=d.next;i=v;do{if((i.tag&n)===n){d=void 0;var j=i.create,O=i.inst;d=j(),O.destroy=d}i=i.next}while(i!==v)}}catch(B){Dt(a,a.return,B)}}function lr(n,a,i){try{var d=a.updateQueue,v=d!==null?d.lastEffect:null;if(v!==null){var j=v.next;d=j;do{if((d.tag&n)===n){var O=d.inst,B=O.destroy;if(B!==void 0){O.destroy=void 0,v=a;var Z=i,se=B;try{se()}catch(ge){Dt(v,Z,ge)}}}d=d.next}while(d!==j)}}catch(ge){Dt(a,a.return,ge)}}function Oy(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{w_(a,i)}catch(d){Dt(n,n.return,d)}}}function zy(n,a,i){i.props=ro(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(d){Dt(n,a,d)}}function Ti(n,a){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var d=n.stateNode;break;case 30:d=n.stateNode;break;default:d=n.stateNode}typeof i=="function"?n.refCleanup=i(d):i.current=d}}catch(v){Dt(n,a,v)}}function Za(n,a){var i=n.ref,d=n.refCleanup;if(i!==null)if(typeof d=="function")try{d()}catch(v){Dt(n,a,v)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(v){Dt(n,a,v)}else i.current=null}function Dy(n){var a=n.type,i=n.memoizedProps,d=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&d.focus();break e;case"img":i.src?d.src=i.src:i.srcSet&&(d.srcset=i.srcSet)}}catch(v){Dt(n,n.return,v)}}function Sm(n,a,i){try{var d=n.stateNode;_R(d,n.type,i,a),d[hn]=a}catch(v){Dt(n,n.return,v)}}function Py(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&mr(n.type)||n.tag===4}function Cm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Py(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&mr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Nm(n,a,i){var d=n.tag;if(d===5||d===6)n=n.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(n),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=_s));else if(d!==4&&(d===27&&mr(n.type)&&(i=n.stateNode,a=null),n=n.child,n!==null))for(Nm(n,a,i),n=n.sibling;n!==null;)Nm(n,a,i),n=n.sibling}function Pu(n,a,i){var d=n.tag;if(d===5||d===6)n=n.stateNode,a?i.insertBefore(n,a):i.appendChild(n);else if(d!==4&&(d===27&&mr(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Pu(n,a,i),n=n.sibling;n!==null;)Pu(n,a,i),n=n.sibling}function Ly(n){var a=n.stateNode,i=n.memoizedProps;try{for(var d=n.type,v=a.attributes;v.length;)a.removeAttributeNode(v[0]);On(a,d,i),a[Ot]=n,a[hn]=i}catch(j){Dt(n,n.return,j)}}var Ts=!1,_n=!1,Em=!1,Iy=typeof WeakSet=="function"?WeakSet:Set,Sn=null;function JE(n,a){if(n=n.containerInfo,Km=ad,n=Qv(n),yp(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var d=i.getSelection&&i.getSelection();if(d&&d.rangeCount!==0){i=d.anchorNode;var v=d.anchorOffset,j=d.focusNode;d=d.focusOffset;try{i.nodeType,j.nodeType}catch{i=null;break e}var O=0,B=-1,Z=-1,se=0,ge=0,_e=n,re=null;t:for(;;){for(var ce;_e!==i||v!==0&&_e.nodeType!==3||(B=O+v),_e!==j||d!==0&&_e.nodeType!==3||(Z=O+d),_e.nodeType===3&&(O+=_e.nodeValue.length),(ce=_e.firstChild)!==null;)re=_e,_e=ce;for(;;){if(_e===n)break t;if(re===i&&++se===v&&(B=O),re===j&&++ge===d&&(Z=O),(ce=_e.nextSibling)!==null)break;_e=re,re=_e.parentNode}_e=ce}i=B===-1||Z===-1?null:{start:B,end:Z}}else i=null}i=i||{start:0,end:0}}else i=null;for(Qm={focusedElem:n,selectionRange:i},ad=!1,Sn=a;Sn!==null;)if(a=Sn,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Sn=n;else for(;Sn!==null;){switch(a=Sn,j=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)v=n[i],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&j!==null){n=void 0,i=a,v=j.memoizedProps,j=j.memoizedState,d=i.stateNode;try{var Ge=ro(i.type,v);n=d.getSnapshotBeforeUpdate(Ge,j),d.__reactInternalSnapshotBeforeUpdate=n}catch(tt){Dt(i,i.return,tt)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)Jm(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Jm(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(o(163))}if(n=a.sibling,n!==null){n.return=a.return,Sn=n;break}Sn=a.return}}function By(n,a,i){var d=i.flags;switch(i.tag){case 0:case 11:case 15:As(n,i),d&4&&Ri(5,i);break;case 1:if(As(n,i),d&4)if(n=i.stateNode,a===null)try{n.componentDidMount()}catch(O){Dt(i,i.return,O)}else{var v=ro(i.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(v,a,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Dt(i,i.return,O)}}d&64&&Oy(i),d&512&&Ti(i,i.return);break;case 3:if(As(n,i),d&64&&(n=i.updateQueue,n!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{w_(n,a)}catch(O){Dt(i,i.return,O)}}break;case 27:a===null&&d&4&&Ly(i);case 26:case 5:As(n,i),a===null&&d&4&&Dy(i),d&512&&Ti(i,i.return);break;case 12:As(n,i);break;case 31:As(n,i),d&4&&Vy(n,i);break;case 13:As(n,i),d&4&&qy(n,i),d&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=iR.bind(null,i),ER(n,i))));break;case 22:if(d=i.memoizedState!==null||Ts,!d){a=a!==null&&a.memoizedState!==null||_n,v=Ts;var j=_n;Ts=d,(_n=a)&&!j?Os(n,i,(i.subtreeFlags&8772)!==0):As(n,i),Ts=v,_n=j}break;case 30:break;default:As(n,i)}}function Uy(n){var a=n.alternate;a!==null&&(n.alternate=null,Uy(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&sp(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var en=null,na=!1;function Ms(n,a,i){for(i=i.child;i!==null;)Hy(n,a,i),i=i.sibling}function Hy(n,a,i){if(Pe&&typeof Pe.onCommitFiberUnmount=="function")try{Pe.onCommitFiberUnmount(Me,i)}catch{}switch(i.tag){case 26:_n||Za(i,a),Ms(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:_n||Za(i,a);var d=en,v=na;mr(i.type)&&(en=i.stateNode,na=!1),Ms(n,a,i),Bi(i.stateNode),en=d,na=v;break;case 5:_n||Za(i,a);case 6:if(d=en,v=na,en=null,Ms(n,a,i),en=d,na=v,en!==null)if(na)try{(en.nodeType===9?en.body:en.nodeName==="HTML"?en.ownerDocument.body:en).removeChild(i.stateNode)}catch(j){Dt(i,a,j)}else try{en.removeChild(i.stateNode)}catch(j){Dt(i,a,j)}break;case 18:en!==null&&(na?(n=en,O0(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),xl(n)):O0(en,i.stateNode));break;case 4:d=en,v=na,en=i.stateNode.containerInfo,na=!0,Ms(n,a,i),en=d,na=v;break;case 0:case 11:case 14:case 15:lr(2,i,a),_n||lr(4,i,a),Ms(n,a,i);break;case 1:_n||(Za(i,a),d=i.stateNode,typeof d.componentWillUnmount=="function"&&zy(i,a,d)),Ms(n,a,i);break;case 21:Ms(n,a,i);break;case 22:_n=(d=_n)||i.memoizedState!==null,Ms(n,a,i),_n=d;break;default:Ms(n,a,i)}}function Vy(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{xl(n)}catch(i){Dt(a,a.return,i)}}}function qy(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{xl(n)}catch(i){Dt(a,a.return,i)}}function eR(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new Iy),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new Iy),a;default:throw Error(o(435,n.tag))}}function Lu(n,a){var i=eR(n);a.forEach(function(d){if(!i.has(d)){i.add(d);var v=cR.bind(null,n,d);d.then(v,v)}})}function aa(n,a){var i=a.deletions;if(i!==null)for(var d=0;d<i.length;d++){var v=i[d],j=n,O=a,B=O;e:for(;B!==null;){switch(B.tag){case 27:if(mr(B.type)){en=B.stateNode,na=!1;break e}break;case 5:en=B.stateNode,na=!1;break e;case 3:case 4:en=B.stateNode.containerInfo,na=!0;break e}B=B.return}if(en===null)throw Error(o(160));Hy(j,O,v),en=null,na=!1,j=v.alternate,j!==null&&(j.return=null),v.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)$y(a,n),a=a.sibling}var Ua=null;function $y(n,a){var i=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:aa(a,n),sa(n),d&4&&(lr(3,n,n.return),Ri(3,n),lr(5,n,n.return));break;case 1:aa(a,n),sa(n),d&512&&(_n||i===null||Za(i,i.return)),d&64&&Ts&&(n=n.updateQueue,n!==null&&(d=n.callbacks,d!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?d:i.concat(d))));break;case 26:var v=Ua;if(aa(a,n),sa(n),d&512&&(_n||i===null||Za(i,i.return)),d&4){var j=i!==null?i.memoizedState:null;if(d=n.memoizedState,i===null)if(d===null)if(n.stateNode===null){e:{d=n.type,i=n.memoizedProps,v=v.ownerDocument||v;t:switch(d){case"title":j=v.getElementsByTagName("title")[0],(!j||j[ai]||j[Ot]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=v.createElement(d),v.head.insertBefore(j,v.querySelector("head > title"))),On(j,d,i),j[Ot]=n,kn(j),d=j;break e;case"link":var O=$0("link","href",v).get(d+(i.href||""));if(O){for(var B=0;B<O.length;B++)if(j=O[B],j.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&j.getAttribute("rel")===(i.rel==null?null:i.rel)&&j.getAttribute("title")===(i.title==null?null:i.title)&&j.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){O.splice(B,1);break t}}j=v.createElement(d),On(j,d,i),v.head.appendChild(j);break;case"meta":if(O=$0("meta","content",v).get(d+(i.content||""))){for(B=0;B<O.length;B++)if(j=O[B],j.getAttribute("content")===(i.content==null?null:""+i.content)&&j.getAttribute("name")===(i.name==null?null:i.name)&&j.getAttribute("property")===(i.property==null?null:i.property)&&j.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&j.getAttribute("charset")===(i.charSet==null?null:i.charSet)){O.splice(B,1);break t}}j=v.createElement(d),On(j,d,i),v.head.appendChild(j);break;default:throw Error(o(468,d))}j[Ot]=n,kn(j),d=j}n.stateNode=d}else F0(v,n.type,n.stateNode);else n.stateNode=q0(v,d,n.memoizedProps);else j!==d?(j===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):j.count--,d===null?F0(v,n.type,n.stateNode):q0(v,d,n.memoizedProps)):d===null&&n.stateNode!==null&&Sm(n,n.memoizedProps,i.memoizedProps)}break;case 27:aa(a,n),sa(n),d&512&&(_n||i===null||Za(i,i.return)),i!==null&&d&4&&Sm(n,n.memoizedProps,i.memoizedProps);break;case 5:if(aa(a,n),sa(n),d&512&&(_n||i===null||Za(i,i.return)),n.flags&32){v=n.stateNode;try{Uo(v,"")}catch(Ge){Dt(n,n.return,Ge)}}d&4&&n.stateNode!=null&&(v=n.memoizedProps,Sm(n,v,i!==null?i.memoizedProps:v)),d&1024&&(Em=!0);break;case 6:if(aa(a,n),sa(n),d&4){if(n.stateNode===null)throw Error(o(162));d=n.memoizedProps,i=n.stateNode;try{i.nodeValue=d}catch(Ge){Dt(n,n.return,Ge)}}break;case 3:if(Ju=null,v=Ua,Ua=Zu(a.containerInfo),aa(a,n),Ua=v,sa(n),d&4&&i!==null&&i.memoizedState.isDehydrated)try{xl(a.containerInfo)}catch(Ge){Dt(n,n.return,Ge)}Em&&(Em=!1,Fy(n));break;case 4:d=Ua,Ua=Zu(n.stateNode.containerInfo),aa(a,n),sa(n),Ua=d;break;case 12:aa(a,n),sa(n);break;case 31:aa(a,n),sa(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Lu(n,d)));break;case 13:aa(a,n),sa(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Bu=we()),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Lu(n,d)));break;case 22:v=n.memoizedState!==null;var Z=i!==null&&i.memoizedState!==null,se=Ts,ge=_n;if(Ts=se||v,_n=ge||Z,aa(a,n),_n=ge,Ts=se,sa(n),d&8192)e:for(a=n.stateNode,a._visibility=v?a._visibility&-2:a._visibility|1,v&&(i===null||Z||Ts||_n||oo(n)),i=null,a=n;;){if(a.tag===5||a.tag===26){if(i===null){Z=i=a;try{if(j=Z.stateNode,v)O=j.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{B=Z.stateNode;var _e=Z.memoizedProps.style,re=_e!=null&&_e.hasOwnProperty("display")?_e.display:null;B.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Ge){Dt(Z,Z.return,Ge)}}}else if(a.tag===6){if(i===null){Z=a;try{Z.stateNode.nodeValue=v?"":Z.memoizedProps}catch(Ge){Dt(Z,Z.return,Ge)}}}else if(a.tag===18){if(i===null){Z=a;try{var ce=Z.stateNode;v?z0(ce,!0):z0(Z.stateNode,!1)}catch(Ge){Dt(Z,Z.return,Ge)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=n.updateQueue,d!==null&&(i=d.retryQueue,i!==null&&(d.retryQueue=null,Lu(n,i))));break;case 19:aa(a,n),sa(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Lu(n,d)));break;case 30:break;case 21:break;default:aa(a,n),sa(n)}}function sa(n){var a=n.flags;if(a&2){try{for(var i,d=n.return;d!==null;){if(Py(d)){i=d;break}d=d.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var v=i.stateNode,j=Cm(n);Pu(n,j,v);break;case 5:var O=i.stateNode;i.flags&32&&(Uo(O,""),i.flags&=-33);var B=Cm(n);Pu(n,B,O);break;case 3:case 4:var Z=i.stateNode.containerInfo,se=Cm(n);Nm(n,se,Z);break;default:throw Error(o(161))}}catch(ge){Dt(n,n.return,ge)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Fy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Fy(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function As(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)By(n,a.alternate,a),a=a.sibling}function oo(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:lr(4,a,a.return),oo(a);break;case 1:Za(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&zy(a,a.return,i),oo(a);break;case 27:Bi(a.stateNode);case 26:case 5:Za(a,a.return),oo(a);break;case 22:a.memoizedState===null&&oo(a);break;case 30:oo(a);break;default:oo(a)}n=n.sibling}}function Os(n,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,v=n,j=a,O=j.flags;switch(j.tag){case 0:case 11:case 15:Os(v,j,i),Ri(4,j);break;case 1:if(Os(v,j,i),d=j,v=d.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(se){Dt(d,d.return,se)}if(d=j,v=d.updateQueue,v!==null){var B=d.stateNode;try{var Z=v.shared.hiddenCallbacks;if(Z!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Z.length;v++)j_(Z[v],B)}catch(se){Dt(d,d.return,se)}}i&&O&64&&Oy(j),Ti(j,j.return);break;case 27:Ly(j);case 26:case 5:Os(v,j,i),i&&d===null&&O&4&&Dy(j),Ti(j,j.return);break;case 12:Os(v,j,i);break;case 31:Os(v,j,i),i&&O&4&&Vy(v,j);break;case 13:Os(v,j,i),i&&O&4&&qy(v,j);break;case 22:j.memoizedState===null&&Os(v,j,i),Ti(j,j.return);break;case 30:break;default:Os(v,j,i)}a=a.sibling}}function Rm(n,a){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&hi(i))}function Tm(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&hi(n))}function Ha(n,a,i,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Gy(n,a,i,d),a=a.sibling}function Gy(n,a,i,d){var v=a.flags;switch(a.tag){case 0:case 11:case 15:Ha(n,a,i,d),v&2048&&Ri(9,a);break;case 1:Ha(n,a,i,d);break;case 3:Ha(n,a,i,d),v&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&hi(n)));break;case 12:if(v&2048){Ha(n,a,i,d),n=a.stateNode;try{var j=a.memoizedProps,O=j.id,B=j.onPostCommit;typeof B=="function"&&B(O,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Z){Dt(a,a.return,Z)}}else Ha(n,a,i,d);break;case 31:Ha(n,a,i,d);break;case 13:Ha(n,a,i,d);break;case 23:break;case 22:j=a.stateNode,O=a.alternate,a.memoizedState!==null?j._visibility&2?Ha(n,a,i,d):Mi(n,a):j._visibility&2?Ha(n,a,i,d):(j._visibility|=2,ol(n,a,i,d,(a.subtreeFlags&10256)!==0||!1)),v&2048&&Rm(O,a);break;case 24:Ha(n,a,i,d),v&2048&&Tm(a.alternate,a);break;default:Ha(n,a,i,d)}}function ol(n,a,i,d,v){for(v=v&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var j=n,O=a,B=i,Z=d,se=O.flags;switch(O.tag){case 0:case 11:case 15:ol(j,O,B,Z,v),Ri(8,O);break;case 23:break;case 22:var ge=O.stateNode;O.memoizedState!==null?ge._visibility&2?ol(j,O,B,Z,v):Mi(j,O):(ge._visibility|=2,ol(j,O,B,Z,v)),v&&se&2048&&Rm(O.alternate,O);break;case 24:ol(j,O,B,Z,v),v&&se&2048&&Tm(O.alternate,O);break;default:ol(j,O,B,Z,v)}a=a.sibling}}function Mi(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=n,d=a,v=d.flags;switch(d.tag){case 22:Mi(i,d),v&2048&&Rm(d.alternate,d);break;case 24:Mi(i,d),v&2048&&Tm(d.alternate,d);break;default:Mi(i,d)}a=a.sibling}}var Ai=8192;function ll(n,a,i){if(n.subtreeFlags&Ai)for(n=n.child;n!==null;)Yy(n,a,i),n=n.sibling}function Yy(n,a,i){switch(n.tag){case 26:ll(n,a,i),n.flags&Ai&&n.memoizedState!==null&&UR(i,Ua,n.memoizedState,n.memoizedProps);break;case 5:ll(n,a,i);break;case 3:case 4:var d=Ua;Ua=Zu(n.stateNode.containerInfo),ll(n,a,i),Ua=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=Ai,Ai=16777216,ll(n,a,i),Ai=d):ll(n,a,i));break;default:ll(n,a,i)}}function Xy(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Oi(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var d=a[i];Sn=d,Qy(d,n)}Xy(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ky(n),n=n.sibling}function Ky(n){switch(n.tag){case 0:case 11:case 15:Oi(n),n.flags&2048&&lr(9,n,n.return);break;case 3:Oi(n);break;case 12:Oi(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Iu(n)):Oi(n);break;default:Oi(n)}}function Iu(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var d=a[i];Sn=d,Qy(d,n)}Xy(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:lr(8,a,a.return),Iu(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Iu(a));break;default:Iu(a)}n=n.sibling}}function Qy(n,a){for(;Sn!==null;){var i=Sn;switch(i.tag){case 0:case 11:case 15:lr(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var d=i.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:hi(i.memoizedState.cache)}if(d=i.child,d!==null)d.return=i,Sn=d;else e:for(i=n;Sn!==null;){d=Sn;var v=d.sibling,j=d.return;if(Uy(d),d===i){Sn=null;break e}if(v!==null){v.return=j,Sn=v;break e}Sn=j}}}var tR={getCacheForType:function(n){var a=Mn(xn),i=a.data.get(n);return i===void 0&&(i=n(),a.data.set(n,i)),i},cacheSignal:function(){return Mn(xn).controller.signal}},nR=typeof WeakMap=="function"?WeakMap:Map,Mt=0,$t=null,bt=null,_t=0,zt=0,xa=null,ir=!1,il=!1,Mm=!1,zs=0,un=0,cr=0,lo=0,Am=0,ba=0,cl=0,zi=null,ra=null,Om=!1,Bu=0,Zy=0,Uu=1/0,Hu=null,ur=null,yn=0,dr=null,ul=null,Ds=0,zm=0,Dm=null,Wy=null,Di=0,Pm=null;function va(){return(Mt&2)!==0&&_t!==0?_t&-_t:V.T!==null?Vm():Pt()}function Jy(){if(ba===0)if((_t&536870912)===0||wt){var n=Jt;Jt<<=1,(Jt&3932160)===0&&(Jt=262144),ba=n}else ba=536870912;return n=ga.current,n!==null&&(n.flags|=32),ba}function oa(n,a,i){(n===$t&&(zt===2||zt===9)||n.cancelPendingCommit!==null)&&(dl(n,0),fr(n,_t,ba,!1)),ea(n,i),((Mt&2)===0||n!==$t)&&(n===$t&&((Mt&2)===0&&(lo|=i),un===4&&fr(n,_t,ba,!1)),Wa(n))}function e0(n,a,i){if((Mt&6)!==0)throw Error(o(327));var d=!i&&(a&127)===0&&(a&n.expiredLanes)===0||dn(n,a),v=d?rR(n,a):Im(n,a,!0),j=d;do{if(v===0){il&&!d&&fr(n,a,0,!1);break}else{if(i=n.current.alternate,j&&!aR(i)){v=Im(n,a,!1),j=!1;continue}if(v===2){if(j=a,n.errorRecoveryDisabledLanes&j)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){a=O;e:{var B=n;v=zi;var Z=B.current.memoizedState.isDehydrated;if(Z&&(dl(B,O).flags|=256),O=Im(B,O,!1),O!==2){if(Mm&&!Z){B.errorRecoveryDisabledLanes|=j,lo|=j,v=4;break e}j=ra,ra=v,j!==null&&(ra===null?ra=j:ra.push.apply(ra,j))}v=O}if(j=!1,v!==2)continue}}if(v===1){dl(n,0),fr(n,a,0,!0);break}e:{switch(d=n,j=v,j){case 0:case 1:throw Error(o(345));case 4:if((a&4194048)!==a)break;case 6:fr(d,a,ba,!ir);break e;case 2:ra=null;break;case 3:case 5:break;default:throw Error(o(329))}if((a&62914560)===a&&(v=Bu+300-we(),10<v)){if(fr(d,a,ba,!ir),Yt(d,0,!0)!==0)break e;Ds=a,d.timeoutHandle=M0(t0.bind(null,d,i,ra,Hu,Om,a,ba,lo,cl,ir,j,"Throttled",-0,0),v);break e}t0(d,i,ra,Hu,Om,a,ba,lo,cl,ir,j,null,-0,0)}}break}while(!0);Wa(n)}function t0(n,a,i,d,v,j,O,B,Z,se,ge,_e,re,ce){if(n.timeoutHandle=-1,_e=a.subtreeFlags,_e&8192||(_e&16785408)===16785408){_e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_s},Yy(a,j,_e);var Ge=(j&62914560)===j?Bu-we():(j&4194048)===j?Zy-we():0;if(Ge=HR(_e,Ge),Ge!==null){Ds=j,n.cancelPendingCommit=Ge(c0.bind(null,n,a,j,i,d,v,O,B,Z,ge,_e,null,re,ce)),fr(n,j,O,!se);return}}c0(n,a,j,i,d,v,O,B,Z)}function aR(n){for(var a=n;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var d=0;d<i.length;d++){var v=i[d],j=v.getSnapshot;v=v.value;try{if(!pa(j(),v))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function fr(n,a,i,d){a&=~Am,a&=~lo,n.suspendedLanes|=a,n.pingedLanes&=~a,d&&(n.warmLanes|=a),d=n.expirationTimes;for(var v=a;0<v;){var j=31-rt(v),O=1<<j;d[j]=-1,v&=~O}i!==0&&In(n,i,a)}function Vu(){return(Mt&6)===0?(Pi(0),!1):!0}function Lm(){if(bt!==null){if(zt===0)var n=bt.return;else n=bt,ks=Wr=null,Jp(n),tl=null,bi=0,n=bt;for(;n!==null;)Ay(n.alternate,n),n=n.return;bt=null}}function dl(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,wR(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Ds=0,Lm(),$t=n,bt=i=js(n.current,null),_t=a,zt=0,xa=null,ir=!1,il=dn(n,a),Mm=!1,cl=ba=Am=lo=cr=un=0,ra=zi=null,Om=!1,(a&8)!==0&&(a|=a&32);var d=n.entangledLanes;if(d!==0)for(n=n.entanglements,d&=a;0<d;){var v=31-rt(d),j=1<<v;a|=n[v],d&=~j}return zs=a,cu(),i}function n0(n,a){ct=null,V.H=Ci,a===el||a===xu?(a=b_(),zt=3):a===Hp?(a=b_(),zt=4):zt=a===gm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,xa=a,bt===null&&(un=1,Mu(n,Na(a,n.current)))}function a0(){var n=ga.current;return n===null?!0:(_t&4194048)===_t?Ma===null:(_t&62914560)===_t||(_t&536870912)!==0?n===Ma:!1}function s0(){var n=V.H;return V.H=Ci,n===null?Ci:n}function r0(){var n=V.A;return V.A=tR,n}function qu(){un=4,ir||(_t&4194048)!==_t&&ga.current!==null||(il=!0),(cr&134217727)===0&&(lo&134217727)===0||$t===null||fr($t,_t,ba,!1)}function Im(n,a,i){var d=Mt;Mt|=2;var v=s0(),j=r0();($t!==n||_t!==a)&&(Hu=null,dl(n,a)),a=!1;var O=un;e:do try{if(zt!==0&&bt!==null){var B=bt,Z=xa;switch(zt){case 8:Lm(),O=6;break e;case 3:case 2:case 9:case 6:ga.current===null&&(a=!0);var se=zt;if(zt=0,xa=null,fl(n,B,Z,se),i&&il){O=0;break e}break;default:se=zt,zt=0,xa=null,fl(n,B,Z,se)}}sR(),O=un;break}catch(ge){n0(n,ge)}while(!0);return a&&n.shellSuspendCounter++,ks=Wr=null,Mt=d,V.H=v,V.A=j,bt===null&&($t=null,_t=0,cu()),O}function sR(){for(;bt!==null;)o0(bt)}function rR(n,a){var i=Mt;Mt|=2;var d=s0(),v=r0();$t!==n||_t!==a?(Hu=null,Uu=we()+500,dl(n,a)):il=dn(n,a);e:do try{if(zt!==0&&bt!==null){a=bt;var j=xa;t:switch(zt){case 1:zt=0,xa=null,fl(n,a,j,1);break;case 2:case 9:if(h_(j)){zt=0,xa=null,l0(a);break}a=function(){zt!==2&&zt!==9||$t!==n||(zt=7),Wa(n)},j.then(a,a);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:h_(j)?(zt=0,xa=null,l0(a)):(zt=0,xa=null,fl(n,a,j,7));break;case 5:var O=null;switch(bt.tag){case 26:O=bt.memoizedState;case 5:case 27:var B=bt;if(O?G0(O):B.stateNode.complete){zt=0,xa=null;var Z=B.sibling;if(Z!==null)bt=Z;else{var se=B.return;se!==null?(bt=se,$u(se)):bt=null}break t}}zt=0,xa=null,fl(n,a,j,5);break;case 6:zt=0,xa=null,fl(n,a,j,6);break;case 8:Lm(),un=6;break e;default:throw Error(o(462))}}oR();break}catch(ge){n0(n,ge)}while(!0);return ks=Wr=null,V.H=d,V.A=v,Mt=i,bt!==null?0:($t=null,_t=0,cu(),un)}function oR(){for(;bt!==null&&!$e();)o0(bt)}function o0(n){var a=Ty(n.alternate,n,zs);n.memoizedProps=n.pendingProps,a===null?$u(n):bt=a}function l0(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=ky(i,a,a.pendingProps,a.type,void 0,_t);break;case 11:a=ky(i,a,a.pendingProps,a.type.render,a.ref,_t);break;case 5:Jp(a);default:Ay(i,a),a=bt=r_(a,zs),a=Ty(i,a,zs)}n.memoizedProps=n.pendingProps,a===null?$u(n):bt=a}function fl(n,a,i,d){ks=Wr=null,Jp(a),tl=null,bi=0;var v=a.return;try{if(XE(n,v,a,i,_t)){un=1,Mu(n,Na(i,n.current)),bt=null;return}}catch(j){if(v!==null)throw bt=v,j;un=1,Mu(n,Na(i,n.current)),bt=null;return}a.flags&32768?(wt||d===1?n=!0:il||(_t&536870912)!==0?n=!1:(ir=n=!0,(d===2||d===9||d===3||d===6)&&(d=ga.current,d!==null&&d.tag===13&&(d.flags|=16384))),i0(a,n)):$u(a)}function $u(n){var a=n;do{if((a.flags&32768)!==0){i0(a,ir);return}n=a.return;var i=ZE(a.alternate,a,zs);if(i!==null){bt=i;return}if(a=a.sibling,a!==null){bt=a;return}bt=a=n}while(a!==null);un===0&&(un=5)}function i0(n,a){do{var i=WE(n.alternate,n);if(i!==null){i.flags&=32767,bt=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(n=n.sibling,n!==null)){bt=n;return}bt=n=i}while(n!==null);un=6,bt=null}function c0(n,a,i,d,v,j,O,B,Z){n.cancelPendingCommit=null;do Fu();while(yn!==0);if((Mt&6)!==0)throw Error(o(327));if(a!==null){if(a===n.current)throw Error(o(177));if(j=a.lanes|a.childLanes,j|=Cp,xs(n,i,j,O,B,Z),n===$t&&(bt=$t=null,_t=0),ul=a,dr=n,Ds=i,zm=j,Dm=v,Wy=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,uR(Se,function(){return m0(),null})):(n.callbackNode=null,n.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=V.T,V.T=null,v=G.p,G.p=2,O=Mt,Mt|=4;try{JE(n,a,i)}finally{Mt=O,G.p=v,V.T=d}}yn=1,u0(),d0(),f0()}}function u0(){if(yn===1){yn=0;var n=dr,a=ul,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=V.T,V.T=null;var d=G.p;G.p=2;var v=Mt;Mt|=4;try{$y(a,n);var j=Qm,O=Qv(n.containerInfo),B=j.focusedElem,Z=j.selectionRange;if(O!==B&&B&&B.ownerDocument&&Kv(B.ownerDocument.documentElement,B)){if(Z!==null&&yp(B)){var se=Z.start,ge=Z.end;if(ge===void 0&&(ge=se),"selectionStart"in B)B.selectionStart=se,B.selectionEnd=Math.min(ge,B.value.length);else{var _e=B.ownerDocument||document,re=_e&&_e.defaultView||window;if(re.getSelection){var ce=re.getSelection(),Ge=B.textContent.length,tt=Math.min(Z.start,Ge),Bt=Z.end===void 0?tt:Math.min(Z.end,Ge);!ce.extend&&tt>Bt&&(O=Bt,Bt=tt,tt=O);var ee=Xv(B,tt),W=Xv(B,Bt);if(ee&&W&&(ce.rangeCount!==1||ce.anchorNode!==ee.node||ce.anchorOffset!==ee.offset||ce.focusNode!==W.node||ce.focusOffset!==W.offset)){var ae=_e.createRange();ae.setStart(ee.node,ee.offset),ce.removeAllRanges(),tt>Bt?(ce.addRange(ae),ce.extend(W.node,W.offset)):(ae.setEnd(W.node,W.offset),ce.addRange(ae))}}}}for(_e=[],ce=B;ce=ce.parentNode;)ce.nodeType===1&&_e.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<_e.length;B++){var xe=_e[B];xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}ad=!!Km,Qm=Km=null}finally{Mt=v,G.p=d,V.T=i}}n.current=a,yn=2}}function d0(){if(yn===2){yn=0;var n=dr,a=ul,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=V.T,V.T=null;var d=G.p;G.p=2;var v=Mt;Mt|=4;try{By(n,a.alternate,a)}finally{Mt=v,G.p=d,V.T=i}}yn=3}}function f0(){if(yn===4||yn===3){yn=0,He();var n=dr,a=ul,i=Ds,d=Wy;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?yn=5:(yn=0,ul=dr=null,p0(n,n.pendingLanes));var v=n.pendingLanes;if(v===0&&(ur=null),ut(i),a=a.stateNode,Pe&&typeof Pe.onCommitFiberRoot=="function")try{Pe.onCommitFiberRoot(Me,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=V.T,v=G.p,G.p=2,V.T=null;try{for(var j=n.onRecoverableError,O=0;O<d.length;O++){var B=d[O];j(B.value,{componentStack:B.stack})}}finally{V.T=a,G.p=v}}(Ds&3)!==0&&Fu(),Wa(n),v=n.pendingLanes,(i&261930)!==0&&(v&42)!==0?n===Pm?Di++:(Di=0,Pm=n):Di=0,Pi(0)}}function p0(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,hi(a)))}function Fu(){return u0(),d0(),f0(),m0()}function m0(){if(yn!==5)return!1;var n=dr,a=zm;zm=0;var i=ut(Ds),d=V.T,v=G.p;try{G.p=32>i?32:i,V.T=null,i=Dm,Dm=null;var j=dr,O=Ds;if(yn=0,ul=dr=null,Ds=0,(Mt&6)!==0)throw Error(o(331));var B=Mt;if(Mt|=4,Ky(j.current),Gy(j,j.current,O,i),Mt=B,Pi(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot=="function")try{Pe.onPostCommitFiberRoot(Me,j)}catch{}return!0}finally{G.p=v,V.T=d,p0(n,a)}}function g0(n,a,i){a=Na(i,a),a=mm(n.stateNode,a,2),n=sr(n,a,2),n!==null&&(ea(n,2),Wa(n))}function Dt(n,a,i){if(n.tag===3)g0(n,n,i);else for(;a!==null;){if(a.tag===3){g0(a,n,i);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ur===null||!ur.has(d))){n=Na(i,n),i=hy(2),d=sr(a,i,2),d!==null&&(xy(i,d,a,n),ea(d,2),Wa(d));break}}a=a.return}}function Bm(n,a,i){var d=n.pingCache;if(d===null){d=n.pingCache=new nR;var v=new Set;d.set(a,v)}else v=d.get(a),v===void 0&&(v=new Set,d.set(a,v));v.has(i)||(Mm=!0,v.add(i),n=lR.bind(null,n,a,i),a.then(n,n))}function lR(n,a,i){var d=n.pingCache;d!==null&&d.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,$t===n&&(_t&i)===i&&(un===4||un===3&&(_t&62914560)===_t&&300>we()-Bu?(Mt&2)===0&&dl(n,0):Am|=i,cl===_t&&(cl=0)),Wa(n)}function h0(n,a){a===0&&(a=Jn()),n=Kr(n,a),n!==null&&(ea(n,a),Wa(n))}function iR(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),h0(n,i)}function cR(n,a){var i=0;switch(n.tag){case 31:case 13:var d=n.stateNode,v=n.memoizedState;v!==null&&(i=v.retryLane);break;case 19:d=n.stateNode;break;case 22:d=n.stateNode._retryCache;break;default:throw Error(o(314))}d!==null&&d.delete(a),h0(n,i)}function uR(n,a){return Re(n,a)}var Gu=null,pl=null,Um=!1,Yu=!1,Hm=!1,pr=0;function Wa(n){n!==pl&&n.next===null&&(pl===null?Gu=pl=n:pl=pl.next=n),Yu=!0,Um||(Um=!0,fR())}function Pi(n,a){if(!Hm&&Yu){Hm=!0;do for(var i=!1,d=Gu;d!==null;){if(n!==0){var v=d.pendingLanes;if(v===0)var j=0;else{var O=d.suspendedLanes,B=d.pingedLanes;j=(1<<31-rt(42|n)+1)-1,j&=v&~(O&~B),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(i=!0,_0(d,j))}else j=_t,j=Yt(d,d===$t?j:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(j&3)===0||dn(d,j)||(i=!0,_0(d,j));d=d.next}while(i);Hm=!1}}function dR(){x0()}function x0(){Yu=Um=!1;var n=0;pr!==0&&jR()&&(n=pr);for(var a=we(),i=null,d=Gu;d!==null;){var v=d.next,j=b0(d,a);j===0?(d.next=null,i===null?Gu=v:i.next=v,v===null&&(pl=i)):(i=d,(n!==0||(j&3)!==0)&&(Yu=!0)),d=v}yn!==0&&yn!==5||Pi(n),pr!==0&&(pr=0)}function b0(n,a){for(var i=n.suspendedLanes,d=n.pingedLanes,v=n.expirationTimes,j=n.pendingLanes&-62914561;0<j;){var O=31-rt(j),B=1<<O,Z=v[O];Z===-1?((B&i)===0||(B&d)!==0)&&(v[O]=Ln(B,a)):Z<=a&&(n.expiredLanes|=B),j&=~B}if(a=$t,i=_t,i=Yt(n,n===a?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d=n.callbackNode,i===0||n===a&&(zt===2||zt===9)||n.cancelPendingCommit!==null)return d!==null&&d!==null&&Le(d),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||dn(n,i)){if(a=i&-i,a===n.callbackPriority)return a;switch(d!==null&&Le(d),ut(i)){case 2:case 8:i=Ee;break;case 32:i=Se;break;case 268435456:i=st;break;default:i=Se}return d=v0.bind(null,n),i=Re(i,d),n.callbackPriority=a,n.callbackNode=i,a}return d!==null&&d!==null&&Le(d),n.callbackPriority=2,n.callbackNode=null,2}function v0(n,a){if(yn!==0&&yn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Fu()&&n.callbackNode!==i)return null;var d=_t;return d=Yt(n,n===$t?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(e0(n,d,a),b0(n,we()),n.callbackNode!=null&&n.callbackNode===i?v0.bind(null,n):null)}function _0(n,a){if(Fu())return null;e0(n,a,!0)}function fR(){kR(function(){(Mt&6)!==0?Re(Ce,dR):x0()})}function Vm(){if(pr===0){var n=Wo;n===0&&(n=At,At<<=1,(At&261888)===0&&(At=256)),pr=n}return pr}function y0(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:tu(""+n)}function j0(n,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,n.id&&i.setAttribute("form",n.id),a.parentNode.insertBefore(i,a),n=new FormData(n),i.parentNode.removeChild(i),n}function pR(n,a,i,d,v){if(a==="submit"&&i&&i.stateNode===v){var j=y0((v[hn]||null).action),O=d.submitter;O&&(a=(a=O[hn]||null)?y0(a.formAction):O.getAttribute("formAction"),a!==null&&(j=a,O=null));var B=new ru("action","action",null,d,v);n.push({event:B,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(pr!==0){var Z=O?j0(v,O):new FormData(v);im(i,{pending:!0,data:Z,method:v.method,action:j},null,Z)}}else typeof j=="function"&&(B.preventDefault(),Z=O?j0(v,O):new FormData(v),im(i,{pending:!0,data:Z,method:v.method,action:j},j,Z))},currentTarget:v}]})}}for(var qm=0;qm<Sp.length;qm++){var $m=Sp[qm],mR=$m.toLowerCase(),gR=$m[0].toUpperCase()+$m.slice(1);Ba(mR,"on"+gR)}Ba(Jv,"onAnimationEnd"),Ba(e_,"onAnimationIteration"),Ba(t_,"onAnimationStart"),Ba("dblclick","onDoubleClick"),Ba("focusin","onFocus"),Ba("focusout","onBlur"),Ba(ME,"onTransitionRun"),Ba(AE,"onTransitionStart"),Ba(OE,"onTransitionCancel"),Ba(n_,"onTransitionEnd"),Io("onMouseEnter",["mouseout","mouseover"]),Io("onMouseLeave",["mouseout","mouseover"]),Io("onPointerEnter",["pointerout","pointerover"]),Io("onPointerLeave",["pointerout","pointerover"]),Fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Li="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),hR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Li));function w0(n,a){a=(a&4)!==0;for(var i=0;i<n.length;i++){var d=n[i],v=d.event;d=d.listeners;e:{var j=void 0;if(a)for(var O=d.length-1;0<=O;O--){var B=d[O],Z=B.instance,se=B.currentTarget;if(B=B.listener,Z!==j&&v.isPropagationStopped())break e;j=B,v.currentTarget=se;try{j(v)}catch(ge){iu(ge)}v.currentTarget=null,j=Z}else for(O=0;O<d.length;O++){if(B=d[O],Z=B.instance,se=B.currentTarget,B=B.listener,Z!==j&&v.isPropagationStopped())break e;j=B,v.currentTarget=se;try{j(v)}catch(ge){iu(ge)}v.currentTarget=null,j=Z}}}}function vt(n,a){var i=a[Zc];i===void 0&&(i=a[Zc]=new Set);var d=n+"__bubble";i.has(d)||(k0(a,n,2,!1),i.add(d))}function Fm(n,a,i){var d=0;a&&(d|=4),k0(i,n,d,a)}var Xu="_reactListening"+Math.random().toString(36).slice(2);function Gm(n){if(!n[Xu]){n[Xu]=!0,xv.forEach(function(i){i!=="selectionchange"&&(hR.has(i)||Fm(i,!1,n),Fm(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Xu]||(a[Xu]=!0,Fm("selectionchange",!1,a))}}function k0(n,a,i,d){switch(J0(a)){case 2:var v=$R;break;case 8:v=FR;break;default:v=lg}i=v.bind(null,a,i,n),v=void 0,!fp||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),d?v!==void 0?n.addEventListener(a,i,{capture:!0,passive:v}):n.addEventListener(a,i,!0):v!==void 0?n.addEventListener(a,i,{passive:v}):n.addEventListener(a,i,!1)}function Ym(n,a,i,d,v){var j=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var O=d.tag;if(O===3||O===4){var B=d.stateNode.containerInfo;if(B===v)break;if(O===4)for(O=d.return;O!==null;){var Z=O.tag;if((Z===3||Z===4)&&O.stateNode.containerInfo===v)return;O=O.return}for(;B!==null;){if(O=Do(B),O===null)return;if(Z=O.tag,Z===5||Z===6||Z===26||Z===27){d=j=O;continue e}B=B.parentNode}}d=d.return}Rv(function(){var se=j,ge=up(i),_e=[];e:{var re=a_.get(n);if(re!==void 0){var ce=ru,Ge=n;switch(n){case"keypress":if(au(i)===0)break e;case"keydown":case"keyup":ce=cE;break;case"focusin":Ge="focus",ce=hp;break;case"focusout":Ge="blur",ce=hp;break;case"beforeblur":case"afterblur":ce=hp;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=Av;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=ZN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=fE;break;case Jv:case e_:case t_:ce=eE;break;case n_:ce=mE;break;case"scroll":case"scrollend":ce=KN;break;case"wheel":ce=hE;break;case"copy":case"cut":case"paste":ce=nE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=zv;break;case"toggle":case"beforetoggle":ce=bE}var tt=(a&4)!==0,Bt=!tt&&(n==="scroll"||n==="scrollend"),ee=tt?re!==null?re+"Capture":null:re;tt=[];for(var W=se,ae;W!==null;){var xe=W;if(ae=xe.stateNode,xe=xe.tag,xe!==5&&xe!==26&&xe!==27||ae===null||ee===null||(xe=ri(W,ee),xe!=null&&tt.push(Ii(W,xe,ae))),Bt)break;W=W.return}0<tt.length&&(re=new ce(re,Ge,null,i,ge),_e.push({event:re,listeners:tt}))}}if((a&7)===0){e:{if(re=n==="mouseover"||n==="pointerover",ce=n==="mouseout"||n==="pointerout",re&&i!==cp&&(Ge=i.relatedTarget||i.fromElement)&&(Do(Ge)||Ge[$r]))break e;if((ce||re)&&(re=ge.window===ge?ge:(re=ge.ownerDocument)?re.defaultView||re.parentWindow:window,ce?(Ge=i.relatedTarget||i.toElement,ce=se,Ge=Ge?Do(Ge):null,Ge!==null&&(Bt=c(Ge),tt=Ge.tag,Ge!==Bt||tt!==5&&tt!==27&&tt!==6)&&(Ge=null)):(ce=null,Ge=se),ce!==Ge)){if(tt=Av,xe="onMouseLeave",ee="onMouseEnter",W="mouse",(n==="pointerout"||n==="pointerover")&&(tt=zv,xe="onPointerLeave",ee="onPointerEnter",W="pointer"),Bt=ce==null?re:si(ce),ae=Ge==null?re:si(Ge),re=new tt(xe,W+"leave",ce,i,ge),re.target=Bt,re.relatedTarget=ae,xe=null,Do(ge)===se&&(tt=new tt(ee,W+"enter",Ge,i,ge),tt.target=ae,tt.relatedTarget=Bt,xe=tt),Bt=xe,ce&&Ge)t:{for(tt=xR,ee=ce,W=Ge,ae=0,xe=ee;xe;xe=tt(xe))ae++;xe=0;for(var We=W;We;We=tt(We))xe++;for(;0<ae-xe;)ee=tt(ee),ae--;for(;0<xe-ae;)W=tt(W),xe--;for(;ae--;){if(ee===W||W!==null&&ee===W.alternate){tt=ee;break t}ee=tt(ee),W=tt(W)}tt=null}else tt=null;ce!==null&&S0(_e,re,ce,tt,!1),Ge!==null&&Bt!==null&&S0(_e,Bt,Ge,tt,!0)}}e:{if(re=se?si(se):window,ce=re.nodeName&&re.nodeName.toLowerCase(),ce==="select"||ce==="input"&&re.type==="file")var Rt=Vv;else if(Uv(re))if(qv)Rt=EE;else{Rt=CE;var Xe=SE}else ce=re.nodeName,!ce||ce.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?se&&ip(se.elementType)&&(Rt=Vv):Rt=NE;if(Rt&&(Rt=Rt(n,se))){Hv(_e,Rt,i,ge);break e}Xe&&Xe(n,re,se),n==="focusout"&&se&&re.type==="number"&&se.memoizedProps.value!=null&&lp(re,"number",re.value)}switch(Xe=se?si(se):window,n){case"focusin":(Uv(Xe)||Xe.contentEditable==="true")&&($o=Xe,jp=se,pi=null);break;case"focusout":pi=jp=$o=null;break;case"mousedown":wp=!0;break;case"contextmenu":case"mouseup":case"dragend":wp=!1,Zv(_e,i,ge);break;case"selectionchange":if(TE)break;case"keydown":case"keyup":Zv(_e,i,ge)}var dt;if(bp)e:{switch(n){case"compositionstart":var yt="onCompositionStart";break e;case"compositionend":yt="onCompositionEnd";break e;case"compositionupdate":yt="onCompositionUpdate";break e}yt=void 0}else qo?Iv(n,i)&&(yt="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(yt="onCompositionStart");yt&&(Dv&&i.locale!=="ko"&&(qo||yt!=="onCompositionStart"?yt==="onCompositionEnd"&&qo&&(dt=Tv()):(Zs=ge,pp="value"in Zs?Zs.value:Zs.textContent,qo=!0)),Xe=Ku(se,yt),0<Xe.length&&(yt=new Ov(yt,n,null,i,ge),_e.push({event:yt,listeners:Xe}),dt?yt.data=dt:(dt=Bv(i),dt!==null&&(yt.data=dt)))),(dt=_E?yE(n,i):jE(n,i))&&(yt=Ku(se,"onBeforeInput"),0<yt.length&&(Xe=new Ov("onBeforeInput","beforeinput",null,i,ge),_e.push({event:Xe,listeners:yt}),Xe.data=dt)),pR(_e,n,se,i,ge)}w0(_e,a)})}function Ii(n,a,i){return{instance:n,listener:a,currentTarget:i}}function Ku(n,a){for(var i=a+"Capture",d=[];n!==null;){var v=n,j=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||j===null||(v=ri(n,i),v!=null&&d.unshift(Ii(n,v,j)),v=ri(n,a),v!=null&&d.push(Ii(n,v,j))),n.tag===3)return d;n=n.return}return[]}function xR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function S0(n,a,i,d,v){for(var j=a._reactName,O=[];i!==null&&i!==d;){var B=i,Z=B.alternate,se=B.stateNode;if(B=B.tag,Z!==null&&Z===d)break;B!==5&&B!==26&&B!==27||se===null||(Z=se,v?(se=ri(i,j),se!=null&&O.unshift(Ii(i,se,Z))):v||(se=ri(i,j),se!=null&&O.push(Ii(i,se,Z)))),i=i.return}O.length!==0&&n.push({event:a,listeners:O})}var bR=/\r\n?/g,vR=/\u0000|\uFFFD/g;function C0(n){return(typeof n=="string"?n:""+n).replace(bR,`
49
+ `).replace(vR,"")}function N0(n,a){return a=C0(a),C0(n)===a}function It(n,a,i,d,v,j){switch(i){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||Uo(n,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&Uo(n,""+d);break;case"className":Jc(n,"class",d);break;case"tabIndex":Jc(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Jc(n,i,d);break;case"style":Nv(n,d,j);break;case"data":if(a!=="object"){Jc(n,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||i!=="href")){n.removeAttribute(i);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=tu(""+d),n.setAttribute(i,d);break;case"action":case"formAction":if(typeof d=="function"){n.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof j=="function"&&(i==="formAction"?(a!=="input"&&It(n,a,"name",v.name,v,null),It(n,a,"formEncType",v.formEncType,v,null),It(n,a,"formMethod",v.formMethod,v,null),It(n,a,"formTarget",v.formTarget,v,null)):(It(n,a,"encType",v.encType,v,null),It(n,a,"method",v.method,v,null),It(n,a,"target",v.target,v,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=tu(""+d),n.setAttribute(i,d);break;case"onClick":d!=null&&(n.onclick=_s);break;case"onScroll":d!=null&&vt("scroll",n);break;case"onScrollEnd":d!=null&&vt("scrollend",n);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(i=d.__html,i!=null){if(v.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"multiple":n.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":n.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){n.removeAttribute("xlink:href");break}i=tu(""+d),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""+d):n.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":d===!0?n.setAttribute(i,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,d):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?n.setAttribute(i,d):n.removeAttribute(i);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?n.removeAttribute(i):n.setAttribute(i,d);break;case"popover":vt("beforetoggle",n),vt("toggle",n),Wc(n,"popover",d);break;case"xlinkActuate":vs(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":vs(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":vs(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":vs(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":vs(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":vs(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":vs(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":vs(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":vs(n,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Wc(n,"is",d);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=YN.get(i)||i,Wc(n,i,d))}}function Xm(n,a,i,d,v,j){switch(i){case"style":Nv(n,d,j);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(i=d.__html,i!=null){if(v.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"children":typeof d=="string"?Uo(n,d):(typeof d=="number"||typeof d=="bigint")&&Uo(n,""+d);break;case"onScroll":d!=null&&vt("scroll",n);break;case"onScrollEnd":d!=null&&vt("scrollend",n);break;case"onClick":d!=null&&(n.onclick=_s);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bv.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(v=i.endsWith("Capture"),a=i.slice(2,v?i.length-7:void 0),j=n[hn]||null,j=j!=null?j[i]:null,typeof j=="function"&&n.removeEventListener(a,j,v),typeof d=="function")){typeof j!="function"&&j!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(a,d,v);break e}i in n?n[i]=d:d===!0?n.setAttribute(i,""):Wc(n,i,d)}}}function On(n,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vt("error",n),vt("load",n);var d=!1,v=!1,j;for(j in i)if(i.hasOwnProperty(j)){var O=i[j];if(O!=null)switch(j){case"src":d=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:It(n,a,j,O,i,null)}}v&&It(n,a,"srcSet",i.srcSet,i,null),d&&It(n,a,"src",i.src,i,null);return;case"input":vt("invalid",n);var B=j=O=v=null,Z=null,se=null;for(d in i)if(i.hasOwnProperty(d)){var ge=i[d];if(ge!=null)switch(d){case"name":v=ge;break;case"type":O=ge;break;case"checked":Z=ge;break;case"defaultChecked":se=ge;break;case"value":j=ge;break;case"defaultValue":B=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(o(137,a));break;default:It(n,a,d,ge,i,null)}}wv(n,j,B,Z,se,O,v,!1);return;case"select":vt("invalid",n),d=O=j=null;for(v in i)if(i.hasOwnProperty(v)&&(B=i[v],B!=null))switch(v){case"value":j=B;break;case"defaultValue":O=B;break;case"multiple":d=B;default:It(n,a,v,B,i,null)}a=j,i=O,n.multiple=!!d,a!=null?Bo(n,!!d,a,!1):i!=null&&Bo(n,!!d,i,!0);return;case"textarea":vt("invalid",n),j=v=d=null;for(O in i)if(i.hasOwnProperty(O)&&(B=i[O],B!=null))switch(O){case"value":d=B;break;case"defaultValue":v=B;break;case"children":j=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(o(91));break;default:It(n,a,O,B,i,null)}Sv(n,d,v,j);return;case"option":for(Z in i)if(i.hasOwnProperty(Z)&&(d=i[Z],d!=null))switch(Z){case"selected":n.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:It(n,a,Z,d,i,null)}return;case"dialog":vt("beforetoggle",n),vt("toggle",n),vt("cancel",n),vt("close",n);break;case"iframe":case"object":vt("load",n);break;case"video":case"audio":for(d=0;d<Li.length;d++)vt(Li[d],n);break;case"image":vt("error",n),vt("load",n);break;case"details":vt("toggle",n);break;case"embed":case"source":case"link":vt("error",n),vt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(se in i)if(i.hasOwnProperty(se)&&(d=i[se],d!=null))switch(se){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:It(n,a,se,d,i,null)}return;default:if(ip(a)){for(ge in i)i.hasOwnProperty(ge)&&(d=i[ge],d!==void 0&&Xm(n,a,ge,d,i,void 0));return}}for(B in i)i.hasOwnProperty(B)&&(d=i[B],d!=null&&It(n,a,B,d,i,null))}function _R(n,a,i,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,j=null,O=null,B=null,Z=null,se=null,ge=null;for(ce in i){var _e=i[ce];if(i.hasOwnProperty(ce)&&_e!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":Z=_e;default:d.hasOwnProperty(ce)||It(n,a,ce,null,d,_e)}}for(var re in d){var ce=d[re];if(_e=i[re],d.hasOwnProperty(re)&&(ce!=null||_e!=null))switch(re){case"type":j=ce;break;case"name":v=ce;break;case"checked":se=ce;break;case"defaultChecked":ge=ce;break;case"value":O=ce;break;case"defaultValue":B=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(o(137,a));break;default:ce!==_e&&It(n,a,re,ce,d,_e)}}op(n,O,B,Z,se,ge,j,v);return;case"select":ce=O=B=re=null;for(j in i)if(Z=i[j],i.hasOwnProperty(j)&&Z!=null)switch(j){case"value":break;case"multiple":ce=Z;default:d.hasOwnProperty(j)||It(n,a,j,null,d,Z)}for(v in d)if(j=d[v],Z=i[v],d.hasOwnProperty(v)&&(j!=null||Z!=null))switch(v){case"value":re=j;break;case"defaultValue":B=j;break;case"multiple":O=j;default:j!==Z&&It(n,a,v,j,d,Z)}a=B,i=O,d=ce,re!=null?Bo(n,!!i,re,!1):!!d!=!!i&&(a!=null?Bo(n,!!i,a,!0):Bo(n,!!i,i?[]:"",!1));return;case"textarea":ce=re=null;for(B in i)if(v=i[B],i.hasOwnProperty(B)&&v!=null&&!d.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:It(n,a,B,null,d,v)}for(O in d)if(v=d[O],j=i[O],d.hasOwnProperty(O)&&(v!=null||j!=null))switch(O){case"value":re=v;break;case"defaultValue":ce=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(o(91));break;default:v!==j&&It(n,a,O,v,d,j)}kv(n,re,ce);return;case"option":for(var Ge in i)if(re=i[Ge],i.hasOwnProperty(Ge)&&re!=null&&!d.hasOwnProperty(Ge))switch(Ge){case"selected":n.selected=!1;break;default:It(n,a,Ge,null,d,re)}for(Z in d)if(re=d[Z],ce=i[Z],d.hasOwnProperty(Z)&&re!==ce&&(re!=null||ce!=null))switch(Z){case"selected":n.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:It(n,a,Z,re,d,ce)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var tt in i)re=i[tt],i.hasOwnProperty(tt)&&re!=null&&!d.hasOwnProperty(tt)&&It(n,a,tt,null,d,re);for(se in d)if(re=d[se],ce=i[se],d.hasOwnProperty(se)&&re!==ce&&(re!=null||ce!=null))switch(se){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(o(137,a));break;default:It(n,a,se,re,d,ce)}return;default:if(ip(a)){for(var Bt in i)re=i[Bt],i.hasOwnProperty(Bt)&&re!==void 0&&!d.hasOwnProperty(Bt)&&Xm(n,a,Bt,void 0,d,re);for(ge in d)re=d[ge],ce=i[ge],!d.hasOwnProperty(ge)||re===ce||re===void 0&&ce===void 0||Xm(n,a,ge,re,d,ce);return}}for(var ee in i)re=i[ee],i.hasOwnProperty(ee)&&re!=null&&!d.hasOwnProperty(ee)&&It(n,a,ee,null,d,re);for(_e in d)re=d[_e],ce=i[_e],!d.hasOwnProperty(_e)||re===ce||re==null&&ce==null||It(n,a,_e,re,d,ce)}function E0(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function yR(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,i=performance.getEntriesByType("resource"),d=0;d<i.length;d++){var v=i[d],j=v.transferSize,O=v.initiatorType,B=v.duration;if(j&&B&&E0(O)){for(O=0,B=v.responseEnd,d+=1;d<i.length;d++){var Z=i[d],se=Z.startTime;if(se>B)break;var ge=Z.transferSize,_e=Z.initiatorType;ge&&E0(_e)&&(Z=Z.responseEnd,O+=ge*(Z<B?1:(B-se)/(Z-se)))}if(--d,a+=8*(j+O)/(v.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Km=null,Qm=null;function Qu(n){return n.nodeType===9?n:n.ownerDocument}function R0(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function T0(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Zm(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Wm=null;function jR(){var n=window.event;return n&&n.type==="popstate"?n===Wm?!1:(Wm=n,!0):(Wm=null,!1)}var M0=typeof setTimeout=="function"?setTimeout:void 0,wR=typeof clearTimeout=="function"?clearTimeout:void 0,A0=typeof Promise=="function"?Promise:void 0,kR=typeof queueMicrotask=="function"?queueMicrotask:typeof A0<"u"?function(n){return A0.resolve(null).then(n).catch(SR)}:M0;function SR(n){setTimeout(function(){throw n})}function mr(n){return n==="head"}function O0(n,a){var i=a,d=0;do{var v=i.nextSibling;if(n.removeChild(i),v&&v.nodeType===8)if(i=v.data,i==="/$"||i==="/&"){if(d===0){n.removeChild(v),xl(a);return}d--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")d++;else if(i==="html")Bi(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Bi(i);for(var j=i.firstChild;j;){var O=j.nextSibling,B=j.nodeName;j[ai]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&j.rel.toLowerCase()==="stylesheet"||i.removeChild(j),j=O}}else i==="body"&&Bi(n.ownerDocument.body);i=v}while(i);xl(a)}function z0(n,a){var i=n;n=0;do{var d=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=d}while(i)}function Jm(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Jm(i),sp(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function CR(n,a,i,d){for(;n.nodeType===1;){var v=i;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(d){if(!n[ai])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(j=n.getAttribute("rel"),j==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(j!==v.rel||n.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||n.getAttribute("title")!==(v.title==null?null:v.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(j=n.getAttribute("src"),(j!==(v.src==null?null:v.src)||n.getAttribute("type")!==(v.type==null?null:v.type)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&j&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var j=v.name==null?null:""+v.name;if(v.type==="hidden"&&n.getAttribute("name")===j)return n}else return n;if(n=Aa(n.nextSibling),n===null)break}return null}function NR(n,a,i){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Aa(n.nextSibling),n===null))return null;return n}function D0(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Aa(n.nextSibling),n===null))return null;return n}function eg(n){return n.data==="$?"||n.data==="$~"}function tg(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function ER(n,a){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||i.readyState!=="loading")a();else{var d=function(){a(),i.removeEventListener("DOMContentLoaded",d)};i.addEventListener("DOMContentLoaded",d),n._reactRetry=d}}function Aa(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var ng=null;function P0(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(a===0)return Aa(n.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}n=n.nextSibling}return null}function L0(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return n;a--}else i!=="/$"&&i!=="/&"||a++}n=n.previousSibling}return null}function I0(n,a,i){switch(a=Qu(i),n){case"html":if(n=a.documentElement,!n)throw Error(o(452));return n;case"head":if(n=a.head,!n)throw Error(o(453));return n;case"body":if(n=a.body,!n)throw Error(o(454));return n;default:throw Error(o(451))}}function Bi(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);sp(n)}var Oa=new Map,B0=new Set;function Zu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Ps=G.d;G.d={f:RR,r:TR,D:MR,C:AR,L:OR,m:zR,X:PR,S:DR,M:LR};function RR(){var n=Ps.f(),a=Vu();return n||a}function TR(n){var a=Po(n);a!==null&&a.tag===5&&a.type==="form"?ny(a):Ps.r(n)}var ml=typeof document>"u"?null:document;function U0(n,a,i){var d=ml;if(d&&typeof a=="string"&&a){var v=Sa(a);v='link[rel="'+n+'"][href="'+v+'"]',typeof i=="string"&&(v+='[crossorigin="'+i+'"]'),B0.has(v)||(B0.add(v),n={rel:n,crossOrigin:i,href:a},d.querySelector(v)===null&&(a=d.createElement("link"),On(a,"link",n),kn(a),d.head.appendChild(a)))}}function MR(n){Ps.D(n),U0("dns-prefetch",n,null)}function AR(n,a){Ps.C(n,a),U0("preconnect",n,a)}function OR(n,a,i){Ps.L(n,a,i);var d=ml;if(d&&n&&a){var v='link[rel="preload"][as="'+Sa(a)+'"]';a==="image"&&i&&i.imageSrcSet?(v+='[imagesrcset="'+Sa(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(v+='[imagesizes="'+Sa(i.imageSizes)+'"]')):v+='[href="'+Sa(n)+'"]';var j=v;switch(a){case"style":j=gl(n);break;case"script":j=hl(n)}Oa.has(j)||(n=b({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:n,as:a},i),Oa.set(j,n),d.querySelector(v)!==null||a==="style"&&d.querySelector(Ui(j))||a==="script"&&d.querySelector(Hi(j))||(a=d.createElement("link"),On(a,"link",n),kn(a),d.head.appendChild(a)))}}function zR(n,a){Ps.m(n,a);var i=ml;if(i&&n){var d=a&&typeof a.as=="string"?a.as:"script",v='link[rel="modulepreload"][as="'+Sa(d)+'"][href="'+Sa(n)+'"]',j=v;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=hl(n)}if(!Oa.has(j)&&(n=b({rel:"modulepreload",href:n},a),Oa.set(j,n),i.querySelector(v)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Hi(j)))return}d=i.createElement("link"),On(d,"link",n),kn(d),i.head.appendChild(d)}}}function DR(n,a,i){Ps.S(n,a,i);var d=ml;if(d&&n){var v=Lo(d).hoistableStyles,j=gl(n);a=a||"default";var O=v.get(j);if(!O){var B={loading:0,preload:null};if(O=d.querySelector(Ui(j)))B.loading=5;else{n=b({rel:"stylesheet",href:n,"data-precedence":a},i),(i=Oa.get(j))&&ag(n,i);var Z=O=d.createElement("link");kn(Z),On(Z,"link",n),Z._p=new Promise(function(se,ge){Z.onload=se,Z.onerror=ge}),Z.addEventListener("load",function(){B.loading|=1}),Z.addEventListener("error",function(){B.loading|=2}),B.loading|=4,Wu(O,a,d)}O={type:"stylesheet",instance:O,count:1,state:B},v.set(j,O)}}}function PR(n,a){Ps.X(n,a);var i=ml;if(i&&n){var d=Lo(i).hoistableScripts,v=hl(n),j=d.get(v);j||(j=i.querySelector(Hi(v)),j||(n=b({src:n,async:!0},a),(a=Oa.get(v))&&sg(n,a),j=i.createElement("script"),kn(j),On(j,"link",n),i.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(v,j))}}function LR(n,a){Ps.M(n,a);var i=ml;if(i&&n){var d=Lo(i).hoistableScripts,v=hl(n),j=d.get(v);j||(j=i.querySelector(Hi(v)),j||(n=b({src:n,async:!0,type:"module"},a),(a=Oa.get(v))&&sg(n,a),j=i.createElement("script"),kn(j),On(j,"link",n),i.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},d.set(v,j))}}function H0(n,a,i,d){var v=(v=ne.current)?Zu(v):null;if(!v)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=gl(i.href),i=Lo(v).hoistableStyles,d=i.get(a),d||(d={type:"style",instance:null,count:0,state:null},i.set(a,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=gl(i.href);var j=Lo(v).hoistableStyles,O=j.get(n);if(O||(v=v.ownerDocument||v,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(n,O),(j=v.querySelector(Ui(n)))&&!j._p&&(O.instance=j,O.state.loading=5),Oa.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Oa.set(n,i),j||IR(v,n,i,O.state))),a&&d===null)throw Error(o(528,""));return O}if(a&&d!==null)throw Error(o(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=hl(i),i=Lo(v).hoistableScripts,d=i.get(a),d||(d={type:"script",instance:null,count:0,state:null},i.set(a,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function gl(n){return'href="'+Sa(n)+'"'}function Ui(n){return'link[rel="stylesheet"]['+n+"]"}function V0(n){return b({},n,{"data-precedence":n.precedence,precedence:null})}function IR(n,a,i,d){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=n.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),On(a,"link",i),kn(a),n.head.appendChild(a))}function hl(n){return'[src="'+Sa(n)+'"]'}function Hi(n){return"script[async]"+n}function q0(n,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var d=n.querySelector('style[data-href~="'+Sa(i.href)+'"]');if(d)return a.instance=d,kn(d),d;var v=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),kn(d),On(d,"style",v),Wu(d,i.precedence,n),a.instance=d;case"stylesheet":v=gl(i.href);var j=n.querySelector(Ui(v));if(j)return a.state.loading|=4,a.instance=j,kn(j),j;d=V0(i),(v=Oa.get(v))&&ag(d,v),j=(n.ownerDocument||n).createElement("link"),kn(j);var O=j;return O._p=new Promise(function(B,Z){O.onload=B,O.onerror=Z}),On(j,"link",d),a.state.loading|=4,Wu(j,i.precedence,n),a.instance=j;case"script":return j=hl(i.src),(v=n.querySelector(Hi(j)))?(a.instance=v,kn(v),v):(d=i,(v=Oa.get(j))&&(d=b({},i),sg(d,v)),n=n.ownerDocument||n,v=n.createElement("script"),kn(v),On(v,"link",d),n.head.appendChild(v),a.instance=v);case"void":return null;default:throw Error(o(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,Wu(d,i.precedence,n));return a.instance}function Wu(n,a,i){for(var d=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=d.length?d[d.length-1]:null,j=v,O=0;O<d.length;O++){var B=d[O];if(B.dataset.precedence===a)j=B;else if(j!==v)break}j?j.parentNode.insertBefore(n,j.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(n,a.firstChild))}function ag(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function sg(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var Ju=null;function $0(n,a,i){if(Ju===null){var d=new Map,v=Ju=new Map;v.set(i,d)}else v=Ju,d=v.get(i),d||(d=new Map,v.set(i,d));if(d.has(n))return d;for(d.set(n,null),i=i.getElementsByTagName(n),v=0;v<i.length;v++){var j=i[v];if(!(j[ai]||j[Ot]||n==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var O=j.getAttribute(a)||"";O=n+O;var B=d.get(O);B?B.push(j):d.set(O,[j])}}return d}function F0(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function BR(n,a,i){if(i===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function G0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function UR(n,a,i,d){if(i.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var v=gl(d.href),j=a.querySelector(Ui(v));if(j){a=j._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=ed.bind(n),a.then(n,n)),i.state.loading|=4,i.instance=j,kn(j);return}j=a.ownerDocument||a,d=V0(d),(v=Oa.get(v))&&ag(d,v),j=j.createElement("link"),kn(j);var O=j;O._p=new Promise(function(B,Z){O.onload=B,O.onerror=Z}),On(j,"link",d),i.instance=j}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=ed.bind(n),a.addEventListener("load",i),a.addEventListener("error",i))}}var rg=0;function HR(n,a){return n.stylesheets&&n.count===0&&nd(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var d=setTimeout(function(){if(n.stylesheets&&nd(n,n.stylesheets),n.unsuspend){var j=n.unsuspend;n.unsuspend=null,j()}},6e4+a);0<n.imgBytes&&rg===0&&(rg=62500*yR());var v=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&nd(n,n.stylesheets),n.unsuspend)){var j=n.unsuspend;n.unsuspend=null,j()}},(n.imgBytes>rg?50:800)+a);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(v)}}:null}function ed(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nd(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var td=null;function nd(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,td=new Map,a.forEach(VR,n),td=null,ed.call(n))}function VR(n,a){if(!(a.state.loading&4)){var i=td.get(n);if(i)var d=i.get(null);else{i=new Map,td.set(n,i);for(var v=n.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<v.length;j++){var O=v[j];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(i.set(O.dataset.precedence,O),d=O)}d&&i.set(null,d)}v=a.instance,O=v.getAttribute("data-precedence"),j=i.get(O)||d,j===d&&i.set(null,v),i.set(O,v),this.count++,d=ed.bind(this),v.addEventListener("load",d),v.addEventListener("error",d),j?j.parentNode.insertBefore(v,j.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(v,n.firstChild)),a.state.loading|=4}}var Vi={$$typeof:E,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function qR(n,a,i,d,v,j,O,B,Z){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=da(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=da(0),this.hiddenUpdates=da(null),this.identifierPrefix=d,this.onUncaughtError=v,this.onCaughtError=j,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Z,this.incompleteTransitions=new Map}function Y0(n,a,i,d,v,j,O,B,Z,se,ge,_e){return n=new qR(n,a,i,O,Z,se,ge,_e,B),a=1,j===!0&&(a|=24),j=ma(3,null,null,a),n.current=j,j.stateNode=n,a=Ip(),a.refCount++,n.pooledCache=a,a.refCount++,j.memoizedState={element:d,isDehydrated:i,cache:a},Vp(j),n}function X0(n){return n?(n=Yo,n):Yo}function K0(n,a,i,d,v,j){v=X0(v),d.context===null?d.context=v:d.pendingContext=v,d=ar(a),d.payload={element:i},j=j===void 0?null:j,j!==null&&(d.callback=j),i=sr(n,d,a),i!==null&&(oa(i,n,a),_i(i,n,a))}function Q0(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function og(n,a){Q0(n,a),(n=n.alternate)&&Q0(n,a)}function Z0(n){if(n.tag===13||n.tag===31){var a=Kr(n,67108864);a!==null&&oa(a,n,67108864),og(n,67108864)}}function W0(n){if(n.tag===13||n.tag===31){var a=va();a=bs(a);var i=Kr(n,a);i!==null&&oa(i,n,a),og(n,a)}}var ad=!0;function $R(n,a,i,d){var v=V.T;V.T=null;var j=G.p;try{G.p=2,lg(n,a,i,d)}finally{G.p=j,V.T=v}}function FR(n,a,i,d){var v=V.T;V.T=null;var j=G.p;try{G.p=8,lg(n,a,i,d)}finally{G.p=j,V.T=v}}function lg(n,a,i,d){if(ad){var v=ig(d);if(v===null)Ym(n,a,d,sd,i),e1(n,d);else if(YR(v,n,a,i,d))d.stopPropagation();else if(e1(n,d),a&4&&-1<GR.indexOf(n)){for(;v!==null;){var j=Po(v);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var O=on(j.pendingLanes);if(O!==0){var B=j;for(B.pendingLanes|=2,B.entangledLanes|=2;O;){var Z=1<<31-rt(O);B.entanglements[1]|=Z,O&=~Z}Wa(j),(Mt&6)===0&&(Uu=we()+500,Pi(0))}}break;case 31:case 13:B=Kr(j,2),B!==null&&oa(B,j,2),Vu(),og(j,2)}if(j=ig(d),j===null&&Ym(n,a,d,sd,i),j===v)break;v=j}v!==null&&d.stopPropagation()}else Ym(n,a,d,null,i)}}function ig(n){return n=up(n),cg(n)}var sd=null;function cg(n){if(sd=null,n=Do(n),n!==null){var a=c(n);if(a===null)n=null;else{var i=a.tag;if(i===13){if(n=u(a),n!==null)return n;n=null}else if(i===31){if(n=p(a),n!==null)return n;n=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return sd=n,null}function J0(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ie()){case Ce:return 2;case Ee:return 8;case Se:case qe:return 32;case st:return 268435456;default:return 32}default:return 32}}var ug=!1,gr=null,hr=null,xr=null,qi=new Map,$i=new Map,br=[],GR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function e1(n,a){switch(n){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":hr=null;break;case"mouseover":case"mouseout":xr=null;break;case"pointerover":case"pointerout":qi.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":$i.delete(a.pointerId)}}function Fi(n,a,i,d,v,j){return n===null||n.nativeEvent!==j?(n={blockedOn:a,domEventName:i,eventSystemFlags:d,nativeEvent:j,targetContainers:[v]},a!==null&&(a=Po(a),a!==null&&Z0(a)),n):(n.eventSystemFlags|=d,a=n.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),n)}function YR(n,a,i,d,v){switch(a){case"focusin":return gr=Fi(gr,n,a,i,d,v),!0;case"dragenter":return hr=Fi(hr,n,a,i,d,v),!0;case"mouseover":return xr=Fi(xr,n,a,i,d,v),!0;case"pointerover":var j=v.pointerId;return qi.set(j,Fi(qi.get(j)||null,n,a,i,d,v)),!0;case"gotpointercapture":return j=v.pointerId,$i.set(j,Fi($i.get(j)||null,n,a,i,d,v)),!0}return!1}function t1(n){var a=Do(n.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=u(i),a!==null){n.blockedOn=a,Rn(n.priority,function(){W0(i)});return}}else if(a===31){if(a=p(i),a!==null){n.blockedOn=a,Rn(n.priority,function(){W0(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function rd(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var i=ig(n.nativeEvent);if(i===null){i=n.nativeEvent;var d=new i.constructor(i.type,i);cp=d,i.target.dispatchEvent(d),cp=null}else return a=Po(i),a!==null&&Z0(a),n.blockedOn=i,!1;a.shift()}return!0}function n1(n,a,i){rd(n)&&i.delete(a)}function XR(){ug=!1,gr!==null&&rd(gr)&&(gr=null),hr!==null&&rd(hr)&&(hr=null),xr!==null&&rd(xr)&&(xr=null),qi.forEach(n1),$i.forEach(n1)}function od(n,a){n.blockedOn===a&&(n.blockedOn=null,ug||(ug=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,XR)))}var ld=null;function a1(n){ld!==n&&(ld=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ld===n&&(ld=null);for(var a=0;a<n.length;a+=3){var i=n[a],d=n[a+1],v=n[a+2];if(typeof d!="function"){if(cg(d||i)===null)continue;break}var j=Po(i);j!==null&&(n.splice(a,3),a-=3,im(j,{pending:!0,data:v,method:i.method,action:d},d,v))}}))}function xl(n){function a(Z){return od(Z,n)}gr!==null&&od(gr,n),hr!==null&&od(hr,n),xr!==null&&od(xr,n),qi.forEach(a),$i.forEach(a);for(var i=0;i<br.length;i++){var d=br[i];d.blockedOn===n&&(d.blockedOn=null)}for(;0<br.length&&(i=br[0],i.blockedOn===null);)t1(i),i.blockedOn===null&&br.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(d=0;d<i.length;d+=3){var v=i[d],j=i[d+1],O=v[hn]||null;if(typeof j=="function")O||a1(i);else if(O){var B=null;if(j&&j.hasAttribute("formAction")){if(v=j,O=j[hn]||null)B=O.formAction;else if(cg(v)!==null)continue}else B=O.action;typeof B=="function"?i[d+1]=B:(i.splice(d,3),d-=3),a1(i)}}}function s1(){function n(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(O){return v=O})},focusReset:"manual",scroll:"manual"})}function a(){v!==null&&(v(),v=null),d||setTimeout(i,20)}function i(){if(!d&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,v=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){d=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),v!==null&&(v(),v=null)}}}function dg(n){this._internalRoot=n}id.prototype.render=dg.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(o(409));var i=a.current,d=va();K0(i,d,n,a,null,null)},id.prototype.unmount=dg.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;K0(n.current,2,null,n,null,null),Vu(),a[$r]=null}};function id(n){this._internalRoot=n}id.prototype.unstable_scheduleHydration=function(n){if(n){var a=Pt();n={blockedOn:null,target:n,priority:a};for(var i=0;i<br.length&&a!==0&&a<br[i].priority;i++);br.splice(i,0,n),i===0&&t1(n)}};var r1=t.version;if(r1!=="19.2.7")throw Error(o(527,r1,"19.2.7"));G.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(o(188)):(n=Object.keys(n).join(","),Error(o(268,n)));return n=g(a),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var KR={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cd.isDisabled&&cd.supportsFiber)try{Me=cd.inject(KR),Pe=cd}catch{}}return Yi.createRoot=function(n,a){if(!l(n))throw Error(o(299));var i=!1,d="",v=fy,j=py,O=my;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(v=a.onUncaughtError),a.onCaughtError!==void 0&&(j=a.onCaughtError),a.onRecoverableError!==void 0&&(O=a.onRecoverableError)),a=Y0(n,1,!1,null,null,i,d,null,v,j,O,s1),n[$r]=a.current,Gm(n),new dg(a)},Yi.hydrateRoot=function(n,a,i){if(!l(n))throw Error(o(299));var d=!1,v="",j=fy,O=py,B=my,Z=null;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(v=i.identifierPrefix),i.onUncaughtError!==void 0&&(j=i.onUncaughtError),i.onCaughtError!==void 0&&(O=i.onCaughtError),i.onRecoverableError!==void 0&&(B=i.onRecoverableError),i.formState!==void 0&&(Z=i.formState)),a=Y0(n,1,!0,a,i??null,d,v,Z,j,O,B,s1),a.context=X0(null),i=a.current,d=va(),d=bs(d),v=ar(d),v.callback=null,sr(i,v,d),i=d,a.current.lanes=i,ea(a,i),Wa(a),n[$r]=a.current,Gm(n),new id(a)},Yi.version="19.2.7",Yi}var g1;function oT(){if(g1)return mg.exports;g1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),mg.exports=rT(),mg.exports}var lT=oT();const iT=jx(lT);/**
50
+ * react-router v7.17.0
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var h1="popstate";function x1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function cT(e={}){function t(o,l){let c=l.state?.masked,{pathname:u,search:p,hash:m}=c||o.location;return Ah("",{pathname:u,search:p,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",c?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function s(o,l){return typeof l=="string"?l:Sc(l)}return dT(t,s,null,e)}function tn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function La(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function uT(){return Math.random().toString(36).substring(2,10)}function b1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ah(e,t,s=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ql(t):t,state:s,key:t&&t.key||o||uT(),mask:l}}function Sc({pathname:e="/",search:t="",hash:s=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Ql(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substring(s),e=e.substring(0,s));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function dT(e,t,s,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,u=l.history,p="POP",m=null,g=h();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function h(){return(u.state||{idx:null}).idx}function b(){p="POP";let w=h(),S=w==null?null:w-g;g=w,m&&m({action:p,location:y.location,delta:S})}function _(w,S){p="PUSH";let N=x1(w)?w:Ah(y.location,w,S);g=h()+1;let E=b1(N,g),R=y.createHref(N.mask||N);try{u.pushState(E,"",R)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;l.location.assign(R)}c&&m&&m({action:p,location:y.location,delta:1})}function k(w,S){p="REPLACE";let N=x1(w)?w:Ah(y.location,w,S);g=h();let E=b1(N,g),R=y.createHref(N.mask||N);u.replaceState(E,"",R),c&&m&&m({action:p,location:y.location,delta:0})}function C(w){return fT(l,w)}let y={get action(){return p},get location(){return e(l,u)},listen(w){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(h1,b),m=w,()=>{l.removeEventListener(h1,b),m=null}},createHref(w){return t(l,w)},createURL:C,encodeLocation(w){let S=C(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:_,replace:k,go(w){return u.go(w)}};return y}function fT(e,t,s=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),tn(o,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Sc(t);return l=l.replace(/ $/,"%20"),!s&&l.startsWith("//")&&(l=o+l),new URL(l,o)}function Zw(e,t,s="/"){return pT(e,t,s,!1)}function pT(e,t,s,o,l){let c=typeof t=="string"?Ql(t):t,u=$s(c.pathname||"/",s);if(u==null)return null;let p=mT(e),m=null,g=CT(u);for(let h=0;m==null&&h<p.length;++h)m=kT(p[h],g,o);return m}function mT(e){let t=Ww(e);return gT(t),t}function Ww(e,t=[],s=[],o="",l=!1){let c=(u,p,m=l,g)=>{let h={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(o)&&m)return;tn(h.relativePath.startsWith(o),`Absolute route path "${h.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(o.length)}let b=$a([o,h.relativePath]),_=s.concat(h);u.children&&u.children.length>0&&(tn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Ww(u.children,t,_,b,m)),!(u.path==null&&!u.index)&&t.push({path:b,score:jT(b,u.index),routesMeta:_})};return e.forEach((u,p)=>{if(u.path===""||!u.path?.includes("?"))c(u,p);else for(let m of Jw(u.path))c(u,p,!0,m)}),t}function Jw(e){let t=e.split("/");if(t.length===0)return[];let[s,...o]=t,l=s.endsWith("?"),c=s.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let u=Jw(o.join("/")),p=[];return p.push(...u.map(m=>m===""?c:[c,m].join("/"))),l&&p.push(...u),p.map(m=>e.startsWith("/")&&m===""?"/":m)}function gT(e){e.sort((t,s)=>t.score!==s.score?s.score-t.score:wT(t.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var hT=/^:[\w-]+$/,xT=3,bT=2,vT=1,_T=10,yT=-2,v1=e=>e==="*";function jT(e,t){let s=e.split("/"),o=s.length;return s.some(v1)&&(o+=yT),t&&(o+=bT),s.filter(l=>!v1(l)).reduce((l,c)=>l+(hT.test(c)?xT:c===""?vT:_T),o)}function wT(e,t){return e.length===t.length&&e.slice(0,-1).every((o,l)=>o===t[l])?e[e.length-1]-t[t.length-1]:0}function kT(e,t,s=!1){let{routesMeta:o}=e,l={},c="/",u=[];for(let p=0;p<o.length;++p){let m=o[p],g=p===o.length-1,h=c==="/"?t:t.slice(c.length)||"/",b=$d({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},h),_=m.route;if(!b&&g&&s&&!o[o.length-1].route.index&&(b=$d({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},h)),!b)return null;Object.assign(l,b.params),u.push({params:l,pathname:$a([c,b.pathname]),pathnameBase:TT($a([c,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(c=$a([c,b.pathnameBase]))}return u}function $d(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,o]=ST(e.path,e.caseSensitive,e.end),l=t.match(s);if(!l)return null;let c=l[0],u=c.replace(/(.)\/+$/,"$1"),p=l.slice(1);return{params:o.reduce((g,{paramName:h,isOptional:b},_)=>{if(h==="*"){let C=p[_]||"";u=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const k=p[_];return b&&!k?g[h]=void 0:g[h]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:u,pattern:e}}function ST(e,t=!1,s=!0){La(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,g,h)=>{if(o.push({paramName:p,isOptional:m!=null}),m){let b=h.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),o]}function CT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return La(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $s(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,o=e.charAt(s);return o&&o!=="/"?null:e.slice(s)||"/"}var NT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function ET(e,t="/"){let{pathname:s,search:o="",hash:l=""}=typeof e=="string"?Ql(e):e,c;return s?(s=ek(s),s.startsWith("/")?c=_1(s.substring(1),"/"):c=_1(s,t)):c=t,{pathname:c,search:MT(o),hash:AT(l)}}function _1(e,t){let s=Fd(t).split("/");return e.split("/").forEach(l=>{l===".."?s.length>1&&s.pop():l!=="."&&s.push(l)}),s.length>1?s.join("/"):"/"}function bg(e,t,s,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function RT(e){return e.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function wx(e){let t=RT(e);return t.map((s,o)=>o===t.length-1?s.pathname:s.pathnameBase)}function _f(e,t,s,o=!1){let l;typeof e=="string"?l=Ql(e):(l={...e},tn(!l.pathname||!l.pathname.includes("?"),bg("?","pathname","search",l)),tn(!l.pathname||!l.pathname.includes("#"),bg("#","pathname","hash",l)),tn(!l.search||!l.search.includes("#"),bg("#","search","hash",l)));let c=e===""||l.pathname==="",u=c?"/":l.pathname,p;if(u==null)p=s;else{let b=t.length-1;if(!o&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;l.pathname=_.join("/")}p=b>=0?t[b]:"/"}let m=ET(l,p),g=u&&u!=="/"&&u.endsWith("/"),h=(c||u===".")&&s.endsWith("/");return!m.pathname.endsWith("/")&&(g||h)&&(m.pathname+="/"),m}var ek=e=>e.replace(/\/\/+/g,"/"),$a=e=>ek(e.join("/")),Fd=e=>e.replace(/\/+$/,""),TT=e=>Fd(e).replace(/^\/*/,"/"),MT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,AT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,OT=class{constructor(e,t,s,o=!1){this.status=e,this.statusText=t||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function zT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function DT(e){let t=e.map(s=>s.route.path).filter(Boolean);return $a(t)||"/"}var tk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nk(e,t){let s=e;if(typeof s!="string"||!NT.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,l=!1;if(tk)try{let c=new URL(window.location.href),u=s.startsWith("//")?new URL(c.protocol+s):new URL(s),p=$s(u.pathname,t);u.origin===c.origin&&p!=null?s=p+u.search+u.hash:l=!0}catch{La(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ak=["POST","PUT","PATCH","DELETE"];new Set(ak);var PT=["GET",...ak];new Set(PT);var Zl=x.createContext(null);Zl.displayName="DataRouter";var yf=x.createContext(null);yf.displayName="DataRouterState";var sk=x.createContext(!1);function LT(){return x.useContext(sk)}var rk=x.createContext({isTransitioning:!1});rk.displayName="ViewTransition";var IT=x.createContext(new Map);IT.displayName="Fetchers";var BT=x.createContext(null);BT.displayName="Await";var wa=x.createContext(null);wa.displayName="Navigation";var Lc=x.createContext(null);Lc.displayName="Location";var Ga=x.createContext({outlet:null,matches:[],isDataRoute:!1});Ga.displayName="Route";var kx=x.createContext(null);kx.displayName="RouteError";var ok="REACT_ROUTER_ERROR",UT="REDIRECT",HT="ROUTE_ERROR_RESPONSE";function VT(e){if(e.startsWith(`${ok}:${UT}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function qT(e){if(e.startsWith(`${ok}:${HT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new OT(t.status,t.statusText,t.data)}catch{}}function $T(e,{relative:t}={}){tn(Wl(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=x.useContext(wa),{hash:l,pathname:c,search:u}=Ic(e,{relative:t}),p=c;return s!=="/"&&(p=c==="/"?s:$a([s,c])),o.createHref({pathname:p,search:u,hash:l})}function Wl(){return x.useContext(Lc)!=null}function Qn(){return tn(Wl(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Lc).location}var lk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ik(e){x.useContext(wa).static||x.useLayoutEffect(e)}function Zn(){let{isDataRoute:e}=x.useContext(Ga);return e?aM():FT()}function FT(){tn(Wl(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Zl),{basename:t,navigator:s}=x.useContext(wa),{matches:o}=x.useContext(Ga),{pathname:l}=Qn(),c=JSON.stringify(wx(o)),u=x.useRef(!1);return ik(()=>{u.current=!0}),x.useCallback((m,g={})=>{if(La(u.current,lk),!u.current)return;if(typeof m=="number"){s.go(m);return}let h=_f(m,JSON.parse(c),l,g.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:$a([t,h.pathname])),(g.replace?s.replace:s.push)(h,g.state,g)},[t,s,c,l,e])}x.createContext(null);function ck(){let{matches:e}=x.useContext(Ga);return e[e.length-1]?.params??{}}function Ic(e,{relative:t}={}){let{matches:s}=x.useContext(Ga),{pathname:o}=Qn(),l=JSON.stringify(wx(s));return x.useMemo(()=>_f(e,JSON.parse(l),o,t==="path"),[e,l,o,t])}function GT(e,t){return uk(e,t)}function uk(e,t,s){tn(Wl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(wa),{matches:l}=x.useContext(Ga),c=l[l.length-1],u=c?c.params:{},p=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;{let w=g&&g.path||"";fk(p,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let h=Qn(),b;if(t){let w=typeof t=="string"?Ql(t):t;tn(m==="/"||w.pathname?.startsWith(m),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=h;let _=b.pathname||"/",k=_;if(m!=="/"){let w=m.replace(/^\//,"").split("/");k="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let C=s&&s.state.matches.length?s.state.matches.map(w=>Object.assign(w,{route:s.manifest[w.route.id]||w.route})):Zw(e,{pathname:k});La(g||C!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),La(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=ZT(C&&C.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:$a([m,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:$a([m,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),l,s);return t&&y?x.createElement(Lc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},y):y}function YT(){let e=nM(),t=zT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:c},"ErrorBoundary")," or"," ",x.createElement("code",{style:c},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),s?x.createElement("pre",{style:l},s):null,u)}var XT=x.createElement(YT,null),dk=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const s=qT(e.digest);s&&(e=s)}let t=e!==void 0?x.createElement(Ga.Provider,{value:this.props.routeContext},x.createElement(kx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(KT,{error:e},t):t}};dk.contextType=sk;var vg=new WeakMap;function KT({children:e,error:t}){let{basename:s}=x.useContext(wa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=VT(t.digest);if(o){let l=vg.get(t);if(l)throw l;let c=nk(o.location,s);if(tk&&!vg.get(t))if(c.isExternal||o.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw vg.set(t,u),u}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function QT({routeContext:e,match:t,children:s}){let o=x.useContext(Zl);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Ga.Provider,{value:e},s)}function ZT(e,t=[],s){let o=s?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(t.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o?.errors;if(c!=null){let h=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);tn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,h+1))}let u=!1,p=-1;if(s&&o){u=o.renderFallback;for(let h=0;h<l.length;h++){let b=l[h];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=h),b.route.id){let{loaderData:_,errors:k}=o,C=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||C){s.isStatic&&(u=!0),p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}}let m=s?.onError,g=o&&m?(h,b)=>{m(h,{location:o.location,params:o.matches?.[0]?.params??{},pattern:DT(o.matches),errorInfo:b})}:void 0;return l.reduceRight((h,b,_)=>{let k,C=!1,y=null,w=null;o&&(k=c&&b.route.id?c[b.route.id]:void 0,y=b.route.errorElement||XT,u&&(p<0&&_===0?(fk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,w=null):p===_&&(C=!0,w=b.route.hydrateFallbackElement||null)));let S=t.concat(l.slice(0,_+1)),N=()=>{let E;return k?E=y:C?E=w:b.route.Component?E=x.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=h,x.createElement(QT,{match:b,routeContext:{outlet:h,matches:S,isDataRoute:o!=null},children:E})};return o&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?x.createElement(dk,{location:o.location,revalidation:o.revalidation,component:y,error:k,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:g}):N()},null)}function Sx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function WT(e){let t=x.useContext(Zl);return tn(t,Sx(e)),t}function JT(e){let t=x.useContext(yf);return tn(t,Sx(e)),t}function eM(e){let t=x.useContext(Ga);return tn(t,Sx(e)),t}function Cx(e){let t=eM(e),s=t.matches[t.matches.length-1];return tn(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function tM(){return Cx("useRouteId")}function nM(){let e=x.useContext(kx),t=JT("useRouteError"),s=Cx("useRouteError");return e!==void 0?e:t.errors?.[s]}function aM(){let{router:e}=WT("useNavigate"),t=Cx("useNavigate"),s=x.useRef(!1);return ik(()=>{s.current=!0}),x.useCallback(async(l,c={})=>{La(s.current,lk),s.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...c}))},[e,t])}var y1={};function fk(e,t,s){!t&&!y1[e]&&(y1[e]=!0,La(!1,s))}x.memo(sM);function sM({routes:e,manifest:t,future:s,state:o,isStatic:l,onError:c}){return uk(e,void 0,{manifest:t,state:o,isStatic:l,onError:c})}function rM({to:e,replace:t,state:s,relative:o}){tn(Wl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(wa);La(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:c}=x.useContext(Ga),{pathname:u}=Qn(),p=Zn(),m=_f(e,wx(c),u,o==="path"),g=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(g),{replace:t,state:s,relative:o})},[p,g,o,t,s]),null}function Ft(e){tn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function oM({basename:e="/",children:t=null,location:s,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:u}){tn(!Wl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:p,navigator:l,static:c,useTransitions:u,future:{}}),[p,l,c,u]);typeof s=="string"&&(s=Ql(s));let{pathname:g="/",search:h="",hash:b="",state:_=null,key:k="default",mask:C}=s,y=x.useMemo(()=>{let w=$s(g,p);return w==null?null:{location:{pathname:w,search:h,hash:b,state:_,key:k,mask:C},navigationType:o}},[p,g,h,b,_,k,o,C]);return La(y!=null,`<Router basename="${p}"> is not able to match the URL "${g}${h}${b}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:x.createElement(wa.Provider,{value:m},x.createElement(Lc.Provider,{children:t,value:y}))}function pk({children:e,location:t}){return GT(Oh(e),t)}function Oh(e,t=[]){let s=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...t,l];if(o.type===x.Fragment){s.push.apply(s,Oh(o.props.children,c));return}tn(o.type===Ft,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),tn(!o.props.index||!o.props.children,"An index route cannot have child routes.");let u={id:o.props.id||c.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(u.children=Oh(o.props.children,c)),s.push(u)}),s}var Dd="get",Pd="application/x-www-form-urlencoded";function jf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function lM(e){return jf(e)&&e.tagName.toLowerCase()==="button"}function iM(e){return jf(e)&&e.tagName.toLowerCase()==="form"}function cM(e){return jf(e)&&e.tagName.toLowerCase()==="input"}function uM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function dM(e,t){return e.button===0&&(!t||t==="_self")&&!uM(e)}function zh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let o=e[s];return t.concat(Array.isArray(o)?o.map(l=>[s,l]):[[s,o]])},[]))}function fM(e,t){let s=zh(e);return t&&t.forEach((o,l)=>{s.has(l)||t.getAll(l).forEach(c=>{s.append(l,c)})}),s}var ud=null;function pM(){if(ud===null)try{new FormData(document.createElement("form"),0),ud=!1}catch{ud=!0}return ud}var mM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function _g(e){return e!=null&&!mM.has(e)?(La(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Pd}"`),null):e}function gM(e,t){let s,o,l,c,u;if(iM(e)){let p=e.getAttribute("action");o=p?$s(p,t):null,s=e.getAttribute("method")||Dd,l=_g(e.getAttribute("enctype"))||Pd,c=new FormData(e)}else if(lM(e)||cM(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||p.getAttribute("action");if(o=m?$s(m,t):null,s=e.getAttribute("formmethod")||p.getAttribute("method")||Dd,l=_g(e.getAttribute("formenctype"))||_g(p.getAttribute("enctype"))||Pd,c=new FormData(p,e),!pM()){let{name:g,type:h,value:b}=e;if(h==="image"){let _=g?`${g}.`:"";c.append(`${_}x`,"0"),c.append(`${_}y`,"0")}else g&&c.append(g,b)}}else{if(jf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Dd,o=null,l=Pd,u=e}return c&&l==="text/plain"&&(u=c,c=void 0),{action:o,method:s.toLowerCase(),encType:l,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function mk(e,t,s,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:t&&$s(l.pathname,t)==="/"?l.pathname=`${Fd(t)}/_root.${o}`:l.pathname=`${Fd(l.pathname)}.${o}`,l}async function hM(e,t){if(e.id in t)return t[e.id];try{let s=await import(e.module);return t[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function xM(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function bM(e,t,s){let o=await Promise.all(e.map(async l=>{let c=t.routes[l.route.id];if(c){let u=await hM(c,s);return u.links?u.links():[]}return[]}));return jM(o.flat(1).filter(xM).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function j1(e,t,s,o,l,c){let u=(m,g)=>s[g]?m.route.id!==s[g].route.id:!0,p=(m,g)=>s[g].pathname!==m.pathname||s[g].route.path?.endsWith("*")&&s[g].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,g)=>u(m,g)||p(m,g)):c==="data"?t.filter((m,g)=>{let h=o.routes[m.route.id];if(!h||!h.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function vM(e,t,{includeHydrateFallback:s}={}){return _M(e.map(o=>{let l=t.routes[o.route.id];if(!l)return[];let c=[l.module];return l.clientActionModule&&(c=c.concat(l.clientActionModule)),l.clientLoaderModule&&(c=c.concat(l.clientLoaderModule)),s&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function _M(e){return[...new Set(e)]}function yM(e){let t={},s=Object.keys(e).sort();for(let o of s)t[o]=e[o];return t}function jM(e,t){let s=new Set;return new Set(t),e.reduce((o,l)=>{let c=JSON.stringify(yM(l));return s.has(c)||(s.add(c),o.push({key:c,link:l})),o},[])}function Ex(){let e=x.useContext(Zl);return Nx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function wM(){let e=x.useContext(yf);return Nx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Rx=x.createContext(void 0);Rx.displayName="FrameworkContext";function Tx(){let e=x.useContext(Rx);return Nx(e,"You must render this element inside a <HydratedRouter> element"),e}function kM(e,t){let s=x.useContext(Rx),[o,l]=x.useState(!1),[c,u]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:h,onTouchStart:b}=t,_=x.useRef(null);x.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let y=S=>{S.forEach(N=>{u(N.isIntersecting)})},w=new IntersectionObserver(y,{threshold:.5});return _.current&&w.observe(_.current),()=>{w.disconnect()}}},[e]),x.useEffect(()=>{if(o){let y=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(y)}}},[o]);let k=()=>{l(!0)},C=()=>{l(!1),u(!1)};return s?e!=="intent"?[c,_,{}]:[c,_,{onFocus:Xi(p,k),onBlur:Xi(m,C),onMouseEnter:Xi(g,k),onMouseLeave:Xi(h,C),onTouchStart:Xi(b,k)}]:[!1,_,{}]}function Xi(e,t){return s=>{e&&e(s),s.defaultPrevented||t(s)}}function SM({page:e,...t}){let s=LT(),{router:o}=Ex(),l=x.useMemo(()=>Zw(o.routes,e,o.basename),[o.routes,e,o.basename]);return l?s?x.createElement(NM,{page:e,matches:l,...t}):x.createElement(EM,{page:e,matches:l,...t}):null}function CM(e){let{manifest:t,routeModules:s}=Tx(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return bM(e,t,s).then(u=>{c||l(u)}),()=>{c=!0}},[e,t,s]),o}function NM({page:e,matches:t,...s}){let o=Qn(),{future:l}=Tx(),{basename:c}=Ex(),u=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let p=mk(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,g=[];for(let h of t)typeof h.route.shouldRevalidate=="function"?m=!0:g.push(h.route.id);return m&&g.length>0&&p.searchParams.set("_routes",g.join(",")),[p.pathname+p.search]},[c,l.v8_trailingSlashAwareDataRequests,e,o,t]);return x.createElement(x.Fragment,null,u.map(p=>x.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...s})))}function EM({page:e,matches:t,...s}){let o=Qn(),{future:l,manifest:c,routeModules:u}=Tx(),{basename:p}=Ex(),{loaderData:m,matches:g}=wM(),h=x.useMemo(()=>j1(e,t,g,c,o,"data"),[e,t,g,c,o]),b=x.useMemo(()=>j1(e,t,g,c,o,"assets"),[e,t,g,c,o]),_=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let y=new Set,w=!1;if(t.forEach(N=>{let E=c.routes[N.route.id];!E||!E.hasLoader||(!h.some(R=>R.route.id===N.route.id)&&N.route.id in m&&u[N.route.id]?.shouldRevalidate||E.hasClientLoader?w=!0:y.add(N.route.id))}),y.size===0)return[];let S=mk(e,p,l.v8_trailingSlashAwareDataRequests,"data");return w&&y.size>0&&S.searchParams.set("_routes",t.filter(N=>y.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[p,l.v8_trailingSlashAwareDataRequests,m,o,c,h,t,e,u]),k=x.useMemo(()=>vM(b,c),[b,c]),C=CM(b);return x.createElement(x.Fragment,null,_.map(y=>x.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...s})),k.map(y=>x.createElement("link",{key:y,rel:"modulepreload",href:y,...s})),C.map(({key:y,link:w})=>x.createElement("link",{key:y,nonce:s.nonce,...w,crossOrigin:w.crossOrigin??s.crossOrigin})))}function RM(...e){return t=>{e.forEach(s=>{typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var TM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{TM&&(window.__reactRouterVersion="7.17.0")}catch{}function MM({basename:e,children:t,useTransitions:s,window:o}){let l=x.useRef();l.current==null&&(l.current=cT({window:o,v5Compat:!0}));let c=l.current,[u,p]=x.useState({action:c.action,location:c.location}),m=x.useCallback(g=>{s===!1?p(g):x.startTransition(()=>p(g))},[s]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(oM,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:s})}var gk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Mx=x.forwardRef(function({onClick:t,discover:s="render",prefetch:o="none",relative:l,reloadDocument:c,replace:u,mask:p,state:m,target:g,to:h,preventScrollReset:b,viewTransition:_,defaultShouldRevalidate:k,...C},y){let{basename:w,navigator:S,useTransitions:N}=x.useContext(wa),E=typeof h=="string"&&gk.test(h),R=nk(h,w);h=R.to;let M=$T(h,{relative:l}),T=Qn(),A=null;if(p){let $=_f(p,[],T.mask?T.mask.pathname:"/",!0);w!=="/"&&($.pathname=$.pathname==="/"?w:$a([w,$.pathname])),A=S.createHref($)}let[z,I,D]=kM(o,C),P=zM(h,{replace:u,mask:p,state:m,target:g,preventScrollReset:b,relative:l,viewTransition:_,defaultShouldRevalidate:k,useTransitions:N});function L($){t&&t($),$.defaultPrevented||P($)}let U=!(R.isExternal||c),q=x.createElement("a",{...C,...D,href:(U?A:void 0)||R.absoluteURL||M,onClick:U?L:t,ref:RM(y,I),target:g,"data-discover":!E&&s==="render"?"true":void 0});return z&&!E?x.createElement(x.Fragment,null,q,x.createElement(SM,{page:M})):q});Mx.displayName="Link";var hk=x.forwardRef(function({"aria-current":t="page",caseSensitive:s=!1,className:o="",end:l=!1,style:c,to:u,viewTransition:p,children:m,...g},h){let b=Ic(u,{relative:g.relative}),_=Qn(),k=x.useContext(yf),{navigator:C,basename:y}=x.useContext(wa),w=k!=null&&BM(b)&&p===!0,S=C.encodeLocation?C.encodeLocation(b).pathname:b.pathname,N=_.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(N=N.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&y&&(E=$s(E,y)||E);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let M=N===S||!l&&N.startsWith(S)&&N.charAt(R)==="/",T=E!=null&&(E===S||!l&&E.startsWith(S)&&E.charAt(S.length)==="/"),A={isActive:M,isPending:T,isTransitioning:w},z=M?t:void 0,I;typeof o=="function"?I=o(A):I=[o,M?"active":null,T?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let D=typeof c=="function"?c(A):c;return x.createElement(Mx,{...g,"aria-current":z,className:I,ref:h,style:D,to:u,viewTransition:p},typeof m=="function"?m(A):m)});hk.displayName="NavLink";var AM=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:s,reloadDocument:o,replace:l,state:c,method:u=Dd,action:p,onSubmit:m,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_,...k},C)=>{let{useTransitions:y}=x.useContext(wa),w=LM(),S=IM(p,{relative:g}),N=u.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&gk.test(p),R=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let T=M.nativeEvent.submitter,A=T?.getAttribute("formmethod")||u,z=()=>w(T||M.currentTarget,{fetcherKey:t,method:A,navigate:s,replace:l,state:c,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_});y&&s!==!1?x.startTransition(()=>z()):z()};return x.createElement("form",{ref:C,method:N,action:S,onSubmit:o?m:R,...k,"data-discover":!E&&e==="render"?"true":void 0})});AM.displayName="Form";function OM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xk(e){let t=x.useContext(Zl);return tn(t,OM(e)),t}function zM(e,{target:t,replace:s,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m,useTransitions:g}={}){let h=Zn(),b=Qn(),_=Ic(e,{relative:u});return x.useCallback(k=>{if(dM(k,t)){k.preventDefault();let C=s!==void 0?s:Sc(b)===Sc(_),y=()=>h(e,{replace:C,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m});g?x.startTransition(()=>y()):y()}},[b,h,_,s,o,l,t,e,c,u,p,m,g])}function wf(e){La(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(zh(e)),s=x.useRef(!1),o=Qn(),l=x.useMemo(()=>fM(o.search,s.current?null:t.current),[o.search]),c=Zn(),u=x.useCallback((p,m)=>{const g=zh(typeof p=="function"?p(new URLSearchParams(l)):p);s.current=!0,c("?"+g,m)},[c,l]);return[l,u]}var DM=0,PM=()=>`__${String(++DM)}__`;function LM(){let{router:e}=xk("useSubmit"),{basename:t}=x.useContext(wa),s=tM(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,u={})=>{let{action:p,method:m,encType:g,formData:h,body:b}=gM(c,t);if(u.navigate===!1){let _=u.fetcherKey||PM();await o(_,s,u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await l(u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:h,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:s,flushSync:u.flushSync,viewTransition:u.viewTransition})},[o,l,t,s])}function IM(e,{relative:t}={}){let{basename:s}=x.useContext(wa),o=x.useContext(Ga);tn(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Ic(e||".",{relative:t})},u=Qn();if(e==null){c.search=u.search;let p=new URLSearchParams(c.search),m=p.getAll("index");if(m.some(h=>h==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let h=p.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:$a([s,c.pathname])),Sc(c)}function BM(e,{relative:t}={}){let s=x.useContext(rk);tn(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=xk("useViewTransitionState"),l=Ic(e,{relative:t});if(!s.isTransitioning)return!1;let c=$s(s.currentLocation.pathname,o)||s.currentLocation.pathname,u=$s(s.nextLocation.pathname,o)||s.nextLocation.pathname;return $d(l.pathname,u)!=null||$d(l.pathname,c)!=null}var is=Qw();/**
61
+ * @license lucide-react v0.469.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const UM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),bk=(...e)=>e.filter((t,s,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===s).join(" ").trim();/**
66
+ * @license lucide-react v0.469.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */var HM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
71
+ * @license lucide-react v0.469.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const VM=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:u,...p},m)=>x.createElement("svg",{ref:m,...HM,width:t,height:t,stroke:e,strokeWidth:o?Number(s)*24/Number(t):s,className:bk("lucide",l),...p},[...u.map(([g,h])=>x.createElement(g,h)),...Array.isArray(c)?c:[c]]));/**
76
+ * @license lucide-react v0.469.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const ke=(e,t)=>{const s=x.forwardRef(({className:o,...l},c)=>x.createElement(VM,{ref:c,iconNode:t,className:bk(`lucide-${UM(e)}`,o),...l}));return s.displayName=`${e}`,s};/**
81
+ * @license lucide-react v0.469.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */const vk=ke("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
86
+ * @license lucide-react v0.469.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const _k=ke("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/**
91
+ * @license lucide-react v0.469.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const qM=ke("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
+ * @license lucide-react v0.469.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const yk=ke("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
101
+ * @license lucide-react v0.469.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const jk=ke("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
106
+ * @license lucide-react v0.469.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const $M=ke("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
111
+ * @license lucide-react v0.469.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const FM=ke("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
116
+ * @license lucide-react v0.469.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const GM=ke("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
121
+ * @license lucide-react v0.469.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const gn=ke("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
126
+ * @license lucide-react v0.469.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const YM=ke("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
131
+ * @license lucide-react v0.469.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const XM=ke("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
136
+ * @license lucide-react v0.469.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const Gd=ke("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
141
+ * @license lucide-react v0.469.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const bo=ke("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
146
+ * @license lucide-react v0.469.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Qs=ke("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
151
+ * @license lucide-react v0.469.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const Bc=ke("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
156
+ * @license lucide-react v0.469.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const wk=ke("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
161
+ * @license lucide-react v0.469.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const KM=ke("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
166
+ * @license lucide-react v0.469.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const Ax=ke("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
171
+ * @license lucide-react v0.469.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const QM=ke("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
176
+ * @license lucide-react v0.469.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const ZM=ke("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
181
+ * @license lucide-react v0.469.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const WM=ke("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
186
+ * @license lucide-react v0.469.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const JM=ke("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
191
+ * @license lucide-react v0.469.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const eA=ke("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
196
+ * @license lucide-react v0.469.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const Yd=ke("Copy",[["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"}]]);/**
201
+ * @license lucide-react v0.469.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const tA=ke("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
206
+ * @license lucide-react v0.469.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const nA=ke("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
211
+ * @license lucide-react v0.469.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const Ox=ke("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
216
+ * @license lucide-react v0.469.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const Fs=ke("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
221
+ * @license lucide-react v0.469.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const kk=ke("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
226
+ * @license lucide-react v0.469.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const aA=ke("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
231
+ * @license lucide-react v0.469.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const sA=ke("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
236
+ * @license lucide-react v0.469.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const kf=ke("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
241
+ * @license lucide-react v0.469.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const rA=ke("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
246
+ * @license lucide-react v0.469.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const Xd=ke("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
251
+ * @license lucide-react v0.469.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const oA=ke("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
256
+ * @license lucide-react v0.469.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const lA=ke("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
261
+ * @license lucide-react v0.469.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const iA=ke("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
266
+ * @license lucide-react v0.469.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const cA=ke("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
271
+ * @license lucide-react v0.469.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const uA=ke("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
276
+ * @license lucide-react v0.469.0 - ISC
277
+ *
278
+ * This source code is licensed under the ISC license.
279
+ * See the LICENSE file in the root directory of this source tree.
280
+ */const Sk=ke("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
281
+ * @license lucide-react v0.469.0 - ISC
282
+ *
283
+ * This source code is licensed under the ISC license.
284
+ * See the LICENSE file in the root directory of this source tree.
285
+ */const dA=ke("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
286
+ * @license lucide-react v0.469.0 - ISC
287
+ *
288
+ * This source code is licensed under the ISC license.
289
+ * See the LICENSE file in the root directory of this source tree.
290
+ */const Ck=ke("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
291
+ * @license lucide-react v0.469.0 - ISC
292
+ *
293
+ * This source code is licensed under the ISC license.
294
+ * See the LICENSE file in the root directory of this source tree.
295
+ */const zx=ke("FolderOpen",[["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"}]]);/**
296
+ * @license lucide-react v0.469.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */const Nk=ke("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
301
+ * @license lucide-react v0.469.0 - ISC
302
+ *
303
+ * This source code is licensed under the ISC license.
304
+ * See the LICENSE file in the root directory of this source tree.
305
+ */const fA=ke("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
306
+ * @license lucide-react v0.469.0 - ISC
307
+ *
308
+ * This source code is licensed under the ISC license.
309
+ * See the LICENSE file in the root directory of this source tree.
310
+ */const pA=ke("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/**
311
+ * @license lucide-react v0.469.0 - ISC
312
+ *
313
+ * This source code is licensed under the ISC license.
314
+ * See the LICENSE file in the root directory of this source tree.
315
+ */const Sf=ke("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
316
+ * @license lucide-react v0.469.0 - ISC
317
+ *
318
+ * This source code is licensed under the ISC license.
319
+ * See the LICENSE file in the root directory of this source tree.
320
+ */const mA=ke("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
321
+ * @license lucide-react v0.469.0 - ISC
322
+ *
323
+ * This source code is licensed under the ISC license.
324
+ * See the LICENSE file in the root directory of this source tree.
325
+ */const Dx=ke("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
326
+ * @license lucide-react v0.469.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const gA=ke("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/**
331
+ * @license lucide-react v0.469.0 - ISC
332
+ *
333
+ * This source code is licensed under the ISC license.
334
+ * See the LICENSE file in the root directory of this source tree.
335
+ */const hA=ke("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
336
+ * @license lucide-react v0.469.0 - ISC
337
+ *
338
+ * This source code is licensed under the ISC license.
339
+ * See the LICENSE file in the root directory of this source tree.
340
+ */const Dl=ke("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
341
+ * @license lucide-react v0.469.0 - ISC
342
+ *
343
+ * This source code is licensed under the ISC license.
344
+ * See the LICENSE file in the root directory of this source tree.
345
+ */const xA=ke("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
346
+ * @license lucide-react v0.469.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const bA=ke("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
351
+ * @license lucide-react v0.469.0 - ISC
352
+ *
353
+ * This source code is licensed under the ISC license.
354
+ * See the LICENSE file in the root directory of this source tree.
355
+ */const vA=ke("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
356
+ * @license lucide-react v0.469.0 - ISC
357
+ *
358
+ * This source code is licensed under the ISC license.
359
+ * See the LICENSE file in the root directory of this source tree.
360
+ */const Dh=ke("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
361
+ * @license lucide-react v0.469.0 - ISC
362
+ *
363
+ * This source code is licensed under the ISC license.
364
+ * See the LICENSE file in the root directory of this source tree.
365
+ */const _A=ke("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
366
+ * @license lucide-react v0.469.0 - ISC
367
+ *
368
+ * This source code is licensed under the ISC license.
369
+ * See the LICENSE file in the root directory of this source tree.
370
+ */const yA=ke("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
371
+ * @license lucide-react v0.469.0 - ISC
372
+ *
373
+ * This source code is licensed under the ISC license.
374
+ * See the LICENSE file in the root directory of this source tree.
375
+ */const jA=ke("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
376
+ * @license lucide-react v0.469.0 - ISC
377
+ *
378
+ * This source code is licensed under the ISC license.
379
+ * See the LICENSE file in the root directory of this source tree.
380
+ */const wA=ke("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
381
+ * @license lucide-react v0.469.0 - ISC
382
+ *
383
+ * This source code is licensed under the ISC license.
384
+ * See the LICENSE file in the root directory of this source tree.
385
+ */const kA=ke("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
386
+ * @license lucide-react v0.469.0 - ISC
387
+ *
388
+ * This source code is licensed under the ISC license.
389
+ * See the LICENSE file in the root directory of this source tree.
390
+ */const Cf=ke("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
391
+ * @license lucide-react v0.469.0 - ISC
392
+ *
393
+ * This source code is licensed under the ISC license.
394
+ * See the LICENSE file in the root directory of this source tree.
395
+ */const Ek=ke("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
396
+ * @license lucide-react v0.469.0 - ISC
397
+ *
398
+ * This source code is licensed under the ISC license.
399
+ * See the LICENSE file in the root directory of this source tree.
400
+ */const Px=ke("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
401
+ * @license lucide-react v0.469.0 - ISC
402
+ *
403
+ * This source code is licensed under the ISC license.
404
+ * See the LICENSE file in the root directory of this source tree.
405
+ */const Kd=ke("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
406
+ * @license lucide-react v0.469.0 - ISC
407
+ *
408
+ * This source code is licensed under the ISC license.
409
+ * See the LICENSE file in the root directory of this source tree.
410
+ */const Rk=ke("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
411
+ * @license lucide-react v0.469.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const Tk=ke("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
416
+ * @license lucide-react v0.469.0 - ISC
417
+ *
418
+ * This source code is licensed under the ISC license.
419
+ * See the LICENSE file in the root directory of this source tree.
420
+ */const SA=ke("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
421
+ * @license lucide-react v0.469.0 - ISC
422
+ *
423
+ * This source code is licensed under the ISC license.
424
+ * See the LICENSE file in the root directory of this source tree.
425
+ */const CA=ke("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
426
+ * @license lucide-react v0.469.0 - ISC
427
+ *
428
+ * This source code is licensed under the ISC license.
429
+ * See the LICENSE file in the root directory of this source tree.
430
+ */const NA=ke("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
431
+ * @license lucide-react v0.469.0 - ISC
432
+ *
433
+ * This source code is licensed under the ISC license.
434
+ * See the LICENSE file in the root directory of this source tree.
435
+ */const Mk=ke("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
436
+ * @license lucide-react v0.469.0 - ISC
437
+ *
438
+ * This source code is licensed under the ISC license.
439
+ * See the LICENSE file in the root directory of this source tree.
440
+ */const EA=ke("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
441
+ * @license lucide-react v0.469.0 - ISC
442
+ *
443
+ * This source code is licensed under the ISC license.
444
+ * See the LICENSE file in the root directory of this source tree.
445
+ */const Eo=ke("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
446
+ * @license lucide-react v0.469.0 - ISC
447
+ *
448
+ * This source code is licensed under the ISC license.
449
+ * See the LICENSE file in the root directory of this source tree.
450
+ */const Lx=ke("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
451
+ * @license lucide-react v0.469.0 - ISC
452
+ *
453
+ * This source code is licensed under the ISC license.
454
+ * See the LICENSE file in the root directory of this source tree.
455
+ */const RA=ke("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
456
+ * @license lucide-react v0.469.0 - ISC
457
+ *
458
+ * This source code is licensed under the ISC license.
459
+ * See the LICENSE file in the root directory of this source tree.
460
+ */const sn=ke("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
461
+ * @license lucide-react v0.469.0 - ISC
462
+ *
463
+ * This source code is licensed under the ISC license.
464
+ * See the LICENSE file in the root directory of this source tree.
465
+ */const Ph=ke("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
466
+ * @license lucide-react v0.469.0 - ISC
467
+ *
468
+ * This source code is licensed under the ISC license.
469
+ * See the LICENSE file in the root directory of this source tree.
470
+ */const TA=ke("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
471
+ * @license lucide-react v0.469.0 - ISC
472
+ *
473
+ * This source code is licensed under the ISC license.
474
+ * See the LICENSE file in the root directory of this source tree.
475
+ */const cs=ke("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
476
+ * @license lucide-react v0.469.0 - ISC
477
+ *
478
+ * This source code is licensed under the ISC license.
479
+ * See the LICENSE file in the root directory of this source tree.
480
+ */const Ix=ke("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
481
+ * @license lucide-react v0.469.0 - ISC
482
+ *
483
+ * This source code is licensed under the ISC license.
484
+ * See the LICENSE file in the root directory of this source tree.
485
+ */const Nf=ke("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
486
+ * @license lucide-react v0.469.0 - ISC
487
+ *
488
+ * This source code is licensed under the ISC license.
489
+ * See the LICENSE file in the root directory of this source tree.
490
+ */const Qd=ke("ScrollText",[["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"}]]);/**
491
+ * @license lucide-react v0.469.0 - ISC
492
+ *
493
+ * This source code is licensed under the ISC license.
494
+ * See the LICENSE file in the root directory of this source tree.
495
+ */const Ld=ke("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
496
+ * @license lucide-react v0.469.0 - ISC
497
+ *
498
+ * This source code is licensed under the ISC license.
499
+ * See the LICENSE file in the root directory of this source tree.
500
+ */const Ya=ke("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
501
+ * @license lucide-react v0.469.0 - ISC
502
+ *
503
+ * This source code is licensed under the ISC license.
504
+ * See the LICENSE file in the root directory of this source tree.
505
+ */const Ak=ke("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
506
+ * @license lucide-react v0.469.0 - ISC
507
+ *
508
+ * This source code is licensed under the ISC license.
509
+ * See the LICENSE file in the root directory of this source tree.
510
+ */const MA=ke("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
511
+ * @license lucide-react v0.469.0 - ISC
512
+ *
513
+ * This source code is licensed under the ISC license.
514
+ * See the LICENSE file in the root directory of this source tree.
515
+ */const Zd=ke("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
516
+ * @license lucide-react v0.469.0 - ISC
517
+ *
518
+ * This source code is licensed under the ISC license.
519
+ * See the LICENSE file in the root directory of this source tree.
520
+ */const AA=ke("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
521
+ * @license lucide-react v0.469.0 - ISC
522
+ *
523
+ * This source code is licensed under the ISC license.
524
+ * See the LICENSE file in the root directory of this source tree.
525
+ */const fs=ke("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
526
+ * @license lucide-react v0.469.0 - ISC
527
+ *
528
+ * This source code is licensed under the ISC license.
529
+ * See the LICENSE file in the root directory of this source tree.
530
+ */const OA=ke("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
531
+ * @license lucide-react v0.469.0 - ISC
532
+ *
533
+ * This source code is licensed under the ISC license.
534
+ * See the LICENSE file in the root directory of this source tree.
535
+ */const Ok=ke("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
536
+ * @license lucide-react v0.469.0 - ISC
537
+ *
538
+ * This source code is licensed under the ISC license.
539
+ * See the LICENSE file in the root directory of this source tree.
540
+ */const zA=ke("Sun",[["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"}]]);/**
541
+ * @license lucide-react v0.469.0 - ISC
542
+ *
543
+ * This source code is licensed under the ISC license.
544
+ * See the LICENSE file in the root directory of this source tree.
545
+ */const Ar=ke("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
546
+ * @license lucide-react v0.469.0 - ISC
547
+ *
548
+ * This source code is licensed under the ISC license.
549
+ * See the LICENSE file in the root directory of this source tree.
550
+ */const DA=ke("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
551
+ * @license lucide-react v0.469.0 - ISC
552
+ *
553
+ * This source code is licensed under the ISC license.
554
+ * See the LICENSE file in the root directory of this source tree.
555
+ */const ua=ke("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
556
+ * @license lucide-react v0.469.0 - ISC
557
+ *
558
+ * This source code is licensed under the ISC license.
559
+ * See the LICENSE file in the root directory of this source tree.
560
+ */const zk=ke("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
561
+ * @license lucide-react v0.469.0 - ISC
562
+ *
563
+ * This source code is licensed under the ISC license.
564
+ * See the LICENSE file in the root directory of this source tree.
565
+ */const PA=ke("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
566
+ * @license lucide-react v0.469.0 - ISC
567
+ *
568
+ * This source code is licensed under the ISC license.
569
+ * See the LICENSE file in the root directory of this source tree.
570
+ */const Bx=ke("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
571
+ * @license lucide-react v0.469.0 - ISC
572
+ *
573
+ * This source code is licensed under the ISC license.
574
+ * See the LICENSE file in the root directory of this source tree.
575
+ */const LA=ke("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
576
+ * @license lucide-react v0.469.0 - ISC
577
+ *
578
+ * This source code is licensed under the ISC license.
579
+ * See the LICENSE file in the root directory of this source tree.
580
+ */const IA=ke("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
581
+ * @license lucide-react v0.469.0 - ISC
582
+ *
583
+ * This source code is licensed under the ISC license.
584
+ * See the LICENSE file in the root directory of this source tree.
585
+ */const Jl=ke("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
586
+ * @license lucide-react v0.469.0 - ISC
587
+ *
588
+ * This source code is licensed under the ISC license.
589
+ * See the LICENSE file in the root directory of this source tree.
590
+ */const ps=ke("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
591
+ * @license lucide-react v0.469.0 - ISC
592
+ *
593
+ * This source code is licensed under the ISC license.
594
+ * See the LICENSE file in the root directory of this source tree.
595
+ */const Pl=ke("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Ef={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Cn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},Ux=["total","automatico","permiso"],w1=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],BA={icon:{light:"/logo/logo_only_white.webp",dark:"/logo/logo_only_dark.webp"},full:{light:"/logo/logo_white.webp",dark:"/logo/logo_dark.webp"},vertical:{light:"/logo/logo_vertical_white.webp",dark:"/logo/logo_vertical_dark.webp"}};function UA(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Cn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const Dk=x.createContext(null);function HA({children:e}){const[t,s]=x.useState(UA);x.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark");try{localStorage.setItem(Cn.theme,t)}catch{}},[t]);const o=x.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),l=x.useMemo(()=>({theme:t,toggle:o,set:s}),[t,o]);return r.jsx(Dk.Provider,{value:l,children:e})}function Hx(){const e=x.useContext(Dk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const VA=1367/458,qA=735/1016;function $A({size:e=32,title:t="APX",variant:s="icon"}){const{theme:o}=Hx(),l=BA[s][o];if(s==="full"){const c=e,u=Math.round(e*VA);return r.jsx("img",{src:l,alt:t,width:u,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,u=Math.round(e/qA);return r.jsx("img",{src:l,alt:t,width:c,height:u,className:"block object-contain",draggable:!1})}return r.jsx("img",{src:l,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function Pk(e){var t,s,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(s=Pk(e[t]))&&(o&&(o+=" "),o+=s)}else for(s in e)e[s]&&(o&&(o+=" "),o+=s);return o}function Cc(){for(var e,t,s=0,o="",l=arguments.length;s<l;s++)(e=arguments[s])&&(t=Pk(e))&&(o&&(o+=" "),o+=t);return o}const Vx="-",FA=e=>{const t=YA(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{const p=u.split(Vx);return p[0]===""&&p.length!==1&&p.shift(),Lk(p,t)||GA(u)},getConflictingClassGroupIds:(u,p)=>{const m=s[u]||[];return p&&o[u]?[...m,...o[u]]:m}}},Lk=(e,t)=>{if(e.length===0)return t.classGroupId;const s=e[0],o=t.nextPart.get(s),l=o?Lk(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;const c=e.join(Vx);return t.validators.find(({validator:u})=>u(c))?.classGroupId},k1=/^\[(.+)\]$/,GA=e=>{if(k1.test(e)){const t=k1.exec(e)[1],s=t?.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},YA=e=>{const{theme:t,prefix:s}=e,o={nextPart:new Map,validators:[]};return KA(Object.entries(e.classGroups),s).forEach(([c,u])=>{Lh(u,o,c,t)}),o},Lh=(e,t,s,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?t:S1(t,l);c.classGroupId=s;return}if(typeof l=="function"){if(XA(l)){Lh(l(o),t,s,o);return}t.validators.push({validator:l,classGroupId:s});return}Object.entries(l).forEach(([c,u])=>{Lh(u,S1(t,c),s,o)})})},S1=(e,t)=>{let s=e;return t.split(Vx).forEach(o=>{s.nextPart.has(o)||s.nextPart.set(o,{nextPart:new Map,validators:[]}),s=s.nextPart.get(o)}),s},XA=e=>e.isThemeGetter,KA=(e,t)=>t?e.map(([s,o])=>{const l=o.map(c=>typeof c=="string"?t+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([u,p])=>[t+u,p])):c);return[s,l]}):e,QA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,o=new Map;const l=(c,u)=>{s.set(c,u),t++,t>e&&(t=0,o=s,s=new Map)};return{get(c){let u=s.get(c);if(u!==void 0)return u;if((u=o.get(c))!==void 0)return l(c,u),u},set(c,u){s.has(c)?s.set(c,u):l(c,u)}}},Ik="!",ZA=e=>{const{separator:t,experimentalParseClassName:s}=e,o=t.length===1,l=t[0],c=t.length,u=p=>{const m=[];let g=0,h=0,b;for(let w=0;w<p.length;w++){let S=p[w];if(g===0){if(S===l&&(o||p.slice(w,w+c)===t)){m.push(p.slice(h,w)),h=w+c;continue}if(S==="/"){b=w;continue}}S==="["?g++:S==="]"&&g--}const _=m.length===0?p:p.substring(h),k=_.startsWith(Ik),C=k?_.substring(1):_,y=b&&b>h?b-h:void 0;return{modifiers:m,hasImportantModifier:k,baseClassName:C,maybePostfixModifierPosition:y}};return s?p=>s({className:p,parseClassName:u}):u},WA=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(o=>{o[0]==="["?(t.push(...s.sort(),o),s=[]):s.push(o)}),t.push(...s.sort()),t},JA=e=>({cache:QA(e.cacheSize),parseClassName:ZA(e),...FA(e)}),e3=/\s+/,t3=(e,t)=>{const{parseClassName:s,getClassGroupId:o,getConflictingClassGroupIds:l}=t,c=[],u=e.trim().split(e3);let p="";for(let m=u.length-1;m>=0;m-=1){const g=u[m],{modifiers:h,hasImportantModifier:b,baseClassName:_,maybePostfixModifierPosition:k}=s(g);let C=!!k,y=o(C?_.substring(0,k):_);if(!y){if(!C){p=g+(p.length>0?" "+p:p);continue}if(y=o(_),!y){p=g+(p.length>0?" "+p:p);continue}C=!1}const w=WA(h).join(":"),S=b?w+Ik:w,N=S+y;if(c.includes(N))continue;c.push(N);const E=l(y,C);for(let R=0;R<E.length;++R){const M=E[R];c.push(S+M)}p=g+(p.length>0?" "+p:p)}return p};function n3(){let e=0,t,s,o="";for(;e<arguments.length;)(t=arguments[e++])&&(s=Bk(t))&&(o&&(o+=" "),o+=s);return o}const Bk=e=>{if(typeof e=="string")return e;let t,s="";for(let o=0;o<e.length;o++)e[o]&&(t=Bk(e[o]))&&(s&&(s+=" "),s+=t);return s};function a3(e,...t){let s,o,l,c=u;function u(m){const g=t.reduce((h,b)=>b(h),e());return s=JA(g),o=s.cache.get,l=s.cache.set,c=p,p(m)}function p(m){const g=o(m);if(g)return g;const h=t3(m,s);return l(m,h),h}return function(){return c(n3.apply(null,arguments))}}const Qt=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},Uk=/^\[(?:([a-z-]+):)?(.+)\]$/i,s3=/^\d+\/\d+$/,r3=new Set(["px","full","screen"]),o3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,l3=/\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$/,i3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,c3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,u3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ls=e=>Cl(e)||r3.has(e)||s3.test(e),_r=e=>ei(e,"length",b3),Cl=e=>!!e&&!Number.isNaN(Number(e)),yg=e=>ei(e,"number",Cl),Ki=e=>!!e&&Number.isInteger(Number(e)),d3=e=>e.endsWith("%")&&Cl(e.slice(0,-1)),ft=e=>Uk.test(e),yr=e=>o3.test(e),f3=new Set(["length","size","percentage"]),p3=e=>ei(e,f3,Hk),m3=e=>ei(e,"position",Hk),g3=new Set(["image","url"]),h3=e=>ei(e,g3,_3),x3=e=>ei(e,"",v3),Qi=()=>!0,ei=(e,t,s)=>{const o=Uk.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):s(o[2]):!1},b3=e=>l3.test(e)&&!i3.test(e),Hk=()=>!1,v3=e=>c3.test(e),_3=e=>u3.test(e),y3=()=>{const e=Qt("colors"),t=Qt("spacing"),s=Qt("blur"),o=Qt("brightness"),l=Qt("borderColor"),c=Qt("borderRadius"),u=Qt("borderSpacing"),p=Qt("borderWidth"),m=Qt("contrast"),g=Qt("grayscale"),h=Qt("hueRotate"),b=Qt("invert"),_=Qt("gap"),k=Qt("gradientColorStops"),C=Qt("gradientColorStopPositions"),y=Qt("inset"),w=Qt("margin"),S=Qt("opacity"),N=Qt("padding"),E=Qt("saturate"),R=Qt("scale"),M=Qt("sepia"),T=Qt("skew"),A=Qt("space"),z=Qt("translate"),I=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",ft,t],L=()=>[ft,t],U=()=>["",Ls,_r],q=()=>["auto",Cl,ft],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",ft],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[Cl,ft];return{cacheSize:500,separator:":",theme:{colors:[Qi],spacing:[Ls,_r],blur:["none","",yr,ft],brightness:H(),borderColor:[e],borderRadius:["none","","full",yr,ft],borderSpacing:L(),borderWidth:U(),contrast:H(),grayscale:F(),hueRotate:H(),invert:F(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[d3,_r],inset:P(),margin:P(),opacity:H(),padding:L(),saturate:H(),scale:H(),sepia:F(),skew:H(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ft]}],container:["container"],columns:[{columns:[yr]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"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"],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:[...$(),ft]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],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:["auto",Ki,ft]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ft]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Ki,ft]}],"grid-cols":[{"grid-cols":[Qi]}],"col-start-end":[{col:["auto",{span:["full",Ki,ft]},ft]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[Qi]}],"row-start-end":[{row:["auto",{span:[Ki,ft]},ft]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ft]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ft]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ft,t]}],"min-w":[{"min-w":[ft,t,"min","max","fit"]}],"max-w":[{"max-w":[ft,t,"none","full","min","max","fit","prose",{screen:[yr]},yr]}],h:[{h:[ft,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ft,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ft,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ft,t,"auto","min","max","fit"]}],"font-size":[{text:["base",yr,_r]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yg]}],"font-family":[{font:[Qi]}],"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:["tighter","tight","normal","wide","wider","widest",ft]}],"line-clamp":[{"line-clamp":["none",Cl,yg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ls,ft]}],"list-image":[{"list-image":["none",ft]}],"list-style-type":[{list:["none","disc","decimal",ft]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ls,_r]}],"underline-offset":[{"underline-offset":["auto",Ls,ft]}],"text-decoration-color":[{decoration:[e]}],"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",ft]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),m3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",p3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},h3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:V()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-b":[{"border-b":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Ls,ft]}],"outline-w":[{outline:[Ls,_r]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[Ls,_r]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",yr,x3]}],"shadow-color":[{shadow:[Qi]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",yr,ft]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[b]}],saturate:[{saturate:[E]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ft]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",ft]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",ft]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[Ki,ft]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ft]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",ft]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],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",ft]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ls,_r,yg]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},Vk=a3(y3);function Oe(...e){return Vk(Cc(e))}const C1={};function Kn(e,t){const s=x.useRef(C1);return s.current===C1&&(s.current=e(t)),s}const Ih=[];let Bh;function j3(){return Bh}function w3(e){Ih.push(e)}function qx(e){const t=(s,o)=>{const l=Kn(k3).current;let c;try{Bh=l;for(const u of Ih)u.before(l);c=e(s,o);for(const u of Ih)u.after(l);l.didInitialize=!0}finally{Bh=void 0}return c};return t.displayName=e.displayName||e.name,t}function qk(e){return x.forwardRef(qx(e))}function k3(){return{didInitialize:!1}}function Rf(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const S3=()=>{},Ie=typeof document<"u"?x.useLayoutEffect:S3;function C3(e,t){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(u=>c.searchParams.append("args[]",u)),`${t} error #${o}; visit ${c} for the full message.`}}const nn=C3("https://base-ui.com/production-error","Base UI"),$k=x.createContext(void 0);function Uc(e){const t=x.useContext($k);if(t===void 0&&!e)throw new Error(nn(72));return t}const N3=[];function $x(e){x.useEffect(e,N3)}const Zi=0;class Fa{static create(){return new Fa}currentId=Zi;start(t,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Zi,s()},t)}isStarted(){return this.currentId!==Zi}clear=()=>{this.currentId!==Zi&&(clearTimeout(this.currentId),this.currentId=Zi)};disposeEffect=()=>this.clear}function wn(){const e=Kn(Fa.create).current;return $x(e.disposeEffect),e}const ti=typeof navigator<"u",jg=E3(),Fk=T3(),Gk=R3(),Fx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Yk=jg.platform==="MacIntel"&&jg.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(jg.platform),Xk=ti&&/apple/i.test(navigator.vendor),Uh=ti&&/android/i.test(Fk)||/android/i.test(Gk),Kk=ti&&Fk.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Qk=Gk.includes("jsdom/");function E3(){if(!ti)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function R3(){if(!ti)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:s})=>`${t}/${s}`).join(" "):navigator.userAgent}function T3(){if(!ti)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function _a(e){e.preventDefault(),e.stopPropagation()}function M3(e){return"nativeEvent"in e}function Gx(e){return e.pointerType===""&&e.isTrusted?!0:Uh&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Zk(e){return Qk?!1:!Uh&&e.width===0&&e.height===0||Uh&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function vo(e,t){const s=["mouse","pen"];return t||s.push("",void 0),s.includes(e)}function A3(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Tf(){return typeof window<"u"}function Fn(e){return Yx(e)?(e.nodeName||"").toLowerCase():"#document"}function Zt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ms(e){var t;return(t=(Yx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yx(e){return Tf()?e instanceof Node||e instanceof Zt(e).Node:!1}function mt(e){return Tf()?e instanceof Element||e instanceof Zt(e).Element:!1}function Vt(e){return Tf()?e instanceof HTMLElement||e instanceof Zt(e).HTMLElement:!1}function Ll(e){return!Tf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Zt(e).ShadowRoot}function Pr(e){const{overflow:t,overflowX:s,overflowY:o,display:l}=ca(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+s)&&l!=="inline"&&l!=="contents"}function O3(e){return/^(table|td|th)$/.test(Fn(e))}function Mf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const z3=/transform|translate|scale|rotate|perspective|filter/,D3=/paint|layout|strict|content/,io=e=>!!e&&e!=="none";let wg;function Xx(e){const t=mt(e)?ca(e):e;return io(t.transform)||io(t.translate)||io(t.scale)||io(t.rotate)||io(t.perspective)||!Af()&&(io(t.backdropFilter)||io(t.filter))||z3.test(t.willChange||"")||D3.test(t.contain||"")}function P3(e){let t=us(e);for(;Vt(t)&&!rs(t);){if(Xx(t))return t;if(Mf(t))return null;t=us(t)}return null}function Af(){return wg==null&&(wg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),wg}function rs(e){return/^(html|body|#document)$/.test(Fn(e))}function ca(e){return Zt(e).getComputedStyle(e)}function Of(e){return mt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function us(e){if(Fn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ll(e)&&e.host||ms(e);return Ll(t)?t.host:t}function Wk(e){const t=us(e);return rs(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Pr(t)?t:Wk(t)}function Nc(e,t,s){var o;t===void 0&&(t=[]),s===void 0&&(s=!0);const l=Wk(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),u=Zt(l);if(c){const p=Hh(u);return t.concat(u,u.visualViewport||[],Pr(l)?l:[],p&&s?Nc(p):[])}else return t.concat(l,Nc(l,[],s))}function Hh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Vh="data-base-ui-focusable",Jk="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Er="ArrowLeft",Rr="ArrowRight",Kx="ArrowUp",Hc="ArrowDown";function Hn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const s=t.getRootNode?.();if(e.contains(t))return!0;if(s&&Ll(s)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function zn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Wd(e,t){if(!mt(e))return!1;const s=e;if(t.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(Qe(o,s))return!o.hasAttribute("data-trigger-disabled");return!1}function kg(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const s=e;return s.target!=null&&t.contains(s.target)}function L3(e){return e.matches("html,body")}function zf(e){return Vt(e)&&e.matches(Jk)}function I3(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Jk}`)!=null}function qh(e){return e?e.getAttribute("role")==="combobox"&&zf(e):!1}function B3(e){if(!e||Qk)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Jd(e){return e?e.hasAttribute(Vh)?e:e.querySelector(`[${Vh}]`)||e:null}function U3(e,t){return t!=null&&!vo(t)?0:typeof e=="function"?e():e}function ef(e,t,s){const o=U3(e,s);return typeof o=="number"?o:o?.[t]}function N1(e){return typeof e=="function"?e():e}function eS(e,t){return t||e==="click"||e==="mousedown"}function H3(e){return e?.includes("mouse")&&e!=="mousedown"}function qn(){}const Or=Object.freeze([]),Gt=Object.freeze({}),Gs="none",Il="trigger-press",jn="trigger-hover",Nl="trigger-focus",Df="outside-press",El="item-press",V3="close-press",_o="focus-out",Pf="escape-key",$h="list-navigation",tS="cancel-open",uc="sibling-open",nS="disabled",E1="missing",R1="initial",Qx="imperative-action",q3="window-resize";function at(e,t,s,o){let l=!1,c=!1;const u=o??Gt;return{reason:e,event:t??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:s,...u}}const aS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Fa,currentIdRef:{current:null},currentContextRef:{current:null}});function $3(e){const{children:t,delay:s,timeoutMs:o=0}=e,l=x.useRef(s),c=x.useRef(s),u=x.useRef(null),p=x.useRef(null),m=wn();return r.jsx(aS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:u,timeoutMs:o,currentContextRef:p,timeout:m}),[o,m]),children:t})}function F3(e,t={open:!1}){const{open:s}=t,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(aS),{currentIdRef:u,delayRef:p,timeoutMs:m,initialDelayRef:g,currentContextRef:h,hasProvider:b,timeout:_}=c,[k,C]=x.useState(!1);return Ie(()=>{function y(){C(!1),h.current?.setIsInstantPhase(!1),u.current=null,h.current=null,p.current=g.current}if(u.current&&!s&&u.current===l){if(C(!1),m){const w=l;return _.start(m,()=>{o.select("open")||u.current&&u.current!==w||y()}),()=>{_.clear()}}y()}},[s,l,u,p,m,g,h,_,o]),Ie(()=>{if(!s)return;const y=h.current,w=u.current;_.clear(),h.current={onOpenChange:o.setOpen,setIsInstantPhase:C},u.current=l,p.current={open:0,close:ef(g.current,"close")},w!==null&&w!==l?(C(!0),y?.setIsInstantPhase(!0),y?.onOpenChange(!1,at(Gs))):(C(!1),y?.setIsInstantPhase(!1))},[s,l,o,u,p,g,h,_]),Ie(()=>()=>{h.current=null},[h]),x.useMemo(()=>({hasProvider:b,delayRef:p,isInstantPhase:k}),[b,p,k])}function gt(e,t,s,o){return e.addEventListener(t,s,o),()=>{e.removeEventListener(t,s,o)}}function os(...e){return()=>{for(let t=0;t<e.length;t+=1){const s=e[t];s&&s()}}}function ds(e,t,s,o){const l=Kn(sS).current;return Y3(l,e,t,s,o)&&rS(l,[e,t,s,o]),l.callback}function G3(e){const t=Kn(sS).current;return X3(t,e)&&rS(t,e),t.callback}function sS(){return{callback:null,cleanup:null,refs:[]}}function Y3(e,t,s,o,l){return e.refs[0]!==t||e.refs[1]!==s||e.refs[2]!==o||e.refs[3]!==l}function X3(e,t){return e.refs.length!==t.length||e.refs.some((s,o)=>s!==t[o])}function rS(e,t){if(e.refs=t,t.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const o=Array(t.length).fill(null);for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=c(s);typeof u=="function"&&(o[l]=u);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=o[l];typeof u=="function"?u():c(null);break}case"object":{c.current=null;break}}}}}}}function mn(e){const t=Kn(K3,e).current;return t.next=e,Ie(t.effect),t}function K3(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Zx={...tT},Sg=Zx.useInsertionEffect,Q3=Sg&&Sg!==Zx.useLayoutEffect?Sg:e=>e();function Ve(e){const t=Kn(Z3).current;return t.next=e,Q3(t.effect),t.trampoline}function Z3(){const e={next:void 0,callback:W3,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function W3(){}const dd=null;class J3{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const s=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<s.length;l+=1)s[l]?.(t)};request(t){const s=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(t){const s=t-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const fd=new J3;class ts{static create(){return new ts}static request(t){return fd.request(t)}static cancel(t){return fd.cancel(t)}currentId=dd;request(t){this.cancel(),this.currentId=fd.request(()=>{this.currentId=dd,t()})}cancel=()=>{this.currentId!==dd&&(fd.cancel(this.currentId),this.currentId=dd)};disposeEffect=()=>this.cancel}function Bl(){const e=Kn(ts.create).current;return $x(e.disposeEffect),e}function pt(e){return e?.ownerDocument||document}const oS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Wx={...oS,position:"fixed",top:0,left:0},lS={...oS,position:"absolute"},Ul=x.forwardRef(function(t,s){const[o,l]=x.useState();Ie(()=>{Xk&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...t,ref:s,style:Wx,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),e5=["top","right","bottom","left"],Hl=Math.min,ya=Math.max,tf=Math.round,mo=Math.floor,ls=e=>({x:e,y:e}),t5={left:"right",right:"left",bottom:"top",top:"bottom"};function Fh(e,t,s){return ya(e,Hl(t,s))}function Ys(e,t){return typeof e=="function"?e(t):e}function ia(e){return e.split("-")[0]}function Lr(e){return e.split("-")[1]}function Jx(e){return e==="x"?"y":"x"}function eb(e){return e==="y"?"height":"width"}function Da(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function tb(e){return Jx(Da(e))}function n5(e,t,s){s===void 0&&(s=!1);const o=Lr(e),l=tb(e),c=eb(l);let u=l==="x"?o===(s?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=nf(u)),[u,nf(u)]}function a5(e){const t=nf(e);return[Gh(e),t,Gh(t)]}function Gh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const T1=["left","right"],M1=["right","left"],s5=["top","bottom"],r5=["bottom","top"];function o5(e,t,s){switch(e){case"top":case"bottom":return s?t?M1:T1:t?T1:M1;case"left":case"right":return t?s5:r5;default:return[]}}function l5(e,t,s,o){const l=Lr(e);let c=o5(ia(e),s==="start",o);return l&&(c=c.map(u=>u+"-"+l),t&&(c=c.concat(c.map(Gh)))),c}function nf(e){const t=ia(e);return t5[t]+e.slice(t.length)}function i5(e){return{top:0,right:0,bottom:0,left:0,...e}}function iS(e){return typeof e!="number"?i5(e):{top:e,right:e,bottom:e,left:e}}function Ec(e){const{x:t,y:s,width:o,height:l}=e;return{width:o,height:l,top:s,left:t,right:t+o,bottom:s+l,x:t,y:s}}function pd(e,t,s){return Math.floor(e/t)!==s}function Rc(e,t){return t<0||t>=e.length}function Id(e,t){return Un(e.current,{disabledIndices:t})}function Yh(e,t){return Un(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Un(e,{startingIndex:t=-1,decrement:s=!1,disabledIndices:o,amount:l=1}={}){let c=t;do c+=s?-l:l;while(c>=0&&c<=e.length-1&&qs(e,c,o));return c}function cS(e,{event:t,orientation:s,loopFocus:o,onLoop:l,rtl:c,cols:u,disabledIndices:p,minIndex:m,maxIndex:g,prevIndex:h,stopEvent:b=!1}){let _=h,k;if(t.key===Kx?k="up":t.key===Hc&&(k="down"),k){const C=[],y=[];let w=!1,S=0;{let I=null,D=-1;e.forEach((P,L)=>{if(P==null)return;S+=1;const U=P.closest('[role="row"]');U&&(w=!0),(U!==I||D===-1)&&(I=U,D+=1,C[D]=[]),C[D].push(L),y[L]=D})}let N=!1,E=0;if(w)for(const I of C){const D=I.length;D>E&&(E=D),D!==u&&(N=!0)}const R=N&&S<e.length,M=E||u,T=I=>{if(!N||h===-1)return;const D=y[h];if(D==null)return;const P=C[D].indexOf(h),L=I==="up"?-1:1;for(let U=D+L,q=0;q<C.length;q+=1,U+=L){if(U<0||U>=C.length){if(!o||R)return;if(U=U<0?C.length-1:0,l){const V=Math.min(P,C[U].length-1),G=C[U][V]??C[U][0],K=l(t,h,G);U=y[K]??U}}const $=C[U];for(let V=Math.min(P,$.length-1);V>=0;V-=1){const G=$[V];if(!qs(e,G,p))return G}}},A=I=>{if(!R||h===-1)return;const D=h%M,P=I==="up"?-M:M,L=g-g%M,U=mo(g/M)+1;for(let q=h-D+P,$=0;$<U;$+=1,q+=P){if(q<0||q>g){if(!o)return;q=q<0?L:0}const V=Math.min(q+M-1,g);for(let G=Math.min(q+D,V);G>=q;G-=1)if(!qs(e,G,p))return G}};b&&_a(t);const z=T(k)??A(k);if(z!==void 0)_=z;else if(h===-1)_=k==="up"?g:m;else if(_=Un(e,{startingIndex:h,amount:M,decrement:k==="up",disabledIndices:p}),o){if(k==="up"&&(h-M<m||_<0)){const I=h%M,D=g%M,P=g-(D-I);D===I?_=g:_=D>I?P:P-M,l&&(_=l(t,h,_))}k==="down"&&h+M>g&&(_=Un(e,{startingIndex:h%M-M,amount:M,disabledIndices:p}),l&&(_=l(t,h,_)))}Rc(e,_)&&(_=h)}if(s==="both"){const C=mo(h/u);t.key===(c?Er:Rr)&&(b&&_a(t),h%u!==u-1?(_=Un(e,{startingIndex:h,disabledIndices:p}),o&&pd(_,u,C)&&(_=Un(e,{startingIndex:h-h%u-1,disabledIndices:p}),l&&(_=l(t,h,_)))):o&&(_=Un(e,{startingIndex:h-h%u-1,disabledIndices:p}),l&&(_=l(t,h,_))),pd(_,u,C)&&(_=h)),t.key===(c?Rr:Er)&&(b&&_a(t),h%u!==0?(_=Un(e,{startingIndex:h,decrement:!0,disabledIndices:p}),o&&pd(_,u,C)&&(_=Un(e,{startingIndex:h+(u-h%u),decrement:!0,disabledIndices:p}),l&&(_=l(t,h,_)))):o&&(_=Un(e,{startingIndex:h+(u-h%u),decrement:!0,disabledIndices:p}),l&&(_=l(t,h,_))),pd(_,u,C)&&(_=h));const y=mo(g/u)===C;Rc(e,_)&&(o&&y?(_=t.key===(c?Rr:Er)?g:Un(e,{startingIndex:h-h%u-1,disabledIndices:p}),l&&(_=l(t,h,_))):_=h)}return _}function uS(e,t,s){const o=[];let l=0;return e.forEach(({width:c,height:u},p)=>{let m=!1;for(s&&(l=0);!m;){const g=[];for(let h=0;h<c;h+=1)for(let b=0;b<u;b+=1)g.push(l+h+b*t);l%t+c<=t&&g.every(h=>o[h]==null)?(g.forEach(h=>{o[h]=p}),m=!0):l+=1}}),[...o]}function dS(e,t,s,o,l){if(e===-1)return-1;const c=s.indexOf(e),u=t[e];switch(l){case"tl":return c;case"tr":return u?c+u.width-1:c;case"bl":return u?c+(u.height-1)*o:c;case"br":return s.lastIndexOf(e);default:return-1}}function fS(e,t){return t.flatMap((s,o)=>e.includes(s)?[o]:[])}function qs(e,t,s){if(typeof s=="function"?s(t):s?.includes(t)??!1)return!0;const l=e[t];return l?Lf(l)?!s&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function c5(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Lf(e,t=e?ca(e):null){return!e||!e.isConnected||!t||c5(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const u5='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function d5(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return Ll(s)?s.host:null}function Xh(e){for(const t of Array.from(e.children))if(Fn(t)==="summary")return t;return null}function f5(e,t){const s=Xh(t);return!!s&&(e===s||Qe(s,e))}function pS(e){const t=e?Fn(e):"";return e!=null&&e.matches(u5)&&(t!=="summary"||e.parentElement!=null&&Fn(e.parentElement)==="details"&&Xh(e.parentElement)===e)&&(t!=="details"||Xh(e)==null)&&(t!=="input"||e.type!=="hidden")}function mS(e){if(!pS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=d5(t)){const s=t!==e,o=Fn(t)==="slot";if(t.hasAttribute("inert")||s&&Fn(t)==="details"&&!t.open&&!f5(e,t)||t.hasAttribute("hidden")||!o&&!p5(t,s))return!1}return!0}function p5(e,t){const s=ca(e);return t?s.display!=="none":Lf(e,s)}function gS(e){const t=e.tabIndex;if(t<0){const s=Fn(e);if(s==="details"||s==="audio"||s==="video"||Vt(e)&&e.isContentEditable)return 0}return t}function Cg(e){if(Fn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function m5(e,t){const s=Cg(e);if(!s)return!0;const o=t.find(l=>{const c=Cg(l);return c?.name===s.name&&c.form===s.form&&c.checked});return o?o===s:t.find(l=>{const c=Cg(l);return c?.name===s.name&&c.form===s.form})===s}function hS(e){if(Vt(e)&&Fn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Vt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function xS(e,t){hS(e).forEach(s=>{pS(s)&&t.push(s),xS(s,t)})}function bS(e,t,s){hS(e).forEach(o=>{Vt(o)&&o.matches(t)&&s.push(o),bS(o,t,s)})}function nb(e){return mS(e)&&gS(e)>=0}function vS(e){const t=[];return xS(e,t),t.filter(mS)}function Vc(e){const t=vS(e);return t.filter(s=>gS(s)>=0&&m5(s,t))}function _S(e,t){const s=Vc(e),o=s.length;if(o===0)return;const l=Hn(pt(e)),c=s.indexOf(l),u=c===-1?t===1?0:o-1:c+t;return s[u]}function ab(e){return _S(pt(e).body,1)||e}function yS(e){return _S(pt(e).body,-1)||e}function jS(e,t){if(!e)return null;const s=Vc(pt(e).body),o=s.length;if(o===0)return null;const l=s.indexOf(e);if(l===-1)return null;const c=(l+t+o)%o;return s[c]}function g5(e){return jS(e,1)}function h5(e){return jS(e,-1)}function Rl(e,t){const s=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(s,o)}function x5(e){Vc(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function A1(e){const t=[];bS(e,"[data-tabindex]",t),t.forEach(s=>{const o=s.dataset.tabindex;delete s.dataset.tabindex,o?s.setAttribute("tabindex",o):s.removeAttribute("tabindex")})}function zr(e,t,s=!0){return e.filter(l=>l.parentId===t).flatMap(l=>[...!s||l.context?.open?[l]:[],...zr(e,l.id,s)])}function O1(e,t){let s=[],o=e.find(l=>l.id===t)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(s=s.concat(l))}return s}function Tc(e){return`data-base-ui-${e}`}let md=0;function Bd(e,t={}){const{preventScroll:s=!1,sync:o=!1,shouldFocus:l}=t;cancelAnimationFrame(md);function c(){l&&!l()||e?.focus({preventScroll:s})}if(o)return c(),qn;const u=requestAnimationFrame(c);return md=u,()=>{md===u&&(cancelAnimationFrame(u),md=0)}}const Ng={inert:new WeakMap,"aria-hidden":new WeakMap},z1="data-base-ui-inert",Kh={inert:new WeakSet,"aria-hidden":new WeakSet};let Wi=new WeakMap,Eg=0;function b5(e){return Kh[e]}function wS(e){return e?Ll(e)?e.host:wS(e.parentNode):null}const Rg=(e,t)=>t.map(s=>{if(e.contains(s))return s;const o=wS(s);return e.contains(o)?o:null}).filter(s=>s!=null),D1=e=>{const t=new Set;return e.forEach(s=>{let o=s;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},P1=(e,t,s)=>{const o=[],l=c=>{!c||s.has(c)||Array.from(c.children).forEach(u=>{Fn(u)!=="script"&&(t.has(u)?l(u):o.push(u))})};return l(e),o};function v5(e,t,s,o,{mark:l=!0,markerIgnoreElements:c=[]}){const u=o?"inert":s?"aria-hidden":null;let p=null,m=null;const g=Rg(t,e),h=l?Rg(t,c):[],b=new Set(h),_=l?P1(t,D1(g),new Set(g)).filter(y=>!b.has(y)):[],k=[],C=[];if(u){const y=Ng[u],w=b5(u);m=w,p=y;const S=Rg(t,Array.from(t.querySelectorAll("[aria-live]"))),N=g.concat(S);P1(t,D1(N),new Set(N)).forEach(R=>{const M=R.getAttribute(u),T=M!==null&&M!=="false",A=(y.get(R)||0)+1;y.set(R,A),k.push(R),A===1&&T&&w.add(R),T||R.setAttribute(u,u==="inert"?"":"true")})}return l&&_.forEach(y=>{const w=(Wi.get(y)||0)+1;Wi.set(y,w),C.push(y),w===1&&y.setAttribute(z1,"")}),Eg+=1,()=>{p&&k.forEach(y=>{const S=(p.get(y)||0)-1;p.set(y,S),S||(!m?.has(y)&&u&&y.removeAttribute(u),m?.delete(y))}),l&&C.forEach(y=>{const w=(Wi.get(y)||0)-1;Wi.set(y,w),w||y.removeAttribute(z1)}),Eg-=1,Eg||(Ng.inert=new WeakMap,Ng["aria-hidden"]=new WeakMap,Kh.inert=new WeakSet,Kh["aria-hidden"]=new WeakSet,Wi=new WeakMap)}}function L1(e,t={}){const{ariaHidden:s=!1,inert:o=!1,mark:l=!0,markerIgnoreElements:c=[]}=t,u=pt(e[0]).body;return v5(e,u,s,o,{mark:l,markerIgnoreElements:c})}let I1=0;function _5(e,t="mui"){const[s,o]=x.useState(e),l=e||s;return x.useEffect(()=>{s==null&&(I1+=1,o(`${t}-${I1}`))},[s,t]),l}const B1=Zx.useId;function yo(e,t){if(B1!==void 0){const s=B1();return e??(t?`${t}-${s}`:s)}return _5(e,t)}const y5=parseInt(x.version,10);function sb(e){return y5>=e}function U1(e){if(!x.isValidElement(e))return null;const t=e,s=t.props;return(sb(19)?s?.ref:t.ref)??null}function Qh(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function j5(e,t){const s={};for(const o in e){const l=e[o];if(t?.hasOwnProperty(o)){const c=t[o](l);c!=null&&Object.assign(s,c);continue}l===!0?s[`data-${o.toLowerCase()}`]="":l&&(s[`data-${o.toLowerCase()}`]=l.toString())}return s}function w5(e,t){return typeof e=="function"?e(t):e}function k5(e,t){return typeof e=="function"?e(t):e}const rb={};function Dn(e,t,s,o,l){if(!s&&!o&&!l&&!e)return af(t);let c=af(e);return t&&(c=dc(c,t)),s&&(c=dc(c,s)),o&&(c=dc(c,o)),l&&(c=dc(c,l)),c}function S5(e){if(e.length===0)return rb;if(e.length===1)return af(e[0]);let t=af(e[0]);for(let s=1;s<e.length;s+=1)t=dc(t,e[s]);return t}function af(e){return ob(e)?{...SS(e,rb)}:C5(e)}function dc(e,t){return ob(t)?SS(t,e):N5(e,t)}function C5(e){const t={...e};for(const s in t){const o=t[s];kS(s,o)&&(t[s]=CS(o))}return t}function N5(e,t){if(!t)return e;for(const s in t){const o=t[s];switch(s){case"style":{e[s]=Qh(e.style,o);break}case"className":{e[s]=NS(e.className,o);break}default:kS(s,o)?e[s]=E5(e[s],o):e[s]=o}}return e}function kS(e,t){const s=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return s===111&&o===110&&l>=65&&l<=90&&(typeof t=="function"||typeof t>"u")}function ob(e){return typeof e=="function"}function SS(e,t){return ob(e)?e(t):e??rb}function E5(e,t){return t?e?(...s)=>{const o=s[0];if(ES(o)){const c=o;sf(c);const u=t(...s);return c.baseUIHandlerPrevented||e?.(...s),u}const l=t(...s);return e?.(...s),l}:CS(t):e}function CS(e){return e&&((...t)=>{const s=t[0];return ES(s)&&sf(s),e(...t)})}function sf(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function NS(e,t){return t?e?t+" "+e:t:e}function ES(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ct(e,t,s={}){const o=t.render,l=R5(t,s);if(s.enabled===!1)return null;const c=s.state??Gt;return A5(e,o,l,c)}function R5(e,t={}){const{className:s,style:o,render:l}=e,{state:c=Gt,ref:u,props:p,stateAttributesMapping:m,enabled:g=!0}=t,h=g?w5(s,c):void 0,b=g?k5(o,c):void 0,_=g?j5(c,m):Gt,k=g&&p?T5(p):void 0,C=g?Qh(_,k)??{}:Gt;return typeof document<"u"&&(g?Array.isArray(u)?C.ref=G3([C.ref,U1(l),...u]):C.ref=ds(C.ref,U1(l),u):ds(null,null)),g?(h!==void 0&&(C.className=NS(C.className,h)),b!==void 0&&(C.style=Qh(C.style,b)),C):Gt}function T5(e){return Array.isArray(e)?S5(e):Dn(void 0,e)}const M5=Symbol.for("react.lazy");function A5(e,t,s,o){if(t){if(typeof t=="function")return t(s,o);const l=Dn(s,t.props);l.ref=s.ref;let c=t;return c?.$$typeof===M5&&(c=x.Children.toArray(t)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return O5(e,s);throw new Error(nn(8))}function O5(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const z5=500,D5=500,P5={style:{transition:"none"}},L5="data-base-ui-click-trigger",RS={fallbackAxisSide:"none"},TS={fallbackAxisSide:"end"},I5={clipPath:"inset(50%)",position:"fixed",top:0,left:0},MS=x.createContext(null),AS=()=>x.useContext(MS),B5=Tc("portal");function OS(e={}){const{ref:t,container:s,componentProps:o=Gt,elementProps:l}=e,c=yo(),p=AS()?.portalNode,[m,g]=x.useState(null),[h,b]=x.useState(null),_=Ve(w=>{w!==null&&b(w)}),k=x.useRef(null);Ie(()=>{if(s===null){k.current&&(k.current=null,b(null),g(null));return}if(c==null)return;const w=(s&&(Yx(s)?s:s.current))??p??document.body;if(w==null){k.current&&(k.current=null,b(null),g(null));return}k.current!==w&&(k.current=w,b(null),g(w))},[s,p,c]);const C=Ct("div",o,{ref:[t,_],props:[{id:c,[B5]:""},l]});return{portalNode:h,portalSubtree:m&&C?is.createPortal(C,m):null}}const lb=x.forwardRef(function(t,s){const{render:o,className:l,style:c,children:u,container:p,renderGuards:m,...g}=t,{portalNode:h,portalSubtree:b}=OS({container:p,ref:s,componentProps:t,elementProps:g}),_=x.useRef(null),k=x.useRef(null),C=x.useRef(null),y=x.useRef(null),[w,S]=x.useState(null),N=x.useRef(!1),E=w?.modal,R=w?.open,M=typeof m=="boolean"?m:!!w&&!w.modal&&w.open&&!!h;x.useEffect(()=>{if(!h||E)return;function A(z){h&&z.relatedTarget&&Rl(z)&&(z.type==="focusin"?N.current&&(A1(h),N.current=!1):(x5(h),N.current=!0))}return os(gt(h,"focusin",A,!0),gt(h,"focusout",A,!0))},[h,E]),x.useEffect(()=>{!h||R!==!1||(A1(h),N.current=!1)},[R,h]);const T=x.useMemo(()=>({beforeOutsideRef:_,afterOutsideRef:k,beforeInsideRef:C,afterInsideRef:y,portalNode:h,setFocusManagerState:S}),[h]);return r.jsxs(x.Fragment,{children:[b,r.jsxs(MS.Provider,{value:T,children:[M&&h&&r.jsx(Ul,{"data-type":"outside",ref:_,onFocus:A=>{if(Rl(A,h))C.current?.focus();else{const z=w?w.domReference:null;yS(z)?.focus()}}}),M&&h&&r.jsx("span",{"aria-owns":h.id,style:I5}),h&&is.createPortal(u,h),M&&h&&r.jsx(Ul,{"data-type":"outside",ref:k,onFocus:A=>{if(Rl(A,h))y.current?.focus();else{const z=w?w.domReference:null;ab(z)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,at(_o,A.nativeEvent))}}})]})]})});function zS(){const e=new Map;return{emit(t,s){e.get(t)?.forEach(o=>o(s))},on(t,s){e.has(t)||e.set(t,new Set),e.get(t).add(s)},off(t,s){e.get(t)?.delete(s)}}}class ib{nodesRef={current:[]};events=zS();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const s=this.nodesRef.current.findIndex(o=>o===t);s!==-1&&this.nodesRef.current.splice(s,1)}}const DS=x.createContext(null),PS=x.createContext(null),Ir=()=>x.useContext(DS)?.id||null,Br=e=>{const t=x.useContext(PS);return e??t};function LS(e){const t=yo(),s=Br(e),o=Ir();return Ie(()=>{if(!t)return;const l={id:t,parentId:o};return s?.addNode(l),()=>{s?.removeNode(l)}},[s,t,o]),t}function U5(e){const{children:t,id:s}=e,o=Ir();return r.jsx(DS.Provider,{value:x.useMemo(()=>({id:s,parentId:o}),[s,o]),children:t})}function H5(e){const{children:t,externalTree:s}=e,o=Kn(()=>s??new ib).current;return r.jsx(PS.Provider,{value:o,children:t})}function Us(e){return e==null?e:"current"in e?e.current:e}function V5(e,t){const s=Zt(zn(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const H1=20;let Cr=[];function cb(){Cr=Cr.filter(e=>e.deref()?.isConnected)}function q5(e){cb(),e&&Fn(e)!=="body"&&(Cr.push(new WeakRef(e)),Cr.length>H1&&(Cr=Cr.slice(-H1)))}function Tg(){return cb(),Cr[Cr.length-1]?.deref()}function $5(e){return e?nb(e)?e:Vc(e)[0]||e:null}function V1(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const o=vS(e).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return nb(c)||c.hasAttribute("data-tabindex")&&!u.startsWith("-")}),l=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function ub(e){const{context:t,children:s,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:p=!0,closeOnFocusOut:m=!0,openInteractionType:g="",nextFocusableElement:h,previousFocusableElement:b,beforeContentFocusGuardRef:_,externalTree:k,getInsideElements:C}=e,y="rootStore"in t?t.rootStore:t,w=y.useState("open"),S=y.useState("domReferenceElement"),N=y.useState("floatingElement"),{events:E,dataRef:R}=y.context,M=Ve(()=>R.current.floatingContext?.nodeId),T=l===!1,A=qh(S)&&T,z=x.useRef(["content"]),I=mn(l),D=mn(c),P=mn(g),L=Br(k),U=AS(),q=x.useRef(!1),$=x.useRef(!1),V=x.useRef(!1),G=x.useRef(null),K=x.useRef(""),F=x.useRef(""),X=x.useRef(null),H=x.useRef(null),Q=ds(X,_,U?.beforeInsideRef),Y=ds(H,U?.afterInsideRef),J=wn(),oe=wn(),ne=Bl(),te=U!=null,le=Jd(N),fe=Ve((pe=le)=>pe?Vc(pe):[]),ze=Ve(()=>C?.().filter(pe=>pe!=null)??[]);x.useEffect(()=>{if(o||!p)return;function pe(Ne){Ne.key==="Tab"&&Qe(le,Hn(pt(le)))&&fe().length===0&&!A&&_a(Ne)}const je=pt(le);return gt(je,"keydown",pe)},[o,le,p,A,fe]),x.useEffect(()=>{if(o||!w)return;const pe=pt(le);function je(){V.current=!1}function Ne(Ue){const ye=zn(Ue),De=ze(),ve=Qe(N,ye)||Qe(S,ye)||Qe(U?.portalNode,ye)||De.some(Re=>Re===ye||Qe(Re,ye));V.current=!ve,F.current=Ue.pointerType||"keyboard",ye?.closest(`[${L5}]`)&&($.current=!0)}function Be(){F.current="keyboard"}return os(gt(pe,"pointerdown",Ne,!0),gt(pe,"pointerup",je,!0),gt(pe,"pointercancel",je,!0),gt(pe,"keydown",Be,!0))},[o,N,S,le,w,U,ze]),x.useEffect(()=>{if(o||!m)return;const pe=pt(le);function je(){$.current=!0,oe.start(0,()=>{$.current=!1})}function Ne(De){const ve=zn(De);nb(ve)&&(G.current=ve)}function Be(De){const ve=De.relatedTarget,Re=De.currentTarget,Le=zn(De);queueMicrotask(()=>{const $e=M(),He=y.context.triggerElements,we=ze(),ie=ve?.hasAttribute(Tc("focus-guard"))&&[X.current,H.current,U?.beforeInsideRef.current,U?.afterInsideRef.current,U?.beforeOutsideRef.current,U?.afterOutsideRef.current,Us(b),Us(h)].includes(ve),Ce=!(Qe(S,ve)||Qe(N,ve)||Qe(ve,N)||Qe(U?.portalNode,ve)||we.some(Ee=>Ee===ve||Qe(Ee,ve))||ve!=null&&He.hasElement(ve)||He.hasMatchingElement(Ee=>Qe(Ee,ve))||ie||L&&(zr(L.nodesRef.current,$e).find(Ee=>Qe(Ee.context?.elements.floating,ve)||Qe(Ee.context?.elements.domReference,ve))||O1(L.nodesRef.current,$e).find(Ee=>[Ee.context?.elements.floating,Jd(Ee.context?.elements.floating)].includes(ve)||Ee.context?.elements.domReference===ve)));if(Re===S&&le&&V1(le,z),u&&Re!==S&&!Lf(Le)&&Hn(pe)===pe.body){if(Vt(le)&&(le.focus(),u==="popup")){ne.request(()=>{le.focus()});return}const Ee=fe(),Se=G.current,qe=(Se&&Ee.includes(Se)?Se:null)||Ee[Ee.length-1]||le;Vt(qe)&&qe.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(A||!p)&&ve&&Ce&&!$.current&&(A||ve!==Tg())&&(q.current=!0,y.setOpen(!1,at(_o,De)))})}function Ue(){V.current||(R.current.insideReactTree=!0,J.start(0,()=>{R.current.insideReactTree=!1}))}const ye=Vt(S)?S:null;if(!(!N&&!ye))return os(ye&&gt(ye,"focusout",Be),ye&&gt(ye,"pointerdown",je),N&&gt(N,"focusin",Ne),N&&gt(N,"focusout",Be),N&&U&&gt(N,"focusout",Ue,!0))},[o,S,N,le,p,L,U,y,m,u,fe,A,M,z,R,J,oe,ne,h,b,ze]),x.useEffect(()=>{if(o||!N||!w)return;const pe=Array.from(U?.portalNode?.querySelectorAll(`[${Tc("portal")}]`)||[]),Ne=(L?O1(L.nodesRef.current,M()):[]).find(Re=>qh(Re.context?.elements.domReference||null))?.context?.elements.domReference,Ue=[...[N,...pe,X.current,H.current,U?.beforeOutsideRef.current,U?.afterOutsideRef.current,...ze()],Ne,Us(b),Us(h),A?S:null].filter(Re=>Re!=null),ye=L1(Ue,{ariaHidden:p||A,mark:!1}),De=[N,...pe].filter(Re=>Re!=null),ve=L1(De);return()=>{ve(),ye()}},[w,o,S,N,p,U,A,L,M,h,b,ze]),Ie(()=>{if(!w||o||!Vt(le))return;const pe=pt(le),je=Hn(pe);queueMicrotask(()=>{const Ne=I.current,Be=typeof Ne=="function"?Ne(P.current||""):Ne;if(Be===void 0||Be===!1||Qe(le,je))return;let ye=null;const De=()=>(ye==null&&(ye=fe(le)),ye[0]||le);let ve;Be===!0||Be===null?ve=De():ve=Us(Be),ve=ve||De();const Re=Qe(le,Hn(pe));Bd(ve,{preventScroll:ve===le,shouldFocus(){if(Re)return!0;const Le=Hn(pe);return!(Le!==ve&&Qe(le,Le))}})})},[o,w,le,fe,I,P]),Ie(()=>{if(o||!le)return;const pe=pt(le),je=Hn(pe);q5(je);function Ne(Ue){if(Ue.open||(K.current=V5(Ue.nativeEvent,F.current)),Ue.reason===jn&&Ue.nativeEvent.type==="mouseleave"&&(q.current=!0),Ue.reason===Df)if(Ue.nested)q.current=!1;else if(Gx(Ue.nativeEvent)||Zk(Ue.nativeEvent))q.current=!1;else{let ye=!1;pt(le).createElement("div").focus({get preventScroll(){return ye=!0,!1}}),ye?q.current=!1:q.current=!0}}E.on("openchange",Ne);function Be(){const Ue=D.current;let ye=typeof Ue=="function"?Ue(K.current):Ue;if(ye===void 0||ye===!1)return null;if(ye===null&&(ye=!0),typeof ye=="boolean")return S?.isConnected?S:Tg()||null;const De=S?.isConnected?S:Tg();return Us(ye)||De||null}return()=>{E.off("openchange",Ne);const Ue=Hn(pe),ye=ze(),De=Qe(N,Ue)||ye.some(Le=>Le===Ue||Qe(Le,Ue))||L&&zr(L.nodesRef.current,M(),!1).some(Le=>Qe(Le.context?.elements.floating,Ue)),ve=D.current,Re=Be();queueMicrotask(()=>{const Le=$5(Re),$e=typeof ve!="boolean";ve&&!q.current&&Vt(Le)&&(!(!$e&&Le!==Ue&&Ue!==pe.body)||De)&&Le.focus({preventScroll:!0}),q.current=!1})}},[o,N,le,D,E,L,S,M,ze]),Ie(()=>{if(!Fx||w||!N)return;const pe=Hn(pt(N));!Vt(pe)||!zf(pe)||Qe(N,pe)&&pe.blur()},[w,N]),Ie(()=>{if(!(o||!U))return U.setFocusManagerState({modal:p,closeOnFocusOut:m,open:w,onOpenChange:y.setOpen,domReference:S}),()=>{U.setFocusManagerState(null)}},[o,U,p,w,y,m,S]),Ie(()=>{if(!(o||!le))return V1(le,z),()=>{queueMicrotask(cb)}},[o,le,z]);const be=!o&&(p?!A:!0)&&(te||p);return r.jsxs(x.Fragment,{children:[be&&r.jsx(Ul,{"data-type":"inside",ref:Q,onFocus:pe=>{if(p){const je=fe();Bd(je[je.length-1])}else U?.portalNode&&(q.current=!1,Rl(pe,U.portalNode)?ab(S)?.focus():Us(b??U.beforeOutsideRef)?.focus())}}),s,be&&r.jsx(Ul,{"data-type":"inside",ref:Y,onFocus:pe=>{p?Bd(fe()[0]):U?.portalNode&&(m&&(q.current=!0),Rl(pe,U.portalNode)?yS(S)?.focus():Us(h??U.afterOutsideRef)?.focus())}})]})}function IS(e,t={}){const{enabled:s=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:p=0,reason:m=Il}=t,g="rootStore"in e?e.rootStore:e,h=g.context.dataRef,b=x.useRef(void 0),_=Bl(),k=wn(),C=x.useMemo(()=>{function y(S,N,E,R){const M=at(m,N,E);S&&R==="touch"&&p>0?k.start(p,()=>{g.setOpen(!0,M)}):g.setOpen(S,M)}function w(S,N,E){const R=h.current.openEvent,M=g.select("domReferenceElement")!==N;return S&&M||!S||!l?!0:R&&u?!E(R.type):!1}return{onPointerDown(S){b.current=S.pointerType},onMouseDown(S){const N=b.current,E=S.nativeEvent,R=g.select("open");if(S.button!==0||o==="click"||vo(N,!0)&&c)return;const M=w(R,S.currentTarget,z=>z==="click"||z==="mousedown"),T=zn(E);if(zf(T)){y(M,E,T,N);return}const A=S.currentTarget;_.request(()=>{y(M,E,A,N)})},onClick(S){if(o==="mousedown-only")return;const N=b.current;if(o==="mousedown"&&N){b.current=void 0;return}if(vo(N,!0)&&c)return;const E=g.select("open"),R=w(E,S.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");y(R,S.nativeEvent,S.currentTarget,N)},onKeyDown(){b.current=void 0}}},[h,o,c,m,g,u,l,_,k,p]);return x.useMemo(()=>s?{reference:C}:Gt,[s,C])}function F5(e,t){let s=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},u=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",m=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let g=c.width,h=c.height,b=c.x,_=c.y;return s==null&&t.x&&u&&(s=c.x-t.x),o==null&&t.y&&p&&(o=c.y-t.y),b-=s||0,_-=o||0,g=0,h=0,!l||m?(g=t.axis==="y"?c.width:0,h=t.axis==="x"?c.height:0,b=u&&t.x!=null?t.x:b,_=p&&t.y!=null?t.y:_):l&&!m&&(h=t.axis==="x"?c.height:h,g=t.axis==="y"?c.width:g),l=!0,{width:g,height:h,x:b,y:_,top:_,right:b+g,bottom:_+h,left:b}}}}function q1(e){return e!=null&&e.clientX!=null}function G5(e,t={}){const{enabled:s=!0,axis:o="both"}=t,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.context.dataRef,g=x.useRef(!1),h=x.useRef(null),[b,_]=x.useState(),[k,C]=x.useState([]),y=Ve(R=>{l.set("positionReference",R)}),w=Ve((R,M,T)=>{g.current||m.current.openEvent&&!q1(m.current.openEvent)||l.set("positionReference",F5(T??p,{x:R,y:M,axis:o,dataRef:m,pointerType:b}))}),S=Ve(R=>{c?h.current||(w(R.clientX,R.clientY,R.currentTarget),C([])):w(R.clientX,R.clientY,R.currentTarget)}),N=vo(b)?u:c;x.useEffect(()=>{if(!s){y(p);return}if(!N)return;function R(){h.current?.(),h.current=null}const M=Zt(u);function T(A){const z=zn(A);Qe(u,z)?R():w(A.clientX,A.clientY)}return!m.current.openEvent||q1(m.current.openEvent)?h.current=gt(M,"mousemove",T):y(p),R},[N,s,u,m,p,l,w,y,k]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{s&&!u&&(g.current=!1)},[s,u]),x.useEffect(()=>{!s&&c&&(g.current=!0)},[s,c]);const E=x.useMemo(()=>{function R(M){_(M.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:S,onMouseEnter:S}},[S]);return x.useMemo(()=>s?{reference:E,trigger:E}:{},[s,E])}const Y5={intentional:"onClick",sloppy:"onPointerDown"};function X5(){return!1}function K5(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function If(e,t={}){const{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=X5,referencePressEvent:p="sloppy",bubbles:m,externalTree:g}=t,h="rootStore"in e?e.rootStore:e,b=h.useState("open"),_=h.useState("floatingElement"),{dataRef:k}=h.context,C=Br(g),y=Ve(typeof l=="function"?l:()=>!1),w=typeof l=="function"?y:l,S=w!==!1,N=Ve(()=>c),{escapeKey:E,outsidePress:R}=K5(m),M=x.useRef(!1),T=x.useRef(!1),A=x.useRef(!1),z=x.useRef(!1),I=x.useRef(""),D=x.useRef(null),P=wn(),L=wn(),U=Ve(()=>{L.clear(),k.current.insideReactTree=!1}),q=Ve(Y=>{const J=k.current.floatingContext?.nodeId;return(C?zr(C.nodesRef.current,J):[]).some(ne=>ne.context?.open&&!ne.context.dataRef.current[Y])}),$=Ve(Y=>kg(Y,h.select("floatingElement"))||kg(Y,h.select("domReferenceElement"))),V=Ve(Y=>{u()&&h.setOpen(!1,at(Il,Y.nativeEvent))}),G=Ve(Y=>{if(!b||!s||!o||Y.key!=="Escape"||z.current||!E&&q("__escapeKeyBubbles"))return;const J=M3(Y)?Y.nativeEvent:Y,oe=at(Pf,J);h.setOpen(!1,oe),oe.isCanceled||Y.preventDefault(),!E&&!oe.isPropagationAllowed&&Y.stopPropagation()}),K=Ve(()=>{k.current.insideReactTree=!0,L.start(0,U)}),F=Ve(Y=>{if(!b||!s||Y.button!==0)return;const J=zn(Y.nativeEvent);Qe(h.select("floatingElement"),J)&&(M.current||(M.current=!0,T.current=!1))}),X=Ve(Y=>{!b||!s||(Y.defaultPrevented||Y.nativeEvent.defaultPrevented)&&M.current&&(T.current=!0)});x.useEffect(()=>{if(!b||!s)return;k.current.__escapeKeyBubbles=E,k.current.__outsidePressBubbles=R;const Y=new Fa,J=new Fa;function oe(){Y.clear(),z.current=!0}function ne(){Y.start(Af()?5:0,()=>{z.current=!1})}function te(){A.current=!0,J.start(0,()=>{A.current=!1})}function le(){M.current=!1,T.current=!1}function fe(){const ie=I.current,Ce=ie==="pen"||!ie?"mouse":ie,Ee=N(),Se=typeof Ee=="function"?Ee():Ee;return typeof Se=="string"?Se:Se[Ce]}function ze(ie){const Ce=fe();return Ce==="intentional"&&ie.type!=="click"||Ce==="sloppy"&&ie.type==="click"}function be(ie){const Ce=k.current.floatingContext?.nodeId,Ee=C&&zr(C.nodesRef.current,Ce).some(Se=>kg(ie,Se.context?.elements.floating));return $(ie)||Ee}function pe(ie){if(ze(ie)){ie.type!=="click"&&!$(ie)&&(J.clear(),A.current=!1),U();return}if(k.current.insideReactTree){U();return}const Ce=zn(ie),Ee=`[${Tc("inert")}]`,Se=mt(Ce)?Ce.getRootNode():null,qe=Array.from((Ll(Se)?Se:pt(h.select("floatingElement"))).querySelectorAll(Ee)),st=h.context.triggerElements;if(Ce&&(st.hasElement(Ce)||st.hasMatchingElement(me=>Qe(me,Ce))))return;let Nt=mt(Ce)?Ce:null;for(;Nt&&!rs(Nt);){const me=us(Nt);if(rs(me)||!mt(me))break;Nt=me}if(!(qe.length&&mt(Ce)&&!L3(Ce)&&!Qe(Ce,h.select("floatingElement"))&&qe.every(me=>!Qe(Nt,me)))){if(Vt(Ce)&&!("touches"in ie)){const me=rs(Ce),Me=ca(Ce),Pe=/auto|scroll/,Fe=me||Pe.test(Me.overflowX),rt=me||Pe.test(Me.overflowY),rn=Fe&&Ce.clientWidth>0&&Ce.scrollWidth>Ce.clientWidth,qt=rt&&Ce.clientHeight>0&&Ce.scrollHeight>Ce.clientHeight,xt=Me.direction==="rtl",At=qt&&(xt?ie.offsetX<=Ce.offsetWidth-Ce.clientWidth:ie.offsetX>Ce.clientWidth),Jt=rn&&ie.offsetY>Ce.clientHeight;if(At||Jt)return}if(!be(ie)){if(fe()==="intentional"&&A.current){J.clear(),A.current=!1;return}typeof w=="function"&&!w(ie)||q("__outsidePressBubbles")||(h.setOpen(!1,at(Df,ie)),U())}}}function je(ie){fe()!=="sloppy"||ie.pointerType==="touch"||!h.select("open")||!s||$(ie)||pe(ie)}function Ne(ie){if(fe()!=="sloppy"||!h.select("open")||!s||$(ie))return;const Ce=ie.touches[0];Ce&&(D.current={startTime:Date.now(),startX:Ce.clientX,startY:Ce.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},P.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function Be(ie,Ce){const Ee=zn(ie);if(!Ee)return;const Se=gt(Ee,ie.type,()=>{Ce(ie),Se()})}function Ue(ie){I.current="touch",Be(ie,Ne)}function ye(ie){P.clear(),ie.type==="pointerdown"&&(I.current=ie.pointerType),!(ie.type==="mousedown"&&D.current&&!D.current.dismissOnMouseDown)&&Be(ie,Ce=>{Ce.type==="pointerdown"?je(Ce):pe(Ce)})}function De(ie){if(!M.current)return;const Ce=T.current;if(le(),fe()==="intentional"){if(ie.type==="pointercancel"){Ce&&te();return}if(!be(ie)){if(Ce){te();return}typeof w=="function"&&!w(ie)||(J.clear(),A.current=!0,U())}}}function ve(ie){if(fe()!=="sloppy"||!D.current||$(ie))return;const Ce=ie.touches[0];if(!Ce)return;const Ee=Math.abs(Ce.clientX-D.current.startX),Se=Math.abs(Ce.clientY-D.current.startY),qe=Math.sqrt(Ee*Ee+Se*Se);qe>5&&(D.current.dismissOnTouchEnd=!0),qe>10&&(pe(ie),P.clear(),D.current=null)}function Re(ie){Be(ie,ve)}function Le(ie){fe()!=="sloppy"||!D.current||$(ie)||(D.current.dismissOnTouchEnd&&pe(ie),P.clear(),D.current=null)}function $e(ie){Be(ie,Le)}const He=pt(_),we=os(o&&os(gt(He,"keydown",G),gt(He,"compositionstart",oe),gt(He,"compositionend",ne)),S&&os(gt(He,"click",ye,!0),gt(He,"pointerdown",ye,!0),gt(He,"pointerup",De,!0),gt(He,"pointercancel",De,!0),gt(He,"mousedown",ye,!0),gt(He,"mouseup",De,!0),gt(He,"touchstart",Ue,!0),gt(He,"touchmove",Re,!0),gt(He,"touchend",$e,!0)));return()=>{we(),Y.clear(),J.clear(),le(),A.current=!1}},[k,_,o,S,w,b,s,E,R,G,U,N,q,$,C,h,P]),x.useEffect(U,[w,U]);const H=x.useMemo(()=>({onKeyDown:G,[Y5[p]]:V,...p!=="intentional"&&{onClick:V}}),[G,V,p]),Q=x.useMemo(()=>({onKeyDown:G,onPointerDown:X,onMouseDown:X,onClickCapture:K,onMouseDownCapture(Y){K(),F(Y)},onPointerDownCapture(Y){K(),F(Y)},onMouseUpCapture:K,onTouchEndCapture:K,onTouchMoveCapture:K}),[G,K,F,X]);return x.useMemo(()=>s?{reference:H,floating:Q,trigger:H}:{},[s,H,Q])}function $1(e,t,s){let{reference:o,floating:l}=e;const c=Da(t),u=tb(t),p=eb(u),m=ia(t),g=c==="y",h=o.x+o.width/2-l.width/2,b=o.y+o.height/2-l.height/2,_=o[p]/2-l[p]/2;let k;switch(m){case"top":k={x:h,y:o.y-l.height};break;case"bottom":k={x:h,y:o.y+o.height};break;case"right":k={x:o.x+o.width,y:b};break;case"left":k={x:o.x-l.width,y:b};break;default:k={x:o.x,y:o.y}}switch(Lr(t)){case"start":k[u]-=_*(s&&g?-1:1);break;case"end":k[u]+=_*(s&&g?-1:1);break}return k}async function Q5(e,t){var s;t===void 0&&(t={});const{x:o,y:l,platform:c,rects:u,elements:p,strategy:m}=e,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:b="floating",altBoundary:_=!1,padding:k=0}=Ys(t,e),C=iS(k),w=p[_?b==="floating"?"reference":"floating":b],S=Ec(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(w)))==null||s?w:w.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(p.floating)),boundary:g,rootBoundary:h,strategy:m})),N=b==="floating"?{x:o,y:l,width:u.floating.width,height:u.floating.height}:u.reference,E=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p.floating)),R=await(c.isElement==null?void 0:c.isElement(E))?await(c.getScale==null?void 0:c.getScale(E))||{x:1,y:1}:{x:1,y:1},M=Ec(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:N,offsetParent:E,strategy:m}):N);return{top:(S.top-M.top+C.top)/R.y,bottom:(M.bottom-S.bottom+C.bottom)/R.y,left:(S.left-M.left+C.left)/R.x,right:(M.right-S.right+C.right)/R.x}}const Z5=50,W5=async(e,t,s)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:u}=s,p=u.detectOverflow?u:{...u,detectOverflow:Q5},m=await(u.isRTL==null?void 0:u.isRTL(t));let g=await u.getElementRects({reference:e,floating:t,strategy:l}),{x:h,y:b}=$1(g,o,m),_=o,k=0;const C={};for(let y=0;y<c.length;y++){const w=c[y];if(!w)continue;const{name:S,fn:N}=w,{x:E,y:R,data:M,reset:T}=await N({x:h,y:b,initialPlacement:o,placement:_,strategy:l,middlewareData:C,rects:g,platform:p,elements:{reference:e,floating:t}});h=E??h,b=R??b,C[S]={...C[S],...M},T&&k<Z5&&(k++,typeof T=="object"&&(T.placement&&(_=T.placement),T.rects&&(g=T.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:l}):T.rects),{x:h,y:b}=$1(g,_,m)),y=-1)}return{x:h,y:b,placement:_,strategy:l,middlewareData:C}},J5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,o;const{placement:l,middlewareData:c,rects:u,initialPlacement:p,platform:m,elements:g}=t,{mainAxis:h=!0,crossAxis:b=!0,fallbackPlacements:_,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:y=!0,...w}=Ys(e,t);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const S=ia(l),N=Da(p),E=ia(p)===p,R=await(m.isRTL==null?void 0:m.isRTL(g.floating)),M=_||(E||!y?[nf(p)]:a5(p)),T=C!=="none";!_&&T&&M.push(...l5(p,y,C,R));const A=[p,...M],z=await m.detectOverflow(t,w),I=[];let D=((o=c.flip)==null?void 0:o.overflows)||[];if(h&&I.push(z[S]),b){const q=n5(l,u,R);I.push(z[q[0]],z[q[1]])}if(D=[...D,{placement:l,overflows:I}],!I.every(q=>q<=0)){var P,L;const q=(((P=c.flip)==null?void 0:P.index)||0)+1,$=A[q];if($&&(!(b==="alignment"?N!==Da($):!1)||D.every(K=>Da(K.placement)===N?K.overflows[0]>0:!0)))return{data:{index:q,overflows:D},reset:{placement:$}};let V=(L=D.filter(G=>G.overflows[0]<=0).sort((G,K)=>G.overflows[1]-K.overflows[1])[0])==null?void 0:L.placement;if(!V)switch(k){case"bestFit":{var U;const G=(U=D.filter(K=>{if(T){const F=Da(K.placement);return F===N||F==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(F=>F>0).reduce((F,X)=>F+X,0)]).sort((K,F)=>K[1]-F[1])[0])==null?void 0:U[0];G&&(V=G);break}case"initialPlacement":V=p;break}if(l!==V)return{reset:{placement:V}}}return{}}}};function F1(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function G1(e){return e5.some(t=>e[t]>=0)}const eO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:o}=t,{strategy:l="referenceHidden",...c}=Ys(e,t);switch(l){case"referenceHidden":{const u=await o.detectOverflow(t,{...c,elementContext:"reference"}),p=F1(u,s.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:G1(p)}}}case"escaped":{const u=await o.detectOverflow(t,{...c,altBoundary:!0}),p=F1(u,s.floating);return{data:{escapedOffsets:p,escaped:G1(p)}}}default:return{}}}}},BS=new Set(["left","top"]);async function tO(e,t){const{placement:s,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),u=ia(s),p=Lr(s),m=Da(s)==="y",g=BS.has(u)?-1:1,h=c&&m?-1:1,b=Ys(t,e);let{mainAxis:_,crossAxis:k,alignmentAxis:C}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return p&&typeof C=="number"&&(k=p==="end"?C*-1:C),m?{x:k*h,y:_*g}:{x:_*g,y:k*h}}const nO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,o;const{x:l,y:c,placement:u,middlewareData:p}=t,m=await tO(t,e);return u===((s=p.offset)==null?void 0:s.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:u}}}}},aO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:o,placement:l,platform:c}=t,{mainAxis:u=!0,crossAxis:p=!1,limiter:m={fn:S=>{let{x:N,y:E}=S;return{x:N,y:E}}},...g}=Ys(e,t),h={x:s,y:o},b=await c.detectOverflow(t,g),_=Da(ia(l)),k=Jx(_);let C=h[k],y=h[_];if(u){const S=k==="y"?"top":"left",N=k==="y"?"bottom":"right",E=C+b[S],R=C-b[N];C=Fh(E,C,R)}if(p){const S=_==="y"?"top":"left",N=_==="y"?"bottom":"right",E=y+b[S],R=y-b[N];y=Fh(E,y,R)}const w=m.fn({...t,[k]:C,[_]:y});return{...w,data:{x:w.x-s,y:w.y-o,enabled:{[k]:u,[_]:p}}}}}},sO=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:o,placement:l,rects:c,middlewareData:u}=t,{offset:p=0,mainAxis:m=!0,crossAxis:g=!0}=Ys(e,t),h={x:s,y:o},b=Da(l),_=Jx(b);let k=h[_],C=h[b];const y=Ys(p,t),w=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(m){const E=_==="y"?"height":"width",R=c.reference[_]-c.floating[E]+w.mainAxis,M=c.reference[_]+c.reference[E]-w.mainAxis;k<R?k=R:k>M&&(k=M)}if(g){var S,N;const E=_==="y"?"width":"height",R=BS.has(ia(l)),M=c.reference[b]-c.floating[E]+(R&&((S=u.offset)==null?void 0:S[b])||0)+(R?0:w.crossAxis),T=c.reference[b]+c.reference[E]+(R?0:((N=u.offset)==null?void 0:N[b])||0)-(R?w.crossAxis:0);C<M?C=M:C>T&&(C=T)}return{[_]:k,[b]:C}}}},rO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,o;const{placement:l,rects:c,platform:u,elements:p}=t,{apply:m=()=>{},...g}=Ys(e,t),h=await u.detectOverflow(t,g),b=ia(l),_=Lr(l),k=Da(l)==="y",{width:C,height:y}=c.floating;let w,S;b==="top"||b==="bottom"?(w=b,S=_===(await(u.isRTL==null?void 0:u.isRTL(p.floating))?"start":"end")?"left":"right"):(S=b,w=_==="end"?"top":"bottom");const N=y-h.top-h.bottom,E=C-h.left-h.right,R=Hl(y-h[w],N),M=Hl(C-h[S],E),T=!t.middlewareData.shift;let A=R,z=M;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(z=E),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(A=N),T&&!_){const D=ya(h.left,0),P=ya(h.right,0),L=ya(h.top,0),U=ya(h.bottom,0);k?z=C-2*(D!==0||P!==0?D+P:ya(h.left,h.right)):A=y-2*(L!==0||U!==0?L+U:ya(h.top,h.bottom))}await m({...t,availableWidth:z,availableHeight:A});const I=await u.getDimensions(p.floating);return C!==I.width||y!==I.height?{reset:{rects:!0}}:{}}}};function US(e){const t=ca(e);let s=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const l=Vt(e),c=l?e.offsetWidth:s,u=l?e.offsetHeight:o,p=tf(s)!==c||tf(o)!==u;return p&&(s=c,o=u),{width:s,height:o,$:p}}function db(e){return mt(e)?e:e.contextElement}function Tl(e){const t=db(e);if(!Vt(t))return ls(1);const s=t.getBoundingClientRect(),{width:o,height:l,$:c}=US(t);let u=(c?tf(s.width):s.width)/o,p=(c?tf(s.height):s.height)/l;return(!u||!Number.isFinite(u))&&(u=1),(!p||!Number.isFinite(p))&&(p=1),{x:u,y:p}}const oO=ls(0);function HS(e){const t=Zt(e);return!Af()||!t.visualViewport?oO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lO(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==Zt(e)?!1:t}function jo(e,t,s,o){t===void 0&&(t=!1),s===void 0&&(s=!1);const l=e.getBoundingClientRect(),c=db(e);let u=ls(1);t&&(o?mt(o)&&(u=Tl(o)):u=Tl(e));const p=lO(c,s,o)?HS(c):ls(0);let m=(l.left+p.x)/u.x,g=(l.top+p.y)/u.y,h=l.width/u.x,b=l.height/u.y;if(c){const _=Zt(c),k=o&&mt(o)?Zt(o):o;let C=_,y=Hh(C);for(;y&&o&&k!==C;){const w=Tl(y),S=y.getBoundingClientRect(),N=ca(y),E=S.left+(y.clientLeft+parseFloat(N.paddingLeft))*w.x,R=S.top+(y.clientTop+parseFloat(N.paddingTop))*w.y;m*=w.x,g*=w.y,h*=w.x,b*=w.y,m+=E,g+=R,C=Zt(y),y=Hh(C)}}return Ec({width:h,height:b,x:m,y:g})}function Bf(e,t){const s=Of(e).scrollLeft;return t?t.left+s:jo(ms(e)).left+s}function VS(e,t){const s=e.getBoundingClientRect(),o=s.left+t.scrollLeft-Bf(e,s),l=s.top+t.scrollTop;return{x:o,y:l}}function iO(e){let{elements:t,rect:s,offsetParent:o,strategy:l}=e;const c=l==="fixed",u=ms(o),p=t?Mf(t.floating):!1;if(o===u||p&&c)return s;let m={scrollLeft:0,scrollTop:0},g=ls(1);const h=ls(0),b=Vt(o);if((b||!b&&!c)&&((Fn(o)!=="body"||Pr(u))&&(m=Of(o)),b)){const k=jo(o);g=Tl(o),h.x=k.x+o.clientLeft,h.y=k.y+o.clientTop}const _=u&&!b&&!c?VS(u,m):ls(0);return{width:s.width*g.x,height:s.height*g.y,x:s.x*g.x-m.scrollLeft*g.x+h.x+_.x,y:s.y*g.y-m.scrollTop*g.y+h.y+_.y}}function cO(e){return Array.from(e.getClientRects())}function uO(e){const t=ms(e),s=Of(e),o=e.ownerDocument.body,l=ya(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=ya(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let u=-s.scrollLeft+Bf(e);const p=-s.scrollTop;return ca(o).direction==="rtl"&&(u+=ya(t.clientWidth,o.clientWidth)-l),{width:l,height:c,x:u,y:p}}const Y1=25;function dO(e,t){const s=Zt(e),o=ms(e),l=s.visualViewport;let c=o.clientWidth,u=o.clientHeight,p=0,m=0;if(l){c=l.width,u=l.height;const h=Af();(!h||h&&t==="fixed")&&(p=l.offsetLeft,m=l.offsetTop)}const g=Bf(o);if(g<=0){const h=o.ownerDocument,b=h.body,_=getComputedStyle(b),k=h.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,C=Math.abs(o.clientWidth-b.clientWidth-k);C<=Y1&&(c-=C)}else g<=Y1&&(c+=g);return{width:c,height:u,x:p,y:m}}function fO(e,t){const s=jo(e,!0,t==="fixed"),o=s.top+e.clientTop,l=s.left+e.clientLeft,c=Vt(e)?Tl(e):ls(1),u=e.clientWidth*c.x,p=e.clientHeight*c.y,m=l*c.x,g=o*c.y;return{width:u,height:p,x:m,y:g}}function X1(e,t,s){let o;if(t==="viewport")o=dO(e,s);else if(t==="document")o=uO(ms(e));else if(mt(t))o=fO(t,s);else{const l=HS(e);o={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return Ec(o)}function qS(e,t){const s=us(e);return s===t||!mt(s)||rs(s)?!1:ca(s).position==="fixed"||qS(s,t)}function pO(e,t){const s=t.get(e);if(s)return s;let o=Nc(e,[],!1).filter(p=>mt(p)&&Fn(p)!=="body"),l=null;const c=ca(e).position==="fixed";let u=c?us(e):e;for(;mt(u)&&!rs(u);){const p=ca(u),m=Xx(u);!m&&p.position==="fixed"&&(l=null),(c?!m&&!l:!m&&p.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Pr(u)&&!m&&qS(e,u))?o=o.filter(h=>h!==u):l=p,u=us(u)}return t.set(e,o),o}function mO(e){let{element:t,boundary:s,rootBoundary:o,strategy:l}=e;const u=[...s==="clippingAncestors"?Mf(t)?[]:pO(t,this._c):[].concat(s),o],p=X1(t,u[0],l);let m=p.top,g=p.right,h=p.bottom,b=p.left;for(let _=1;_<u.length;_++){const k=X1(t,u[_],l);m=ya(k.top,m),g=Hl(k.right,g),h=Hl(k.bottom,h),b=ya(k.left,b)}return{width:g-b,height:h-m,x:b,y:m}}function gO(e){const{width:t,height:s}=US(e);return{width:t,height:s}}function hO(e,t,s){const o=Vt(t),l=ms(t),c=s==="fixed",u=jo(e,!0,c,t);let p={scrollLeft:0,scrollTop:0};const m=ls(0);function g(){m.x=Bf(l)}if(o||!o&&!c)if((Fn(t)!=="body"||Pr(l))&&(p=Of(t)),o){const k=jo(t,!0,c,t);m.x=k.x+t.clientLeft,m.y=k.y+t.clientTop}else l&&g();c&&!o&&l&&g();const h=l&&!o&&!c?VS(l,p):ls(0),b=u.left+p.scrollLeft-m.x-h.x,_=u.top+p.scrollTop-m.y-h.y;return{x:b,y:_,width:u.width,height:u.height}}function Mg(e){return ca(e).position==="static"}function K1(e,t){if(!Vt(e)||ca(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return ms(e)===s&&(s=s.ownerDocument.body),s}function $S(e,t){const s=Zt(e);if(Mf(e))return s;if(!Vt(e)){let l=us(e);for(;l&&!rs(l);){if(mt(l)&&!Mg(l))return l;l=us(l)}return s}let o=K1(e,t);for(;o&&O3(o)&&Mg(o);)o=K1(o,t);return o&&rs(o)&&Mg(o)&&!Xx(o)?s:o||P3(e)||s}const xO=async function(e){const t=this.getOffsetParent||$S,s=this.getDimensions,o=await s(e.floating);return{reference:hO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function bO(e){return ca(e).direction==="rtl"}const FS={convertOffsetParentRelativeRectToViewportRelativeRect:iO,getDocumentElement:ms,getClippingRect:mO,getOffsetParent:$S,getElementRects:xO,getClientRects:cO,getDimensions:gO,getScale:Tl,isElement:mt,isRTL:bO};function GS(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vO(e,t){let s=null,o;const l=ms(e);function c(){var p;clearTimeout(o),(p=s)==null||p.disconnect(),s=null}function u(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),c();const g=e.getBoundingClientRect(),{left:h,top:b,width:_,height:k}=g;if(p||t(),!_||!k)return;const C=mo(b),y=mo(l.clientWidth-(h+_)),w=mo(l.clientHeight-(b+k)),S=mo(h),E={rootMargin:-C+"px "+-y+"px "+-w+"px "+-S+"px",threshold:ya(0,Hl(1,m))||1};let R=!0;function M(T){const A=T[0].intersectionRatio;if(A!==m){if(!R)return u();A?u(!1,A):o=setTimeout(()=>{u(!1,1e-7)},1e3)}A===1&&!GS(g,e.getBoundingClientRect())&&u(),R=!1}try{s=new IntersectionObserver(M,{...E,root:l.ownerDocument})}catch{s=new IntersectionObserver(M,E)}s.observe(e)}return u(!0),c}function Q1(e,t,s,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,g=db(e),h=l||c?[...g?Nc(g):[],...t?Nc(t):[]]:[];h.forEach(S=>{l&&S.addEventListener("scroll",s,{passive:!0}),c&&S.addEventListener("resize",s)});const b=g&&p?vO(g,s):null;let _=-1,k=null;u&&(k=new ResizeObserver(S=>{let[N]=S;N&&N.target===g&&k&&t&&(k.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var E;(E=k)==null||E.observe(t)})),s()}),g&&!m&&k.observe(g),t&&k.observe(t));let C,y=m?jo(e):null;m&&w();function w(){const S=jo(e);y&&!GS(y,S)&&s(),y=S,C=requestAnimationFrame(w)}return s(),()=>{var S;h.forEach(N=>{l&&N.removeEventListener("scroll",s),c&&N.removeEventListener("resize",s)}),b?.(),(S=k)==null||S.disconnect(),k=null,m&&cancelAnimationFrame(C)}}const _O=nO,yO=aO,jO=J5,wO=rO,kO=eO,SO=sO,CO=(e,t,s)=>{const o=new Map,l={platform:FS,...s},c={...l.platform,_c:o};return W5(e,t,{...l,platform:c})};var NO=typeof document<"u",EO=function(){},Ud=NO?x.useLayoutEffect:EO;function rf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let s,o,l;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(o=s;o--!==0;)if(!rf(e[o],t[o]))return!1;return!0}if(l=Object.keys(e),s=l.length,s!==Object.keys(t).length)return!1;for(o=s;o--!==0;)if(!{}.hasOwnProperty.call(t,l[o]))return!1;for(o=s;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!rf(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function YS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Z1(e,t){const s=YS(e);return Math.round(t*s)/s}function Ag(e){const t=x.useRef(e);return Ud(()=>{t.current=e}),t}function RO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:u}={},transform:p=!0,whileElementsMounted:m,open:g}=e,[h,b]=x.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[_,k]=x.useState(o);rf(_,o)||k(o);const[C,y]=x.useState(null),[w,S]=x.useState(null),N=x.useCallback(K=>{K!==T.current&&(T.current=K,y(K))},[]),E=x.useCallback(K=>{K!==A.current&&(A.current=K,S(K))},[]),R=c||C,M=u||w,T=x.useRef(null),A=x.useRef(null),z=x.useRef(h),I=m!=null,D=Ag(m),P=Ag(l),L=Ag(g),U=x.useCallback(()=>{if(!T.current||!A.current)return;const K={placement:t,strategy:s,middleware:_};P.current&&(K.platform=P.current),CO(T.current,A.current,K).then(F=>{const X={...F,isPositioned:L.current!==!1};q.current&&!rf(z.current,X)&&(z.current=X,is.flushSync(()=>{b(X)}))})},[_,t,s,P,L]);Ud(()=>{g===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,b(K=>({...K,isPositioned:!1})))},[g]);const q=x.useRef(!1);Ud(()=>(q.current=!0,()=>{q.current=!1}),[]),Ud(()=>{if(R&&(T.current=R),M&&(A.current=M),R&&M){if(D.current)return D.current(R,M,U);U()}},[R,M,U,D,I]);const $=x.useMemo(()=>({reference:T,floating:A,setReference:N,setFloating:E}),[N,E]),V=x.useMemo(()=>({reference:R,floating:M}),[R,M]),G=x.useMemo(()=>{const K={position:s,left:0,top:0};if(!V.floating)return K;const F=Z1(V.floating,h.x),X=Z1(V.floating,h.y);return p?{...K,transform:"translate("+F+"px, "+X+"px)",...YS(V.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:F,top:X}},[s,p,V.floating,h.x,h.y]);return x.useMemo(()=>({...h,update:U,refs:$,elements:V,floatingStyles:G}),[h,U,$,V,G])}const TO=(e,t)=>{const s=_O(e);return{name:s.name,fn:s.fn,options:[e,t]}},MO=(e,t)=>{const s=yO(e);return{name:s.name,fn:s.fn,options:[e,t]}},AO=(e,t)=>({fn:SO(e).fn,options:[e,t]}),OO=(e,t)=>{const s=jO(e);return{name:s.name,fn:s.fn,options:[e,t]}},zO=(e,t)=>{const s=wO(e);return{name:s.name,fn:s.fn,options:[e,t]}},DO=(e,t)=>{const s=kO(e);return{name:s.name,fn:s.fn,options:[e,t]}},Te=(e,t,s,o,l,c,...u)=>{if(u.length>0)throw new Error(nn(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var Og={exports:{}},zg={};/**
596
+ * @license React
597
+ * use-sync-external-store-shim.production.js
598
+ *
599
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
600
+ *
601
+ * This source code is licensed under the MIT license found in the
602
+ * LICENSE file in the root directory of this source tree.
603
+ */var W1;function PO(){if(W1)return zg;W1=1;var e=Dc();function t(b,_){return b===_&&(b!==0||1/b===1/_)||b!==b&&_!==_}var s=typeof Object.is=="function"?Object.is:t,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function p(b,_){var k=_(),C=o({inst:{value:k,getSnapshot:_}}),y=C[0].inst,w=C[1];return c(function(){y.value=k,y.getSnapshot=_,m(y)&&w({inst:y})},[b,k,_]),l(function(){return m(y)&&w({inst:y}),b(function(){m(y)&&w({inst:y})})},[b]),u(k),k}function m(b){var _=b.getSnapshot;b=b.value;try{var k=_();return!s(b,k)}catch{return!0}}function g(b,_){return _()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:p;return zg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,zg}var J1;function XS(){return J1||(J1=1,Og.exports=PO()),Og.exports}var of=XS(),Dg={exports:{}},Pg={};/**
604
+ * @license React
605
+ * use-sync-external-store-shim/with-selector.production.js
606
+ *
607
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
608
+ *
609
+ * This source code is licensed under the MIT license found in the
610
+ * LICENSE file in the root directory of this source tree.
611
+ */var ej;function LO(){if(ej)return Pg;ej=1;var e=Dc(),t=XS();function s(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var o=typeof Object.is=="function"?Object.is:s,l=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,p=e.useMemo,m=e.useDebugValue;return Pg.useSyncExternalStoreWithSelector=function(g,h,b,_,k){var C=c(null);if(C.current===null){var y={hasValue:!1,value:null};C.current=y}else y=C.current;C=p(function(){function S(T){if(!N){if(N=!0,E=T,T=_(T),k!==void 0&&y.hasValue){var A=y.value;if(k(A,T))return R=A}return R=T}if(A=R,o(E,T))return A;var z=_(T);return k!==void 0&&k(A,z)?(E=T,A):(E=T,R=z)}var N=!1,E,R,M=b===void 0?null:b;return[function(){return S(h())},M===null?void 0:function(){return S(M())}]},[h,b,_,k]);var w=l(g,C[0],C[1]);return u(function(){y.hasValue=!0,y.value=w},[w]),m(w),w},Pg}var tj;function IO(){return tj||(tj=1,Dg.exports=LO()),Dg.exports}var BO=IO();const UO=sb(19),HO=UO?qO:$O;function nt(e,t,s,o,l){return HO(e,t,s,o,l)}function VO(e,t,s,o,l){const c=x.useCallback(()=>t(e.getSnapshot(),s,o,l),[e,t,s,o,l]);return of.useSyncExternalStore(e.subscribe,c,c)}w3({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let s=0;s<e.syncHooks.length;s+=1){const o=e.syncHooks[s],l=o.selector(o.store.state,o.a1,o.a2,o.a3);(o.didChange||!Object.is(o.value,l))&&(t=!0,o.value=l,o.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const s=new Set;for(const l of e.syncHooks)s.add(l.store);const o=[];for(const l of s)o.push(l.subscribe(t));return()=>{for(const l of o)l()}}),of.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function qO(e,t,s,o,l){const c=j3();if(!c)return VO(e,t,s,o,l);const u=c.syncIndex;c.syncIndex+=1;let p;return c.didInitialize?(p=c.syncHooks[u],(p.store!==e||p.selector!==t||!Object.is(p.a1,s)||!Object.is(p.a2,o)||!Object.is(p.a3,l))&&(p.store!==e&&(c.didChangeStore=!0),p.store=e,p.selector=t,p.a1=s,p.a2=o,p.a3=l,p.didChange=!0)):(p={store:e,selector:t,a1:s,a2:o,a3:l,value:t(e.getSnapshot(),s,o,l),didChange:!1},c.syncHooks.push(p)),p.value}function $O(e,t,s,o,l){return BO.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,s,o,l))}class KS{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const s=this.updateTick;for(const o of this.listeners){if(s!==this.updateTick)return;o(t)}}update(t){for(const s in t)if(!Object.is(this.state[s],t[s])){this.setState({...this.state,...t});return}}set(t,s){Object.is(this.state[t],s)||this.setState({...this.state,[t]:s})}notifyAll(){const t={...this.state};this.setState(t)}use(t,s,o,l){return nt(this,t,s,o,l)}}class Uf extends KS{constructor(t,s={},o){super(t),this.context=s,this.selectors=o}useSyncedValue(t,s){x.useDebugValue(t);const o=this;Ie(()=>{o.state[t]!==s&&o.set(t,s)},[o,t,s])}useSyncedValueWithCleanup(t,s){const o=this;Ie(()=>(o.state[t]!==s&&o.set(t,s),()=>{o.set(t,void 0)}),[o,t,s])}useSyncedValues(t){const s=this,o=Object.values(t);Ie(()=>{s.update(t)},[s,...o])}useControlledProp(t,s){x.useDebugValue(t);const o=this,l=s!==void 0;Ie(()=>{l&&!Object.is(o.state[t],s)&&o.setState({...o.state,[t]:s})},[o,t,s,l])}select(t,s,o,l){const c=this.selectors[t];return c(this.state,s,o,l)}useState(t,s,o,l){return x.useDebugValue(t),nt(this,this.selectors[t],s,o,l)}useContextCallback(t,s){x.useDebugValue(t);const o=Ve(s??qn);this.context[t]=o}useStateSetter(t){const s=x.useRef(void 0);return s.current===void 0&&(s.current=o=>{this.set(t,o)}),s.current}observe(t,s){let o;typeof t=="function"?o=t:o=this.selectors[t];let l=o(this.state);return s(l,l,this),this.subscribe(c=>{const u=o(c);if(!Object.is(l,u)){const p=l;l=u,s(u,p,this)}})}}const FO={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class Hf extends Uf{constructor(t){const{syncOnly:s,nested:o,onOpenChange:l,triggerElements:c,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:zS(),nested:o,triggerElements:c},FO),this.syncOnly=s}syncOpenEvent=(t,s)=>{(!t||!this.state.open||s!=null&&A3(s))&&(this.context.dataRef.current.openEvent=t?s:void 0)};dispatchOpenChange=(t,s)=>{this.syncOpenEvent(t,s.event);const o={open:t,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",o)};setOpen=(t,s)=>{if(this.syncOnly){this.context.onOpenChange?.(t,s);return}this.dispatchOpenChange(t,s),this.context.onOpenChange?.(t,s)}}function QS(e){const{popupStore:t,treatPopupAsFloatingElement:s=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:u}=e,p=t.useState("open"),m=t.useState("activeTriggerElement"),g=t.useState(s?"popupElement":"positionerElement"),h=t.context.triggerElements,b=u,_=x.useRef(null);o===void 0&&_.current===null&&(_.current=new Hf({open:p,transitionStatus:void 0,referenceElement:m,floatingElement:g,triggerElements:h,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const k=o??_.current;return t.useSyncedValue("floatingId",l),Ie(()=>{const C={open:p,floatingId:l,referenceElement:m,floatingElement:g};mt(m)&&(C.domReferenceElement=m),k.state.positionReference===k.state.referenceElement&&(C.positionReference=m),k.update(C)},[p,l,m,g,k]),k.context.onOpenChange=b,k.context.nested=c,k}function ni(e,t=!1,s=!1){const[o,l]=x.useState(e&&t?"idle":void 0),[c,u]=x.useState(e);return e&&!c&&(u(!0),l("starting")),!e&&c&&o!=="ending"&&!s&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),Ie(()=>{if(!e&&c&&o!=="ending"&&s){const p=ts.request(()=>{l("ending")});return()=>{ts.cancel(p)}}},[e,c,o,s]),Ie(()=>{if(!e||t)return;const p=ts.request(()=>{l(void 0)});return()=>{ts.cancel(p)}},[t,e]),Ie(()=>{if(!e||!t)return;e&&c&&o!=="idle"&&l("starting");const p=ts.request(()=>{l("idle")});return()=>{ts.cancel(p)}},[t,e,c,o]),{mounted:c,setMounted:u,transitionStatus:o}}let wo=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const GO={[wo.startingStyle]:""},YO={[wo.endingStyle]:""},Ur={transitionStatus(e){return e==="starting"?GO:e==="ending"?YO:null}};function ZS(e,t=!1,s=!0){const o=Bl();return Ve((l,c=null)=>{o.cancel();const u=Us(e);if(u==null)return;const p=u,m=()=>{is.flushSync(l)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function g(){Promise.all(p.getAnimations().map(h=>h.finished)).then(()=>{c?.aborted||m()}).catch(()=>{if(s){c?.aborted||m();return}const h=p.getAnimations();!c?.aborted&&h.length>0&&h.some(b=>b.pending||b.playState!=="finished")&&g()})}if(t){const h=wo.startingStyle;if(!p.hasAttribute(h)){o.request(g);return}const b=new MutationObserver(()=>{p.hasAttribute(h)||(b.disconnect(),g())});b.observe(p,{attributes:!0,attributeFilter:[h]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(g)})}function gs(e){const{enabled:t=!0,open:s,ref:o,onComplete:l}=e,c=Ve(l),u=ZS(o,s,!1);x.useEffect(()=>{if(!t)return;const p=new AbortController;return u(c,p.signal),()=>{p.abort()}},[t,s,c,u])}const qc={tabIndex:-1,[Vh]:""};function WS(e,t,s=!1){const o=yo(),l=Ir()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=t(o,l));const u=e??c.current;return QS({popupStore:u,treatPopupAsFloatingElement:s,floatingRootContext:u.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:u.setOpen}),{store:u,internalStore:c.current}}function XO(e,t){const s=x.useRef(null),o=x.useRef(null);return x.useCallback(l=>{if(e===void 0)return;let c=!1;if(s.current!==null){const u=s.current,p=o.current,m=t.context.triggerElements.getById(u);p&&m===p&&(t.context.triggerElements.delete(u),c=!0),s.current=null,o.current=null}if(l!==null&&(s.current=e,o.current=l,t.context.triggerElements.add(e,l),c=!0),c){const u=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==u&&t.set("triggerCount",u)}},[t,e])}function JS(e,t,s){const o=s?.id??null;(o||t)&&(e.activeTriggerId=o,e.activeTriggerElement=s??null)}function e2(e,t,s,o){const l=s.useState("isMountedByTrigger",e),c=XO(e,s),u=Ve(p=>{if(c(p),!p)return;const m=s.select("open"),g=s.select("activeTriggerId");if(g===e){s.update({activeTriggerElement:p,...m?o:null});return}g==null&&m&&s.update({activeTriggerId:e,activeTriggerElement:p,...o})});return Ie(()=>{l&&s.update({activeTriggerElement:t.current,...o})},[l,s,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:l}}function fb(e){const t=e.useState("open"),s=e.useState("triggerCount");Ie(()=>{if(!t){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,l={};if(e.state.triggerCount!==o&&(l.triggerCount=o),!e.select("activeTriggerId")&&o===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[u,p]=c.value;l.activeTriggerId=u,l.activeTriggerElement=p}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0)&&e.update(l)},[t,e,s])}function pb(e,t,s){const{mounted:o,setMounted:l,transitionStatus:c}=ni(e);t.useSyncedValues({mounted:o,transitionStatus:c});const u=Ve(()=>{l(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),s?.(),t.context.onOpenChangeComplete?.(!1)}),p=t.useState("preventUnmountingOnClose");return gs({enabled:o&&!e&&!p,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:c}}function mb(e,t){e.useSyncedValues(t),Ie(()=>()=>{e.update({activeTriggerProps:Gt,inactiveTriggerProps:Gt,popupProps:Gt})},[e])}function KO(e,t){Ie(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Ie(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class $c{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,s){const o=this.idMap.get(t);o!==s&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(s),this.idMap.set(t,s))}delete(t){const s=this.idMap.get(t);s&&(this.elementsSet.delete(s),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const s of this.elementsSet)if(t(s))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function QO(){return new Hf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new $c,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function gb(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:QO(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Gt,inactiveTriggerProps:Gt,popupProps:Gt}}function t2(e,t,s=!1){return new Hf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:s,onOpenChange:void 0})}const vc=Te(e=>e.triggerIdProp??e.activeTriggerId),hb=Te(e=>e.openProp??e.open),nj=Te(e=>(e.popupElement?.id??e.floatingId)||void 0);function n2(e,t){return t!==void 0&&hb(e)&&vc(e)===t}function ZO(e,t){return n2(e,t)?!0:t!==void 0&&hb(e)&&vc(e)==null&&e.triggerCount===1}const xb={open:hb,mounted:Te(e=>e.mounted),transitionStatus:Te(e=>e.transitionStatus),floatingRootContext:Te(e=>e.floatingRootContext),triggerCount:Te(e=>e.triggerCount),preventUnmountingOnClose:Te(e=>e.preventUnmountingOnClose),payload:Te(e=>e.payload),activeTriggerId:vc,activeTriggerElement:Te(e=>e.mounted?e.activeTriggerElement:null),popupId:nj,isTriggerActive:Te((e,t)=>t!==void 0&&vc(e)===t),isOpenedByTrigger:Te((e,t)=>n2(e,t)),isMountedByTrigger:Te((e,t)=>t!==void 0&&vc(e)===t&&e.mounted),triggerProps:Te((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Te((e,t)=>ZO(e,t)?nj(e):void 0),popupProps:Te(e=>e.popupProps),popupElement:Te(e=>e.popupElement),positionerElement:Te(e=>e.positionerElement)};function a2(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,l=yo(),c=Ir()!=null,u=Kn(()=>new Hf({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new $c,floatingId:l,syncOnly:!1,nested:c})).current;return Ie(()=>{const p={open:t,floatingId:l};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=mt(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),u.update(p)},[t,l,o.reference,o.floating,u]),u.context.onOpenChange=s,u.context.nested=c,u}function WO(e={}){const{nodeId:t,externalTree:s}=e,o=a2(e),l=e.rootContext||o,c=l.useState("referenceElement"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.useState("open"),g=l.useState("floatingId"),[h,b]=x.useState(null),[_,k]=x.useState(void 0),[C,y]=x.useState(void 0),w=x.useRef(null),S=Br(s),N=x.useMemo(()=>({reference:c,floating:u,domReference:p}),[c,u,p]),E=RO({...e,elements:{...N,...h&&{reference:h}}}),R=mt(_)?_:null,M=C===void 0?l.state.floatingElement:C;l.useSyncedValue("referenceElement",_??null),l.useSyncedValue("domReferenceElement",_===void 0?p:R),l.useSyncedValue("floatingElement",M);const T=x.useCallback(L=>{const U=mt(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;b(U),E.refs.setReference(U)},[E.refs]),A=x.useCallback(L=>{(mt(L)||L===null)&&(w.current=L,k(L)),(mt(E.refs.reference.current)||E.refs.reference.current===null||L!==null&&!mt(L))&&E.refs.setReference(L)},[E.refs,k]),z=x.useCallback(L=>{y(L),E.refs.setFloating(L)},[E.refs]),I=x.useMemo(()=>({...E.refs,setReference:A,setFloating:z,setPositionReference:T,domReference:w}),[E.refs,A,z,T]),D=x.useMemo(()=>({...E.elements,domReference:p}),[E.elements,p]),P=x.useMemo(()=>({...E,dataRef:l.context.dataRef,open:m,onOpenChange:l.setOpen,events:l.context.events,floatingId:g,refs:I,elements:D,nodeId:t,rootStore:l}),[E,I,D,t,l,m,g]);return Ie(()=>{p&&(w.current=p)},[p]),Ie(()=>{l.context.dataRef.current.floatingContext=P;const L=S?.nodesRef.current.find(U=>U.id===t);L&&(L.context=P)}),x.useMemo(()=>({...E,context:P,refs:I,elements:D,rootStore:l}),[E,I,D,P,l])}const Lg=Kk&&Xk;function s2(e,t={}){const{enabled:s=!0,delay:o}=t,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=l.context,p=x.useRef(!1),m=x.useRef(null),g=x.useRef(!0),h=wn();x.useEffect(()=>{const _=l.select("domReferenceElement");if(!s)return;const k=Zt(_);function C(){const S=l.select("domReferenceElement");!l.select("open")&&Vt(S)&&S===Hn(pt(S))&&(p.current=!0)}function y(){g.current=!0}function w(){g.current=!1}return os(gt(k,"blur",C),Lg&&gt(k,"keydown",y,!0),Lg&&gt(k,"pointerdown",w,!0))},[l,s]),x.useEffect(()=>{if(!s)return;function _(k){if(k.reason===Il||k.reason===Pf){const C=l.select("domReferenceElement");mt(C)&&(m.current=C,p.current=!0)}}return c.on("openchange",_),()=>{c.off("openchange",_)}},[c,s,l]);const b=x.useMemo(()=>{function _(){p.current=!1,m.current=null}return{onMouseLeave(){_()},onFocus(k){const C=k.currentTarget;if(p.current){if(m.current===C)return;_()}const y=zn(k.nativeEvent);if(mt(y)){if(Lg&&!k.relatedTarget){if(!g.current&&!zf(y))return}else if(!B3(y))return}const w=Wd(k.relatedTarget,l.context.triggerElements),{nativeEvent:S,currentTarget:N}=k,E=typeof o=="function"?o():o;if(l.select("open")&&w||E===0||E===void 0){l.setOpen(!0,at(Nl,S,N));return}h.start(E,()=>{p.current||l.setOpen(!0,at(Nl,S,N))})},onBlur(k){_();const C=k.relatedTarget,y=k.nativeEvent,w=mt(C)&&C.hasAttribute(Tc("focus-guard"))&&C.getAttribute("data-type")==="outside";h.start(0,()=>{const S=l.select("domReferenceElement"),N=Hn(pt(S));!C&&N===S||Qe(u.current.floatingContext?.refs.floating.current,N)||Qe(S,N)||w||Wd(C??N,l.context.triggerElements)||l.setOpen(!1,at(Nl,y))})}}},[u,o,l,h]);return x.useMemo(()=>s?{reference:b,trigger:b}:{},[s,b])}class bb{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Fa,this.restTimeout=new Fa,this.handleCloseOptions=void 0}static create(){return new bb}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const lf=new WeakMap;function cf(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&lf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),lf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function r2(e,t){const{scopeElement:s,referenceElement:o,floatingElement:l}=t,c=lf.get(s);c&&c!==e&&cf(c),cf(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,lf.set(s,e),s.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function vb(e){const t=e.context.dataRef.current,s=Kn(()=>t.hoverInteractionState??bb.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=s),$x(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function o2(e,t={}){const{enabled:s=!0,closeDelay:o=0,nodeId:l}=t,c="rootStore"in e?e.rootStore:e,u=c.useState("open"),p=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:g}=c.context,h=Br(),b=Ir(),_=vb(c),k=wn(),C=Ve(()=>eS(g.current.openEvent?.type,_.interactedInside)),y=Ve(()=>H3(g.current.openEvent?.type)),w=Ve(()=>{cf(_)});Ie(()=>{u||(_.pointerType=void 0,_.restTimeoutPending=!1,_.interactedInside=!1,w())},[u,_,w]),x.useEffect(()=>w,[w]),Ie(()=>{if(s&&u&&_.handleCloseOptions?.blockPointerEvents&&y()&&mt(m)&&p){const S=m,N=p,E=pt(p),R=h?.nodesRef.current.find(z=>z.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const M=_.pointerEventsScopeElement!==N?_.pointerEventsScopeElement:null,T=R!==N?R:null,A=_.handleCloseOptions?.getScope?.()??M??T??S.closest("[data-rootownerid]")??E.body;return r2(_,{scopeElement:A,referenceElement:S,floatingElement:N}),()=>{w()}}},[s,u,m,p,_,y,h,b,w]),x.useEffect(()=>{if(!s)return;function S(){return!!(h&&b&&zr(h.nodesRef.current,b).length>0)}function N(z){const I=ef(o,"close",_.pointerType),D=()=>{c.setOpen(!1,at(jn,z)),h?.events.emit("floating.closed",z)};I?_.openChangeTimeout.start(I,D):(_.openChangeTimeout.clear(),D())}function E(z){const I=zn(z);if(!I3(I)){_.interactedInside=!1;return}_.interactedInside=I?.closest("[aria-haspopup]")!=null}function R(){_.openChangeTimeout.clear(),k.clear(),h?.events.off("floating.closed",T),w()}function M(z){if(S()&&h){h.events.on("floating.closed",T);return}if(Wd(z.relatedTarget,c.context.triggerElements))return;const I=g.current.floatingContext?.nodeId??l,D=z.relatedTarget;if(!(h&&I&&mt(D)&&zr(h.nodesRef.current,I,!1).some(L=>Qe(L.context?.elements.floating,D)))){if(_.handler){_.handler(z);return}w(),C()||N(z)}}function T(z){!h||!b||S()||k.start(0,()=>{h.events.off("floating.closed",T),c.setOpen(!1,at(jn,z)),h.events.emit("floating.closed",z)})}const A=p;return os(A&&gt(A,"mouseenter",R),A&&gt(A,"mouseleave",M),A&&gt(A,"pointerdown",E,!0),()=>{h?.events.off("floating.closed",T)})},[s,p,c,g,o,l,C,w,_,h,b,k])}const JO={current:null};function l2(e,t={}){const{enabled:s=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:u=0,move:p=!0,triggerElementRef:m=JO,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:b,isClosing:_,shouldOpen:k}=t,C="rootStore"in e?e.rootStore:e,{dataRef:y,events:w}=C.context,S=Br(g),N=vb(C),E=x.useRef(!1),R=mn(l),M=mn(o),T=mn(u),A=mn(s),z=mn(k),I=mn(_),D=Ve(()=>eS(y.current.openEvent?.type,N.interactedInside)),P=Ve(()=>z.current?.()!==!1),L=Ve(($,V,G)=>{const K=C.context.triggerElements;if(K.hasElement(V))return!$||!Qe($,V);if(!mt(G))return!1;const F=G;return K.hasMatchingElement(X=>Qe(X,F))&&(!$||!Qe($,F))}),U=Ve(()=>{if(!N.handler)return;pt(C.select("domReferenceElement")).removeEventListener("mousemove",N.handler),N.handler=void 0}),q=Ve(()=>{cf(N)});return h&&(N.handleCloseOptions=R.current?.__options),x.useEffect(()=>U,[U]),x.useEffect(()=>{if(!s)return;function $(V){V.open?E.current=!1:(E.current=V.reason===jn,U(),N.openChangeTimeout.clear(),N.restTimeout.clear(),N.blockMouseMove=!0,N.restTimeoutPending=!1)}return w.on("openchange",$),()=>{w.off("openchange",$)}},[s,w,N,U]),x.useEffect(()=>{if(!s)return;function $(F,X=!0){const H=ef(M.current,"close",N.pointerType);H?N.openChangeTimeout.start(H,()=>{C.setOpen(!1,at(jn,F)),S?.events.emit("floating.closed",F)}):X&&(N.openChangeTimeout.clear(),C.setOpen(!1,at(jn,F)),S?.events.emit("floating.closed",F))}const V=m.current??(h?C.select("domReferenceElement"):null);if(!mt(V))return;function G(F){if(N.openChangeTimeout.clear(),N.blockMouseMove=!1,c&&!vo(N.pointerType))return;const X=N1(T.current),H=ef(M.current,"open",N.pointerType),Q=zn(F),Y=F.currentTarget??null,J=C.select("domReferenceElement");let oe=Y;if(mt(Q)&&!C.context.triggerElements.hasElement(Q)){for(const Ne of C.context.triggerElements.elements())if(Qe(Ne,Q)){oe=Ne;break}}mt(Y)&&mt(J)&&!C.context.triggerElements.hasElement(Y)&&Qe(Y,J)&&(oe=J);const ne=oe==null?!1:L(J,oe,Q),te=C.select("open"),le=I.current?.()??C.select("transitionStatus")==="ending",fe=!te&&le&&E.current,ze=!ne&&mt(oe)&&mt(J)&&Qe(J,oe)&&fe,be=X>0&&!H,pe=ne&&(te||fe)||ze,je=!te||ne;if(pe){P()&&C.setOpen(!0,at(jn,F,oe));return}be||(H?N.openChangeTimeout.start(H,()=>{je&&P()&&C.setOpen(!0,at(jn,F,oe))}):je&&P()&&C.setOpen(!0,at(jn,F,oe)))}function K(F){if(D()){q();return}U();const X=C.select("domReferenceElement"),H=pt(X);N.restTimeout.clear(),N.restTimeoutPending=!1;const Q=y.current.floatingContext??b?.();if(Wd(F.relatedTarget,C.context.triggerElements))return;if(R.current&&Q){C.select("open")||N.openChangeTimeout.clear();const J=m.current;N.handler=R.current({...Q,tree:S,x:F.clientX,y:F.clientY,onClose(){q(),U(),A.current&&!D()&&J===C.select("domReferenceElement")&&$(F,!0)}}),H.addEventListener("mousemove",N.handler),N.handler(F);return}(N.pointerType==="touch"?!Qe(C.select("floatingElement"),F.relatedTarget):!0)&&$(F)}return p?os(gt(V,"mousemove",G,{once:!0}),gt(V,"mouseenter",G),gt(V,"mouseleave",K)):os(gt(V,"mouseenter",G),gt(V,"mouseleave",K))},[U,q,y,M,C,s,R,N,h,L,D,c,p,T,m,S,A,b,I,P]),x.useMemo(()=>{if(!s)return;function $(V){N.pointerType=V.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(V){const{nativeEvent:G}=V,K=V.currentTarget,F=C.select("domReferenceElement"),X=C.select("open"),H=L(F,K,V.target);if(c&&!vo(N.pointerType))return;if(X&&H&&N.handleCloseOptions?.blockPointerEvents){const J=C.select("floatingElement");if(J){const oe=N.handleCloseOptions?.getScope?.()??K.ownerDocument.body;r2(N,{scopeElement:oe,referenceElement:K,floatingElement:J})}}const Q=N1(T.current);if(X&&!H||Q===0||!H&&N.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;N.restTimeout.clear();function Y(){if(N.restTimeoutPending=!1,D())return;const J=C.select("open");!N.blockMouseMove&&(!J||H)&&P()&&C.setOpen(!0,at(jn,G,K))}N.pointerType==="touch"?is.flushSync(()=>{Y()}):H&&X?Y():(N.restTimeoutPending=!0,N.restTimeout.start(Q,Y))}}},[s,N,D,L,c,C,T,P])}const e4="Escape";function Vf(e,t,s){switch(e){case"vertical":return t;case"horizontal":return s;default:return t||s}}function gd(e,t){return Vf(t,e===Kx||e===Hc,e===Er||e===Rr)}function Ig(e,t,s){return Vf(t,e===Hc,s?e===Er:e===Rr)||e==="Enter"||e===" "||e===""}function t4(e,t,s){return Vf(t,s?e===Er:e===Rr,e===Hc)}function n4(e,t,s,o){const l=s?e===Rr:e===Er,c=e===Kx;return t==="both"||t==="horizontal"&&o&&o>1?e===e4:Vf(t,l,c)}function i2(e,t){const{listRef:s,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:_="auto",focusItemOnHover:k=!0,openOnArrowKeyDown:C=!0,disabledIndices:y=void 0,orientation:w="vertical",parentOrientation:S,cols:N=1,id:E,resetOnPointerLeave:R=!0,externalTree:M}=t,T="rootStore"in e?e.rootStore:e,A=T.useState("open"),z=T.useState("floatingElement"),I=T.useState("domReferenceElement"),D=T.context.dataRef,P=Jd(z),L=qh(I),U=mn(P),q=Ir(),$=Br(M),V=x.useRef(_),G=x.useRef(u??-1),K=x.useRef(null),F=x.useRef(!0),X=Ve(we=>{l(G.current===-1?null:G.current,we)}),H=x.useRef(X),Q=x.useRef(!!z),Y=x.useRef(A),J=x.useRef(!1),oe=x.useRef(!1),ne=x.useRef(null),te=mn(y),le=mn(A),fe=mn(u),ze=mn(R),be=Bl(),pe=Bl(),je=Ve(()=>{function we(Se){b?$?.events.emit("virtualfocus",Se):ne.current=Bd(Se,{sync:J.current,preventScroll:!0})}const ie=s.current[G.current],Ce=oe.current;ie&&we(ie),(J.current?Se=>Se():Se=>be.request(Se))(()=>{const Se=s.current[G.current]||ie;if(!Se)return;ie||we(Se),ve&&(Ce||!F.current)&&Se.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Ie(()=>{D.current.orientation=w},[D,w]),Ie(()=>{c&&(A&&z?(G.current=u??-1,V.current&&u!=null&&(oe.current=!0,X())):Q.current&&(G.current=-1,H.current()))},[c,A,z,u,X]),Ie(()=>{if(c){if(!A){J.current=!1;return}if(z)if(o==null){if(J.current=!1,fe.current!=null)return;if(Q.current&&(G.current=-1,je()),(!Y.current||!Q.current)&&V.current&&(K.current!=null||V.current===!0&&K.current==null)){let we=0;const ie=()=>{s.current[0]==null?(we<2&&(we?Ee=>pe.request(Ee):queueMicrotask)(ie),we+=1):(G.current=K.current==null||Ig(K.current,w,h)||g?Id(s):Yh(s),K.current=null,X())};ie()}}else Rc(s.current,o)||(G.current=o,je(),oe.current=!1)}},[c,A,z,o,fe,g,s,w,h,X,je,pe]),Ie(()=>{if(!c||z||!$||b||!Q.current)return;const we=$.nodesRef.current,ie=we.find(Se=>Se.id===q)?.context?.elements.floating,Ce=Hn(pt(z)),Ee=we.some(Se=>Se.context&&Qe(Se.context.elements.floating,Ce));ie&&!Ee&&F.current&&ie.focus({preventScroll:!0})},[c,z,$,q,b]),Ie(()=>{H.current=X,Y.current=A,Q.current=!!z}),Ie(()=>{A||(K.current=null,V.current=_)},[A,_]);const Ne=o!=null,Be=Ve(we=>{if(!le.current)return;const ie=s.current.indexOf(we.currentTarget);ie!==-1&&(G.current!==ie||o!==ie)&&(G.current=ie,X(we))}),Ue=Ve(()=>S??$?.nodesRef.current.find(we=>we.id===q)?.context?.dataRef?.current.orientation),ye=Ve(()=>Id(s,te.current)),De=Ve(we=>{if(F.current=!1,J.current=!0,we.which===229||!le.current&&we.currentTarget===U.current)return;if(g&&n4(we.key,w,h,N)){gd(we.key,Ue())||_a(we),T.setOpen(!1,at($h,we.nativeEvent)),Vt(I)&&(b?$?.events.emit("virtualfocus",I):I.focus());return}const ie=G.current,Ce=Id(s,y),Ee=Yh(s,y);if(L||(we.key==="Home"&&(_a(we),G.current=Ce,X(we)),we.key==="End"&&(_a(we),G.current=Ee,X(we))),N>1){const Se=Array.from({length:s.current.length},()=>({width:1,height:1})),qe=uS(Se,N,!1),st=qe.findIndex(Me=>Me!=null&&!qs(s.current,Me,y)),Nt=qe.reduce((Me,Pe,Fe)=>Pe!=null&&!qs(s.current,Pe,y)?Fe:Me,-1),me=qe[cS(qe.map(Me=>Me!=null?s.current[Me]:null),{event:we,orientation:w,loopFocus:m,rtl:h,cols:N,disabledIndices:fS([...(typeof y!="function"?y:null)||s.current.map((Me,Pe)=>qs(s.current,Pe,y)?Pe:void 0),void 0],qe),minIndex:st,maxIndex:Nt,prevIndex:dS(G.current>Ee?Ce:G.current,Se,qe,N,we.key===Hc?"bl":we.key===(h?Er:Rr)?"tr":"tl"),stopEvent:!0})];if(me!=null&&(G.current=me,X(we)),w==="both")return}if(gd(we.key,w)){if(_a(we),A&&!b&&Hn(we.currentTarget.ownerDocument)===we.currentTarget){G.current=Ig(we.key,w,h)?Ce:Ee,X(we);return}Ig(we.key,w,h)?m?ie>=Ee?p&&ie!==s.current.length?G.current=-1:(J.current=!1,G.current=Ce):G.current=Un(s.current,{startingIndex:ie,disabledIndices:y}):G.current=Math.min(Ee,Un(s.current,{startingIndex:ie,disabledIndices:y})):m?ie<=Ce?p&&ie!==-1?G.current=s.current.length:(J.current=!1,G.current=Ee):G.current=Un(s.current,{startingIndex:ie,decrement:!0,disabledIndices:y}):G.current=Math.max(Ce,Un(s.current,{startingIndex:ie,decrement:!0,disabledIndices:y})),Rc(s.current,G.current)&&(G.current=-1),X(we)}}),ve=x.useMemo(()=>({onFocus(ie){J.current=!0,Be(ie)},onClick:({currentTarget:ie})=>ie.focus({preventScroll:!0}),onMouseMove(ie){J.current=!0,oe.current=!1,k&&Be(ie)},onPointerLeave(ie){if(!le.current||!F.current||ie.pointerType==="touch")return;J.current=!0;const Ce=ie.relatedTarget;if(!(!k||s.current.includes(Ce))&&ze.current&&(ne.current?.(),ne.current=null,G.current=-1,X(ie),!b)){const Ee=U.current,Se=Hn(pt(Ee));Ee&&Qe(Ee,Se)&&Ee.focus({preventScroll:!0})}}}),[Be,le,U,k,s,X,ze,b]),Re=x.useMemo(()=>b&&A&&Ne&&{"aria-activedescendant":`${E}-${o}`},[b,A,Ne,E,o]),Le=x.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...L?{}:Re,onKeyDown(we){if(we.key==="Tab"&&we.shiftKey&&A&&!b){const ie=zn(we.nativeEvent);if(ie&&!Qe(U.current,ie))return;_a(we),T.setOpen(!1,at(_o,we.nativeEvent)),Vt(I)&&I.focus();return}De(we)},onPointerMove(){F.current=!0}}),[Re,De,U,w,L,T,A,b,I]),$e=x.useMemo(()=>{function we(Ee){T.setOpen(!0,at($h,Ee.nativeEvent,Ee.currentTarget))}function ie(Ee){_==="auto"&&Gx(Ee.nativeEvent)&&(V.current=!b)}function Ce(Ee){V.current=_,_==="auto"&&Zk(Ee.nativeEvent)&&(V.current=!0)}return{onKeyDown(Ee){const Se=T.select("open");F.current=!1;const qe=Ee.key.startsWith("Arrow"),st=t4(Ee.key,Ue(),h),Nt=gd(Ee.key,w),me=(g?st:Nt)||Ee.key==="Enter"||Ee.key.trim()==="";if(b&&Se)return De(Ee);if(!(!Se&&!C&&qe)){if(me){const Me=gd(Ee.key,Ue());K.current=g&&Me?null:Ee.key}if(g){st&&(_a(Ee),Se?(G.current=ye(),X(Ee)):we(Ee));return}Nt&&(fe.current!=null&&(G.current=fe.current),_a(Ee),!Se&&C?we(Ee):De(Ee),Se&&X(Ee))}},onFocus(Ee){T.select("open")&&!b&&(G.current=-1,X(Ee))},onPointerDown:Ce,onPointerEnter:Ce,onMouseDown:ie,onClick:ie}},[De,_,ye,g,X,T,C,w,Ue,h,fe,b]),He=x.useMemo(()=>({...Re,...$e}),[Re,$e]);return x.useMemo(()=>c?{reference:He,floating:Le,item:ve,trigger:$e}:{},[c,He,Le,$e,ve])}function c2(e,t){const{listRef:s,elementsRef:o,activeIndex:l,onMatch:c,onTyping:u,enabled:p=!0,resetMs:m=750,selectedIndex:g=null}=t,h="rootStore"in e?e.rootStore:e,b=h.useState("open"),_=wn(),k=x.useRef(""),C=x.useRef(g??l??-1),y=x.useRef(null),w=Ve(E=>{function R(L){const U=o?.current[L];return!U||Lf(U)}function M(L,U,q=0){if(L.length===0)return-1;const $=(q%L.length+L.length)%L.length,V=U.toLocaleLowerCase();for(let G=0;G<L.length;G+=1){const K=($+G)%L.length;if(!(!L[K]?.toLocaleLowerCase().startsWith(V)||!R(K)))return K}return-1}const T=s.current;if(k.current.length>0&&E.key===" "&&(_a(E),u?.(!0)),k.current.length>0&&k.current[0]!==" "&&M(T,k.current)===-1&&E.key!==" "&&u?.(!1),T==null||E.key.length!==1||E.ctrlKey||E.metaKey||E.altKey)return;b&&E.key!==" "&&(_a(E),u?.(!0));const A=k.current==="";A&&(C.current=g??l??-1),T.every(L=>L?L[0]?.toLocaleLowerCase()!==L[1]?.toLocaleLowerCase():!0)&&k.current===E.key&&(k.current="",C.current=y.current),k.current+=E.key,_.start(m,()=>{k.current="",C.current=y.current,u?.(!1)});const D=((A?g??l??-1:C.current)??0)+1,P=M(T,k.current,D);P!==-1?(c?.(P),y.current=P):E.key!==" "&&(k.current="",u?.(!1))}),S=Ve(E=>{const R=E.relatedTarget,M=h.select("domReferenceElement"),T=h.select("floatingElement");Qe(M,R)||Qe(T,R)||(_.clear(),k.current="",C.current=y.current,u?.(!1))});Ie(()=>{!b&&g!==null||(_.clear(),y.current=null,k.current!==""&&(k.current=""))},[b,g,_]),Ie(()=>{b&&k.current===""&&(C.current=g??l??-1)},[b,g,l]);const N=x.useMemo(()=>({onKeyDown:w,onBlur:S}),[w,S]);return x.useMemo(()=>p?{reference:N,floating:N}:{},[p,N])}const aj=.1,a4=aj*aj,Ut=.5;function hd(e,t,s,o,l,c){return o>=t!=c>=t&&e<=(l-s)*(t-o)/(c-o)+s}function xd(e,t,s,o,l,c,u,p,m,g){let h=!1;return hd(e,t,s,o,l,c)&&(h=!h),hd(e,t,l,c,u,p)&&(h=!h),hd(e,t,u,p,m,g)&&(h=!h),hd(e,t,m,g,s,o)&&(h=!h),h}function s4(e,t,s){return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function bd(e,t,s,o,l,c){const u=Math.min(s,l),p=Math.max(s,l),m=Math.min(o,c),g=Math.max(o,c);return e>=u&&e<=p&&t>=m&&t<=g}function u2(e={}){const{blockPointerEvents:t=!1}=e,s=new Fa,o=({x:l,y:c,placement:u,elements:p,onClose:m,nodeId:g,tree:h})=>{const b=u?.split("-")[0];let _=!1,k=null,C=null,y=typeof performance<"u"?performance.now():0;function w(N,E){const R=performance.now(),M=R-y;if(k===null||C===null||M===0)return k=N,C=E,y=R,!1;const T=N-k,A=E-C,z=T*T+A*A,I=M*M*a4;return k=N,C=E,y=R,z<I}function S(){s.clear(),m()}return function(E){s.clear();const R=p.domReference,M=p.floating;if(!R||!M||b==null||l==null||c==null)return;const{clientX:T,clientY:A}=E,z=zn(E),I=E.type==="mouseleave",D=Qe(M,z),P=Qe(R,z);if(D&&(_=!0,!I))return;if(P&&(_=!1,!I)){_=!0;return}if(I&&mt(E.relatedTarget)&&Qe(M,E.relatedTarget))return;function L(){return!!(h&&zr(h.nodesRef.current,g).length>0)}function U(){L()||S()}if(L())return;const q=R.getBoundingClientRect(),$=M.getBoundingClientRect(),V=l>$.right-$.width/2,G=c>$.bottom-$.height/2,K=$.width>q.width,F=$.height>q.height,X=(K?q:$).left,H=(K?q:$).right,Q=(F?q:$).top,Y=(F?q:$).bottom;if(b==="top"&&c>=q.bottom-1||b==="bottom"&&c<=q.top+1||b==="left"&&l>=q.right-1||b==="right"&&l<=q.left+1){U();return}let J=!1;switch(b){case"top":J=bd(T,A,X,q.top+1,H,$.bottom-1);break;case"bottom":J=bd(T,A,X,$.top+1,H,q.bottom-1);break;case"left":J=bd(T,A,$.right-1,Y,q.left+1,Q);break;case"right":J=bd(T,A,q.right-1,Y,$.left+1,Q);break}if(J)return;if(_&&!s4(T,A,q)){U();return}if(!I&&w(T,A)){U();return}let oe=!1;switch(b){case"top":{const ne=K?Ut/2:Ut*4,te=K||V?l+ne:l-ne,le=K?l-ne:V?l+ne:l-ne,fe=c+Ut+1,ze=V||K?$.bottom-Ut:$.top,be=V?K?$.bottom-Ut:$.top:$.bottom-Ut;oe=xd(T,A,te,fe,le,fe,$.left,ze,$.right,be);break}case"bottom":{const ne=K?Ut/2:Ut*4,te=K||V?l+ne:l-ne,le=K?l-ne:V?l+ne:l-ne,fe=c-Ut,ze=V||K?$.top+Ut:$.bottom,be=V?K?$.top+Ut:$.bottom:$.top+Ut;oe=xd(T,A,te,fe,le,fe,$.left,ze,$.right,be);break}case"left":{const ne=F?Ut/2:Ut*4,te=F||G?c+ne:c-ne,le=F?c-ne:G?c+ne:c-ne,fe=l+Ut+1,ze=G||F?$.right-Ut:$.left,be=G?F?$.right-Ut:$.left:$.right-Ut;oe=xd(T,A,ze,$.top,be,$.bottom,fe,te,fe,le);break}case"right":{const ne=F?Ut/2:Ut*4,te=F||G?c+ne:c-ne,le=F?c-ne:G?c+ne:c-ne,fe=l-Ut,ze=G||F?$.left+Ut:$.right,be=G?F?$.left+Ut:$.right:$.left+Ut;oe=xd(T,A,fe,te,fe,le,ze,$.top,be,$.bottom);break}}oe?_||s.start(40,U):U()}};return o.__options={...e,blockPointerEvents:t},o}const r4={...xb,disabled:Te(e=>e.disabled),instantType:Te(e=>e.instantType),isInstantPhase:Te(e=>e.isInstantPhase),trackCursorAxis:Te(e=>e.trackCursorAxis),disableHoverablePopup:Te(e=>e.disableHoverablePopup),lastOpenChangeReason:Te(e=>e.openChangeReason),closeOnClick:Te(e=>e.closeOnClick),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport)};class _b extends Uf{constructor(t,s,o=!1){const l=new $c,c={...o4(),...t};c.floatingRootContext=t2(l,s,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},r4)}setOpen=(t,s)=>{const o=s.reason,l=o===jn,c=t&&o===Nl,u=!t&&(o===Il||o===Pf);if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,s);const p=()=>{const m={open:t,openChangeReason:o};c?m.instantType="focus":u?m.instantType="dismiss":o===jn&&(m.instantType=void 0),JS(m,t,s.trigger),this.update(m)};l?is.flushSync(p):p()};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,at(Il,t))}static useStore(t,s){return WS(t,(l,c)=>new _b(s,l,c)).store}}function o4(){return{...gb(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const l4=qx(function(t){const{disabled:s=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:p,onOpenChange:m,onOpenChangeComplete:g,handle:h,triggerId:b,defaultTriggerId:_=null,children:k}=t,C=_b.useStore(h?.store,{open:o,openProp:l,activeTriggerId:_,triggerIdProp:b});Rf(()=>{l===void 0&&C.state.open===!1&&o===!0&&C.update({open:!0,activeTriggerId:_})}),C.useControlledProp("openProp",l),C.useControlledProp("triggerIdProp",b),C.useContextCallback("onOpenChange",m),C.useContextCallback("onOpenChangeComplete",g);const y=C.useState("open"),w=!s&&y,S=C.useState("activeTriggerId"),N=C.useState("mounted"),E=C.useState("payload");C.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c}),C.useSyncedValue("disabled",s),fb(C);const{forceUnmount:R,transitionStatus:M}=pb(w,C),T=C.useState("isInstantPhase"),A=C.useState("instantType"),z=C.useState("lastOpenChangeReason"),I=x.useRef(null);Ie(()=>{y&&s&&C.setOpen(!1,at(nS))},[y,s,C]),Ie(()=>{M==="ending"&&z===Gs||M!=="ending"&&T?(A!=="delay"&&(I.current=A),C.set("instantType","delay")):I.current!==null&&(C.set("instantType",I.current),I.current=null)},[M,T,z,A,C]),Ie(()=>{w&&S==null&&C.set("payload",void 0)},[C,S,w]);const D=x.useCallback(()=>{C.setOpen(!1,at(Qx))},[C]);x.useImperativeHandle(p,()=>({unmount:R,close:D}),[R,D]);const P=w||N||!s&&u!=="none";return r.jsxs($k.Provider,{value:C,children:[P&&r.jsx(i4,{store:C,disabled:s,trackCursorAxis:u}),typeof k=="function"?k({payload:E}):k]})});function i4({store:e,disabled:t,trackCursorAxis:s}){const o=e.useState("floatingRootContext"),l=If(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=G5(o,{enabled:!t&&s!=="none",axis:s==="none"?void 0:s}),u=x.useMemo(()=>Dn(c.reference,l.reference),[c.reference,l.reference]),p=x.useMemo(()=>Dn(c.trigger,l.trigger),[c.trigger,l.trigger]),m=x.useMemo(()=>Dn(qc,c.floating,l.floating),[c.floating,l.floating]);return mb(e,{activeTriggerProps:u,inactiveTriggerProps:p,popupProps:m}),null}let go=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=wo.startingStyle]="startingStyle",e[e.endingStyle=wo.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),uf=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const c4={[uf.popupOpen]:""},u4={[uf.popupOpen]:"",[uf.pressed]:""},d4={[go.open]:""},f4={[go.closed]:""},p4={[go.anchorHidden]:""},d2={open(e){return e?c4:null}},Zh={open(e){return e?u4:null}},Ro={open(e){return e?d4:f4},anchorHidden(e){return e?p4:null}};function Xa(e){return yo(e,"base-ui")}const f2=x.createContext(void 0);function m4(){return x.useContext(f2)}let g4=(function(e){return e[e.popupOpen=uf.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const h4=600,p2="data-base-ui-tooltip-trigger";function sj(e){if("composedPath"in e){const s=e.composedPath();for(let o=0;o<s.length;o+=1){const l=s[o];if(mt(l))return l}}const t=e.target;return mt(t)?t:null}function x4(e){let t=e;for(;t;){if(t.hasAttribute(p2))return t;const s=t.parentElement;if(s){t=s;continue}const o=t.getRootNode();t="host"in o&&mt(o.host)?o.host:null}return null}const b4=qk(function(t,s){const{render:o,className:l,style:c,handle:u,payload:p,disabled:m,delay:g,closeOnClick:h=!0,closeDelay:b,id:_,...k}=t,C=Uc(!0),y=u?.store??C;if(!y)throw new Error(nn(82));const w=Xa(_),S=y.useState("isTriggerActive",w),N=y.useState("isOpenedByTrigger",w),E=y.useState("floatingRootContext"),R=x.useRef(null),M=g??h4,T=b??0,{registerTrigger:A,isMountedByThisTrigger:z}=e2(w,R,y,{payload:p,closeOnClick:h,closeDelay:T}),I=m4(),{delayRef:D,isInstantPhase:P,hasProvider:L}=F3(E,{open:N}),U=vb(E);y.useSyncedValue("isInstantPhase",P);const q=y.useState("disabled"),$=m??q,V=mn($),G=y.useState("trackCursorAxis"),K=y.useState("disableHoverablePopup"),F=x.useRef(!1),X=wn(),H=x.useRef(void 0);function Q(){const pe=I?.delay,je=typeof D.current=="object"?D.current.open:void 0;let Ne=M;return L&&(je!==0?Ne=g??pe??M:Ne=0),Ne}function Y(pe){const je=R.current;if(!je||!pe)return!1;const Ne=x4(pe);return Ne!==null&&Ne!==je&&Qe(je,Ne)}function J(pe){const je=Y(pe);return F.current=je,je&&(U.openChangeTimeout.clear(),U.restTimeout.clear(),U.restTimeoutPending=!1,X.clear()),je}const oe=l2(E,{enabled:!$,mouseOnly:!0,move:!1,handleClose:!K&&G!=="both"?u2():null,restMs:Q,delay(){const pe=typeof D.current=="object"?D.current.close:void 0;let je=T;return b==null&&L&&(je=pe),{close:je}},triggerElementRef:R,isActiveTrigger:S,isClosing:()=>y.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ne=s2(E,{enabled:!$}).reference,te=pe=>{const je=F.current,Ne=sj(pe),Be=J(Ne),Ue=R.current,ye=Ue&&Ne&&Qe(Ue,Ne);if(Be&&y.select("open")&&y.select("lastOpenChangeReason")===jn){y.setOpen(!1,at(jn,pe));return}if(je&&!Be&&ye&&!V.current&&!y.select("open")&&Ue&&vo(H.current)){const De=()=>{!F.current&&!V.current&&!y.select("open")&&y.setOpen(!0,at(jn,pe,Ue))},ve=Q();ve===0?(X.clear(),De()):X.start(ve,De)}},le=y.useState("triggerProps",z);return Ct("button",t,{state:{open:N},ref:[s,A,R],props:[oe,ne,z||G!=="none"?le:void 0,{onMouseOver(pe){te(pe.nativeEvent)},onFocus(pe){Y(sj(pe.nativeEvent))&&pe.preventBaseUIHandler()},onMouseLeave(){F.current=!1,X.clear(),H.current=void 0},onPointerEnter(pe){H.current=pe.pointerType},onPointerDown(pe){H.current=pe.pointerType,y.set("closeOnClick",h),h&&!y.select("open")&&y.cancelPendingOpen(pe.nativeEvent)},onClick(pe){h&&!y.select("open")&&y.cancelPendingOpen(pe.nativeEvent)},id:w,[g4.triggerDisabled]:$?"":void 0,[p2]:$?void 0:""},k],stateAttributesMapping:d2})}),m2=x.createContext(void 0);function v4(){const e=x.useContext(m2);if(e===void 0)throw new Error(nn(70));return e}const _4=x.forwardRef(function(t,s){const{children:o,container:l,className:c,render:u,style:p,...m}=t,{portalNode:g,portalSubtree:h}=OS({container:l,ref:s,componentProps:t,elementProps:m});return!h&&!g?null:r.jsxs(x.Fragment,{children:[h,g&&is.createPortal(o,g)]})}),y4=x.forwardRef(function(t,s){const{keepMounted:o=!1,...l}=t;return Uc().useState("mounted")||o?r.jsx(m2.Provider,{value:o,children:r.jsx(_4,{ref:s,...l})}):null}),g2=x.createContext(void 0);function h2(){const e=x.useContext(g2);if(e===void 0)throw new Error(nn(71));return e}const j4=x.createContext(void 0);function qf(){return x.useContext(j4)?.direction??"ltr"}const w4=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:o,placement:l,rects:c,platform:u,elements:p,middlewareData:m}=t,{element:g,padding:h=0,offsetParent:b="real"}=Ys(e,t)||{};if(g==null)return{};const _=iS(h),k={x:s,y:o},C=tb(l),y=eb(C),w=await u.getDimensions(g),S=C==="y",N=S?"top":"left",E=S?"bottom":"right",R=S?"clientHeight":"clientWidth",M=c.reference[y]+c.reference[C]-k[C]-c.floating[y],T=k[C]-c.reference[C],A=b==="real"?await u.getOffsetParent?.(g):p.floating;let z=p.floating[R]||c.floating[y];(!z||!await u.isElement?.(A))&&(z=p.floating[R]||c.floating[y]);const I=M/2-T/2,D=z/2-w[y]/2-1,P=Math.min(_[N],D),L=Math.min(_[E],D),U=P,q=z-w[y]-L,$=z/2-w[y]/2+I,V=Fh(U,$,q),G=!m.arrow&&Lr(l)!=null&&$!==V&&c.reference[y]/2-($<U?P:L)-w[y]/2<0,K=G?$<U?$-U:$-q:0;return{[C]:k[C]+K,data:{[C]:V,centerOffset:$-V-K,...G&&{alignmentOffset:K}},reset:G}}}),k4=(e,t)=>({...w4(e),options:[e,t]}),S4={name:"hide",async fn(e){const{width:t,height:s,x:o,y:l}=e.rects.reference,c=t===0&&s===0&&o===0&&l===0;return{data:{referenceHidden:(await DO().fn(e)).data?.referenceHidden||c}}}},Hd={sideX:"left",sideY:"top"},x2={name:"adaptiveOrigin",async fn(e){const{x:t,y:s,rects:{floating:o},elements:{floating:l},platform:c,strategy:u,placement:p}=e,m=Zt(l),g=m.getComputedStyle(l);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:s,data:Hd};const b=await c.getOffsetParent?.(l);let _={width:0,height:0};if(u==="fixed"&&m?.visualViewport)_={width:m.visualViewport.width,height:m.visualViewport.height};else if(b===m){const N=pt(l);_={width:N.documentElement.clientWidth,height:N.documentElement.clientHeight}}else await c.isElement?.(b)&&(_=await c.getDimensions(b));const k=ia(p);let C=t,y=s;k==="left"&&(C=_.width-(t+o.width)),k==="top"&&(y=_.height-(s+o.height));const w=k==="left"?"right":Hd.sideX,S=k==="top"?"bottom":Hd.sideY;return{x:C,y,data:{sideX:w,sideY:S}}}};function b2(e,t,s){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?s?"inline-start":"inline-end":"right",bottom:"bottom",left:o?s?"inline-end":"inline-start":"left"}[t]}function rj(e,t,s){const{rects:o,placement:l}=e;return{side:b2(t,ia(l),s),align:Lr(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function yb(e){const{anchor:t,positionMethod:s="absolute",side:o="bottom",sideOffset:l=0,align:c="center",alignOffset:u=0,collisionBoundary:p,collisionPadding:m=5,sticky:g=!1,arrowPadding:h=5,disableAnchorTracking:b=!1,inline:_,keepMounted:k=!1,floatingRootContext:C,mounted:y,collisionAvoidance:w,shiftCrossAxis:S=!1,nodeId:N,adaptiveOrigin:E,lazyFlip:R=!1,externalTree:M}=e,[T,A]=x.useState(null);!y&&T!==null&&A(null);const z=w.side||"flip",I=w.align||"flip",D=w.fallbackAxisSide||"end",P=typeof t=="function"?t:void 0,L=Ve(P),U=P?L:t,q=mn(t),$=mn(y),G=qf()==="rtl",K=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":G?"left":"right","inline-start":G?"right":"left"}[o],F=c==="center"?K:`${K}-${c}`;let X=m;const H=1,Q=o==="bottom"?H:0,Y=o==="top"?H:0,J=o==="right"?H:0,oe=o==="left"?H:0;typeof X=="number"?X={top:X+Q,right:X+oe,bottom:X+Y,left:X+J}:X&&(X={top:(X.top||0)+Q,right:(X.right||0)+oe,bottom:(X.bottom||0)+Y,left:(X.left||0)+J});const ne={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:X},te=x.useRef(null),le=mn(l),fe=mn(u),ze=typeof l!="function"?l:0,be=typeof u!="function"?u:0,pe=[];_&&pe.push(_),pe.push(TO(xt=>{const At=rj(xt,o,G),Jt=typeof le.current=="function"?le.current(At):le.current,Et=typeof fe.current=="function"?fe.current(At):fe.current;return{mainAxis:Jt,crossAxis:Et,alignmentAxis:Et}},[ze,be,G,o]));const je=I==="none"&&z!=="shift",Ne=!je&&(g||S||z==="shift"),Be=z==="none"?null:OO({...ne,padding:{top:X.top+H,right:X.right+H,bottom:X.bottom+H,left:X.left+H},mainAxis:!S&&z==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),Ue=je?null:MO(xt=>{const At=pt(xt.elements.floating).documentElement;return{...ne,rootBoundary:S?{x:0,y:0,width:At.clientWidth,height:At.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:Ne,limiter:g||S?void 0:AO(Jt=>{if(!te.current)return{};const{width:Et,height:on}=te.current.getBoundingClientRect(),Yt=Da(ia(Jt.placement)),dn=Yt==="y"?Et:on,Ln=Yt==="y"?X.left+X.right:X.top+X.bottom;return{offset:dn/2+Ln/2}})}},[ne,g,S,X,I]);z==="shift"||I==="shift"||c==="center"?pe.push(Ue,Be):pe.push(Be,Ue),pe.push(zO({...ne,apply({elements:{floating:xt},availableWidth:At,availableHeight:Jt,rects:Et}){if(!$.current)return;const on=xt.style;on.setProperty("--available-width",`${At}px`),on.setProperty("--available-height",`${Jt}px`);const Yt=Zt(xt).devicePixelRatio||1,{x:dn,y:Ln,width:Jn,height:da}=Et.reference,ea=(Math.round((dn+Jn)*Yt)-Math.round(dn*Yt))/Yt,xs=(Math.round((Ln+da)*Yt)-Math.round(Ln*Yt))/Yt;on.setProperty("--anchor-width",`${ea}px`),on.setProperty("--anchor-height",`${xs}px`)}}),k4(xt=>({element:te.current||pt(xt.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(xt){const{elements:At,middlewareData:Jt,placement:Et,rects:on,y:Yt}=xt,dn=ia(Et),Ln=Da(dn),Jn=te.current,da=Jt.arrow?.x||0,ea=Jt.arrow?.y||0,xs=Jn?.clientWidth||0,In=Jn?.clientHeight||0,fa=da+xs/2,Ia=ea+In/2,bs=Math.abs(Jt.shift?.y||0),ut=on.reference.height/2,Pt=typeof l=="function"?l(rj(xt,o,G)):l,Rn=bs>Pt,ln={top:`${fa}px calc(100% + ${Pt}px)`,bottom:`${fa}px ${-Pt}px`,left:`calc(100% + ${Pt}px) ${Ia}px`,right:`${-Pt}px ${Ia}px`}[dn],Ot=`${fa}px ${on.reference.y+ut-Yt}px`;return At.floating.style.setProperty("--transform-origin",Ne&&Ln==="y"&&Rn?Ot:ln),{}}},S4,E),Ie(()=>{!y&&C&&C.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,C]);const ye=x.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:De,elements:ve,x:Re,y:Le,middlewareData:$e,update:He,placement:we,context:ie,isPositioned:Ce,floatingStyles:Ee}=WO({rootContext:C,open:k?y:void 0,placement:F,middleware:pe,strategy:s,whileElementsMounted:k?void 0:(...xt)=>Q1(...xt,ye),nodeId:N,externalTree:M}),{sideX:Se,sideY:qe}=$e.adaptiveOrigin||Hd,st=Ce?s:"fixed",Nt=x.useMemo(()=>{const xt=E?{position:st,[Se]:Re,[qe]:Le}:{position:st,...Ee};return Ce||(xt.opacity=0),xt},[E,st,Se,Re,qe,Le,Ee,Ce]),me=x.useRef(null);Ie(()=>{if(!y)return;const xt=q.current,At=typeof xt=="function"?xt():xt,Et=(oj(At)?At.current:At)||null||null;Et!==me.current&&(De.setPositionReference(Et),me.current=Et)},[y,De,U,q]),x.useEffect(()=>{if(!y)return;const xt=q.current;typeof xt!="function"&&oj(xt)&&xt.current!==me.current&&(De.setPositionReference(xt.current),me.current=xt.current)},[y,De,U,q]),x.useEffect(()=>{if(k&&y&&ve.domReference&&ve.floating)return Q1(ve.domReference,ve.floating,He,ye)},[k,y,ve,He,ye]);const Me=ia(we),Pe=b2(o,Me,G),Fe=Lr(we)||"center",rt=!!$e.hide?.referenceHidden;Ie(()=>{R&&y&&Ce&&A(Me)},[R,y,Ce,Me]);const rn=x.useMemo(()=>({position:"absolute",top:$e.arrow?.y,left:$e.arrow?.x}),[$e.arrow]),qt=$e.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Nt,arrowStyles:rn,arrowRef:te,arrowUncentered:qt,side:Pe,align:Fe,physicalSide:Me,anchorHidden:rt,refs:De,context:ie,isPositioned:Ce,update:He}),[Nt,rn,te,qt,Pe,Fe,Me,rt,De,ie,Ce,He])}function oj(e){return e!=null&&"current"in e}function $f(e){return e==="starting"?P5:Gt}function jb(e,t,{styles:s,transitionStatus:o,props:l,refs:c,hidden:u,inert:p=!1}){const m={...s};return p&&(m.pointerEvents="none"),Ct("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},$f(o),l],stateAttributesMapping:Ro})}const C4=x.forwardRef(function(t,s){const{render:o,className:l,anchor:c,positionMethod:u="absolute",side:p="top",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:k=5,sticky:C=!1,disableAnchorTracking:y=!1,collisionAvoidance:w=TS,style:S,...N}=t,E=Uc(),R=v4(),M=E.useState("open"),T=E.useState("mounted"),A=E.useState("trackCursorAxis"),z=E.useState("disableHoverablePopup"),I=E.useState("floatingRootContext"),D=E.useState("instantType"),P=E.useState("transitionStatus"),L=E.useState("hasViewport"),U=yb({anchor:c,positionMethod:u,floatingRootContext:I,mounted:T,side:p,sideOffset:g,align:m,alignOffset:h,collisionBoundary:b,collisionPadding:_,sticky:C,arrowPadding:k,disableAnchorTracking:y,keepMounted:R,collisionAvoidance:w,adaptiveOrigin:L?x2:void 0}),q=x.useMemo(()=>({open:M,side:U.side,align:U.align,anchorHidden:U.anchorHidden,instant:A!=="none"?"tracking-cursor":D}),[M,U.side,U.align,U.anchorHidden,A,D]),$=jb(t,q,{styles:U.positionerStyles,transitionStatus:P,props:N,refs:[s,E.useStateSetter("positionerElement")],hidden:!T,inert:!M||A==="both"||z});return r.jsx(g2.Provider,{value:U,children:$})}),N4={...Ro,...Ur},E4=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,p=Uc(),{side:m,align:g}=h2(),h=p.useState("open"),b=p.useState("instantType"),_=p.useState("transitionStatus"),k=p.useState("popupProps"),C=p.useState("floatingRootContext"),y=p.useState("disabled"),w=p.useState("closeDelay");gs({open:h,ref:p.context.popupRef,onComplete(){h&&p.context.onOpenChangeComplete?.(!0)}}),o2(C,{enabled:!y,closeDelay:w});const S=p.useStateSetter("popupElement");return Ct("div",t,{state:{open:h,side:m,align:g,instant:b,transitionStatus:_},ref:[s,p.context.popupRef,S],props:[k,$f(_),u],stateAttributesMapping:N4})}),R4=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,p=Uc(),{arrowRef:m,side:g,align:h,arrowUncentered:b,arrowStyles:_}=h2(),k=p.useState("open"),C=p.useState("instantType");return Ct("div",t,{state:{open:k,side:g,align:h,uncentered:b,instant:C},ref:[s,m],props:[{style:_,"aria-hidden":!0},u],stateAttributesMapping:Ro})}),T4=function(t){const{delay:s,closeDelay:o,timeout:l=400}=t,c=x.useMemo(()=>({delay:s,closeDelay:o}),[s,o]),u=x.useMemo(()=>({open:s,close:o}),[s,o]);return r.jsx(f2.Provider,{value:c,children:r.jsx($3,{delay:u,timeoutMs:l,children:t.children})})};function Ff(e){return sb(19)?e:e?"true":void 0}function M4(e){const[t,s]=x.useState({current:e,previous:null});return e!==t.current&&s({current:e,previous:t.current}),t.previous}function St(...e){return Vk(Cc(e))}function A4({delay:e=0,...t}){return r.jsx(T4,{"data-slot":"tooltip-provider",delay:e,...t})}function wb({...e}){return r.jsx(l4,{"data-slot":"tooltip",...e})}function kb({...e}){return r.jsx(b4,{"data-slot":"tooltip-trigger",...e})}function Sb({className:e,side:t="top",sideOffset:s=4,align:o="center",alignOffset:l=0,children:c,...u}){return r.jsx(y4,{children:r.jsx(C4,{align:o,alignOffset:l,side:t,sideOffset:s,className:"isolate z-50",children:r.jsxs(E4,{"data-slot":"tooltip-content",className:St("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[c,r.jsx(R4,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}function bl({label:e,active:t,onClick:s,isAdd:o,isSettings:l,isDefault:c,icon:u,title:p,testId:m}){const g=e.trim()||"·",{initials:h,subLabel:b}=v2(g),_=o||l?"indigo":_2(g),k=b&&!o&&!l&&!c;return r.jsxs(wb,{children:[r.jsx(kb,{render:r.jsxs("button",{type:"button",onClick:s,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Oe("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",t&&"ring-2 ring-foreground ring-offset-2 ring-offset-card",o&&"border border-dashed border-muted-fg/50 bg-transparent text-muted-fg hover:bg-accent/60 hover:text-foreground",l&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",c&&"overflow-hidden bg-muted",!o&&!l&&!c&&t&&P4(_),!o&&!l&&!c&&!t&&D4(_)),children:u??h}),k&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),r.jsx(Sb,{side:"right",children:p||e})]})}function v2(e){const t=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!t)return{initials:"·",subLabel:null};const s=t.split(" ");if(s.length>=2)return{initials:(s[0][0]+s[1][0]).toUpperCase(),subLabel:O4(t)};const o=s[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function O4(e){return e.length>6?e.slice(0,5)+"…":e}function _2(e){let t=0;for(let s=0;s<e.length;s++)t=t*31+e.charCodeAt(s)|0;return w1[Math.abs(t)%w1.length]}const y2={sky:"bg-sky-500/15 text-sky-300 hover:bg-sky-500/25",violet:"bg-violet-500/15 text-violet-300 hover:bg-violet-500/25",emerald:"bg-emerald-500/15 text-emerald-300 hover:bg-emerald-500/25",amber:"bg-amber-500/15 text-amber-300 hover:bg-amber-500/25",rose:"bg-rose-500/15 text-rose-300 hover:bg-rose-500/25",indigo:"bg-indigo-500/15 text-indigo-300 hover:bg-indigo-500/25",teal:"bg-teal-500/15 text-teal-300 hover:bg-teal-500/25",fuchsia:"bg-fuchsia-500/15 text-fuchsia-300 hover:bg-fuchsia-500/25"},z4={sky:"bg-sky-500/30 text-sky-100",violet:"bg-violet-500/30 text-violet-100",emerald:"bg-emerald-500/30 text-emerald-100",amber:"bg-amber-500/30 text-amber-100",rose:"bg-rose-500/30 text-rose-100",indigo:"bg-indigo-500/30 text-indigo-100",teal:"bg-teal-500/30 text-teal-100",fuchsia:"bg-fuchsia-500/30 text-fuchsia-100"};function D4(e){return y2[e]}function P4(e){return z4[e]}function L4(e){const{initials:t}=v2(e);return{initials:t,idleClass:y2[_2(e)]}}function Je({content:e,side:t="top",children:s}){return e?r.jsxs(wb,{children:[r.jsx(kb,{render:s}),r.jsx(Sb,{side:t,children:e})]}):s}const j2=x.createContext(void 0);function Cb(e){const t=x.useContext(j2);if(t===void 0&&!e)throw new Error(nn(33));return t}const w2=x.createContext(void 0);function Hr(e){const t=x.useContext(w2);if(t===void 0&&!e)throw new Error(nn(36));return t}const I4=x.createContext(void 0);function Gf(e=!0){const t=x.useContext(I4);if(t===void 0&&!e)throw new Error(nn(25));return t}function Vl({controlled:e,default:t,name:s,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,u]=x.useState(t),p=l?e:c,m=x.useCallback(g=>{l||u(g)},[]);return[p,m]}const k2=x.createContext(void 0);function Nb(e=!1){const t=x.useContext(k2);if(t===void 0&&!e)throw new Error(nn(16));return t}function B4(e){const{focusableWhenDisabled:t,disabled:s,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,u=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const g={onKeyDown(h){s&&t&&h.key!=="Tab"&&h.preventDefault()}};return o||(g.tabIndex=l,!c&&s&&(g.tabIndex=t?l:-1)),(c&&(t||u)||!c&&s)&&(g["aria-disabled"]=s),c&&(!t||p)&&(g.disabled=s),g},[o,s,t,u,p,c,l])}}function Vr(e={}){const{disabled:t=!1,focusableWhenDisabled:s,tabIndex:o=0,native:l=!0,composite:c}=e,u=x.useRef(null),p=Nb(!0),m=c??p!==void 0,{props:g}=B4({focusableWhenDisabled:s,disabled:t,composite:m,tabIndex:o,isNativeButton:l}),h=x.useCallback(()=>{const k=u.current;Bg(k)&&m&&t&&g.disabled===void 0&&k.disabled&&(k.disabled=!1)},[t,g.disabled,m]);Ie(h,[h]);const b=x.useCallback((k={})=>{const{onClick:C,onMouseDown:y,onKeyUp:w,onKeyDown:S,onPointerDown:N,...E}=k;return Dn({onClick(R){if(t){R.preventDefault();return}C?.(R)},onMouseDown(R){t||y?.(R)},onKeyDown(R){if(t||(sf(R),S?.(R),R.baseUIHandlerPrevented))return;const M=R.target===R.currentTarget,T=R.currentTarget,A=Bg(T),z=!l&&U4(T),I=M&&(l?A:!z),D=R.key==="Enter",P=R.key===" ",L=T.getAttribute("role"),U=L?.startsWith("menuitem")||L==="option"||L==="gridcell";if(M&&m&&P){if(R.defaultPrevented&&U)return;R.preventDefault(),z||l&&A?(T.click(),R.preventBaseUIHandler()):I&&(C?.(R),R.preventBaseUIHandler());return}I&&(!l&&(P||D)&&R.preventDefault(),!l&&D&&C?.(R))},onKeyUp(R){if(!t){if(sf(R),w?.(R),R.target===R.currentTarget&&l&&m&&Bg(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!l&&!m&&R.key===" "&&C?.(R)}},onPointerDown(R){if(t){R.preventDefault();return}N?.(R)}},l?{type:"button"}:{role:"button"},g,E)},[t,g,m,l]),_=Ve(k=>{u.current=k,h()});return{getButtonProps:b,buttonRef:_}}function Bg(e){return Vt(e)&&e.tagName==="BUTTON"}function U4(e){return!!(e?.tagName==="A"&&e?.href)}function H4(e){const{closeOnClick:t,highlighted:s,id:o,nodeId:l,store:c,typingRef:u,itemRef:p,itemMetadata:m}=e,{events:g}=c.useState("floatingTreeRoot"),h=Gf(!0),b=h!==void 0;return x.useMemo(()=>({id:o,role:"menuitem",tabIndex:s?0:-1,onKeyDown(_){_.key===" "&&u?.current&&_.preventDefault()},onMouseMove(_){l&&g.emit("itemhover",{nodeId:l,target:_.currentTarget})},onClick(_){t&&g.emit("close",{domEvent:_,reason:El})},onMouseUp(_){if(h){const k=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,b&&k&&Math.abs(_.clientX-k.x)<=1&&Math.abs(_.clientY-k.y)<=1||b&&!Kk&&_.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!b||_.button===2)&&(!m||m.type==="regular-item")&&p.current.click()}}),[t,s,o,g,l,c,u,p,h,b,m])}const S2={type:"regular-item"};function C2(e){const{closeOnClick:t,disabled:s=!1,highlighted:o,id:l,store:c,typingRef:u=c.context.typingRef,nativeButton:p,itemMetadata:m,nodeId:g}=e,h=x.useRef(null),{getButtonProps:b,buttonRef:_}=Vr({disabled:s,focusableWhenDisabled:!0,native:p,composite:!0}),k=H4({closeOnClick:t,highlighted:o,id:l,nodeId:g,store:c,typingRef:u,itemRef:h,itemMetadata:m}),C=x.useCallback(w=>Dn(k,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},w,b),[k,b,m]),y=ds(h,_);return x.useMemo(()=>({getItemProps:C,itemRef:y}),[C,y])}const N2=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function V4(){return x.useContext(N2)}let E2=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Fc(e={}){const{label:t,metadata:s,textRef:o,indexGuessBehavior:l,index:c}=e,{register:u,unregister:p,subscribeMapChange:m,elementsRef:g,labelsRef:h,nextIndexRef:b}=V4(),_=x.useRef(-1),[k,C]=x.useState(c??(l===E2.GuessFromOrder?()=>{if(_.current===-1){const S=b.current;b.current+=1,_.current=S}return _.current}:-1)),y=x.useRef(null),w=x.useCallback(S=>{if(y.current=S,k!==-1&&S!==null&&(g.current[k]=S,h)){const N=t!==void 0;h.current[k]=N?t:o?.current?.textContent??S.textContent}},[k,g,h,t,o]);return Ie(()=>{if(c!=null)return;const S=y.current;if(S)return u(S,s),()=>{p(S)}},[c,u,p,s]),Ie(()=>{if(c==null)return m(S=>{const N=y.current?S.get(y.current)?.index:null;N!=null&&C(N)})},[c,m,C]),x.useMemo(()=>({ref:w,index:k}),[k,w])}let lj=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const R2={checked(e){return e?{[lj.checked]:""}:{[lj.unchecked]:""}},...Ur},q4=x.createContext(void 0),$4=x.forwardRef(function(t,s){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:g=!0,style:h,...b}=t,_=Fc({label:u}),k=Cb(!0),C=Xa(c),{store:y}=Hr(),w=y.useState("isActive",_.index),S=y.useState("itemProps"),{getItemProps:N,itemRef:E}=C2({closeOnClick:g,disabled:m,highlighted:w,id:C,store:y,nativeButton:p,nodeId:k?.context.nodeId,itemMetadata:S2});return Ct("div",t,{state:{disabled:m,highlighted:w},props:[S,b,N],ref:[E,s,_.ref]})}),F4=x.createContext(void 0);function T2(e){return x.useContext(F4)}const _c="ArrowUp",kl="ArrowDown",df="ArrowLeft",yc="ArrowRight",Yf="Home",Xf="End",M2=new Set([df,yc]),G4=new Set([df,yc,Yf,Xf]),A2=new Set([_c,kl]),Y4=new Set([_c,kl,Yf,Xf]),O2=new Set([...M2,...A2]),Kf=new Set([...O2,Yf,Xf]),X4="Shift",K4="Control",Q4="Alt",Z4="Meta",W4=new Set([X4,K4,Q4,Z4]);function J4(e){return Vt(e)&&e.tagName==="INPUT"}function ij(e){return!!(J4(e)&&e.selectionStart!=null||Vt(e)&&e.tagName==="TEXTAREA")}function cj(e,t,s,o){if(!e||!t||!t.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const u=e.clientWidth<e.scrollWidth,p=e.clientHeight<e.scrollHeight;if(u&&o!=="vertical"){const m=uj(e,t,"left"),g=vd(e),h=vd(t);s==="ltr"&&(m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight?l=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight:m-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft&&(l=m-h.scrollMarginLeft-g.scrollPaddingLeft)),s==="rtl"&&(m-h.scrollMarginRight<e.scrollLeft+g.scrollPaddingLeft?l=m-h.scrollMarginLeft-g.scrollPaddingLeft:m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight&&(l=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight))}if(p&&o!=="horizontal"){const m=uj(e,t,"top"),g=vd(e),h=vd(t);m-h.scrollMarginTop<e.scrollTop+g.scrollPaddingTop?c=m-h.scrollMarginTop-g.scrollPaddingTop:m+t.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-g.scrollPaddingBottom&&(c=m+t.offsetHeight+h.scrollMarginBottom-e.clientHeight+g.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function uj(e,t,s){const o=s==="left"?"offsetLeft":"offsetTop";let l=0;for(;t.offsetParent&&(l+=t[o],t.offsetParent!==e);)t=t.offsetParent;return l}function vd(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const ez={...Ro,...Ur},tz=x.forwardRef(function(t,s){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m}=Hr(),{side:g,align:h}=Cb(),b=T2()!=null,_=m.useState("open"),k=m.useState("transitionStatus"),C=m.useState("popupProps"),y=m.useState("mounted"),w=m.useState("instantType"),S=m.useState("activeTriggerElement"),N=m.useState("parent"),E=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),M=m.useState("floatingRootContext"),T=m.useState("floatingTreeRoot"),A=m.useState("closeDelay"),z=m.useState("activeTriggerElement"),I=m.useState("hoverEnabled"),D=m.useState("disabled"),P=N.type==="context-menu";gs({open:_,ref:m.context.popupRef,onComplete(){_&&m.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function V(G){m.setOpen(!1,at(G.reason,G.domEvent))}return T.events.on("close",V),()=>{T.events.off("close",V)}},[T.events,m]),o2(M,{enabled:I&&!D&&!P&&N.type!=="menubar",closeDelay:A});const L=x.useCallback(V=>{m.set("popupElement",V)},[m]),U={transitionStatus:k,side:g,align:h,open:_,nested:N.type==="menu",instant:w},q=Ct("div",t,{state:U,ref:[s,m.context.popupRef,L],stateAttributesMapping:ez,props:[C,{onKeyDown(V){b&&Kf.has(V.key)&&V.stopPropagation()}},$f(k),p,{"data-rootownerid":R}]});let $=N.type===void 0||P;return(S||N.type==="menubar"&&E!==Df)&&($=!0),r.jsx(ub,{context:M,modal:P,disabled:!y,returnFocus:u===void 0?$:u,initialFocus:N.type!=="menu",restoreFocus:!0,externalTree:N.type!=="menubar"?T:void 0,previousFocusableElement:z,nextFocusableElement:N.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:N.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:q})}),z2=x.createContext(void 0);function nz(){const e=x.useContext(z2);if(e===void 0)throw new Error(nn(32));return e}const az=x.forwardRef(function(t,s){const{keepMounted:o=!1,...l}=t,{store:c}=Hr();return c.useState("mounted")||o?r.jsx(z2.Provider,{value:o,children:r.jsx(lb,{ref:s,...l})}):null});function Qf(e){const{children:t,elementsRef:s,labelsRef:o,onMapChange:l}=e,c=Ve(l),u=x.useRef(0),p=Kn(rz).current,m=Kn(sz).current,[g,h]=x.useState(0),b=x.useRef(g),_=Ve((S,N)=>{m.set(S,N??null),b.current+=1,h(b.current)}),k=Ve(S=>{m.delete(S),b.current+=1,h(b.current)}),C=x.useMemo(()=>{const S=new Map;return Array.from(m.keys()).filter(E=>E.isConnected).sort(oz).forEach((E,R)=>{const M=m.get(E)??{};S.set(E,{...M,index:R})}),S},[m,g]);Ie(()=>{if(typeof MutationObserver!="function"||C.size===0)return;const S=new MutationObserver(N=>{const E=new Set,R=M=>E.has(M)?E.delete(M):E.add(M);N.forEach(M=>{M.removedNodes.forEach(R),M.addedNodes.forEach(R)}),E.size===0&&(b.current+=1,h(b.current))});return C.forEach((N,E)=>{E.parentElement&&S.observe(E.parentElement,{childList:!0})}),()=>{S.disconnect()}},[C]),Ie(()=>{b.current===g&&(s.current.length!==C.size&&(s.current.length=C.size),o&&o.current.length!==C.size&&(o.current.length=C.size),u.current=C.size),c(C)},[c,C,s,o,g]),Ie(()=>()=>{s.current=[]},[s]),Ie(()=>()=>{o&&(o.current=[])},[o]);const y=Ve(S=>(p.add(S),()=>{p.delete(S)}));Ie(()=>{p.forEach(S=>S(C))},[p,C]);const w=x.useMemo(()=>({register:_,unregister:k,subscribeMapChange:y,elementsRef:s,labelsRef:o,nextIndexRef:u}),[_,k,y,s,o,u]);return r.jsx(N2.Provider,{value:w,children:t})}function sz(){return new Map}function rz(){return new Set}function oz(e,t){const s=e.compareDocumentPosition(t);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Eb=x.forwardRef(function(t,s){const{cutout:o,...l}=t;let c;if(o){const u=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${u.left}px ${u.top}px,${u.left}px ${u.bottom}px,${u.right}px ${u.bottom}px,${u.right}px ${u.top}px,${u.left}px ${u.top}px)`}return r.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});let dj={},fj={},pj="";function lz(e){if(typeof document>"u")return!1;const t=pt(e);return Zt(t).innerWidth-t.documentElement.clientWidth>0}function iz(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=pt(e),o=s.documentElement,l=s.body,c=Pr(o)?o:l,u=c.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const g=c.offsetWidth;return c.style.overflowY=u,o.style.scrollbarGutter=p,m===g}function cz(e){const t=pt(e),s=t.documentElement,o=t.body,l=Pr(s)?s:o,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function uz(e){const t=pt(e),s=t.documentElement,o=t.body,l=Zt(s);let c=0,u=0,p=!1;const m=ts.create();if(Fx&&(l.visualViewport?.scale??1)!==1)return()=>{};function g(){const k=l.getComputedStyle(s),C=l.getComputedStyle(o),S=(k.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,u=s.scrollLeft,dj={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},pj=s.style.scrollBehavior,fj={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const N=s.scrollHeight>s.clientHeight,E=s.scrollWidth>s.clientWidth,R=k.overflowY==="scroll"||C.overflowY==="scroll",M=k.overflowX==="scroll"||C.overflowX==="scroll",T=Math.max(0,l.innerWidth-o.clientWidth),A=Math.max(0,l.innerHeight-o.clientHeight),z=parseFloat(C.marginTop)+parseFloat(C.marginBottom),I=parseFloat(C.marginLeft)+parseFloat(C.marginRight),D=Pr(s)?s:o;if(p=iz(e),p){s.style.scrollbarGutter=S,D.style.overflowY="hidden",D.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(N||R)&&(s.style.overflowY="scroll"),(E||M)&&(s.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:z||A?`calc(100dvh - ${z+A}px)`:"100dvh",width:I||T?`calc(100vw - ${I+T}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=u,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function h(){Object.assign(s.style,dj),Object.assign(o.style,fj),p||(s.scrollTop=c,s.scrollLeft=u,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=pj)}function b(){h(),m.request(g)}g();const _=gt(l,"resize",b);return()=>{m.cancel(),h(),typeof l.removeEventListener=="function"&&_()}}class dz{lockCount=0;restore=null;timeoutLock=Fa.create();timeoutUnlock=Fa.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const o=pt(t).documentElement,l=Zt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=qn;return}const c=Yk||!lz(t);this.restore=c?cz(t):uz(t)}}const fz=new dz;function D2(e=!0,t=null){Ie(()=>{if(e)return fz.acquire(t)},[e,t])}const pz=20;function P2(e,t,s,o){const[l,c]=x.useState(!1);Ie(()=>{if(!e||!t||s==null){c(!1);return}const u=pt(s).documentElement.clientWidth,p=s.offsetWidth;c(u>0&&p>0&&p>=u-pz)},[e,t,s]),D2(e&&(!t||l),o)}const mz=x.forwardRef(function(t,s){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p,align:m,sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:k=5,sticky:C=!1,disableAnchorTracking:y=!1,collisionAvoidance:w=RS,style:S,...N}=t,{store:E}=Hr(),R=nz(),M=Gf(!0),T=E.useState("parent"),A=E.useState("floatingRootContext"),z=E.useState("floatingTreeRoot"),I=E.useState("mounted"),D=E.useState("open"),P=E.useState("modal"),L=E.useState("openMethod"),U=E.useState("activeTriggerElement"),q=E.useState("transitionStatus"),$=E.useState("positionerElement"),V=E.useState("instantType"),G=E.useState("hasViewport"),K=E.useState("lastOpenChangeReason"),F=E.useState("floatingNodeId"),X=E.useState("floatingParentNodeId"),H=A.useState("domReferenceElement"),Q=x.useRef(null),Y=ZS($,!1,!1);let J=o,oe=g,ne=h,te=m,le=w;T.type==="context-menu"&&(J=o??T.context?.anchor,te=te??"start",!p&&te!=="center"&&(ne=t.alignOffset??2,oe=t.sideOffset??-5));let fe=p,ze=te;T.type==="menu"?(fe=fe??"inline-end",ze=ze??"start",le=t.collisionAvoidance??TS):T.type==="menubar"&&(fe=fe??"bottom",ze=ze??"start");const be=T.type==="context-menu",pe=yb({anchor:J,floatingRootContext:A,positionMethod:M?"fixed":l,mounted:I,side:fe,sideOffset:oe,align:ze,alignOffset:ne,arrowPadding:be?0:k,collisionBoundary:b,collisionPadding:_,sticky:C,nodeId:F,keepMounted:R,disableAnchorTracking:y,collisionAvoidance:le,shiftCrossAxis:be&&!("side"in le&&le.side==="flip"),externalTree:z,adaptiveOrigin:G?x2:void 0});x.useEffect(()=>{function Re(Le){Le.open&&(Le.parentNodeId===F&&E.set("hoverEnabled",!1),Le.nodeId!==F&&Le.parentNodeId===E.select("floatingParentNodeId")&&E.setOpen(!1,at(uc)))}return z.events.on("menuopenchange",Re),()=>{z.events.off("menuopenchange",Re)}},[E,z.events,F]),x.useEffect(()=>{if(E.select("floatingParentNodeId")==null)return;function Re(Le){if(Le.open||Le.nodeId!==E.select("floatingParentNodeId"))return;const $e=Le.reason??uc;E.setOpen(!1,at($e))}return z.events.on("menuopenchange",Re),()=>{z.events.off("menuopenchange",Re)}},[z.events,E]);const je=wn();x.useEffect(()=>{D||je.clear()},[D,je]),x.useEffect(()=>{function Re(Le){if(!(!D||Le.nodeId!==E.select("floatingParentNodeId")))if(Le.target&&U&&U!==Le.target){const $e=E.select("closeDelay");$e>0?je.isStarted()||je.start($e,()=>{E.setOpen(!1,at(uc))}):E.setOpen(!1,at(uc))}else je.clear()}return z.events.on("itemhover",Re),()=>{z.events.off("itemhover",Re)}},[z.events,D,U,E,je]),x.useEffect(()=>{const Re={open:D,nodeId:F,parentNodeId:X,reason:E.select("lastOpenChangeReason")};z.events.emit("menuopenchange",Re)},[z.events,D,E,F,X]),Ie(()=>{const Re=H,Le=Q.current;if(Re&&(Q.current=Re),Le&&Re&&Re!==Le){E.set("instantType",void 0);const $e=new AbortController;return Y(()=>{E.set("instantType","trigger-change")},$e.signal),()=>{$e.abort()}}},[H,Y,E]);const Ne={open:D,side:pe.side,align:pe.align,anchorHidden:pe.anchorHidden,nested:T.type==="menu",instant:V},Be=T.type==="menubar"&&T.context.modal;P2(D&&(Be||P&&K!==jn),L==="touch",$,U);const ye=jb(t,Ne,{styles:pe.positionerStyles,transitionStatus:q,props:N,refs:[s,E.useStateSetter("positionerElement")],hidden:!I,inert:!D}),De=I&&T.type!=="menu"&&(T.type!=="menubar"&&P&&K!==jn||T.type==="menubar"&&T.context.modal);let ve=null;return T.type==="menubar"?ve=T.context.contentElement:T.type===void 0&&(ve=U),r.jsxs(j2.Provider,{value:pe,children:[De&&r.jsx(Eb,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:Ff(!D),cutout:ve}),r.jsx(U5,{id:F,children:r.jsx(Qf,{elementsRef:E.context.itemDomElements,labelsRef:E.context.itemLabels,children:ye})})]})}),L2=x.createContext(void 0);function gz(){const e=x.useContext(L2);if(e===void 0)throw new Error(nn(34));return e}const hz=x.memo(x.forwardRef(function(t,s){const{render:o,className:l,value:c,defaultValue:u,onValueChange:p,disabled:m=!1,style:g,"aria-labelledby":h,...b}=t,[_,k]=x.useState(void 0),[C,y]=Vl({controlled:c,default:u,name:"MenuRadioGroup"}),w=Ve((R,M)=>{p?.(R,M),!M.isCanceled&&y(R)}),N=Ct("div",t,{state:{disabled:m},ref:s,props:{role:"group","aria-labelledby":h??_,"aria-disabled":m||void 0,...b}}),E=x.useMemo(()=>({value:C,setValue:w,disabled:m}),[C,w,m]);return r.jsx(q4.Provider,{value:k,children:r.jsx(L2.Provider,{value:E,children:N})})})),I2=x.createContext(void 0);function xz(){const e=x.useContext(I2);if(e===void 0)throw new Error(nn(35));return e}const bz=x.forwardRef(function(t,s){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:g=!1,value:h,style:b,..._}=t,k=Fc({label:u}),C=Cb(!0),y=Xa(c),{store:w}=Hr(),S=w.useState("isActive",k.index),N=w.useState("itemProps"),{value:E,setValue:R,disabled:M}=gz(),T=M||m,A=E===h,{getItemProps:z,itemRef:I}=C2({closeOnClick:g,disabled:T,highlighted:S,id:y,store:w,nativeButton:p,nodeId:C?.context.nodeId,itemMetadata:S2}),D=x.useMemo(()=>({disabled:T,highlighted:S,checked:A}),[T,S,A]);function P(U){const q=at(El,U.nativeEvent,void 0,{preventUnmountOnClose(){}});R(h,q)}const L=Ct("div",t,{state:D,stateAttributesMapping:R2,props:[N,{role:"menuitemradio","aria-checked":A,onClick:P},_,z],ref:[I,s,k.ref]});return r.jsx(I2.Provider,{value:D,children:L})}),vz=x.forwardRef(function(t,s){const{render:o,className:l,style:c,keepMounted:u=!1,...p}=t,m=xz(),g=x.useRef(null),{transitionStatus:h,setMounted:b}=ni(m.checked);gs({open:m.checked,ref:g,onComplete(){m.checked||b(!1)}});const _={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:h};return Ct("span",t,{state:_,stateAttributesMapping:R2,ref:[s,g],props:{"aria-hidden":!0,...p},enabled:u||m.checked})}),_z=x.createContext(null);function B2(e){return x.useContext(_z)}function yz(e){const t=x.useRef(""),s=x.useCallback(l=>{l.defaultPrevented||(t.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:x.useCallback(l=>{if(l.detail===0){e(l,"keyboard");return}"pointerType"in l?e(l,l.pointerType):e(l,t.current),t.current=""},[e]),onPointerDown:s}}function Rb(e,t){const s=x.useRef(e),o=Ve(t);Ie(()=>{s.current!==e&&o(s.current)},[e,o]),Ie(()=>{s.current=e},[e])}function jz(e,t){const s=Ve((c,u)=>{(typeof e=="function"?e():e)||t(u||(Yk?"touch":""))}),{onClick:o,onPointerDown:l}=yz(s);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function U2(e){const[t,s]=x.useState(null),o=jz(e,s);return Rb(e,l=>{l&&!e&&s(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const wz={...xb,disabled:Te(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Te(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),openMethod:Te(e=>e.openMethod),allowMouseEnter:Te(e=>e.allowMouseEnter),stickIfOpen:Te(e=>e.stickIfOpen),parent:Te(e=>e.parent),rootId:Te(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Te(e=>e.activeIndex),isActive:Te((e,t)=>e.activeIndex===t),hoverEnabled:Te(e=>e.hoverEnabled),instantType:Te(e=>e.instantType),lastOpenChangeReason:Te(e=>e.openChangeReason),floatingTreeRoot:Te(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Te(e=>e.floatingNodeId),floatingParentNodeId:Te(e=>e.floatingParentNodeId),itemProps:Te(e=>e.itemProps),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport),keyboardEventRelay:Te(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Tb extends Uf{constructor(t){super({...kz(),...t},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new $c},wz),this.unsubscribeParentListener=this.observe("parent",s=>{if(this.unsubscribeParentListener?.(),s.type==="menu"){let o=s.store.select("rootId"),l=s.store.select("floatingTreeRoot"),c=s.store.select("keyboardEventRelay");this.unsubscribeParentListener=s.store.subscribe(()=>{const u=s.store.select("rootId"),p=s.store.select("floatingTreeRoot"),m=s.store.select("keyboardEventRelay");o===u&&l===p&&c===m||(o=u,l=p,c=m,this.notifyAll())}),this.context.allowMouseUpTriggerRef=s.store.context.allowMouseUpTriggerRef;return}s.type!==void 0&&(this.context.allowMouseUpTriggerRef=s.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,s){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:s})}static useStore(t,s){const o=Kn(()=>new Tb(s)).current;return t??o}unsubscribeParentListener=null}function kz(){return{...gb(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new ib,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Gt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const Sz=x.createContext(void 0);function Cz(){return x.useContext(Sz)}const Nz=qx(function(t){const{children:s,open:o,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:p=!1,modal:m,loopFocus:g=!0,orientation:h="vertical",actionsRef:b,closeParentOnEsc:_=!1,handle:k,triggerId:C,defaultTriggerId:y=null,highlightItemOnHover:w=!0}=t,S=Gf(!0),N=Hr(!0),E=B2(!0),R=Cz(),M=x.useMemo(()=>R&&N?{type:"menu",store:N.store}:E?{type:"menubar",context:E}:S&&!N?{type:"context-menu",context:S}:{type:void 0},[S,N,E,R]),T=Tb.useStore(k?.store,{open:u,openProp:o,activeTriggerId:y,triggerIdProp:C,parent:M});Rf(()=>{o===void 0&&T.state.open===!1&&u===!0&&T.update({open:!0,activeTriggerId:y})}),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",C),T.useContextCallback("onOpenChangeComplete",c);const A=yo(),z=yo(),I=T.useState("floatingTreeRoot"),D=LS(I),P=Ir(),L=T.useState("open"),U=T.useState("activeTriggerElement"),q=T.useState("positionerElement"),$=T.useState("hoverEnabled"),V=T.useState("disabled"),G=T.useState("lastOpenChangeReason"),K=T.useState("parent"),F=T.useState("activeIndex"),X=T.useState("payload"),H=T.useState("floatingParentNodeId"),Q=x.useRef(null),Y=x.useRef(K.type!=="context-menu"),J=wn(),oe=x.useRef(!0),ne=wn(),te=H!=null,{openMethod:le,triggerProps:fe}=U2(L);T.useSyncedValues({disabled:p,modal:K.type===void 0?m:void 0,openMethod:le,rootId:A}),fb(T);const{forceUnmount:ze}=pb(L,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})});Ie(()=>{S&&!N?T.update({parent:{type:"context-menu",context:S},floatingNodeId:D,floatingParentNodeId:P}):N&&T.update({floatingNodeId:D,floatingParentNodeId:P})},[S,N,D,P,T]),x.useEffect(()=>{if(L||(Q.current=null),K.type==="context-menu"){if(!L){J.clear(),Y.current=!1;return}J.start(500,()=>{Y.current=!0})}},[J,L,K.type]),Ie(()=>{!L&&!$&&T.set("hoverEnabled",!0)},[L,$,T]);const be=Ve((Se,qe)=>{const st=qe.reason;if(L===Se&&qe.trigger===U&&G===st||(qe.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},!Se&&qe.trigger==null&&(qe.trigger=U??void 0),l?.(Se,qe),qe.isCanceled))return;T.state.floatingRootContext.dispatchOpenChange(Se,qe);const Nt=qe.event;if(Se===!1&&Nt?.type==="click"&&Nt.pointerType==="touch"&&!oe.current)return;if(!Se&&F!==null){const rt=T.context.itemDomElements.current[F];queueMicrotask(()=>{rt?.setAttribute("tabindex","-1")})}Se&&st===Nl?(oe.current=!1,ne.start(300,()=>{oe.current=!0})):(oe.current=!0,ne.clear());const me=(st===Il||st===El)&&Nt.detail===0&&Nt?.isTrusted,Me=!Se&&(st===Pf||st==null),Pe={open:Se,openChangeReason:st};Q.current=qe.event??null;const Fe=qe.trigger?.id??null;(Fe||Se)&&(Pe.activeTriggerId=Fe,Pe.activeTriggerElement=qe.trigger??null),T.update(Pe),K.type==="menubar"&&(st===Nl||st===_o||st===jn||st===$h||st===uc)?T.set("instantType","group"):me||Me?T.set("instantType",me?"click":"dismiss"):T.set("instantType",void 0)}),pe=QS({popupStore:T,floatingId:z,nested:P!=null,onOpenChange:be}),je=pe.context.events;x.useEffect(()=>{const Se=({open:qe,eventDetails:st})=>be(qe,st);return je.on("setOpen",Se),()=>{je?.off("setOpen",Se)}},[je,be]);const Ne=x.useCallback(()=>{T.setOpen(!1,at(Qx))},[T]);x.useImperativeHandle(b,()=>({unmount:ze,close:Ne}),[ze,Ne]);let Be;K.type==="context-menu"&&(Be=K.context),x.useImperativeHandle(Be?.positionerRef,()=>q,[q]),x.useImperativeHandle(Be?.actionsRef,()=>({setOpen:be}),[be]);const Ue=If(pe,{enabled:!V,bubbles:{escapeKey:_&&K.type==="menu"},outsidePress(){return K.type!=="context-menu"||Q.current?.type==="contextmenu"?!0:Y.current},externalTree:te?I:void 0}),ye=qf(),De=x.useCallback(Se=>{T.select("activeIndex")!==Se&&T.set("activeIndex",Se)},[T]),ve=i2(pe,{enabled:!V,listRef:T.context.itemDomElements,activeIndex:F,nested:K.type!==void 0,loopFocus:g,orientation:h,parentOrientation:K.type==="menubar"?K.context.orientation:void 0,rtl:ye==="rtl",disabledIndices:Or,onNavigate:De,openOnArrowKeyDown:K.type!=="context-menu",externalTree:te?I:void 0,focusItemOnHover:w}),Re=x.useCallback(Se=>{T.context.typingRef.current=Se},[T]),Le=c2(pe,{listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:F,resetMs:z5,onMatch:Se=>{L&&Se!==F&&T.set("activeIndex",Se)},onTyping:Re}),$e=x.useMemo(()=>{const Se=Dn(Le.reference,ve.reference,Ue.reference,{onMouseMove(){T.set("allowMouseEnter",!0)}},fe);return Se["aria-haspopup"]="menu",Se["aria-expanded"]=L,Se},[T,Le.reference,ve.reference,Ue.reference,fe,L]),He=x.useMemo(()=>{const Se=Dn(ve.trigger,Ue.trigger,fe);return Se["aria-haspopup"]="menu",Se["aria-expanded"]=!1,Se},[ve.trigger,Ue.trigger,fe]),we=x.useMemo(()=>Dn(qc,{id:z,role:"menu","aria-labelledby":U?.id,onMouseMove(){T.set("allowMouseEnter",!0),K.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(Se){const qe=T.select("keyboardEventRelay");qe&&!Se.isPropagationStopped()&&qe(Se)}},Le.floating,ve.floating,Ue.floating),[U,z,K.type,T,Le.floating,ve.floating,Ue.floating]),ie=ve.item??Gt;mb(T,{floatingRootContext:pe,activeTriggerProps:$e,inactiveTriggerProps:He,popupProps:we,itemProps:ie});const Ce=x.useMemo(()=>({store:T,parent:M}),[T,M]),Ee=r.jsx(w2.Provider,{value:Ce,children:typeof s=="function"?s({payload:X}):s});return K.type===void 0||K.type==="context-menu"?r.jsx(H5,{externalTree:I,children:Ee}):Ee});function H2(e){const t=e.getBoundingClientRect(),s=Zt(e),o=s.getComputedStyle(e,"::before"),l=s.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const u=parseFloat(o.width)||0,p=parseFloat(o.height)||0,m=parseFloat(l.width)||0,g=parseFloat(l.height)||0,h=Math.max(t.width,u,m),b=Math.max(t.height,p,g),_=h-t.width,k=b-t.height;return{left:t.left-_/2,right:t.right+_/2,top:t.top-k/2,bottom:t.bottom+k/2}}function V2(e={}){const{highlightItemOnHover:t,highlightedIndex:s,onHighlightedIndexChange:o}=Nb(),{ref:l,index:c}=Fc(e),u=s===c,p=x.useRef(null),m=ds(l,p);return{compositeProps:x.useMemo(()=>({tabIndex:u?0:-1,onFocus(){o(c)},onMouseMove(){const h=p.current;if(!t||!h)return;const b=h.hasAttribute("disabled")||h.ariaDisabled==="true";!u&&!b&&h.focus()}}),[u,o,c,t]),compositeRef:m,index:c}}function Ez(e){const{render:t,className:s,style:o,state:l=Gt,props:c=Or,refs:u=Or,metadata:p,stateAttributesMapping:m,tag:g="div",...h}=e,{compositeProps:b,compositeRef:_}=V2({metadata:p});return Ct(g,e,{state:l,ref:[...u,_],props:[b,...c,h],stateAttributesMapping:m})}function q2(e){if(Vt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!rs(e))return q2(us(e))}function Rz(e,t){const s=x.useRef(null);function o(c){is.flushSync(()=>{e.setOpen(!1,at(_o,c.nativeEvent,c.currentTarget))}),h5(s.current)?.focus()}function l(c){const u=e.select("positionerElement");if(u&&Rl(c,u))e.context.beforeContentFocusGuardRef.current?.focus();else{is.flushSync(()=>{e.setOpen(!1,at(_o,c.nativeEvent,c.currentTarget))});let p=g5(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(u,p);){const m=p;if(p=ab(p),p===m)break}p?.focus()}}return{preFocusGuardRef:s,handlePreFocusGuardFocus:o,handleFocusTargetFocus:l}}function Tz(e){const{enabled:t=!0,mouseDownAction:s,open:o}=e,l=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(s==="open"&&!o||s==="close"&&o)&&(l.current=!0,pt(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:Gt,[t,s,o])}const _d=2,Mz=qk(function(t,s){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,id:m,openOnHover:g,delay:h=100,closeDelay:b=0,handle:_,payload:k,...C}=t,y=Hr(!0),w=_?.store??y?.store;if(!w)throw new Error(nn(85));const S=Xa(m),N=w.useState("isTriggerActive",S),E=w.useState("floatingRootContext"),R=w.useState("isOpenedByTrigger",S),M=w.useState("triggerPopupId",S),T=x.useRef(null),A=Oz(),z=Nb(!0),I=Br(),D=x.useMemo(()=>I??new ib,[I]),P=LS(D),L=Ir(),{registerTrigger:U,isMountedByThisTrigger:q}=e2(S,T,w,{payload:k,closeDelay:b,parent:A,floatingTreeRoot:D,floatingNodeId:P,floatingParentNodeId:L,keyboardEventRelay:z?.relayKeyboardEvent}),$=A.type==="menubar",V=w.useState("disabled"),G=u||V||$&&A.context.disabled,{getButtonProps:K,buttonRef:F}=Vr({disabled:G,native:p});x.useEffect(()=>{!R&&A.type===void 0&&(w.context.allowMouseUpTriggerRef.current=!1)},[w,R,A.type]);const X=x.useRef(null),H=wn(),Q=Ve(ve=>{if(!X.current)return;H.clear(),w.context.allowMouseUpTriggerRef.current=!1;const Re=ve.target;if(Qe(X.current,Re)||Qe(w.select("positionerElement"),Re)||Re===X.current||Re!=null&&q2(Re)===w.select("rootId"))return;const Le=H2(X.current);ve.clientX>=Le.left-_d&&ve.clientX<=Le.right+_d&&ve.clientY>=Le.top-_d&&ve.clientY<=Le.bottom+_d||D.events.emit("close",{domEvent:ve,reason:tS})});x.useEffect(()=>{R&&w.select("lastOpenChangeReason")===jn&&pt(X.current).addEventListener("mouseup",Q,{once:!0})},[R,Q,w]);const Y=$&&A.context.hasSubmenuOpen,oe=l2(E,{enabled:(g??Y)&&!G&&A.type!=="context-menu"&&(!$||Y&&!q),handleClose:u2({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:A.type===void 0?h:void 0,delay:{close:b},triggerElementRef:T,externalTree:D,isActiveTrigger:N,isClosing:()=>w.select("transitionStatus")==="ending"}),ne=Az(R,w.select("lastOpenChangeReason")),te=IS(E,{enabled:!G&&A.type!=="context-menu",event:R&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:A.type===void 0?ne:!1}),le=s2(E,{enabled:!G&&Y}),fe=Tz({open:R,enabled:$,mouseDownAction:"open"}),ze=x.useMemo(()=>Dn(le.reference,te.reference),[le.reference,te.reference]),be=w.useState("triggerProps",q),{preFocusGuardRef:pe,handlePreFocusGuardFocus:je,handleFocusTargetFocus:Ne}=Rz(w,T),Be={disabled:G,open:R},Ue=[X,s,F,U,T],ye=[ze,oe??Gt,be,{"aria-haspopup":"menu","aria-controls":M,id:S,onMouseDown:ve=>{if(w.select("open"))return;H.start(200,()=>{w.context.allowMouseUpTriggerRef.current=!0}),pt(ve.currentTarget).addEventListener("mouseup",Q,{once:!0})}},$?{role:"menuitem"}:{},fe,C,K],De=Ct("button",t,{enabled:!$,stateAttributesMapping:Zh,state:Be,ref:Ue,props:ye});return $?r.jsx(Ez,{tag:"button",render:o,className:l,style:c,state:Be,refs:Ue,props:ye,stateAttributesMapping:Zh}):R?r.jsxs(x.Fragment,{children:[r.jsx(Ul,{ref:pe,onFocus:je},`${S}-pre-focus-guard`),r.jsx(x.Fragment,{children:De},S),r.jsx(Ul,{ref:w.context.triggerFocusTargetRef,onFocus:Ne},`${S}-post-focus-guard`)]}):r.jsx(x.Fragment,{children:De},S)});function Az(e,t){const s=wn(),[o,l]=x.useState(!1);return Ie(()=>{e&&t==="trigger-hover"?(l(!0),s.start(D5,()=>{l(!1)})):e||(s.clear(),l(!1))},[e,t,s]),o}function Oz(){const e=Gf(!0),t=Hr(!0),s=B2();return x.useMemo(()=>s?{type:"menubar",context:s}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,s])}function zz(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function $2({...e}){return r.jsx(Nz,{"data-slot":"dropdown-menu",...e})}function F2({...e}){return r.jsx(Mz,{"data-slot":"dropdown-menu-trigger",...e})}function G2({align:e="start",alignOffset:t=0,side:s="bottom",sideOffset:o=4,className:l,...c}){return r.jsx(az,{children:r.jsx(mz,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:s,sideOffset:o,children:r.jsx(tz,{"data-slot":"dropdown-menu-content",className:St("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",l),...c})})})}function Dz({className:e,inset:t,variant:s="default",...o}){return r.jsx($4,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":s,className:St("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...o})}function Pz({...e}){return r.jsx(hz,{"data-slot":"dropdown-menu-radio-group",...e})}function Lz({className:e,children:t,inset:s,...o}){return r.jsxs(bz,{"data-slot":"dropdown-menu-radio-item","data-inset":s,className:St("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[r.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:r.jsx(vz,{children:r.jsx(bo,{})})}),t]})}const Iz={common:{loading:"Cargando…",saving:"Guardando…",cancel:"Cancelar",save:"Guardar",delete:"Borrar",edit:"Editar",create:"Crear",add:"Agregar",remove:"Quitar",reload:"Recargar",shutdown:"Apagar",enabled:"Habilitado",disabled:"Deshabilitado",enable:"Habilitar",disable:"Deshabilitar",open:"Abrir",close:"Cerrar",confirm:"Confirmar",optional:"(opcional)",none:"—",none_yet:"Todavía no hay nada.",error_generic:"Algo salió mal.",search:"Buscar",new:"Nuevo",restore:"Restaurar",show:"Mostrar",hide:"Ocultar",copy:"Copiar",run:"Ejecutar"},daemon:{connecting:"Conectando con el daemon…",unreachable:"No pude llegar al daemon en localhost:7430.",unreachable_hint:"Arrancá APX con `apx daemon start` y refrescá.",version:"Versión",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — relee ~/.apx/config.json sin reiniciar.",shutdown_confirm:"¿Apagar el daemon? Las próximas requests fallarán hasta levantarlo de nuevo.",shutdown_done:"Daemon detenido."},pairing:{title:"Vincular este equipo",subtitle:"Estás entrando desde fuera de esta máquina. Por seguridad, vinculá este navegador con un código de pairing.",steps_title:"Cómo obtener el código",step_1:"En la PC donde corre APX, abrí una terminal.",step_2:"Ejecutá `apx pair` (o escaneá el QR con APX Deck).",step_3:"Copiá el código que aparece debajo del QR y pegalo acá.",code_label:"Código de pairing",code_ph:"p. ej. 7f3a1c9e-…",label_label:"Nombre de este equipo",label_ph:"p. ej. Notebook del living",submit:"Vincular",linking:"Vinculando…",success:"Equipo vinculado ✓",err_required:"Pegá el código de pairing.",err_expired:"El código expiró. Volvé a correr `apx pair` y probá de nuevo.",err_unknown:"Código desconocido o ya usado. Generá uno nuevo con `apx pair`.",err_generic:"No se pudo vincular. Revisá el código e intentá otra vez.",revoke_hint:"Podés revocar este equipo cuando quieras desde Settings o con `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Proyecto",add_project:"Agregar proyecto",all_projects:"Todos los proyectos",more_projects:"{count} más",collapse_projects:"Ocultar proyectos",expand_projects:"Mostrar proyectos",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Proyecto",breadcrumb_base:"Base",breadcrumb_projects:"Proyectos",light:"Cambiar a claro",dark:"Cambiar a oscuro",lang_toggle:"Idioma"},admin:{title:"APX",subtitle:"Panel general. Configuración global, canales y proyectos.",engines_title:"Engines",engines_subtitle:"Adaptadores LLM disponibles. Las API keys viven en ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Canales configurados. Cada uno puede estar pineado a un proyecto.",telegram_polling_on:"Polling activo",telegram_polling_off:"Deshabilitado",telegram_add_channel:"Canal",telegram_send_test:"Probar",telegram_send_test_title:"Enviar a",telegram_default_message:"Mensaje de prueba desde el panel de APX ✅",projects_title:"Proyectos registrados",projects_subtitle:"Click en un proyecto para abrir su panel.",unregister:"Desregistrar",unregister_confirm:"¿Quitar {label} de APX? La carpeta no se borra; sólo se desregistra.",reload_success:"Config recargada.",telegram_polling_started:"Polling iniciado.",telegram_polling_stopped:"Polling detenido.",telegram_channel_removed:"Canal eliminado.",agents_badge:"agents",engine_badge:"sí",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Agregar proyecto",subtitle:"APX indexará .apc/, agents y AGENTS.md en esa carpeta.",path_label:"Ruta absoluta",path_hint:"Equivalente a apx project add /ruta/al/proyecto",path_placeholder:"/Volumes/SSDT7Shield/proyectos_varios/mi-proyecto",register:"Registrar",path_required:"Ruta requerida.",registered:"Proyecto #{id} registrado.",search_btn:"Buscar",picker_prompt:"Elegí la carpeta del proyecto",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",language:"Idioma",daemon:"Daemon",daemon_sub:"Estado del proceso local que sirve esta web y orquesta los agentes.",engines:"Engines disponibles",engines_sub:"Adaptadores LLM compilados con el daemon.",token:"Token para esta sesión",token_sub:"Si esta web no logró auto-cargar el token, pegalo acá.",token_active:"(ya hay token activo)",token_paste:"Pegá el bearer del daemon",token_saved:"Token guardado.",devices:"Dispositivos pareados",devices_sub:"GET /pair/list. Revocar invalida ese bearer en el daemon.",devices_empty:"No hay clientes pareados todavía.",devices_revoke_confirm:"Revocar cliente {id}?",devices_revoke_success:"Cliente revocado.",devices_pair_btn:"Vincular dispositivo",devices_pair_title:"Vincular dispositivo",devices_pair_desc:"Escaneá el QR con la cámara del celu para entrar directo, o pegá el código en la otra PC.",devices_pair_scan:"Escaneá con la cámara del teléfono — te abre la web ya vinculada.",devices_pair_code:"O pegá este código en la pantalla de pairing:",devices_pair_url:"URL de acceso",devices_pair_link:"O copiá este link y abrilo en el otro dispositivo (entra solo):",devices_pair_copy:"Copiar",devices_pair_copied:"Link copiado al portapapeles.",devices_pair_copied_code:"Código copiado.",devices_pair_expires:"Expira en {s}s",devices_pair_expired:"El código expiró.",devices_pair_regen:"Generar otro",devices_pair_waiting:"Esperando que el dispositivo confirme…",devices_pair_done:"Dispositivo vinculado ✓",devices_pair_localhost_only:"Solo se pueden generar códigos desde la PC del daemon (localhost).",devices_last_seen:"visto:",devices_never:"nunca",devices_revoke:"Revocar",account_section:"Cuenta",agents_section:"Agentes & modelos",channels_section:"Canales & dispositivos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},identity:{title:"Identidad",subtitle:"Datos del usuario. Configuración del agente va en Super-agente.",agent_name:"Nombre del agente",owner_name:"Tu nombre",personality:"Personalidad",owner_context:"Contexto del dueño",owner_context_hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",language:"Idioma preferido",timezone:"Timezone (IANA)",timezone_hint:"ej. America/Argentina/Buenos_Aires",saved:"Identidad guardada."},super_agent:{title:"Super-agente",subtitle:"Personalidad, modelo, prompt y modos del super-agente.",personality:"Personalidad",model:"Modelo activo",model_hint:"Ej: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Prompt extra (system)",system_hint:"Texto que se prepende al system prompt base.",system_ph:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)",fallback_title:"Fallback chain",fallback_hint:"Si el modelo activo falla, prueba estos en orden.",fallback_add:"Agregar modelo a la cadena",saved:"Super-agente guardado.",enabled_label:"Super-agente habilitado",model_active:"Modelo activo (router)",model_configure:"Configurar en Modelos",behavior_subtitle:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos."},engines_keys:{title:"API keys de modelos",subtitle:"Cada engine guarda su key en ~/.apx/config.json. Los valores ya seteados muestran sufijo seguro.",ollama_url:"Ollama URL",ollama_hint:"Por defecto: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(no seteada)",clear:"Borrar key",saved:"Key guardada.",cleared:"Key borrada."},telegram_global:{title:"Telegram (default)",subtitle:"Canal default — los proyectos pueden overridear con su propio canal.",bot_token:"Bot token",chat_id:"Chat ID por defecto",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling habilitado",saved:"Telegram guardado."},advanced:{title:"Avanzado",subtitle:"Editor raw del ~/.apx/config.json. Los secretos se ven *** set *** pero podés escribir uno nuevo.",write:"Aplicar cambios",written:"Config aplicada y daemon recargado.",reload_success:"Config recargada."}},project:{not_found:"Roby no encontró el proyecto {pid}: quizás se desregistró o el ID es incorrecto.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",danger:{title:"Zona peligrosa",subtitle:"Acciones que afectan el registro del proyecto en APX. No tocan archivos del repo.",rebuild_desc:"Re-escanea .apc/, MCPs y agents y regenera el contexto del super-agente para este proyecto.",unregister_desc:"Quita el proyecto del registry de APX. La carpeta del disco se mantiene intacta.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerar contexto de {label}.",rebuild_long:"Vuelve a leer la config APC, lista MCPs y agents disponibles, y reconstruye el system prompt del super-agente. Es seguro de correr — no borra nada. Usalo después de tocar .apc/ a mano o si los cambios no se reflejan.",unregister_confirm_title:"Desregistrar proyecto",unregister_long:"El proyecto deja de aparecer en `apx`. Los archivos del disco (.apc/, código, todo) se mantienen. Podés volver a registrarlo con `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memorias"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"abrir"},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",loaded_subtitle:"Conversación cargada con {slug}. Lo que mandes se agrega a este chat.",empty:"Mandá un mensaje para arrancar la conversación.",placeholder:"Escribí algo y enter para enviar (shift+enter = nueva línea)",send:"Enviar",stop:"Stop",clear:"Limpiar",copy:"copiar",copied:"Copiado.",stopped_marker:" [detenido]",create_agent:"Crear agente",create_agent_title:"Crear agente",create_agent_desc:"Necesario para iniciar chat en proyecto.",role_label:"rol",model_label:"modelo",model_hint:"ej. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Agente master",list:{title:"Chats",new:"Nuevo",search:"Buscar chats…",all_agents:"Todos los agentes",empty:"No hay conversaciones todavía. Arrancá una desde la derecha.",count:"{n} en total",live_with:"Live · {slug}",live_subtitle:"Sesión en memoria"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL en ~/.apx/projects/<id>/tasks/.",add:"agregar",add_label:"Nueva task",add_placeholder:"ej. revisar bug del scroll",empty:"No hay tasks {state}.",empty_open:"No hay tasks abiertas.",created:"Task creada.",create_error:"no pude crear la task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"vence",via:"via",aria_done:"marcar done",aria_drop:"descartar task",aria_reopen:"reabrir task"},global_tasks:{title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Cada rutina dispara un agente o un shell.",empty:"Sin rutinas. Creá una arriba.",new:"nueva",new_btn:"Nueva",delete_confirm:"Borrar rutina {name}?",delete_confirm_body:"Esta acción no se puede deshacer.",saved:"Rutina guardada.",paused:"pausada",next_run:"próxima:",last_run:"última:",enabled_hint:"Activa · corre según el intervalo",disabled_hint:"Pausada · solo con el botón Run",enabled_label:"Habilitada",new_title:"Nueva rutina",edit_title:"Editar {name}",dialog_desc:"Se guarda en .apc/routines.json. La rutina corre mientras el daemon está activo.",name_field:"Nombre (name)",name_no_edit:"No se puede cambiar al editar.",kind_field:"Acción (kind)",schedule_field:"Intervalo (schedule)",schedule_hint:"Elegí un preset o escribilo a mano. Manual = solo corre con el botón Run.",vars_title:"Variables disponibles",what_happens:"Qué va a pasar",list_title:"Rutinas",detail_empty:"Elegí una rutina de la lista.",edit_btn:"Editar",edit_hint:"Abrir el editor: tipo, intervalo, prompt, pre/post y variables.",block_pre:"Pre-commands",block_post:"Post-commands",block_prompt:"Prompt",block_text:"Texto",block_command:"Comando",block_empty:"(vacío)",runs_title:"Ejecuciones",runs_empty:"Sin ejecuciones todavía.",runs_close:"Cerrar",runs_no_detail:"Sin más detalle.",runs_output:"Salida",status_ok:"ok",status_error:"error",status_skipped:"salteada",agent_field:"Agente (spec.agent)",agent_hint:"Quién ejecuta la rutina.",agent_loading:"cargando…",agent_pick:"— elegí un agente —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"qué pendiente hay para hoy?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"resumí el estado del proyecto",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell ANTES del prompt. Uno por línea.",post_field:"Post-commands (post_commands)",post_hint:"Shell DESPUÉS del prompt. Uno por línea.",tg_channel:"Canal (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Mensaje de Telegram (spec.text)",tg_text_hint:"Mensaje fijo a enviar. No usa modelo.",shell_field:"Comando (spec.command)",shell_hint:"Corre tal cual en el shell. Sin prompt ni pre/post.",hb_channel:"Canal (spec.channel)",hb_message:"Mensaje (spec.message)",name_required:"name requerido",save_error:"save falló",run_error:"run falló",toggle_error:"toggle falló",delete_error:"delete falló",run_success:"{name} disparada.",run_confirm:"¿Ejecutar la rutina {name} ahora?",run_confirm_body:"Corre la acción una vez, sin esperar al horario.",running:"Ejecutando…",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en .apc/agents/<slug>.md.",subtitle_full:"Definidos en .apc/agents/<slug>.md. La memoria runtime vive en ~/.apx/projects/<id>/agents/<slug>/.",empty:"Sin agents. Agregá uno con <code>apx agent add</code> o el botón.",empty_text:"Sin agents. Agregá uno con `apx agent add` o el botón de arriba.",new:"Agente",created:"Agent {slug} creado.",slug_invalid:"slug debe matchear /^[a-z][a-z0-9_-]*$/",hierarchy:"Jerarquía",list_view:"Lista",import:"Importar",chat:"Chat",view:"Ver",orchestrator:"Orquestador",new_title:"Nuevo agent",new_desc:"POST /projects/:pid/agents — escribe .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (opcional)",role_ph:"code refactor",model_label:"model (opcional)",model_hint:"ej. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (opcional)",desc_label:"description (opcional)",desc_ph:"Qué hace este agente…",skills_label:"skills (coma)",skills_ph:"skill-a, skill-b",tools_label:"tools (coma)",tools_ph:"tool-a, tool-b",parent_label:"reporta a (parent, opcional)",parent_hint:"Subagente de un orquestador.",none_parent:"— ninguno —",master_label:"Orquestador (master)",create_success:"Agent {slug} creado.",create_error:"create falló",import_title:"Importar del vault",import_desc:"Plantillas en ~/.apx/agents. Se registran en este proyecto (.apc/agents/<slug>.md).",import_empty:"Sin plantillas en el vault.",import_success:"Importado: {slug}",import_already:"ya está",import_btn:"Importar"},agent_detail:{not_found:"Agente no encontrado.",chat_btn:"Chat con {slug}",reports_to:"↳ reporta a",no_threads:"Sin threads.",no_activity:"Sin actividad registrada.",threads_recent:"Threads recientes",subagents:"Subagentes",subagents_desc:"Agentes que reportan a este orquestador.",config_title:"Configuración del agente",type_label:"Tipología (type)",area_label:"Área",area_hint:"ej. operaciones, marketing",area_ph:"operaciones",role_label:"Role",parent_label:"Reporta a (parent)",none_parent:"— ninguno —",model_label:"Modelo base",model_hint:"Vacío = usa el modelo del Router (default). Setealo solo para forzar un modelo a este agente.",model_ph:"(vacío = router default)",skills_label:"Skills (coma)",bio_label:"Bio / descripción",system_label:"System prompt",system_hint:"Define personalidad y comportamiento (cuerpo del AGENT.md).",master_label:"Orquestador (master)",delete_btn:"Borrar agente",save_btn:"Guardar cambios",delete_confirm:'Borrar el agente "{slug}"? Se elimina .apc/agents/{slug}.md y sus datos runtime locales.',update_success:"Agente actualizado.",delete_success:"Agente borrado.",tools_hint:"Qué tools puede usar el agente. Tocá para activar/desactivar; o editá la lista abajo.",tools_custom_ph:"lista (coma): echo, http_fetch",memory_title:"Memoria del agente",memory_empty:"(memoria vacía)",memory_saved:"Memoria guardada.",records_title:"Records",records_desc:"Log de actividad del agente (mensajes/acciones). Lo más nuevo primero.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Estado de ejecución del agente, derivado de sus rutinas.",sleep_deep:"Deep sleep · sin heartbeat",sleep_deep_desc:"Este agente no tiene ninguna rutina que lo dispare. No se ejecuta de forma autónoma; solo responde cuando lo invocás (chat / tarea).",brain_title:"Brain",brain_desc:"Grafo de relaciones reales del agente: memoria, threads, tasks, heartbeats y jerarquía. (primera versión — lo refinamos)",brain_empty:"Aún no hay relaciones para graficar (sin memoria, threads, tasks ni rutinas).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: Runtime > Shared > Global. Conflictos arriba si los hay.",empty:"Sin MCPs configurados.",new:"MCP",delete_confirm:"Borrar MCP {name} de scope {scope}?",conflicts:"⚠ Conflictos: {names}",new_title:"Nuevo MCP",edit_title:"Editar MCP",new_desc:"Se guarda según el scope elegido. Los valores con ${var.X} se resuelven al arrancar el MCP.",scope_label:"Scope",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"Solo este proyecto · con secrets · no se commitea (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"Solo este proyecto · committeable · sin secrets (.apc/mcps.json)",scope_global_desc:"Todos los proyectos de esta máquina (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Proceso local — `command` + args",transport_http_desc:"Endpoint remoto — URL + headers",transport_label:"Transport",name_label:"Nombre",name_ph:"my-mcp",cmd_label:"Comando",cmd_ph:"npx",args_label:"Args",args_hint_tokens:"Una entrada por argumento. Usá el botón + para insertar variables.",env_label:"Env",env_hint_tokens:"Pares clave/valor. Los valores aceptan ${var.NOMBRE} (botón + a la derecha).",env_empty:"Sin variables de entorno.",url_label:"URL",url_ph:"https://example.com/v2/mcp",headers_label:"Headers",headers_hint:"Pares clave/valor — típicamente Authorization: Bearer ${var.TOKEN}.",headers_empty:"Sin headers.",enabled_label:"Habilitado",add_btn:"Agregar",save_btn:"Guardar",add_arg:"Agregar arg",edit_btn:"Editar",test_btn:"Probar",logs_btn:"Logs",testing:"Probando…",test_ok:"OK · {n} tools disponibles",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos."},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
612
+
613
+ Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",defaults_title:"Agent defaults",defaults_desc:"Plantillas globales del vault. Las bundled vienen con APX y siempre están; las que crees o edites quedan en ~/.apx/agents y se superponen. Importalas a un proyecto desde Agents › Importar.",defaults_show_removed:"Mostrar removidos",defaults_new:"Nuevo",defaults_empty:"Sin plantillas en el vault.",defaults_hide:"Ocultar",defaults_restore:"Restaurar",defaults_edit:"Editar",defaults_remove:"Ocultar",defaults_delete:"Borrar",defaults_tombstone_msg:'Ocultar el default "{slug}"? Es bundled — quedá tombstoneado y lo recuperás con Restaurar.',defaults_delete_msg:'Borrar el template "{slug}"?',defaults_hidden:"Ocultado.",defaults_deleted:"Borrado.",defaults_restored:"Restaurado.",defaults_new_title:"Nuevo template",defaults_new_desc:"POST /agents/vault — se guarda en ~/.apx/agents/<slug>.md",defaults_edit_title:'Editar "{slug}"',defaults_bundled_desc:"Es un default bundled. Al guardar se hace copy-on-write a ~/.apx/agents/<slug>.md (queda como override).",defaults_user_desc:"PATCH /agents/vault/:slug — edita el archivo en ~/.apx/agents.",defaults_master_label:"Agente master",defaults_slug_invalid:"slug inválido (debe matchear /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" creado.',defaults_saved:'Template "{slug}" guardado.'},logs:{title:"Logs",desc_global:"Actividad del daemon (canales globales: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Actividad del proyecto. ~/.apx/projects/<id>/messages/.",filter_channel:"filtrar canal (ej. telegram)",filter_dir:"dirección",all_directions:"Todas las direcciones",in:"Entrada (in)",out:"Salida (out)",filter_type:"tipo",all_types:"Todos los tipos",search_text:"buscar en el texto…",count_of:"de",no_activity:"Sin actividad.",no_activity_ch:'Sin actividad en el canal "{ch}".',error:"No pude leer los mensajes: {msg}",show_more:"ver más",show_less:"ver menos",daemon_errors:"Errores del daemon (~/.apx/logs/errors.jsonl)",no_errors:"Sin errores registrados. 🎉"},telegram_contacts:{title:"Contactos de Telegram",desc:"Quién le escribe a los bots. El rol define qué herramientas puede usar; un invitado no tiene permisos hasta que le asignes un rol.",empty:"Todavía no hay contactos — se registran solos cuando alguien escribe a un bot.",owner_badge:"dueño",assign_role:"Asignar rol",owner_hint:"Es dueño de un canal — cambialo desde el canal",removed:"Contacto eliminado.",delete_confirm:"¿Borrar el contacto {name}?",last_seen:"visto:",tools_all:"tools: todas",tools_none:"tools: ninguna",tools_label:"tools:"},telegram_channels:{title:"Canales",desc:"Cada canal es un bot que el daemon polea. Acá podés añadir/quitar canales, cambiar el agente que contesta, el proyecto al que pertenece y su dueño.",new_btn:"Nuevo canal",empty:"Todavía no hay canales — agregá el primero.",removed:"Canal eliminado.",delete_confirm:"¿Borrar el canal {name}?",no_owner:"sin dueño (se reclama al primer DM)",owner_label:"dueño:"},telegram_channel_dialog:{new_title:"Nuevo canal de Telegram",edit_title:"Editar canal: {name}",name_label:"name (slug interno)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug o id del proyecto al que pinear este canal (opcional).",route_label:"route_to_agent",route_hint:"Agente que contesta; vacío = super-agent APX.",owner_label:"owner_user_id",owner_hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",owner_ph:"889721252",respond_label:"Responder con engine (no echo)",name_required:"name requerido",saved:"Canal guardado."},telegram_send_dialog:{title:"Enviar a {name}",default_msg:"Mensaje de prueba desde el panel de APX ✅"},telegram_roles:{title:"Roles",desc:"Cada rol define qué herramientas del super-agent puede usar quien lo tenga asignado. 'owner' siempre = todas; 'guest' siempre = ninguna (solo chat).",empty:"No hay roles definidos.",tools_all:"todas las herramientas",tools_none:"ninguna herramienta",builtin:"built-in",delete_confirm:'¿Borrar el rol "{name}"?',removed:"Rol eliminado.",saved:'Rol "{name}" guardado.',name_required:"Nombre requerido.",builtin_error:'"{name}" es un rol built-in.',new_title:"Nuevo rol o reemplazar uno custom",name_label:"Nombre",name_ph:"editor",tools_label:"Tools (separadas por coma)",tools_hint:"Vacío = ninguna. Ejemplos: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Acceso total (todas las tools)",save_btn:"Guardar rol",delete_btn:"Borrar"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Conversación rápida con tu super-agente. Tiene acceso a tools (proyectos, tasks, mcps, agentes); para un hilo más largo y persistente, abrí Chats.",empty:"Mandale un mensaje a {persona} para arrancar.",thinking:"{persona} está pensando…",talk:"Hablar con {persona}",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Roby se perdió: esta página no existe o se movió.",home:"Volver al inicio"},ask_panel:{answers_header:"Respuestas",other:"Otro",other_placeholder:"Escribí tu propia respuesta acá",text_placeholder:"Escribí tu respuesta…",back:"Atrás",skip:"Omitir",next:"Siguiente",submit:"Enviar",status_waiting:"Esperando respuesta…",status_received:"Respuestas recibidas"},code_module:{title:"Code",badge:"super-agent",desc:"Sesiones de código estilo OpenCode. Elegí un proyecto, abrí una sesión y pedile que lea, planifique, edite o ejecute.",no_projects:"No hay proyectos registrados. Registrá uno con `apx project add` para usar Code.",sessions:"Sesiones",new_session:"Nueva sesión",untitled:"Nueva sesión",no_sessions:"Todavía no hay sesiones — creá una para empezar a codear.",pick_project:"Elegí un proyecto para ver sus sesiones.",rename:"Renombrar",delete:"Eliminar",delete_confirm:"¿Eliminar esta sesión? Se borra la transcripción; tus archivos quedan intactos.",empty_chat:"Mandá una instrucción de código para arrancar.",placeholder:"Pedí un cambio… (enter envía, shift+enter = nueva línea)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edita archivos y ejecuta comandos",mode_plan_hint:"Plan — solo lectura, propone cambios sin tocar archivos",tab_context:"Contexto",tab_changes:"Cambios",tab_artifacts:"Artifacts",artifacts_none:"Todavía no hay artifacts. Pedile al agente que cree un script en `artifacts/<nombre>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copiar path",artifacts_run:"Run",artifacts_run_hint:"Para ejecutarlo desde la terminal:",artifacts_delete:"Eliminar",artifacts_delete_confirm:"¿Eliminar este artifact? El archivo se borra del disco.",ctx_model:"Modelo",ctx_tokens:"Tokens",ctx_input:"Entrada",ctx_output:"Salida",ctx_messages:"Mensajes",ctx_breakdown:"Desglose de contexto",ctx_none:"Sin uso todavía — mandá un turno para ver tokens.",seg_system:"Sistema",seg_user:"Usuario",seg_assistant:"Asistente",seg_tool:"Tools",seg_other:"Otro",changes_none:"Todavía no hay cambios en esta sesión.",changes_no_git:"Los cambios necesitan un repo git. Este proyecto no lo es.",changes_files:"{n} archivo(s) cambiados",stopped:"[detenido]",close:"Cerrar",reload:"Recargar",discard_changes:"Descartar cambios",save_shortcut_hint:"Guardar (Cmd/Ctrl+S)",artifacts_rename:"Renombrar",artifacts_view:"Ver contenido",artifacts_edit:"Editar contenido",tree_collapse_all:"Colapsar todo",terminal_clear:"Limpiar",terminal_close:"Cerrar terminal"},desktop_screen:{status_title:"Estado",autostart_title:"Arranque automático",shortcut_title:"Atajo de teclado",appearance_title:"Apariencia",activation_title:"Activación + transcripción",last_conv_title:"Última conversación"},voice_screen:{providers_title:"Proveedores de voz (TTS)",test_title:"Probar voz",stt_title:"Transcripción (STT)",configure_provider:"Configurar {name}"},deck_screen:{widgets_title:"Widgets",context_title:"Contexto APX",reload_manifest:"Recargar manifest",widget_native:"Widget nativo APX",widget_external:"Widget externo"},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí un proveedor y un modelo. 'Automático' prueba local primero y cae a offline si no hay nada disponible.",provider_label:"Proveedor",provider_hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de abajo).",mode_label:"Modo de selección",mode_hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",available:"disponible",unavailable:"no disp.",test_btn:"Probar embedding",reindex_btn:"Reindexar memoria",test_ok:"Embedding OK con {embedder}",test_failed:"Test falló: {msg}",reindexed:"Reindexado: {indexed} chunks (limpiados {cleared}).",reindex_failed:"Reindex falló: {msg}",save_failed:"No se pudo guardar: {msg}",provider_auto:"Automático (cadena: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, sin API key (nomic-embed-text)",provider_gemini:"Gemini — free tier con key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, sin modelo — degradado)",mode_chain:"Cadena (fallback automático)",mode_single:"Único (usa solo el elegido)",ollama_title:"Ollama (local)",ollama_desc:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",model_label:"Modelo",base_url_label:"Base URL",ollama_base_url_hint:"Vacío usa engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) u otro modelo compatible.",api_key_label:"API key",openai_key_hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para mantener la guardada.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier con API key de Google.",gemini_key_hint:"Vacío reusa engines.gemini.api_key.",compaction_title:"Compactación de historial",compaction_desc:"Cuando un chat supera el umbral de turnos, los más viejos se resumen con un LLM liviano (local) y se guardan como [RESUMEN COMPACTADO], manteniendo el contexto acotado. Corre fuera del hot-path: el turno actual usa el resumen que ya exista.",threshold_label:"Umbral de compactación",threshold_hint:"Compactar una vez que el chat supera estos turnos (por defecto 60).",keep_recent_label:"Turnos recientes a preservar",keep_recent_hint:"Turnos verbatim que NUNCA se compactan (por defecto 40). Debe ser menor al umbral.",compact_model_label:"Modelo de compactación",compact_model_hint:"LLM liviano para resumir. Ideal uno local (Ollama) para no gastar. Formato proveedor:modelo.",compact_fallback_label:"Modelo de fallback",compact_fallback_hint:"Se usa si el de compactación falla. Vacío cae al modelo del super-agente.",compact_fallback_ph:"(vacío → modelo del super-agente)"},router_panel:{title:"Router de modelos",description:"Un único router general (sin casos por tarea). Elegí un proveedor y un modelo; si el activo falla, prueba la cadena de fallback en orden.",badge_default:"default",no_providers:"Agregá un proveedor abajo para poder elegir modelos.",active_model_label:"Modelo activo (default)",active_model_hint:"Proveedor + modelo. Se guarda como proveedor:modelo.",fallback_title:"Cadena de fallback",fallback_desc:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo.",fallback_empty:"Sin fallback configurado.",add_to_chain:"Agregar a la cadena",done:"listo",save:"Guardar router",saved:"Guardado",saved_toast:"Router guardado.",provider_ph:"— proveedor —",provider_not_found:"⚠ {name} (no encontrado)",provider_not_configured:'El proveedor "{name}" no está configurado.'},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",empty:"Sin providers. Agregá uno con el botón de arriba.",add_card:"Agregar provider",saved:"Provider guardado.",saved_json:"Provider guardado (JSON).",deleted:"Provider borrado.",delete_confirm:"¿Borrar provider {name}?"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar",custom:"Custom",json_mode:"JSON",form_mode:"Volver al formulario",json_label:"Config del provider (JSON)",json_hint:"Se guarda como engines.{slug} en config.json",json_help:"Debe ser un objeto JSON válido con al menos engine. El slug se toma del formulario.",name_label:"Nombre",name_ph:"Mi provider",engine_label:"Motor (engine)",base_url_label:"URL base (base_url)",base_url_hint:"Se completa sola al elegir un proveedor.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Dejá en blanco para mantener la actual.",api_key_hint_env:"Se guarda como secreto. Env sugerida: {env}",api_key_hint:"Se guarda como secreto.",api_key_set:"…{suffix} (ya seteada)",model_label:"Modelo por defecto",load_models:"Cargar modelos",max_tokens_label:"Máx. tokens (max_tokens)",temperature_label:"Temperatura: {value}",pricing_summary:"Análisis de tokens / pricing (opcional)",context_limit_label:"Límite de contexto (tokens)",price_input:"$ entrada / 1M",price_output:"$ salida / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Límites de contexto por modelo (JSON)",active_label:"Activo (los agentes pueden usarlo)",err_slug_required:"Slug requerido.",err_slug_required_form:"Slug requerido (en el formulario).",err_slug_exists:'Ya existe un provider "{slug}".',err_model_limits_json:"Límites de contexto por modelo: JSON inválido.",err_json_invalid:"JSON inválido: revisá la sintaxis.",err_json_object:"El JSON debe ser un objeto con la config del provider.",err_engine_missing:'Falta "engine" (ej. "anthropic", "ollama").',err_save:"Error al guardar.",err_no_models:"Sin modelos. ¿Key/URL correctas?",err_list_models:"No se pudo listar modelos."},providers_card:{active:"Activo",off:"Off",model:"Modelo",base_url:"Base URL",api_key:"API key",key_set:"✓ seteada",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (ya seteada)",api_key_keep_hint:"Dejá en blanco para mantener la actual.",api_key_secret_hint:"Se guarda como secreto. Env: {env}",api_key_reuse_hint:"Si lo dejás vacío, reusa {engine}. Env: {env}",err_save:"Error al guardar.",model_label:"Modelo",voice_label:"Voz",format_label:"Formato",output_format_label:"Formato de salida",voice_id_label:"Voice ID",voice_id_hint:"Voice id de ElevenLabs (vacío = default).",gemini_model_hint:"El TTS de Gemini todavía está en preview.",style_label:"Estilo (cómo debería hablar)",style_hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej.: 'hablá en un tono alegre y pausado'.",style_ph:"hablá en un tono alegre y enérgico",piper_bin_label:"Binario (bin)",piper_bin_hint:"Ruta o nombre del CLI de piper (PATH).",piper_model_label:"Modelo (.onnx)",piper_model_hint:"Ruta absoluta al modelo de voz de piper.",piper_speaker_label:"Speaker (opcional)",piper_speaker_hint:"Speaker id para modelos multi-voz.",mock_desc:"El engine mock genera un WAV de prueba en silencio. No tiene parámetros: sirve como fallback garantizado cuando no hay ningún otro engine configurado.",selection_mode:"Modo de selección",mode_chain_desc:"Cadena con fallback: usa el primer engine disponible siguiendo el orden de abajo.",mode_single_desc:"Solo engine default: siempre usa el elegido; el resto queda configurado para otros usos.",mode_chain_btn:"Cadena (router)",mode_single_btn:"Solo engine default",move_up:"Subir",move_down:"Bajar",badge_local:"local",badge_available:"disponible",badge_unavailable:"configurado, no disponible",badge_not_configured:"sin configurar",badge_default:"default",set_as_default:"Usar como default",configure:"Configurar",stt_engine_label:"Engine de transcripción",stt_engine_hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",stt_model_label:"Modelo local (whisper)",stt_model_hint:"Más grande = más preciso y más lento.",stt_language_label:"Idioma",stt_language_hint:'Para español, elegir "Español" mejora la precisión.',stt_provider_auto:"Automático (local, después OpenAI)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",lang_auto:"Detección automática",lang_es:"Español",lang_en:"Inglés",lang_pt:"Portugués",lang_fr:"Francés",lang_it:"Italiano",lang_de:"Alemán",test_default_text:"Hola, soy APX. Esto es una prueba de voz.",test_default_engine:"Default ({name})",test_default_chain:"Default (cadena)",test_unavailable_suffix:" · no disponible",test_empty_error:"Escribí algo para decir.",test_synth_error:"No se pudo sintetizar.",test_engine_label:"Engine",test_engine_hint:"Override del default para probar.",test_style_label:"Estilo (solo Gemini)",test_style_hint:"Cómo debería hablar. Vacío = sin estilo.",test_text_label:"Texto a decir",test_text_ph:"Escribí lo que querés que diga…",say_this:"Decir esto",stop:"Detener",replay:"Repetir",engine_result:"Engine",providers_desc:"Engines de síntesis. El estado lo reporta el daemon en vivo. Elegí cuál usar por defecto.",providers_load_error:"No pude cargar los proveedores: {msg}",test_desc:"Elegí con qué engine sintetizar y, si aplica, cómo debería hablar.",stt_desc:"Engine de speech-to-text que usan el deck, Telegram y la CLI al escuchar.",toast_default_engine:"Engine default: {id}.",toast_mode_chain:"Modo: cadena con fallback.",toast_mode_single:"Modo: solo engine default.",toast_config_saved:"Configuración de voz guardada.",toast_transcription_updated:"Transcripción actualizada."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",bot_token_hint:"Token de BotFather. Se guarda en ~/.apx/config.json.",bot_token_hint_short:"Token de BotFather.",secret_set_replace:"(seteado — escribí para reemplazar)",secret_already_set:"(ya seteado)",empty_keep:"— vacío = mantener",message_sent:"Mensaje enviado.",message_label:"Texto",send_chat_id:"chat_id: {id}",default_apx:"APX por defecto",yes:"sí",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_ui:{model_router_default:"modelo: default del router",slug_kebab_hint:"kebab-case, ej. reviewer, my-agent, content-writer",comma_separated:"separadas por coma",body_hint:"markdown — extiende el system prompt del agente",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorador",type_none:"— sin tipo —",type_orchestrator:"Orquestador",type_orchestrator_desc:"Coordina el equipo y delega.",type_specialist:"Especialista",type_specialist_desc:"Experto en el dominio; corre tareas.",type_assistant:"Asistente",type_assistant_desc:"Ayudante conversacional.",type_worker:"Worker",type_worker_desc:"Corre tareas autónomas.",type_monitor:"Monitor",type_monitor_desc:"Vigila el estado y reporta.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definición (frontmatter + system prompt).",memory_durable_desc:"hechos durables que el agente recuerda.",running:"running",paused:"pausada",last_error:"última: error",field_tick:"Tick",field_next_tick:"Próximo tick",field_last_tick:"Último tick",field_last_run:"Última corrida",tools_label:"Tools",kind_agent:"agente",kind_memory:"memoria",kind_thread:"thread",kind_task:"task",kind_routine:"rutina",kind_hierarchy:"jerarquía",nodes_drag_hint:"{n} nodos · arrastrá para reordenar",kind_exec_agent:"Agente del proyecto",kind_exec_agent_desc:"Corre un agente del proyecto con un prompt. Vos elegís cuál.",kind_super_agent:"Super-agente",kind_super_agent_desc:"Llama al super-agente APX con un prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Manda un mensaje fijo a un canal de Telegram. Sin modelo ni agente.",kind_shell:"Shell",kind_shell_desc:"Corre un comando shell. Sin prompt ni pre/post — el comando es la acción.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",unit_seconds:"segundos",unit_minutes:"minutos",unit_hours:"horas",unit_days:"días",every_n_unit:"cada {n} {unit}",every_v:"cada {v}",preset_every_10m:"cada 10 min",preset_hourly:"cada hora",preset_daily_9am:"diario 9am",preset_weekdays_9am:"días hábiles 9am",preset_manual:"Manual",var_pre_output_prompt:"Salida de texto de los pre-commands. Se reemplaza dentro del prompt/texto antes de enviarlo. Útil para inyectar datos frescos (clima, una API) en la instrucción.",var_llm_output:"Respuesta final del agente o super-agente. Disponible en los post-commands como variable de entorno. Ej: reenviarla por Telegram.",var_status:"Resultado de la acción: ok o error. Disponible en los post-commands para decidir qué hacer después.",var_skipped:"Vale 1 si la acción se salteó (por skip_prompt_on), 0 si corrió. Disponible en los post-commands.",var_pre_output:"Salida completa de los pre-commands, como variable de entorno en los post-commands (hasta 32k).",var_pre_output_file:"Ruta a un archivo temporal con la salida de los pre-commands. Para salidas grandes que no convienen como variable.",var_pre_exit:"Código de salida del último pre-command (0 = ok). Disponible en los post-commands.",var_routine:"Nombre de esta rutina. Disponible como variable de entorno en los comandos.",summary_runs_agent:'Corre el agente "{agent}"',summary_runs_agent_none:"Corre un agente (todavía no elegiste cuál)",summary_super_agent:"Llama al super-agente",summary_telegram:'Manda Telegram a "{channel}"',summary_runs_cmd:"Corre: {cmd}",summary_shell:"Corre un comando shell",summary_heartbeat:"Deja un heartbeat en los logs",action_agent_answers:'El agente "{agent}" responde el prompt',action_agent_pick_answers:"El agente (elegí uno) responde el prompt",action_super_answers:"El super-agente responde el prompt",action_telegram_channel:'Manda Telegram al canal "{channel}"',action_runs_shell:"Corre el comando shell",step_pre:"Pre",step_post:"Post",last_label:"última:",tg_chat_id_ph:"(usa el del canal)",tg_text_ph:"mensaje a enviar",hb_message_ph:"sigo vivo",arg_placeholder:"--flag o valor",remove_arg:"quitar arg",super_agent_label:"{persona} (super-agente)",super_agent_badge:"super-agente"},modules_ui:{desktop_pos_left:"Izquierda",desktop_pos_center:"Centro",desktop_pos_right:"Derecha",desktop_theme_light:"Claro",desktop_theme_dark:"Oscuro",desktop_status_desc:"La ventana se abre desde la terminal o por arranque automático.",desktop_running:"Corriendo",desktop_stopped:"Detenida",desktop_refresh:"refrescar",desktop_from_terminal:"Desde la terminal:",desktop_autostart_desc:"Abre la ventana al iniciar sesión. Equivale a `apx desktop install` (no requiere sudo).",desktop_platform:"plataforma: {platform}",desktop_shortcut_desc:"Atajo global que muestra/oculta la ventana y empieza a escuchar.",desktop_accelerator:"Acelerador",desktop_accelerator_hint:'Formato Electron, ej. "CommandOrControl+G" o "CommandOrControl+Shift+Space". Reiniciá la ventana para aplicar.',desktop_shortcut_saved:"Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.",desktop_autostart_on:"Arranque automático habilitado para el próximo inicio de sesión.",desktop_autostart_off:"Arranque automático deshabilitado.",desktop_appearance_desc:"Tema de la ventana y posición en la pantalla.",desktop_theme:"Tema",desktop_restart_apply:"Reiniciá la ventana para aplicar.",desktop_theme_set:"Tema: {value}.",desktop_position:"Posición",desktop_position_hint:'"izquierda" / "centro" / "derecha" del borde superior.',desktop_position_set:"Posición: {value}.",desktop_activation_desc:"El plugin del daemon procesa los mensajes. El STT se configura en Voces.",desktop_enabled_toast:"Escritorio habilitado.",desktop_disabled_toast:"Escritorio deshabilitado.",desktop_plugin_on:"Plugin habilitado (responde mensajes)",desktop_plugin_off:"Plugin deshabilitado",desktop_stt_engine:"Motor de speech-to-text:",desktop_stt_engine_suffix:"(whisper local, idioma, modelo).",desktop_last_conv_desc:"El último intercambio con el agente desde la ventana flotante.",desktop_no_messages:"Todavía no hay mensajes. Mandá algo a la ventana de escritorio para que aparezca acá.",desktop_you:"Vos",desktop_roby:"Roby",desktop_empty_msg:"(vacío)",deck_widget_enabled:"Widget {id} habilitado.",deck_widget_disabled:"Widget {id} deshabilitado.",deck_save_error:"Error al guardar",deck_loading_manifest:"Cargando manifest…",deck_manifest_error:"Error al cargar el manifest.",deck_widgets_summary:"{count} widgets · {enabled} externos habilitados",deck_loading_manifest_full:"Cargando el manifest del Deck…",deck_manifest_load_failed:"No se pudo cargar el manifest del Deck.",deck_retry:"Reintentar",deck_no_widgets:"No hay widgets en el manifest.",deck_context_desc:"Información que el Deck ve desde el daemon.",deck_active_project:"Proyecto activo:",deck_none:"ninguno",deck_registered_projects:"Proyectos registrados:",deck_active_plugins:"Plugins activos:",deck_daemon_active:"activo · {uptime}",deck_daemon_started:"iniciado",deck_safety_no_shell:"sin shell directo",deck_safety_no_arbitrary:"comandos arbitrarios bloqueados",deck_safety_confirm:"las acciones peligrosas requieren confirmación",code_copied:"Copiado.",code_saved:"Guardado.",code_file_empty:"(vacío)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Agente principal con todas las tools",code_chat_tab:"Chat",code_panel_sessions:"Lista de sesiones",code_panel_tree:"Árbol de archivos",code_panel_terminal:"Terminal",code_panel_context:"Panel de contexto",code_ctx_auto:"auto",code_ctx_mode:"Modo",code_ctx_agent:"Agente",code_ctx_msgs_value:"{user} usuario · {assistant} asistente",code_ctx_tokens_total:"Tokens Total",code_ctx_created:"Creado",code_ctx_activity:"Actividad",code_project_fallback:"proyecto {id}",code_pick_project_ph:"Elegí un proyecto…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"Ver",code_artifact_edit_short:"Editar",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncado"},settings_ui:{bearer_label:"Bearer",global_config_desc:"Config general en ~/.apx/config.json. Editable por tabs; el JSON queda separado.",global_json_desc:"Los secretos redacted no se sobrescriben.",save_json:"Guardar JSON",expand_menu:"Expandir menú",collapse_menu:"Colapsar menú",documentation:"Documentación",kind_personal:"Personal",kind_company:"Empresa",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Otro",base_menu_view:"Vista del menú Base (workspace general).",coming_soon:"Próximamente",inspector_title:"Skill Inspector (RAG por turno)",inspector_desc:"Función experimental. Cuando está activa, el agente NO recibe la lista completa de skills en su prompt; en cada mensaje un RAG local decide qué skill(s) cargar — el cuerpo completo si hay match fuerte, una sugerencia si es medio, nada si no aplica. Se reevalúa en cada turno: una skill que dejó de ser relevante desaparece del contexto.",enable_inspector:"Habilitar inspector",enable_inspector_hint:"Off = comportamiento clásico (lista de slugs + sugerencia pasiva). On = el RAG decide por turno.",on:"On",off:"Off",index_count:"Índice: {n} skills",not_indexed:"sin indexar",dim:"dim {dim}",updated_at:"actualizado {date}",reindex:"Reindexar",reindex_forced:"Reindexar (forzado)",embedder_source:"El embedder viene de Memoria (RAG). Local con Ollama, u offline si no hay proveedor configurado.",thresholds_title:"Umbrales y límites",thresholds_desc:"Ajustá qué tan agresivo es el inspector. Subir los umbrales = menos falsos positivos pero más riesgo de perderte una skill; bajarlos = al revés.",test_title:"Probar (dry-run)",test_desc:"Escribí un mensaje como lo haría un usuario y mirá qué skills cargaría/sugeriría el inspector — sin llamar al modelo. Fuerza el inspector aunque esté apagado arriba.",test_placeholder:"ej.: necesito crear un video promocional con voz en off",test_btn:"Probar",jit_empty_index:"JIT (índice vacío)",loaded_label:"Cargadas:",suggested_label:"Sugeridas:",could_not_save:"No se pudo guardar: {msg}",indexed_with:"Indexado con {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Falló el indexado: {msg}",dry_run_failed:"Falló el dry-run: {msg}",knob_load_threshold:"Umbral de carga",knob_load_threshold_hint:"Similaridad mínima para inyectar el CUERPO de la skill (alto = más estricto).",knob_hint_threshold:"Umbral de sugerencia",knob_hint_threshold_hint:"Similaridad mínima para solo SUGERIR la skill (así el agente la carga si quiere).",knob_margin:"Margen sobre la 2da",knob_margin_hint:"La primera tiene que superar a la segunda por este margen para cargar su cuerpo (evita empates flojos).",knob_max_loaded:"Máx. cuerpos cargados",knob_max_loaded_hint:"Cuántas skills se inyectan completas por turno.",knob_max_hints:"Máx. sugerencias",knob_max_hints_hint:"Cuántas skills extra se nombran como sugerencia.",knob_prompt_floor:"Largo mínimo del prompt",knob_prompt_floor_hint:"Los mensajes más cortos que esto se ignoran (evita 'ok', 'hola').",knob_body_char_cap:"Tope de chars del cuerpo",knob_body_char_cap_hint:"Recorta los cuerpos largos para que no inflen el contexto.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Solo valores específicos del proyecto; vacío hereda del global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Modelo del super-agente",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Prompt extra",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Responder con engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Proyecto",cfg_project_desc:".apc/project.json. Metadata APC portable; sin secretos, sin runtime.",cfg_name:"Nombre",cfg_version:"Versión",cfg_apc_spec:"APC spec",cfg_apx_install:"Estado de instalación APX",cfg_apx_storage_id:"ID de storage APX"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) eligió estas skills para este turno",tools_count:"{n} tools",tool_read_file:"Leer archivo",tool_write_file:"Escribir archivo",tool_edit_file:"Editar archivo",tool_list_files:"Listar archivos",tool_search_files:"Buscar en archivos",tool_search_messages:"Buscar mensajes",tool_tail_messages:"Últimos mensajes",tool_run_shell:"Correr shell",tool_send_telegram:"Enviar Telegram",tool_call_agent:"Llamar agente",tool_call_mcp:"Llamar MCP",tool_call_runtime:"Llamar runtime",tool_create_task:"Crear task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (decide el router)",model_filter_ph:"filtrar o escribir modelo…",loading_models:"cargando modelos…",use_value:"usar “{value}”",model_combobox_ph:"elegí o escribí un modelo…",search_variable_ph:"buscar variable…",no_matches:"sin coincidencias",create_variable:"Crear nueva variable…",kv_key_ph:"CLAVE",kv_value_ph:"valor",remove_row:"quitar fila",add_row:"Agregar fila",err_chat_failed:"Falló el chat.",err_stream_failed:"Falló el stream.",err_load_conversation:"No se pudo cargar la conversación.",err_stream:"Error de stream."}},Bz={common:{loading:"Loading…",saving:"Saving…",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",add:"Add",remove:"Remove",reload:"Reload",shutdown:"Shut down",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",open:"Open",close:"Close",confirm:"Confirm",optional:"(optional)",none:"—",none_yet:"Nothing here yet.",error_generic:"Something went wrong.",search:"Search",new:"New",restore:"Restore",show:"Show",hide:"Hide",copy:"Copy",run:"Run"},daemon:{connecting:"Connecting to the daemon…",unreachable:"Could not reach the daemon at localhost:7430.",unreachable_hint:"Start APX with `apx daemon start` and refresh.",version:"Version",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — reloads ~/.apx/config.json without restarting.",shutdown_confirm:"Shut down the daemon? Upcoming requests will fail until it restarts.",shutdown_done:"Daemon stopped."},pairing:{title:"Pair this device",subtitle:"You are connecting from outside this machine. For security, pair this browser with a pairing code.",steps_title:"How to get the code",step_1:"On the PC where APX is running, open a terminal.",step_2:"Run `apx pair` (or scan the QR with APX Deck).",step_3:"Copy the code shown below the QR and paste it here.",code_label:"Pairing code",code_ph:"e.g. 7f3a1c9e-…",label_label:"Device name",label_ph:"e.g. Living room laptop",submit:"Pair",linking:"Pairing…",success:"Device paired ✓",err_required:"Paste the pairing code.",err_expired:"The code expired. Run `apx pair` again and try again.",err_unknown:"Unknown or already-used code. Generate a new one with `apx pair`.",err_generic:"Could not pair. Check the code and try again.",revoke_hint:"You can revoke this device at any time from Settings or with `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Project",add_project:"Add project",all_projects:"All projects",more_projects:"{count} more",collapse_projects:"Hide projects",expand_projects:"Show projects",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Project",breadcrumb_base:"Base",breadcrumb_projects:"Projects",light:"Switch to light",dark:"Switch to dark",lang_toggle:"Language"},admin:{title:"APX",subtitle:"Admin panel. Global config, channels and projects.",engines_title:"Engines",engines_subtitle:"Available LLM adapters. API keys live in ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Configured channels. Each one can be pinned to a project.",telegram_polling_on:"Polling active",telegram_polling_off:"Disabled",telegram_add_channel:"Channel",telegram_send_test:"Test",telegram_send_test_title:"Send to",telegram_default_message:"Test message from APX panel ✅",projects_title:"Registered projects",projects_subtitle:"Click a project to open its panel.",unregister:"Unregister",unregister_confirm:"Remove {label} from APX? The folder is not deleted; only unregistered.",reload_success:"Config reloaded.",telegram_polling_started:"Polling started.",telegram_polling_stopped:"Polling stopped.",telegram_channel_removed:"Channel deleted.",agents_badge:"agents",engine_badge:"yes",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Add project",subtitle:"APX will index .apc/, agents and AGENTS.md in that folder.",path_label:"Absolute path",path_hint:"Equivalent to apx project add /path/to/project",path_placeholder:"/path/to/my-project",register:"Register",path_required:"Path required.",registered:"Project #{id} registered.",search_btn:"Browse",picker_prompt:"Pick the project folder",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",language:"Language",daemon:"Daemon",daemon_sub:"Status of the local process that serves this web and orchestrates agents.",engines:"Available engines",engines_sub:"LLM adapters compiled with the daemon.",token:"Session token",token_sub:"If this web could not auto-load the token, paste it here.",token_active:"(token already active)",token_paste:"Paste daemon bearer",token_saved:"Token saved.",devices:"Paired devices",devices_sub:"GET /pair/list. Revoking invalidates that bearer on the daemon.",devices_empty:"No paired clients yet.",devices_revoke_confirm:"Revoke client {id}?",devices_revoke_success:"Client revoked.",devices_pair_btn:"Pair device",devices_pair_title:"Pair device",devices_pair_desc:"Scan the QR with your phone camera to open the web already paired, or paste the code on another PC.",devices_pair_scan:"Scan with your phone camera — opens the web already paired.",devices_pair_code:"Or paste this code on the pairing screen:",devices_pair_url:"Access URL",devices_pair_link:"Or copy this link and open it on the other device (enters automatically):",devices_pair_copy:"Copy",devices_pair_copied:"Link copied to clipboard.",devices_pair_copied_code:"Code copied.",devices_pair_expires:"Expires in {s}s",devices_pair_expired:"The code expired.",devices_pair_regen:"Generate another",devices_pair_waiting:"Waiting for device to confirm…",devices_pair_done:"Device paired ✓",devices_pair_localhost_only:"Codes can only be generated from the daemon's PC (localhost).",devices_last_seen:"seen:",devices_never:"never",devices_revoke:"Revoke",account_section:"Account",agents_section:"Agents & models",channels_section:"Channels & devices",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},identity:{title:"Identity",subtitle:"User data. Agent configuration goes in Super-agent.",agent_name:"Agent name",owner_name:"Your name",personality:"Personality",owner_context:"Owner context",owner_context_hint:"Who you are, what you work on, what the agent should know about you.",language:"Preferred language",timezone:"Timezone (IANA)",timezone_hint:"e.g. America/New_York",saved:"Identity saved."},super_agent:{title:"Super-agent",subtitle:"Personality, model, prompt and modes of the super-agent.",personality:"Personality",model:"Active model",model_hint:"E.g.: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Extra prompt (system)",system_hint:"Text prepended to the base system prompt.",system_ph:"(Empty = the base prompt from core/agent/prompts/super-agent-base.md is used)",fallback_title:"Fallback chain",fallback_hint:"If the active model fails, these are tried in order.",fallback_add:"Add model to chain",saved:"Super-agent saved.",enabled_label:"Super-agent enabled",model_active:"Active model (router)",model_configure:"Configure in Models",behavior_subtitle:"Super-agent behavior. Model and fallback chain are configured in the Model Router."},engines_keys:{title:"Model API keys",subtitle:"Each engine stores its key in ~/.apx/config.json. Already-set values show a safe suffix.",ollama_url:"Ollama URL",ollama_hint:"Default: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(not set)",clear:"Clear key",saved:"Key saved.",cleared:"Key cleared."},telegram_global:{title:"Telegram (default)",subtitle:"Default channel — projects can override with their own channel.",bot_token:"Bot token",chat_id:"Default chat ID",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling enabled",saved:"Telegram saved."},advanced:{title:"Advanced",subtitle:"Raw editor for ~/.apx/config.json. Secrets show as *** set *** but you can write a new one.",write:"Apply changes",written:"Config applied and daemon reloaded.",reload_success:"Config reloaded."}},project:{not_found:"Roby couldn't find project {pid}: it may have been unregistered, or the ID is wrong.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",danger:{title:"Danger zone",subtitle:"Actions that affect APX's project registry. They do not touch repo files.",rebuild_desc:"Re-scans .apc/, MCPs and agents and regenerates the super-agent context for this project.",unregister_desc:"Removes the project from APX's registry. The folder on disk stays intact.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerate context for {label}.",rebuild_long:"Re-reads APC config, lists available MCPs and agents, and rebuilds the super-agent system prompt. Safe to run — nothing is deleted. Use it after editing .apc/ by hand or if changes are not being picked up.",unregister_confirm_title:"Unregister project",unregister_long:"The project disappears from `apx`. Files on disk (.apc/, code, everything) stay. You can re-register it with `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memories"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"open"},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",superagent_title:"Chat with {persona}",superagent_subtitle:"Chat with {persona} — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",loaded_subtitle:"Loaded conversation with {slug}. Sending will append to this thread.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",clear:"Clear",copy:"copy",copied:"Copied.",stopped_marker:" [stopped]",create_agent:"Create agent",create_agent_title:"Create agent",create_agent_desc:"Required to start a chat in this project.",role_label:"role",model_label:"model",model_hint:"e.g. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Master agent",list:{title:"Chats",new:"New",search:"Search chats…",all_agents:"All agents",empty:"No conversations yet. Start one from the right.",count:"{n} total",live_with:"Live · {slug}",live_subtitle:"In-memory session"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",delete_confirm_body:"This can't be undone.",saved:"Routine saved.",paused:"paused",next_run:"next:",last_run:"last:",enabled_hint:"Active · runs on schedule",disabled_hint:"Paused · only via Run button",enabled_label:"Enabled",new_title:"New routine",edit_title:"Edit {name}",dialog_desc:"Saved in .apc/routines.json. The routine runs while the daemon is active.",name_field:"Name",name_no_edit:"Cannot be changed when editing.",kind_field:"Action (kind)",schedule_field:"Interval (schedule)",schedule_hint:"Choose a preset or type manually. Manual = only runs via Run button.",vars_title:"Available variables",what_happens:"What will happen",list_title:"Routines",detail_empty:"Pick a routine from the list.",edit_btn:"Edit",edit_hint:"Open the editor: kind, schedule, prompt, pre/post and variables.",block_pre:"Pre-commands",block_post:"Post-commands",block_prompt:"Prompt",block_text:"Text",block_command:"Command",block_empty:"(empty)",runs_title:"Executions",runs_empty:"No executions yet.",runs_close:"Close",runs_no_detail:"No further detail.",runs_output:"Output",status_ok:"ok",status_error:"error",status_skipped:"skipped",agent_field:"Agent (spec.agent)",agent_hint:"Who executes the routine.",agent_loading:"loading…",agent_pick:"— pick an agent —",prompt_exec:"Prompt (spec.prompt)",prompt_exec_ph:"what is pending for today?",prompt_super:"Prompt (spec.prompt)",prompt_super_ph:"summarize the project status",pre_field:"Pre-commands (pre_commands)",pre_hint:"Shell BEFORE the prompt. One per line.",post_field:"Post-commands (post_commands)",post_hint:"Shell AFTER the prompt. One per line.",tg_channel:"Channel (spec.channel)",tg_chat_id:"Chat ID (spec.chat_id)",tg_text:"Telegram Message (spec.text)",tg_text_hint:"Fixed message to send. Does not use a model.",shell_field:"Command (spec.command)",shell_hint:"Runs as-is in the shell. No prompt, no pre/post.",hb_channel:"Channel (spec.channel)",hb_message:"Message (spec.message)",name_required:"name required",save_error:"save failed",run_error:"run failed",toggle_error:"toggle failed",delete_error:"delete failed",run_success:"{name} fired.",run_confirm:"Run routine {name} now?",run_confirm_body:"Runs the action once, regardless of the schedule.",running:"Running…",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in .apc/agents/<slug>.md.",subtitle_full:"Defined in .apc/agents/<slug>.md. Runtime memory lives under ~/.apx/projects/<id>/agents/<slug>/.",empty:"No agents. Add one with <code>apx agent add</code> or the button.",empty_text:"No agents. Add one with `apx agent add` or the button above.",new:"Agent",created:"Agent {slug} created.",slug_invalid:"slug must match /^[a-z][a-z0-9_-]*$/",hierarchy:"Hierarchy",list_view:"List",import:"Import",chat:"Chat",view:"View",orchestrator:"Orchestrator",new_title:"New agent",new_desc:"POST /projects/:pid/agents — writes .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (optional)",role_ph:"code refactor",model_label:"model (optional)",model_hint:"e.g. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (optional)",desc_label:"description (optional)",desc_ph:"What does this agent do…",skills_label:"skills (comma)",skills_ph:"skill-a, skill-b",tools_label:"tools (comma)",tools_ph:"tool-a, tool-b",parent_label:"reports to (parent, optional)",parent_hint:"Sub-agent of an orchestrator.",none_parent:"— none —",master_label:"Orchestrator (master)",create_success:"Agent {slug} created.",create_error:"create failed",import_title:"Import from vault",import_desc:"Templates in ~/.apx/agents. Registered in this project (.apc/agents/<slug>.md).",import_empty:"No templates in the vault.",import_success:"Imported: {slug}",import_already:"already here",import_btn:"Import"},agent_detail:{not_found:"Agent not found.",chat_btn:"Chat with {slug}",reports_to:"↳ reports to",no_threads:"No threads.",no_activity:"No recorded activity.",threads_recent:"Recent threads",subagents:"Sub-agents",subagents_desc:"Agents that report to this orchestrator.",config_title:"Agent configuration",type_label:"Type",area_label:"Area",area_hint:"e.g. operations, marketing",area_ph:"operations",role_label:"Role",parent_label:"Reports to (parent)",none_parent:"— none —",model_label:"Base model",model_hint:"Empty = uses the Router model (default). Set only to force a model for this agent.",model_ph:"(empty = router default)",skills_label:"Skills (comma)",bio_label:"Bio / description",system_label:"System prompt",system_hint:"Defines personality and behavior (body of AGENT.md).",master_label:"Orchestrator (master)",delete_btn:"Delete agent",save_btn:"Save changes",delete_confirm:'Delete agent "{slug}"? Removes .apc/agents/{slug}.md and local runtime data.',update_success:"Agent updated.",delete_success:"Agent deleted.",tools_hint:"Which tools this agent can use. Tap to toggle; or edit the list below.",tools_custom_ph:"list (comma): echo, http_fetch",memory_title:"Agent memory",memory_empty:"(empty memory)",memory_saved:"Memory saved.",records_title:"Records",records_desc:"Agent activity log (messages/actions). Newest first.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Agent execution status, derived from its routines.",sleep_deep:"Deep sleep · no heartbeat",sleep_deep_desc:"This agent has no routine that triggers it. It does not run autonomously; it only responds when invoked (chat / task).",brain_title:"Brain",brain_desc:"Real relationship graph of the agent: memory, threads, tasks, heartbeats and hierarchy. (first version — will be refined)",brain_empty:"No relationships to graph yet (no memory, threads, tasks or routines).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: runtime > shared > global. Conflicts shown above if any.",empty:"No MCPs configured.",new:"MCP",delete_confirm:"Delete MCP {name} from scope {scope}?",conflicts:"⚠ Conflicts: {names}",new_title:"New MCP",new_desc:"POST /projects/:pid/mcps?scope=…",scope_label:"Scope",transport_label:"Transport",name_label:"Name",name_ph:"filesystem",cmd_label:"Command",cmd_ph:"npx",args_label:"Args",args_hint:"space-separated",args_ph:"-y @modelcontextprotocol/server-filesystem /tmp",env_label:"Env (JSON, optional)",url_label:"URL",url_ph:"https://example.com/mcp",enabled_label:"Enabled",add_btn:"Add",name_required:"name required",env_invalid:"env must be valid JSON",removed:"removed",added:"MCP added.",updated:"MCP updated.",edit_title:"Edit MCP",save_btn:"Save",add_arg:"Add arg",edit_btn:"Edit",test_btn:"Test",logs_btn:"Logs",testing:"Testing…",test_ok:"OK · {n} tools available",logs_title:"Logs · {name}",logs_empty:"No logs yet. Start the MCP by calling a tool or running Test.",logs_events:"Recent events",logs_stderr:"stderr (last 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"pick an MCP",logs_panel_hint:"Click an MCP in the list to see what's happening live.",logs_panel_idle:"No activity. Hit Test to spin it up.",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"This project only · with secrets · not committed (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"This project only · committeable · no secrets (.apc/mcps.json)",scope_global_desc:"All projects on this machine (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Local process — `command` + args",transport_http_desc:"Remote endpoint — URL + headers",args_hint_tokens:"One entry per arg. Use the + button to insert a variable.",env_hint_tokens:"Key/value pairs. Values accept ${var.NAME} (+ button on the right).",env_empty:"No env vars.",headers_label:"Headers",headers_hint:"Key/value pairs — typically Authorization: Bearer ${var.TOKEN}.",headers_empty:"No headers."},vars:{title:"Variables",subtitle_project:"Replace ${var.NAME} when loading MCPs and templates. Project vars beat globals. Stored outside the repo (~/.apx/, chmod 0600).",subtitle_base:"Global variables — available to every project. Stored in ~/.apx/vars.json (chmod 0600).",empty:"No variables yet.",new:"Variable",new_title:"New variable",edit_title:"Edit variable",new_desc:"Referenced as ${var.NAME} in any field that supports interpolation.",reveal_all:"Show values",reveal:"Show",hide:"Hide",filter_label:"Show:",filter_all:"All",filter_project:"Project only",filter_global:"Globals only",scope_label:"Scope",scope_project:"project",scope_project_desc:"This project only. Beats the global with the same name.",scope_global:"global",scope_global_desc:"Available to every project.",name_label:"Name",name_hint:"Uppercase, digits and _. E.g. MY_API_KEY, GITHUB_TOKEN.",value_label:"Value",value_hint:"Stored on disk with 0600 perms. Never committed.",value_edit_ph:"(leave empty to keep current… not yet supported, paste the value again)",add_btn:"Add",save_btn:"Save",edit_btn:"Edit",delete_btn:"Delete",delete_confirm:"Delete {name} ({scope})?",removed:"Variable removed.",added:"Variable added.",updated:"Variable updated.",name_required:"Name required.",value_required:"Value required."},threads:{title:"Chats",subtitle:"Conversations per agent (empty = no logs persisted yet).",no_agents:"No agents. Conversations require a configured agent.",pick:"Pick an agent to view its conversations.",empty:"No conversations for {slug}.",conversation_title:"Conversation {id}",messages:"messages",via:"via"},config:{title:"Quick config",subtitle:"Project override. Written to {path}.",model:"super_agent.model",model_hint:"e.g. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug of the agent that handles this project by default.",use_global:"(uses global)",saved:"Saved.",nothing:"Nothing to save.",raw_title:"Config (raw JSON)",raw_subtitle:"Paste the entire object — equivalent to PUT the file.",raw_save:"Replace config",raw_done:"Config overwritten.",effective:"Effective config (read-only)",effective_sub:"What the daemon actually sees (global ⊕ override).",section_title:"Project config",section_desc:"APC metadata and overrides separated. General APX lives in Settings > Config.",effective_read:"Read: global APX + project override.",save_project:".apc/project.json saved.",save_override:".apc/config.json saved.",save_fields_success:"Overrides saved.",save_meta_success:"Project metadata saved.",no_data:"No data."},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
614
+
615
+ Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",defaults_title:"Agent defaults",defaults_desc:"Global vault templates. Bundled ones come with APX and are always present; ones you create or edit go in ~/.apx/agents and override. Import them into a project from Agents › Import.",defaults_show_removed:"Show removed",defaults_new:"New",defaults_empty:"No templates in the vault.",defaults_hide:"Hide",defaults_restore:"Restore",defaults_edit:"Edit",defaults_remove:"Hide",defaults_delete:"Delete",defaults_tombstone_msg:`Hide the default "{slug}"? It's bundled — tombstoned and recoverable with Restore.`,defaults_delete_msg:'Delete the template "{slug}"?',defaults_hidden:"Hidden.",defaults_deleted:"Deleted.",defaults_restored:"Restored.",defaults_new_title:"New template",defaults_new_desc:"POST /agents/vault — saved to ~/.apx/agents/<slug>.md",defaults_edit_title:'Edit "{slug}"',defaults_bundled_desc:"This is a bundled default. Saving does a copy-on-write to ~/.apx/agents/<slug>.md (becomes an override).",defaults_user_desc:"PATCH /agents/vault/:slug — edits the file in ~/.apx/agents.",defaults_master_label:"Master agent",defaults_slug_invalid:"invalid slug (must match /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" created.',defaults_saved:'Template "{slug}" saved.'},logs:{title:"Logs",desc_global:"Daemon activity (global channels: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Project activity. ~/.apx/projects/<id>/messages/.",filter_channel:"filter channel (e.g. telegram)",filter_dir:"direction",all_directions:"All directions",in:"Incoming (in)",out:"Outgoing (out)",filter_type:"type",all_types:"All types",search_text:"search text…",count_of:"of",no_activity:"No activity.",no_activity_ch:'No activity in channel "{ch}".',error:"Could not read messages: {msg}",show_more:"show more",show_less:"show less",daemon_errors:"Daemon errors (~/.apx/logs/errors.jsonl)",no_errors:"No errors recorded. 🎉"},telegram_contacts:{title:"Telegram contacts",desc:"Who writes to the bots. The role defines which tools they can use; a guest has no permissions until you assign a role.",empty:"No contacts yet — they register automatically when someone writes to a bot.",owner_badge:"owner",assign_role:"Assign role",owner_hint:"Channel owner — change it from the channel",removed:"Contact deleted.",delete_confirm:"Delete contact {name}?",last_seen:"seen:",tools_all:"tools: all",tools_none:"tools: none",tools_label:"tools:"},telegram_channels:{title:"Channels",desc:"Each channel is a bot the daemon polls. Here you can add/remove channels, change the answering agent, the project it belongs to and its owner.",new_btn:"New channel",empty:"No channels yet — add the first one.",removed:"Channel deleted.",delete_confirm:"Delete channel {name}?",no_owner:"no owner (claimed on first DM)",owner_label:"owner:"},telegram_channel_dialog:{new_title:"New Telegram channel",edit_title:"Edit channel: {name}",name_label:"name (internal slug)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug or id of the project to pin this channel to (optional).",route_label:"route_to_agent",route_hint:"Answering agent; empty = APX super-agent.",owner_label:"owner_user_id",owner_hint:"Telegram user_id of the channel owner. Overrides global role to 'owner' here. Leave empty — first private message claims it.",owner_ph:"889721252",respond_label:"Respond with engine (not echo)",name_required:"name required",saved:"Channel saved."},telegram_send_dialog:{title:"Send to {name}",default_msg:"Test message from APX panel ✅"},telegram_roles:{title:"Roles",desc:"Each role defines which super-agent tools the assigned user can invoke. 'owner' always = all; 'guest' always = none (chat only).",empty:"No roles defined.",tools_all:"all tools",tools_none:"no tools",builtin:"built-in",delete_confirm:'Delete role "{name}"?',removed:"Role deleted.",saved:'Role "{name}" saved.',name_required:"Name required.",builtin_error:'"{name}" is a built-in role.',new_title:"New role or replace a custom one",name_label:"Name",name_ph:"editor",tools_label:"Tools (comma-separated)",tools_hint:"Empty = none. Examples: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Full access (all tools)",save_btn:"Save role",delete_btn:"Delete"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Quick chat with your super-agent. Has access to tools (projects, tasks, mcps, agents); for a longer persistent thread, open Chats.",empty:"Send {persona} a message to get started.",thinking:"{persona} is thinking…",talk:"Talk to {persona}",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"Roby got lost: this page doesn't exist or has moved.",home:"Back to home"},ask_panel:{answers_header:"Answers",other:"Other",other_placeholder:"Write your own answer here",text_placeholder:"Type your answer…",back:"Back",skip:"Skip",next:"Next",submit:"Send",status_waiting:"Waiting for your answer…",status_received:"Answers received"},code_module:{title:"Code",badge:"super-agent",desc:"OpenCode-style coding sessions. Pick a project, open a session, and ask it to read, plan, edit or run.",no_projects:"No registered projects. Register one with `apx project add` to use Code.",sessions:"Sessions",new_session:"New session",untitled:"New session",no_sessions:"No sessions yet — create one to start coding.",pick_project:"Pick a project to see its sessions.",rename:"Rename",delete:"Delete",delete_confirm:"Delete this session? The transcript is removed; your files are untouched.",empty_chat:"Send a coding instruction to get started.",placeholder:"Ask for a change… (enter sends, shift+enter = new line)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edits files and runs commands",mode_plan_hint:"Plan — read-only, proposes changes without touching files",tab_context:"Context",tab_changes:"Changes",tab_artifacts:"Artifacts",artifacts_none:"No artifacts yet. Ask the agent to create a script under `artifacts/<name>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copy path",artifacts_run:"Run",artifacts_run_hint:"Run it from your terminal:",artifacts_delete:"Delete",artifacts_delete_confirm:"Delete this artifact? The file will be removed from disk.",ctx_model:"Model",ctx_tokens:"Tokens",ctx_input:"Input",ctx_output:"Output",ctx_messages:"Messages",ctx_breakdown:"Context breakdown",ctx_none:"No usage yet — send a turn to see tokens.",seg_system:"System",seg_user:"User",seg_assistant:"Assistant",seg_tool:"Tools",seg_other:"Other",changes_none:"No changes in this session yet.",changes_no_git:"Changes need a git repository. This project isn't one.",changes_files:"{n} file(s) changed",stopped:"[stopped]",close:"Close",reload:"Reload",discard_changes:"Discard changes",save_shortcut_hint:"Save (Cmd/Ctrl+S)",artifacts_rename:"Rename",artifacts_view:"View contents",artifacts_edit:"Edit contents",tree_collapse_all:"Collapse all",terminal_clear:"Clear",terminal_close:"Close terminal"},desktop_screen:{status_title:"Status",autostart_title:"Auto-start",shortcut_title:"Keyboard shortcut",appearance_title:"Appearance",activation_title:"Activation + transcription",last_conv_title:"Last conversation"},voice_screen:{providers_title:"Voice providers (TTS)",test_title:"Test voice",stt_title:"Transcription (STT)",configure_provider:"Configure {name}"},deck_screen:{widgets_title:"Widgets",context_title:"APX context",reload_manifest:"Reload manifest",widget_native:"Native APX widget",widget_external:"External widget"},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Model that vectorizes the history of all channels for relevant memory. Just like TTS/STT: pick a provider and model. 'Automatic' tries local first and falls back to offline if nothing is available.",provider_label:"Provider",provider_hint:"Ollama is local and free. Gemini/OpenAI use the API key from their section in Models (or the one below).",mode_label:"Selection mode",mode_hint:"Chain falls back to the next if one fails; Single uses exactly the chosen provider.",available:"available",unavailable:"unavail.",test_btn:"Test embedding",reindex_btn:"Reindex memory",test_ok:"Embedding OK with {embedder}",test_failed:"Test failed: {msg}",reindexed:"Reindexed: {indexed} chunks (cleared {cleared}).",reindex_failed:"Reindex failed: {msg}",save_failed:"Could not save: {msg}",provider_auto:"Automatic (chain: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, no API key (nomic-embed-text)",provider_gemini:"Gemini — free tier with key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, no model — degraded)",mode_chain:"Chain (automatic fallback)",mode_single:"Single (uses only the chosen one)",ollama_title:"Ollama (local)",ollama_desc:"No API key. Runs nomic-embed-text on your local or cloud Ollama.",model_label:"Model",base_url_label:"Base URL",ollama_base_url_hint:"Empty uses engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) or another compatible model.",api_key_label:"API key",openai_key_hint:"Empty reuses engines.openai.api_key. Leave it blank to keep the saved one.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier with a Google API key.",gemini_key_hint:"Empty reuses engines.gemini.api_key.",compaction_title:"History compaction",compaction_desc:"When a chat exceeds the turn threshold, the oldest turns are summarized with a lightweight (local) LLM and saved as [COMPACTED SUMMARY], keeping context bounded. Runs off the hot-path: the current turn uses whatever summary already exists.",threshold_label:"Compaction threshold",threshold_hint:"Compact once the chat exceeds these turns (default 60).",keep_recent_label:"Recent turns to preserve",keep_recent_hint:"Verbatim turns that are NEVER compacted (default 40). Must be lower than the threshold.",compact_model_label:"Compaction model",compact_model_hint:"Lightweight LLM for summarizing. Ideally a local one (Ollama) to avoid cost. Format provider:model.",compact_fallback_label:"Fallback model",compact_fallback_hint:"Used if the compaction one fails. Empty falls back to the super-agent model.",compact_fallback_ph:"(empty → super-agent model)"},router_panel:{title:"Model router",description:"A single general router (no per-task cases). Pick a provider and model; if the active one fails, it tries the fallback chain in order.",badge_default:"default",no_providers:"Add a provider below to be able to pick models.",active_model_label:"Active model (default)",active_model_hint:"Provider + model. Saved as provider:model.",fallback_title:"Fallback chain",fallback_desc:"If the active model fails, it tries these in order. Click one to edit it.",fallback_empty:"No fallback configured.",add_to_chain:"Add to the chain",done:"done",save:"Save router",saved:"Saved",saved_toast:"Router saved.",provider_ph:"— provider —",provider_not_found:"⚠ {name} (not found)",provider_not_configured:'The provider "{name}" is not configured.'},engines_panel:{title:"Providers",new_btn:"New provider",description:"LLM providers (API). Each provider uses an engine/adapter (openai, ollama, …) with its key and URL.",empty:"No providers. Add one with the button above.",add_card:"Add provider",saved:"Provider saved.",saved_json:"Provider saved (JSON).",deleted:"Provider deleted.",delete_confirm:"Delete provider {name}?"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",description:"LLM provider. The engine defines which adapter it uses (openai, ollama, …).",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete",custom:"Custom",json_mode:"JSON",form_mode:"Back to form",json_label:"Provider config (JSON)",json_hint:"Saved as engines.{slug} in config.json",json_help:"Must be a valid JSON object with at least engine. The slug is taken from the form.",name_label:"Name",name_ph:"My provider",engine_label:"Engine",base_url_label:"Base URL (base_url)",base_url_hint:"Auto-filled when you pick a provider.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Leave blank to keep the current one.",api_key_hint_env:"Stored as a secret. Suggested env: {env}",api_key_hint:"Stored as a secret.",api_key_set:"…{suffix} (already set)",model_label:"Default model",load_models:"Load models",max_tokens_label:"Max tokens (max_tokens)",temperature_label:"Temperature: {value}",pricing_summary:"Token analysis / pricing (optional)",context_limit_label:"Context limit (tokens)",price_input:"$ input / 1M",price_output:"$ output / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Per-model context limits (JSON)",active_label:"Active (agents can use it)",err_slug_required:"Slug required.",err_slug_required_form:"Slug required (in the form).",err_slug_exists:'A provider "{slug}" already exists.',err_model_limits_json:"Per-model context limits: invalid JSON.",err_json_invalid:"Invalid JSON: check the syntax.",err_json_object:"The JSON must be an object with the provider config.",err_engine_missing:'Missing "engine" (e.g. "anthropic", "ollama").',err_save:"Error saving.",err_no_models:"No models. Correct key/URL?",err_list_models:"Could not list models."},providers_card:{active:"Active",off:"Off",model:"Model",base_url:"Base URL",api_key:"API key",key_set:"✓ set",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (already set)",api_key_keep_hint:"Leave blank to keep the current one.",api_key_secret_hint:"Stored as a secret. Env: {env}",api_key_reuse_hint:"Reuses {engine} if left blank. Env: {env}",err_save:"Error while saving.",model_label:"Model",voice_label:"Voice",format_label:"Format",output_format_label:"Output format",voice_id_label:"Voice ID",voice_id_hint:"ElevenLabs voice id (empty = default).",gemini_model_hint:"Gemini TTS is still in preview.",style_label:"Style (how it should speak)",style_hint:"Natural-language instruction. Empty = no style. E.g.: 'speak in a cheerful, unhurried tone'.",style_ph:"speak in a cheerful, energetic tone",piper_bin_label:"Binary (bin)",piper_bin_hint:"Path or name of the piper CLI (PATH).",piper_model_label:"Model (.onnx)",piper_model_hint:"Absolute path to the piper voice model.",piper_speaker_label:"Speaker (optional)",piper_speaker_hint:"Speaker id for multi-voice models.",mock_desc:"The mock engine generates a silent test WAV. It has no parameters: it serves as a guaranteed fallback when no other engine is configured.",selection_mode:"Selection mode",mode_chain_desc:"Chain with fallback: uses the first available engine following the order below.",mode_single_desc:"Default engine only: always uses the chosen one; the rest stay configured for other purposes.",mode_chain_btn:"Chain (router)",mode_single_btn:"Default engine only",move_up:"Move up",move_down:"Move down",badge_local:"local",badge_available:"available",badge_unavailable:"configured, unavailable",badge_not_configured:"not configured",badge_default:"default",set_as_default:"Set as default",configure:"Configure",stt_engine_label:"Transcription engine",stt_engine_hint:"Local uses faster-whisper (requires python3 + faster-whisper). OpenAI uses the engines.openai key.",stt_model_label:"Local model (whisper)",stt_model_hint:"Bigger = more accurate and slower.",stt_language_label:"Language",stt_language_hint:'For Spanish, setting "Spanish" improves accuracy.',stt_provider_auto:"Automatic (local, then OpenAI)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",lang_auto:"Auto-detect",lang_es:"Spanish",lang_en:"English",lang_pt:"Portuguese",lang_fr:"French",lang_it:"Italian",lang_de:"German",test_default_text:"Hi, I'm APX. This is a voice test.",test_default_engine:"Default ({name})",test_default_chain:"Default (chain)",test_unavailable_suffix:" · unavailable",test_empty_error:"Type something to say.",test_synth_error:"Could not synthesize.",test_engine_label:"Engine",test_engine_hint:"Override the default for testing.",test_style_label:"Style (Gemini only)",test_style_hint:"How it should speak. Empty = no style.",test_text_label:"Text to say",test_text_ph:"Type what you want it to say…",say_this:"Say this",stop:"Stop",replay:"Replay",engine_result:"Engine",providers_desc:"Synthesis engines. Status is reported live by the daemon. Pick which one to use by default.",providers_load_error:"Could not load providers: {msg}",test_desc:"Pick which engine to synthesize with and, if applicable, how it should speak.",stt_desc:"Speech-to-text engine used by the deck, Telegram, and the CLI when listening.",toast_default_engine:"Default engine: {id}.",toast_mode_chain:"Mode: chain with fallback.",toast_mode_single:"Mode: default engine only.",toast_config_saved:"Voice configuration saved.",toast_transcription_updated:"Transcription updated."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (partial).",bot_token_hint:"BotFather token. Stored in ~/.apx/config.json.",bot_token_hint_short:"BotFather token.",secret_set_replace:"(set — type to replace)",secret_already_set:"(already set)",empty_keep:"— empty = keep",message_sent:"Message sent.",message_label:"Text",send_chat_id:"chat_id: {id}",default_apx:"default APX",yes:"yes",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_ui:{model_router_default:"model: router default",slug_kebab_hint:"kebab-case, e.g. reviewer, my-agent, content-writer",comma_separated:"comma-separated",body_hint:"markdown — extends the agent's system prompt",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorer",type_none:"— no type —",type_orchestrator:"Orchestrator",type_orchestrator_desc:"Coordinates the team and delegates.",type_specialist:"Specialist",type_specialist_desc:"Domain expert; runs tasks.",type_assistant:"Assistant",type_assistant_desc:"Conversational helper.",type_worker:"Worker",type_worker_desc:"Runs autonomous tasks.",type_monitor:"Monitor",type_monitor_desc:"Watches state and reports.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definition (frontmatter + system prompt).",memory_durable_desc:"durable facts the agent remembers.",running:"running",paused:"paused",last_error:"last: error",field_tick:"Tick",field_next_tick:"Next tick",field_last_tick:"Last tick",field_last_run:"Last run",tools_label:"Tools",kind_agent:"agent",kind_memory:"memory",kind_thread:"thread",kind_task:"task",kind_routine:"routine",kind_hierarchy:"hierarchy",nodes_drag_hint:"{n} nodes · drag to rearrange",kind_exec_agent:"Project agent",kind_exec_agent_desc:"Runs a project agent with a prompt. You pick which one.",kind_super_agent:"Super-agent",kind_super_agent_desc:"Calls the APX super-agent with a prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Sends a fixed message to a Telegram channel. No model or agent.",kind_shell:"Shell",kind_shell_desc:"Runs a shell command. No prompt or pre/post — the command is the action.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"Does nothing except write a line to the logs each time it runs. Useful to confirm the scheduler is alive. If you don't know whether you need it, don't use it.",unit_seconds:"seconds",unit_minutes:"minutes",unit_hours:"hours",unit_days:"days",every_n_unit:"every {n} {unit}",every_v:"every {v}",preset_every_10m:"every 10 min",preset_hourly:"hourly",preset_daily_9am:"daily 9am",preset_weekdays_9am:"weekdays 9am",preset_manual:"Manual",var_pre_output_prompt:"Text output of the pre-commands. Replaced inside the prompt/text before it is sent. Use it to inject fresh data (weather, an API) into the instruction.",var_llm_output:"Final answer from the agent or super-agent. Available in the post-commands as an env var — e.g. forward it via Telegram.",var_status:"Action result: ok or error. Available in the post-commands to branch on what happened.",var_skipped:"1 if the action was skipped (via skip_prompt_on), 0 if it ran. Available in the post-commands.",var_pre_output:"Full pre-commands output, as an env var in the post-commands (up to 32k).",var_pre_output_file:"Path to a temp file with the pre-commands output. For large outputs not suited to an env var.",var_pre_exit:"Exit code of the last pre-command (0 = ok). Available in the post-commands.",var_routine:"Name of this routine. Available as an env var in the commands.",summary_runs_agent:'Runs the agent "{agent}"',summary_runs_agent_none:"Runs an agent (none chosen yet)",summary_super_agent:"Calls the super-agent",summary_telegram:'Sends Telegram to "{channel}"',summary_runs_cmd:"Runs: {cmd}",summary_shell:"Runs a shell command",summary_heartbeat:"Leaves a heartbeat in the logs",action_agent_answers:'Agent "{agent}" answers the prompt',action_agent_pick_answers:"Agent (pick one) answers the prompt",action_super_answers:"The super-agent answers the prompt",action_telegram_channel:'Sends Telegram to channel "{channel}"',action_runs_shell:"Runs the shell command",step_pre:"Pre",step_post:"Post",last_label:"last:",tg_chat_id_ph:"(uses the channel's)",tg_text_ph:"message to send",hb_message_ph:"still alive",arg_placeholder:"--flag or value",remove_arg:"remove arg",super_agent_label:"{persona} (super-agent)",super_agent_badge:"super-agent"},modules_ui:{desktop_pos_left:"Left",desktop_pos_center:"Center",desktop_pos_right:"Right",desktop_theme_light:"Light",desktop_theme_dark:"Dark",desktop_status_desc:"The window launches from the terminal or via autostart.",desktop_running:"Running",desktop_stopped:"Stopped",desktop_refresh:"refresh",desktop_from_terminal:"From terminal:",desktop_autostart_desc:"Launches the window at user login. Equivalent to `apx desktop install` (no sudo required).",desktop_platform:"platform: {platform}",desktop_shortcut_desc:"Global hotkey that shows/hides the window and starts listening.",desktop_accelerator:"Accelerator",desktop_accelerator_hint:'Electron format, e.g. "CommandOrControl+G" or "CommandOrControl+Shift+Space". Restart the window to apply.',desktop_shortcut_saved:"Shortcut saved. Restart the window (apx desktop stop && start) to apply it.",desktop_autostart_on:"Autostart enabled for the next login.",desktop_autostart_off:"Autostart disabled.",desktop_appearance_desc:"Window theme and position on the screen.",desktop_theme:"Theme",desktop_restart_apply:"Restart the window to apply.",desktop_theme_set:"Theme: {value}.",desktop_position:"Position",desktop_position_hint:'"left" / "center" / "right" of the top edge.',desktop_position_set:"Position: {value}.",desktop_activation_desc:"The daemon plugin processes the messages. STT is configured in Voices.",desktop_enabled_toast:"Desktop enabled.",desktop_disabled_toast:"Desktop disabled.",desktop_plugin_on:"Plugin enabled (replies to messages)",desktop_plugin_off:"Plugin disabled",desktop_stt_engine:"Speech-to-text engine:",desktop_stt_engine_suffix:"(local whisper, language, model).",desktop_last_conv_desc:"The latest exchange with the agent from the floating window.",desktop_no_messages:"No messages yet. Send something to the desktop window for it to appear here.",desktop_you:"You",desktop_roby:"Roby",desktop_empty_msg:"(empty)",deck_widget_enabled:"Widget {id} enabled.",deck_widget_disabled:"Widget {id} disabled.",deck_save_error:"Error while saving",deck_loading_manifest:"Loading manifest…",deck_manifest_error:"Error loading the manifest.",deck_widgets_summary:"{count} widgets · {enabled} external enabled",deck_loading_manifest_full:"Loading the Deck manifest…",deck_manifest_load_failed:"Could not load the Deck manifest.",deck_retry:"Retry",deck_no_widgets:"No widgets in the manifest.",deck_context_desc:"Information the Deck sees from the daemon.",deck_active_project:"Active project:",deck_none:"none",deck_registered_projects:"Registered projects:",deck_active_plugins:"Active plugins:",deck_daemon_active:"active · {uptime}",deck_daemon_started:"started",deck_safety_no_shell:"no direct shell",deck_safety_no_arbitrary:"arbitrary commands blocked",deck_safety_confirm:"dangerous actions require confirmation",code_copied:"Copied.",code_saved:"Saved.",code_file_empty:"(empty)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Main agent with all tools",code_chat_tab:"Chat",code_panel_sessions:"Session list",code_panel_tree:"File tree",code_panel_terminal:"Terminal",code_panel_context:"Context panel",code_ctx_auto:"auto",code_ctx_mode:"Mode",code_ctx_agent:"Agent",code_ctx_msgs_value:"{user} user · {assistant} assistant",code_ctx_tokens_total:"Total Tokens",code_ctx_created:"Created",code_ctx_activity:"Activity",code_project_fallback:"project {id}",code_pick_project_ph:"Pick a project…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"View",code_artifact_edit_short:"Edit",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncated"},settings_ui:{bearer_label:"Bearer",global_config_desc:"General config in ~/.apx/config.json. Editable by tabs; JSON stays separate.",global_json_desc:"Redacted secrets are not overwritten.",save_json:"Save JSON",expand_menu:"Expand menu",collapse_menu:"Collapse menu",documentation:"Documentation",kind_personal:"Personal",kind_company:"Company",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Other",base_menu_view:"Base menu view (general workspace).",coming_soon:"Coming soon",inspector_title:"Skill Inspector (per-turn RAG)",inspector_desc:"Experimental feature. When active, the agent does NOT receive the full skill list in its prompt; on each message a local RAG decides which skill(s) to load — the full body on a strong match, a suggestion on a medium match, nothing if it doesn't apply. It is re-evaluated every turn: a skill that stopped being relevant disappears from the context.",enable_inspector:"Enable inspector",enable_inspector_hint:"Off = classic behavior (slug list + passive suggestion). On = the RAG decides per turn.",on:"On",off:"Off",index_count:"Index: {n} skills",not_indexed:"not indexed",dim:"dim {dim}",updated_at:"updated {date}",reindex:"Reindex",reindex_forced:"Reindex (forced)",embedder_source:"The embedder comes from Memory (RAG). Local with Ollama, or offline if no provider is set.",thresholds_title:"Thresholds and limits",thresholds_desc:"Tune how aggressive the inspector is. Raising the thresholds = fewer false positives but more risk of missing a skill; lowering them = the opposite.",test_title:"Test (dry-run)",test_desc:"Type a message the way a user would and see which skills the inspector would load/suggest — without calling the model. Forces the inspector on even if it's off above.",test_placeholder:"e.g.: I need to create a promo video with voiceover",test_btn:"Test",jit_empty_index:"JIT (empty index)",loaded_label:"Loaded:",suggested_label:"Suggested:",could_not_save:"Could not save: {msg}",indexed_with:"Indexed with {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Index failed: {msg}",dry_run_failed:"Dry-run failed: {msg}",knob_load_threshold:"Load threshold",knob_load_threshold_hint:"Minimum similarity to inject the skill's BODY (high = stricter).",knob_hint_threshold:"Hint threshold",knob_hint_threshold_hint:"Minimum similarity to only SUGGEST the skill (so the agent loads it if it wants).",knob_margin:"Margin over the 2nd",knob_margin_hint:"The top must beat the second by this margin to load its body (avoids weak ties).",knob_max_loaded:"Max. loaded bodies",knob_max_loaded_hint:"How many skills are injected in full per turn.",knob_max_hints:"Max. hints",knob_max_hints_hint:"How many extra skills are named as a suggestion.",knob_prompt_floor:"Minimum prompt length",knob_prompt_floor_hint:"Messages shorter than this are ignored (avoids 'ok', 'hi').",knob_body_char_cap:"Body char cap",knob_body_char_cap_hint:"Trims long skill bodies so they don't bloat the context.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Only project-specific values; empty inherits global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Super-agent model",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Extra prompt",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Respond with engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Project",cfg_project_desc:".apc/project.json. Portable APC metadata; no secrets, no runtime.",cfg_name:"Name",cfg_version:"Version",cfg_apc_spec:"APC spec",cfg_apx_install:"APX install state",cfg_apx_storage_id:"APX storage id"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) chose these skills for this turn",tools_count:"{n} tools",tool_read_file:"Read file",tool_write_file:"Write file",tool_edit_file:"Edit file",tool_list_files:"List files",tool_search_files:"Search in files",tool_search_messages:"Search messages",tool_tail_messages:"Latest messages",tool_run_shell:"Run shell",tool_send_telegram:"Send Telegram",tool_call_agent:"Call agent",tool_call_mcp:"Call MCP",tool_call_runtime:"Call runtime",tool_create_task:"Create task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (router decides)",model_filter_ph:"filter or type a model…",loading_models:"loading models…",use_value:"use “{value}”",model_combobox_ph:"pick or type a model…",search_variable_ph:"search variable…",no_matches:"no matches",create_variable:"Create new variable…",kv_key_ph:"KEY",kv_value_ph:"value",remove_row:"remove row",add_row:"Add row",err_chat_failed:"Chat failed.",err_stream_failed:"Stream failed.",err_load_conversation:"Could not load conversation.",err_stream:"Stream error."}},Mb={es:Iz,en:Bz};function Uz(){try{const e=localStorage.getItem(Cn.language);if(e&&e in Mb)return e}catch{}return"en"}let Zf=Uz();function Y2(e){Zf=e;try{localStorage.setItem(Cn.language,e)}catch{}}const X2=[{value:"es",label:"Español"},{value:"en",label:"English"}];function K2(){return Zf}function Hz(e){const t=Mb[Zf],s=e.split(".");let o=t;for(const l of s)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function Vz(e,t){return t?e.replace(/\{(\w+)\}/g,(s,o)=>o in t?String(t[o]):`{${o}}`):e}function qz(e){const t=Hz(e);if(t!==void 0)return t;if(Zf!=="es"){const s=Mb.es,o=e.split(".");let l=s;for(const c of o)if(l&&typeof l=="object"&&c in l)l=l[c];else return;return typeof l=="string"?l:void 0}}function f(e,t){const s=qz(e);return s===void 0?e:Vz(s,t)}function Ab(e){const[t,s]=x.useState(!1);x.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>s(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:t,toggle:o}}function $z({collapsed:e,onToggle:t}){return r.jsx(Je,{content:f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:r.jsx("button",{type:"button",onClick:t,"aria-label":f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(Mk,{className:Oe("size-4 transition-transform",e&&"rotate-180")})})})}function Fz({sections:e,active:t,onChange:s,collapsed:o=!1}){return r.jsx("nav",{className:Oe("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",o?"w-12 items-center px-1":"w-52 px-2"),children:e.map((l,c)=>r.jsxs("div",{className:Oe("w-full",c>0&&"mt-2"),children:[!o&&l.title&&r.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),r.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:u,label:p,icon:m,badge:g})=>{const h=t===u,b=r.jsxs("button",{type:"button",onClick:()=>s(u),"data-testid":`tabnav-${u||"index"}`,className:Oe("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",h?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[r.jsx(m,{className:"size-4 shrink-0"}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate text-left text-xs",children:p}),g!==void 0&&r.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:g})]})]});return o?r.jsx(Je,{content:p,side:"right",children:b},u):r.jsx(x.Fragment,{children:b},u)})})]},c))})}const Q2=0,Z2=1,W2=2,mj=3;var gj=Object.prototype.hasOwnProperty;function Wh(e,t){var s,o;if(e===t)return!0;if(e&&t&&(s=e.constructor)===t.constructor){if(s===Date)return e.getTime()===t.getTime();if(s===RegExp)return e.toString()===t.toString();if(s===Array){if((o=e.length)===t.length)for(;o--&&Wh(e[o],t[o]););return o===-1}if(!s||typeof e=="object"){o=0;for(s in e)if(gj.call(e,s)&&++o&&!gj.call(t,s)||!(s in t)||!Wh(e[s],t[s]))return!1;return Object.keys(t).length===o}}return e!==e&&t!==t}const Hs=new WeakMap,Vs=()=>{},$n=Vs(),Jh=Object,jt=e=>e===$n,ns=e=>typeof e=="function",Dr=(e,t)=>({...e,...t}),J2=e=>ns(e.then),Ug={},yd={},Ob="undefined",Gc=typeof window!=Ob,ex=typeof document!=Ob,Gz=Gc&&"Deno"in window,Yz=()=>Gc&&typeof window.requestAnimationFrame!=Ob,eC=(e,t)=>{const s=Hs.get(e);return[()=>!jt(t)&&e.get(t)||Ug,o=>{if(!jt(t)){const l=e.get(t);t in yd||(yd[t]=l),s[5](t,Dr(l,o),l||Ug)}},s[6],()=>!jt(t)&&t in yd?yd[t]:!jt(t)&&e.get(t)||Ug]};let tx=!0;const Xz=()=>tx,[nx,ax]=Gc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Vs,Vs],Kz=()=>{const e=ex&&document.visibilityState;return jt(e)||e!=="hidden"},Qz=e=>(ex&&document.addEventListener("visibilitychange",e),nx("focus",e),()=>{ex&&document.removeEventListener("visibilitychange",e),ax("focus",e)}),Zz=e=>{const t=()=>{tx=!0,e()},s=()=>{tx=!1};return nx("online",t),nx("offline",s),()=>{ax("online",t),ax("offline",s)}},Wz={isOnline:Xz,isVisible:Kz},Jz={initFocus:Qz,initReconnect:Zz},hj=!Pc.useId,Ml=!Gc||Gz,eD=e=>Yz()?window.requestAnimationFrame(e):setTimeout(e,1),Hg=Ml?x.useEffect:x.useLayoutEffect,Vg=typeof navigator<"u"&&navigator.connection,xj=!Ml&&Vg&&(["slow-2g","2g"].includes(Vg.effectiveType)||Vg.saveData),jd=new WeakMap,tD=e=>Jh.prototype.toString.call(e),qg=(e,t)=>e===`[object ${t}]`;let nD=0;const sx=e=>{const t=typeof e,s=tD(e),o=qg(s,"Date"),l=qg(s,"RegExp"),c=qg(s,"Object");let u,p;if(Jh(e)===e&&!o&&!l){if(u=jd.get(e),u)return u;if(u=++nD+"~",jd.set(e,u),Array.isArray(e)){for(u="@",p=0;p<e.length;p++)u+=sx(e[p])+",";jd.set(e,u)}if(c){u="#";const m=Jh.keys(e).sort();for(;!jt(p=m.pop());)jt(e[p])||(u+=p+":"+sx(e[p])+",");jd.set(e,u)}}else u=o?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return u},zb=e=>{if(ns(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?sx(e):"",[e,t]};let aD=0;const rx=()=>++aD;async function tC(...e){const[t,s,o,l]=e,c=Dr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let u=c.populateCache;const p=c.rollbackOnError;let m=c.optimisticData;const g=_=>typeof p=="function"?p(_):p!==!1,h=c.throwOnError;if(ns(s)){const _=s,k=[],C=t.keys();for(const y of C)!/^\$(inf|sub)\$/.test(y)&&_(t.get(y)._k)&&k.push(y);return Promise.all(k.map(b))}return b(s);async function b(_){const[k]=zb(_);if(!k)return;const[C,y]=eC(t,k),[w,S,N,E]=Hs.get(t),R=()=>{const q=w[k];return(ns(c.revalidate)?c.revalidate(C().data,_):c.revalidate!==!1)&&(delete N[k],delete E[k],q&&q[0])?q[0](W2).then(()=>C().data):C().data};if(e.length<3)return R();let M=o,T,A=!1;const z=rx();S[k]=[z,0];const I=!jt(m),D=C(),P=D.data,L=D._c,U=jt(L)?P:L;if(I&&(m=ns(m)?m(U,P):m,y({data:m,_c:U})),ns(M))try{M=M(U)}catch(q){T=q,A=!0}if(M&&J2(M))if(M=await M.catch(q=>{T=q,A=!0}),z!==S[k][0]){if(A)throw T;return M}else A&&I&&g(T)&&(u=!0,y({data:U,_c:$n}));if(u&&!A)if(ns(u)){const q=u(M,U);y({data:q,error:$n,_c:$n})}else y({data:M,error:$n,_c:$n});if(S[k][1]=rx(),Promise.resolve(R()).then(()=>{y({_c:$n})}),A){if(h)throw T;return}return M}}const bj=(e,t)=>{for(const s in e)e[s][0]&&e[s][0](t)},sD=(e,t)=>{if(!Hs.has(e)){const s=Dr(Jz,t),o=Object.create(null),l=tC.bind($n,e);let c=Vs;const u=Object.create(null),p=(h,b)=>{const _=u[h]||[];return u[h]=_,_.push(b),()=>_.splice(_.indexOf(b),1)},m=(h,b,_)=>{e.set(h,b);const k=u[h];if(k)for(const C of k)C(b,_)},g=()=>{if(!Hs.has(e)&&(Hs.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,m,p]),!Ml)){const h=s.initFocus(setTimeout.bind($n,bj.bind($n,o,Q2))),b=s.initReconnect(setTimeout.bind($n,bj.bind($n,o,Z2)));c=()=>{h&&h(),b&&b(),Hs.delete(e)}}};return g(),[e,l,g,c]}return[e,Hs.get(e)[4]]},rD=(e,t,s,o,l)=>{const c=s.errorRetryCount,u=l.retryCount,p=~~((Math.random()+.5)*(1<<(u<8?u:8)))*s.errorRetryInterval;!jt(c)&&u>c||setTimeout(o,p,l)},oD=Wh,[nC,aC]=sD(new Map),lD=Dr({onLoadingSlow:Vs,onSuccess:Vs,onError:Vs,onErrorRetry:rD,onDiscarded:Vs,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:xj?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:xj?5e3:3e3,compare:oD,isPaused:()=>!1,cache:nC,mutate:aC,fallback:{}},Wz),iD=(e,t)=>{const s=Dr(e,t);if(t){const{use:o,fallback:l}=e,{use:c,fallback:u}=t;o&&c&&(s.use=o.concat(c)),l&&u&&(s.fallback=Dr(l,u))}return s},cD=x.createContext({}),uD="$inf$",sC=Gc&&window.__SWR_DEVTOOLS_USE__,dD=sC?window.__SWR_DEVTOOLS_USE__:[],fD=()=>{sC&&(window.__SWR_DEVTOOLS_REACT__=Pc)},pD=e=>ns(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],rC=()=>{const e=x.useContext(cD);return x.useMemo(()=>Dr(lD,e),[e])},mD=e=>(t,s,o)=>e(t,s&&((...c)=>{const[u]=zb(t),[,,,p]=Hs.get(nC);if(u.startsWith(uD))return s(...c);const m=p[u];return jt(m)?s(...c):(delete p[u],m)}),o),gD=dD.concat(mD),hD=e=>function(...s){const o=rC(),[l,c,u]=pD(s),p=iD(o,u);let m=e;const{use:g}=p,h=(g||[]).concat(gD);for(let b=h.length;b--;)m=h[b](m);return m(l,c||p.fetcher||null,p)},xD=(e,t,s)=>{const o=t[e]||(t[e]=[]);return o.push(s),()=>{const l=o.indexOf(s);l>=0&&(o[l]=o[o.length-1],o.pop())}};fD();const $g=Pc.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),Fg={dedupe:!0},vj=Promise.resolve($n),bD=()=>Vs,vD=(e,t,s)=>{const{cache:o,compare:l,suspense:c,fallbackData:u,revalidateOnMount:p,revalidateIfStale:m,refreshInterval:g,refreshWhenHidden:h,refreshWhenOffline:b,keepPreviousData:_,strictServerPrefetchWarning:k}=s,[C,y,w,S]=Hs.get(o),[N,E]=zb(e),R=x.useRef(!1),M=x.useRef(!1),T=x.useRef(N),A=x.useRef(t),z=x.useRef(s),I=()=>z.current,D=()=>I().isVisible()&&I().isOnline(),[P,L,U,q]=eC(o,N),$=x.useRef({}).current,V=jt(u)?jt(s.fallback)?$n:s.fallback[N]:u,G=(ye,De)=>{for(const ve in $){const Re=ve;if(Re==="data"){if(!l(ye[Re],De[Re])&&(!jt(ye[Re])||!l(ne,De[Re])))return!1}else if(De[Re]!==ye[Re])return!1}return!0},K=!R.current,F=x.useMemo(()=>{const ye=P(),De=q(),ve=He=>{const we=Dr(He);return delete we._k,(()=>{if(!N||!t||I().isPaused())return!1;if(K&&!jt(p))return p;const Ce=jt(V)?we.data:V;return jt(Ce)||m})()?{isValidating:!0,isLoading:!0,...we}:we},Re=ve(ye),Le=ye===De?Re:ve(De);let $e=Re;return[()=>{const He=ve(P());return G(He,$e)?($e.data=He.data,$e.isLoading=He.isLoading,$e.isValidating=He.isValidating,$e.error=He.error,$e):($e=He,He)},()=>Le]},[o,N]),X=of.useSyncExternalStore(x.useCallback(ye=>U(N,(De,ve)=>{G(ve,De)||ye()}),[o,N]),F[0],F[1]),H=C[N]&&C[N].length>0,Q=X.data,Y=jt(Q)?V&&J2(V)?$g(V):V:Q,J=X.error,oe=x.useRef(Y),ne=_?jt(Q)?jt(oe.current)?Y:oe.current:Q:Y,te=N&&jt(Y),le=x.useRef(null);!Ml&&of.useSyncExternalStore(bD,()=>(le.current=!1,le),()=>(le.current=!0,le));const fe=le.current;k&&fe&&!c&&te&&console.warn(`Missing pre-initiated data for serialized key "${N}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const ze=!N||!t||I().isPaused()||H&&!jt(J)?!1:K&&!jt(p)?p:c?jt(Y)?!1:m:jt(Y)||m,be=K&&ze,pe=jt(X.isValidating)?be:X.isValidating,je=jt(X.isLoading)?be:X.isLoading,Ne=x.useCallback(async ye=>{const De=A.current;if(!N||!De||M.current||I().isPaused())return!1;let ve,Re,Le=!0;const $e=ye||{},He=!w[N]||!$e.dedupe,we=()=>hj?!M.current&&N===T.current&&R.current:N===T.current,ie={isValidating:!1,isLoading:!1},Ce=()=>{L(ie)},Ee=()=>{const qe=w[N];qe&&qe[1]===Re&&delete w[N]},Se={isValidating:!0};jt(P().data)&&(Se.isLoading=!0);try{if(He&&(L(Se),s.loadingTimeout&&jt(P().data)&&setTimeout(()=>{Le&&we()&&I().onLoadingSlow(N,s)},s.loadingTimeout),w[N]=[De(E),rx()]),[ve,Re]=w[N],ve=await ve,He&&setTimeout(Ee,s.dedupingInterval),!w[N]||w[N][1]!==Re)return He&&we()&&I().onDiscarded(N),!1;ie.error=$n;const qe=y[N];if(!jt(qe)&&(Re<=qe[0]||Re<=qe[1]||qe[1]===0))return Ce(),He&&we()&&I().onDiscarded(N),!1;const st=P().data;ie.data=l(st,ve)?st:ve,He&&we()&&I().onSuccess(ve,N,s)}catch(qe){Ee();const st=I(),{shouldRetryOnError:Nt}=st;st.isPaused()||(ie.error=qe,He&&we()&&(st.onError(qe,N,st),(Nt===!0||ns(Nt)&&Nt(qe))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||D())&&st.onErrorRetry(qe,N,st,me=>{const Me=C[N];Me&&Me[0]&&Me[0](mj,me)},{retryCount:($e.retryCount||0)+1,dedupe:!0})))}return Le=!1,Ce(),!0},[N,o]),Be=x.useCallback((...ye)=>tC(o,T.current,...ye),[]);if(Hg(()=>{A.current=t,z.current=s,jt(Q)||(oe.current=Q)}),Hg(()=>{if(!N)return;const ye=Ne.bind($n,Fg);let De=0;I().revalidateOnFocus&&(De=Date.now()+I().focusThrottleInterval);const Re=xD(N,C,(Le,$e={})=>{if(Le==Q2){const He=Date.now();I().revalidateOnFocus&&He>De&&D()&&(De=He+I().focusThrottleInterval,ye())}else if(Le==Z2)I().revalidateOnReconnect&&D()&&ye();else{if(Le==W2)return Ne();if(Le==mj)return Ne($e)}});return M.current=!1,T.current=N,R.current=!0,L({_k:E}),ze&&(w[N]||(jt(Y)||Ml?ye():eD(ye))),()=>{M.current=!0,Re()}},[N]),Hg(()=>{let ye;function De(){const Re=ns(g)?g(P().data):g;Re&&ye!==-1&&(ye=setTimeout(ve,Re))}function ve(){!P().error&&(h||I().isVisible())&&(b||I().isOnline())?Ne(Fg).then(De):De()}return De(),()=>{ye&&(clearTimeout(ye),ye=-1)}},[g,h,b,N]),x.useDebugValue(ne),c){if(!hj&&Ml&&te)throw new Error("Fallback data is required when using Suspense in SSR.");te&&(A.current=t,z.current=s,M.current=!1);const ye=S[N],De=!jt(ye)&&te?Be(ye):vj;if($g(De),!jt(J)&&te)throw J;const ve=te?Ne(Fg):vj;!jt(ne)&&te&&(ve.status="fulfilled",ve.value=!0),$g(ve)}return{mutate:Be,get data(){return $.data=!0,ne},get error(){return $.error=!0,J},get isValidating(){return $.isValidating=!0,pe},get isLoading(){return $.isLoading=!0,je}}},Ze=hD(vD);let ql=null;function po(e){ql=e}function Db(){return ql}class Yc extends Error{status;body;constructor(t,s,o){super(s),this.status=t,this.body=o}}async function Ji(e,t,s,o={}){const l={"content-type":"application/json",...ql?{authorization:`Bearer ${ql}`}:{},...o.headers||{}},c=await fetch(t,{...o,method:e,headers:l,body:s!==void 0?JSON.stringify(s):void 0});if(!c.ok){let u="",p=null;try{p=await c.json(),u=p?.error||JSON.stringify(p)}catch{u=await c.text()}throw new Yc(c.status,`${e} ${t} → ${c.status}: ${u}`,p)}if(c.status!==204)return await c.json()}const he={get:e=>Ji("GET",e),post:(e,t)=>Ji("POST",e,t),put:(e,t)=>Ji("PUT",e,t),patch:(e,t)=>Ji("PATCH",e,t),del:e=>Ji("DELETE",e)};async function oC(e,t,s,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...ql?{authorization:`Bearer ${ql}`}:{}},body:JSON.stringify(t)});if(!l.ok||!l.body){const m=await l.text().catch(()=>"");throw new Yc(l.status,`POST ${e} → ${l.status}: ${m||"stream failed"}`)}const c=l.body.getReader(),u=new TextDecoder("utf-8");let p="";for(;;){const{value:m,done:g}=await c.read();if(g)break;p+=u.decode(m,{stream:!0});let h=p.indexOf(`
616
+ `);for(;h>=0;){const b=p.slice(0,h).trim();if(p=p.slice(h+1),b)try{s(JSON.parse(b))}catch{}h=p.indexOf(`
617
+ `)}}if(p.trim())try{s(JSON.parse(p.trim()))}catch{}}const _D={get:()=>he.get("/health")},la={list:()=>he.get("/projects"),register:e=>he.post("/projects",{path:e}),remove:e=>he.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>he.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>he.get(`/projects/${e}/config`),set:(e,t)=>he.patch(`/projects/${e}/config`,{set:t}),unset:(e,t)=>he.patch(`/projects/${e}/config`,{unset:t}),put:(e,t)=>he.put(`/projects/${e}/config`,t)},apcProject:{set:(e,t,s)=>he.patch(`/projects/${e}/apc-project`,{set:t,unset:s}),put:(e,t)=>he.put(`/projects/${e}/apc-project`,t)},memory:{get:e=>he.get(`/projects/${e}/memory`),put:(e,t)=>he.put(`/projects/${e}/memory`,{body:t})}},an={list:e=>he.get(`/projects/${e}/agents`),get:(e,t)=>he.get(`/projects/${e}/agents/${t}`),create:(e,t)=>he.post(`/projects/${e}/agents`,t),update:(e,t,s)=>he.patch(`/projects/${e}/agents/${encodeURIComponent(t)}`,s),remove:(e,t)=>he.del(`/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,s)=>he.post(`/projects/${e}/agents/${encodeURIComponent(t)}/chat`,s),memory:{get:(e,t)=>he.get(`/projects/${e}/agents/${t}/memory`),put:(e,t,s)=>he.put(`/projects/${e}/agents/${t}/memory`,{body:s})},vault:e=>he.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,t={},s="")=>he.post("/agents/vault",{slug:e,fields:t,body:s}),vaultPatch:(e,t)=>he.patch(`/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>he.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>he.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>he.post(`/projects/${e}/agents/import`,{slug:t})},Pb={list:(e,t)=>he.get(`/projects/${e}/agents/${t}/conversations`),get:(e,t,s)=>he.get(`/projects/${e}/agents/${t}/conversations/${s}`),compact:(e,t,s)=>he.post(s?`/projects/${e}/agents/${t}/conversations/${s}/compact`:`/projects/${e}/agents/${t}/compact`,{})},wr={list:e=>he.get(`/projects/${e}/routines`),get:(e,t)=>he.get(`/projects/${e}/routines/${t}`),run:(e,t)=>he.post(`/projects/${e}/routines/${t}/run`),enable:(e,t)=>he.post(`/projects/${e}/routines/${t}/enable`),disable:(e,t)=>he.post(`/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>he.post(`/projects/${e}/routines`,t),remove:(e,t)=>he.del(`/projects/${e}/routines/${encodeURIComponent(t)}`)},kr={list:(e,t="open")=>he.get(`/projects/${e}/tasks?state=${t}`),global:(e="open")=>he.get(`/tasks?state=${e}`),add:(e,t)=>he.post(`/projects/${e}/tasks`,t),done:(e,t)=>he.post(`/projects/${e}/tasks/${t}/done`),drop:(e,t)=>he.post(`/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>he.post(`/projects/${e}/tasks/${t}/reopen`)},Sr={list:e=>he.get(`/projects/${e}/mcps`),check:e=>he.get(`/projects/${e}/mcps/check`),add:(e,t,s)=>he.post(`/projects/${e}/mcps?scope=${t}`,s),remove:(e,t,s="shared")=>he.del(`/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${s}`),test:(e,t)=>he.post(`/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>he.get(`/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},Mc={list:(e,t={})=>he.get(`/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,s={})=>he.get(`/projects/${e}/vars/${encodeURIComponent(t)}${s.reveal?"?reveal=1":""}`),upsert:(e,t)=>he.post(`/projects/${e}/vars`,t),remove:(e,t,s="project")=>he.del(`/projects/${e}/vars/${encodeURIComponent(t)}?scope=${s}`)},Gg=e=>{const t=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&t.set(o,String(l));const s=t.toString();return s?`?${s}`:""},ff={global:(e={})=>he.get(`/messages/global${Gg(e)}`),project:(e,t={})=>he.get(`/projects/${e}/messages${Gg(t)}`),search:(e,t,s=50)=>he.get(`/projects/${e}/messages/search${Gg({q:t,limit:s})}`)},yD={global:e=>he.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},jD={list:()=>he.get("/tools")},Nn={channels:{list:()=>he.get("/telegram/channels"),upsert:e=>he.post("/telegram/channels",e),patch:(e,t)=>he.patch(`/telegram/channels/${e}`,t),remove:e=>he.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>he.get("/telegram/contacts"),patch:(e,t)=>he.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>he.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>he.get("/telegram/roles"),set:(e,t)=>he.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>he.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>he.get("/telegram/status"),start:()=>he.post("/telegram/start"),stop:()=>he.post("/telegram/stop"),send:e=>he.post("/telegram/send",e)},pf={list:()=>he.get("/engines"),models:e=>he.post("/engines/models",e)},$l={reload:()=>he.post("/admin/reload"),shutdown:()=>he.post("/admin/shutdown"),config:{get:()=>he.get("/admin/config"),patch:e=>he.patch("/admin/config",e)},superAgent:()=>he.get("/admin/super-agent"),logs:(e="errors",t=200)=>he.get(`/admin/logs?file=${e}&limit=${t}`)},Fl={list:()=>he.get("/pair/list"),revoke:e=>he.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>he.post("/pair/init",{}),status:e=>he.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>he.post("/pair/confirm",e)},_j={get:()=>he.get("/identity"),patch:e=>he.patch("/identity",e)},lC={send:(e,t)=>he.post(`/projects/${e}/super-agent/chat`,t),stream:(e,t,s,o)=>oC(`/projects/${e}/super-agent/chat/stream`,t,s,o),summarize:e=>he.post("/super-agent/summarize",e)},yj={dirs:e=>he.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>he.get(`/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},wD=["alloy","echo","fable","onyx","nova","shimmer"],kD=["Kore","Puck","Charon","Fenrir","Aoede"],SD=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],CD=["tts-1","tts-1-hd"],ND=["tiny","base","small","medium","large-v2","large-v3"],mf={piper:{name:"Piper",note:"Local, offline (CLI + .onnx model). No API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingual. Requires an API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd). Uses your OpenAI key."},gemini:{name:"Gemini",note:"Cloud (preview). Uses your Gemini key."},mock:{name:"Mock",note:"Silent test engine. Always available as a fallback.",local:!0}};async function ED(e){const t=Db(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:t?{authorization:`Bearer ${t}`}:{}});if(!s.ok){const l=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${l.slice(0,160)}`)}const o=await s.blob();return URL.createObjectURL(o)}const iC={providers:()=>he.get("/tts/providers"),say:e=>he.post("/tts/say",e),turn:e=>he.post("/voice/turn",e)},jj={manifest:()=>he.get("/deck/manifest"),setWidget:(e,t)=>he.patch(`/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>he.post("/deck/exec",e)},co=e=>`/projects/${e}/code/sessions`,Is={sessions:{list:e=>he.get(co(e)).then(t=>t.sessions),get:(e,t)=>he.get(`${co(e)}/${t}`),create:(e,t={})=>he.post(co(e),t),update:(e,t,s)=>he.patch(`${co(e)}/${t}`,s),remove:(e,t)=>he.del(`${co(e)}/${t}`)},changes:(e,t)=>he.get(`${co(e)}/${t}/changes`),stream:(e,t,s,o,l)=>oC(`${co(e)}/${t}/chat/stream`,s,o,l)},Al={list:e=>he.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>he.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,s=[])=>he.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:s}),remove:(e,t)=>he.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,s)=>he.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:s}),rename:(e,t,s)=>he.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:s})},fc={list:e=>he.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills"),inspector:()=>he.get("/skills/inspector"),updateInspector:e=>he.put("/skills/inspector",e),index:(e={})=>he.post("/skills/index",e),inspect:(e,t)=>he.post("/skills/inspect",{prompt:e,project_path:t})};function Xc(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/projects",()=>la.list(),{refreshInterval:Ef.projects});return{projects:(e||[]).slice().sort((c,u)=>{const p=Number(c.id),m=Number(u.id);return p===0&&m!==0?-1:m===0&&p!==0?1:p-m}),error:t,isLoading:s,mutate:o}}function Lb(e){const{projects:t,isLoading:s,mutate:o}=Xc();return{project:t.find(c=>String(c.id)===e)??null,isLoading:s,mutate:o}}function Ib(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/identity",()=>_j.get());return{identity:e||{},error:t,isLoading:s,mutate:o,save:async c=>{const u=await _j.patch(c);return await o(u,{revalidate:!1}),u}}}function Bb(){const{identity:e}=Ib();return e?.agent_name?.trim()||"APX"}function RD(){return[{id:"voice",label:f("nav.modules.voice"),href:"/m/voice",icon:Rk},{id:"desktop",label:f("nav.modules.desktop"),href:"/m/desktop",icon:Tk},{id:"deck",label:f("nav.modules.deck"),href:"/m/deck",icon:jA},{id:"code",label:f("nav.modules.code"),href:"/m/code",icon:Ar}]}function TD(e,t,s){const[o,l]=x.useState(t);return x.useLayoutEffect(()=>{const c=e.current;if(!c||!s)return;const u=()=>{const m=c.clientHeight;if(!m)return;const g=parseFloat(getComputedStyle(c).rowGap)||12,b=(c.querySelector("[data-rail-probe]")?.offsetHeight??56)+g,k=Math.max(0,Math.floor((m+g)/b))-1;l(k>=t?t:Math.max(0,k-1))};u();const p=new ResizeObserver(u);return p.observe(c),()=>p.disconnect()},[e,t,s]),s?Math.min(o,t):t}function wj({projects:e,label:t,sublabel:s,icon:o,tooltip:l,header:c,active:u,testId:p,onSelect:m,isActive:g}){return r.jsxs($2,{children:[r.jsxs(F2,{"data-testid":p,title:l,"aria-label":l,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Oe("flex size-10 items-center justify-center rounded-xl text-xs font-bold transition-all","bg-muted/40 text-muted-fg hover:bg-accent hover:text-foreground",u&&"ring-2 ring-foreground ring-offset-2 ring-offset-card"),children:o??t}),s&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:s})]}),r.jsxs(G2,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[r.jsx("div",{className:"px-1.5 py-1 text-xs font-medium text-muted-foreground",children:c}),e.map(h=>{const b=h.name||h.path.split("/").pop()||String(h.id),_=`/p/${h.id}`,{initials:k,idleClass:C}=L4(b);return r.jsxs(Dz,{"data-testid":`project-menu-item-${h.id}`,onClick:()=>m(_),className:Oe(g(_)&&"bg-accent/60 text-foreground"),children:[r.jsx("span",{className:Oe("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",C),children:k}),r.jsx("span",{className:"truncate",children:b})]},h.id)})]})]})}function MD({onSelect:e,onOpenRoby:t,onOpenAddProject:s}){const{projects:o,isLoading:l}=Xc(),c=Qn(),u=RD(),p=Bb(),m=x.useRef(null),{collapsed:g,toggle:h}=Ab(Cn.sidebarCollapsed+".projects"),b=N=>c.pathname===N||c.pathname.startsWith(`${N}/`),_=o.find(N=>String(N.id)==="0"),k=o.filter(N=>String(N.id)!=="0").sort((N,E)=>Number(E.id)-Number(N.id)),C=TD(m,k.length,!g&&k.length>0),y=k.slice(0,C),w=k.slice(C),S=w.some(N=>b(`/p/${N.id}`));return r.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[r.jsx(Je,{content:f("nav.apx_admin"),side:"right",children:r.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:r.jsx($A,{size:36})})}),l&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),_&&r.jsx(bl,{label:f("base.title"),testId:"project-avatar-0",title:f("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:r.jsx("img",{src:"/modules/superagent.png",alt:f("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),u.map(N=>r.jsx(bl,{label:N.label,testId:`module-avatar-${N.id}`,title:N.label,active:b(N.href),icon:r.jsx(N.icon,{size:18}),onClick:()=>e(N.href)},N.id)),r.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[k.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),r.jsx(Je,{content:f(g?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:r.jsx("button",{type:"button",onClick:h,"data-testid":"nav-toggle-projects","aria-label":f(g?"nav.expand_projects":"nav.collapse_projects"),"aria-expanded":!g,className:"flex h-5 w-8 cursor-pointer items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(Qs,{className:Oe("size-3.5 transition-transform",g&&"-rotate-90")})})})]}),r.jsxs("div",{ref:m,className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3 overflow-hidden",children:[k.length>0&&g&&r.jsx(wj,{projects:k,icon:r.jsx(pA,{size:18}),sublabel:String(k.length),tooltip:f("nav.all_projects"),header:f("nav.all_projects"),active:k.some(N=>b(`/p/${N.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),k.length>0&&!g&&r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:r.jsx(bl,{label:"Ag",active:!1,onClick:()=>{}})}),y.map(N=>{const E=N.name||N.path.split("/").pop()||String(N.id),R=`/p/${N.id}`;return r.jsx("div",{"data-rail-item":!0,className:"w-full",children:r.jsx(bl,{label:E,testId:`project-avatar-${N.id}`,title:`${E} — ${N.path}`,active:b(R),onClick:()=>e(R)})},N.id)}),w.length>0&&r.jsx(wj,{projects:w,label:`+${w.length}`,tooltip:f("nav.more_projects",{count:w.length}),header:f("nav.more_projects",{count:w.length}),active:S,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),r.jsx(bl,{label:f("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:r.jsx(sn,{size:18}),active:!1,onClick:()=>s?s():e("/?action=add-project"),title:f("nav.add_project")})]})]}),r.jsx(bl,{label:f("nav.settings"),isSettings:!0,testId:"nav-settings",icon:r.jsx(Zd,{size:16}),active:c.pathname==="/settings"||c.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:f("nav.settings")}),r.jsx(Je,{content:f("settings_ui.documentation"),side:"right",children:r.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":f("settings_ui.documentation"),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(GM,{size:18})})}),r.jsx(Je,{content:f("superagent.talk",{persona:p}),side:"right",children:r.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":f("superagent.talk",{persona:p}),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(gn,{size:18})})})]})}function cC(e){switch(e){case"personal":return f("settings_ui.kind_personal");case"company":return f("settings_ui.kind_company");case"app":return f("settings_ui.kind_app");case"software":return f("settings_ui.kind_software");case"default":return f("settings_ui.kind_default");case"other":return f("settings_ui.kind_other");default:return f("nav.project")}}function Ke({title:e,description:t,action:s,className:o,children:l}){return r.jsxs("section",{className:Oe("rounded-xl border border-border bg-card p-5",o),children:[r.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),s]}),r.jsx("div",{children:l})]})}function kj({children:e}){return r.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-fg",children:e})}function Kc({ok:e}){return r.jsx("span",{className:Oe("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const AD=x.forwardRef(function(t,s){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:p=!0,style:m,...g}=t,{getButtonProps:h,buttonRef:b}=Vr({disabled:c,focusableWhenDisabled:u,native:p});return Ct("button",t,{state:{disabled:c},ref:[s,b],props:[g,h]})}),Sj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Cj=Cc,Ub=(e,t)=>s=>{var o;if(t?.variants==null)return Cj(e,s?.class,s?.className);const{variants:l,defaultVariants:c}=t,u=Object.keys(l).map(g=>{const h=s?.[g],b=c?.[g];if(h===null)return null;const _=Sj(h)||Sj(b);return l[g][_]}),p=s&&Object.entries(s).reduce((g,h)=>{let[b,_]=h;return _===void 0||(g[b]=_),g},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((g,h)=>{let{class:b,className:_,...k}=h;return Object.entries(k).every(C=>{let[y,w]=C;return Array.isArray(w)?w.includes({...c,...p}[y]):{...c,...p}[y]===w})?[...g,b,_]:g},[]);return Cj(e,u,m,s?.class,s?.className)},OD=Ub("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Xs({className:e,variant:t="default",size:s="default",...o}){return r.jsx(AD,{"data-slot":"button",className:St(OD({variant:t,size:s,className:e})),...o})}let Nj=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const zD={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},pc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},DD={disabled:!1,...pc},Hb={valid(e){return e===null?null:e?{[Nj.valid]:""}:{[Nj.invalid]:""}}},PD={invalid:void 0,name:void 0,validityData:{state:zD,errors:[],error:"",value:"",initialValue:null},setValidityData:qn,disabled:void 0,touched:pc.touched,setTouched:qn,dirty:pc.dirty,setDirty:qn,filled:pc.filled,setFilled:qn,focused:pc.focused,setFocused:qn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:DD,markedDirtyRef:{current:!1},registerFieldControl:qn,validation:{getValidationProps:(e=Gt)=>e,getInputValidationProps:(e=Gt)=>e,inputRef:{current:null},commit:async()=>{}}},LD=x.createContext(PD);function Qc(e=!0){const t=x.useContext(LD);if(t.setValidityData===qn&&!e)throw new Error(nn(28));return t}const ID=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:qn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function uC(){return x.useContext(ID)}const BD=x.createContext({controlId:void 0,registerControlId:qn,labelId:void 0,setLabelId:qn,messageIds:[],setMessageIds:qn,getDescriptionProps:e=>e});function Wf(){return x.useContext(BD)}function UD(e,t,s,o=!0,l){const[c,u]=x.useState(),p=Xa(l?`${l}-label`:void 0),m=e??t??c;return Ie(()=>{const g=e||t||!o?void 0:HD(s.current,p);c!==g&&u(g)}),m}function HD(e,t){const s=VD(e);if(s)return!s.id&&t&&(s.id=t),s.id||void 0}function VD(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const s=e.id;if(s){const l=e.nextElementSibling;if(l&&l.htmlFor===s)return l}const o=e.labels;return o&&o[0]}function Jf(e={}){const{id:t,implicit:s=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=Wf(),u=Xa(t),p=s?l:void 0,m=Kn(()=>Symbol("labelable-control")),g=x.useRef(!1),h=x.useRef(t!=null),b=Ve(()=>{!g.current||c===qn||(g.current=!1,c(m.current,void 0))});return Ie(()=>{if(c===qn)return;let _;if(s){const k=o?.current;mt(k)&&k.closest("label")!=null?_=t??null:_=p??u}else if(t!=null)h.current=!0,_=t;else if(h.current)_=u;else{b();return}if(_===void 0){b();return}g.current=!0,c(m.current,_)},[t,o,p,c,s,u,m,b]),x.useEffect(()=>b,[b]),l??u}function Vb(e,t,s,o,l=!0){const{registerFieldControl:c}=Qc(),u=x.useRef(null);u.current||(u.current=Symbol()),Ie(()=>{const p=u.current;return!p||!l?void 0:(c(p,{controlRef:e,getValue:o,id:t,value:s}),()=>{c(p,void 0)})},[e,l,o,t,c,s])}const qD=x.forwardRef(function(t,s){const{render:o,className:l,id:c,name:u,value:p,disabled:m=!1,onValueChange:g,defaultValue:h,autoFocus:b=!1,style:_,...k}=t,{state:C,name:y,disabled:w,setTouched:S,setDirty:N,validityData:E,setFocused:R,setFilled:M,validationMode:T,validation:A}=Qc(),z=w||m,I=y??u,D={...C,disabled:z},{labelId:P}=Wf(),L=Jf({id:c});Ie(()=>{const F=p!=null;A.inputRef.current?.value||F&&p!==""?M(!0):F&&p===""&&M(!1)},[A.inputRef,M,p]);const U=x.useRef(null);Ie(()=>{b&&U.current===Hn(pt(U.current))&&R(!0)},[b,R]);const[q]=Vl({controlled:p,default:h,name:"FieldControl",state:"value"}),$=p!==void 0,V=$?q:void 0,G=Ve(()=>A.inputRef.current?.value);return Vb(A.inputRef,L,V,G),Ct("input",t,{ref:[s,U],state:D,props:[{id:L,disabled:z,name:I,ref:A.inputRef,"aria-labelledby":P,autoFocus:b,...$?{value:V}:{defaultValue:h},onChange(F){const X=F.currentTarget.value;g?.(X,at(Gs,F.nativeEvent)),N(X!==E.initialValue),M(X!=="")},onFocus(){R(!0)},onBlur(F){S(!0),R(!1),T==="onBlur"&&A.commit(F.currentTarget.value)},onKeyDown(F){F.currentTarget.tagName==="INPUT"&&F.key==="Enter"&&(S(!0),A.commit(F.currentTarget.value))}},A.getInputValidationProps(),k],stateAttributesMapping:Hb})}),$D=x.forwardRef(function(t,s){return r.jsx(qD,{ref:s,...t})});function FD({className:e,type:t,...s}){return r.jsx($D,{type:t,"data-slot":"input",className:St("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}function GD({className:e,...t}){return r.jsx("textarea",{"data-slot":"textarea",className:St("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function YD(e){return Ct(e.defaultTagName??"div",e,e)}const XD=Ub("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function KD({className:e,variant:t="default",render:s,...o}){return YD({defaultTagName:"span",props:Dn({className:St(XD({variant:t}),e)},o),render:s,state:{slot:"badge",variant:t}})}const dC=x.createContext(void 0);function QD(){const e=x.useContext(dC);if(e===void 0)throw new Error(nn(63));return e}let Ej=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const fC={...Hb,checked(e){return e?{[Ej.checked]:""}:{[Ej.unchecked]:""}}},ZD=x.forwardRef(function(t,s){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":u,form:p,id:m,inputRef:g,name:h,nativeButton:b=!1,onCheckedChange:_,readOnly:k=!1,required:C=!1,disabled:y=!1,render:w,uncheckedValue:S,value:N,style:E,...R}=t,{clearErrors:M}=uC(),{state:T,setTouched:A,setDirty:z,validityData:I,setFilled:D,setFocused:P,shouldValidateOnChange:L,validationMode:U,disabled:q,name:$,validation:V}=Qc(),{labelId:G}=Wf(),K=q||y,F=$??h,X=x.useRef(null),H=ds(X,g,V.inputRef),Q=x.useRef(null),Y=Xa(),J=Jf({id:m,implicit:!1,controlRef:Q}),oe=b?void 0:J,[ne,te]=Vl({controlled:o,default:!!c,name:"Switch",state:"checked"});Vb(Q,Y,ne),Ie(()=>{X.current&&D(X.current.checked)},[X,D]),Rb(ne,()=>{M(F),z(ne!==I.initialValue),D(ne),L()?V.commit(ne):V.commit(ne,!0)});const{getButtonProps:le,buttonRef:fe}=Vr({disabled:K,native:b}),ze=UD(u,G,X,!b,oe),be={id:b?J:Y,role:"switch","aria-checked":ne,"aria-readonly":k||void 0,"aria-required":C||void 0,"aria-labelledby":ze,onFocus(){K||P(!0)},onBlur(){const Be=X.current;!Be||K||(A(!0),P(!1),U==="onBlur"&&V.commit(Be.checked))},onClick(Be){if(k||K)return;Be.preventDefault();const Ue=X.current;Ue&&Ue.dispatchEvent(new(Zt(Ue)).PointerEvent("click",{bubbles:!0,shiftKey:Be.shiftKey,ctrlKey:Be.ctrlKey,altKey:Be.altKey,metaKey:Be.metaKey}))}},pe=Dn({checked:ne,disabled:K,form:p,id:oe,name:F,required:C,style:F?lS:Wx,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:H,onChange(Be){if(Be.nativeEvent.defaultPrevented)return;if(k){Be.preventDefault();return}const Ue=Be.currentTarget.checked,ye=at(Gs,Be.nativeEvent);_?.(Ue,ye),!ye.isCanceled&&te(Ue)},onFocus(){Q.current?.focus()}},V.getInputValidationProps,N!==void 0?{value:N}:Gt),je=x.useMemo(()=>({...T,checked:ne,disabled:K,readOnly:k,required:C}),[T,ne,K,k,C]),Ne=Ct("span",t,{state:je,ref:[s,Q,fe],props:[be,V.getValidationProps,R,le],stateAttributesMapping:fC});return r.jsxs(dC.Provider,{value:je,children:[Ne,!ne&&F&&S!==void 0&&r.jsx("input",{type:"hidden",form:p,name:F,value:S}),r.jsx("input",{...pe,suppressHydrationWarning:!0})]})}),WD=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,p=QD();return Ct("span",t,{state:p,ref:s,stateAttributesMapping:fC,props:u})});function JD({className:e,size:t="default",...s}){return r.jsx(ZD,{"data-slot":"switch","data-size":t,className:St("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:r.jsx(WD,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}function eP({className:e,...t}){return r.jsx(Cf,{role:"status","aria-label":"Loading",className:St("size-4 animate-spin",e),...t})}const pC=x.createContext(!1),mC=x.createContext(void 0);function To(e){const t=x.useContext(mC);if(e===!1&&t===void 0)throw new Error(nn(27));return t}const tP={...Ro,...Ur},gC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,forceRender:u=!1,...p}=t,{store:m}=To(),g=m.useState("open"),h=m.useState("nested"),b=m.useState("mounted"),_=m.useState("transitionStatus");return Ct("div",t,{state:{open:g,transitionStatus:_},ref:[m.context.backdropRef,s],stateAttributesMapping:tP,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:u||!h})}),ep=x.forwardRef(function(t,s){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,...m}=t,{store:g}=To(),h=g.useState("open"),{getButtonProps:b,buttonRef:_}=Vr({disabled:u,native:p}),k={disabled:u};function C(y){h&&g.setOpen(!1,at(V3,y.nativeEvent))}return Ct("button",t,{state:k,ref:[s,_],props:[{onClick:C},m,b]})}),hC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=To(),g=Xa(u);return m.useSyncedValueWithCleanup("descriptionElementId",g),Ct("p",t,{ref:s,props:[{id:g},p]})});let nP=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),aP=(function(e){return e[e.open=go.open]="open",e[e.closed=go.closed]="closed",e[e.startingStyle=go.startingStyle]="startingStyle",e[e.endingStyle=go.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const xC=x.createContext(void 0);function sP(){const e=x.useContext(xC);if(e===void 0)throw new Error(nn(26));return e}const rP={...Ro,...Ur,nestedDialogOpen(e){return e?{[aP.nestedDialogOpen]:""}:null}},bC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,finalFocus:u,initialFocus:p,...m}=t,{store:g}=To(),h=g.useState("descriptionElementId"),b=g.useState("disablePointerDismissal"),_=g.useState("floatingRootContext"),k=g.useState("popupProps"),C=g.useState("modal"),y=g.useState("mounted"),w=g.useState("nested"),S=g.useState("nestedOpenDialogCount"),N=g.useState("open"),E=g.useState("openMethod"),R=g.useState("titleElementId"),M=g.useState("transitionStatus"),T=g.useState("role"),A=_.useState("floatingId"),z=m.id??A;sP(),gs({open:N,ref:g.context.popupRef,onComplete(){N&&g.context.onOpenChangeComplete?.(!0)}});function I($){return $==="touch"?g.context.popupRef.current:!0}const D=p===void 0?I:p,P=S>0,L=g.useStateSetter("popupElement"),q=Ct("div",t,{state:{open:N,nested:w,transitionStatus:M,nestedDialogOpen:P},props:[k,{id:z,"aria-labelledby":R??void 0,"aria-describedby":h??void 0,role:T,...qc,hidden:!y,onKeyDown($){Kf.has($.key)&&$.stopPropagation()},style:{[nP.nestedDialogs]:S}},m],ref:[s,g.context.popupRef,L],stateAttributesMapping:rP});return r.jsx(ub,{context:_,openInteractionType:E,disabled:!y,closeOnFocusOut:!b,initialFocus:D,returnFocus:u,modal:C!==!1,restoreFocus:"popup",children:q})}),vC=x.forwardRef(function(t,s){const{keepMounted:o=!1,...l}=t,{store:c}=To(),u=c.useState("mounted"),p=c.useState("modal"),m=c.useState("open");return u||o?r.jsx(xC.Provider,{value:o,children:r.jsxs(lb,{ref:s,...l,children:[u&&p===!0&&r.jsx(Eb,{ref:c.context.internalBackdropRef,inert:Ff(!m)}),t.children]})}):null});function oP(e){const{store:t,parentContext:s,actionsRef:o,isDrawer:l}=e,c=t.useState("open");KO(t,c),fb(t);const{forceUnmount:u}=pb(c,t),p=x.useCallback(()=>{t.setOpen(!1,at(Qx))},[t]);return x.useImperativeHandle(o,()=>({unmount:u,close:p}),[u,p]),{parentContext:s,isDrawer:l}}function lP({store:e,dialogRoot:t}){const{parentContext:s,isDrawer:o}=t,l=e.useState("open"),c=e.useState("disablePointerDismissal"),u=e.useState("modal"),p=e.useState("popupElement"),m=e.useState("floatingRootContext"),[g,h]=x.useState(0),[b,_]=x.useState(0),k=g===0,C=If(m,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(N){if(!e.context.outsidePressEnabledRef.current||"button"in N&&N.button!==0||"touches"in N&&N.touches.length!==1)return!1;const E=zn(N);if(k&&!c){const R=E;return u&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===R||e.context.backdropRef.current===R||Qe(R,p)&&!R?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:k});D2(l&&u===!0,p),e.useContextCallback("onNestedDialogOpen",(N,E)=>{h(N),_(E)}),e.useContextCallback("onNestedDialogClose",()=>{h(0),_(0)}),x.useEffect(()=>(s?.onNestedDialogOpen&&l&&s.onNestedDialogOpen(g+1,b+(o?1:0)),s?.onNestedDialogClose&&!l&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&l&&s.onNestedDialogClose()}),[o,l,g,b,s]);const y=C.reference??Gt,w=C.trigger??Gt,S=x.useMemo(()=>Dn(qc,C.floating),[C.floating]);return mb(e,{activeTriggerProps:y,inactiveTriggerProps:w,popupProps:S,nestedOpenDialogCount:g,nestedOpenDrawerCount:b}),null}const iP={...xb,modal:Te(e=>e.modal),nested:Te(e=>e.nested),nestedOpenDialogCount:Te(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Te(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Te(e=>e.disablePointerDismissal),openMethod:Te(e=>e.openMethod),descriptionElementId:Te(e=>e.descriptionElementId),titleElementId:Te(e=>e.titleElementId),viewportElement:Te(e=>e.viewportElement),role:Te(e=>e.role)};class qb extends Uf{constructor(t,s,o=!1){const l=new $c,c=cP(t);c.floatingRootContext=t2(l,s,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},iP)}setOpen=(t,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,s);const o={open:t};JS(o,t,s.trigger),this.update(o)};static useStore(t,s){return WS(t,(l,c)=>new qb(s,l,c),!0).store}}function cP(e={}){return{...gb(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function uP(e,t="dialog"){const{children:s,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:p=!1,modal:m=!0,actionsRef:g,handle:h,triggerId:b,defaultTriggerId:_=null}=e,k=t==="drawer",C=t==="alert-dialog",y=C?!0:m,w=C||p,S=C?"alertdialog":"dialog",N=To(!0),R={modal:y,disablePointerDismissal:w,nested:!!N,role:S},M=qb.useStore(h?.store,{open:l,openProp:o,activeTriggerId:_,triggerIdProp:b,...R});Rf(()=>{const L=o===void 0&&M.state.open===!1&&l===!0?{open:!0,activeTriggerId:_}:null;C?M.update(L?{...R,...L}:R):L&&M.update(L)}),M.useControlledProp("openProp",o),M.useControlledProp("triggerIdProp",b),M.useSyncedValues(R),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",u);const T=M.useState("open"),A=M.useState("mounted"),z=M.useState("payload"),I=oP({store:M,actionsRef:g,parentContext:N?.store.context,isDrawer:k}),D=T||A,P=x.useMemo(()=>({store:M}),[M]);return r.jsx(pC.Provider,{value:!1,children:r.jsxs(mC.Provider,{value:P,children:[D&&r.jsx(lP,{store:M,dialogRoot:I}),typeof s=="function"?s({payload:z}):s]})})}function _C(e){const t=x.useContext(pC)?"drawer":"dialog";return uP(e,t)}const yC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=To(),g=Xa(u);return m.useSyncedValueWithCleanup("titleElementId",g),Ct("h2",t,{ref:s,props:[{id:g},p]})});function ox({...e}){return r.jsx(_C,{"data-slot":"dialog",...e})}function dP({...e}){return r.jsx(vC,{"data-slot":"dialog-portal",...e})}function fP({...e}){return r.jsx(ep,{"data-slot":"dialog-close",...e})}function pP({className:e,...t}){return r.jsx(gC,{"data-slot":"dialog-overlay",className:St("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function lx({className:e,children:t,showCloseButton:s=!0,...o}){return r.jsxs(dP,{children:[r.jsx(pP,{}),r.jsxs(bC,{"data-slot":"dialog-content",className:St("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[t,s&&r.jsxs(ep,{"data-slot":"dialog-close",render:r.jsx(Xs,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(ps,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ix({className:e,...t}){return r.jsx("div",{"data-slot":"dialog-header",className:St("flex flex-col gap-2",e),...t})}function Rj({className:e,showCloseButton:t=!1,children:s,...o}){return r.jsxs("div",{"data-slot":"dialog-footer",className:St("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...o,children:[s,t&&r.jsx(ep,{render:r.jsx(Xs,{variant:"outline"}),children:"Close"})]})}function cx({className:e,...t}){return r.jsx(yC,{"data-slot":"dialog-title",className:St("font-heading text-base leading-none font-medium",e),...t})}function mP({className:e,...t}){return r.jsx(hC,{"data-slot":"dialog-description",className:St("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const gP={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},hP={sm:"sm",md:"default"};function de({variant:e="secondary",size:t="md",loading:s,className:o,children:l,disabled:c,type:u="button",...p}){return r.jsxs(Xs,{type:u,variant:gP[e],size:hP[t],disabled:c||s,className:o,...p,children:[s?r.jsx(ja,{size:14}):null,l]})}function Ae(e){return r.jsx(FD,{...e})}function Pn(e){return r.jsx(GD,{...e})}function xP(e){return r.jsx("select",{...e,className:Oe("h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",e.className)})}function ue({label:e,hint:t,badge:s,children:o}){return r.jsxs("label",{className:"block space-y-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&r.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),o,t&&r.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Wt({checked:e,onChange:t,label:s,disabled:o}){return r.jsxs("label",{className:Oe("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(JD,{checked:e,onCheckedChange:t,disabled:o}),s&&r.jsx("span",{className:"text-sm",children:s})]})}function Ye({children:e,tone:t="muted",className:s}){const o=t==="danger"?"destructive":t==="muted"?"secondary":"outline",l={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return r.jsx(KD,{variant:o,className:Oe("rounded-md",l[t],s),children:e})}function En({open:e,onClose:t,title:s,description:o,children:l,footer:c,size:u="md"}){const p={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return r.jsx(ox,{open:e,onOpenChange:m=>{m||t()},children:r.jsxs(lx,{className:Oe("flex max-h-[88vh] w-full flex-col gap-0 p-0",p[u]),children:[(s||o)&&r.jsxs(ix,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&r.jsx(cx,{children:s}),o&&r.jsx(mP,{children:o})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function ja({size:e=14}){return r.jsx(eP,{style:{width:e,height:e}})}function ht({children:e}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/20 px-4 py-6 text-center text-sm text-muted-foreground",children:e})}function ot({label:e="Cargando…"}){return r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(ja,{})," ",e]})}const jC=x.createContext(null);let bP=1;function vP({children:e}){const[t,s]=x.useState([]),o=x.useCallback((c,u)=>{const p=bP++;s(m=>[...m,{id:p,kind:c,message:u}]),setTimeout(()=>{s(m=>m.filter(g=>g.id!==p))},4500)},[]),l=x.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return x.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),r.jsxs(jC.Provider,{value:l,children:[e,r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[100] flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",children:t.map(c=>r.jsx("div",{className:Oe("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",c.kind==="success"&&"border-emerald-500/40",c.kind==="error"&&"border-destructive/60",c.kind==="info"&&"border-border"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:Oe("mt-1 size-2 shrink-0 rounded-full",c.kind==="success"&&"bg-emerald-500",c.kind==="error"&&"bg-destructive",c.kind==="info"&&"bg-sky-500")}),r.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function lt(){const e=x.useContext(jC);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function wC(){const{data:e,error:t,isLoading:s}=Ze("/health",()=>_D.get(),{refreshInterval:Ef.health});return{health:e,error:t,isLoading:s,isUp:!t&&!!e}}function _P(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/engines",()=>pf.list());return{engines:e?.engines||[],error:t,isLoading:s,mutate:o}}function yP(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/telegram/status",()=>Nn.status(),{refreshInterval:Ef.telegramStatus});return{status:e,error:t,isLoading:s,mutate:o}}function $b(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/telegram/channels",()=>Nn.channels.list());return{channels:e?.channels||[],error:t,isLoading:s,mutate:o}}function Fb(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/telegram/contacts",()=>Nn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:s,mutate:o}}function qa(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Tr(e,t="(no seteada)"){return qa(e)?e:t}function Gl(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function kC({channel:e,onClose:t,onSaved:s}){const o=lt(),[l,c]=x.useState(!1),[u,p]=x.useState({name:""});x.useEffect(()=>{p(e?{...e,bot_token:""}:{name:""})},[e?.name]);const m=async()=>{if(!u.name?.trim()){o.error(f("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===u.name?await Nn.channels.patch(e.name,u):await Nn.channels.upsert(u),o.success(f("telegram_channel_dialog.saved")),s()}catch(g){o.error(g.message)}finally{c(!1)}};return r.jsx(En,{open:!!e,onClose:t,title:e?.name?f("telegram_channel_dialog.edit_title",{name:e.name}):f("telegram_channel_dialog.new_title"),description:f("telegram_ui.channel_dialog_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:l,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:m,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:f("telegram_channel_dialog.name_label"),children:r.jsx(Ae,{value:u.name,onChange:g=>p({...u,name:g.target.value}),disabled:!!e?.name})}),r.jsx(ue,{label:f("telegram_channel_dialog.token_label"),hint:e?.bot_token?Tr(e.bot_token):f("telegram_ui.bot_token_hint"),children:r.jsx(Ae,{type:"password",value:u.bot_token||"",onChange:g=>p({...u,bot_token:g.target.value}),placeholder:e?.bot_token?Tr(e.bot_token):""})}),r.jsx(ue,{label:f("telegram_channel_dialog.chat_id"),children:r.jsx(Ae,{value:u.chat_id||"",onChange:g=>p({...u,chat_id:g.target.value})})}),r.jsx(ue,{label:f("telegram_channel_dialog.project_label"),hint:f("telegram_channel_dialog.project_hint"),children:r.jsx(Ae,{value:u.project||"",onChange:g=>p({...u,project:g.target.value})})}),r.jsx(ue,{label:f("telegram_channel_dialog.route_label"),hint:f("telegram_channel_dialog.route_hint"),children:r.jsx(Ae,{value:u.route_to_agent||"",onChange:g=>p({...u,route_to_agent:g.target.value})})}),r.jsx(ue,{label:f("telegram_channel_dialog.owner_label"),hint:f("telegram_channel_dialog.owner_hint"),children:r.jsx(Ae,{value:u.owner_user_id!=null?String(u.owner_user_id):"",onChange:g=>{const h=g.target.value.trim();p({...u,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),r.jsx(Wt,{checked:!!u.respond_with_engine,onChange:g=>p({...u,respond_with_engine:g}),label:f("telegram_channel_dialog.respond_label")})]})})}function SC({channel:e,onClose:t}){const s=lt(),[o,l]=x.useState(f("admin.telegram_default_message")),[c,u]=x.useState(!1),p=async()=>{if(!(!o.trim()||!e)){u(!0);try{await Nn.send({text:o,channel:e.name}),s.success(f("telegram_ui.message_sent")),t()}catch(m){s.error(m.message)}finally{u(!1)}}};return r.jsx(En,{open:!!e,onClose:t,title:e?f("telegram_send_dialog.title",{name:e.name}):"",description:e?f("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:c,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:p,loading:c,children:f("chat_ui.send")})]}),children:r.jsx(ue,{label:f("telegram_ui.message_label"),children:r.jsx(Pn,{rows:4,value:o,onChange:m=>l(m.target.value)})})})}function CC({bare:e=!1}){const t=lt(),{contacts:s,roles:o,channelOwners:l,isLoading:c,mutate:u}=Fb(),p=new Set(l.filter(_=>_.owner_user_id!=null).map(_=>String(_.owner_user_id))),m=Array.from(new Set(["owner","guest",...Object.keys(o)])),g=async(_,k)=>{try{await Nn.contacts.patch(_.user_id,{role:k}),t.success(f("telegram_ui.role_assigned",{name:_.name||_.user_id,role:k})),u()}catch(C){t.error(C.message)}},h=async _=>{if(confirm(f("telegram_contacts.delete_confirm",{name:_.name||String(_.user_id)})))try{await Nn.contacts.remove(_.user_id),t.success(f("telegram_contacts.removed")),u()}catch(k){t.error(k.message)}},b=r.jsxs(r.Fragment,{children:[c&&r.jsx(ot,{}),!c&&s.length===0&&r.jsx(ht,{children:f("telegram_contacts.empty")}),s.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:s.map(_=>{const k=p.has(String(_.user_id)),C=k?"owner":_.role||"guest";return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:_.name||"—"}),_.username&&r.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",_.username]}),k&&r.jsx(Ye,{tone:"success",children:f("telegram_contacts.owner_badge")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Je,{content:f(k?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:r.jsx(xP,{value:C,disabled:k,onChange:y=>g(_,y.target.value),children:m.map(y=>r.jsx("option",{value:y,children:y},y))})}),r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>h(_),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["user_id: ",String(_.user_id)]}),r.jsxs("span",{children:[f("telegram_contacts.last_seen")," ",_.last_seen?_.last_seen.slice(0,10):"—"]}),r.jsx("span",{children:jP(o[C])})]})]},String(_.user_id))})})]});return e?b:r.jsx(Ke,{title:f("telegram_contacts.title"),description:f("telegram_contacts.desc"),children:b})}function jP(e){return!e||e.tools===void 0?"":e.tools==="*"?f("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${f("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:f("telegram_contacts.tools_none"):""}function wP(){const e=Zn(),[t,s]=wf(),o=lt(),{health:l,isUp:c}=wC(),{projects:u,isLoading:p,mutate:m}=Xc(),{engines:g,isLoading:h}=_P(),{status:b,mutate:_}=yP(),{channels:k,isLoading:C,mutate:y}=$b(),[w,S]=x.useState(null),[N,E]=x.useState(null),R=async()=>{try{await $l.reload(),o.success(f("admin.reload_success"))}catch(z){o.error(z.message)}},M=async()=>{try{b?.enabled?(await Nn.stop(),o.info(f("admin.telegram_polling_stopped"))):(await Nn.start(),o.success(f("admin.telegram_polling_started"))),_()}catch(z){o.error(z.message)}},T=async z=>{if(confirm(f("telegram_channels.delete_confirm",{name:z})))try{await Nn.channels.remove(z),o.success(f("admin.telegram_channel_removed")),y()}catch(I){o.error(I.message)}},A=async(z,I)=>{if(confirm(f("admin.unregister_confirm",{label:I})))try{await la.remove(z),o.success(f("project.unregistered")),m()}catch(D){o.error(D.message)}};return r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[r.jsxs("header",{className:"flex items-end justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:f("admin.title")}),r.jsx("p",{className:"text-sm text-muted-fg",children:f("admin.subtitle")})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Je,{content:f("daemon.reload_hint"),children:r.jsxs(de,{size:"sm",onClick:R,children:[f("common.reload")," config"]})}),r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>{const z=new URLSearchParams(t);z.set("action","add-project"),s(z)},children:[r.jsx(sn,{size:14})," ",f("nav.project")]})]})]}),r.jsx(Ke,{title:f("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Yg,{label:f("daemon.version"),value:l?.version||"—"}),r.jsx(Yg,{label:f("daemon.uptime"),value:l?`${l.uptime_s}s`:"—"}),r.jsx(Yg,{label:f("daemon.status"),value:f(c?"daemon.running":"daemon.down"),ok:c})]})}),r.jsxs(Ke,{title:f("admin.engines_title"),description:f("admin.engines_subtitle"),children:[h&&r.jsx(ot,{}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(z=>r.jsx(Ye,{tone:"info",children:z},z))})]}),r.jsxs(Ke,{title:f("admin.telegram_title"),description:f("admin.telegram_subtitle"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wt,{checked:!!b?.enabled,onChange:M,label:b?.enabled?f("admin.telegram_polling_on"):f("admin.telegram_polling_off")}),r.jsxs(de,{size:"sm",onClick:()=>S({name:""}),children:[r.jsx(sn,{size:14})," ",f("admin.telegram_add_channel")]})]}),children:[C&&r.jsx(ot,{}),k.length===0&&r.jsx(ht,{children:f("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:k.map(z=>r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:z.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[z.project&&r.jsxs(Ye,{tone:"success",children:["project = ",z.project]}),r.jsxs(de,{size:"sm",variant:"ghost",onClick:()=>E(z),children:[r.jsx(Ya,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>S(z),children:f("common.edit")}),r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>T(z.name),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",z.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",z.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",z.respond_with_engine?f("admin.engine_badge"):f("admin.engine_badge_no")]})]})]},z.name))})]}),r.jsx(CC,{}),r.jsxs(Ke,{title:f("admin.projects_title"),description:f("admin.projects_subtitle"),children:[p&&r.jsx(ot,{}),r.jsx("ul",{className:"divide-y divide-border",children:u.map(z=>r.jsxs("li",{className:"flex items-center gap-3 py-2",children:[r.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",z.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${z.id}`),children:[r.jsx("span",{className:"font-medium",children:z.name||z.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:z.path})]}),r.jsxs(Ye,{children:[z.agents??0," ",f("admin.agents_badge")]}),Number(z.id)!==0&&r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>A(String(z.id),z.name||z.path),children:f("admin.unregister")})]},z.id))})]}),r.jsx(kC,{channel:w,onClose:()=>S(null),onSaved:()=>{S(null),y()}}),r.jsx(SC,{channel:N,onClose:()=>E(null)})]})}function Yg({label:e,value:t,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Kc,{ok:s}),r.jsx("span",{children:t})]})]})}const NC=x.createContext(null),EC=x.createContext(null),RC=x.createContext(""),TC=x.createContext(null),MC=x.createContext(null),AC=x.createContext(null);function kP({children:e}){const[t,s]=x.useState(null),[o,l]=x.useState(""),[c,u]=x.useState(null);return r.jsx(EC.Provider,{value:s,children:r.jsx(NC.Provider,{value:t,children:r.jsx(TC.Provider,{value:l,children:r.jsx(RC.Provider,{value:o,children:r.jsx(AC.Provider,{value:u,children:r.jsx(MC.Provider,{value:c,children:e})})})})})})}function SP(){return x.useContext(NC)}function CP(e,t){const s=x.useContext(EC);x.useEffect(()=>(s?.({collapsed:e,toggle:t}),()=>s?.(null)),[e,t,s])}function NP(){return x.useContext(RC)}function EP(e){const t=x.useContext(TC);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function RP(){return x.useContext(MC)}function TP(e){const t=x.useContext(AC);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function OC({sections:e,active:t,onChange:s,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:u,testId:p,children:m}){return CP(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx(Fz,{sections:e,active:t,onChange:s,collapsed:o}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,r.jsx("div",{className:Oe("flex-1 min-h-0 overflow-y-auto",u),"data-testid":p,children:m})]})]})}const Tj={happy:{eyes:["◕","◕"],mouth:"‿"},wave:{eyes:["◕","◕"],mouth:"▽",top:"·"},confused:{eyes:["◑","◐"],mouth:"o",top:"?"},sad:{eyes:["╥","╥"],mouth:"◠"},excited:{eyes:["★","★"],mouth:"▽",top:"✦"},sleeping:{eyes:["−","−"],mouth:"‿",top:"z z"}};function zC({mood:e="happy",className:t}){const s=Tj[e]??Tj.happy,[o,l]=s.eyes,c="text-emerald-700 dark:text-emerald-600/70";return r.jsxs("div",{"aria-hidden":!0,className:St("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[s.top&&r.jsx("div",{children:r.jsx("span",{className:c,children:` ${s.top}`})}),r.jsx("div",{children:" ▄███████▄"}),r.jsxs("div",{children:[" █ ",r.jsx("span",{className:c,children:"██"})," ",r.jsx("span",{className:c,children:"██"})," █"]}),r.jsx("div",{children:` █ ${o} ${l} █`}),r.jsx("div",{children:` █ ${s.mouth} █`}),r.jsx("div",{children:" ▀███████▀"})]})}function DC({mood:e="confused",title:t,titleClassName:s,message:o,action:l,className:c,testId:u}){return r.jsx("div",{className:St("grid h-full place-items-center p-8",c),"data-testid":u,children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(zC,{mood:e,className:"mb-6 text-sm"}),t!=null&&r.jsx("div",{className:St("font-mono font-semibold leading-none tracking-tight text-foreground",s),children:t}),o!=null&&r.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),l&&r.jsx("div",{className:"mt-6",children:l})]})})}function Mj({pid:e}){const t=Ze(`/projects/${e}/tasks?state=open`,()=>kr.list(e)),s=Ze(`/projects/${e}/routines`,()=>wr.list(e)),o=Ze(`/projects/${e}/agents`,()=>an.list(e)),l=Ze(`/projects/${e}/mcps`,()=>Sr.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(ec,{title:f("project.overview.tasks_open"),value:t.data?.length??"…",href:`/p/${e}/tasks`,icon:Pl}),r.jsx(ec,{title:f("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:Dl}),r.jsx(ec,{title:f("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:gn}),r.jsx(ec,{title:f("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:Ph}),r.jsx(ec,{title:f("project.overview.chat"),value:f("project.overview.chat_value"),href:`/p/${e}/chat`,icon:Kd})]})}function ec({title:e,value:t,href:s,icon:o}){return r.jsxs(hk,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[r.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:r.jsx(o,{size:20})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"text-2xl font-semibold",children:t})]})]})}function MP(){const e=Zn(),{projects:t,isLoading:s}=Xc();return r.jsxs(Ke,{title:f("base.workspaces_title"),description:f("base.workspaces_desc"),action:r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[r.jsx(sn,{size:14})," ",f("base.workspaces_new")]}),children:[s&&r.jsx(ot,{}),!s&&t.length===0&&r.jsx(ht,{children:f("base.workspaces_empty")}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.map(o=>{const l=String(o.id)==="0",c=l?f("base.title"):o.name||o.path.split("/").pop()||String(o.id);return r.jsxs("button",{type:"button",onClick:()=>e(`/p/${o.id}`),className:"flex cursor-pointer flex-col gap-2 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-muted-fg/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ck,{className:"size-4 text-muted-fg"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:c}),r.jsx(Ye,{tone:l?"success":"info",children:l?f("base.title"):cC(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const PC=x.createContext(null),LC=x.createContext(null);function hs(){const e=x.useContext(PC);if(e===null)throw new Error(nn(60));return e}function IC(){const e=x.useContext(LC);if(e===null)throw new Error(nn(61));return e}const AP=(e,t)=>Object.is(e,t);function Yl(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function OP(e,t,s){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Yl(t,o,s))}function jc(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Yl(o,t,s))}function zP(e,t,s){return e.filter(o=>!Yl(t,o,s))}function ux(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function BC(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function DP(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(BC(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function UC(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return ux(e)}function jl(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?ux(e.value):ux(e)}function HC(e,t,s){function o(){return UC(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=BC(l)?l.flatMap(u=>u.items):l;if(e==null||typeof e!="object"){const u=c.find(p=>p.value===e);return u&&u.label!=null?u.label:o()}if("value"in e){const u=c.find(p=>p&&p.value===e.value);if(u&&u.label!=null)return u.label}}return o()}function PP(e,t,s){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(x.Fragment,{children:HC(l,t,s)},c)),o),[])}const et={id:Te(e=>e.id),labelId:Te(e=>e.labelId),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),hasSelectedValue:Te(e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:jl(t,o)!==""}),hasNullItemLabel:Te((e,t)=>t?DP(e.items):!1),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t,s)=>{const o=e.isItemEqualToValue,l=e.value;return e.multiple?Array.isArray(l)&&l.some(c=>Yl(s,c,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Yl(s,l,o)}),isSelectedByFocus:Te((e,t)=>e.selectedIndex===t),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),popupSide:Te(e=>e.popupSide),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows)};function mc(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const Va=1;function Gb(e,t){return Math.max(0,e-t)}function gf(e,t){if(t<=0)return 0;const s=mc(e,0,t),o=s,l=t-s,c=o<=Va,u=l<=Va;return c&&u?o<=l?0:t:c?0:u?t:s}function LP(e){const{id:t,value:s,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:u=!1,onOpenChange:p,name:m,form:g,autoComplete:h,disabled:b=!1,readOnly:_=!1,required:k=!1,modal:C=!0,actionsRef:y,inputRef:w,onOpenChangeComplete:S,items:N,multiple:E=!1,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T=AP,highlightItemOnHover:A=!0,children:z}=e,{clearErrors:I}=uC(),{setDirty:D,setTouched:P,setFocused:L,shouldValidateOnChange:U,validityData:q,setFilled:$,name:V,disabled:G,validation:K,validationMode:F}=Qc(),X=Jf({id:t}),H=G||b,Q=V??m,[Y,J]=Vl({controlled:s,default:E?o??Or:o,name:"Select",state:"value"}),[oe,ne]=Vl({controlled:c,default:u,name:"Select",state:"open"}),te=x.useRef([]),le=x.useRef([]),fe=x.useRef(null),ze=x.useRef(null),be=x.useRef(0),pe=x.useRef(null),je=x.useRef([]),Ne=x.useRef(!1),Be=x.useRef(!1),Ue=x.useRef(null),ye=x.useRef(null),De=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ve=x.useRef(!1),{mounted:Re,setMounted:Le,transitionStatus:$e}=ni(oe),{openMethod:He,triggerProps:we}=U2(oe),ie=Kn(()=>new KS({id:X,labelId:void 0,modal:C,multiple:E,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T,value:Y,open:oe,mounted:Re,transitionStatus:$e,items:N,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Ce=nt(ie,et.activeIndex),Ee=nt(ie,et.selectedIndex),Se=nt(ie,et.triggerElement),qe=nt(ie,et.positionerElement),st=M4(He),Nt=He??st,me=x.useMemo(()=>E&&Array.isArray(Y)&&Y.length===0?"":jl(Y,M),[E,Y,M]),Me=x.useMemo(()=>E&&Array.isArray(Y)?Y.map(ut=>jl(ut,M)):jl(Y,M),[E,Y,M]),Pe=mn(ie.state.triggerElement),Fe=Ve(()=>Me);Vb(Pe,X,Y,Fe);const rt=x.useRef(Y),rn=E?Array.isArray(Y)&&Y.length>0:Y!=null;Ie(()=>{Y!==rt.current&&ie.set("forceMount",!0)},[ie,Y]),Ie(()=>{$(rn)},[rn,$]),Ie(function(){const Pt=je.current;let Rn;if(E){const ln=Array.isArray(Y)?Y:[];if(ln.length===0)Rn=null;else{const Ot=ln[ln.length-1],hn=jc(Pt,Ot,T);Rn=hn===-1?null:hn}}else{const ln=jc(Pt,Y,T);Rn=ln===-1?null:ln}Rn===null&&(ye.current=null),!oe&&ie.set("selectedIndex",Rn)},[rn,E,oe,Y,je,T,ie,ye]),Rb(Y,()=>{I(Q),D(Y!==q.initialValue),U()?K.commit(Y):K.commit(Y,!0)});const qt=Ve((ut,Pt)=>{if(p?.(ut,Pt),!Pt.isCanceled&&(ne(ut),!ut&&(Pt.reason===_o||Pt.reason===Df)&&(P(!0),L(!1),F==="onBlur"&&K.commit(Y)),!ut&&ie.state.activeIndex!==null)){const Rn=te.current[ie.state.activeIndex];queueMicrotask(()=>{Rn?.setAttribute("tabindex","-1")})}}),xt=Ve(()=>{Le(!1),ie.update({activeIndex:null,openMethod:null}),S?.(!1)});gs({enabled:!y,open:oe,ref:fe,onComplete(){oe||xt()}}),x.useImperativeHandle(y,()=>({unmount:xt}),[xt]);const At=Ve((ut,Pt)=>{l?.(ut,Pt),!Pt.isCanceled&&J(ut)}),Jt=Ve(()=>{const ut=ie.state.listElement||fe.current;if(!ut)return;const Pt=Gb(ut.scrollHeight,ut.clientHeight),Rn=gf(ut.scrollTop,Pt),ln=Rn>0,Ot=Rn<Pt;ie.state.scrollUpArrowVisible!==ln&&ie.set("scrollUpArrowVisible",ln),ie.state.scrollDownArrowVisible!==Ot&&ie.set("scrollDownArrowVisible",Ot)}),Et=a2({open:oe,onOpenChange:qt,elements:{reference:Se,floating:qe}}),on=IS(Et,{enabled:!_&&!H,event:"mousedown"}),Yt=If(Et),dn=i2(Et,{enabled:!_&&!H,listRef:te,activeIndex:Ce,selectedIndex:Ee,disabledIndices:Or,onNavigate(ut){ut===null&&!oe||ie.set("activeIndex",ut)},focusItemOnHover:A}),Ln=c2(Et,{enabled:!_&&!H&&(oe||!E),listRef:le,activeIndex:Ce,selectedIndex:Ee,onMatch(ut){oe?ie.set("activeIndex",ut):At(je.current[ut],at("none"))},onTyping(ut){Ne.current=ut}}),Jn=x.useMemo(()=>{const ut=Dn(Ln.reference,dn.reference,Yt.reference,on.reference,we);return X&&(ut.id=X),ut},[on.reference,Ln.reference,dn.reference,Yt.reference,we,X]),da=x.useMemo(()=>Dn(qc,Ln.floating,dn.floating,Yt.floating),[Ln.floating,dn.floating,Yt.floating]),ea=dn.item??Gt;Rf(()=>{ie.update({popupProps:da,triggerProps:Jn})}),Ie(()=>{ie.update({id:X,modal:C,multiple:E,value:Y,open:oe,mounted:Re,transitionStatus:$e,popupProps:da,triggerProps:Jn,items:N,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T,openMethod:Nt})},[ie,X,C,E,Y,oe,Re,$e,da,Jn,N,R,M,T,Nt]);const xs=x.useMemo(()=>({store:ie,name:Q,required:k,disabled:H,readOnly:_,multiple:E,highlightItemOnHover:A,setValue:At,setOpen:qt,listRef:te,popupRef:fe,scrollHandlerRef:ze,handleScrollArrowVisibility:Jt,scrollArrowsMountedCountRef:be,itemProps:ea,events:Et.context.events,valueRef:pe,valuesRef:je,labelsRef:le,typingRef:Ne,selectionRef:De,firstItemTextRef:Ue,selectedItemTextRef:ye,validation:K,onOpenChangeComplete:S,keyboardActiveRef:Be,alignItemWithTriggerActiveRef:ve,initialValueRef:rt}),[ie,Q,k,H,_,E,A,At,qt,ea,Et.context.events,K,S,Jt]),In=ds(w,K.inputRef),fa=E&&Array.isArray(Y)&&Y.length>0,Ia=E?void 0:Q,bs=x.useMemo(()=>!E||!Array.isArray(Y)||!Q?null:Y.map(ut=>{const Pt=jl(ut,M);return r.jsx("input",{type:"hidden",form:g,name:Q,value:Pt},Pt)}),[E,Y,g,Q,M]);return r.jsx(PC.Provider,{value:xs,children:r.jsxs(LC.Provider,{value:Et,children:[z,r.jsx("input",{...K.getInputValidationProps({onFocus(){ie.state.triggerElement?.focus({focusVisible:!0})},onChange(ut){if(ut.nativeEvent.defaultPrevented||H||_){ut.preventBaseUIHandler?.();return}const Pt=ut.currentTarget.value,Rn=at(Gs,ut.nativeEvent);function ln(){if(E)return;const Ot=je.current.find(hn=>jl(hn,M).toLowerCase()===Pt.toLowerCase()||UC(hn,R).toLowerCase()===Pt.toLowerCase());Ot!=null&&(D(Ot!==q.initialValue),At(Ot,Rn),U()&&K.commit(Ot))}ie.set("forceMount",!0),queueMicrotask(ln)}}),id:X&&Ia==null?`${X}-hidden-input`:void 0,form:g,name:Ia,autoComplete:h,value:me,disabled:H,required:k&&!fa,readOnly:_,ref:In,style:Q?lS:Wx,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),bs]})})}function IP(e,t){return e??t}const wd=2,BP=400,UP={...Zh,...Hb,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},HP=x.forwardRef(function(t,s){const{render:o,className:l,id:c,disabled:u=!1,nativeButton:p=!0,style:m,...g}=t,{setTouched:h,setFocused:b,validationMode:_,state:k,disabled:C}=Qc(),{labelId:y}=Wf(),{store:w,setOpen:S,selectionRef:N,validation:E,readOnly:R,required:M,alignItemWithTriggerActiveRef:T,disabled:A,keyboardActiveRef:z}=hs(),I=C||A||u,D=nt(w,et.open),P=nt(w,et.mounted),L=nt(w,et.value),U=nt(w,et.triggerProps),q=nt(w,et.positionerElement),$=nt(w,et.listElement),V=nt(w,et.popupSide),G=nt(w,et.id),K=nt(w,et.labelId),F=nt(w,et.hasSelectedValue),X=P&&q?V:null,H=c??G,Q=IP(y,K);Jf({id:H});const Y=mn(q),J=x.useRef(null),{getButtonProps:oe,buttonRef:ne}=Vr({disabled:I,native:p}),te=Ve(Ne=>{w.set("triggerElement",Ne)}),le=ds(s,J,ne,te),fe=wn(),ze=wn(),be=wn();x.useEffect(()=>{if(D)return be.start(BP,()=>{N.current.allowUnselectedMouseUp=!0,N.current.allowSelectedMouseUp=!0}),()=>{be.clear()};N.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ze.clear()},[D,N,ze,be]);const pe=Dn(U,{id:H,role:"combobox","aria-expanded":D?"true":"false","aria-haspopup":"listbox","aria-controls":D?$?.id??Jd(q)?.id:void 0,"aria-labelledby":Q,"aria-readonly":R||void 0,"aria-required":M||void 0,tabIndex:I?-1:0,ref:le,onFocus(Ne){b(!0),D&&T.current&&S(!1,at(Gs,Ne.nativeEvent)),fe.start(0,()=>{w.set("forceMount",!0)})},onBlur(Ne){Qe(q,Ne.relatedTarget)||(h(!0),b(!1),_==="onBlur"&&E.commit(L))},onPointerMove(){z.current=!1},onKeyDown(){z.current=!0},onMouseDown(Ne){if(D)return;const Be=pt(Ne.currentTarget);function Ue(ye){if(!J.current)return;const De=ye.target;if(Qe(J.current,De)||Qe(Y.current,De)||De===J.current)return;const ve=H2(J.current);ye.clientX>=ve.left-wd&&ye.clientX<=ve.right+wd&&ye.clientY>=ve.top-wd&&ye.clientY<=ve.bottom+wd||S(!1,at(tS,ye))}ze.start(0,()=>{Be.addEventListener("mouseup",Ue,{once:!0})})}},E.getValidationProps,g,oe);pe.role="combobox";const je={...k,open:D,disabled:I,value:L,readOnly:R,popupSide:X,placeholder:!F};return Ct("button",t,{ref:[s,J],state:je,stateAttributesMapping:UP,props:pe})}),VP={value:()=>null},qP=x.forwardRef(function(t,s){const{className:o,render:l,children:c,placeholder:u,style:p,...m}=t,{store:g,valueRef:h}=hs(),b=nt(g,et.value),_=nt(g,et.items),k=nt(g,et.itemToStringLabel),C=nt(g,et.hasSelectedValue),y=!C&&u!=null&&c==null,w=nt(g,et.hasNullItemLabel,y),S={value:b,placeholder:!C};let N=null;return typeof c=="function"?N=c(b):c!=null?N=c:!C&&u!=null&&!w?N=u:Array.isArray(b)?N=PP(b,_,k):N=HC(b,_,k),Ct("span",t,{state:S,ref:[s,h],props:[{children:N},m],stateAttributesMapping:VP})}),$P=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,{store:p}=hs(),g={open:nt(p,et.open)};return Ct("span",t,{state:g,ref:s,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:d2})}),FP=x.createContext(void 0),GP=x.forwardRef(function(t,s){const{store:o}=hs(),l=nt(o,et.mounted),c=nt(o,et.forceMount);return l||c?r.jsx(FP.Provider,{value:!0,children:r.jsx(lb,{ref:s,...t})}):null}),VC=x.createContext(void 0);function Yb(){const e=x.useContext(VC);if(!e)throw new Error(nn(59));return e}function hf(e,t){e&&Object.assign(e.style,t)}const qC={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},YP={position:"fixed"},XP=x.forwardRef(function(t,s){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p="bottom",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_,arrowPadding:k=5,sticky:C=!1,disableAnchorTracking:y,alignItemWithTrigger:w=!0,collisionAvoidance:S=RS,style:N,...E}=t,{store:R,listRef:M,labelsRef:T,alignItemWithTriggerActiveRef:A,selectedItemTextRef:z,valuesRef:I,initialValueRef:D,popupRef:P,setValue:L}=hs(),U=IC(),q=nt(R,et.open),$=nt(R,et.mounted),V=nt(R,et.modal),G=nt(R,et.value),K=nt(R,et.openMethod),F=nt(R,et.positionerElement),X=nt(R,et.triggerElement),H=nt(R,et.isItemEqualToValue),Q=nt(R,et.transitionStatus),Y=x.useRef(null),J=x.useRef(null),[oe,ne]=x.useState(w),te=$&&oe&&K!=="touch";!$&&oe!==w&&ne(w),Ie(()=>{$||(et.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),et.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,$]),x.useImperativeHandle(A,()=>te),P2((te||V)&&q,K==="touch",F,X);const le=yb({anchor:o,floatingRootContext:U,positionMethod:l,mounted:$,side:p,sideOffset:g,align:m,alignOffset:h,arrowPadding:k,collisionBoundary:b,collisionPadding:_,sticky:C,disableAnchorTracking:y??te,collisionAvoidance:S,keepMounted:!0}),fe=te?"none":le.side,ze=te?YP:le.positionerStyles,be={open:q,side:fe,align:le.align,anchorHidden:le.anchorHidden};Ie(()=>{R.set("popupSide",le.side)},[R,le.side]);const pe=Ve(ye=>{R.set("positionerElement",ye)}),je=jb(t,be,{styles:ze,transitionStatus:Q,props:E,refs:[s,pe],hidden:!$,inert:!q}),Ne=x.useRef(0),Be=Ve(ye=>{if(ye.size===0&&Ne.current===0||I.current.length===0)return;const De=Ne.current;if(Ne.current=ye.size,ye.size===De)return;const ve=at(Gs);if(De!==0&&!R.state.multiple&&G!==null&&jc(I.current,G,H)===-1){const Le=D.current,He=Le!=null&&jc(I.current,Le,H)!==-1?Le:null;L(He,ve),He===null&&(R.set("selectedIndex",null),z.current=null)}if(De!==0&&R.state.multiple&&Array.isArray(G)){const Re=$e=>jc(I.current,$e,H)!==-1,Le=G.filter($e=>Re($e));(Le.length!==G.length||Le.some($e=>!OP(G,$e,H)))&&(L(Le,ve),Le.length===0&&(R.set("selectedIndex",null),z.current=null))}if(q&&te){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Re={height:""};hf(F,Re),hf(P.current,Re)}}),Ue=x.useMemo(()=>({...le,side:fe,alignItemWithTriggerActive:te,setControlledAlignItemWithTrigger:ne,scrollUpArrowRef:Y,scrollDownArrowRef:J}),[le,fe,te,ne]);return r.jsx(Qf,{elementsRef:M,labelsRef:T,onMapChange:Be,children:r.jsxs(VC.Provider,{value:Ue,children:[$&&V&&r.jsx(Eb,{inert:Ff(!q),cutout:X}),je]})})}),kd="base-ui-disable-scrollbar",dx={className:kd,getElement(e){return r.jsx("style",{nonce:e,href:kd,precedence:"base-ui:low",children:`.${kd}{scrollbar-width:none}.${kd}::-webkit-scrollbar{display:none}`})}},KP=x.createContext(void 0),QP={disableStyleElements:!1};function ZP(){return x.useContext(KP)??QP}const WP={...Ro,...Ur},JP=x.forwardRef(function(t,s){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m,popupRef:g,onOpenChangeComplete:h,setOpen:b,valueRef:_,firstItemTextRef:k,selectedItemTextRef:C,keyboardActiveRef:y,multiple:w,handleScrollArrowVisibility:S,scrollHandlerRef:N,listRef:E,highlightItemOnHover:R}=hs(),{side:M,align:T,alignItemWithTriggerActive:A,isPositioned:z,setControlledAlignItemWithTrigger:I,scrollDownArrowRef:D,scrollUpArrowRef:P}=Yb(),L=T2()!=null,U=IC(),q=qf(),{nonce:$,disableStyleElements:V}=ZP(),G=nt(m,et.id),K=nt(m,et.open),F=nt(m,et.mounted),X=nt(m,et.popupProps),H=nt(m,et.transitionStatus),Q=nt(m,et.triggerElement),Y=nt(m,et.positionerElement),J=nt(m,et.listElement),oe=x.useRef(!1),ne=x.useRef(!1),te=x.useRef({}),le=Bl(),fe=Ve(je=>{if(!Y||!g.current||!ne.current)return;if(oe.current||!A){S();return}const Ne=Y.style.top==="0px",Be=Y.style.bottom==="0px";if(!Ne&&!Be){S();return}const Ue=Oj(Y),ye=gc(Y.getBoundingClientRect().height,"y",Ue),De=pt(Y),ve=getComputedStyle(Y),Re=parseFloat(ve.marginTop),Le=parseFloat(ve.marginBottom),$e=Aj(getComputedStyle(g.current)),He=Math.min(De.documentElement.clientHeight-Re-Le,$e),we=je.scrollTop,ie=Sd(je);let Ce=0,Ee=null,Se=!1,qe=!1;const st=Pe=>{Y.style.height=`${Pe}px`},Nt=(Pe,Fe)=>{const rt=mc(Pe,0,He-ye);rt>0&&st(ye+rt),je.scrollTop=Fe,He-(ye+rt)<=Va&&(oe.current=!0),S()},me=Ne?ie-we:we,Me=Math.min(ye+me,He);if(Ce=Me,me<=Va){Nt(me,Ne?ie:0);return}if(He-Me>Va)Ne?qe=!0:Ee=0;else if(Se=!0,Be&&we<ie){const Pe=ye+me-He;Ee=we-(me-Pe)}if(Ce=Math.ceil(Ce),Ce!==0&&st(Ce),qe||Ee!=null){const Pe=Sd(je),Fe=qe?Pe:mc(Ee,0,Pe);Math.abs(je.scrollTop-Fe)>Va&&(je.scrollTop=Fe)}(Se||Ce>=He-Va)&&(oe.current=!0),S()});x.useImperativeHandle(N,()=>fe,[fe]),gs({open:K,ref:g,onComplete(){K&&h?.(!0)}});const ze={open:K,transitionStatus:H,side:M,align:T};Ie(()=>{!Y||!g.current||Object.keys(te.current).length||(te.current={top:Y.style.top||"0",left:Y.style.left||"0",right:Y.style.right,height:Y.style.height,bottom:Y.style.bottom,minHeight:Y.style.minHeight,maxHeight:Y.style.maxHeight,marginTop:Y.style.marginTop,marginBottom:Y.style.marginBottom})},[g,Y]),Ie(()=>{K||A||(ne.current=!1,oe.current=!1,hf(Y,te.current))},[K,A,Y,g]),Ie(()=>{const je=g.current;if(!K||!Q||!Y||!je||A&&!z||m.state.transitionStatus==="ending")return;if(!A){ne.current=!0,le.request(S),je.style.removeProperty("--transform-origin");return}const Ne=eL(je);je.style.removeProperty("--transform-origin");try{let Be=C.current;Be?.isConnected||(Be=!et.hasSelectedValue(m.state)&&k.current?.isConnected?k.current:null);const Ue=_.current,ye=getComputedStyle(Y),De=getComputedStyle(je),ve=pt(Q),Re=Zt(Y),Le=Oj(Q),$e=Cd(Q.getBoundingClientRect(),Le),He=Cd(Y.getBoundingClientRect(),Le),we=$e.height,ie=J||je,Ce=ie.scrollHeight,Ee=parseFloat(De.borderBottomWidth),Se=parseFloat(ye.marginTop)||10,qe=parseFloat(ye.marginBottom)||10,st=parseFloat(ye.minHeight)||100,Nt=Aj(De),me=5,Me=5,Pe=20,Fe=ve.documentElement.clientHeight-Se-qe,rt=ve.documentElement.clientWidth,rn=Fe-$e.bottom+we;let qt,xt=q==="rtl"?$e.right-He.width:$e.left,At=0;if(Be&&Ue){const In=Cd(Ue.getBoundingClientRect(),Le);qt=Cd(Be.getBoundingClientRect(),Le),xt=He.left+(q==="rtl"?In.right-qt.right:In.left-qt.left);const fa=In.top-$e.top+In.height/2;At=qt.top-He.top+qt.height/2-fa}const Jt=rn+At+qe+Ee;let Et=Math.min(Fe,Jt);const on=Fe-Se-qe,Yt=Jt-Et,dn=rt-Me;Y.style.left=`${mc(xt,me,dn-He.width)}px`,Y.style.height=`${Et}px`,Y.style.maxHeight="auto",Y.style.marginTop=`${Se}px`,Y.style.marginBottom=`${qe}px`,je.style.height="100%";const Ln=Sd(ie),Jn=Yt>=Ln-Va;Jn&&(Et=Math.min(Fe,He.height)-(Yt-Ln));const da=$e.top<Pe||$e.bottom>Fe-Pe||Math.ceil(Et)+Va<Math.min(Ce,st),ea=(Re.visualViewport?.scale??1)!==1&&Fx;if(da||ea){ne.current=!0,hf(Y,te.current),I(!1);return}const xs=Math.max(st,Et);if(Jn){const In=Math.max(0,Fe-Jt);Y.style.top=He.height>=on?"0":`${In}px`,Y.style.height=`${Et}px`,ie.scrollTop=Sd(ie)}else Y.style.bottom="0",ie.scrollTop=Yt;if(qt){const In=He.top,fa=He.height,Ia=qt.top+qt.height/2,bs=fa>0?(Ia-In)/fa*100:50,ut=mc(bs,0,100);je.style.setProperty("--transform-origin",`50% ${ut}%`)}(xs===Fe||Et>=Nt)&&(oe.current=!0),S(),R&&m.state.selectedIndex===null&&m.state.activeIndex===null&&E.current[0]!=null&&m.set("activeIndex",0),ne.current=!0}finally{Ne()}},[m,K,Y,Q,_,k,C,g,S,A,I,le,D,P,J,E,R,q,z]),x.useEffect(()=>{if(!A||!Y||!K)return;const je=Zt(Y);function Ne(Be){b(!1,at(q3,Be))}return gt(je,"resize",Ne)},[b,A,Y,K]);const be={...J?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${G}-list`},onKeyDown(je){y.current=!0,L&&Kf.has(je.key)&&je.stopPropagation()},onMouseMove(){y.current=!1},onScroll(je){J||fe(je.currentTarget)},...A&&{style:J?{height:"100%"}:qC}},pe=Ct("div",t,{ref:[s,g],state:ze,stateAttributesMapping:WP,props:[X,be,$f(H),{className:!J&&A?dx.className:void 0},p]});return r.jsxs(x.Fragment,{children:[!V&&dx.getElement($),r.jsx(ub,{context:U,modal:!1,disabled:!F,returnFocus:u,restoreFocus:!0,children:pe})]})});function Aj(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Sd(e){return Gb(e.scrollHeight,e.clientHeight)}function Oj(e){return FS.getScale(e)}function gc(e,t,s){return e/s[t]}function Cd(e,t){return Ec({x:gc(e.x,"x",t),y:gc(e.y,"y",t),width:gc(e.width,"x",t),height:gc(e.height,"y",t)})}const zj=[["transform","none"],["scale","1"],["translate","0 0"]];function eL(e){const{style:t}=e,s={};for(const[o,l]of zj)s[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of zj){const l=s[o];l?t.setProperty(o,l):t.removeProperty(o)}}}const tL=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,{store:p,scrollHandlerRef:m}=hs(),{alignItemWithTriggerActive:g}=Yb(),h=nt(p,et.hasScrollArrows),b=nt(p,et.openMethod),_=nt(p,et.multiple),C={id:`${nt(p,et.id)}-list`,role:"listbox","aria-multiselectable":_||void 0,onScroll(w){m.current?.(w.currentTarget)},...g&&{style:qC},className:h&&b!=="touch"?dx.className:void 0},y=Ve(w=>{p.set("listElement",w)});return Ct("div",t,{ref:[s,y],props:[C,u]})}),$C=x.createContext(void 0);function Xb(){const e=x.useContext($C);if(!e)throw new Error(nn(57));return e}const nL=x.memo(x.forwardRef(function(t,s){const{render:o,className:l,style:c,value:u=null,label:p,disabled:m=!1,nativeButton:g=!1,...h}=t,b=x.useRef(null),_=Fc({label:p,textRef:b,indexGuessBehavior:E2.GuessFromOrder}),{store:k,itemProps:C,setOpen:y,setValue:w,selectionRef:S,typingRef:N,valuesRef:E,multiple:R,selectedItemTextRef:M}=hs(),T=nt(k,et.isActive,_.index),A=nt(k,et.isSelected,_.index,u),z=nt(k,et.isSelectedByFocus,_.index),I=nt(k,et.isItemEqualToValue),D=_.index,P=D!==-1,L=x.useRef(null);Ie(()=>{if(!P)return;const J=E.current;return J[D]=u,()=>{delete J[D]}},[P,D,u,E]),Ie(()=>{if(!P)return;const J=k.state.value;let oe=J;R&&Array.isArray(J)&&J.length>0&&(oe=J[J.length-1]),oe!==void 0&&Yl(u,oe,I)&&(k.set("selectedIndex",D),b.current&&(M.current=b.current))},[P,D,R,I,k,u,M]);const U=x.useRef(null),q=x.useRef("mouse"),$=x.useRef(!1),{getButtonProps:V,buttonRef:G}=Vr({disabled:m,focusableWhenDisabled:!0,native:g,composite:!0}),K={disabled:m,selected:A,highlighted:T};function F(J){const oe=k.state.value;if(R){const ne=Array.isArray(oe)?oe:[],te=A?zP(ne,u,I):[...ne,u];w(te,at(El,J))}else w(u,at(El,J)),y(!1,at(El,J))}function X(){S.current.dragY=0}const H={role:"option","aria-selected":A,tabIndex:T?0:-1,onKeyDown(J){U.current=J.key,k.set("activeIndex",D),J.key===" "&&N.current&&J.preventDefault()},onClick(J){const oe=J.type==="click"&&q.current!=="touch",ne=J.nativeEvent.pointerType,te=oe&&Gx(J.nativeEvent)&&(ne!==void 0||T),le=oe&&!te&&!$.current;$.current=!1,!(J.type==="keydown"&&U.current===null)&&(m||J.type==="keydown"&&U.current===" "&&N.current||le||(U.current=null,F(J.nativeEvent)))},onPointerEnter(J){q.current=J.pointerType},onPointerMove(J){if(J.pointerType==="mouse"&&J.buttons===1){const oe=S.current;oe.dragY+=J.movementY,oe.dragY**2>=64&&(oe.allowUnselectedMouseUp=!0)}},onPointerDown(J){q.current=J.pointerType,$.current=!0,X()},onMouseUp(){if(X(),m||q.current==="touch"||$.current)return;const J=!S.current.allowSelectedMouseUp&&A,oe=!S.current.allowUnselectedMouseUp&&!A;J||oe||($.current=!0,L.current?.click(),$.current=!1)}},Q=Ct("div",t,{ref:[G,s,_.ref,L],state:K,props:[C,H,h,V]}),Y=x.useMemo(()=>({selected:A,index:D,textRef:b,selectedByFocus:z,hasRegistered:P}),[A,D,b,z,P]);return r.jsx($C.Provider,{value:Y,children:Q})})),aL=x.forwardRef(function(t,s){const o=t.keepMounted??!1,{selected:l}=Xb();return o||l?r.jsx(sL,{...t,ref:s}):null}),sL=x.memo(x.forwardRef((e,t)=>{const{render:s,className:o,style:l,keepMounted:c,...u}=e,{selected:p}=Xb(),m=x.useRef(null),{transitionStatus:g,setMounted:h}=ni(p),_=Ct("span",e,{ref:[t,m],state:{selected:p,transitionStatus:g},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Ur});return gs({open:p,ref:m,onComplete(){p||h(!1)}}),_})),rL=x.memo(x.forwardRef(function(t,s){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:u}=Xb(),{firstItemTextRef:p,selectedItemTextRef:m}=hs(),{render:g,className:h,style:b,..._}=t,k=x.useCallback(y=>{y&&(u&&o===0&&(p.current=y),u&&c&&(m.current=y))},[p,m,o,c,u]);return Ct("div",t,{ref:[k,s,l],props:_})})),FC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,direction:u,keepMounted:p=!1,...m}=t,g=u==="up",{store:h,popupRef:b,listRef:_,handleScrollArrowVisibility:k,scrollArrowsMountedCountRef:C}=hs(),{side:y,scrollDownArrowRef:w,scrollUpArrowRef:S}=Yb(),N=g?et.scrollUpArrowVisible:et.scrollDownArrowVisible,E=nt(h,N),R=nt(h,et.openMethod),M=E&&R!=="touch",T=wn(),A=g?S:w,{transitionStatus:z,setMounted:I}=ni(M);Ie(()=>(C.current+=1,h.state.hasScrollArrows||h.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&h.state.hasScrollArrows&&h.set("hasScrollArrows",!1)}),[h,C]),gs({open:M,ref:A,onComplete(){M||I(!1)}});const L=Ct("div",t,{ref:[s,A],state:{direction:u,visible:M,side:y,transitionStatus:z},props:[{"aria-hidden":!0,children:g?"▲":"▼",style:{position:"absolute"},onMouseMove(q){if(q.movementX===0&&q.movementY===0||T.isStarted())return;h.set("activeIndex",null);function $(){const V=h.state.listElement??b.current;if(!V)return;h.set("activeIndex",null),k();const G=Gb(V.scrollHeight,V.clientHeight),K=gf(V.scrollTop,G),F=K===(g?0:G),X=_.current;if(K!==V.scrollTop&&(V.scrollTop=K),X.length===0&&h.set(g?"scrollUpArrowVisible":"scrollDownArrowVisible",!F),F){T.clear();return}if(X.length>0){const H=A.current?.offsetHeight||0;V.scrollTop=oL(X,g,K,V.clientHeight,H,G)}T.start(40,$)}T.start(40,$)},onMouseLeave(){T.clear()}},m]});return M||p?L:null});function oL(e,t,s,o,l,c){if(t){let h=0;const b=s+l-Va;for(let C=0;C<e.length;C+=1){const y=e[C];if(y&&y.offsetTop>=b){h=C;break}}const _=Math.max(0,h-1),k=e[_];return _<h&&k?gf(k.offsetTop-l,c):0}let u=e.length-1;const p=s+o-l+Va;for(let h=0;h<e.length;h+=1){const b=e[h];if(b&&b.offsetTop+b.offsetHeight>p){u=Math.max(0,h-1);break}}const m=Math.min(e.length-1,u+1),g=e[m];return m>u&&g?gf(g.offsetTop+g.offsetHeight-o+l,c):c}const lL=x.forwardRef(function(t,s){return r.jsx(FC,{...t,ref:s,direction:"down"})}),iL=x.forwardRef(function(t,s){return r.jsx(FC,{...t,ref:s,direction:"up"})}),cL=LP;function uL({className:e,...t}){return r.jsx(qP,{"data-slot":"select-value",className:St("flex flex-1 text-left",e),...t})}function dL({className:e,size:t="default",children:s,...o}){return r.jsxs(HP,{"data-slot":"select-trigger","data-size":t,className:St("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,r.jsx($P,{render:r.jsx(Qs,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function fL({className:e,children:t,side:s="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...p}){return r.jsx(GP,{children:r.jsx(XP,{side:s,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:r.jsxs(JP,{"data-slot":"select-content","data-align-trigger":u,className:St("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...p,children:[r.jsx(mL,{}),r.jsx(tL,{children:t}),r.jsx(gL,{})]})})})}function pL({className:e,children:t,...s}){return r.jsxs(nL,{"data-slot":"select-item",className:St("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[r.jsx(rL,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),r.jsx(aL,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(bo,{className:"pointer-events-none"})})]})}function mL({className:e,...t}){return r.jsx(iL,{"data-slot":"select-scroll-up-button",className:St("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:r.jsx(wk,{})})}function gL({className:e,...t}){return r.jsx(lL,{"data-slot":"select-scroll-down-button",className:St("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:r.jsx(Qs,{})})}function kt({value:e,onChange:t,options:s,placeholder:o="— elegir —",disabled:l,className:c,showIcon:u=!1}){return r.jsxs(cL,{value:e,onValueChange:p=>t(p??""),disabled:l,children:[r.jsx(dL,{className:Oe("h-9 w-full",c),children:r.jsx(uL,{placeholder:o,children:p=>{const m=s.find(h=>h.value===p),g=u?m?.icon:void 0;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g&&r.jsx(g,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:m?.label??p})]})}})}),r.jsx(fL,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:s.map(p=>{const m=p.icon;return r.jsx(pL,{value:p.value,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?r.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,p.description?r.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[r.jsx("span",{className:"truncate font-medium",children:p.label}),r.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:p.description})]}):r.jsx("span",{className:"truncate",children:p.label})]})},p.value)})})]})}const Dj=320;function hL(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function xL(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function bL({m:e}){const[t,s]=x.useState(!1),o=(e.body?.length||0)>Dj,l=!o||t?e.body:`${e.body.slice(0,Dj)}…`;return r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?r.jsx(_k,{size:14,className:"text-blue-400"}):r.jsx(jk,{size:14,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:hL(e.ts)}),r.jsx(Ye,{tone:"info",children:e.channel}),e.type&&r.jsx(Ye,{children:e.type}),r.jsx("span",{className:"font-medium text-foreground",children:xL(e)})]}),e.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&r.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:f(t?"logs.show_less":"logs.show_more")})]})]})}function vL(){const[e,t]=x.useState(!1),s=Ze(e?"/admin/logs?errors":null,()=>$l.logs("errors",200)),o=s.data?.entries||[];return r.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>t(l.target.open),children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[f("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),r.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&r.jsx(ot,{}),e&&!s.isLoading&&o.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("logs.no_errors")}),r.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>r.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&r.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&r.jsx("span",{className:"text-destructive",children:l.level})]}),r.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(l.msg??l.message??l.error??l.raw??JSON.stringify(l)).slice(0,500)})]},c))})]})]})}function _L({pid:e}){const t=!e||String(e)==="0",[s,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,g]=x.useState(""),h=s.trim()||void 0,b=t?`/messages/global?channel=${h??""}`:`/projects/${e}/messages?channel=${h??""}`,_=Ze(b,()=>t?ff.global({channel:h,limit:300}):ff.project(e,{channel:h,limit:300})),k=x.useMemo(()=>[..._.data||[]].sort((w,S)=>(S.ts||"").localeCompare(w.ts||"")),[_.data]),C=x.useMemo(()=>Array.from(new Set(k.map(w=>w.type).filter(Boolean))),[k]),y=x.useMemo(()=>k.filter(w=>!(l&&w.direction!==l||u&&w.type!==u||m&&!(w.body||"").toLowerCase().includes(m.toLowerCase()))),[k,l,u,m]);return r.jsxs(Ke,{title:f("logs.title"),description:f(t?"logs.desc_global":"logs.desc_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ae,{placeholder:f("logs.filter_channel"),value:s,onChange:w=>o(w.target.value),className:"w-44"}),r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),children:r.jsx(cs,{size:13})})]}),children:[t&&r.jsx(vL,{}),r.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"w-36",children:r.jsx(kt,{value:l,onChange:c,placeholder:f("logs.filter_dir"),options:[{value:"",label:f("logs.all_directions")},{value:"in",label:f("logs.in")},{value:"out",label:f("logs.out")}]})}),r.jsx("div",{className:"w-40",children:r.jsx(kt,{value:u,onChange:p,placeholder:f("logs.filter_type"),options:[{value:"",label:f("logs.all_types")},...C.map(w=>({value:w,label:w}))]})}),r.jsx(Ae,{placeholder:f("logs.search_text"),value:m,onChange:w=>g(w.target.value),className:"w-56"}),r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[y.length," ",f("logs.count_of")," ",k.length]})]}),_.isLoading&&r.jsx(ot,{}),_.error&&r.jsx(ht,{children:f("logs.error",{msg:_.error.message})}),!_.isLoading&&!_.error&&y.length===0&&r.jsx(ht,{children:h?f("logs.no_activity_ch",{ch:h}):f("logs.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:y.map((w,S)=>r.jsx(bL,{m:w},`${w.ts}-${S}`))})]})}function GC({value:e,onChange:t,options:s,placeholder:o=f("shared_ui.model_combobox_ph"),invalid:l,invalidHint:c,className:u}){const[p,m]=x.useState(!1),[g,h]=x.useState(e),b=x.useRef(null),_=x.useRef(null),[k,C]=x.useState(null);x.useEffect(()=>{h(e)},[e]),x.useLayoutEffect(()=>{if(!p)return;const E=()=>{const R=b.current;if(!R)return;const M=R.getBoundingClientRect();C({top:M.bottom+4,left:M.left,width:M.width})};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[p]),x.useEffect(()=>{if(!p)return;const E=R=>{const M=R.target;b.current?.contains(M)||_.current?.contains(M)||m(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);const y=g.trim().toLowerCase(),S=y&&!(g===e)?s.filter(E=>E.toLowerCase().includes(y)):s,N=E=>{t(E),h(E),m(!1)};return r.jsxs("div",{ref:b,className:Oe("relative",u),children:[r.jsxs("div",{className:Oe("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",l?"border-amber-500/60":"border-border"),children:[l&&r.jsx(Je,{content:c||f("models_ui.invalid_hint"),children:r.jsx("span",{children:r.jsx(zk,{className:"size-3.5 shrink-0 text-amber-400"})})}),r.jsx("input",{value:g,placeholder:o,onChange:E=>{h(E.target.value),t(E.target.value),m(!0)},onFocus:()=>m(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(E=>!E),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(Qs,{className:"size-4"})})]}),p&&S.length>0&&k&&is.createPortal(r.jsx("ul",{ref:_,style:{position:"fixed",top:k.top,left:k.left,width:k.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:S.map(E=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),N(E)},className:Oe("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",E===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:E})})},E))}),document.body)]})}function qr(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/admin/config",()=>$l.config.get()),l=async(c,u)=>{const p=await $l.config.patch({set:c,unset:u});return await o({config:p.config},{revalidate:!1}),p.config};return{config:e?.config||{},error:t,isLoading:s,mutate:o,patch:l}}function YC(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/admin/super-agent",()=>$l.superAgent());return{superAgent:e,error:t,isLoading:s,mutate:o}}const yL={anthropic:"from-orange-600 to-amber-600",openai:"from-emerald-600 to-teal-600",gemini:"from-blue-600 to-indigo-600",groq:"from-cyan-600 to-teal-600",openrouter:"from-violet-600 to-indigo-600",ollama:"from-amber-600 to-orange-600",azure:"from-blue-600 to-cyan-600",mock:"from-slate-600 to-gray-600",custom:"from-slate-600 to-gray-600"},jL={anthropic:"bg-orange-500/20 text-orange-300 border border-orange-500/40",openai:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40",gemini:"bg-blue-500/20 text-blue-300 border border-blue-500/40",groq:"bg-cyan-500/20 text-cyan-300 border border-cyan-500/40",openrouter:"bg-violet-500/20 text-violet-300 border border-violet-500/40",ollama:"bg-amber-500/20 text-amber-300 border border-amber-500/40",azure:"bg-blue-500/20 text-blue-300 border border-blue-500/40",mock:"bg-slate-500/20 text-slate-300 border border-slate-500/40",custom:"bg-slate-500/20 text-slate-300 border border-slate-500/40"},wc=[{value:"anthropic",label:"Anthropic"},{value:"openai",label:"OpenAI-compatible"},{value:"gemini",label:"Gemini"},{value:"groq",label:"Groq"},{value:"openrouter",label:"OpenRouter"},{value:"ollama",label:"Ollama"},{value:"azure",label:"Azure OpenAI"},{value:"mock",label:"Mock (test)"},{value:"custom",label:"Custom"}];function Xg(e,t){return t&&t in e?e[t]:e.custom}const xf={anthropic:fs,openai:gn,gemini:mA,groq:Pl,openrouter:Dx,ollama:Ak,azure:eA,mock:Sk,custom:Jl},ho={anthropic:{base_url:"",default_model:"claude-sonnet-4.6",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-sonnet-4.6","claude-sonnet-4.5","claude-haiku-4.5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-4o-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-pro","gemini-3.5-flash","gemini-3.1-pro","gemini-3.1-flash","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"llama-3.3-70b-versatile",api_key_env:"GROQ_API_KEY",known_models:["llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","openai/gpt-oss-120b","openai/gpt-oss-20b","groq/compound","groq/compound-mini","qwen/qwen3-32b","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","deepseek/deepseek-r1:free","meta-llama/llama-3.3-70b-instruct:free","google/gemini-2.0-flash-exp:free","qwen/qwen3-235b-a22b:free","anthropic/claude-sonnet-4.5","openai/gpt-4o-mini"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"gpt-4o-mini",api_key_env:"AZURE_OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini"]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};function XC(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function Kg({value:e,onChange:t,providers:s}){const{provider:o,model:l}=XC(e),c=s.find(h=>h.slug===o),u=!!o&&!c,p=x.useMemo(()=>{const h=c?ho[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),m=h=>{const b=s.find(k=>k.slug===h),_=b?.default_model||ho[b?.engine]?.default_model||"";t(_?`${h}:${_}`:`${h}:`)},g=h=>t(`${o}:${h}`);return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(kt,{value:o,onChange:m,placeholder:u?f("router_panel.provider_not_found",{name:o}):f("router_panel.provider_ph"),options:s.map(h=>({value:h.slug,label:h.slug,icon:xf[h.engine]}))}),r.jsx(GC,{value:l,onChange:g,options:p,invalid:u,invalidHint:f("router_panel.provider_not_configured",{name:o})})]})}function wL(){const e=lt(),{superAgent:t,isLoading:s,mutate:o}=YC(),{config:l,patch:c}=qr(),[u,p]=x.useState(""),[m,g]=x.useState([]),[h,b]=x.useState(""),[_,k]=x.useState(null),[C,y]=x.useState(!1),[w,S]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const D=t.model_fallback?.models||[],P=Array.isArray(D)?D:[];p(t.model||""),g(P),S({model:t.model||"",fallback:P})},[t]);const N=x.useMemo(()=>{const D=l.engines||{};return Object.entries(D).map(([P,L])=>({slug:P,engine:L?.engine||P,default_model:L?.default_model||ho[L?.engine||P]?.default_model}))},[l.engines]),E=D=>{const{provider:P}=XC(D);return N.some(L=>L.slug===P)};if(s||!t)return r.jsx(ot,{});const R=u!==w.model||JSON.stringify(m)!==JSON.stringify(w.fallback),M=async()=>{y(!0);try{await c({"super_agent.model":u,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(f("router_panel.saved_toast")),S({model:u,fallback:m}),o()}catch(D){e.error(D.message)}finally{y(!1)}},T=()=>{const D=h.trim().replace(/:$/,"");!D||!D.includes(":")||m.includes(D)||(g([...m,D]),b(""))},A=(D,P)=>{const L=[...m];L[D]=P,g(L)},z=D=>{g(m.filter((P,L)=>L!==D)),_===D&&k(null)},I=(D,P)=>{const L=D+P;if(L<0||L>=m.length)return;const U=[...m];[U[D],U[L]]=[U[L],U[D]],g(U)};return r.jsx(Ke,{title:f("router_panel.title"),description:f("router_panel.description"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs(Ye,{tone:"success",children:[r.jsx(Dx,{size:11})," ",f("router_panel.badge_default")]}),r.jsx("span",{className:`font-mono text-xs ${!E(u)&&u?"text-amber-400":""}`,children:u||"—"}),m.map(D=>r.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[r.jsx(yk,{size:12}),r.jsx("span",{className:`font-mono text-xs ${E(D)?"":"text-amber-400"}`,children:D})]},D))]}),N.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("router_panel.no_providers")}):r.jsx(ue,{label:f("router_panel.active_model_label"),hint:f("router_panel.active_model_hint"),children:r.jsx(Kg,{value:u,onChange:p,providers:N})}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-sm font-medium",children:f("router_panel.fallback_title")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_desc")})]}),r.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((D,P)=>{const L=!E(D),U=_===P;return r.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"w-6 text-muted-fg",children:["#",P+1]}),U?r.jsx("div",{className:"flex-1",children:r.jsx(Kg,{value:D,onChange:q=>A(P,q),providers:N})}):r.jsxs("button",{type:"button",onClick:()=>k(P),className:"flex flex-1 items-center gap-1.5 text-left",children:[L&&r.jsx(zk,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${L?"text-amber-400":""}`,children:D})]}),U?r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>k(null),children:f("router_panel.done")}):r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>k(P),children:r.jsx(Eo,{size:12})}),r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>I(P,-1),disabled:P===0,children:"↑"}),r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>I(P,1),disabled:P===m.length-1,children:"↓"}),r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>z(P),children:r.jsx(ua,{size:12})})]})},`${P}-${D}`)}),m.length===0&&r.jsx("li",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_empty")})]}),N.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.add_to_chain")}),r.jsx(Kg,{value:h,onChange:b,providers:N}),r.jsxs(de,{size:"sm",variant:"secondary",onClick:T,disabled:!h.includes(":")||h.endsWith(":"),children:[r.jsx(sn,{size:13})," ",f("router_panel.add_to_chain")]})]})]}),r.jsx(de,{variant:"primary",loading:C,disabled:!R,onClick:M,children:f(R?"router_panel.save":"router_panel.saved")})]})})}function kL({provider:e,onEdit:t,onDelete:s,onToggle:o}){const l=Xg(yL,e.engine),c=Xg(jL,e.engine),u=Xg(xf,e.engine),p=wc.find(b=>b.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,g=Gl(e.api_key),h=e.is_active!==!1;return r.jsxs("div",{className:"group flex h-full cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4 transition-colors hover:border-muted-fg/50",onClick:t,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:Oe("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:r.jsx(u,{className:"size-5 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),r.jsxs("span",{className:Oe("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[r.jsx(u,{className:"size-3"})," ",p]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Je,{content:f(h?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:r.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:Oe("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",h?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[r.jsx("span",{className:Oe("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),f(h?"providers_card.active":"providers_card.off")]})}),r.jsx(Je,{content:f("providers_modal.delete"),children:r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:r.jsx(ua,{className:"size-3.5"})})})]})]}),r.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[r.jsx(tc,{label:f("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(tc,{label:f("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),r.jsx(tc,{label:f("providers_card.api_key"),value:m?g?`…${g}`:f("providers_card.key_set"):"—",mono:!!g}),e.default_temperature!==void 0&&r.jsx(tc,{label:f("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(tc,{label:f("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function tc({label:e,value:t,mono:s,truncate:o}){return r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:e}),r.jsx("span",{className:Oe("text-foreground",s&&"font-mono",o&&"max-w-[180px] truncate"),children:t})]})}const Pj={name:"",slug:"",engine:"anthropic",base_url:"",api_key_value:"",default_model:"",default_temperature:.7,default_max_tokens:4096,is_active:!0,context_limit_tokens:2e5,model_context_limits_json:"",p_input:"",p_output:"",p_cache_read:"",p_cache_write:""},SL=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function nc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Nd(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function CL(e){return{name:e.name||e.slug,slug:e.slug,engine:e.engine||"custom",base_url:e.base_url||"",api_key_value:"",default_model:e.default_model||"",default_temperature:e.default_temperature??.7,default_max_tokens:e.default_max_tokens??4096,is_active:e.is_active!==!1,context_limit_tokens:e.context_limit_tokens??2e5,model_context_limits_json:e.model_context_limits?JSON.stringify(e.model_context_limits,null,2):"",p_input:Nd(e.pricing?.input_per_million),p_output:Nd(e.pricing?.output_per_million),p_cache_read:Nd(e.pricing?.cache_read_per_million),p_cache_write:Nd(e.pricing?.cache_write_per_million)}}function NL({open:e,initial:t,existingSlugs:s,onClose:o,onSave:l}){const c=!!t,[u,p]=x.useState(Pj),[m,g]=x.useState(!1),[h,b]=x.useState(null),[_,k]=x.useState([]),[C,y]=x.useState(!1),[w,S]=x.useState(null),[N,E]=x.useState(!1),[R,M]=x.useState("");x.useEffect(()=>{if(!e)return;const F=t?CL(t):Pj;p(F),b(null),S(null),E(!1);const X=ho[F.engine];k(X?.known_models||[])},[e,t]);const T=F=>p(X=>({...X,...F})),A=F=>{const X=ho[F];T({engine:F,name:F==="custom"?u.name:wc.find(H=>H.value===F)?.label||F,slug:F==="custom"?u.slug:F,base_url:X.base_url,default_model:X.default_model}),k(X.known_models),S(null)},z=F=>{const X=ho[F];T({engine:F,base_url:u.base_url||X.base_url,default_model:u.default_model||X.default_model}),k(X.known_models)},I=async()=>{y(!0),S(null);try{const F=await pf.models({engine:u.engine,slug:u.slug||nc(u.name),base_url:u.base_url||void 0,api_key:u.api_key_value||void 0});if(F.error){S(F.error);return}k(F.models),F.models.length===0&&S(f("providers_modal.err_no_models"))}catch(F){S(F.message||f("providers_modal.err_list_models"))}finally{y(!1)}},D=x.useMemo(()=>u.default_model&&!_.includes(u.default_model)?[u.default_model,..._]:_,[_,u.default_model]),P=()=>{const F=(u.slug||nc(u.name)).trim();if(!F)return b(f("providers_modal.err_slug_required")),null;if(!c&&s.includes(F))return b(f("providers_modal.err_slug_exists",{slug:F})),null;let X;if(u.model_context_limits_json.trim())try{const Y=JSON.parse(u.model_context_limits_json);if(!Y||typeof Y!="object"||Array.isArray(Y))throw new Error;X=Y}catch{return b(f("providers_modal.err_model_limits_json")),null}const Q=[u.p_input,u.p_output,u.p_cache_read,u.p_cache_write].map(Y=>Y.trim()).some(Boolean)?{input_per_million:Number(u.p_input||0),output_per_million:Number(u.p_output||0),cache_read_per_million:Number(u.p_cache_read||0),cache_write_per_million:Number(u.p_cache_write||0)}:void 0;return{provider:{slug:F,name:u.name.trim()||F,engine:u.engine,base_url:u.base_url.trim()||void 0,default_model:u.default_model.trim()||void 0,default_temperature:u.default_temperature,default_max_tokens:u.default_max_tokens,is_active:u.is_active,context_limit_tokens:u.context_limit_tokens||void 0,model_context_limits:X,pricing:Q},modelLimits:X}},L=()=>{const F=P();if(!F)return;const{provider:X}=F,H={name:X.name,engine:X.engine,is_active:X.is_active!==!1,default_temperature:X.default_temperature,default_max_tokens:X.default_max_tokens};X.base_url&&(H.base_url=X.base_url),X.default_model&&(H.default_model=X.default_model),X.context_limit_tokens&&(H.context_limit_tokens=X.context_limit_tokens),X.model_context_limits&&(H.model_context_limits=X.model_context_limits),X.pricing&&(H.pricing=X.pricing),u.api_key_value.trim()&&(H.api_key=u.api_key_value.trim()),M(JSON.stringify(H,null,2)),b(null),E(!0)},U=async()=>{g(!0),b(null);try{if(N){const X=(u.slug||nc(u.name)).trim();if(!X){b(f("providers_modal.err_slug_required_form"));return}let H;try{H=JSON.parse(R)}catch{b(f("providers_modal.err_json_invalid"));return}if(!H||typeof H!="object"||Array.isArray(H)){b(f("providers_modal.err_json_object"));return}const Q=H;if(!Q.engine||typeof Q.engine!="string"){b(f("providers_modal.err_engine_missing"));return}const Y={slug:X,name:typeof Q.name=="string"?Q.name:X,engine:String(Q.engine),base_url:typeof Q.base_url=="string"?Q.base_url:void 0,default_model:typeof Q.default_model=="string"?Q.default_model:void 0,is_active:Q.is_active!==!1};await l({provider:Y,raw:Q,originalSlug:t?.slug}),o();return}const F=P();if(!F)return;await l({provider:F.provider,apiKeyValue:u.api_key_value.trim()||void 0,originalSlug:t?.slug}),o()}catch(F){b(F.message||f("providers_modal.err_save"))}finally{g(!1)}},q=c&&qa(t?.api_key),$=Gl(t?.api_key),V=q?f("providers_modal.api_key_set",{suffix:$??""}):"sk-…",G=u.engine==="ollama",K=ho[u.engine]?.api_key_env;return r.jsx(En,{open:e,onClose:o,title:c?f("providers_modal.edit_title",{name:t?.name||t?.slug||""}):f("providers_modal.new_title"),description:f("providers_modal.description"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:o,disabled:m,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:U,loading:m,children:f(c?"common.save":"common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[c?r.jsx("span",{}):r.jsx("div",{className:"flex flex-wrap gap-1.5",children:SL.map(F=>{const X=xf[F],H=F==="custom"?f("providers_modal.custom"):wc.find(Y=>Y.value===F)?.label||F,Q=u.engine===F;return r.jsxs("button",{type:"button",onClick:()=>A(F),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${Q?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:border-muted-fg/60 hover:text-foreground"}`,children:[r.jsx(X,{className:"size-3.5"})," ",H]},F)})}),r.jsxs("button",{type:"button",onClick:()=>N?E(!1):L(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${N?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[r.jsx(XM,{className:"size-3.5"})," ",f(N?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),N?r.jsxs("div",{className:"space-y-2",children:[r.jsx(ue,{label:f("providers_modal.json_label"),hint:f("providers_modal.json_hint",{slug:u.slug||nc(u.name)||"<slug>"}),children:r.jsx(Pn,{rows:14,className:"font-mono text-xs",value:R,onChange:F=>M(F.target.value),spellCheck:!1})}),r.jsx("p",{className:"text-[11px] text-muted-fg",children:f("providers_modal.json_help")})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("providers_modal.name_label"),children:r.jsx(Ae,{value:u.name,onChange:F=>T({name:F.target.value,slug:c?u.slug:nc(F.target.value)}),placeholder:f("providers_modal.name_ph")})}),r.jsx(ue,{label:f("providers_modal.engine_label"),children:r.jsx(kt,{value:u.engine,onChange:F=>z(F),options:wc.map(F=>({value:F.value,label:F.label,icon:xf[F.value]}))})})]}),r.jsx(ue,{label:f("providers_modal.base_url_label"),hint:f("providers_modal.base_url_hint"),children:r.jsx(Ae,{value:u.base_url,onChange:F=>T({base_url:F.target.value}),placeholder:f("providers_modal.base_url_ph")})}),!G&&r.jsx(ue,{label:f("providers_modal.api_key_label"),hint:q?f("providers_modal.api_key_hint_existing"):K?f("providers_modal.api_key_hint_env",{env:K}):f("providers_modal.api_key_hint"),children:r.jsx(Ae,{type:"password",autoComplete:"new-password",value:u.api_key_value,onChange:F=>T({api_key_value:F.target.value}),placeholder:V})}),r.jsx(ue,{label:f("providers_modal.model_label"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(GC,{value:u.default_model,onChange:F=>T({default_model:F}),options:D,className:"flex-1"}),r.jsx(Je,{content:f("providers_modal.list_models_hint"),children:r.jsxs(de,{size:"sm",variant:"secondary",onClick:I,disabled:C,"aria-label":f("providers_modal.list_models_hint"),children:[C?r.jsx(Cf,{className:"size-3.5 animate-spin"}):r.jsx(cs,{className:"size-3.5"}),f("providers_modal.load_models")]})})]}),w&&r.jsx("p",{className:"text-[11px] text-amber-400",children:w})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("providers_modal.max_tokens_label"),children:r.jsx(Ae,{type:"number",min:256,step:256,value:u.default_max_tokens,onChange:F=>T({default_max_tokens:parseInt(F.target.value)||4096})})}),r.jsx(ue,{label:f("providers_modal.temperature_label",{value:u.default_temperature.toFixed(1)}),children:r.jsx("input",{type:"range",min:0,max:2,step:.1,value:u.default_temperature,onChange:F=>T({default_temperature:parseFloat(F.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),r.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:f("providers_modal.pricing_summary")}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx(ue,{label:f("providers_modal.context_limit_label"),children:r.jsx(Ae,{type:"number",min:0,step:1024,value:u.context_limit_tokens,onChange:F=>T({context_limit_tokens:parseInt(F.target.value)||0})})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("providers_modal.price_input"),children:r.jsx(Ae,{type:"number",min:0,step:1e-4,value:u.p_input,onChange:F=>T({p_input:F.target.value}),placeholder:"0.15"})}),r.jsx(ue,{label:f("providers_modal.price_output"),children:r.jsx(Ae,{type:"number",min:0,step:1e-4,value:u.p_output,onChange:F=>T({p_output:F.target.value}),placeholder:"0.60"})}),r.jsx(ue,{label:f("providers_modal.price_cache_read"),children:r.jsx(Ae,{type:"number",min:0,step:1e-4,value:u.p_cache_read,onChange:F=>T({p_cache_read:F.target.value}),placeholder:"0.03"})}),r.jsx(ue,{label:f("providers_modal.price_cache_write"),children:r.jsx(Ae,{type:"number",min:0,step:1e-4,value:u.p_cache_write,onChange:F=>T({p_cache_write:F.target.value}),placeholder:"0.00"})})]}),r.jsx(ue,{label:f("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:r.jsx(Pn,{rows:3,className:"font-mono text-xs",value:u.model_context_limits_json,onChange:F=>T({model_context_limits_json:F.target.value})})})]})]}),r.jsx(Wt,{checked:u.is_active,onChange:F=>T({is_active:F}),label:f("providers_modal.active_label")})]}),h&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const EL=new Set(wc.map(e=>e.value));function RL(e,t){const s=typeof t.engine=="string"&&t.engine||(EL.has(e)?e:"custom");return{slug:e,name:typeof t.name=="string"?t.name:void 0,engine:s,base_url:typeof t.base_url=="string"?t.base_url:void 0,api_key:typeof t.api_key=="string"?t.api_key:void 0,default_model:typeof t.default_model=="string"?t.default_model:void 0,default_temperature:typeof t.default_temperature=="number"?t.default_temperature:void 0,default_max_tokens:typeof t.default_max_tokens=="number"?t.default_max_tokens:void 0,is_active:typeof t.is_active=="boolean"?t.is_active:void 0,context_limit_tokens:typeof t.context_limit_tokens=="number"?t.context_limit_tokens:void 0,model_context_limits:t.model_context_limits||void 0,pricing:t.pricing||void 0}}function TL(){const e=lt(),{config:t,isLoading:s,patch:o,mutate:l}=qr(),[c,u]=x.useState(!1),[p,m]=x.useState(null);if(s)return r.jsx(ot,{});const g=t.engines||{},h=Object.entries(g).map(([S,N])=>RL(S,N||{})),b=h.map(S=>S.slug),_=()=>{m(null),u(!0)},k=S=>{m(S),u(!0)},C=async({provider:S,apiKeyValue:N,raw:E})=>{if(E){await o({[`engines.${S.slug}`]:E}),e.success(f("engines_panel.saved_json")),l();return}const R=`engines.${S.slug}`,M={[`${R}.name`]:S.name,[`${R}.engine`]:S.engine,[`${R}.is_active`]:S.is_active!==!1,[`${R}.default_temperature`]:S.default_temperature,[`${R}.default_max_tokens`]:S.default_max_tokens},T=[],A=(z,I)=>{I===void 0||I===""?T.push(`${R}.${z}`):M[`${R}.${z}`]=I};A("base_url",S.base_url),A("default_model",S.default_model),A("context_limit_tokens",S.context_limit_tokens),A("pricing",S.pricing),A("model_context_limits",S.model_context_limits),N&&(M[`${R}.api_key`]=N),await o(M,T),e.success(f("engines_panel.saved")),l()},y=async S=>{try{await o({[`engines.${S.slug}.is_active`]:S.is_active===!1}),l()}catch(N){e.error(N.message)}},w=async S=>{if(confirm(f("engines_panel.delete_confirm",{name:S.name||S.slug})))try{await o(void 0,[`engines.${S.slug}`]),e.success(f("engines_panel.deleted")),l()}catch(N){e.error(N.message)}};return r.jsxs(Ke,{title:f("engines_panel.title"),description:f("engines_panel.description"),action:r.jsxs(de,{size:"sm",variant:"primary",onClick:_,children:[r.jsx(sn,{size:14})," ",f("engines_panel.new_btn")]}),children:[h.length===0?r.jsx(ht,{children:f("engines_panel.empty")}):r.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(S=>r.jsx(kL,{provider:S,onEdit:()=>k(S),onDelete:()=>w(S),onToggle:()=>y(S)},S.slug)),r.jsxs("button",{type:"button",onClick:_,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[r.jsx(sn,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:f("engines_panel.add_card")})]})]}),r.jsx(NL,{open:c,initial:p,existingSlugs:b,onClose:()=>{u(!1),m(null)},onSave:C})]})}function KC(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(wL,{}),r.jsx(TL,{})]})}function ML(){const e=lt(),[t,s]=x.useState(!1),l=Ze(t?"/agents/vault?include_removed=1":"/agents/vault",()=>an.vault({includeRemoved:t})),c=l.data||[],[u,p]=x.useState(null),m=async h=>{const b=h.source!=="user",_=b?f("base.defaults_tombstone_msg",{slug:h.slug}):f("base.defaults_delete_msg",{slug:h.slug});if(confirm(_))try{await an.vaultRemove(h.slug),e.success(f(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(k){e.error(k.message)}},g=async h=>{try{await an.vaultRestore(h),e.success(f("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return r.jsxs(Ke,{title:f("base.defaults_title"),description:f("base.defaults_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wt,{checked:t,onChange:s,label:f("base.defaults_show_removed")}),r.jsxs(de,{size:"sm",onClick:()=>p("new"),children:[r.jsx(sn,{size:14})," ",f("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(ot,{}),!l.isLoading&&c.length===0&&r.jsx(ht,{children:f("base.defaults_empty")}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const b=t&&h.tombstoned;return r.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${b?"border-dashed border-border opacity-60":"border-border"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:h.is_master?r.jsx(Fs,{className:"size-4 text-white"}):r.jsx(gn,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),r.jsx(AL,{source:h.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?r.jsx(Qg,{label:f("base.defaults_restore"),onClick:()=>g(h.slug),variant:"secondary",children:r.jsx(Ix,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(Qg,{label:f("base.defaults_edit"),onClick:()=>p(h),variant:"ghost",children:r.jsx(Eo,{size:13})}),r.jsx(Qg,{label:h.source==="user"?f("base.defaults_delete"):f("base.defaults_hide"),onClick:()=>m(h),variant:"ghost-destructive",children:r.jsx(ua,{size:13})})]})})]}),h.model?r.jsx(Ye,{tone:"info",children:h.model}):r.jsx("span",{className:"text-[10px] text-muted-fg",children:f("agents_ui.model_router_default")}),h.description&&r.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&r.jsx(Ye,{children:h.role}),h.skills?.map(_=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(fs,{size:9})," ",_]},_)),h.tools?.map(_=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Jl,{size:9})," ",_]},_))]})]},h.slug)})}),u!==null&&r.jsx(OL,{agent:u==="new"?null:u,onClose:()=>p(null),onSaved:()=>{p(null),l.mutate()}})]})}function AL({source:e}){return e==="user"?r.jsx(Ye,{tone:"success",children:f("agents_ui.source_user")}):e==="user-override"?r.jsx(Ye,{tone:"warning",children:f("agents_ui.source_override")}):r.jsx(Ye,{tone:"muted",children:f("agents_ui.source_bundled")})}function Qg({label:e,onClick:t,variant:s="ghost",children:o}){const l="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",c={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return r.jsxs(wb,{children:[r.jsx(kb,{render:r.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${l} ${c[s]}`,children:o})}),r.jsx(Sb,{children:e})]})}function OL({agent:e,onClose:t,onSaved:s}){const o=lt(),[l,c]=x.useState(!1),u=!e,[p,m]=x.useState(e?.slug??""),[g,h]=x.useState(e?.role??""),[b,_]=x.useState(e?.model??""),[k,C]=x.useState(e?.description??""),[y,w]=x.useState(e?.language??"es"),[S,N]=x.useState((e?.skills??[]).join(", ")),[E,R]=x.useState((e?.tools??[]).join(", ")),[M,T]=x.useState(!!e?.is_master),[A,z]=x.useState(e?.body??""),I=async()=>{const D={role:g||void 0,model:b||void 0,description:k||void 0,language:y||void 0,skills:S,tools:E,is_master:M};c(!0);try{if(u){if(!/^[a-z][a-z0-9_-]*$/.test(p))throw new Error(f("base.defaults_slug_invalid"));await an.vaultCreate(p,D,A),o.success(f("base.defaults_created",{slug:p}))}else await an.vaultPatch(e.slug,{fields:D,body:A}),o.success(f("base.defaults_saved",{slug:e.slug}));s()}catch(P){o.error(P.message)}finally{c(!1)}};return r.jsx(En,{open:!0,onClose:t,title:u?f("base.defaults_new_title"):f("base.defaults_edit_title",{slug:e.slug}),description:u?f("base.defaults_new_desc"):e.source==="bundled"?f("base.defaults_bundled_desc"):f("base.defaults_user_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:l,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:I,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[u&&r.jsx(ue,{label:"slug",hint:f("agents_ui.slug_kebab_hint"),children:r.jsx(Ae,{autoFocus:!0,value:p,onChange:D=>m(D.target.value),placeholder:"reviewer"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:"role",children:r.jsx(Ae,{value:g,onChange:D=>h(D.target.value),placeholder:"Code reviewer"})}),r.jsx(ue,{label:"model",children:r.jsx(Ae,{value:b,onChange:D=>_(D.target.value),placeholder:"openrouter:..."})}),r.jsx(ue,{label:"language",children:r.jsx(Ae,{value:y,onChange:D=>w(D.target.value),placeholder:"es"})}),r.jsx(ue,{label:"is_master",children:r.jsx("div",{className:"flex h-9 items-center",children:r.jsx(Wt,{checked:M,onChange:T,label:f("base.defaults_master_label")})})})]}),r.jsx(ue,{label:"description",children:r.jsx(Ae,{value:k,onChange:D=>C(D.target.value)})}),r.jsx(ue,{label:"skills",hint:f("agents_ui.comma_separated"),children:r.jsx(Ae,{value:S,onChange:D=>N(D.target.value),placeholder:"code-review, git"})}),r.jsx(ue,{label:"tools",hint:f("agents_ui.comma_separated"),children:r.jsx(Ae,{value:E,onChange:D=>R(D.target.value),placeholder:"read, write, run"})}),r.jsx(ue,{label:"body",hint:f("agents_ui.body_hint"),children:r.jsx(Pn,{value:A,onChange:D=>z(D.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const zL={apx:"success",claude:"info",codex:"warning"};function DL(){const[e,t]=x.useState(""),s=Ze(`/sessions?engine=${e}`,()=>yD.global(e||void 0)),o=s.data?.sessions||[];return r.jsxs(Ke,{title:f("base.sessions_title"),description:f("base.sessions_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-40",children:r.jsx(kt,{value:e,onChange:t,options:[{value:"",label:f("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>s.mutate(),children:r.jsx(cs,{size:13})})]}),children:[s.isLoading&&r.jsx(ot,{}),s.error&&r.jsx(ht,{children:f("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&o.length===0&&r.jsx(ht,{children:f("base.sessions_empty")}),r.jsx("ul",{className:"space-y-1 text-sm",children:o.map((l,c)=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx(Ye,{tone:zL[l.engine]||"muted",children:l.engine}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate",children:l.title||l.id}),r.jsx("div",{className:"truncate font-mono text-[10px] text-muted-fg",children:l.cwd})]}),l.mtime>0&&r.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(l.mtime).toLocaleString()})]},`${l.engine}-${l.id}-${c}`))})]})}function PL(){const e=Zn(),[t,s]=x.useState("open"),o=Ze(`/tasks?state=${t}`,()=>kr.global(t));return r.jsxs(Ke,{title:f("project.global_tasks.title"),description:f("project.global_tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>r.jsx(de,{size:"sm",variant:t===l?"primary":"ghost",onClick:()=>s(l),children:l},l))}),children:[o.isLoading&&r.jsx(ot,{}),!o.isLoading&&(o.data?.length??0)===0&&r.jsx(ht,{children:f("project.global_tasks.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(o.data||[]).map(l=>r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:f("project.global_tasks.go_project"),children:r.jsx(Ye,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-medium",children:l.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{children:l.state}),l.agent&&r.jsxs(Ye,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>r.jsxs("span",{children:["#",c]},c)),l.due&&r.jsxs("span",{children:[f("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})]})}const QC=x.createContext(void 0);function Kb(){const e=x.useContext(QC);if(e===void 0)throw new Error(nn(64));return e}let LL=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const Qb={tabActivationDirection:e=>({[LL.activationDirection]:e})},IL=x.forwardRef(function(t,s){const{className:o,defaultValue:l=0,onValueChange:c,orientation:u="horizontal",render:p,value:m,style:g,...h}=t,b=t.defaultValue!==void 0,_=x.useRef([]),[k,C]=x.useState(()=>new Map),[y,w]=Vl({controlled:m,default:l,name:"Tabs",state:"value"}),S=m!==void 0,[N,E]=x.useState(()=>new Map),R=x.useCallback(te=>{if(te===void 0)return null;for(const[le,fe]of N.entries())if(fe!=null&&te===(fe.value??fe.index))return le;return null},[N]),[M,T]=x.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:A,tabActivationDirection:z}=M;let I=z,D=!1;A!==y&&(I=Lj(A,y,u,N),D=A!=null&&y!=null&&R(y)==null);const P=D?A:y,L=A!==P||z!==I;Ie(()=>{L&&T({previousValue:P,tabActivationDirection:I})},[P,L,I]);const U=Ve((te,le)=>{const fe=Lj(y,te,u,N);le.activationDirection=fe,c?.(te,le),!le.isCanceled&&w(te)}),q=Ve((te,le)=>{c?.(te,at(le,void 0,void 0,{activationDirection:"none"}))}),$=Ve((te,le)=>{C(fe=>{if(fe.get(te)===le)return fe;const ze=new Map(fe);return ze.set(te,le),ze})}),V=Ve((te,le)=>{C(fe=>{if(!fe.has(te)||fe.get(te)!==le)return fe;const ze=new Map(fe);return ze.delete(te),ze})}),G=x.useCallback(te=>k.get(te),[k]),K=x.useCallback(te=>{for(const le of N.values())if(te===le?.value)return le?.id},[N]),F=x.useMemo(()=>({getTabElementBySelectedValue:R,getTabIdByPanelValue:K,getTabPanelIdByValue:G,onValueChange:U,orientation:u,registerMountedTabPanel:$,setTabMap:E,unregisterMountedTabPanel:V,tabActivationDirection:I,value:y}),[R,K,G,U,u,$,E,V,I,y]),X=x.useMemo(()=>{for(const te of N.values())if(te!=null&&te.value===y)return te},[N,y]),H=x.useMemo(()=>{for(const te of N.values())if(te!=null&&!te.disabled)return te.value},[N]),Q=x.useRef(!b),Y=x.useRef(b),J=x.useRef(!1);Ie(()=>{if(S)return;function te(be,pe){w(be),T(je=>je.previousValue===be&&je.tabActivationDirection==="none"?je:{previousValue:be,tabActivationDirection:"none"}),q(be,pe),Q.current=!1}if(N.size===0){if(!J.current||y===null)return;te(null,E1);return}J.current=!0;const le=X?.disabled,fe=X==null&&y!==null;if(!le&&y===l&&(Y.current=!1),Y.current&&le&&y===l)return;const ze=Q.current;if(le||fe){const be=H??null;if(y===be){Q.current=!1;return}let pe=E1;ze?pe=R1:le&&(pe=nS),te(be,pe);return}ze&&X!=null&&(q(y,R1),Q.current=!1)},[l,H,S,q,X,w,N,y]);const ne=Ct("div",t,{state:{orientation:u,tabActivationDirection:I},ref:s,props:h,stateAttributesMapping:Qb});return r.jsx(QC.Provider,{value:F,children:r.jsx(Qf,{elementsRef:_,children:ne})})});function Lj(e,t,s,o){if(e==null||t==null)return"none";let l=null,c=null;for(const[m,g]of o.entries()){if(g==null)continue;const h=g.value??g.index;if(e===h&&(l=m),t===h&&(c=m),l!=null&&c!=null)break}if(l==null||c==null)return l!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?s==="horizontal"?t>e?"right":"left":t>e?"down":"up":"none";const u=l.getBoundingClientRect(),p=c.getBoundingClientRect();if(s==="horizontal"){if(p.left<u.left)return"left";if(p.left>u.left)return"right"}else{if(p.top<u.top)return"up";if(p.top>u.top)return"down"}return"none"}const ZC="data-composite-item-active",WC=x.createContext(void 0);function BL(){const e=x.useContext(WC);if(e===void 0)throw new Error(nn(65));return e}const UL=x.forwardRef(function(t,s){const{className:o,disabled:l=!1,render:c,value:u,id:p,nativeButton:m=!0,style:g,...h}=t,{value:b,getTabPanelIdByValue:_,orientation:k}=Kb(),{activateOnFocus:C,highlightedTabIndex:y,onTabActivation:w,registerTabResizeObserverElement:S,setHighlightedTabIndex:N,tabsListElement:E}=BL(),R=Xa(p),M=x.useMemo(()=>({disabled:l,id:R,value:u}),[l,R,u]),{compositeProps:T,compositeRef:A,index:z}=V2({metadata:M}),I=u===b,D=x.useRef(!1),P=x.useRef(null);x.useEffect(()=>{const Q=P.current;if(Q)return S(Q)},[S]),Ie(()=>{if(D.current){D.current=!1;return}if(!(I&&z>-1&&y!==z))return;const Q=E;if(Q!=null){const Y=Hn(pt(Q));if(Y&&Qe(Q,Y))return}l||N(z)},[I,z,y,N,l,E]);const{getButtonProps:L,buttonRef:U}=Vr({disabled:l,native:m,focusableWhenDisabled:!0}),q=_(u),$=x.useRef(!1),V=x.useRef(!1);function G(Q){I||l||w(u,at(Gs,Q.nativeEvent,void 0,{activationDirection:"none"}))}function K(Q){I||(z>-1&&!l&&N(z),!l&&C&&(!$.current||$.current&&V.current)&&w(u,at(Gs,Q.nativeEvent,void 0,{activationDirection:"none"})))}function F(Q){if(I||l)return;$.current=!0;function Y(){$.current=!1,V.current=!1}(!Q.button||Q.button===0)&&(V.current=!0,pt(Q.currentTarget).addEventListener("pointerup",Y,{once:!0}))}return Ct("button",t,{state:{disabled:l,active:I,orientation:k},ref:[s,U,A,P],props:[T,{role:"tab","aria-controls":q,"aria-selected":I,id:R,onClick:G,onFocus:K,onPointerDown:F,[ZC]:I?"":void 0,onKeyDownCapture(){D.current=!0}},h,L]})});let HL=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=wo.startingStyle]="startingStyle",e[e.endingStyle=wo.endingStyle]="endingStyle",e})({});const VL={...Qb,...Ur},qL=x.forwardRef(function(t,s){const{className:o,value:l,render:c,keepMounted:u=!1,style:p,...m}=t,{value:g,getTabIdByPanelValue:h,orientation:b,tabActivationDirection:_,registerMountedTabPanel:k,unregisterMountedTabPanel:C}=Kb(),y=Xa(),w=x.useMemo(()=>({id:y,value:l}),[y,l]),{ref:S,index:N}=Fc({metadata:w}),E=l===g,{mounted:R,transitionStatus:M,setMounted:T}=ni(E),A=!R,z=h(l),I={hidden:A,orientation:b,tabActivationDirection:_,transitionStatus:M},D=x.useRef(null),P=Ct("div",t,{state:I,ref:[s,S,D],props:[{"aria-labelledby":z,hidden:A,id:y,role:"tabpanel",tabIndex:E?0:-1,inert:Ff(!E),[HL.index]:N},m],stateAttributesMapping:VL});return gs({open:E,ref:D,onComplete(){E||T(!1)}}),Ie(()=>{if(!(A&&!u)&&y!=null)return k(l,y),()=>{C(l,y)}},[A,u,l,y,k,C]),u||R?P:null}),$L=[];function FL(e){const{itemSizes:t,cols:s=1,loopFocus:o=!0,onLoop:l,dense:c=!1,orientation:u="both",direction:p,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:h,enableHomeAndEndKeys:b=!1,stopEventPropagation:_=!1,disabledIndices:k,modifierKeys:C=$L}=e,[y,w]=x.useState(0),S=s>1,N=x.useRef(null),E=ds(N,h),R=x.useRef([]),M=x.useRef(!1),T=m??y,A=Ve((P,L=!1)=>{if((g??w)(P),L){const U=R.current[P];cj(N.current,U,p,u)}}),z=Ve(P=>{if(P.size===0||M.current)return;M.current=!0;const L=Array.from(P.keys()),U=L.find($=>$?.hasAttribute(ZC))??null,q=U?L.indexOf(U):-1;q!==-1&&A(q),cj(N.current,U,p,u)}),I=Ve((P,L,U)=>l?l?.(P,L,U,R):U),D=x.useMemo(()=>({"aria-orientation":u==="both"?void 0:u,ref:E,onFocus(P){const L=N.current,U=zn(P.nativeEvent);!L||U==null||!ij(U)||U.setSelectionRange(0,U.value.length??0)},onKeyDown(P){const L=b?Kf:O2;if(!L.has(P.key)||GL(P,C)||!N.current)return;const q=p==="rtl",$=q?df:yc,V={horizontal:$,vertical:kl,both:$}[u],G=q?yc:df,K={horizontal:G,vertical:_c,both:G}[u],F=zn(P.nativeEvent);if(F!=null&&ij(F)&&!zz(F)){const ne=F.selectionStart,te=F.selectionEnd,le=F.value??"";if(ne==null||P.shiftKey||ne!==te||P.key!==K&&ne<le.length||P.key!==V&&ne>0)return}let X=T;const H=Id(R,k),Q=Yh(R,k);if(S){const ne=t||Array.from({length:R.current.length},()=>({width:1,height:1})),te=uS(ne,s,c),le=te.findIndex(ze=>ze!=null&&!qs(R.current,ze,k)),fe=te.reduce((ze,be,pe)=>be!=null&&!qs(R.current,be,k)?pe:ze,-1);X=te[cS(te.map(ze=>ze!=null?R.current[ze]:null),{event:P,orientation:u,loopFocus:o,onLoop:I,cols:s,disabledIndices:fS([...k||R.current.map((ze,be)=>qs(R.current,be)?be:void 0),void 0],te),minIndex:le,maxIndex:fe,prevIndex:dS(T>Q?H:T,ne,te,s,P.key===kl?"bl":P.key===yc?"tr":"tl"),rtl:q})]}const Y={horizontal:[$],vertical:[kl],both:[$,kl]}[u],J={horizontal:[G],vertical:[_c],both:[G,_c]}[u],oe=S?L:{horizontal:b?G4:M2,vertical:b?Y4:A2,both:L}[u];b&&(P.key===Yf?X=H:P.key===Xf&&(X=Q)),X===T&&(Y.includes(P.key)||J.includes(P.key))&&(o&&X===Q&&Y.includes(P.key)?(X=H,l&&(X=l(P,T,X,R))):o&&X===H&&J.includes(P.key)?(X=Q,l&&(X=l(P,T,X,R))):X=Un(R.current,{startingIndex:X,decrement:J.includes(P.key),disabledIndices:k})),X!==T&&!Rc(R.current,X)&&(_&&P.stopPropagation(),oe.has(P.key)&&P.preventDefault(),A(X,!0),queueMicrotask(()=>{R.current[X]?.focus()}))}}),[s,c,p,k,R,b,T,S,t,o,l,I,E,C,A,u,_]);return x.useMemo(()=>({props:D,highlightedIndex:T,onHighlightedIndexChange:A,elementsRef:R,disabledIndices:k,onMapChange:z,relayKeyboardEvent:D.onKeyDown}),[D,T,A,R,k,z])}function GL(e,t){for(const s of W4.values())if(!t.includes(s)&&e.getModifierState(s))return!0;return!1}function YL(e){const{render:t,className:s,style:o,refs:l=Or,props:c=Or,state:u=Gt,stateAttributesMapping:p,highlightedIndex:m,onHighlightedIndexChange:g,orientation:h,dense:b,itemSizes:_,loopFocus:k,onLoop:C,cols:y,enableHomeAndEndKeys:w,onMapChange:S,stopEventPropagation:N=!0,rootRef:E,disabledIndices:R,modifierKeys:M,highlightItemOnHover:T=!1,tag:A="div",...z}=e,I=qf(),{props:D,highlightedIndex:P,onHighlightedIndexChange:L,elementsRef:U,onMapChange:q,relayKeyboardEvent:$}=FL({itemSizes:_,cols:y,loopFocus:k,onLoop:C,dense:b,orientation:h,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:E,stopEventPropagation:N,enableHomeAndEndKeys:w,direction:I,disabledIndices:R,modifierKeys:M}),V=Ct(A,e,{state:u,ref:l,props:[D,...c,z],stateAttributesMapping:p}),G=x.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:L,highlightItemOnHover:T,relayKeyboardEvent:$}),[P,L,T,$]);return r.jsx(k2.Provider,{value:G,children:r.jsx(Qf,{elementsRef:U,onMapChange:K=>{S?.(K),q(K)},children:V})})}const XL=x.forwardRef(function(t,s){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:u,style:p,...m}=t,{onValueChange:g,orientation:h,value:b,setTabMap:_,tabActivationDirection:k}=Kb(),[C,y]=x.useState(0),[w,S]=x.useState(null),N=x.useRef(new Set),E=x.useRef(new Set),R=x.useRef(null);x.useEffect(()=>{if(typeof ResizeObserver>"u")return;const P=new ResizeObserver(()=>{N.current.forEach(L=>{L()})});return R.current=P,w&&P.observe(w),E.current.forEach(L=>{P.observe(L)}),()=>{P.disconnect(),R.current=null}},[w]);const M=Ve(P=>(N.current.add(P),()=>{N.current.delete(P)})),T=Ve(P=>(E.current.add(P),R.current?.observe(P),()=>{E.current.delete(P),R.current?.unobserve(P)})),A=Ve((P,L)=>{P!==b&&g(P,L)}),z={orientation:h,tabActivationDirection:k},I={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},D=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:C,registerIndicatorUpdateListener:M,registerTabResizeObserverElement:T,onTabActivation:A,setHighlightedTabIndex:y,tabsListElement:w}),[o,C,M,T,A,y,w]);return r.jsx(WC.Provider,{value:D,children:r.jsx(YL,{render:u,className:l,style:p,state:z,refs:[s,S],props:[I,m],stateAttributesMapping:Qb,highlightedIndex:C,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:y,onMapChange:_,disabledIndices:Or})})});function tp({className:e,...t}){return r.jsx(IL,{"data-slot":"tabs",className:St("flex flex-col gap-4",e),...t})}const KL=Ub("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground data-[variant=line]:h-8 data-[variant=line]:gap-1 data-[variant=line]:rounded-none data-[variant=line]:bg-transparent data-[variant=line]:p-0",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function np({className:e,variant:t="default",...s}){return r.jsx(XL,{"data-slot":"tabs-list","data-variant":t,className:St(KL({variant:t}),e),...s})}function as({className:e,...t}){return r.jsx(UL,{"data-slot":"tabs-trigger",className:St("inline-flex h-7 items-center justify-center gap-1.5 rounded-md border border-transparent px-3 py-1 text-sm font-medium whitespace-nowrap text-muted-fg transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-active:bg-background data-active:text-foreground data-active:shadow-sm dark:data-active:border-input dark:data-active:bg-input/30 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Pa({className:e,...t}){return r.jsx(qL,{"data-slot":"tabs-content",className:St("text-sm outline-none",e),...t})}function Ij(e,t){let s=e;for(const o of t.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[o]}return s}function Zb(e,t=""){const s={};for(const[o,l]of Object.entries(e)){const c=t?`${t}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(s,Zb(l,c)):s[c]=l}return s}function QL(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function fx({sections:e,source:t,placeholderSource:s,jsonTitle:o,jsonDescription:l,saveLabel:c=f("common.save"),onSaveFields:u,onSaveJson:p,busy:m}){const g=e[0]?.key||"json",[h,b]=x.useState({}),[_,k]=x.useState(""),[C,y]=x.useState("");x.useEffect(()=>{const E={};for(const R of e.flatMap(M=>M.fields))E[R.path]=Ij(t,R.path)??"";b(E),k(JSON.stringify(t||{},null,2)),y("")},[t,e]);const w=x.useMemo(()=>new Set(e.flatMap(E=>E.fields.map(R=>R.path))),[e]),S=async()=>{const E={},R=[];for(const M of e.flatMap(T=>T.fields)){const T=h[M.path];if(!qa(T)){if(T===""||T===void 0||T===null){R.push(M.path);continue}if(M.kind==="number"){const A=Number(T);Number.isFinite(A)&&(E[M.path]=A)}else E[M.path]=T}}await u(E,R.filter(M=>w.has(M)))},N=async()=>{y("");try{await p(QL(_))}catch(E){y(E.message)}};return r.jsxs(tp,{defaultValue:g,className:"space-y-4",children:[r.jsxs(np,{className:"flex flex-wrap",children:[e.map(E=>r.jsx(as,{value:E.key,children:E.label},E.key)),r.jsx(as,{value:"json",children:"JSON"})]}),e.map(E=>r.jsx(Pa,{value:E.key,children:r.jsxs("div",{className:"space-y-4",children:[E.description&&r.jsx("p",{className:"text-sm text-muted-fg",children:E.description}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:E.fields.map(R=>r.jsx(ZL,{field:R,value:h[R.path],inherited:Ij(s,R.path),onChange:M=>b(T=>({...T,[R.path]:M}))},R.path))}),r.jsx(de,{variant:"primary",loading:m,onClick:S,children:c})]})},E.key)),r.jsx(Pa,{value:"json",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:o}),l&&r.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),r.jsx(Pn,{rows:18,className:"font-mono text-xs",value:_,onChange:E=>k(E.target.value)}),C&&r.jsx("p",{className:"text-xs text-destructive",children:C}),r.jsx(de,{variant:"primary",loading:m,onClick:N,children:f("settings_ui.save_json")})]})})]})}function ZL({field:e,value:t,inherited:s,onChange:o}){const l=e.placeholder||Bj(s)||(qa(t)?Tr(t):""),c=e.hint||(s!==void 0?`Heredado: ${Bj(s)}`:void 0);return e.kind==="boolean"?r.jsx("div",{className:"flex items-end pb-1",children:r.jsx(Wt,{checked:t===!0,onChange:o,label:e.label})}):r.jsx(ue,{label:e.label,hint:c,children:e.kind==="select"?r.jsx(kt,{value:String(t||""),onChange:o,placeholder:l||"(sin override)",options:[{value:"",label:l||"(sin override)"},...(e.options||[]).map(u=>({value:String(u.value),label:u.label}))]}):e.kind==="textarea"?r.jsx(Pn,{rows:4,value:String(t||""),placeholder:l,onChange:u=>o(u.target.value)}):r.jsx(Ae,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(qa(t)?"":t||""),placeholder:e.kind==="password"&&qa(t)?Tr(t):e.kind==="password"&&qa(s)?Tr(s):l,onChange:u=>o(u.target.value)})})}function Bj(e){return e==null||e===""?"":qa(e)?Tr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function WL(){return[{key:"routing",label:f("settings_ui.cfg_overrides_label"),description:f("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:f("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:f("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:f("settings_ui.cfg_permission_mode"),kind:"select",options:Ux.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:f("settings_ui.cfg_extra_prompt"),kind:"textarea"}]},{key:"telegram",label:f("settings_ui.cfg_telegram_label"),fields:[{path:"telegram.route_to_agent",label:f("settings_ui.cfg_route_to_agent")},{path:"telegram.chat_id",label:f("settings_ui.cfg_chat_id")},{path:"telegram.bot_token",label:f("settings_ui.cfg_bot_token"),kind:"password"},{path:"telegram.respond_with_engine",label:f("settings_ui.cfg_respond_with_engine"),kind:"boolean"}]},{key:"engines",label:f("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:f("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:f("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:f("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:f("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:f("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:f("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function JL(){return[{key:"identity",label:f("settings_ui.cfg_project_label"),description:f("settings_ui.cfg_project_desc"),fields:[{path:"name",label:f("settings_ui.cfg_name")},{path:"version",label:f("settings_ui.cfg_version")},{path:"apf",label:f("settings_ui.cfg_apc_spec")},{path:"apx",label:f("settings_ui.cfg_apx_install")},{path:"apx_id",label:f("settings_ui.cfg_apx_storage_id")}]}]}function e6({pid:e}){const t=lt(),s=Zn(),{project:o,mutate:l}=Lb(e),c=Ze(`/projects/${e}/config`,()=>la.config.show(e)),u=String(e)==="0";if(c.isLoading)return r.jsx(ot,{});if(!c.data)return r.jsx(ht,{children:f("project.config.no_data")});const p=async g=>{await la.apcProject.put(e,g),t.success(f("project.config.save_project")),c.mutate()},m=async g=>{await la.config.put(e,g),t.success(f("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("project.config.section_title"),description:f("project.config.section_desc"),children:r.jsxs(tp,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(np,{children:[r.jsx(as,{value:"override",children:"Override"}),r.jsx(as,{value:"project",children:"APC project"}),r.jsx(as,{value:"effective",children:"Effective"})]}),r.jsx(Pa,{value:"override",children:r.jsx(fx,{sections:WL(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(g,h)=>{await la.config.set(e,g),h.length&&await la.config.unset(e,h),t.success(f("project.config.save_fields_success")),c.mutate()},onSaveJson:m})}),r.jsx(Pa,{value:"project",children:r.jsx(fx,{sections:JL(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(g,h)=>{await la.apcProject.set(e,n6(g),h),t.success(f("project.config.save_meta_success")),c.mutate()},onSaveJson:p})}),r.jsx(Pa,{value:"effective",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.config.effective_read")}),r.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(c.data.effective,null,2)})]})})]})}),!u&&o?r.jsx(t6,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),s("/")}}):null]})}function t6({pid:e,label:t,onRebuilt:s,onUnregistered:o}){const l=lt(),[c,u]=x.useState(null),[p,m]=x.useState(null),g=async()=>{u("rebuild");try{await la.rebuild(e),l.success(f("project.rebuild_done")),s()}catch(b){l.error(b.message)}finally{u(null),m(null)}},h=async()=>{u("unregister");try{await la.remove(e),l.success(f("project.unregistered")),o()}catch(b){l.error(b.message)}finally{u(null),m(null)}};return r.jsxs(r.Fragment,{children:[r.jsx(Ke,{title:f("project.danger.title"),description:f("project.danger.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("project.rebuild")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.rebuild_desc")})]}),r.jsxs(de,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[r.jsx(cs,{size:13})," ",f("project.rebuild")]})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-red-500/40 bg-red-500/5 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("admin.unregister")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.unregister_desc")})]}),r.jsxs(de,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[r.jsx(ua,{size:13})," ",f("admin.unregister")]})]})]})}),r.jsx(En,{open:p==="rebuild",onClose:()=>c?null:m(null),title:f("project.danger.rebuild_confirm_title"),description:f("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:g,loading:c==="rebuild",children:f("project.rebuild")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.rebuild_long")})}),r.jsx(En,{open:p==="unregister",onClose:()=>c?null:m(null),title:f("project.danger.unregister_confirm_title"),description:f("project.unregister_confirm",{label:t}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(de,{variant:"destructive",onClick:h,loading:c==="unregister",children:f("admin.unregister")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.unregister_long")})})]})}function n6(e){const t={};for(const[s,o]of Object.entries(Zb(e)))qa(o)||(t[s]=o);return t}const a6=["","es","en","pt","fr","it","de"],Uj=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function JC(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Fs}:{gradient:"from-slate-600 to-gray-600",Icon:gn}}function s6(e){const t=e.filter(u=>u.is_master),s=t.length===1?t[0]:null,o=u=>u.parent?u.parent:s&&!u.is_master&&u.slug!==s.slug?s.slug:null,l=new Map,c=[];for(const u of e){const p=o(u);p&&e.some(m=>m.slug===p)?(l.has(p)||l.set(p,[]),l.get(p).push(u)):c.push(u)}return{roots:c,childrenByParent:l}}function r6({pid:e}){const t=Zn();lt();const s=Ze(`/projects/${e}/agents`,()=>an.list(e)),[o,l]=x.useState("hierarchy"),[c,u]=x.useState(!1),[p,m]=x.useState(!1),g=s.data||[],h=C=>t(`/p/${e}/agents/${C}`),b=C=>t(C?`/p/${e}/chat?agent=${C}`:`/p/${e}/chat`),{roots:_,childrenByParent:k}=x.useMemo(()=>s6(g),[g]);return r.jsxs(Ke,{title:f("project.agents.title"),description:f("project.agents.subtitle_full"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[r.jsxs("button",{onClick:()=>l("hierarchy"),className:Oe("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(Dx,{size:13})," ",f("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:Oe("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(kA,{size:13})," ",f("project.agents.list_view")]})]}),r.jsxs(de,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[r.jsx(PA,{size:13})," ",f("project.agents.import")]}),r.jsxs(de,{size:"sm",variant:"secondary",onClick:()=>b(),children:[r.jsx(Ya,{size:13})," ",f("project.agents.chat")]}),r.jsxs(de,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>u(!0),children:[r.jsx(sn,{size:14})," ",f("project.agents.new")]})]}),children:[s.isLoading&&r.jsx(ot,{}),!s.isLoading&&g.length===0&&r.jsx(ht,{children:f("project.agents.empty_text")}),!s.isLoading&&g.length>0&&(o==="hierarchy"?r.jsx(l6,{roots:_,childrenByParent:k,onOpen:h,onChat:b}):r.jsx(i6,{agents:g,onOpen:h,onChat:b})),r.jsx(c6,{open:c,pid:e,agents:g,onClose:()=>u(!1),onCreated:()=>{u(!1),s.mutate()}}),r.jsx(o6,{open:p,pid:e,existing:g.map(C=>C.slug),onClose:()=>m(!1),onImported:()=>s.mutate()})]})}function o6({open:e,onClose:t,onImported:s,pid:o,existing:l}){const c=lt(),u=Ze(e?"/agents/vault":null,()=>an.vault()),[p,m]=x.useState(""),g=u.data||[],h=async b=>{m(b);try{await an.import(o,b),c.success(f("project.agents.import_success",{slug:b})),s()}catch(_){c.error(_.message)}finally{m("")}};return r.jsxs(En,{open:e,onClose:t,title:f("project.agents.import_title"),description:f("project.agents.import_desc"),size:"lg",footer:r.jsx(de,{variant:"ghost",onClick:t,children:f("common.close")}),children:[u.isLoading&&r.jsx(ot,{}),!u.isLoading&&g.length===0&&r.jsx(ht,{children:f("project.agents.import_empty")}),r.jsx("ul",{className:"space-y-2",children:g.map(b=>{const _=l.includes(b.slug);return r.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[r.jsx(gn,{size:16,className:"shrink-0 text-muted-fg"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&r.jsxs(Ye,{tone:"success",children:[r.jsx(Fs,{size:9})," ",f("project.agents.orchestrator")]}),b.model&&r.jsx(Ye,{tone:"info",children:b.model})]}),b.description&&r.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),r.jsx(de,{size:"sm",variant:"primary",disabled:_||p===b.slug,loading:p===b.slug,onClick:()=>h(b.slug),children:f(_?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function l6({roots:e,childrenByParent:t,onOpen:s,onChat:o}){return r.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=t.get(l.slug)||[];return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Zg,{agent:l,onOpen:s,onChat:o,wide:!0}),c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-5 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(u=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Zg,{agent:u,onOpen:s,onChat:o}),(t.get(u.slug)||[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(t.get(u.slug)||[]).map(p=>r.jsx(Zg,{agent:p,onOpen:s,onChat:o,compact:!0},p.slug))})]})]},u.slug))})]})]},l.slug)})})}function Zg({agent:e,onOpen:t,onChat:s,wide:o,compact:l}){const{gradient:c,Icon:u}=JC(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Oe("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",o?"w-64":l?"w-44":"w-52"),onClick:()=>t(e.slug),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:Oe("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:r.jsx(u,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&r.jsxs(Ye,{tone:"success",children:[r.jsx(Fs,{size:9})," ",f("project.agents.orchestrator")]}),e.role&&r.jsx(Ye,{children:e.role}),e.model&&!l&&r.jsx(Ye,{tone:"info",children:e.model})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(kf,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Ya,{size:12})," ",f("project.agents.chat")]})]})]})}function i6({agents:e,onOpen:t,onChat:s}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return r.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:u}=JC(l);return r.jsxs("div",{"data-testid":`agent-card-${l.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>t(l.slug),children:[r.jsx("div",{className:Oe("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:r.jsx(u,{className:"size-4 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&r.jsxs(Ye,{tone:"success",children:[r.jsx(Fs,{size:10})," ",f("project.agents.orchestrator")]}),l.role&&r.jsx(Ye,{children:l.role}),l.model&&r.jsx(Ye,{tone:"info",children:l.model}),l.parent&&r.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&r.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),r.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(p=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(fs,{size:9})," ",p]},p)),l.tools?.map(p=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Jl,{size:9})," ",p]},p))]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>t(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(kf,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Ya,{size:12})," ",f("project.agents.chat")]})]})]},l.slug)})})}function c6({open:e,onClose:t,onCreated:s,pid:o,agents:l}){const c=lt(),[u,p]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,k]=x.useState(""),[C,y]=x.useState(""),[w,S]=x.useState(""),[N,E]=x.useState(""),[R,M]=x.useState(!1),[T,A]=x.useState(""),[z,I]=x.useState(!1),D=()=>{p(""),g(""),b(""),k(""),y(""),S(""),E(""),M(!1),A("")},P=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(u)){c.error(f("project.agents.slug_invalid"));return}I(!0);try{await an.create(o,{slug:u,role:m||void 0,model:h||void 0,language:_||void 0,description:C||void 0,skills:Uj(w),tools:Uj(N),is_master:R,parent:T||void 0}),c.success(f("project.agents.create_success",{slug:u})),s(),D()}catch(L){c.error(L?.message||f("project.agents.create_error"))}finally{I(!1)}};return r.jsx(En,{open:e,onClose:t,title:f("project.agents.new_title"),description:f("project.agents.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:z,children:f("common.cancel")}),r.jsx(de,{variant:"primary","data-testid":"agent-create-submit",onClick:P,loading:z,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.agents.slug_label"),children:r.jsx(Ae,{autoFocus:!0,"data-testid":"agent-slug",value:u,onChange:L=>p(L.target.value),placeholder:f("project.agents.slug_ph")})}),r.jsx(ue,{label:f("project.agents.role_label"),children:r.jsx(Ae,{value:m,onChange:L=>g(L.target.value),placeholder:f("project.agents.role_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.agents.model_label"),hint:f("project.agents.model_hint"),children:r.jsx(Ae,{value:h,onChange:L=>b(L.target.value)})}),r.jsx(ue,{label:f("project.agents.lang_label"),children:r.jsx(kt,{value:_,onChange:k,options:a6.map(L=>({value:L,label:L||"—"}))})})]}),r.jsx(ue,{label:f("project.agents.desc_label"),children:r.jsx(Pn,{rows:2,value:C,onChange:L=>y(L.target.value),placeholder:f("project.agents.desc_ph")})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.agents.skills_label"),children:r.jsx(Ae,{value:w,onChange:L=>S(L.target.value),placeholder:f("project.agents.skills_ph")})}),r.jsx(ue,{label:f("project.agents.tools_label"),children:r.jsx(Ae,{value:N,onChange:L=>E(L.target.value),placeholder:f("project.agents.tools_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[r.jsx(ue,{label:f("project.agents.parent_label"),hint:f("project.agents.parent_hint"),children:r.jsx(kt,{value:T,onChange:A,placeholder:f("project.agents.none_parent"),options:[{value:"",label:f("project.agents.none_parent")},...l.filter(L=>L.slug!==u).map(L=>({value:L.slug,label:L.slug}))]})}),r.jsx(Wt,{checked:R,onChange:M,label:f("project.agents.master_label")})]})]})})}function Ed(e){return e.split(`
618
+ `).map(t=>t.trim()).filter(Boolean)}function Ac(){return{exec_agent:{label:f("agents_ui.kind_exec_agent"),desc:f("agents_ui.kind_exec_agent_desc"),icon:gn},super_agent:{label:f("agents_ui.kind_super_agent"),desc:f("agents_ui.kind_super_agent_desc"),icon:Fs},telegram:{label:f("agents_ui.kind_telegram"),desc:f("agents_ui.kind_telegram_desc"),icon:Ya},shell:{label:f("agents_ui.kind_shell"),desc:f("agents_ui.kind_shell_desc"),icon:Ar},heartbeat:{label:f("agents_ui.kind_heartbeat"),desc:f("agents_ui.kind_heartbeat_desc"),icon:Dl}}}function u6(e){const t=Ac();return Object.keys(t).filter(s=>s!=="heartbeat"||e==="heartbeat").map(s=>({value:s,label:t[s].label,description:t[s].desc,icon:t[s].icon}))}function Wb(e){if(!e)return"—";if(e.startsWith("every:")){const t=e.slice(6),s=t.match(/^(\d+)(s|m|h|d)$/);if(s){const o=s[1],l={s:f("agents_ui.unit_seconds"),m:f("agents_ui.unit_minutes"),h:f("agents_ui.unit_hours"),d:f("agents_ui.unit_days")}[s[2]]||s[2];return f("agents_ui.every_n_unit",{n:o,unit:l})}return f("agents_ui.every_v",{v:t})}return e.startsWith("once:")?`once · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}function d6(){return[{label:f("agents_ui.preset_every_10m"),value:"every:10m"},{label:f("agents_ui.preset_hourly"),value:"every:1h"},{label:f("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:f("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function eN(){return[{v:"{{pre_output}}",where:"prompt",desc:f("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:f("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:f("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:f("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:f("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:f("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:f("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:f("agents_ui.var_routine")}]}function ac(e){return eN().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function f6({routines:e,selectedName:t,onSelect:s}){return r.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[r.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.list_title")}),r.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(o=>{const l=Ac()[o.kind],c=l?.icon||Pl,u=o.name===t;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(o.name),"aria-current":u,className:Oe("w-full rounded-lg border px-2.5 py-2 text-left transition-colors",u?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Oe("flex size-6 shrink-0 items-center justify-center rounded-md",o.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(c,{size:13})}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o.name}),!o.enabled&&r.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:f("project.routines.paused")}),r.jsx(Kc,{ok:o.last_status==="ok"?!0:o.last_status==="error"?!1:null})]}),r.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:l?.label||o.kind}),r.jsxs("span",{className:"shrink-0",children:["⏱ ",Wb(o.schedule)]})]})]})},o.name)})})]})}function p6({title:e,body:t,mono:s}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:Oe("max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs",s&&"font-mono"),children:t.trim()?t:r.jsx("span",{className:"text-muted-fg",children:f("project.routines.block_empty")})})]})}function tN(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function nN(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function aN({st:e}){return e==="ok"?r.jsx(bo,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?r.jsx(ps,{size:13,className:"shrink-0 text-destructive"}):r.jsx(FM,{size:13,className:"shrink-0 text-amber-500"})}function sN(e){return f(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function Wg({title:e,children:t}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const Jg="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function m6({m:e,onClose:t}){const s=tN(e),o=e.meta||{},l=o.result||{},c=o.flow||null,u=String(l.reply??l.text??l.stdout??""),p=String(l.error??l.stderr??""),m=String(l.note??""),g=r.jsx("span",{className:"text-muted-fg",children:f("project.routines.block_empty")});return r.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsx(aN,{st:s}),r.jsx("span",{className:Oe("font-medium",s==="ok"&&"text-emerald-500",s==="error"&&"text-destructive",s==="skipped"&&"text-amber-500"),children:sN(s)}),r.jsx("span",{className:"font-mono text-muted-fg",children:nN(e.ts)})]}),r.jsx("button",{type:"button",onClick:t,"aria-label":f("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:r.jsx(ps,{size:14})})]}),r.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&r.jsx("div",{className:"text-muted-fg",children:e.body}),c?.pre&&r.jsx(Wg,{title:f("project.routines.block_pre"),children:c.pre.output?.trim()?r.jsx("pre",{className:Jg,children:c.pre.output}):g}),r.jsx(Wg,{title:f("project.routines.runs_output"),children:u?r.jsx("pre",{className:Jg,children:u}):p?r.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg bg-destructive/10 px-3 py-2 font-mono text-[11px] text-destructive",children:p}):m?r.jsx("div",{className:"text-muted-fg",children:m}):g}),c?.post&&c.post.length>0&&r.jsx(Wg,{title:f("project.routines.block_post"),children:r.jsx("div",{className:"space-y-1.5",children:c.post.map((h,b)=>r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",h.cmd," ",r.jsxs("span",{className:"opacity-70",children:["· exit ",h.exit]})]}),(h.stdout||h.stderr)&&r.jsx("pre",{className:Jg,children:h.stdout||h.stderr})]},b))})})]})]})}function g6({pid:e,name:t,running:s}){const o=Ze(`/projects/${e}/routines/${t}/runs`,async()=>(await ff.project(e,{channel:"routine",limit:200})).filter(g=>g.meta?.routine===t&&(g.actor_id==="apx:routine"||g.type==="system"))),l=(o.data||[]).slice(0,50),[c,u]=x.useState(null),p=c&&l.find(m=>m.ts===c)||null;return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[r.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.runs_title")}),r.jsxs("div",{className:Oe("grid min-h-0 flex-1 overflow-hidden",p?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[r.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[o.isLoading&&r.jsx(ot,{}),!o.isLoading&&l.length===0&&r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.routines.runs_empty")}),r.jsxs("ul",{className:"space-y-1",children:[s&&r.jsx("li",{children:r.jsxs("div",{className:"flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs",children:[r.jsx(ja,{size:12}),r.jsx("span",{className:"text-muted-fg",children:f("project.routines.running")})]})}),l.map((m,g)=>{const h=tN(m),b=c===m.ts;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>u(b?null:m.ts),"aria-current":b,className:Oe("flex w-full items-center gap-2 rounded-md border px-3 py-1.5 text-left text-xs transition-colors",b?"border-primary/50 bg-primary/10":"border-border bg-muted/30 hover:border-muted-fg/40"),children:[r.jsx(aN,{st:h}),r.jsx("span",{className:"font-mono text-muted-fg",children:nN(m.ts)}),r.jsx("span",{className:Oe("font-medium",h==="ok"&&"text-emerald-500",h==="error"&&"text-destructive",h==="skipped"&&"text-amber-500"),children:sN(h)})]})},`${m.ts}-${g}`)})]})]}),p&&r.jsx(m6,{m:p,onClose:()=>u(null)})]})]})}function h6({pid:e,routine:t,onEdit:s,onRun:o,onToggle:l,onDelete:c,running:u}){const p=Ac()[t.kind],m=p?.icon||Pl,g=t.spec||{},h=t.pre_commands||[],b=t.post_commands||[],_=[];return h.length&&_.push({title:f("project.routines.block_pre"),body:h.join(`
619
+ `),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"?_.push({title:f("project.routines.block_prompt"),body:String(g.prompt||"")}):t.kind==="telegram"?_.push({title:f("project.routines.block_text"),body:String(g.text||"")}):t.kind==="shell"?_.push({title:f("project.routines.block_command"),body:String(g.command||""),mono:!0}):t.kind==="heartbeat"&&_.push({title:f("project.routines.block_text"),body:String(g.message||"")}),b.length&&_.push({title:f("project.routines.block_post"),body:b.join(`
620
+ `),mono:!0}),r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:Oe("flex size-7 shrink-0 items-center justify-center rounded-lg",t.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(m,{size:14})}),r.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),r.jsx(Ye,{tone:t.kind==="shell"?"warning":"info",children:p?.label||t.kind})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(Wt,{checked:t.enabled,onChange:l}),r.jsx(Je,{content:f("common.run"),children:r.jsx(de,{size:"sm",variant:"secondary",onClick:o,loading:u,children:r.jsx(Lx,{size:13})})}),r.jsx(Je,{content:f("project.routines.edit_hint"),children:r.jsxs(de,{size:"sm",variant:"secondary",onClick:s,children:[r.jsx(Eo,{size:13})," ",f("project.routines.edit_btn")]})}),r.jsx(Je,{content:f("common.delete"),children:r.jsx(de,{size:"sm",variant:"destructive",onClick:c,children:r.jsx(ua,{size:13})})})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[r.jsxs("span",{children:["⏱ ",Wb(t.schedule)]}),t.next_run_at&&r.jsxs("span",{children:[f("project.routines.next_run")," ",new Date(t.next_run_at).toLocaleString()]}),t.last_run_at&&r.jsxs("span",{children:[f("project.routines.last_run")," ",new Date(t.last_run_at).toLocaleString()]}),r.jsxs("span",{className:Oe(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[f("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&r.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),r.jsx("div",{className:"space-y-3",children:_.map(k=>r.jsx(p6,{title:k.title,body:k.body,mono:k.mono},k.title))})]}),r.jsx(g6,{pid:e,name:t.name,running:u})]})}function vl({label:e,hint:t,value:s,onChange:o,vars:l,rows:c=3,mono:u,placeholder:p}){const m=x.useRef(null),g=h=>{const b=m.current?.querySelector("textarea");if(!b){o(s?`${s}${h}`:h);return}const _=b.selectionStart??s.length,k=b.selectionEnd??s.length,C=s.slice(0,_)+h+s.slice(k);o(C),requestAnimationFrame(()=>{b.focus();const y=_+h.length;b.setSelectionRange(y,y)})};return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&r.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),r.jsxs("div",{ref:m,className:"space-y-1.5",children:[r.jsx(Pn,{rows:c,className:Oe(u&&"font-mono text-xs"),value:s,onChange:h=>o(h.target.value),placeholder:p}),l.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(h=>r.jsx("button",{type:"button",onClick:()=>g(h.v),className:"inline-flex items-center rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px] text-muted-fg transition-colors hover:border-muted-fg/50 hover:text-foreground",children:h.v},h.v))})]})]})}function x6(){return r.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[r.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.vars_title")}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:eN().map(e=>r.jsx(Je,{content:r.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:r.jsxs("span",{className:"inline-flex cursor-help items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[e.v,r.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function b6({draft:e,onClose:t,onSaved:s,pid:o}){const l=lt(),c=Ze(e?`/projects/${o}/agents`:null,()=>an.list(o)),[u,p]=x.useState(!1),[m,g]=x.useState(""),[h,b]=x.useState("super_agent"),[_,k]=x.useState("every:10m"),[C,y]=x.useState(!0),[w,S]=x.useState(""),[N,E]=x.useState(""),[R,M]=x.useState("default"),[T,A]=x.useState(""),[z,I]=x.useState(""),[D,P]=x.useState(""),[L,U]=x.useState("heartbeat"),[q,$]=x.useState(""),[V,G]=x.useState(""),[K,F]=x.useState(""),X=Ze(e&&h==="telegram"?"/telegram/channels":null,()=>Nn.channels.list());x.useEffect(()=>{if(!e)return;const be=e.spec&&typeof e.spec=="object"?e.spec:{};g(e.name||""),b(e.kind||"super_agent"),k(e.schedule||"every:10m"),y(e.enabled??!0),S(be.agent||""),E(be.prompt||""),M(be.channel||"default"),A(be.chat_id?String(be.chat_id):""),I(be.text||""),P(be.command||""),U(be.channel||"heartbeat"),$(be.message||""),G((e.pre_commands||[]).join(`
621
+ `)),F((e.post_commands||[]).join(`
622
+ `))},[e]);const H=h==="exec_agent"||h==="super_agent"||h==="telegram",Q=()=>{switch(h){case"exec_agent":return{agent:w,prompt:N};case"super_agent":return{prompt:N};case"telegram":return{channel:R,...T?{chat_id:T}:{},text:z};case"shell":return{command:D};case"heartbeat":return{channel:L,message:q}}},Y=async()=>{if(!m){l.error(f("project.routines.name_required"));return}p(!0);try{await wr.upsert(o,{name:m,kind:h,schedule:_,enabled:C,spec:Q(),pre_commands:H?Ed(V):[],post_commands:H?Ed(K):[]}),l.success(f("project.routines.saved")),s()}catch(be){l.error(be?.message||f("project.routines.save_error"))}finally{p(!1)}},J=(()=>{const be=X.data?.channels||[],pe=["default",...be.map(Ne=>Ne.name)];R&&!pe.includes(R)&&pe.push(R);const je=new Set;return pe.filter(Ne=>je.has(Ne)?!1:(je.add(Ne),!0)).map(Ne=>{const Be=be.find(ye=>ye.name===Ne),Ue=Be?.project?`proyecto ${Be.project}`:Be?.chat_id?`chat ${Be.chat_id}`:void 0;return{value:Ne,label:Ne,description:Ue}})})(),oe=H?Ed(V):[],ne=H?Ed(K):[],te=(()=>{switch(h){case"exec_agent":return w?f("agents_ui.action_agent_answers",{agent:w}):f("agents_ui.action_agent_pick_answers");case"super_agent":return f("agents_ui.action_super_answers");case"telegram":return f("agents_ui.action_telegram_channel",{channel:R});case"shell":return D?f("agents_ui.summary_runs_cmd",{cmd:D.slice(0,48)}):f("agents_ui.action_runs_shell");case"heartbeat":return f("agents_ui.summary_heartbeat")}})(),le=h==="telegram"?z:h==="shell"?D:h==="heartbeat"?q:N,fe=Ac()[h].icon,ze=[...oe.map((be,pe)=>({id:`pre-${pe}`,icon:Ar,label:f("agents_ui.step_pre"),detail:be,action:!1})),{id:"action",icon:fe,label:te,detail:le?le.slice(0,90):f("project.routines.block_empty"),action:!0},...ne.map((be,pe)=>({id:`post-${pe}`,icon:Ar,label:f("agents_ui.step_post"),detail:be,action:!1}))];return r.jsx(En,{open:!!e,onClose:t,title:e?.name?f("project.routines.edit_title",{name:e.name}):f("project.routines.new_title"),description:f("project.routines.dialog_desc"),size:"xl",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:u,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:Y,loading:u,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[r.jsx(Wt,{checked:C,onChange:y,label:f("project.routines.enabled_label")}),r.jsx("span",{className:"text-[11px] text-muted-fg",children:f(C?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),r.jsx(ue,{label:f("project.routines.name_field"),hint:e?.name?f("project.routines.name_no_edit"):void 0,children:r.jsx(Ae,{value:m,disabled:!!e?.name,onChange:be=>g(be.target.value),placeholder:"resumen-diario"})}),r.jsx(ue,{label:f("project.routines.kind_field"),children:r.jsx(kt,{value:h,onChange:be=>b(be),options:u6(h)})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Ac()[h].desc}),h==="exec_agent"&&r.jsx(ue,{label:f("project.routines.agent_field"),hint:f("project.routines.agent_hint"),children:r.jsx(kt,{value:w,onChange:S,placeholder:c.isLoading?f("project.routines.agent_loading"):f("project.routines.agent_pick"),options:(c.data||[]).map(be=>({value:be.slug,label:be.slug,description:[be.role,be.model].filter(Boolean).join(" · ")||void 0}))})}),r.jsx(ue,{label:f("project.routines.schedule_field"),hint:f("project.routines.schedule_hint"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[d6().map(be=>r.jsx("button",{type:"button",onClick:()=>k(be.value),className:Oe("rounded-md border px-2 py-0.5 text-[11px]",_===be.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:be.label},be.value)),r.jsx("button",{type:"button",onClick:()=>k("manual"),className:Oe("rounded-md border px-2 py-0.5 text-[11px]",_==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f("agents_ui.preset_manual")})]}),r.jsx(Ae,{value:_,onChange:be=>k(be.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})}),r.jsx(x6,{})]}),r.jsxs("div",{className:"space-y-3",children:[H&&r.jsx(vl,{label:f("project.routines.pre_field"),hint:f("project.routines.pre_hint"),rows:2,mono:!0,value:V,onChange:G,vars:ac("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),h==="exec_agent"&&r.jsx(vl,{label:f("project.routines.prompt_exec"),rows:4,value:N,onChange:E,vars:ac("prompt"),placeholder:f("project.routines.prompt_exec_ph")}),h==="super_agent"&&r.jsx(vl,{label:f("project.routines.prompt_super"),rows:4,value:N,onChange:E,vars:ac("prompt"),placeholder:f("project.routines.prompt_super_ph")}),h==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.routines.tg_channel"),children:r.jsx(kt,{value:R,onChange:M,options:J})}),r.jsx(ue,{label:f("project.routines.tg_chat_id"),children:r.jsx(Ae,{value:T,onChange:be=>A(be.target.value),placeholder:f("agents_ui.tg_chat_id_ph")})})]}),r.jsx(vl,{label:f("project.routines.tg_text"),hint:f("project.routines.tg_text_hint"),rows:6,value:z,onChange:I,vars:ac("prompt"),placeholder:f("agents_ui.tg_text_ph")})]}),h==="shell"&&r.jsx(vl,{label:f("project.routines.shell_field"),hint:f("project.routines.shell_hint"),rows:11,mono:!0,value:D,onChange:P,vars:[],placeholder:"cd /repo && git pull && npm test"}),h==="heartbeat"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.routines.hb_channel"),children:r.jsx(Ae,{value:L,onChange:be=>U(be.target.value),placeholder:"heartbeat"})}),r.jsx(ue,{label:f("project.routines.hb_message"),children:r.jsx(Ae,{value:q,onChange:be=>$(be.target.value),placeholder:f("agents_ui.hb_message_ph")})})]}),H&&r.jsx(vl,{label:f("project.routines.post_field"),hint:f("project.routines.post_hint"),rows:2,mono:!0,value:K,onChange:F,vars:ac("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[f("project.routines.what_happens")," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",Wb(_)]})]}),r.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ze.map((be,pe)=>r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsxs("div",{className:Oe("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",be.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[r.jsxs("div",{className:Oe("flex items-center gap-1.5 text-[11px] font-medium",be.action?"text-emerald-400":"text-muted-fg"),children:[r.jsx(be.icon,{size:12})," ",be.label]}),be.detail&&r.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:be.detail})]}),pe<ze.length-1&&r.jsx(yk,{size:14,className:"shrink-0 self-center text-muted-fg"})]},be.id))})]})]})})}function v6({pid:e}){const t=lt(),s=Ze(`/projects/${e}/routines`,()=>wr.list(e)),[o,l]=wf(),[c,u]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState(!1),[b,_]=x.useState(null),[k,C]=x.useState(null),y=s.data||[],w=o.get("r_id"),S=y.find(T=>T.name===w)||null,N=T=>l(A=>{const z=new URLSearchParams(A);return T?z.set("r_id",T):z.delete("r_id"),z},{replace:!0});x.useEffect(()=>{y.length!==0&&(w&&y.some(T=>T.name===w)||N(y[0].name))},[y,w]);const E=async T=>{try{await(T.enabled?wr.disable:wr.enable)(e,T.name),s.mutate()}catch(A){t.error(A?.message||f("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const T=b;_(null),C(T.name);try{await wr.run(e,T.name),t.success(f("project.routines.run_success",{name:T.name})),await Promise.all([s.mutate(),aC(`/projects/${e}/routines/${T.name}/runs`)])}catch(A){t.error(A?.message||f("project.routines.run_error"))}finally{C(null)}},M=async()=>{if(p){h(!0);try{await wr.remove(e,p.name),t.success(f("project.routines.delete_success")),w===p.name&&N(null),m(null),s.mutate()}catch(T){t.error(T?.message||f("project.routines.delete_error"))}finally{h(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[r.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:f("project.routines.title")}),r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:f("project.routines.subtitle")})]}),r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>u({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[r.jsx(sn,{size:14})," ",f("project.routines.new_btn")]})]}),s.isLoading&&r.jsx(ot,{}),!s.isLoading&&y.length===0&&r.jsx(ht,{children:f("project.routines.empty")}),y.length>0&&r.jsxs("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] grid-cols-[minmax(200px,260px)_1fr] overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(f6,{routines:y,selectedName:S?.name??null,onSelect:N}),r.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:S?r.jsx(h6,{pid:e,routine:S,onEdit:()=>u({...S}),onRun:()=>_(S),onToggle:()=>E(S),onDelete:()=>m(S),running:k===S.name},S.name):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.detail_empty")})})})]}),r.jsx(b6,{draft:c,onClose:()=>u(null),onSaved:()=>{u(null),s.mutate()},pid:e}),r.jsx(En,{open:!!p,onClose:()=>g?null:m(null),title:f("project.routines.delete_confirm",{name:p?.name||""}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:()=>m(null),disabled:g,children:f("common.cancel")}),r.jsx(de,{variant:"destructive",onClick:M,loading:g,children:f("common.delete")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.delete_confirm_body")})}),r.jsx(En,{open:!!b,onClose:()=>_(null),title:f("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:()=>_(null),children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:R,children:f("common.run")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.run_confirm_body")})})]})}function _6({pid:e}){const[t,s]=x.useState("open"),o=lt(),l=Ze(`/projects/${e}/tasks?state=${t}`,()=>kr.list(e,t),{dedupingInterval:0,revalidateOnFocus:!0}),[c,u]=x.useState(""),[p,m]=x.useState(!1),g=async()=>{if(c.trim()){m(!0);try{await kr.add(e,{title:c.trim()}),u(""),o.success(f("project.tasks.created")),l.mutate()}catch(b){o.error(b?.message||f("project.tasks.create_error"))}finally{m(!1)}}},h=async(b,_)=>{try{await b(),o.success(_),l.mutate()}catch(k){o.error(k?.message||f("common.error_generic"))}};return r.jsxs(Ke,{title:f("project.tasks.title"),description:f("project.tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(b=>r.jsx(de,{size:"sm","data-testid":`task-filter-${b}`,variant:t===b?"primary":"ghost",onClick:()=>s(b),children:b},b))}),children:[r.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[r.jsx(ue,{label:f("project.tasks.add_label"),children:r.jsx(Ae,{"data-testid":"task-input",placeholder:f("project.tasks.add_placeholder"),value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{b.key==="Enter"&&g()}})}),r.jsxs(de,{variant:"primary","data-testid":"task-add",onClick:g,loading:p,children:[r.jsx(sn,{size:14})," ",f("project.tasks.add")]})]}),l.isLoading&&r.jsx(ot,{}),!l.isLoading&&(l.data?.length??0)===0&&r.jsxs(ht,{children:[t==="open"?f("project.tasks.empty_open"):f("project.tasks.empty",{state:t})," ",r.jsx("code",{children:'apx task add "…"'})]}),r.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:(l.data||[]).map(b=>r.jsxs("li",{"data-testid":`task-${b.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:b.id}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:b.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[b.tags?.map(_=>r.jsxs(Ye,{children:["#",_]},_)),b.agent&&r.jsxs(Ye,{tone:"info",children:["@",b.agent]}),b.source&&r.jsxs("span",{children:[f("project.tasks.via")," ",b.source]}),b.due&&r.jsxs("span",{children:[f("project.tasks.due")," ",b.due]})]})]}),r.jsxs("div",{className:"flex gap-1",children:[t==="open"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{size:"sm",variant:"secondary","aria-label":f("project.tasks.aria_done"),"data-testid":`task-done-${b.id}`,onClick:()=>h(()=>kr.done(e,b.id),f("project.tasks.done")),children:r.jsx(bo,{size:13})}),r.jsx(de,{size:"sm",variant:"destructive","aria-label":f("project.tasks.aria_drop"),"data-testid":`task-drop-${b.id}`,onClick:()=>h(()=>kr.drop(e,b.id),f("project.tasks.drop")),children:r.jsx(ua,{size:13})})]}),t!=="open"&&r.jsx(de,{size:"sm",variant:"ghost","aria-label":f("project.tasks.aria_reopen"),"data-testid":`task-reopen-${b.id}`,onClick:()=>h(()=>kr.reopen(e,b.id),f("project.tasks.reopen")),children:r.jsx(Ix,{size:13})})]})]},b.id))})]})}const y6="\\$\\{var\\.([^}\\s]+)\\}";function rN(e="g"){return new RegExp(y6,e)}function oN(e){return rN("").test(e)}function j6(e){const t=[];let s=0;for(const o of e.matchAll(rN("g"))){const l=o.index??0;l>s&&t.push({type:"text",value:e.slice(s,l)}),t.push({type:"var",value:o[1]}),s=l+o[0].length}return s<e.length&&t.push({type:"text",value:e.slice(s)}),t}function eh(e){let t="";for(const s of Array.from(e.childNodes))if(s.nodeType===Node.TEXT_NODE)t+=s.textContent??"";else if(s instanceof HTMLElement){const o=s.dataset.varName;o?t+=`\${var.${o}}`:s.tagName==="BR"?t+="":t+=s.textContent??""}return t.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function Hj(e,t){e.replaceChildren();const s=j6(t);for(const o of s)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(lN(o.value));(s.length===0||s[s.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function lN(e){const t=document.createElement("span");return t.contentEditable="false",t.dataset.varName=e,t.className="inline-flex items-baseline px-1 rounded bg-primary/10 text-primary font-mono text-[12px] select-none cursor-default whitespace-nowrap",t.textContent=`$${e}`,t.title=`\${var.${e}}`,t}function w6(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}function k6(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(t)}const Jb=x.forwardRef(function({value:t,onChange:s,placeholder:o,className:l,varNames:c=[],onCreateVar:u},p){const m=x.useRef(null),g=x.useRef(null),[h,b]=x.useState(!1),[_,k]=x.useState(""),C=x.useRef(t);x.useEffect(()=>{const M=m.current;M&&(t===C.current&&M.childNodes.length>0||(Hj(M,t),C.current=t))},[t]);const y=x.useCallback(()=>{const M=m.current;if(!M)return;const T=eh(M);C.current=T,T!==t&&s(T)},[s,t]),w=x.useCallback(()=>{const M=m.current;if(!M)return;const T=eh(M);if(oN(T)&&C6(M)){const A=N6(M);Hj(M,T),A!=null&&E6(M,A)}C.current=eh(M),C.current!==t&&s(C.current)},[s,t]),S=x.useCallback(()=>{const M=window.getSelection();if(!M||M.rangeCount===0)return;const T=M.getRangeAt(0),A=m.current;A&&A.contains(T.startContainer)&&(g.current=T.cloneRange())},[]),N=x.useCallback(M=>{if(M.key==="Enter"){M.preventDefault(),M.currentTarget.blur();return}if(M.key==="Backspace"){const T=window.getSelection();if(!T||T.rangeCount===0)return;const A=T.getRangeAt(0);if(!A.collapsed)return;const{startContainer:z,startOffset:I}=A;if(z.nodeType===Node.TEXT_NODE&&I===0){const D=z.previousSibling;if(D instanceof HTMLElement&&D.dataset.varName){M.preventDefault(),D.remove(),y();return}}else if(z===m.current){const D=z.childNodes[I-1];if(D instanceof HTMLElement&&D.dataset.varName){M.preventDefault(),D.remove(),y();return}}}},[y]),E=x.useCallback(M=>{const T=m.current;if(!T)return;const A=g.current;T.focus();let z;A&&T.contains(A.startContainer)?z=A:(z=document.createRange(),z.selectNodeContents(T),z.collapse(!1)),w6(z,lN(M)),g.current=null,y()},[y]);x.useImperativeHandle(p,()=>({insertVar:E,focus:()=>m.current?.focus()}),[E]);const R=c.filter(M=>M.toLowerCase().includes(_.toLowerCase()));return r.jsxs("div",{className:Oe("group flex items-stretch w-full min-w-0 rounded-lg border border-input bg-transparent dark:bg-input/30 transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",l),children:[r.jsxs("div",{className:"relative flex-1 min-w-0",children:[r.jsx("div",{ref:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:w,onKeyDown:N,onBlur:y,onFocus:S,onMouseUp:S,onKeyUp:S,className:Oe("h-8 w-full whitespace-nowrap overflow-x-auto px-2.5 py-1 text-sm rounded-l-lg","focus:outline-none font-mono leading-7","[&_*]:align-baseline"),"data-placeholder":o||"",style:{caretColor:"currentColor"}}),t===""&&o&&r.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground font-mono",children:o})]}),r.jsxs("div",{className:"relative flex",children:[r.jsx(Je,{content:f("chat_ui.insert_variable"),children:r.jsx("button",{type:"button",onMouseDown:M=>{M.preventDefault(),S()},onClick:()=>b(M=>!M),"aria-label":f("chat_ui.insert_variable"),className:Oe("flex items-center justify-center px-2 min-w-8 border-l border-input text-muted-foreground rounded-r-lg","hover:bg-muted/60 hover:text-foreground transition-colors",h&&"bg-muted/60 text-foreground"),children:r.jsx(sn,{size:14})})}),h&&r.jsx(S6,{query:_,onQuery:k,varNames:R,onPick:M=>{E(M),b(!1),k("")},onClose:()=>{b(!1),k("")},onCreateVar:u})]})]})});function S6({query:e,onQuery:t,varNames:s,onPick:o,onClose:l,onCreateVar:c}){const u=x.useRef(null),p=x.useRef(null);return x.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function m(g){u.current&&!u.current.contains(g.target)&&l()}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[l]),r.jsxs("div",{ref:u,className:"absolute right-0 top-full z-50 mt-1 w-64 rounded-md border border-border bg-popover shadow-lg",children:[r.jsx("div",{className:"border-b border-border p-2",children:r.jsx("input",{ref:p,value:e,onChange:m=>t(m.target.value),placeholder:f("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),r.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[s.length===0&&r.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:f("shared_ui.no_matches")}),s.map(m=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:g=>g.preventDefault(),onClick:()=>o(m),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:m})},m))]}),c&&r.jsx("div",{className:"border-t border-border p-1",children:r.jsxs("button",{type:"button",onMouseDown:m=>m.preventDefault(),onClick:()=>{c(),l()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[r.jsx(sn,{size:12})," ",f("shared_ui.create_variable")]})})]})}function C6(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&oN(t.textContent??""))return!0;return!1}function N6(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const s=t.getRangeAt(0);if(!e.contains(s.startContainer))return null;const o=s.cloneRange();return o.selectNodeContents(e),o.setEnd(s.startContainer,s.startOffset),o.toString().length}function E6(e,t){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=t,l=s.nextNode();for(;l;){const c=(l.textContent??"").length;if(o<=c){const u=document.createRange();u.setStart(l,o),u.collapse(!0);const p=window.getSelection();p?.removeAllRanges(),p?.addRange(u);return}o-=c,l=s.nextNode()}k6(e)}function Vj(e){return e?Object.entries(e).map(([t,s])=>({key:t,value:String(s)})):[]}function qj(e){const t={};for(const s of e)s.key.trim()&&(t[s.key.trim()]=s.value);return t}function $j({rows:e,onChange:t,keyPlaceholder:s=f("shared_ui.kv_key_ph"),valuePlaceholder:o=f("shared_ui.kv_value_ph"),varNames:l,onCreateVar:c,emptyLabel:u}){const p=(h,b)=>{const _=e.slice();_[h]={..._[h],...b},t(_)},m=h=>t(e.filter((b,_)=>_!==h)),g=()=>t([...e,{key:"",value:""}]);return r.jsxs("div",{className:"space-y-2",children:[e.length===0&&u&&r.jsx("p",{className:"text-[11px] text-muted-foreground",children:u}),e.map((h,b)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ae,{value:h.key,onChange:_=>p(b,{key:_.target.value}),placeholder:s,className:"w-40 font-mono text-xs"}),r.jsx("div",{className:"flex-1",children:r.jsx(Jb,{value:h.value,onChange:_=>p(b,{value:_}),placeholder:o,varNames:l,onCreateVar:c})}),r.jsx(de,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(b),"aria-label":f("shared_ui.remove_row"),children:r.jsx(ua,{size:13})})]},b)),r.jsxs(de,{type:"button",size:"sm",variant:"ghost",onClick:g,children:[r.jsx(sn,{size:12})," ",f("shared_ui.add_row")]})]})}const R6={apc:"info",runtime:"success",global:"muted"};function px(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function T6(e){return e==="apc"?f("project.mcps.scope_shared"):e==="runtime"?f("project.mcps.scope_runtime"):e==="global"?f("project.mcps.scope_global"):e}function M6({pid:e}){const t=lt(),s=Ze(`/projects/${e}/mcps`,()=>Sr.list(e)),o=Ze(`/projects/${e}/mcps/check`,()=>Sr.check(e)),l=Ze(`/projects/${e}/vars`,()=>Mc.list(e)),[c,u]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState(null),b=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),_=async(y,w)=>{if(confirm(f("project.mcps.delete_confirm",{name:y,scope:w})))try{await Sr.remove(e,y,w),t.success(f("project.mcps.removed")),s.mutate(),p===y&&m(null)}catch(S){t.error(S?.message||f("common.error_generic"))}},k=async y=>{try{await Sr.add(e,px(y.source),{name:y.name,enabled:!y.enabled}),s.mutate()}catch(w){t.error(w?.message||f("common.error_generic"))}},C=async y=>{m(y),h({name:y,busy:!0});try{const w=await Sr.test(e,y);h({name:y,result:w})}catch(w){h({name:y,result:{ok:!1,error:w?.message||"error"}})}};return r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[r.jsx("div",{className:"lg:col-span-3",children:r.jsxs(Ke,{title:f("project.mcps.title"),description:f("project.mcps.subtitle"),action:r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>u({kind:"new"}),children:[r.jsx(sn,{size:14})," ",f("project.mcps.new")]}),children:[o.data?.conflicts?.length?r.jsx("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:f("project.mcps.conflicts",{names:o.data.conflicts.map(y=>y.name).join(", ")})}):null,s.isLoading&&r.jsx(ot,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(ht,{children:f("project.mcps.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(y=>{const w=y.source==="apc"||y.source==="runtime"||y.source==="global",S=px(y.source),N=p===y.name;return r.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(N?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(y.name),role:"button",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("span",{className:"font-medium",children:y.name}),r.jsx(Ye,{tone:R6[y.source]??"muted",children:T6(y.source)}),r.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(y.transport||"stdio").toUpperCase()}),r.jsx("div",{onClick:E=>E.stopPropagation(),children:r.jsx(Wt,{checked:y.enabled!==!1,onChange:()=>k(y),label:""})}),r.jsx(Je,{content:f("project.mcps.test_btn"),children:r.jsx(de,{size:"sm",variant:"ghost",onClick:E=>{E.stopPropagation(),C(y.name)},"aria-label":f("project.mcps.test_btn"),children:r.jsx(Sk,{size:13})})}),r.jsx(Je,{content:f("project.mcps.logs_btn"),children:r.jsx(de,{size:"sm",variant:"ghost",onClick:E=>{E.stopPropagation(),m(y.name)},"aria-label":f("project.mcps.logs_btn"),children:r.jsx(Qd,{size:13})})}),w&&r.jsx(Je,{content:f("project.mcps.edit_btn"),children:r.jsx(de,{size:"sm",variant:"ghost",onClick:E=>{E.stopPropagation(),u({kind:"edit",entry:y})},"aria-label":f("project.mcps.edit_btn"),children:r.jsx(Eo,{size:13})})}),w&&r.jsx(de,{size:"sm",variant:"destructive",onClick:E=>{E.stopPropagation(),_(y.name,S)},children:r.jsx(ua,{size:13})})]}),g?.name===y.name&&r.jsx(A6,{result:g.result,busy:!!g.busy,onClose:()=>h(null)})]},`${y.source}-${y.name}`)})}),c&&r.jsx(z6,{mode:c,pid:e,varNames:b,onClose:()=>u(null),onSaved:()=>{u(null),s.mutate()},onVarsChanged:()=>l.mutate()})]})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(O6,{pid:e,mcpName:p,runningTest:!!g?.busy})})]})}function A6({result:e,busy:t,onClose:s}){return r.jsxs("div",{className:"mt-2 rounded border border-border/60 bg-background/40 p-2 text-xs",children:[r.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[t&&r.jsx("span",{className:"text-muted-fg",children:f("project.mcps.testing")}),!t&&e?.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[r.jsx(Ax,{size:12})," ",f("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!t&&e&&!e.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[r.jsx(QM,{size:12})," ",e.error]}),r.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:s,children:"×"})]}),!t&&e?.ok&&e.tools&&e.tools.length>0&&r.jsxs("ul",{className:"space-y-0.5 font-mono",children:[e.tools.slice(0,10).map(o=>r.jsxs("li",{className:"truncate",children:[r.jsx("span",{className:"text-primary",children:o.name}),o.description&&r.jsxs("span",{className:"ml-2 text-muted-fg",children:["— ",o.description]})]},o.name)),e.tools.length>10&&r.jsxs("li",{className:"text-muted-fg",children:["… +",e.tools.length-10]})]})]})}function O6({pid:e,mcpName:t,runningTest:s}){const[o,l]=x.useState(null),[c,u]=x.useState(null),p=x.useRef(null);x.useEffect(()=>{if(!t){l(null),u(null);return}p.current!==t&&(l(null),u(null),p.current=t);let g=!1;const h=async()=>{try{const k=await Sr.logs(e,t);g||(l(k),u(null))}catch(k){g||u(k?.message||"error")}};h();const _=setInterval(h,s?1200:4e3);return()=>{g=!0,clearInterval(_)}},[e,t,s]);const m=x.useRef(null);return x.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),r.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[r.jsx(Ar,{size:13,className:"text-muted-fg"}),r.jsx("span",{className:"font-medium",children:f("project.mcps.logs_panel_title")}),t?r.jsx(Ye,{tone:"info",children:t}):r.jsxs("span",{className:"text-muted-fg",children:["— ",f("project.mcps.logs_panel_pick")]})]}),r.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_hint")}),t&&c&&r.jsx("p",{className:"text-red-400",children:c}),t&&!c&&o&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-2 text-muted-fg",children:[o.transport.toUpperCase(),o.url?` · ${o.url}`:o.command?` · ${o.command}`:"",o.last_error?` · last_error: ${o.last_error}`:""]}),o.note&&r.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_idle")}),o.events?.map((g,h)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:g.ts.slice(11,19)}),r.jsx("span",{className:g.level==="error"?"text-red-400":g.level==="stderr"?"text-amber-400":"text-emerald-400",children:g.level}),r.jsx("span",{className:"flex-1 break-all",children:g.msg})]},h)),o.stderr_tail&&r.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[r.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),r.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function z6({mode:e,pid:t,varNames:s,onClose:o,onSaved:l,onVarsChanged:c}){const u=lt(),p=e.kind==="edit",m=p?e.entry:null,[g,h]=x.useState(!1),[b,_]=x.useState(m?px(m.source):"runtime"),[k,C]=x.useState(m?.name||""),[y,w]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[S,N]=x.useState(m?.command||""),[E,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[M,T]=x.useState(Vj(m?.env)),[A,z]=x.useState(m?.url||""),[I,D]=x.useState(Vj(m?.headers)),[P,L]=x.useState(m?.enabled!==!1),[U,q]=x.useState(!1),$=async()=>{if(!k.trim()){u.error(f("project.mcps.name_required"));return}h(!0);try{const V=E.map(K=>K.trim()).filter(Boolean),G=y==="stdio"?{name:k.trim(),command:S.trim(),args:V.length?V:void 0,env:M.length?qj(M):void 0,enabled:P}:{name:k.trim(),url:A.trim(),headers:I.length?qj(I):void 0,enabled:P};await Sr.add(t,b,G),u.success(f(p?"project.mcps.updated":"project.mcps.added")),l()}catch(V){u.error(V?.message||f("common.error_generic"))}finally{h(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(En,{open:!0,onClose:()=>g?null:o(),title:f(p?"project.mcps.edit_title":"project.mcps.new_title"),description:p?m?.name:f("project.mcps.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:o,disabled:g,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:$,loading:g,children:f(p?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.mcps.scope_label"),children:r.jsx(kt,{value:b,onChange:V=>_(V),options:[{value:"runtime",label:f("project.mcps.scope_runtime"),description:f("project.mcps.scope_runtime_desc")},{value:"shared",label:f("project.mcps.scope_shared"),description:f("project.mcps.scope_shared_desc")},{value:"global",label:f("project.mcps.scope_global"),description:f("project.mcps.scope_global_desc")}]})}),r.jsx(ue,{label:f("project.mcps.transport_label"),children:r.jsx(kt,{value:y,onChange:V=>w(V),options:[{value:"stdio",label:f("project.mcps.transport_stdio"),description:f("project.mcps.transport_stdio_desc")},{value:"http",label:f("project.mcps.transport_http"),description:f("project.mcps.transport_http_desc")}]})})]}),r.jsx(ue,{label:f("project.mcps.name_label"),children:r.jsx(Ae,{value:k,onChange:V=>C(V.target.value),placeholder:f("project.mcps.name_ph"),disabled:p})}),y==="stdio"?r.jsxs(r.Fragment,{children:[r.jsx(ue,{label:f("project.mcps.cmd_label"),children:r.jsx(Ae,{value:S,onChange:V=>N(V.target.value),placeholder:f("project.mcps.cmd_ph")})}),r.jsx(ue,{label:f("project.mcps.args_label"),hint:f("project.mcps.args_hint_tokens"),children:r.jsx(D6,{args:E,onChange:R,varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(ue,{label:f("project.mcps.env_label"),hint:f("project.mcps.env_hint_tokens"),children:r.jsx($j,{rows:M,onChange:T,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:f("project.mcps.env_empty")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(ue,{label:f("project.mcps.url_label"),children:r.jsx(Jb,{value:A,onChange:z,placeholder:f("project.mcps.url_ph"),varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(ue,{label:f("project.mcps.headers_label"),hint:f("project.mcps.headers_hint"),children:r.jsx($j,{rows:I,onChange:D,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:f("project.mcps.headers_empty")})})]}),r.jsx(Wt,{checked:P,onChange:L,label:f("project.mcps.enabled_label")})]})}),U&&r.jsx(P6,{pid:t,onClose:()=>q(!1),onCreated:()=>{q(!1),c()}})]})}function D6({args:e,onChange:t,varNames:s,onCreateVar:o}){const l=(p,m)=>{const g=e.slice();g[p]=m,t(g)},c=p=>t(e.filter((m,g)=>g!==p)),u=()=>t([...e,""]);return r.jsxs("div",{className:"space-y-2",children:[e.map((p,m)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1",children:r.jsx(Jb,{value:p,onChange:g=>l(m,g),placeholder:f("agents_ui.arg_placeholder"),varNames:s,onCreateVar:o})}),r.jsx(de,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":f("agents_ui.remove_arg"),children:r.jsx(ua,{size:13})})]},m)),r.jsxs(de,{type:"button",size:"sm",variant:"ghost",onClick:u,children:[r.jsx(sn,{size:12})," ",f("project.mcps.add_arg")]})]})}function P6({pid:e,onClose:t,onCreated:s}){const o=lt(),l=String(e)==="0",[c,u]=x.useState(""),[p,m]=x.useState(""),[g,h]=x.useState(!1),[b,_]=x.useState(l?"global":"project"),k=async()=>{if(!c.trim()){o.error(f("project.vars.name_required"));return}if(!p){o.error(f("project.vars.value_required"));return}h(!0);try{await Mc.upsert(e,{name:c.trim(),value:p,scope:b}),o.success(f("project.vars.added")),s()}catch(C){o.error(C?.message||f("common.error_generic"))}finally{h(!1)}};return r.jsx(En,{open:!0,onClose:()=>g?null:t(),title:f("project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:g,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:k,loading:g,children:f("project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:f("project.vars.scope_label"),children:r.jsx(kt,{value:b,onChange:C=>_(C),options:[...l?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(ue,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ae,{value:c,onChange:C=>u(C.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),r.jsx(ue,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsx(Ae,{type:"password",value:p,onChange:C=>m(C.target.value),className:"font-mono text-xs"})})]})})}function L6({pid:e}){const t=lt(),s=String(e)==="0",[o,l]=x.useState(s?"global":"all"),[c,u]=x.useState(!1),p=Ze(`/projects/${e}/vars?reveal=${c?1:0}`,()=>Mc.list(e,{reveal:c})),[m,g]=x.useState(null),h=x.useMemo(()=>{if(!p.data)return[];const _=[],k=p.data.project||{},C=p.data.global||{};for(const[y,w]of Object.entries(k))_.push({name:y,scope:"project",masked:w});for(const[y,w]of Object.entries(C))k[y]===void 0&&_.push({name:y,scope:"global",masked:w});return _.filter(y=>o==="all"?!0:y.scope===o).sort((y,w)=>y.name.localeCompare(w.name))},[p.data,o]),b=async(_,k)=>{if(confirm(f("project.vars.delete_confirm",{name:_,scope:k})))try{await Mc.remove(e,_,k),t.success(f("project.vars.removed")),p.mutate()}catch(C){t.error(C?.message||f("common.error_generic"))}};return r.jsxs(Ke,{title:f("project.vars.title"),description:f(s?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wt,{checked:c,onChange:u,label:f("project.vars.reveal_all")}),r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>g({}),children:[r.jsx(sn,{size:14})," ",f("project.vars.new")]})]}),children:[!s&&r.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-muted-fg",children:f("project.vars.filter_label")}),r.jsx(th,{active:o==="all",onClick:()=>l("all"),children:f("project.vars.filter_all")}),r.jsx(th,{active:o==="project",onClick:()=>l("project"),children:f("project.vars.filter_project")}),r.jsx(th,{active:o==="global",onClick:()=>l("global"),children:f("project.vars.filter_global")})]}),p.isLoading&&r.jsx(ot,{}),!p.isLoading&&h.length===0&&r.jsx(ht,{children:f("project.vars.empty")}),h.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:h.map(_=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-mono text-xs font-medium",children:_.name}),r.jsx(Ye,{tone:_.scope==="project"?"info":"muted",children:_.scope==="project"?f("project.vars.scope_project"):f("project.vars.scope_global")}),r.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:_.masked}),r.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>g({name:_.name,scope:_.scope}),"aria-label":f("project.vars.edit_btn"),children:r.jsx(Eo,{size:13})}),!(s&&_.scope==="project")&&r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>b(_.name,_.scope),"aria-label":f("project.vars.delete_btn"),children:r.jsx(ua,{size:13})})]})]},`${_.scope}-${_.name}`))}),r.jsx(I6,{open:m!==null,initial:m||void 0,onClose:()=>g(null),pid:e,isBase:s,onSaved:()=>{g(null),p.mutate()}})]})}function th({active:e,onClick:t,children:s}){return r.jsx("button",{type:"button",onClick:t,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:s})}function I6({open:e,onClose:t,pid:s,isBase:o,initial:l,onSaved:c}){const u=lt(),[p,m]=x.useState(!1),[g,h]=x.useState(!1),[b,_]=x.useState(l?.name||""),[k,C]=x.useState(l?.value||""),[y,w]=x.useState(l?.scope||(o?"global":"project")),S=!!l?.name;x.useEffect(()=>{e&&(_(l?.name||""),C(l?.value||""),w(l?.scope||(o?"global":"project")),h(!1))},[e,l?.name,l?.scope,l?.value,o]);const N=async()=>{if(!b.trim()){u.error(f("project.vars.name_required"));return}if(!k){u.error(f("project.vars.value_required"));return}m(!0);try{await Mc.upsert(s,{name:b.trim(),value:k,scope:y}),u.success(f(S?"project.vars.updated":"project.vars.added")),c()}catch(E){u.error(E?.message||f("common.error_generic"))}finally{m(!1)}};return r.jsx(En,{open:e,onClose:()=>p?null:t(),title:f(S?"project.vars.edit_title":"project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:p,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:N,loading:p,children:f(S?"project.vars.save_btn":"project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:f("project.vars.scope_label"),children:r.jsx(kt,{value:y,onChange:E=>w(E),options:[...o?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(ue,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ae,{value:b,onChange:E=>_(E.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:S,autoFocus:!S})}),r.jsx(ue,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ae,{type:g?"text":"password",value:k,onChange:E=>C(E.target.value),placeholder:S?f("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:S}),r.jsx("button",{type:"button",onClick:()=>h(E=>!E),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":f(g?"project.vars.hide":"project.vars.reveal"),children:g?r.jsx(sA,{size:14}):r.jsx(kf,{size:14})})]})})]})})}function ev({value:e,onValueChange:t,onSubmit:s,onStop:o,busy:l=!1,disabled:c=!1,placeholder:u,autoFocus:p,minRows:m=2,maxRows:g=8,footer:h,className:b}){const _=x.useRef(null);x.useLayoutEffect(()=>{const C=_.current;if(!C)return;const y=()=>{C.style.height="auto",C.offsetHeight;const S=parseFloat(getComputedStyle(C).lineHeight)||20,N=S*m,E=S*g;C.style.height=`${Math.min(Math.max(C.scrollHeight,N),E)}px`,C.style.overflowY=C.scrollHeight>E?"auto":"hidden"};y();const w=requestAnimationFrame(y);return()=>cancelAnimationFrame(w)},[e,m,g]);const k=e.trim().length>0&&!c;return r.jsxs("div",{className:St("flex flex-col gap-1.5 rounded-2xl border border-border bg-muted/60 p-2 shadow-sm transition-colors","focus-within:border-foreground/25 focus-within:bg-muted",c&&"opacity-60",b),children:[r.jsx("textarea",{ref:_,rows:m,value:e,autoFocus:p,disabled:c,placeholder:u,onChange:C=>t(C.target.value),onKeyDown:C=>{if(C.key==="Enter"&&!C.shiftKey){if(C.preventDefault(),l||!k)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),r.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),l&&o?r.jsx(Je,{content:f("chat_ui.stop"),children:r.jsx(Xs,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":f("chat_ui.stop"),children:r.jsx(Ok,{className:"size-3.5",fill:"currentColor"})})}):r.jsx(Je,{content:f("chat_ui.send"),children:r.jsx(Xs,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!k,"aria-label":f("chat_ui.send"),children:r.jsx($M,{className:"size-4"})})})]})]})}function tv({value:e,onChange:t,disabled:s}){const[o,l]=x.useState(!1),[c,u]=x.useState(""),[p,m]=x.useState([]),[g,h]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const w=S=>{b.current&&!b.current.contains(S.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),x.useEffect(()=>{if(!o||g)return;let w=!1;return(async()=>{try{const{engines:S}=await pf.list(),N=await Promise.all(S.map(E=>pf.models({engine:E}).then(R=>(R.models||[]).map(M=>M.includes(":")?M:`${E}:${M}`)).catch(()=>[])));if(!w){const E=Array.from(new Set(N.flat())).sort();m(E),h(!0)}}catch{w||h(!0)}})(),()=>{w=!0}},[o,g]);const _=c.trim().toLowerCase(),k=_?p.filter(w=>w.toLowerCase().includes(_)):p,C=e||f("shared_ui.auto"),y=w=>{t(w),l(!1),u("")};return r.jsxs("div",{ref:b,className:"relative",children:[r.jsx(Je,{content:f("chat_ui.pick_model"),children:r.jsxs("button",{type:"button",disabled:s,onClick:()=>l(w=>!w),"data-testid":"chat-model-picker",className:Oe("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),"aria-label":f("chat_ui.pick_model"),children:[r.jsx(Ak,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:C}),r.jsx(Qs,{className:"size-3 shrink-0 opacity-60"})]})}),o&&r.jsxs("div",{className:"absolute bottom-full left-0 z-50 mb-1.5 w-64 rounded-lg border border-border bg-popover p-1.5 shadow-md ring-1 ring-foreground/10",children:[r.jsx("input",{autoFocus:!0,value:c,placeholder:f("shared_ui.model_filter_ph"),onChange:w=>u(w.target.value),onKeyDown:w=>{w.key==="Enter"&&c.trim()&&y(c.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),r.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),y("")},className:Oe("flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent hover:text-accent-fg",!e&&"bg-accent/50"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(ps,{className:"size-3"})," ",f("shared_ui.auto_router")]}),!e&&r.jsx(bo,{className:"size-3"})]})}),!g&&r.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:f("shared_ui.loading_models")}),g&&k.length===0&&c.trim()&&r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:w=>{w.preventDefault(),y(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:f("shared_ui.use_value",{value:c.trim()})})}),k.map(w=>r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:S=>{S.preventDefault(),y(w)},className:Oe("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",w===e&&"bg-accent/50"),children:[r.jsx("span",{className:"truncate",children:w}),w===e&&r.jsx(bo,{className:"size-3 shrink-0"})]})},w))]})]})]})}function B6({onSend:e,onStop:t,streaming:s,model:o,onModelChange:l}){const[c,u]=x.useState(""),p=()=>{const m=c.trim();m&&(u(""),e(m))};return r.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:r.jsx(ev,{value:c,onValueChange:u,onSubmit:p,onStop:t,busy:s,placeholder:f("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(tv,{value:o||"",onChange:l,disabled:s}):void 0})})}function U6(){return{read_file:{icon:iA,label:f("shared_ui.tool_read_file")},write_file:{icon:lA,label:f("shared_ui.tool_write_file")},edit_file:{icon:Xd,label:f("shared_ui.tool_edit_file")},list_files:{icon:Nk,label:f("shared_ui.tool_list_files")},search_files:{icon:Ld,label:f("shared_ui.tool_search_files")},search_messages:{icon:Ld,label:f("shared_ui.tool_search_messages")},tail_messages:{icon:Ld,label:f("shared_ui.tool_tail_messages")},run_shell:{icon:Ar,label:f("shared_ui.tool_run_shell")},send_telegram:{icon:Ya,label:f("shared_ui.tool_send_telegram")},call_agent:{icon:gn,label:f("shared_ui.tool_call_agent")},call_mcp:{icon:RA,label:f("shared_ui.tool_call_mcp")},call_runtime:{icon:gn,label:f("shared_ui.tool_call_runtime")},create_task:{icon:wA,label:f("shared_ui.tool_create_task")}}}const iN=new Set(["write_file","edit_file"]);function H6(e){return U6()[e]||{icon:Jl,label:e}}function V6(e,t){if(!t)return"";const s=l=>typeof t[l]=="string"?t[l]:void 0,o=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return o?String(o):""}function Fj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function q6({status:e}){return e==="running"?r.jsx(Cf,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?r.jsx(ps,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?r.jsx(nA,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(bo,{className:"size-3 shrink-0 text-emerald-400"})}function $6({part:e}){const[t,s]=x.useState(!1),{icon:o,label:l}=H6(e.tool),c=V6(e.tool,e.args),u=iN.has(e.tool),p=!!e.args||e.result!==void 0;return r.jsxs("div",{className:Oe("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[r.jsxs("button",{type:"button",onClick:()=>p&&s(m=>!m),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[p?r.jsx(Bc,{className:Oe("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:Oe("size-3.5 shrink-0",u?"text-violet-400":"text-muted-foreground")}),r.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&r.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),r.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&r.jsx("span",{className:"text-[10px] text-amber-400",children:f("shared_ui.dedup")}),r.jsx(q6,{status:e.status})]})]}),t&&p&&r.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.args&&Object.keys(e.args).length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:f("shared_ui.args")}),r.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:Fj(e.args)})]}),e.result!==void 0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:f("shared_ui.result")}),r.jsx("pre",{className:Oe("max-h-64 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed",e.status==="error"?"text-rose-300":"text-foreground"),children:Fj(e.result)})]})]})]})}function F6(e){const t=e.args;return(t&&Array.isArray(t.questions)?t.questions:[]).map(o=>typeof o=="string"?o:o&&typeof o=="object"&&typeof o.question=="string"?o.question:null).filter(o=>!!o)}function G6({part:e,pending:t}){const s=F6(e),o=f(t?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:Oe("rounded-2xl border px-3 py-2 text-sm shadow-sm",t?"rounded-bl-sm border-amber-500/30 bg-amber-500/5 text-foreground":"rounded-bl-sm border-emerald-500/30 bg-emerald-500/5 text-foreground"),"data-testid":"ask-questions-card","data-state":t?"pending":"answered",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[t?r.jsx(Cf,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(Ax,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(Ek,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"text-[12px] font-medium",children:o}),s.length>1&&r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[s.length," preguntas"]})]}),s.length>0&&r.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:s.map((l,c)=>r.jsx("li",{className:"list-disc",children:l},c))})]})}function cN(e){const t=e.split(`
623
+ `),s=[];let o=null;for(const l of t)if(l.startsWith("- "))o&&s.push(o),o={question:l.slice(2),answer:"",skipped:!1};else if(l.startsWith(" → ")&&o){const c=l.slice(4);o.answer=c,o.skipped=c==="(omitido)"}else return null;return o&&s.push(o),s.length>0?s:null}function Y6({text:e}){const t=cN(e);return t?r.jsx("div",{className:"flex w-full justify-center",children:r.jsxs("div",{className:"w-full max-w-[85%] rounded-2xl border border-border/70 bg-card/40 px-4 py-3 shadow-sm","data-testid":"ask-answers-card",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(Ek,{className:"size-3.5"}),r.jsx("span",{children:f("ask_panel.answers_header")})]}),r.jsx("ul",{className:"space-y-2.5",children:t.map((s,o)=>r.jsxs("li",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:s.question}),r.jsx("div",{className:Oe("whitespace-pre-wrap text-[13px] leading-snug",s.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:s.answer})]},o))})]})}):null}function mx(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
624
+
625
+ `).trim()}function X6(e){const t=e.args?.questions;if(!Array.isArray(t)||t.length===0)return null;const s=t.map(o=>{if(typeof o=="string")return`- ${o}`;if(!o||typeof o!="object")return null;const l=o;if(typeof l.question!="string")return null;const u=(Array.isArray(l.options)?l.options:[]).map(p=>typeof p=="string"?p:p&&typeof p=="object"&&typeof p.label=="string"?p.label:"").filter(p=>p).join(", ");return u?`- ${l.question} (opciones: ${u})`:`- ${l.question}`}).filter(o=>!!o);return s.length===0?null:`[ask_questions]
626
+ ${s.join(`
627
+ `)}`}function K6(e){const t=[];for(const s of e.parts)if(s.kind==="text"&&s.text)t.push(s.text);else if(s.kind==="tool"&&s.tool==="ask_questions"){const o=X6(s);o&&t.push(o)}return t.join(`
628
+
629
+ `).trim()}const Q6=e=>[{kind:"text",text:e}];function Z6(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function nv(e,t){const s=o=>({...e,notes:[...e.notes||[],o]});switch(t.type){case"model_start":return t.model?{...e,model:t.model}:e;case"model_routed":{const o=t.model?{...e,model:t.model}:e;return t.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${t.model}`]}:o}case"engine_failed":return s(`engine ${t.model||"?"} failed → ${t.retry_with||"retry"}`);case"model_retry":return s(`retry (${t.reason||"?"})`);case"tools_suppressed":return s(`tools suppressed: ${(t.tools||[]).join(", ")}`);case"skill_inspector":{const o=t.inspector;return!o||!o.loaded?.length&&!o.hinted?.length?e:{...e,inspector:{embedder:o.embedder,loaded:o.loaded||[],hinted:o.hinted||[]}}}case"assistant_text":return t.text?{...e,parts:[...e.parts,{kind:"text",text:t.text}]}:e;case"tool_start":return t.trace?{...e,parts:[...e.parts,{kind:"tool",id:t.trace.id,tool:t.trace.tool,args:t.trace.args,status:"running"}]}:e;case"tool_deduped":return t.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===t.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!t.trace)return e;{const o=Z6(t.trace.result);return{...e,parts:e.parts.map(l=>l.kind==="tool"&&l.id===t.trace.id?{...l,result:t.trace.result,status:o?"error":l.status==="deduped"?"deduped":"done"}:l)}}case"final":return{...e,pending:!1,usage:t.result?.usage??e.usage,model:e.model??t.result?.name,parts:t.result?.text&&!e.parts.some(o=>o.kind==="text")?[...e.parts,{kind:"text",text:t.result.text}]:e.parts};default:{const o=t.delta||t.content||"";if(!o)return e;const l=[...e.parts],c=l[l.length-1];return c&&c.kind==="text"?l[l.length-1]={...c,text:c.text+o}:l.push({kind:"text",text:o}),{...e,parts:l}}}}function W6(e,t){const[s,o]=x.useState([]),[l,c]=x.useState(!1),[u,p]=x.useState(void 0),m=x.useRef(null),g=x.useRef(void 0),h=x.useCallback(w=>{o(S=>{const N=[...S],E=N[N.length-1];return E&&E.role==="assistant"&&(N[N.length-1]=w(E)),N})},[]),b=x.useCallback(w=>{if(w.type==="error"){t?.(w.error||f("shared_ui.err_stream"));return}h(S=>nv(S,w))},[h,t]),_=x.useCallback(async(w,S={})=>{const N=w.trim();if(!N||l)return;const E=()=>new Date().toISOString(),R=s.map(T=>({role:T.role,content:K6(T)}));if(o(T=>[...T,{role:"user",parts:Q6(N),ts:E()},{role:"assistant",parts:[],ts:E(),pending:!0}]),c(!0),S.agentSlug){try{const T=await an.chat(e,S.agentSlug,{prompt:N,conversation_id:g.current,model:S.model||void 0,channel:"web"});g.current=T.conversation_id,p(T.conversation_id),h(A=>({...A,pending:!1,model:T.engine,parts:[{kind:"text",text:T.text}]}))}catch(T){t?.(T?.message||f("shared_ui.err_chat_failed")),o(A=>A.filter((z,I)=>I!==A.length-1))}finally{c(!1)}return}const M=new AbortController;m.current=M;try{await lC.stream(e,{prompt:N,previousMessages:R,model:S.model||void 0,channel:"web"},b,M.signal),h(T=>({...T,pending:!1}))}catch(T){M.signal.aborted?h(A=>({...A,pending:!1,parts:[...A.parts,{kind:"text",text:f("code_module.stopped")}]})):(t?.(T?.message||f("shared_ui.err_stream_failed")),o(A=>A.filter((z,I)=>I!==A.length-1)))}finally{c(!1),m.current=null}},[e,s,l,b,h,t]),k=x.useCallback(()=>m.current?.abort(),[]),C=x.useCallback(()=>{l||(g.current=void 0,p(void 0),o([]))},[l]),y=x.useCallback(async(w,S)=>{if(!l)try{const E=(await Pb.get(e,w,S)).messages.filter(R=>R.role==="user"||R.role==="assistant").map(R=>({role:R.role,parts:[{kind:"text",text:R.content}],ts:R.ts||new Date().toISOString()}));g.current=S,p(S),o(E)}catch(N){t?.(N?.message||f("shared_ui.err_load_conversation"))}},[e,l,t]);return{msgs:s,send:_,stop:k,clear:C,load:y,streaming:l,conversationId:u}}function J6({msg:e,isLast:t,isAskAnswer:s,onCopy:o}){const l=e.role==="user",c=mx(e),u=e.parts.some(p=>p.kind==="tool");if(l&&s){const p=mx(e);if(cN(p))return r.jsx(Y6,{text:p})}return r.jsxs("div",{className:Oe("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(gn,{size:14})}),r.jsxs("div",{className:Oe("flex min-w-0 flex-col gap-1.5",l?"items-end":"w-full max-w-[85%]"),children:[!l&&e.notes&&e.notes.length>0&&r.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((p,m)=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[r.jsx(vA,{size:10})," ",p]},m))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?r.jsx(Je,{content:f("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[r.jsx(fs,{size:10}),e.inspector.loaded?.map(p=>r.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:p},`l-${p}`)),e.inspector.hinted?.map(p=>r.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[p,"?"]},`h-${p}`))]})}):null,e.parts.map((p,m)=>p.kind==="tool"?p.tool==="ask_questions"&&!l?r.jsx(G6,{part:p,pending:!!t},`${p.id}-${m}`):r.jsx($6,{part:p},`${p.id}-${m}`):p.text?r.jsx("div",{className:Oe("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",l?"rounded-br-sm border border-emerald-500/30 bg-emerald-500/10 text-foreground dark:bg-emerald-500/15":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:p.text},m):null),!l&&e.pending&&e.parts.length===0&&r.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsx("span",{children:eI(e.ts)}),!l&&e.model&&r.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&u&&r.jsxs("span",{children:["· ",f("shared_ui.tools_count",{n:e.parts.filter(p=>p.kind==="tool").length})]}),o&&c&&r.jsx(Je,{content:f("chat_ui.copy"),children:r.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":f("chat_ui.copy"),children:[r.jsx(Yd,{size:10})," ",f("chat_ui.copy")]})})]})]}),l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(Bx,{size:14})})]})}function eI(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function av({msgs:e,onCopy:t}){const s=x.useRef(null);if(x.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(ht,{children:f("project.chat.empty")})});const o=e.length-1;return r.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>r.jsx(J6,{msg:l,isLast:c===o,isAskAnswer:tI(e,c),onCopy:t},c)),r.jsx("div",{ref:s})]})}function tI(e,t){const s=e[t];if(!s||s.role!=="user")return!1;const o=e[t-1];if(!o||o.role!=="assistant")return!1;for(let l=o.parts.length-1;l>=0;l--){const c=o.parts[l];if(c.kind==="tool")return c.tool==="ask_questions"}return!1}function nI(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function uN({msgs:e}){const[t,s]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:u,model:p}=x.useMemo(()=>{let g=0,h=0,b=0,_;const k=new Set,C=[];for(const y of e)if(y.role==="assistant"){y.usage&&(g+=y.usage.input_tokens||0,h+=y.usage.output_tokens||0),y.model&&(_=y.model);for(const w of y.parts)if(w.kind==="tool"&&(b+=1,iN.has(w.tool)&&w.status!=="error")){const S=nI(w.args);S&&!k.has(S)&&(k.add(S),C.push({path:S,tool:w.tool}))}}return{inTok:g,outTok:h,toolCount:b,changed:C,model:_}},[e]),m=o+l;return m===0&&c===0?null:r.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[r.jsxs("button",{type:"button",onClick:()=>u.length>0&&s(g=>!g),className:Oe("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",u.length>0&&"hover:text-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Sf,{size:12})," ",nh(m)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",nh(o),"↑ / ",nh(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Jl,{size:12})," ",c," tools"]}),u.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Xd,{size:12})," ",u.length," archivos"]}),p&&r.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:p}),u.length>0&&r.jsx(Qs,{className:Oe("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&u.length>0&&r.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:u.map(g=>r.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[r.jsx(Xd,{size:11,className:"shrink-0 text-violet-400"}),r.jsx("span",{className:"truncate",children:g.path}),r.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:g.tool==="write_file"?"write":"edit"})]},g.path))})]})}function nh(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function wl(){return{picked:new Set,text:"",skipped:!1}}function Gj(e,t){const s=[];return e.forEach((o,l)=>{const c=t[l]||wl();if(c.skipped){s.push(`- ${o.question}
630
+ → (omitido)`);return}const u=[];if(o.options&&o.options.length>0){const g=[...c.picked].sort((h,b)=>h-b).map(h=>o.options[h]?.label).filter(Boolean);g.length>0&&u.push(g.join(", "))}const p=c.text.trim();p&&u.push(o.options&&o.options.length>0?`(Otro: ${p})`:p);const m=u.length>0?u.join(" "):"(sin respuesta)";s.push(`- ${o.question}
631
+ → ${m}`)}),s.join(`
632
+ `)}function dN({turnKey:e,questions:t,onSubmit:s,onDismiss:o,disabled:l}){const c=t.length,[u,p]=x.useState(0),[m,g]=x.useState(()=>t.map(()=>wl()));x.useEffect(()=>{p(0),g(t.map(()=>wl()))},[e,t]);const h=t[u],b=m[u]||wl(),_=!!h?.options&&h.options.length>0,k=!!h?.multiSelect,C=h?.allowText!==!1,y=T=>{g(A=>{const z=[...A],I=z[u]||wl();return z[u]={...I,...T,skipped:!1},z})},w=T=>{g(A=>{const z=[...A],I=z[u]||wl(),D=new Set(I.picked);return k?D.has(T)?D.delete(T):D.add(T):(D.clear(),D.add(T)),z[u]={...I,picked:D,skipped:!1},z})},S=x.useMemo(()=>!0,[]),N=u===c-1,E=()=>p(T=>Math.max(0,T-1)),R=()=>{if(N){s(Gj(t,m));return}p(T=>Math.min(c-1,T+1))},M=()=>{if(g(T=>{const A=[...T];return A[u]={picked:new Set,text:"",skipped:!0},A}),N){const T=m.map((A,z)=>z===u?{picked:new Set,text:"",skipped:!0}:A);s(Gj(t,T))}else p(T=>Math.min(c-1,T+1))};return x.useEffect(()=>{const T=A=>{if(l)return;const z=A.target?.tagName?.toLowerCase(),I=z==="input"||z==="textarea";if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)){A.preventDefault(),R();return}if(!I&&_&&/^[1-9]$/.test(A.key)){const D=parseInt(A.key,10)-1;D<(h?.options?.length||0)&&(A.preventDefault(),w(D))}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)}),!h||c===0?null:r.jsxs("div",{className:Oe("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",l&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[r.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[u+1,"/",c]}),h.header&&r.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:h.header}),r.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),o&&r.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":f("common.close"),children:r.jsx(ps,{className:"size-3.5"})})]}),r.jsxs("div",{className:"space-y-1 px-2 py-2",children:[_&&h.options.map((T,A)=>{const z=b.picked.has(A);return r.jsxs("button",{type:"button",onClick:()=>w(A),className:Oe("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",z?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium",children:T.label}),T.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:T.description})]}),k?r.jsx("span",{className:Oe("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:z&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:Oe("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:A+1})]},`${A}:${T.label}`)}),(C||!_)&&r.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[_&&r.jsx("div",{className:"mb-1 text-xs font-medium",children:f("ask_panel.other")}),r.jsx("input",{type:"text",value:b.text,onChange:T=>y({text:T.target.value}),placeholder:f(_?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),r.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[r.jsx("button",{type:"button",onClick:E,disabled:u===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:f("ask_panel.back")}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:M,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:f("ask_panel.skip")}),r.jsxs("button",{type:"button",onClick:R,disabled:!S,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[f(N?"ask_panel.submit":"ask_panel.next"),r.jsx(tA,{className:"size-3 opacity-60"})]})]})]})]})}function aI(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const t=e,s=typeof t.question=="string"?t.question:"";if(!s)return null;const l=(Array.isArray(t.options)?t.options:[]).map(c=>{if(typeof c=="string")return{label:c};if(c&&typeof c=="object"&&typeof c.label=="string"){const u=c;return{label:u.label,description:typeof u.description=="string"?u.description:void 0}}return null}).filter(c=>c!==null);return{question:s,header:typeof t.header=="string"?t.header:void 0,options:l,multiSelect:t.multiSelect===!0,allowText:t.allowText!==!1}}function fN(e){if(!e.length)return null;const t=e[e.length-1];if(t.role!=="assistant")return null;let s=null,o=-1;for(let g=t.parts.length-1;g>=0;g--){const h=t.parts[g];if(h.kind==="tool"&&h.tool==="ask_questions"){s=h,o=g;break}}if(!s||o<0)return null;let l=null;if(typeof s.result=="string")try{l=JSON.parse(s.result)}catch{l=null}else s.result&&typeof s.result=="object"&&(l=s.result);const c=[];Array.isArray(s.args?.questions)&&c.push(s.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let u=[];for(const g of c)if(u=g.map(aI).filter(h=>!!h),u.length>0)break;return u.length?{turnKey:`${t.ts||""}#${o}`,questions:u}:null}const gx={live:{label:"Live",icon:fs,order:0},telegram:{label:"Telegram",icon:Ya,order:1},voice:{label:"Voice",icon:Rk,order:2},desktop:{label:"Desktop",icon:Tk,order:3},web:{label:"Web",icon:Px,order:4},a2a:{label:"Agent ↔ Agent",icon:gn,order:5},schedule:{label:"Schedule",icon:DA,order:6},other:{label:"Other",icon:zx,order:7}};function sI(e){if(!e)return"web";const t=e.toLowerCase();return t==="telegram"?"telegram":t==="voice"||t==="overlay"?"voice":t==="desktop"?"desktop":t==="web"||t==="sidebar"||t==="web-sidebar"?"web":t==="a2a"||t.startsWith("agent")?"a2a":t==="schedule"||t==="cron"||t==="routine"?"schedule":"other"}function rI({pid:e,slug:t,onLoaded:s}){const{data:o}=Ze(`/projects/${e}/agents/${t}/conversations`,()=>Pb.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{s(t,o)},[t,o]),null}function oI({pid:e,agents:t,superAgentSlug:s,superAgentLabel:o,selected:l,onSelect:c,onNewChat:u}){const[p,m]=x.useState(""),[g,h]=x.useState(""),[b,_]=x.useState({}),[k,C]=x.useState({}),y=(A,z)=>{z&&C(I=>{const D=I[A];return D&&D.length===z.length&&D===z?I:{...I,[A]:z}})},w=x.useMemo(()=>{const A=[];for(const z of t)for(const I of k[z.slug]||[])A.push({...I,agent_slug:I.agent_slug||z.slug});return A},[t,k]),S=x.useMemo(()=>{const A=p.trim().toLowerCase();return w.filter(z=>!(g&&z.agent_slug!==g||A&&!`${z.title||""} ${z.id} ${z.agent_slug}`.toLowerCase().includes(A)))},[w,p,g]),N=x.useMemo(()=>{const A=new Map;for(const z of S){const I=sI(z.channel),D=A.get(I);D?D.push(z):A.set(I,[z])}return Array.from(A.entries()).map(([z,I])=>({key:z,items:I.sort((D,P)=>new Date(P.started_at||0).getTime()-new Date(D.started_at||0).getTime())})).sort((z,I)=>gx[z.key].order-gx[I.key].order)},[S]),E=x.useMemo(()=>{if(g===s)return[{slug:s,label:o}];const A=[];g||A.push({slug:s,label:o});for(const z of t)g&&z.slug!==g||A.push({slug:z.slug,label:z.slug});return A},[t,g,s,o]),R=x.useMemo(()=>[{value:"",label:f("project.chat.list.all_agents")},{value:s,label:o},...t.map(A=>({value:A.slug,label:A.slug}))],[t,s,o]),M=w.length+E.length,T=Object.keys(k).length>0||t.length===0;return r.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(A=>r.jsx(rI,{pid:e,slug:A.slug,onLoaded:y},A.slug)),r.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"truncate text-sm font-semibold",children:f("project.chat.list.title")}),r.jsx("p",{className:"text-[10px] text-muted-fg",children:f("project.chat.list.count",{n:M})})]}),r.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1 rounded-md border border-border bg-accent/60 px-2 py-1 text-[11px] font-medium hover:bg-accent",children:[r.jsx(sn,{className:"size-3"})," ",f("project.chat.list.new")]})]}),r.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[r.jsx(Ae,{value:p,onChange:A=>m(A.target.value),placeholder:f("project.chat.list.search")}),r.jsx(kt,{value:g,onChange:h,options:R})]}),r.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!T&&r.jsx("div",{className:"px-2 py-1",children:r.jsx(ot,{})}),E.length>0&&r.jsx(Yj,{keyName:"live",count:E.length,collapsed:!!b.live,onToggle:()=>_(A=>({...A,live:!A.live})),children:E.map(A=>{const z=A.slug===s,I=l.kind==="live"&&l.agentSlug===A.slug;return r.jsx(Xj,{title:z?A.label:f("project.chat.list.live_with",{slug:A.slug}),subtitle:f("project.chat.list.live_subtitle"),badge:z?"super":A.slug,selected:I,onClick:()=>c({kind:"live",agentSlug:A.slug})},`live-${A.slug}`)})}),N.map(A=>r.jsx(Yj,{keyName:A.key,count:A.items.length,collapsed:!!b[A.key],onToggle:()=>_(z=>({...z,[A.key]:!z[A.key]})),children:A.items.map(z=>{const I=l.kind==="conv"&&l.agentSlug===z.agent_slug&&l.convId===z.id;return r.jsx(Xj,{title:z.title||z.id,subtitle:[z.agent_slug,`${z.messages??0} msg`].filter(Boolean).join(" · "),badge:z.agent_slug,timeAgo:z.started_at,selected:I,onClick:()=>c({kind:"conv",agentSlug:z.agent_slug,convId:z.id})},`${z.agent_slug}-${z.id}`)})},A.key)),T&&w.length===0&&r.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:f("project.chat.list.empty")})]})]})}function Yj({keyName:e,count:t,collapsed:s,onToggle:o,children:l}){const c=gx[e],u=c.icon;return r.jsxs("section",{className:"space-y-1",children:[r.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-between rounded-md px-2 py-1 text-muted-fg hover:bg-accent/30",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s?r.jsx(Bc,{className:"size-3"}):r.jsx(Qs,{className:"size-3"}),r.jsx(u,{className:"size-3"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),r.jsx("span",{className:"text-[10px]",children:t})]}),!s&&r.jsx("div",{className:"space-y-0.5",children:l})]})}function Xj({title:e,subtitle:t,badge:s,timeAgo:o,selected:l,onClick:c}){return r.jsxs("button",{type:"button",onClick:c,className:Cc("w-full rounded-md border px-2.5 py-2 text-left transition-colors",l?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:Cc("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[r.jsx(JM,{className:"size-2.5"}),lI(o)]})]}),r.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:t}),s&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[r.jsx(Bx,{className:"size-2.5"}),s]})]})]})}function lI(e){if(!e)return"";const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const s=Date.now()-t,o=Math.floor(s/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const l=Math.floor(o/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}const Rd="__super_agent__";function iI({pid:e}){const t=lt(),[s]=wf(),o=Ze(`/projects/${e}/agents`,()=>an.list(e)),[l,c]=x.useState(!1),[u,p]=x.useState(""),[m,g]=x.useState(null),{msgs:h,send:b,stop:_,clear:k,load:C,streaming:y,conversationId:w}=W6(e,q=>t.error(q)),S=Bb(),N=s.get("agent"),[E,R]=x.useState(N?{kind:"live",agentSlug:N}:{kind:"live",agentSlug:Rd}),M=o.data||[],T=q=>q===Rd,A=x.useMemo(()=>E.kind==="live"?M.find(q=>q.slug===E.agentSlug):M.find(q=>q.slug===E.agentSlug),[M,E]),z=T(E.agentSlug);x.useEffect(()=>{E.kind==="conv"?C(E.agentSlug,E.convId):w&&k()},[E.kind,E.kind==="conv"?E.convId:E.agentSlug]);const I=async q=>{if(z){await b(q,{model:u||void 0});return}A&&await b(q,{model:u||void 0,agentSlug:A.slug})},D=async q=>{try{await navigator.clipboard.writeText(q),t.info(f("project.chat.copied"))}catch{}},P=()=>{R({kind:"live",agentSlug:Rd}),k()},L=z?f("project.chat.superagent_title",{persona:S}):E.kind==="conv"?E.convId:f("project.chat.title"),U=z?f("project.chat.superagent_subtitle",{persona:S}):E.kind==="conv"?f("project.chat.loaded_subtitle",{slug:E.agentSlug}):f("project.chat.subtitle");return o.isLoading?r.jsx(ot,{}):r.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(oI,{pid:e,agents:M,superAgentSlug:Rd,superAgentLabel:f("agents_ui.super_agent_label",{persona:S}),selected:E,onSelect:R,onNewChat:P}),r.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-sm font-semibold",children:L}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:U})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[z?r.jsx(Ye,{tone:"success",children:f("agents_ui.super_agent_badge")}):A?.model&&r.jsx(Ye,{tone:"info",children:A.model}),E.kind==="conv"&&r.jsx(Ye,{tone:"info",children:w||"…"}),!M.length&&!z&&r.jsxs(de,{variant:"primary",size:"sm",onClick:()=>c(!0),children:[r.jsx(sn,{size:14})," ",f("project.chat.create_agent")]}),r.jsxs(de,{variant:"ghost",size:"sm",disabled:y||h.length===0,onClick:P,children:[r.jsx(ua,{size:13})," ",f("project.chat.clear")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length?r.jsx(av,{msgs:h,onCopy:D}):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.chat.empty")})})}),r.jsx(uN,{msgs:h}),(()=>{const q=y?null:fN(h);return!q||q.turnKey===m?null:r.jsx(dN,{turnKey:q.turnKey,questions:q.questions,onSubmit:$=>void I($),onDismiss:()=>g(q.turnKey),disabled:y})})(),r.jsx(B6,{onSend:I,onStop:_,streaming:y,model:u,onModelChange:p})]}),r.jsx(cI,{open:l,pid:e,onClose:()=>c(!1),onCreated:()=>{c(!1),o.mutate()}})]})}function cI({open:e,onClose:t,onCreated:s,pid:o}){const l=lt(),[c,u]=x.useState(""),[p,m]=x.useState("master"),[g,h]=x.useState(""),[b,_]=x.useState(!0),[k,C]=x.useState(!1),y=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(f("project.agents.slug_invalid"));return}C(!0);try{await an.create(o,{slug:c,role:p,model:g||void 0,is_master:b}),l.success(f("project.agents.created",{slug:c})),u(""),m("master"),h(""),_(!0),s()}catch(w){l.error(w.message)}finally{C(!1)}};return r.jsx(En,{open:e,onClose:t,title:f("project.chat.create_agent_title"),description:f("project.chat.create_agent_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:k,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:y,loading:k,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:"slug",children:r.jsx(Ae,{autoFocus:!0,value:c,onChange:w=>u(w.target.value),placeholder:"master"})}),r.jsx(ue,{label:f("project.chat.role_label"),children:r.jsx(Ae,{value:p,onChange:w=>m(w.target.value),placeholder:"master"})}),r.jsx(ue,{label:f("project.chat.model_label"),hint:f("project.chat.model_hint"),children:r.jsx(Ae,{value:g,onChange:w=>h(w.target.value)})}),r.jsx(Wt,{checked:b,onChange:_,label:f("project.chat.master_label")})]})})}function uI({pid:e}){const t=lt(),{project:s}=Lb(e),{channels:o,isLoading:l,mutate:c}=$b(),u=String(e),p=s?.name||s?.path?.split("/").pop()||u,m=`proj-${u}`,g=o.find(A=>A.project===u||A.project===p||A.name===m),[h,b]=x.useState(!!g),[_,k]=x.useState(""),[C,y]=x.useState(""),[w,S]=x.useState(""),[N,E]=x.useState(!0),[R,M]=x.useState(!1);if(x.useEffect(()=>{g?(b(!0),k(""),y(g.chat_id||""),S(g.route_to_agent||""),E(g.respond_with_engine??!0)):(b(!1),k(""),y(""),S(""),E(!0))},[g?.name,g?.chat_id,g?.route_to_agent]),l)return r.jsx(ot,{});const T=async()=>{M(!0);try{if(!h){g&&(await Nn.channels.remove(g.name),t.success(f("project.telegram.cleared"))),await c();return}const A={name:g?.name||m,project:u,chat_id:C,route_to_agent:w,respond_with_engine:N,..._?{bot_token:_}:{}};g?await Nn.channels.patch(g.name,A):await Nn.channels.upsert(A),t.success(f("project.telegram.saved")),await c(),k("")}catch(A){t.error(A.message)}finally{M(!1)}};return r.jsx(Ke,{title:f("project.telegram.title"),description:f("project.telegram.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Wt,{checked:h,onChange:b,label:f(h?"project.telegram.override_active":"project.telegram.use_default")}),g&&r.jsx(Ye,{tone:"success",children:f("project.telegram.channel_badge",{name:g.name})})]}),h&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.telegram.bot_token"),hint:g?.bot_token?`${Tr(g.bot_token)} ${f("telegram_ui.empty_keep")}`:f("project.telegram.bot_hint_none"),children:r.jsx(Ae,{type:"password",value:_,onChange:A=>k(A.target.value),placeholder:g?.bot_token?Tr(g.bot_token):""})}),r.jsx(ue,{label:f("project.telegram.chat_id"),children:r.jsx(Ae,{value:C,onChange:A=>y(A.target.value)})}),r.jsx(ue,{label:f("project.telegram.route_agent"),hint:f("project.telegram.route_hint"),children:r.jsx(Ae,{value:w,onChange:A=>S(A.target.value)})})]}),r.jsx(Wt,{checked:N,onChange:E,label:f("project.telegram.respond_engine")})]}),r.jsx("div",{className:"pt-2",children:r.jsx(de,{variant:"primary",loading:R,onClick:T,children:f("common.save")})}),!h&&!g&&r.jsx(ht,{children:f("project.telegram.no_override")})]})})}function pN({load:e,save:t,rows:s=10,placeholder:o}){const l=lt(),[c,u]=x.useState(null),[p,m]=x.useState(""),[g,h]=x.useState(!1);if(x.useEffect(()=>{let k=!0;return e().then(C=>{k&&(u(C),m(C))}).catch(()=>{k&&(u(""),m(""))}),()=>{k=!1}},[e]),c===null)return r.jsx(ot,{});const b=p!==c,_=async()=>{h(!0);try{await t(p),u(p),l.success(f("project.memories.saved"))}catch(k){l.error(k.message)}finally{h(!1)}};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(Pn,{rows:s,className:"font-mono text-xs",value:p,onChange:k=>m(k.target.value),placeholder:o}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[p.length," ",f("project.memories.chars")]}),r.jsxs(de,{size:"sm",variant:"primary",loading:g,disabled:!b,onClick:_,children:[r.jsx(Nf,{size:12})," ",f("project.memories.save_btn")]})]})]})}function dI({pid:e,agent:t}){const[s,o]=x.useState(!1),l=t.is_master?Fs:gn;return r.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[r.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?r.jsx(Qs,{size:14,className:"text-muted-fg"}):r.jsx(Bc,{size:14,className:"text-muted-fg"}),r.jsx(l,{size:14,className:t.is_master?"text-violet-400":"text-muted-fg"}),r.jsx("span",{className:"text-sm font-medium",children:t.slug}),t.role&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",t.role]})]}),s&&r.jsx("div",{className:"border-t border-border p-3",children:r.jsx(pN,{rows:8,load:()=>an.memory.get(e,t.slug).then(c=>c.body),save:c=>an.memory.put(e,t.slug,c).then(()=>{})})})]})}function fI({pid:e}){const t=Ze(`/projects/${e}/agents`,()=>an.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("project.memories.project_title"),description:f("project.memories.project_desc"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-indigo-600",children:r.jsx(Gd,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(pN,{rows:12,load:()=>la.memory.get(e).then(s=>s.body),save:s=>la.memory.put(e,s).then(()=>{}),placeholder:f("project.memories.project_ph")})})]})}),r.jsxs(Ke,{title:f("project.memories.agents_title"),description:f("project.memories.agents_desc"),children:[t.isLoading&&r.jsx(ot,{}),!t.isLoading&&(t.data?.length??0)===0&&r.jsx(ht,{children:f("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(t.data||[]).map(s=>r.jsx(dI,{pid:e,agent:s},s.slug))})]})]})}function pI(e,t){var s,o=1;e==null&&(e=0),t==null&&(t=0);function l(){var c,u=s.length,p,m=0,g=0;for(c=0;c<u;++c)p=s[c],m+=p.x,g+=p.y;for(m=(m/u-e)*o,g=(g/u-t)*o,c=0;c<u;++c)p=s[c],p.x-=m,p.y-=g}return l.initialize=function(c){s=c},l.x=function(c){return arguments.length?(e=+c,l):e},l.y=function(c){return arguments.length?(t=+c,l):t},l.strength=function(c){return arguments.length?(o=+c,l):o},l}function mI(e){const t=+this._x.call(null,e),s=+this._y.call(null,e);return mN(this.cover(t,s),t,s,e)}function mN(e,t,s,o){if(isNaN(t)||isNaN(s))return e;var l,c=e._root,u={data:o},p=e._x0,m=e._y0,g=e._x1,h=e._y1,b,_,k,C,y,w,S,N;if(!c)return e._root=u,e;for(;c.length;)if((y=t>=(b=(p+g)/2))?p=b:g=b,(w=s>=(_=(m+h)/2))?m=_:h=_,l=c,!(c=c[S=w<<1|y]))return l[S]=u,e;if(k=+e._x.call(null,c.data),C=+e._y.call(null,c.data),t===k&&s===C)return u.next=c,l?l[S]=u:e._root=u,e;do l=l?l[S]=new Array(4):e._root=new Array(4),(y=t>=(b=(p+g)/2))?p=b:g=b,(w=s>=(_=(m+h)/2))?m=_:h=_;while((S=w<<1|y)===(N=(C>=_)<<1|k>=b));return l[N]=c,l[S]=u,e}function gI(e){var t,s,o=e.length,l,c,u=new Array(o),p=new Array(o),m=1/0,g=1/0,h=-1/0,b=-1/0;for(s=0;s<o;++s)isNaN(l=+this._x.call(null,t=e[s]))||isNaN(c=+this._y.call(null,t))||(u[s]=l,p[s]=c,l<m&&(m=l),l>h&&(h=l),c<g&&(g=c),c>b&&(b=c));if(m>h||g>b)return this;for(this.cover(m,g).cover(h,b),s=0;s<o;++s)mN(this,u[s],p[s],e[s]);return this}function hI(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var s=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(s))l=(s=Math.floor(e))+1,c=(o=Math.floor(t))+1;else{for(var u=l-s||1,p=this._root,m,g;s>e||e>=l||o>t||t>=c;)switch(g=(t<o)<<1|e<s,m=new Array(4),m[g]=p,p=m,u*=2,g){case 0:l=s+u,c=o+u;break;case 1:s=l-u,c=o+u;break;case 2:l=s+u,o=c-u;break;case 3:s=l-u,o=c-u;break}this._root&&this._root.length&&(this._root=p)}return this._x0=s,this._y0=o,this._x1=l,this._y1=c,this}function xI(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function bI(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Yn(e,t,s,o,l){this.node=e,this.x0=t,this.y0=s,this.x1=o,this.y1=l}function vI(e,t,s){var o,l=this._x0,c=this._y0,u,p,m,g,h=this._x1,b=this._y1,_=[],k=this._root,C,y;for(k&&_.push(new Yn(k,l,c,h,b)),s==null?s=1/0:(l=e-s,c=t-s,h=e+s,b=t+s,s*=s);C=_.pop();)if(!(!(k=C.node)||(u=C.x0)>h||(p=C.y0)>b||(m=C.x1)<l||(g=C.y1)<c))if(k.length){var w=(u+m)/2,S=(p+g)/2;_.push(new Yn(k[3],w,S,m,g),new Yn(k[2],u,S,w,g),new Yn(k[1],w,p,m,S),new Yn(k[0],u,p,w,S)),(y=(t>=S)<<1|e>=w)&&(C=_[_.length-1],_[_.length-1]=_[_.length-1-y],_[_.length-1-y]=C)}else{var N=e-+this._x.call(null,k.data),E=t-+this._y.call(null,k.data),R=N*N+E*E;if(R<s){var M=Math.sqrt(s=R);l=e-M,c=t-M,h=e+M,b=t+M,o=k.data}}return o}function _I(e){if(isNaN(h=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,s=this._root,o,l,c,u=this._x0,p=this._y0,m=this._x1,g=this._y1,h,b,_,k,C,y,w,S;if(!s)return this;if(s.length)for(;;){if((C=h>=(_=(u+m)/2))?u=_:m=_,(y=b>=(k=(p+g)/2))?p=k:g=k,t=s,!(s=s[w=y<<1|C]))return this;if(!s.length)break;(t[w+1&3]||t[w+2&3]||t[w+3&3])&&(o=t,S=w)}for(;s.data!==e;)if(l=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,l?(c?l.next=c:delete l.next,this):t?(c?t[w]=c:delete t[w],(s=t[0]||t[1]||t[2]||t[3])&&s===(t[3]||t[2]||t[1]||t[0])&&!s.length&&(o?o[S]=s:this._root=s),this):(this._root=c,this)}function yI(e){for(var t=0,s=e.length;t<s;++t)this.remove(e[t]);return this}function jI(){return this._root}function wI(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function kI(e){var t=[],s,o=this._root,l,c,u,p,m;for(o&&t.push(new Yn(o,this._x0,this._y0,this._x1,this._y1));s=t.pop();)if(!e(o=s.node,c=s.x0,u=s.y0,p=s.x1,m=s.y1)&&o.length){var g=(c+p)/2,h=(u+m)/2;(l=o[3])&&t.push(new Yn(l,g,h,p,m)),(l=o[2])&&t.push(new Yn(l,c,h,g,m)),(l=o[1])&&t.push(new Yn(l,g,u,p,h)),(l=o[0])&&t.push(new Yn(l,c,u,g,h))}return this}function SI(e){var t=[],s=[],o;for(this._root&&t.push(new Yn(this._root,this._x0,this._y0,this._x1,this._y1));o=t.pop();){var l=o.node;if(l.length){var c,u=o.x0,p=o.y0,m=o.x1,g=o.y1,h=(u+m)/2,b=(p+g)/2;(c=l[0])&&t.push(new Yn(c,u,p,h,b)),(c=l[1])&&t.push(new Yn(c,h,p,m,b)),(c=l[2])&&t.push(new Yn(c,u,b,h,g)),(c=l[3])&&t.push(new Yn(c,h,b,m,g))}s.push(o)}for(;o=s.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function CI(e){return e[0]}function NI(e){return arguments.length?(this._x=e,this):this._x}function EI(e){return e[1]}function RI(e){return arguments.length?(this._y=e,this):this._y}function sv(e,t,s){var o=new rv(t??CI,s??EI,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function rv(e,t,s,o,l,c){this._x=e,this._y=t,this._x0=s,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function Kj(e){for(var t={data:e.data},s=t;e=e.next;)s=s.next={data:e.data};return t}var Wn=sv.prototype=rv.prototype;Wn.copy=function(){var e=new rv(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,s,o;if(!t)return e;if(!t.length)return e._root=Kj(t),e;for(s=[{source:t,target:e._root=new Array(4)}];t=s.pop();)for(var l=0;l<4;++l)(o=t.source[l])&&(o.length?s.push({source:o,target:t.target[l]=new Array(4)}):t.target[l]=Kj(o));return e};Wn.add=mI;Wn.addAll=gI;Wn.cover=hI;Wn.data=xI;Wn.extent=bI;Wn.find=vI;Wn.remove=_I;Wn.removeAll=yI;Wn.root=jI;Wn.size=wI;Wn.visit=kI;Wn.visitAfter=SI;Wn.x=NI;Wn.y=RI;function xo(e){return function(){return e}}function Nr(e){return(e()-.5)*1e-6}function TI(e){return e.x+e.vx}function MI(e){return e.y+e.vy}function AI(e){var t,s,o,l=1,c=1;typeof e!="function"&&(e=xo(e==null?1:+e));function u(){for(var g,h=t.length,b,_,k,C,y,w,S=0;S<c;++S)for(b=sv(t,TI,MI).visitAfter(p),g=0;g<h;++g)_=t[g],y=s[_.index],w=y*y,k=_.x+_.vx,C=_.y+_.vy,b.visit(N);function N(E,R,M,T,A){var z=E.data,I=E.r,D=y+I;if(z){if(z.index>_.index){var P=k-z.x-z.vx,L=C-z.y-z.vy,U=P*P+L*L;U<D*D&&(P===0&&(P=Nr(o),U+=P*P),L===0&&(L=Nr(o),U+=L*L),U=(D-(U=Math.sqrt(U)))/U*l,_.vx+=(P*=U)*(D=(I*=I)/(w+I)),_.vy+=(L*=U)*D,z.vx-=P*(D=1-D),z.vy-=L*D)}return}return R>k+D||T<k-D||M>C+D||A<C-D}}function p(g){if(g.data)return g.r=s[g.data.index];for(var h=g.r=0;h<4;++h)g[h]&&g[h].r>g.r&&(g.r=g[h].r)}function m(){if(t){var g,h=t.length,b;for(s=new Array(h),g=0;g<h;++g)b=t[g],s[b.index]=+e(b,g,t)}}return u.initialize=function(g,h){t=g,o=h,m()},u.iterations=function(g){return arguments.length?(c=+g,u):c},u.strength=function(g){return arguments.length?(l=+g,u):l},u.radius=function(g){return arguments.length?(e=typeof g=="function"?g:xo(+g),m(),u):e},u}function OI(e){return e.index}function Qj(e,t){var s=e.get(t);if(!s)throw new Error("node not found: "+t);return s}function zI(e){var t=OI,s=b,o,l=xo(30),c,u,p,m,g,h=1;e==null&&(e=[]);function b(w){return 1/Math.min(p[w.source.index],p[w.target.index])}function _(w){for(var S=0,N=e.length;S<h;++S)for(var E=0,R,M,T,A,z,I,D;E<N;++E)R=e[E],M=R.source,T=R.target,A=T.x+T.vx-M.x-M.vx||Nr(g),z=T.y+T.vy-M.y-M.vy||Nr(g),I=Math.sqrt(A*A+z*z),I=(I-c[E])/I*w*o[E],A*=I,z*=I,T.vx-=A*(D=m[E]),T.vy-=z*D,M.vx+=A*(D=1-D),M.vy+=z*D}function k(){if(u){var w,S=u.length,N=e.length,E=new Map(u.map((M,T)=>[t(M,T,u),M])),R;for(w=0,p=new Array(S);w<N;++w)R=e[w],R.index=w,typeof R.source!="object"&&(R.source=Qj(E,R.source)),typeof R.target!="object"&&(R.target=Qj(E,R.target)),p[R.source.index]=(p[R.source.index]||0)+1,p[R.target.index]=(p[R.target.index]||0)+1;for(w=0,m=new Array(N);w<N;++w)R=e[w],m[w]=p[R.source.index]/(p[R.source.index]+p[R.target.index]);o=new Array(N),C(),c=new Array(N),y()}}function C(){if(u)for(var w=0,S=e.length;w<S;++w)o[w]=+s(e[w],w,e)}function y(){if(u)for(var w=0,S=e.length;w<S;++w)c[w]=+l(e[w],w,e)}return _.initialize=function(w,S){u=w,g=S,k()},_.links=function(w){return arguments.length?(e=w,k(),_):e},_.id=function(w){return arguments.length?(t=w,_):t},_.iterations=function(w){return arguments.length?(h=+w,_):h},_.strength=function(w){return arguments.length?(s=typeof w=="function"?w:xo(+w),C(),_):s},_.distance=function(w){return arguments.length?(l=typeof w=="function"?w:xo(+w),y(),_):l},_}var DI={value:()=>{}};function gN(){for(var e=0,t=arguments.length,s={},o;e<t;++e){if(!(o=arguments[e]+"")||o in s||/[\s.]/.test(o))throw new Error("illegal type: "+o);s[o]=[]}return new Vd(s)}function Vd(e){this._=e}function PI(e,t){return e.trim().split(/^|\s+/).map(function(s){var o="",l=s.indexOf(".");if(l>=0&&(o=s.slice(l+1),s=s.slice(0,l)),s&&!t.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:o}})}Vd.prototype=gN.prototype={constructor:Vd,on:function(e,t){var s=this._,o=PI(e+"",s),l,c=-1,u=o.length;if(arguments.length<2){for(;++c<u;)if((l=(e=o[c]).type)&&(l=LI(s[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++c<u;)if(l=(e=o[c]).type)s[l]=Zj(s[l],e.name,t);else if(t==null)for(l in s)s[l]=Zj(s[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var s in t)e[s]=t[s].slice();return new Vd(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var s=new Array(l),o=0,l,c;o<l;++o)s[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],o=0,l=c.length;o<l;++o)c[o].value.apply(t,s)},apply:function(e,t,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],l=0,c=o.length;l<c;++l)o[l].value.apply(t,s)}};function LI(e,t){for(var s=0,o=e.length,l;s<o;++s)if((l=e[s]).name===t)return l.value}function Zj(e,t,s){for(var o=0,l=e.length;o<l;++o)if(e[o].name===t){e[o]=DI,e=e.slice(0,o).concat(e.slice(o+1));break}return s!=null&&e.push({name:t,value:s}),e}var Xl=0,hc=0,sc=0,hN=1e3,bf,xc,vf=0,ko=0,ap=0,Oc=typeof performance=="object"&&performance.now?performance:Date,xN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bN(){return ko||(xN(II),ko=Oc.now()+ap)}function II(){ko=0}function hx(){this._call=this._time=this._next=null}hx.prototype=vN.prototype={constructor:hx,restart:function(e,t,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?bN():+s)+(t==null?0:+t),!this._next&&xc!==this&&(xc?xc._next=this:bf=this,xc=this),this._call=e,this._time=s,xx()},stop:function(){this._call&&(this._call=null,this._time=1/0,xx())}};function vN(e,t,s){var o=new hx;return o.restart(e,t,s),o}function BI(){bN(),++Xl;for(var e=bf,t;e;)(t=ko-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xl}function Wj(){ko=(vf=Oc.now())+ap,Xl=hc=0;try{BI()}finally{Xl=0,HI(),ko=0}}function UI(){var e=Oc.now(),t=e-vf;t>hN&&(ap-=t,vf=e)}function HI(){for(var e,t=bf,s,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(s=t._next,t._next=null,t=e?e._next=s:bf=s);xc=e,xx(o)}function xx(e){if(!Xl){hc&&(hc=clearTimeout(hc));var t=e-ko;t>24?(e<1/0&&(hc=setTimeout(Wj,e-Oc.now()-ap)),sc&&(sc=clearInterval(sc))):(sc||(vf=Oc.now(),sc=setInterval(UI,hN)),Xl=1,xN(Wj))}}const VI=1664525,qI=1013904223,Jj=4294967296;function $I(){let e=1;return()=>(e=(VI*e+qI)%Jj)/Jj}function FI(e){return e.x}function GI(e){return e.y}var YI=10,XI=Math.PI*(3-Math.sqrt(5));function KI(e){var t,s=1,o=.001,l=1-Math.pow(o,1/300),c=0,u=.6,p=new Map,m=vN(b),g=gN("tick","end"),h=$I();e==null&&(e=[]);function b(){_(),g.call("tick",t),s<o&&(m.stop(),g.call("end",t))}function _(y){var w,S=e.length,N;y===void 0&&(y=1);for(var E=0;E<y;++E)for(s+=(c-s)*l,p.forEach(function(R){R(s)}),w=0;w<S;++w)N=e[w],N.fx==null?N.x+=N.vx*=u:(N.x=N.fx,N.vx=0),N.fy==null?N.y+=N.vy*=u:(N.y=N.fy,N.vy=0);return t}function k(){for(var y=0,w=e.length,S;y<w;++y){if(S=e[y],S.index=y,S.fx!=null&&(S.x=S.fx),S.fy!=null&&(S.y=S.fy),isNaN(S.x)||isNaN(S.y)){var N=YI*Math.sqrt(.5+y),E=y*XI;S.x=N*Math.cos(E),S.y=N*Math.sin(E)}(isNaN(S.vx)||isNaN(S.vy))&&(S.vx=S.vy=0)}}function C(y){return y.initialize&&y.initialize(e,h),y}return k(),t={tick:_,restart:function(){return m.restart(b),t},stop:function(){return m.stop(),t},nodes:function(y){return arguments.length?(e=y,k(),p.forEach(C),t):e},alpha:function(y){return arguments.length?(s=+y,t):s},alphaMin:function(y){return arguments.length?(o=+y,t):o},alphaDecay:function(y){return arguments.length?(l=+y,t):+l},alphaTarget:function(y){return arguments.length?(c=+y,t):c},velocityDecay:function(y){return arguments.length?(u=1-y,t):1-u},randomSource:function(y){return arguments.length?(h=y,p.forEach(C),t):h},force:function(y,w){return arguments.length>1?(w==null?p.delete(y):p.set(y,C(w)),t):p.get(y)},find:function(y,w,S){var N=0,E=e.length,R,M,T,A,z;for(S==null?S=1/0:S*=S,N=0;N<E;++N)A=e[N],R=y-A.x,M=w-A.y,T=R*R+M*M,T<S&&(z=A,S=T);return z},on:function(y,w){return arguments.length>1?(g.on(y,w),t):g.on(y)}}}function QI(){var e,t,s,o,l=xo(-30),c,u=1,p=1/0,m=.81;function g(k){var C,y=e.length,w=sv(e,FI,GI).visitAfter(b);for(o=k,C=0;C<y;++C)t=e[C],w.visit(_)}function h(){if(e){var k,C=e.length,y;for(c=new Array(C),k=0;k<C;++k)y=e[k],c[y.index]=+l(y,k,e)}}function b(k){var C=0,y,w,S=0,N,E,R;if(k.length){for(N=E=R=0;R<4;++R)(y=k[R])&&(w=Math.abs(y.value))&&(C+=y.value,S+=w,N+=w*y.x,E+=w*y.y);k.x=N/S,k.y=E/S}else{y=k,y.x=y.data.x,y.y=y.data.y;do C+=c[y.data.index];while(y=y.next)}k.value=C}function _(k,C,y,w){if(!k.value)return!0;var S=k.x-t.x,N=k.y-t.y,E=w-C,R=S*S+N*N;if(E*E/m<R)return R<p&&(S===0&&(S=Nr(s),R+=S*S),N===0&&(N=Nr(s),R+=N*N),R<u&&(R=Math.sqrt(u*R)),t.vx+=S*k.value*o/R,t.vy+=N*k.value*o/R),!0;if(k.length||R>=p)return;(k.data!==t||k.next)&&(S===0&&(S=Nr(s),R+=S*S),N===0&&(N=Nr(s),R+=N*N),R<u&&(R=Math.sqrt(u*R)));do k.data!==t&&(E=c[k.data.index]*o/R,t.vx+=S*E,t.vy+=N*E);while(k=k.next)}return g.initialize=function(k,C){e=k,s=C,h()},g.strength=function(k){return arguments.length?(l=typeof k=="function"?k:xo(+k),h(),g):l},g.distanceMin=function(k){return arguments.length?(u=k*k,g):Math.sqrt(u)},g.distanceMax=function(k){return arguments.length?(p=k*k,g):Math.sqrt(p)},g.theta=function(k){return arguments.length?(m=k*k,g):Math.sqrt(m)},g}const rc={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"};function ZI(){return{agent:f("agents_ui.kind_agent"),memory:f("agents_ui.kind_memory"),thread:f("agents_ui.kind_thread"),task:f("agents_ui.kind_task"),routine:f("agents_ui.kind_routine"),agentlink:f("agents_ui.kind_hierarchy")}}const oc=760,lc=460;function WI({center:e,nodes:t}){const s=x.useRef(null),o=x.useRef(null),l=x.useRef([]),c=x.useRef([]),u=x.useRef(null),[,p]=x.useState(0),[m,g]=x.useState(null);x.useEffect(()=>{const w={id:"__center",label:e,kind:"agent",relation:"self",x:oc/2,y:lc/2,fx:oc/2,fy:lc/2},S=[w,...t.map(R=>({...R}))],N=S.slice(1).map(R=>({source:w,target:R}));l.current=S,c.current=N;const E=KI(S).force("link",zI(N).distance(120).strength(.5)).force("charge",QI().strength(-220)).force("center",pI(oc/2,lc/2).strength(.05)).force("collide",AI(26)).on("tick",()=>p(R=>R+1));return o.current=E,()=>{E.stop()}},[e,t]);const h=w=>{const S=s.current.getBoundingClientRect();return{x:(w.clientX-S.left)/S.width*oc,y:(w.clientY-S.top)/S.height*lc}},b=w=>S=>{w.id!=="__center"&&(u.current=w,S.target.setPointerCapture?.(S.pointerId),o.current?.alphaTarget(.3).restart())},_=w=>{const S=u.current;if(!S)return;const{x:N,y:E}=h(w);S.fx=N,S.fy=E},k=()=>{const w=u.current;w&&(w.fx=null,w.fy=null),u.current=null,o.current?.alphaTarget(0)},C=l.current,y=c.current;return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:r.jsxs("svg",{ref:s,viewBox:`0 0 ${oc} ${lc}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:_,onPointerUp:k,onPointerLeave:k,children:[y.map((w,S)=>r.jsx("line",{x1:w.source.x,y1:w.source.y,x2:w.target.x,y2:w.target.y,stroke:rc[w.target.kind],strokeOpacity:.22,strokeWidth:1.5},S)),C.map(w=>{if(w.id==="__center")return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,children:[r.jsx("circle",{r:22,fill:rc.agent}),r.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},w.id);const S=m?.id===w.id;return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(w),onClick:()=>g(w),children:[r.jsx("circle",{r:S?9:6,fill:rc[w.kind],fillOpacity:S?1:.9,stroke:S?"#fff":"none",strokeWidth:S?2:0}),r.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:w.label.length>22?`${w.label.slice(0,22)}…`:w.label})]},w.id)})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[(()=>{const w=ZI();return Object.keys(w).filter(S=>S!=="agent").map(S=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:rc[S]}})," ",w[S]]},S))})(),r.jsx("span",{className:"ml-auto",children:f("agents_ui.nodes_drag_hint",{n:String(t.length)})})]}),m&&r.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:rc[m.kind]}}),r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-muted-fg",children:["· ",m.relation]})]}),m.detail&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:m.detail})]})]})}function JI(){return[{key:"overview",label:f("agents_ui.tab_explorer"),icon:Sf},{key:"memories",label:f("project.nav.memories"),icon:Gd},{key:"records",label:f("project.agent_detail.records_title"),icon:vk},{key:"sleep",label:f("project.agent_detail.sleep_title"),icon:Dl},{key:"brain",label:f("project.agent_detail.brain_title"),icon:fs},{key:"config",label:f("settings.tabs.advanced"),icon:Zd}]}function e8(){return[{value:"",label:f("agents_ui.type_none")},{value:"orchestrator",label:f("agents_ui.type_orchestrator"),description:f("agents_ui.type_orchestrator_desc")},{value:"specialist",label:f("agents_ui.type_specialist"),description:f("agents_ui.type_specialist_desc")},{value:"assistant",label:f("agents_ui.type_assistant"),description:f("agents_ui.type_assistant_desc")},{value:"worker",label:f("agents_ui.type_worker"),description:f("agents_ui.type_worker_desc")},{value:"monitor",label:f("agents_ui.type_monitor"),description:f("agents_ui.type_monitor_desc")}]}const bx=e=>e.split(",").map(t=>t.trim()).filter(Boolean),t8=(e,t)=>e.filter(s=>s.spec?.agent===t||t==="super-agent"&&s.kind==="super_agent");function n8(e){return e.split(`
633
+ `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function a8({pid:e}){const{slug:t=""}=ck(),s=Zn(),[o,l]=x.useState("overview"),c=JI(),u=Ze(`/projects/${e}/agents/${t}`,()=>an.get(e,t)),p=Ze(`/projects/${e}/agents`,()=>an.list(e)),m=Ze(`/projects/${e}/routines`,()=>wr.list(e)),g=Ze(`/projects/${e}/messages?agent=${t}`,()=>ff.project(e,{agent:t,limit:200})),h=Ze(`/projects/${e}/agents/${t}/conversations`,()=>Pb.list(e,t)),b=Ze(`/projects/${e}/tasks?all`,()=>kr.list(e,"all")),_=u.data,k=t8(m.data||[],t),C=(b.data||[]).filter(S=>S.agent===t),y=(p.data||[]).filter(S=>S.parent===t);if(u.isLoading)return r.jsx(ot,{});if(!_)return r.jsx("div",{className:"text-sm text-muted-fg",children:f("project.agent_detail.not_found")});const w=_.is_master?Fs:gn;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:r.jsx(qM,{size:16})}),r.jsx("div",{className:Oe("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",_.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:r.jsx(w,{className:"size-5 text-white"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-lg font-semibold",children:_.slug}),_.is_master&&r.jsxs(Ye,{tone:"success",children:[r.jsx(Fs,{size:10})," ",f("project.agents.orchestrator")]}),_.role&&r.jsx(Ye,{children:_.role}),_.model&&r.jsx(Ye,{tone:"info",children:_.model}),_.parent&&r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${_.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[f("project.agent_detail.reports_to")," ",_.parent]})]}),_.description&&r.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:_.description})]})]}),r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${t}`),children:[r.jsx(Ya,{size:13})," ",f("project.agent_detail.chat_btn",{slug:_.slug})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:S,label:N,icon:E})=>r.jsxs("button",{onClick:()=>l(S),className:Oe("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===S?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[r.jsx(E,{size:14})," ",N]},S))}),o==="overview"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(Td,{label:f("agents_ui.stat_threads"),value:h.data?.length??0,icon:Kd}),r.jsx(Td,{label:f("agents_ui.stat_records"),value:g.data?.length??0,icon:vk}),r.jsx(Td,{label:f("agents_ui.stat_tasks"),value:C.length,icon:Sf}),r.jsx(Td,{label:f("agents_ui.stat_heartbeats"),value:k.length,icon:Dl})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(Ke,{title:f("agent_detail_extra.skills_title"),description:"",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[_.skills?.map(S=>r.jsxs(Ye,{tone:"info",children:[r.jsx(fs,{size:10})," ",S]},S)),_.tools?.map(S=>r.jsxs(Ye,{children:[r.jsx(Jl,{size:10})," ",S]},S)),!_.skills?.length&&!_.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx(Ke,{title:f("project.agent_detail.threads_recent"),description:"",children:r.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(S=>r.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[r.jsx("span",{className:"truncate",children:S.title||S.filename}),r.jsxs("span",{className:"shrink-0 text-muted-fg",children:[S.messages??0," ",f("project.agent_detail.msgs_count")]})]},S.id)),!h.data?.length&&r.jsx("li",{className:"text-muted-fg",children:f("project.agent_detail.no_threads")})]})})]}),y.length>0&&r.jsx(Ke,{title:f("project.agent_detail.subagents"),description:f("project.agent_detail.subagents_desc"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(S=>r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${S.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[r.jsx(gn,{size:14,className:"text-muted-fg"})," ",S.slug]},S.slug))})})]}),o==="memories"&&r.jsx(r8,{pid:e,slug:t,initial:_.memory||"",onSaved:()=>u.mutate()}),o==="records"&&r.jsx(o8,{records:g.data||[],loading:g.isLoading}),o==="sleep"&&r.jsx(l8,{routines:k}),o==="brain"&&r.jsx(c8,{slug:t,memory:_.memory||"",threads:(h.data||[]).map(S=>({id:S.id,label:S.title||S.filename})),tasks:C.map(S=>({id:S.id,label:S.title,detail:S.body||void 0})),routines:k,parent:_.parent||null,children:y.map(S=>S.slug)}),o==="config"&&r.jsx(s8,{pid:e,agent:_,agents:p.data||[],onSaved:()=>{u.mutate(),p.mutate()},onDeleted:()=>{p.mutate(),s(`/p/${e}/agents`)}})]})}function s8({pid:e,agent:t,agents:s,onSaved:o,onDeleted:l}){const c=lt(),[u,p]=x.useState(t.type||""),[m,g]=x.useState(t.area||""),[h,b]=x.useState(t.role||""),[_,k]=x.useState(t.model||""),[C,y]=x.useState(t.parent||""),[w,S]=x.useState(!!t.is_master),[N,E]=x.useState((t.skills||[]).join(", ")),[R,M]=x.useState((t.tools||[]).join(", ")),[T,A]=x.useState(t.description||""),[z,I]=x.useState(t.system||""),[D,P]=x.useState(!1),L=async()=>{P(!0);try{await an.update(e,t.slug,{type:u||null,area:m||null,role:h||null,model:_||null,parent:C||null,is_master:w||u==="orchestrator",skills:bx(N),tools:bx(R),description:T||null,system:z}),c.success(f("project.agent_detail.update_success")),o()}catch(q){c.error(q.message)}finally{P(!1)}},U=async()=>{if(confirm(f("project.agent_detail.delete_confirm",{slug:t.slug})))try{await an.remove(e,t.slug),c.success(f("project.agent_detail.delete_success")),l()}catch(q){c.error(q.message)}};return r.jsx(Ke,{title:f("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${f("agents_ui.config_def_desc")}`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.agent_detail.type_label"),children:r.jsx(kt,{value:u,onChange:p,options:e8()})}),r.jsx(ue,{label:f("project.agent_detail.area_label"),hint:f("project.agent_detail.area_hint"),children:r.jsx(Ae,{value:m,onChange:q=>g(q.target.value),placeholder:f("project.agent_detail.area_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("project.agent_detail.role_label"),children:r.jsx(Ae,{value:h,onChange:q=>b(q.target.value),placeholder:"Operations Lead"})}),r.jsx(ue,{label:f("project.agent_detail.parent_label"),children:r.jsx(kt,{value:C,onChange:y,placeholder:f("project.agent_detail.none_parent"),options:[{value:"",label:f("project.agent_detail.none_parent")},...s.filter(q=>q.slug!==t.slug).map(q=>({value:q.slug,label:q.slug}))]})})]}),r.jsx(ue,{label:f("project.agent_detail.model_label"),hint:f("project.agent_detail.model_hint"),children:r.jsx(Ae,{value:_,onChange:q=>k(q.target.value),placeholder:f("project.agent_detail.model_ph")})}),r.jsx(ue,{label:f("project.agent_detail.skills_label"),children:r.jsx(Ae,{value:N,onChange:q=>E(q.target.value),placeholder:"skill-a, skill-b"})}),r.jsx(i8,{value:R,onChange:M}),r.jsx(ue,{label:f("project.agent_detail.bio_label"),children:r.jsx(Pn,{rows:2,value:T,onChange:q=>A(q.target.value)})}),r.jsx(ue,{label:f("project.agent_detail.system_label"),hint:f("project.agent_detail.system_hint"),children:r.jsx(Pn,{rows:10,className:"font-mono text-xs",value:z,onChange:q=>I(q.target.value),placeholder:"You are…"})}),r.jsx(Wt,{checked:w,onChange:S,label:f("project.agent_detail.master_label")}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[r.jsxs(de,{variant:"destructive",onClick:U,children:[r.jsx(ua,{size:13})," ",f("project.agent_detail.delete_btn")]}),r.jsxs(de,{variant:"primary",loading:D,onClick:L,children:[r.jsx(Nf,{size:13})," ",f("project.agent_detail.save_btn")]})]})]})})}function Td({label:e,value:t,icon:s}){return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(s,{size:13})," ",e]}),r.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function r8({pid:e,slug:t,initial:s,onSaved:o}){const l=lt(),[c,u]=x.useState(s),[p,m]=x.useState(!1);x.useEffect(()=>{u(s)},[s]);const g=c!==s,h=async()=>{m(!0);try{await an.memory.put(e,t,c),l.success(f("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{m(!1)}};return r.jsxs(Ke,{title:f("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${t}/memory.md — ${f("agents_ui.memory_durable_desc")}`,children:[r.jsx(Pn,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>u(b.target.value),placeholder:f("project.agent_detail.memory_empty")}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",f("project.memories.chars")]}),r.jsxs(de,{size:"sm",variant:"primary",loading:p,disabled:!g,onClick:h,children:[r.jsx(Nf,{size:12})," ",f("project.memories.save_btn")]})]})]})}function o8({records:e,loading:t}){const s=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs(Ke,{title:f("project.agent_detail.records_title"),description:f("project.agent_detail.records_desc"),children:[t&&r.jsx(ot,{}),!t&&s.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:s.map((o,l)=>r.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?r.jsx(_k,{size:13,className:"text-blue-400"}):r.jsx(jk,{size:13,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),r.jsx(Ye,{tone:"info",children:o.channel}),o.type&&r.jsx(Ye,{children:o.type})]}),o.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:o.body.length>400?`${o.body.slice(0,400)}…`:o.body})]})]},`${o.ts}-${l}`))})]})}function l8({routines:e}){return e.length===0?r.jsx(Ke,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[r.jsx("div",{className:"font-medium text-amber-400",children:f("project.agent_detail.sleep_deep")}),r.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:f("project.agent_detail.sleep_deep_desc")})]})}):r.jsx(Ke,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsx("div",{className:"space-y-3",children:e.map(t=>{const s=t.enabled,o=t.last_status==="error";return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Oe("size-2 rounded-full",o?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),r.jsx("span",{className:"text-sm font-medium",children:t.name}),r.jsx(Ye,{tone:s?"success":"muted",children:f(s?"agents_ui.running":"agents_ui.paused")}),o&&r.jsx(Ye,{tone:"danger",children:f("agents_ui.last_error")})]}),r.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[r.jsx(Md,{label:f("agents_ui.field_tick"),value:t.schedule}),r.jsx(Md,{label:f("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),r.jsx(Md,{label:f("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),r.jsx(Md,{label:f("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&r.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:t.last_error})]},t.name)})})})}function Md({label:e,value:t}){return r.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:t})]})}function i8({value:e,onChange:t}){const s=Ze("/tools",()=>jD.list()),o=bx(e),l=s.data||[],c=p=>{const m=new Set(o);m.has(p)?m.delete(p):m.add(p),t([...m].join(", "))},u=o.filter(p=>!l.some(m=>m.name===p));return r.jsxs(ue,{label:f("agents_ui.tools_label"),hint:f("project.agent_detail.tools_hint"),children:[r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(p=>{const m=o.includes(p.name);return r.jsx(Je,{content:p.description||p.name,children:r.jsx("button",{type:"button",onClick:()=>c(p.name),className:Oe("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",m?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:p.name})},p.name)}),u.map(p=>r.jsxs("button",{type:"button",onClick:()=>c(p),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[p," ✕"]},p))]}),r.jsx(Ae,{className:"mt-2",value:e,onChange:p=>t(p.target.value),placeholder:f("project.agent_detail.tools_custom_ph")})]})}function c8({slug:e,memory:t,threads:s,tasks:o,routines:l,parent:c,children:u}){const p=x.useMemo(()=>{const m=[];return n8(t).forEach((g,h)=>m.push({id:`m${h}`,label:g,kind:"memory",relation:"knows",detail:g})),s.slice(0,8).forEach(g=>m.push({id:`th-${g.id}`,label:g.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(g=>m.push({id:`ts-${g.id}`,label:g.label,kind:"task",relation:"handles_task",detail:g.detail})),l.forEach(g=>m.push({id:`rt-${g.name}`,label:g.name,kind:"routine",relation:"ticks",detail:`schedule: ${g.schedule}`})),c&&m.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),u.forEach(g=>m.push({id:`c-${g}`,label:g,kind:"agentlink",relation:"orchestrates"})),m},[t,s,o,l,c,u]);return r.jsx(Ke,{title:f("project.agent_detail.brain_title"),description:f("project.agent_detail.brain_desc"),children:p.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.brain_empty")}):r.jsx(WI,{center:e,nodes:p})})}function u8(){const e=Zn(),t=Qn(),{pid:s=""}=ck(),{project:o}=Lb(s),{collapsed:l,toggle:c}=Ab(Cn.sidebarCollapsed+".project"),u=String(s)==="0",p=x.useMemo(()=>u?[{title:f("base.nav_general"),items:[{key:"",label:"Dashboard",icon:yA},{key:"workspaces",label:f("base.workspaces_title"),icon:YM},{key:"models",label:f("settings.tabs.engines"),icon:Ox},{key:"agent-defaults",label:f("base.defaults_title"),icon:gn}]},{title:f("base.nav_activity"),items:[{key:"chat",label:f("project.nav.chat"),icon:Kd},{key:"sessions",label:f("base.sessions_title"),icon:xA},{key:"tasks",label:f("project.nav.tasks"),icon:Pl},{key:"logs",label:f("project.nav.logs"),icon:Qd}]},{title:f("base.nav_system"),items:[{key:"agents",label:f("project.nav.agents"),icon:gn},{key:"memories",label:f("project.nav.memories"),icon:Gd},{key:"routines",label:f("project.nav.routines"),icon:Dl},{key:"mcps",label:f("project.nav.mcps"),icon:Ph},{key:"vars",label:f("project.nav.vars"),icon:Dh},{key:"config",label:f("project.nav.config"),icon:Zd}]}]:[{title:f("project.sections.workspace"),items:[{key:"",label:f("project.nav.overview"),icon:Ck},{key:"telegram",label:f("project.nav.telegram"),icon:Ya},{key:"chat",label:f("project.nav.chat"),icon:Kd},{key:"agents",label:f("project.nav.agents"),icon:gn},{key:"memories",label:f("project.nav.memories"),icon:Gd}]},{title:f("project.sections.automation"),items:[{key:"routines",label:f("project.nav.routines"),icon:Dl},{key:"tasks",label:f("project.nav.tasks"),icon:Pl},{key:"mcps",label:f("project.nav.mcps"),icon:Ph},{key:"vars",label:f("project.nav.vars"),icon:Dh},{key:"logs",label:f("project.nav.logs"),icon:Qd}]},{title:f("project.sections.config"),items:[{key:"config",label:f("project.nav.config"),icon:Zd}]}],[u]),m=t.pathname.replace(`/p/${s}`,"").replace(/^\//,"").split("/")[0];if(!o)return r.jsx(DC,{testId:"screen-project-not-found",mood:"confused",message:f("project.not_found",{pid:s}),action:r.jsx(Xs,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})});const g=h=>{const b=h?`/p/${s}/${h}`:`/p/${s}`;e(b)};return r.jsx(OC,{sections:p,active:m,onChange:g,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${m||"overview"}`,children:r.jsxs(pk,{children:[r.jsx(Ft,{index:!0,element:r.jsx(Mj,{pid:s})}),r.jsx(Ft,{path:"workspaces",element:r.jsx(MP,{})}),r.jsx(Ft,{path:"models",element:r.jsx(KC,{})}),r.jsx(Ft,{path:"agent-defaults",element:r.jsx(ML,{})}),r.jsx(Ft,{path:"sessions",element:r.jsx(DL,{})}),r.jsx(Ft,{path:"logs",element:r.jsx(_L,{pid:s})}),r.jsx(Ft,{path:"config",element:r.jsx(e6,{pid:s})}),r.jsx(Ft,{path:"telegram",element:r.jsx(uI,{pid:s})}),r.jsx(Ft,{path:"agents",element:r.jsx(r6,{pid:s})}),r.jsx(Ft,{path:"agents/:slug",element:r.jsx(a8,{pid:s})}),r.jsx(Ft,{path:"memories",element:r.jsx(fI,{pid:s})}),r.jsx(Ft,{path:"routines",element:r.jsx(v6,{pid:s})}),r.jsx(Ft,{path:"tasks",element:u?r.jsx(PL,{}):r.jsx(_6,{pid:s})}),r.jsx(Ft,{path:"mcps",element:r.jsx(M6,{pid:s})}),r.jsx(Ft,{path:"vars",element:r.jsx(L6,{pid:s})}),r.jsx(Ft,{path:"threads",element:r.jsx(rM,{to:`/p/${s}/chat`,replace:!0})}),r.jsx(Ft,{path:"chat",element:r.jsx(iI,{pid:s})}),r.jsx(Ft,{path:"*",element:r.jsx(Mj,{pid:s})})]})})}const d8=["es","en","pt","fr","it","de"];function f8(){const e=lt(),{identity:t,isLoading:s,save:o}=Ib(),[l,c]=x.useState({}),[u,p]=x.useState(!1);if(x.useEffect(()=>{c(t)},[t]),s)return r.jsx(ot,{});const m=async()=>{p(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(f("settings.identity.saved"))}catch(g){e.error(g.message)}finally{p(!1)}};return r.jsxs(Ke,{title:f("settings.identity.title"),description:f("settings.identity.subtitle"),children:[t?null:r.jsx(ht,{children:f("common.none_yet")}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("settings.identity.owner_name"),children:r.jsx(Ae,{value:l.owner_name||"",onChange:g=>c({...l,owner_name:g.target.value})})}),r.jsx(ue,{label:f("settings.identity.language"),children:r.jsx(kt,{value:l.language||"es",onChange:g=>c({...l,language:g}),options:d8.map(g=>({value:g,label:g}))})}),r.jsx(ue,{label:f("settings.identity.timezone"),hint:f("settings.identity.timezone_hint"),children:r.jsx(Ae,{value:l.timezone||"",onChange:g=>c({...l,timezone:g.target.value})})})]}),r.jsx("div",{className:"mt-3",children:r.jsx(ue,{label:f("settings.identity.owner_context"),hint:f("settings.identity.owner_context_hint"),children:r.jsx(Pn,{rows:3,value:l.owner_context||"",onChange:g=>c({...l,owner_context:g.target.value})})})}),r.jsx("div",{className:"mt-4",children:r.jsx(de,{variant:"primary",loading:u,onClick:m,children:f("common.save")})})]})}function p8(){const e=lt(),t=Zn(),{superAgent:s,isLoading:o,mutate:l}=YC(),{patch:c}=qr(),{identity:u,save:p}=Ib(),[m,g]=x.useState(!0),[h,b]=x.useState(""),[_,k]=x.useState(""),[C,y]=x.useState("permiso"),[w,S]=x.useState(!1);if(x.useEffect(()=>{s&&(g(!!s.enabled),b(s.system||""),y(s.permission_mode||"permiso"))},[s]),x.useEffect(()=>{k(u.personality||"")},[u.personality]),o||!s)return r.jsx(ot,{});const N=async()=>{S(!0);try{await c({"super_agent.enabled":m,"super_agent.system":h,"super_agent.permission_mode":C},["super_agent.name"]),await p({personality:_}),e.success(f("settings.super_agent.saved")),l()}catch(E){e.error(E.message)}finally{S(!1)}};return r.jsx(Ke,{title:f("settings.super_agent.title"),description:f("settings.super_agent.behavior_subtitle"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(Wt,{checked:m,onChange:g,label:f("settings.super_agent.enabled_label")})}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("settings.super_agent.model_active")}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),r.jsxs(de,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[r.jsx(Ox,{size:13})," ",f("settings.super_agent.model_configure")]})]}),r.jsx(ue,{label:f("settings.super_agent.permission_mode"),children:r.jsx(kt,{value:C,onChange:y,options:Ux.map(E=>({value:E,label:E}))})}),r.jsx(ue,{label:f("settings.super_agent.personality"),children:r.jsx(Pn,{rows:2,value:_,onChange:E=>k(E.target.value)})}),r.jsx(ue,{label:f("settings.super_agent.system"),hint:f("settings.super_agent.system_hint"),children:r.jsx(Pn,{rows:6,className:"font-mono text-xs",value:h,onChange:E=>b(E.target.value),placeholder:f("settings.super_agent.system_ph")})}),r.jsx(de,{variant:"primary",loading:w,onClick:N,children:f("common.save")})]})})}const ah={providers:()=>he.get("/embeddings/providers"),test:(e={})=>he.post("/embeddings/test",e),reindex:()=>he.post("/embeddings/reindex",{})},m8=()=>[{value:"auto",label:f("memory_panel.provider_auto")},{value:"ollama",label:f("memory_panel.provider_ollama")},{value:"gemini",label:f("memory_panel.provider_gemini")},{value:"openai",label:f("memory_panel.provider_openai")},{value:"tf",label:f("memory_panel.provider_tf")}],g8=()=>[{value:"chain",label:f("memory_panel.mode_chain")},{value:"single",label:f("memory_panel.mode_single")}],ew=e=>e.startsWith("***");function h8(){const e=lt(),{config:t,isLoading:s,patch:o}=qr(),{data:l,mutate:c}=Ze("/embeddings/providers",()=>ah.providers()),[u,p]=x.useState(!1),[m,g]=x.useState(null);if(s)return r.jsx(ot,{});const h=t.memory||{},b=h.embeddings||{},_=l?.configured_provider||b.provider||"auto",k=l?.mode||b.mode||"chain",C=l?.engines||[],y=async N=>{p(!0);try{await o(N),await c()}catch(E){e.error(f("memory_panel.save_failed",{msg:E.message}))}finally{p(!1)}},w=async()=>{p(!0),g(null);try{const N=await ah.test({});g(`${N.embedder} · dim ${N.dim} · ${N.ms}ms`),e.success(f("memory_panel.test_ok",{embedder:N.embedder}))}catch(N){e.error(f("memory_panel.test_failed",{msg:N.message}))}finally{p(!1)}},S=async()=>{p(!0);try{const N=await ah.reindex();e.success(f("memory_panel.reindexed",{indexed:N.indexed,cleared:N.cleared}))}catch(N){e.error(f("memory_panel.reindex_failed",{msg:N.message}))}finally{p(!1)}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ke,{title:f("memory_panel.embeddings_title"),description:f("memory_panel.embeddings_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:f("memory_panel.provider_label"),hint:f("memory_panel.provider_hint"),children:r.jsx(kt,{value:_,onChange:N=>y({"memory.embeddings.provider":N}),options:m8(),disabled:u,className:"max-w-xl"})}),r.jsx(ue,{label:f("memory_panel.mode_label"),hint:f("memory_panel.mode_hint"),children:r.jsx(kt,{value:k,onChange:N=>y({"memory.embeddings.mode":N}),options:g8(),disabled:u,className:"max-w-md"})}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:C.map(N=>r.jsxs(Ye,{tone:N.available?"success":"muted",children:[N.id,": ",N.available?f("memory_panel.available"):f("memory_panel.unavailable")]},N.id))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(de,{variant:"secondary",onClick:w,loading:u,children:[r.jsx(fs,{size:14})," ",f("memory_panel.test_btn")]}),r.jsxs(de,{variant:"secondary",onClick:S,loading:u,children:[r.jsx(kk,{size:14})," ",f("memory_panel.reindex_btn")]}),m&&r.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),r.jsxs(Ke,{title:f("memory_panel.ollama_title"),description:f("memory_panel.ollama_desc"),children:[r.jsx(ue,{label:f("memory_panel.model_label"),children:r.jsx(Ae,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:u,onBlur:N=>{const E=N.target.value.trim();E&&E!==b.ollama?.model&&y({"memory.embeddings.ollama.model":E})},className:"max-w-md"})}),r.jsx(ue,{label:f("memory_panel.base_url_label"),hint:f("memory_panel.ollama_base_url_hint"),children:r.jsx(Ae,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:u,onBlur:N=>y({"memory.embeddings.ollama.base_url":N.target.value.trim()}),className:"max-w-md"})})]}),r.jsxs(Ke,{title:f("memory_panel.openai_title"),description:f("memory_panel.openai_desc"),children:[r.jsx(ue,{label:f("memory_panel.model_label"),children:r.jsx(Ae,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:u,onBlur:N=>{const E=N.target.value.trim();E&&E!==b.openai?.model&&y({"memory.embeddings.openai.model":E})},className:"max-w-md"})}),r.jsx(ue,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.openai_key_hint"),children:r.jsx(Ae,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:u,onBlur:N=>{const E=N.target.value;E&&!ew(E)&&y({"memory.embeddings.openai.api_key":E})},className:"max-w-md"})})]}),r.jsxs(Ke,{title:f("memory_panel.gemini_title"),description:f("memory_panel.gemini_desc"),children:[r.jsx(ue,{label:f("memory_panel.model_label"),children:r.jsx(Ae,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:u,onBlur:N=>{const E=N.target.value.trim();E&&E!==b.gemini?.model&&y({"memory.embeddings.gemini.model":E})},className:"max-w-md"})}),r.jsx(ue,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.gemini_key_hint"),children:r.jsx(Ae,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:u,onBlur:N=>{const E=N.target.value;E&&!ew(E)&&y({"memory.embeddings.gemini.api_key":E})},className:"max-w-md"})})]}),r.jsxs(Ke,{title:f("memory_panel.compaction_title"),description:f("memory_panel.compaction_desc"),children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(ue,{label:f("memory_panel.threshold_label"),hint:f("memory_panel.threshold_hint"),children:r.jsx(Ae,{type:"number",min:1,defaultValue:h.compact_threshold??60,placeholder:"60",disabled:u,onBlur:N=>{const E=parseInt(N.target.value,10);Number.isFinite(E)&&E>0&&E!==h.compact_threshold&&y({"memory.compact_threshold":E})},className:"max-w-[10rem]"})}),r.jsx(ue,{label:f("memory_panel.keep_recent_label"),hint:f("memory_panel.keep_recent_hint"),children:r.jsx(Ae,{type:"number",min:1,defaultValue:h.keep_recent??40,placeholder:"40",disabled:u,onBlur:N=>{const E=parseInt(N.target.value,10);Number.isFinite(E)&&E>0&&E!==h.keep_recent&&y({"memory.keep_recent":E})},className:"max-w-[10rem]"})})]}),r.jsx(ue,{label:f("memory_panel.compact_model_label"),hint:f("memory_panel.compact_model_hint"),children:r.jsx(Ae,{defaultValue:h.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:u,onBlur:N=>{const E=N.target.value.trim();E&&E!==h.compact_model&&y({"memory.compact_model":E})},className:"max-w-md"})}),r.jsx(ue,{label:f("memory_panel.compact_fallback_label"),hint:f("memory_panel.compact_fallback_hint"),children:r.jsx(Ae,{defaultValue:h.compact_fallback_model||"",placeholder:f("memory_panel.compact_fallback_ph"),disabled:u,onBlur:N=>{const E=N.target.value.trim();E!==(h.compact_fallback_model||"")&&y({"memory.compact_fallback_model":E})},className:"max-w-md"})})]})]})}function x8(){return[{key:"load_threshold",label:f("settings_ui.knob_load_threshold"),hint:f("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:f("settings_ui.knob_hint_threshold"),hint:f("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:f("settings_ui.knob_margin"),hint:f("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:f("settings_ui.knob_max_loaded"),hint:f("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:f("settings_ui.knob_max_hints"),hint:f("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:f("settings_ui.knob_prompt_floor"),hint:f("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:f("settings_ui.knob_body_char_cap"),hint:f("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function b8(){const e=lt(),{data:t,mutate:s,isLoading:o}=Ze("/skills/inspector",()=>fc.inspector()),[l,c]=x.useState(!1),[u,p]=x.useState(""),[m,g]=x.useState(null);if(o||!t)return r.jsx(ot,{});const h=t.config,b=t.index,_=async y=>{c(!0);try{await fc.updateInspector(y),await s()}catch(w){e.error(f("settings_ui.could_not_save",{msg:w.message}))}finally{c(!1)}},k=async(y=!1)=>{c(!0);try{const w=await fc.index({force:y});e.success(f("settings_ui.indexed_with",{embedder:w.embedder,dim:w.dim,added:w.changed.added,refreshed:w.changed.refreshed,removed:w.changed.removed})),await s()}catch(w){e.error(f("settings_ui.index_failed",{msg:w.message}))}finally{c(!1)}},C=async()=>{if(u.trim()){c(!0),g(null);try{const y=await fc.inspect(u.trim());g(y.trace)}catch(y){e.error(f("settings_ui.dry_run_failed",{msg:y.message}))}finally{c(!1)}}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ke,{title:f("settings_ui.inspector_title"),description:f("settings_ui.inspector_desc"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(ue,{label:f("settings_ui.enable_inspector"),hint:f("settings_ui.enable_inspector_hint"),children:r.jsx(Wt,{checked:h.enabled,disabled:l,onChange:y=>_({enabled:y}),label:h.enabled?f("settings_ui.on"):f("settings_ui.off")})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[r.jsx(Ye,{tone:b.count>0?"success":"warning",children:f("settings_ui.index_count",{n:b.count})}),r.jsx(Ye,{tone:"muted",children:b.embedder||f("settings_ui.not_indexed")}),b.dim?r.jsx(Ye,{tone:"muted",children:f("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(de,{variant:"secondary",onClick:()=>k(!1),loading:l,children:[r.jsx(cs,{size:14})," ",f("settings_ui.reindex")]}),r.jsxs(de,{variant:"secondary",onClick:()=>k(!0),loading:l,children:[r.jsx(cs,{size:14})," ",f("settings_ui.reindex_forced")]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.embedder_source")})]})]})}),r.jsx(Ke,{title:f("settings_ui.thresholds_title"),description:f("settings_ui.thresholds_desc"),children:r.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:x8().map(y=>r.jsx(ue,{label:y.label,hint:y.hint,children:r.jsx(Ae,{type:"number",step:y.step,min:y.min,max:y.max,defaultValue:String(h[y.key]),disabled:l,onBlur:w=>{const S=Number(w.target.value);Number.isFinite(S)&&S!==h[y.key]&&_({[y.key]:S})},className:"max-w-[12rem]"})},y.key))})}),r.jsx(Ke,{title:f("settings_ui.test_title"),description:f("settings_ui.test_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Ae,{value:u,placeholder:f("settings_ui.test_placeholder"),disabled:l,onChange:y=>p(y.target.value),onKeyDown:y=>{y.key==="Enter"&&C()},className:"max-w-xl flex-1"}),r.jsxs(de,{variant:"primary",onClick:C,loading:l,children:[r.jsx(IA,{size:14})," ",f("settings_ui.test_btn")]})]}),m&&r.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[r.jsx(fs,{size:14,className:"text-muted-foreground"}),r.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?r.jsx(Ye,{tone:"warning",children:f("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?r.jsx(Ye,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.loaded_label")," "]}),m.loaded.map(y=>r.jsx(Ye,{tone:"success",className:"mr-1",children:y},y))]}):null,m.hinted?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.suggested_label")," "]}),m.hinted.map(y=>r.jsx(Ye,{tone:"info",className:"mr-1",children:y},y))]}):null,m.scored?.length?r.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(y=>r.jsxs("div",{children:[y.sim.toFixed(3)," ",y.slug]},y.slug))}):null]})]})})]})}function v8(){const e=lt(),{config:t,isLoading:s,patch:o,mutate:l}=qr(),c=t.telegram?.channels||[],u=Math.max(0,c.findIndex(M=>M.name==="default")),p=c[u],[m,g]=x.useState(!0),[h,b]=x.useState(1500),[_,k]=x.useState(!0),[C,y]=x.useState(""),[w,S]=x.useState(""),[N,E]=x.useState(!1);if(x.useEffect(()=>{g(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),k(!!t.telegram?.respond_with_engine),y(""),S(p?.chat_id||"")},[t,p?.chat_id]),s)return r.jsx(ot,{});const R=async()=>{E(!0);try{const M=c.slice(),T={name:"default",chat_id:w,respond_with_engine:_,...C?{bot_token:C}:{}};c.length===0?M.push(T):M[u]={...p,...T},await o({"telegram.enabled":m,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":_,"telegram.channels":M}),e.success(f("settings.telegram_global.saved")),l(),y("")}catch(M){e.error(M.message)}finally{E(!1)}};return r.jsx(Ke,{title:f("settings.telegram_global.title"),description:f("settings.telegram_global.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Wt,{checked:m,onChange:g,label:f("settings.telegram_global.enabled")}),r.jsx(Wt,{checked:_,onChange:k,label:f("settings.telegram_global.respond_with_engine")})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("settings.telegram_global.bot_token"),hint:p?.bot_token?`…${Gl(p.bot_token)??""} ${f("telegram_ui.secret_set_replace")}`:f("telegram_ui.bot_token_hint_short"),children:r.jsx(Ae,{type:"password",value:C,onChange:M=>y(M.target.value),placeholder:p?.bot_token?`…${Gl(p.bot_token)??""} ${f("telegram_ui.secret_already_set")}`:""})}),r.jsx(ue,{label:f("settings.telegram_global.chat_id"),children:r.jsx(Ae,{value:w,onChange:M=>S(M.target.value),placeholder:"889721252"})}),r.jsx(ue,{label:f("settings.telegram_global.poll_interval"),children:r.jsx(Ae,{type:"number",value:String(h),onChange:M=>b(Number(M.target.value)||1500)})})]}),r.jsx(de,{variant:"primary",loading:N,onClick:R,children:f("common.save")})]})})}function _8(){const e=lt(),{channels:t,isLoading:s,mutate:o}=$b(),{contacts:l}=Fb(),[c,u]=x.useState(null),[p,m]=x.useState(null),g=new Map;for(const b of l)g.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const h=async b=>{if(confirm(f("telegram_channels.delete_confirm",{name:b})))try{await Nn.channels.remove(b),e.success(f("telegram_channels.removed")),o()}catch(_){e.error(_.message)}};return r.jsxs(Ke,{title:f("telegram_channels.title"),description:f("telegram_channels.desc"),action:r.jsxs(de,{size:"sm",onClick:()=>u({name:""}),children:[r.jsx(sn,{size:14})," ",f("telegram_channels.new_btn")]}),children:[s&&r.jsx(ot,{}),!s&&t.length===0&&r.jsx(ht,{children:f("telegram_channels.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:t.map(b=>{const _=b.owner_user_id!=null?g.get(String(b.owner_user_id))||f("telegram_ui.user_id_fallback",{id:b.owner_user_id}):f("telegram_channels.no_owner");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:b.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&r.jsxs(Ye,{tone:"success",children:["project = ",b.project]}),r.jsxs(de,{size:"sm",variant:"ghost",onClick:()=>m(b),children:[r.jsx(Ya,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>u(b),children:f("common.edit")}),r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>h(b.name),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),r.jsxs("span",{children:["bot_token: ",b.bot_token?`…${Gl(b.bot_token)??""}`:"—"]}),r.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||f("telegram_ui.default_apx")]}),r.jsxs("span",{children:["engine: ",b.respond_with_engine?f("telegram_ui.yes"):f("telegram_ui.no")]}),r.jsxs("span",{className:"col-span-2",children:[f("telegram_channels.owner_label")," ",_]})]})]},b.name)})}),r.jsx(kC,{channel:c,onClose:()=>u(null),onSaved:()=>{u(null),o()}}),r.jsx(SC,{channel:p,onClose:()=>m(null)})]})}const tw=new Set(["owner","guest"]);function y8(){const e=lt(),{roles:t,mutate:s,isLoading:o}=Fb(),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(!1),_=async()=>{const y=l.trim();if(!y){e.error(f("telegram_roles.name_required"));return}if(tw.has(y)){e.error(f("telegram_roles.builtin_error",{name:y}));return}b(!0);try{const w=m?"*":u.split(",").map(S=>S.trim()).filter(Boolean);await Nn.roles.set(y,w),e.success(f("telegram_roles.saved",{name:y})),c(""),p(""),g(!1),s()}catch(w){e.error(w.message)}finally{b(!1)}},k=async y=>{if(confirm(f("telegram_roles.delete_confirm",{name:y})))try{await Nn.roles.remove(y),e.success(f("telegram_roles.removed")),s()}catch(w){e.error(w.message)}},C=Object.entries(t);return r.jsxs(Ke,{title:f("telegram_roles.title"),description:f("telegram_roles.desc"),children:[o&&r.jsx(ot,{}),C.length===0&&!o&&r.jsx(ht,{children:f("telegram_roles.empty")}),C.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:C.map(([y,w])=>{const S=tw.has(y),N=w?.tools==="*"?f("telegram_roles.tools_all"):Array.isArray(w?.tools)&&w.tools.length>0?w.tools.join(", "):f("telegram_roles.tools_none");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:y}),S&&r.jsx(Ye,{tone:"info",children:f("telegram_roles.builtin")})]}),!S&&r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>k(y),children:f("telegram_roles.delete_btn")})]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[f("telegram_contacts.tools_label")," ",N]})]},y)})}),r.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(sn,{size:14})," ",f("telegram_roles.new_title")]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ue,{label:f("telegram_roles.name_label"),children:r.jsx(Ae,{value:l,onChange:y=>c(y.target.value),placeholder:f("telegram_roles.name_ph")})}),r.jsx(ue,{label:f("telegram_roles.tools_label"),hint:f("telegram_roles.tools_hint"),children:r.jsx(Ae,{value:u,onChange:y=>p(y.target.value),disabled:m,placeholder:f("telegram_roles.tools_ph")})})]}),r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Wt,{checked:m,onChange:g,label:f("telegram_roles.full_access")}),r.jsx(de,{variant:"primary",loading:h,onClick:_,children:f("telegram_roles.save_btn")})]})]})]})}const _N="apx.settings.telegramTab";function j8(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(_N);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function w8(){const[e,t]=x.useState("default");x.useEffect(()=>{t(j8())},[]);const s=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";t(l);try{window.localStorage.setItem(_N,l)}catch{}};return r.jsxs(tp,{value:e,onValueChange:s,className:"w-full",children:[r.jsxs(np,{children:[r.jsx(as,{value:"default",children:f("settings.telegram_global.title")}),r.jsx(as,{value:"channels",children:f("telegram_channels.title")}),r.jsx(as,{value:"contacts",children:f("telegram_contacts.title")}),r.jsx(as,{value:"roles",children:f("telegram_roles.title")})]}),r.jsx(Pa,{value:"default",className:"mt-4",children:r.jsx(v8,{})}),r.jsx(Pa,{value:"channels",className:"mt-4",children:r.jsx(_8,{})}),r.jsx(Pa,{value:"contacts",className:"mt-4",children:r.jsx(CC,{})}),r.jsx(Pa,{value:"roles",className:"mt-4",children:r.jsx(y8,{})})]})}function k8(){const{data:e,error:t,isLoading:s,mutate:o}=Ze("/pair/list",()=>Fl.list(),{refreshInterval:Ef.pairList});return{clients:e?.clients||[],error:t,isLoading:s,mutate:o}}var _l={},sh,nw;function S8(){return nw||(nw=1,sh=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),sh}var rh={},jr={},aw;function Mo(){if(aw)return jr;aw=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return jr.getSymbolSize=function(o){if(!o)throw new Error('"version" cannot be null or undefined');if(o<1||o>40)throw new Error('"version" should be in range from 1 to 40');return o*4+17},jr.getSymbolTotalCodewords=function(o){return t[o]},jr.getBCHDigit=function(s){let o=0;for(;s!==0;)o++,s>>>=1;return o},jr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},jr.isKanjiModeEnabled=function(){return typeof e<"u"},jr.toSJIS=function(o){return e(o)},jr}var oh={},sw;function ov(){return sw||(sw=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,l){if(e.isValid(o))return o;try{return t(o)}catch{return l}}})(oh)),oh}var lh,rw;function C8(){if(rw)return lh;rw=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const s=Math.floor(t/8);return(this.buffer[s]>>>7-t%8&1)===1},put:function(t,s){for(let o=0;o<s;o++)this.putBit((t>>>s-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),t&&(this.buffer[s]|=128>>>this.length%8),this.length++}},lh=e,lh}var ih,ow;function N8(){if(ow)return ih;ow=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,s,o,l){const c=t*this.size+s;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(t,s){return this.data[t*this.size+s]},e.prototype.xor=function(t,s,o){this.data[t*this.size+s]^=o},e.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},ih=e,ih}var ch={},lw;function E8(){return lw||(lw=1,(function(e){const t=Mo().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=t(o),u=c===145?26:Math.ceil((c-13)/(2*l-2))*2,p=[c-7];for(let m=1;m<l-1;m++)p[m]=p[m-1]-u;return p.push(6),p.reverse()},e.getPositions=function(o){const l=[],c=e.getRowColCoords(o),u=c.length;for(let p=0;p<u;p++)for(let m=0;m<u;m++)p===0&&m===0||p===0&&m===u-1||p===u-1&&m===0||l.push([c[p],c[m]]);return l}})(ch)),ch}var uh={},iw;function R8(){if(iw)return uh;iw=1;const e=Mo().getSymbolSize,t=7;return uh.getPositions=function(o){const l=e(o);return[[0,0],[l-t,0],[0,l-t]]},uh}var dh={},cw;function T8(){return cw||(cw=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const c=l.size;let u=0,p=0,m=0,g=null,h=null;for(let b=0;b<c;b++){p=m=0,g=h=null;for(let _=0;_<c;_++){let k=l.get(b,_);k===g?p++:(p>=5&&(u+=t.N1+(p-5)),g=k,p=1),k=l.get(_,b),k===h?m++:(m>=5&&(u+=t.N1+(m-5)),h=k,m=1)}p>=5&&(u+=t.N1+(p-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(l){const c=l.size;let u=0;for(let p=0;p<c-1;p++)for(let m=0;m<c-1;m++){const g=l.get(p,m)+l.get(p,m+1)+l.get(p+1,m)+l.get(p+1,m+1);(g===4||g===0)&&u++}return u*t.N2},e.getPenaltyN3=function(l){const c=l.size;let u=0,p=0,m=0;for(let g=0;g<c;g++){p=m=0;for(let h=0;h<c;h++)p=p<<1&2047|l.get(g,h),h>=10&&(p===1488||p===93)&&u++,m=m<<1&2047|l.get(h,g),h>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(l){let c=0;const u=l.data.length;for(let m=0;m<u;m++)c+=l.data[m];return Math.abs(Math.ceil(c*100/u/5)-10)*t.N4};function s(o,l,c){switch(o){case e.Patterns.PATTERN000:return(l+c)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(l+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return l*c%2+l*c%3===0;case e.Patterns.PATTERN110:return(l*c%2+l*c%3)%2===0;case e.Patterns.PATTERN111:return(l*c%3+(l+c)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(l,c){const u=c.size;for(let p=0;p<u;p++)for(let m=0;m<u;m++)c.isReserved(m,p)||c.xor(m,p,s(l,m,p))},e.getBestMask=function(l,c){const u=Object.keys(e.Patterns).length;let p=0,m=1/0;for(let g=0;g<u;g++){c(g),e.applyMask(g,l);const h=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(g,l),h<m&&(m=h,p=g)}return p}})(dh)),dh}var Ad={},uw;function yN(){if(uw)return Ad;uw=1;const e=ov(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Ad.getBlocksCount=function(l,c){switch(c){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},Ad.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return s[(l-1)*4+0];case e.M:return s[(l-1)*4+1];case e.Q:return s[(l-1)*4+2];case e.H:return s[(l-1)*4+3];default:return}},Ad}var fh={},ic={},dw;function M8(){if(dw)return ic;dw=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let o=1;for(let l=0;l<255;l++)e[l]=o,t[o]=l,o<<=1,o&256&&(o^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),ic.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},ic.exp=function(o){return e[o]},ic.mul=function(o,l){return o===0||l===0?0:e[t[o]+t[l]]},ic}var fw;function A8(){return fw||(fw=1,(function(e){const t=M8();e.mul=function(o,l){const c=new Uint8Array(o.length+l.length-1);for(let u=0;u<o.length;u++)for(let p=0;p<l.length;p++)c[u+p]^=t.mul(o[u],l[p]);return c},e.mod=function(o,l){let c=new Uint8Array(o);for(;c.length-l.length>=0;){const u=c[0];for(let m=0;m<l.length;m++)c[m]^=t.mul(l[m],u);let p=0;for(;p<c.length&&c[p]===0;)p++;c=c.slice(p)}return c},e.generateECPolynomial=function(o){let l=new Uint8Array([1]);for(let c=0;c<o;c++)l=e.mul(l,new Uint8Array([1,t.exp(c)]));return l}})(fh)),fh}var ph,pw;function O8(){if(pw)return ph;pw=1;const e=A8();function t(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(o.length+this.degree);l.set(o);const c=e.mod(l,this.genPoly),u=this.degree-c.length;if(u>0){const p=new Uint8Array(this.degree);return p.set(c,u),p}return c},ph=t,ph}var mh={},gh={},hh={},mw;function jN(){return mw||(mw=1,hh.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),hh}var Ja={},gw;function wN(){if(gw)return Ja;gw=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
634
+ ]))+`;Ja.KANJI=new RegExp(s,"g"),Ja.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ja.BYTE=new RegExp(o,"g"),Ja.NUMERIC=new RegExp(e,"g"),Ja.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ja.testKanji=function(m){return l.test(m)},Ja.testNumeric=function(m){return c.test(m)},Ja.testAlphanumeric=function(m){return u.test(m)},Ja}var hw;function Ao(){return hw||(hw=1,(function(e){const t=jN(),s=wN();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(c,u){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?c.ccBits[0]:u<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return s.testNumeric(c)?e.NUMERIC:s.testAlphanumeric(c)?e.ALPHANUMERIC:s.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.ccBits};function o(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(c,u){if(e.isValid(c))return c;try{return o(c)}catch{return u}}})(gh)),gh}var xw;function z8(){return xw||(xw=1,(function(e){const t=Mo(),s=yN(),o=ov(),l=Ao(),c=jN(),u=7973,p=t.getBCHDigit(u);function m(_,k,C){for(let y=1;y<=40;y++)if(k<=e.getCapacity(y,C,_))return y}function g(_,k){return l.getCharCountIndicator(_,k)+4}function h(_,k){let C=0;return _.forEach(function(y){const w=g(y.mode,k);C+=w+y.getBitsLength()}),C}function b(_,k){for(let C=1;C<=40;C++)if(h(_,C)<=e.getCapacity(C,k,l.MIXED))return C}e.from=function(k,C){return c.isValid(k)?parseInt(k,10):C},e.getCapacity=function(k,C,y){if(!c.isValid(k))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=l.BYTE);const w=t.getSymbolTotalCodewords(k),S=s.getTotalCodewordsCount(k,C),N=(w-S)*8;if(y===l.MIXED)return N;const E=N-g(y,k);switch(y){case l.NUMERIC:return Math.floor(E/10*3);case l.ALPHANUMERIC:return Math.floor(E/11*2);case l.KANJI:return Math.floor(E/13);case l.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(k,C){let y;const w=o.from(C,o.M);if(Array.isArray(k)){if(k.length>1)return b(k,w);if(k.length===0)return 1;y=k[0]}else y=k;return m(y.mode,y.getLength(),w)},e.getEncodedBits=function(k){if(!c.isValid(k)||k<7)throw new Error("Invalid QR Code version");let C=k<<12;for(;t.getBCHDigit(C)-p>=0;)C^=u<<t.getBCHDigit(C)-p;return k<<12|C}})(mh)),mh}var xh={},bw;function D8(){if(bw)return xh;bw=1;const e=Mo(),t=1335,s=21522,o=e.getBCHDigit(t);return xh.getEncodedBits=function(c,u){const p=c.bit<<3|u;let m=p<<10;for(;e.getBCHDigit(m)-o>=0;)m^=t<<e.getBCHDigit(m)-o;return(p<<10|m)^s},xh}var bh={},vh,vw;function P8(){if(vw)return vh;vw=1;const e=Ao();function t(s){this.mode=e.NUMERIC,this.data=s.toString()}return t.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){let l,c,u;for(l=0;l+3<=this.data.length;l+=3)c=this.data.substr(l,3),u=parseInt(c,10),o.put(u,10);const p=this.data.length-l;p>0&&(c=this.data.substr(l),u=parseInt(c,10),o.put(u,p*3+1))},vh=t,vh}var _h,_w;function L8(){if(_w)return _h;_w=1;const e=Ao(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(o){this.mode=e.ALPHANUMERIC,this.data=o}return s.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let u=t.indexOf(this.data[c])*45;u+=t.indexOf(this.data[c+1]),l.put(u,11)}this.data.length%2&&l.put(t.indexOf(this.data[c]),6)},_h=s,_h}var yh,yw;function I8(){if(yw)return yh;yw=1;const e=Ao();function t(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return t.getBitsLength=function(o){return o*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(s){for(let o=0,l=this.data.length;o<l;o++)s.put(this.data[o],8)},yh=t,yh}var jh,jw;function B8(){if(jw)return jh;jw=1;const e=Ao(),t=Mo();function s(o){this.mode=e.KANJI,this.data=o}return s.getBitsLength=function(l){return l*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(o){let l;for(l=0;l<this.data.length;l++){let c=t.toSJIS(this.data[l]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
635
+ Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},jh=s,jh}var wh={exports:{}},ww;function U8(){return ww||(ww=1,(function(e){var t={single_source_shortest_paths:function(s,o,l){var c={},u={};u[o]=0;var p=t.PriorityQueue.make();p.push(o,0);for(var m,g,h,b,_,k,C,y,w;!p.empty();){m=p.pop(),g=m.value,b=m.cost,_=s[g]||{};for(h in _)_.hasOwnProperty(h)&&(k=_[h],C=b+k,y=u[h],w=typeof u[h]>"u",(w||y>C)&&(u[h]=C,p.push(h,C),c[h]=g))}if(typeof l<"u"&&typeof u[l]>"u"){var S=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(S)}return c},extract_shortest_path_from_predecessor_list:function(s,o){for(var l=[],c=o;c;)l.push(c),s[c],c=s[c];return l.reverse(),l},find_path:function(s,o,l){var c=t.single_source_shortest_paths(s,o,l);return t.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(s){var o=t.PriorityQueue,l={},c;s=s||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=s.sorter||o.default_sorter,l},default_sorter:function(s,o){return s.cost-o.cost},push:function(s,o){var l={value:s,cost:o};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(wh)),wh.exports}var kw;function H8(){return kw||(kw=1,(function(e){const t=Ao(),s=P8(),o=L8(),l=I8(),c=B8(),u=wN(),p=Mo(),m=U8();function g(S){return unescape(encodeURIComponent(S)).length}function h(S,N,E){const R=[];let M;for(;(M=S.exec(E))!==null;)R.push({data:M[0],index:M.index,mode:N,length:M[0].length});return R}function b(S){const N=h(u.NUMERIC,t.NUMERIC,S),E=h(u.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,M;return p.isKanjiModeEnabled()?(R=h(u.BYTE,t.BYTE,S),M=h(u.KANJI,t.KANJI,S)):(R=h(u.BYTE_KANJI,t.BYTE,S),M=[]),N.concat(E,R,M).sort(function(A,z){return A.index-z.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function _(S,N){switch(N){case t.NUMERIC:return s.getBitsLength(S);case t.ALPHANUMERIC:return o.getBitsLength(S);case t.KANJI:return c.getBitsLength(S);case t.BYTE:return l.getBitsLength(S)}}function k(S){return S.reduce(function(N,E){const R=N.length-1>=0?N[N.length-1]:null;return R&&R.mode===E.mode?(N[N.length-1].data+=E.data,N):(N.push(E),N)},[])}function C(S){const N=[];for(let E=0;E<S.length;E++){const R=S[E];switch(R.mode){case t.NUMERIC:N.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:N.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:N.push([R,{data:R.data,mode:t.BYTE,length:g(R.data)}]);break;case t.BYTE:N.push([{data:R.data,mode:t.BYTE,length:g(R.data)}])}}return N}function y(S,N){const E={},R={start:{}};let M=["start"];for(let T=0;T<S.length;T++){const A=S[T],z=[];for(let I=0;I<A.length;I++){const D=A[I],P=""+T+I;z.push(P),E[P]={node:D,lastCount:0},R[P]={};for(let L=0;L<M.length;L++){const U=M[L];E[U]&&E[U].node.mode===D.mode?(R[U][P]=_(E[U].lastCount+D.length,D.mode)-_(E[U].lastCount,D.mode),E[U].lastCount+=D.length):(E[U]&&(E[U].lastCount=D.length),R[U][P]=_(D.length,D.mode)+4+t.getCharCountIndicator(D.mode,N))}}M=z}for(let T=0;T<M.length;T++)R[M[T]].end=0;return{map:R,table:E}}function w(S,N){let E;const R=t.getBestModeForData(S);if(E=t.from(N,R),E!==t.BYTE&&E.bit<R.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(E)+`.
636
+ Suggested mode is: `+t.toString(R));switch(E===t.KANJI&&!p.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new s(S);case t.ALPHANUMERIC:return new o(S);case t.KANJI:return new c(S);case t.BYTE:return new l(S)}}e.fromArray=function(N){return N.reduce(function(E,R){return typeof R=="string"?E.push(w(R,null)):R.data&&E.push(w(R.data,R.mode)),E},[])},e.fromString=function(N,E){const R=b(N,p.isKanjiModeEnabled()),M=C(R),T=y(M,E),A=m.find_path(T.map,"start","end"),z=[];for(let I=1;I<A.length-1;I++)z.push(T.table[A[I]].node);return e.fromArray(k(z))},e.rawSplit=function(N){return e.fromArray(b(N,p.isKanjiModeEnabled()))}})(bh)),bh}var Sw;function V8(){if(Sw)return rh;Sw=1;const e=Mo(),t=ov(),s=C8(),o=N8(),l=E8(),c=R8(),u=T8(),p=yN(),m=O8(),g=z8(),h=D8(),b=Ao(),_=H8();function k(T,A){const z=T.size,I=c.getPositions(A);for(let D=0;D<I.length;D++){const P=I[D][0],L=I[D][1];for(let U=-1;U<=7;U++)if(!(P+U<=-1||z<=P+U))for(let q=-1;q<=7;q++)L+q<=-1||z<=L+q||(U>=0&&U<=6&&(q===0||q===6)||q>=0&&q<=6&&(U===0||U===6)||U>=2&&U<=4&&q>=2&&q<=4?T.set(P+U,L+q,!0,!0):T.set(P+U,L+q,!1,!0))}}function C(T){const A=T.size;for(let z=8;z<A-8;z++){const I=z%2===0;T.set(z,6,I,!0),T.set(6,z,I,!0)}}function y(T,A){const z=l.getPositions(A);for(let I=0;I<z.length;I++){const D=z[I][0],P=z[I][1];for(let L=-2;L<=2;L++)for(let U=-2;U<=2;U++)L===-2||L===2||U===-2||U===2||L===0&&U===0?T.set(D+L,P+U,!0,!0):T.set(D+L,P+U,!1,!0)}}function w(T,A){const z=T.size,I=g.getEncodedBits(A);let D,P,L;for(let U=0;U<18;U++)D=Math.floor(U/3),P=U%3+z-8-3,L=(I>>U&1)===1,T.set(D,P,L,!0),T.set(P,D,L,!0)}function S(T,A,z){const I=T.size,D=h.getEncodedBits(A,z);let P,L;for(P=0;P<15;P++)L=(D>>P&1)===1,P<6?T.set(P,8,L,!0):P<8?T.set(P+1,8,L,!0):T.set(I-15+P,8,L,!0),P<8?T.set(8,I-P-1,L,!0):P<9?T.set(8,15-P-1+1,L,!0):T.set(8,15-P-1,L,!0);T.set(I-8,8,1,!0)}function N(T,A){const z=T.size;let I=-1,D=z-1,P=7,L=0;for(let U=z-1;U>0;U-=2)for(U===6&&U--;;){for(let q=0;q<2;q++)if(!T.isReserved(D,U-q)){let $=!1;L<A.length&&($=(A[L]>>>P&1)===1),T.set(D,U-q,$),P--,P===-1&&(L++,P=7)}if(D+=I,D<0||z<=D){D-=I,I=-I;break}}}function E(T,A,z){const I=new s;z.forEach(function(q){I.put(q.mode.bit,4),I.put(q.getLength(),b.getCharCountIndicator(q.mode,T)),q.write(I)});const D=e.getSymbolTotalCodewords(T),P=p.getTotalCodewordsCount(T,A),L=(D-P)*8;for(I.getLengthInBits()+4<=L&&I.put(0,4);I.getLengthInBits()%8!==0;)I.putBit(0);const U=(L-I.getLengthInBits())/8;for(let q=0;q<U;q++)I.put(q%2?17:236,8);return R(I,T,A)}function R(T,A,z){const I=e.getSymbolTotalCodewords(A),D=p.getTotalCodewordsCount(A,z),P=I-D,L=p.getBlocksCount(A,z),U=I%L,q=L-U,$=Math.floor(I/L),V=Math.floor(P/L),G=V+1,K=$-V,F=new m(K);let X=0;const H=new Array(L),Q=new Array(L);let Y=0;const J=new Uint8Array(T.buffer);for(let fe=0;fe<L;fe++){const ze=fe<q?V:G;H[fe]=J.slice(X,X+ze),Q[fe]=F.encode(H[fe]),X+=ze,Y=Math.max(Y,ze)}const oe=new Uint8Array(I);let ne=0,te,le;for(te=0;te<Y;te++)for(le=0;le<L;le++)te<H[le].length&&(oe[ne++]=H[le][te]);for(te=0;te<K;te++)for(le=0;le<L;le++)oe[ne++]=Q[le][te];return oe}function M(T,A,z,I){let D;if(Array.isArray(T))D=_.fromArray(T);else if(typeof T=="string"){let $=A;if(!$){const V=_.rawSplit(T);$=g.getBestVersionForData(V,z)}D=_.fromString(T,$||40)}else throw new Error("Invalid data");const P=g.getBestVersionForData(D,z);if(!P)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=P;else if(A<P)throw new Error(`
637
+ The chosen QR Code version cannot contain this amount of data.
638
+ Minimum version required to store current data is: `+P+`.
639
+ `);const L=E(A,z,D),U=e.getSymbolSize(A),q=new o(U);return k(q,A),C(q),y(q,A),S(q,z,0),A>=7&&w(q,A),N(q,L),isNaN(I)&&(I=u.getBestMask(q,S.bind(null,q,z))),u.applyMask(I,q),S(q,z,I),{modules:q,version:A,errorCorrectionLevel:z,maskPattern:I,segments:D}}return rh.create=function(A,z){if(typeof A>"u"||A==="")throw new Error("No input text");let I=t.M,D,P;return typeof z<"u"&&(I=t.from(z.errorCorrectionLevel,t.M),D=g.from(z.version),P=u.from(z.maskPattern),z.toSJISFunc&&e.setToSJISFunction(z.toSJISFunc)),M(A,D,I,P)},rh}var kh={},Sh={},Cw;function kN(){return Cw||(Cw=1,(function(e){function t(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let o=s.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+s);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(c){return[c,c]}))),o.length===6&&o.push("F","F");const l=parseInt(o.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const l=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,c=o.width&&o.width>=21?o.width:void 0,u=o.scale||4;return{width:c,scale:c?4:u,margin:l,color:{dark:t(o.color.dark||"#000000ff"),light:t(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,l){return l.width&&l.width>=o+l.margin*2?l.width/(o+l.margin*2):l.scale},e.getImageWidth=function(o,l){const c=e.getScale(o,l);return Math.floor((o+l.margin*2)*c)},e.qrToImageData=function(o,l,c){const u=l.modules.size,p=l.modules.data,m=e.getScale(u,c),g=Math.floor((u+c.margin*2)*m),h=c.margin*m,b=[c.color.light,c.color.dark];for(let _=0;_<g;_++)for(let k=0;k<g;k++){let C=(_*g+k)*4,y=c.color.light;if(_>=h&&k>=h&&_<g-h&&k<g-h){const w=Math.floor((_-h)/m),S=Math.floor((k-h)/m);y=b[p[w*u+S]?1:0]}o[C++]=y.r,o[C++]=y.g,o[C++]=y.b,o[C]=y.a}}})(Sh)),Sh}var Nw;function q8(){return Nw||(Nw=1,(function(e){const t=kN();function s(l,c,u){l.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=u,c.width=u,c.style.height=u+"px",c.style.width=u+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,u,p){let m=p,g=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(g=o()),m=t.getOptions(m);const h=t.getImageWidth(c.modules.size,m),b=g.getContext("2d"),_=b.createImageData(h,h);return t.qrToImageData(_.data,c,m),s(b,g,h),b.putImageData(_,0,0),g},e.renderToDataURL=function(c,u,p){let m=p;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const g=e.render(c,u,m),h=m.type||"image/png",b=m.rendererOpts||{};return g.toDataURL(h,b.quality)}})(kh)),kh}var Ch={},Ew;function $8(){if(Ew)return Ch;Ew=1;const e=kN();function t(l,c){const u=l.a/255,p=c+'="'+l.hex+'"';return u<1?p+" "+c+'-opacity="'+u.toFixed(2).slice(1)+'"':p}function s(l,c,u){let p=l+c;return typeof u<"u"&&(p+=" "+u),p}function o(l,c,u){let p="",m=0,g=!1,h=0;for(let b=0;b<l.length;b++){const _=Math.floor(b%c),k=Math.floor(b/c);!_&&!g&&(g=!0),l[b]?(h++,b>0&&_>0&&l[b-1]||(p+=g?s("M",_+u,.5+k+u):s("m",m,0),m=0,g=!1),_+1<c&&l[b+1]||(p+=s("h",h),h=0)):m++}return p}return Ch.render=function(c,u,p){const m=e.getOptions(u),g=c.modules.size,h=c.modules.data,b=g+m.margin*2,_=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",k="<path "+t(m.color.dark,"stroke")+' d="'+o(h,g,m.margin)+'"/>',C='viewBox="0 0 '+b+" "+b+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+C+' shape-rendering="crispEdges">'+_+k+`</svg>
640
+ `;return typeof p=="function"&&p(null,w),w},Ch}var Rw;function F8(){if(Rw)return _l;Rw=1;const e=S8(),t=V8(),s=q8(),o=$8();function l(c,u,p,m,g){const h=[].slice.call(arguments,1),b=h.length,_=typeof h[b-1]=="function";if(!_&&!e())throw new Error("Callback required as last argument");if(_){if(b<2)throw new Error("Too few arguments provided");b===2?(g=p,p=u,u=m=void 0):b===3&&(u.getContext&&typeof g>"u"?(g=m,m=void 0):(g=m,m=p,p=u,u=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(p=u,u=m=void 0):b===2&&!u.getContext&&(m=p,p=u,u=void 0),new Promise(function(k,C){try{const y=t.create(p,m);k(c(y,u,m))}catch(y){C(y)}})}try{const k=t.create(p,m);g(null,c(k,u,m))}catch(k){g(k)}}return _l.create=t.create,_l.toCanvas=l.bind(null,s.render),_l.toDataURL=l.bind(null,s.renderToDataURL),_l.toString=l.bind(null,function(c,u,p){return o.render(c,p)}),_l}var G8=F8();const Y8=jx(G8);function X8({value:e,size:t=200}){const[s,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return Y8.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,t]),r.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:s?r.jsx("img",{src:s,width:t,height:t,alt:"QR"}):r.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function K8(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function Q8({open:e,onClose:t,onPaired:s}){const o=lt(),[l,c]=x.useState(null),[u,p]=x.useState(null),[m,g]=x.useState(0),[h,b]=x.useState(!1),_=x.useRef(null),k=x.useCallback(async()=>{c(null),p(null),b(!1);try{const N=await Fl.init();c(N),g(Math.round((N.ttl_ms||9e4)/1e3))}catch(N){N instanceof Yc&&N.status===403?p(f("settings.devices_pair_localhost_only")):p(N.message)}},[]);x.useEffect(()=>{e?k():(c(null),p(null),b(!1))},[e,k]),x.useEffect(()=>{if(!l||h||m<=0)return;const N=window.setTimeout(()=>g(E=>E-1),1e3);return()=>window.clearTimeout(N)},[l,m,h]),x.useEffect(()=>{if(!e||!l||h)return;let N=!0;const E=async()=>{try{const R=await Fl.status(l.pairing_id);if(!N)return;if(R.status==="confirmed"){b(!0),o.success(f("settings.devices_pair_done")),s(),window.setTimeout(()=>{N&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){g(0);return}}catch{}_.current=window.setTimeout(E,1500)};return _.current=window.setTimeout(E,1500),()=>{N=!1,_.current&&window.clearTimeout(_.current)}},[e,l,h,t,s,o]);const C=!!l&&!h&&m<=0,y=l?K8(l.lan_urls):"",w=l?`${y}/#pair=${l.pairing_id}`:"",S=async(N,E)=>{try{await navigator.clipboard.writeText(N),o.success(E)}catch{o.error(N)}};return r.jsxs(En,{open:e,onClose:t,title:f("settings.devices_pair_title"),description:f("settings.devices_pair_desc"),footer:r.jsx(de,{variant:"secondary",onClick:t,children:f("common.close")}),children:[u&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}),!u&&!l&&r.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[r.jsx(ja,{})," ",f("common.loading")]}),!u&&l&&r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx("div",{className:C?"opacity-40":"",children:r.jsx(X8,{value:w,size:196})}),h?r.jsx("p",{className:"text-sm font-medium text-emerald-500",children:f("settings.devices_pair_done")}):C?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-fg",children:f("settings.devices_pair_expired")}),r.jsx(de,{variant:"primary",onClick:()=>void k(),children:f("settings.devices_pair_regen")})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-xs text-muted-fg",children:f("settings.devices_pair_scan")}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(ja,{size:12}),r.jsx("span",{children:f("settings.devices_pair_waiting")}),r.jsxs("span",{className:"tabular-nums",children:["· ",f("settings.devices_pair_expires",{s:m})]})]}),r.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("settings.devices_pair_link")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:w}),r.jsx(Je,{content:f("settings.devices_pair_copy"),children:r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>S(w,f("settings.devices_pair_copied")),children:r.jsx(Yd,{size:14})})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("settings.devices_pair_code")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:l.pairing_id}),r.jsx(Je,{content:f("settings.devices_pair_copy"),children:r.jsx(de,{size:"sm",variant:"secondary",onClick:()=>S(l.pairing_id,f("settings.devices_pair_copied_code")),children:r.jsx(Yd,{size:14})})})]})]})]})]})]})]})}function Z8(){const e=lt(),{clients:t,isLoading:s,mutate:o}=k8(),[l,c]=x.useState(!1),u=async p=>{if(confirm(f("settings.devices_revoke_confirm",{id:p})))try{await Fl.revoke(p),e.success(f("settings.devices_revoke_success")),o()}catch(m){e.error(m.message)}};return r.jsxs(Ke,{title:f("settings.devices"),description:f("settings.devices_sub"),action:r.jsxs(de,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(TA,{size:14})," ",f("settings.devices_pair_btn")]}),children:[s&&r.jsx(ot,{}),!s&&t.length===0&&r.jsx(ht,{children:f("settings.devices_empty")}),t.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:t.map(p=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-medium",children:p.label||p.id}),r.jsx(Ye,{tone:p.kind==="web"?"info":p.kind==="deck"?"success":"muted",children:p.kind}),r.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",p.token_suffix]}),r.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[f("settings.devices_last_seen")," ",p.last_seen?new Date(p.last_seen).toLocaleString():f("settings.devices_never")]}),r.jsx(de,{size:"sm",variant:"destructive",onClick:()=>u(p.id),children:f("settings.devices_revoke")})]},p.id))}),r.jsx(Q8,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]})}const W8=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. General APX config.",fields:[{path:"port",label:"Port",kind:"number",placeholder:"7430"},{path:"host",label:"Host",placeholder:"127.0.0.1"},{path:"log_level",label:"Log level",placeholder:"info"},{path:"user.language",label:"Language",placeholder:"en"},{path:"user.locale",label:"Locale",placeholder:"en-US"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agent",fields:[{path:"super_agent.enabled",label:"Super-agent enabled",kind:"boolean"},{path:"super_agent.model",label:"Model",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:Ux.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Extra prompt",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling enabled",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Respond with engine",kind:"boolean"},{path:"telegram.route_to_agent",label:"Route to agent",placeholder:"master"},{path:"telegram.channels.0.chat_id",label:"Default chat ID"},{path:"telegram.channels.0.bot_token",label:"Default bot token",kind:"password"}]},{key:"engines",label:"Engines",fields:[{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.openai.base_url",label:"OpenAI base URL",placeholder:"https://api.openai.com/v1"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.groq.base_url",label:"Groq base URL",placeholder:"https://api.groq.com/openai/v1"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.openrouter.base_url",label:"OpenRouter base URL",placeholder:"https://openrouter.ai/api/v1"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"},{path:"engines.ollama.base_url",label:"Ollama URL",placeholder:"http://localhost:11434"}]}];function J8(){const{config:e,isLoading:t,patch:s,mutate:o}=qr();if(t)return r.jsx(ot,{});const l=async c=>{const u={};for(const[p,m]of Object.entries(Zb(c)))qa(m)||(u[p]=m);await s(u),o()};return r.jsx(Ke,{title:f("global_config.title"),description:f("settings_ui.global_config_desc"),children:r.jsx(fx,{sections:W8,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:f("settings_ui.global_json_desc"),onSaveFields:async(c,u)=>{await s(c,u),o()},onSaveJson:l})})}function e7(){const e=lt(),{health:t,isUp:s}=wC(),o=async()=>{try{await $l.reload(),e.success(f("settings.advanced.reload_success"))}catch(l){e.error(l.message)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("daemon.version"),action:r.jsx(de,{size:"sm",onClick:o,children:f("common.reload")}),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Nh,{label:f("daemon.version"),value:t?.version||"—"}),r.jsx(Nh,{label:f("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),r.jsx(Nh,{label:f("daemon.status"),value:f(s?"daemon.running":"daemon.down"),ok:s})]})}),r.jsx(J8,{})]})}function Nh({label:e,value:t,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Kc,{ok:s}),r.jsx("span",{children:t})]})]})}function t7(){const e=lt(),{theme:t,set:s}=Hx(),[o,l]=x.useState(""),[c,u]=x.useState(K2()),p=()=>{const g=o.trim();if(g){po(g);try{localStorage.setItem(Cn.token,g)}catch{}l(""),e.success(f("settings.token_saved"))}},m=g=>{Y2(g),u(g),window.location.reload()};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ke,{title:f("settings.appearance"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(de,{variant:t==="light"?"primary":"secondary",onClick:()=>s("light"),children:f("settings.light_mode")}),r.jsx(de,{variant:t==="dark"?"primary":"secondary",onClick:()=>s("dark"),children:f("settings.dark_mode")})]})}),r.jsx(Ke,{title:f("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:X2.map(g=>r.jsx(de,{variant:c===g.value?"primary":"secondary",onClick:()=>m(g.value),children:g.label},g.value))})}),r.jsxs(Ke,{title:f("settings.token"),description:f("settings.token_sub"),children:[r.jsx(ue,{label:f("settings_ui.bearer_label"),children:r.jsx(Ae,{type:"password",placeholder:Db()?f("settings.token_active"):f("settings.token_paste"),value:o,onChange:g=>l(g.target.value),className:"font-mono",onKeyDown:g=>{g.key==="Enter"&&p()}})}),r.jsx("div",{className:"mt-2",children:r.jsx(de,{variant:"primary",onClick:p,children:f("common.save")})})]})]})}const n7=[{title:f("settings.account_section"),items:[{key:"identity",label:f("settings.tabs.identity"),icon:Bx},{key:"appearance",label:f("settings.appearance"),icon:NA}]},{title:f("settings.agents_section"),items:[{key:"super_agent",label:f("settings.tabs.super_agent"),icon:gn},{key:"engines",label:f("settings.tabs.engines"),icon:Ox},{key:"memory",label:"Memory (RAG)",icon:kk},{key:"skills",label:"Skills (RAG)",icon:fs}]},{title:f("settings.channels_section"),items:[{key:"telegram",label:f("settings.tabs.telegram"),icon:Ya},{key:"devices",label:f("settings.tabs.devices"),icon:AA}]},{title:f("settings.advanced_section"),items:[{key:"advanced",label:f("settings.tabs.advanced"),icon:Qd}]}],a7=new Set(["engines","telegram","memory","skills","appearance"]),s7={identity:()=>r.jsx(f8,{}),super_agent:()=>r.jsx(p8,{}),engines:()=>r.jsx(KC,{}),memory:()=>r.jsx(h8,{}),skills:()=>r.jsx(b8,{}),telegram:()=>r.jsx(w8,{}),devices:()=>r.jsx(Z8,{}),appearance:()=>r.jsx(t7,{}),advanced:()=>r.jsx(e7,{})};function r7(){const e=Zn(),t=Qn(),s=o7(t.pathname),o=s7[s],{collapsed:l,toggle:c}=Ab(Cn.sidebarCollapsed+".settings");return r.jsx(OC,{sections:n7,active:s,onChange:u=>e(u==="identity"?"/settings":`/settings/${l7(u)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${a7.has(s)?"":"mx-auto max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:r.jsx(o,{})})}function o7(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"skills":return"skills";case"telegram":return"telegram";case"devices":return"devices";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function l7(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function i7({engines:e,order:t,mode:s,configuredProvider:o,onSetMode:l,onSetDefault:c,onToggleEnabled:u,onReorder:p,onConfigure:m,busy:g}){const h=new Map(e.map(C=>[C.id,C])),b=[...t.filter(C=>h.has(C)),...e.map(C=>C.id).filter(C=>!t.includes(C))],_=s==="chain",k=(C,y)=>{const w=b.indexOf(C),S=w+y;if(w<0||S<0||S>=b.length)return;const N=[...b];[N[w],N[S]]=[N[S],N[w]],p(N)};return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg border border-border p-3",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("voice_ui.selection_mode")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f(_?"voice_ui.mode_chain_desc":"voice_ui.mode_single_desc")})]}),r.jsxs("div",{className:"flex shrink-0 overflow-hidden rounded-md border border-border",role:"group",children:[r.jsx("button",{type:"button",onClick:()=>l("chain"),disabled:g,"data-testid":"voice-mode-chain",className:Oe("px-3 py-1.5 text-xs font-medium transition-colors",_?"bg-emerald-500/15 text-emerald-300":"text-muted-fg hover:text-fg"),children:f("voice_ui.mode_chain_btn")}),r.jsx("button",{type:"button",onClick:()=>l("single"),disabled:g,"data-testid":"voice-mode-single",className:Oe("border-l border-border px-3 py-1.5 text-xs font-medium transition-colors",_?"text-muted-fg hover:text-fg":"bg-emerald-500/15 text-emerald-300"),children:f("voice_ui.mode_single_btn")})]})]})}),r.jsx("div",{className:"space-y-2",children:b.map((C,y)=>{const w=h.get(C),S=mf[C]||{name:C,note:""},N=!_&&o===C,E=C==="mock";return r.jsxs("div",{"data-testid":`voice-provider-${C}`,className:Oe("flex items-center gap-3 rounded-lg border px-3 py-2.5",N?"border-emerald-500/50 bg-emerald-500/10":"border-border",_&&!E&&!w.enabled&&"opacity-60"),children:[_&&r.jsxs("div",{className:"flex flex-col",children:[r.jsx("button",{type:"button",onClick:()=>k(C,-1),disabled:g||y===0,"aria-label":f("voice_ui.move_up"),"data-testid":`voice-provider-${C}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(wk,{className:"size-3.5"})}),r.jsx("button",{type:"button",onClick:()=>k(C,1),disabled:g||y===b.length-1,"aria-label":f("voice_ui.move_down"),"data-testid":`voice-provider-${C}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Qs,{className:"size-3.5"})})]}),r.jsx(Kc,{ok:w.available?!0:w.configured?!1:null}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:S.name}),S.local&&r.jsx(Ye,{tone:"info",children:f("voice_ui.badge_local")}),w.available?r.jsx(Ye,{tone:"success",children:f("voice_ui.badge_available")}):w.configured?r.jsx(Ye,{tone:"warning",children:f("voice_ui.badge_unavailable")}):r.jsx(Ye,{tone:"muted",children:f("voice_ui.badge_not_configured")}),N&&r.jsx(Ye,{tone:"success",children:f("voice_ui.badge_default")})]}),r.jsx("div",{className:"truncate text-xs text-muted-fg",children:S.note})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[_?r.jsx(Wt,{checked:E?!0:w.enabled,onChange:R=>u(C,R),disabled:g||E}):!N&&r.jsxs(de,{size:"sm",variant:"ghost",onClick:()=>c(C),disabled:g,"data-testid":`voice-provider-${C}-default`,children:[r.jsx(ZM,{className:"size-3.5"})," ",f("voice_ui.set_as_default")]}),N&&r.jsx(Ax,{className:"size-4 text-emerald-400"}),r.jsxs(de,{size:"sm",variant:"secondary",onClick:()=>m(C),"data-testid":`voice-provider-${C}-config`,children:[r.jsx(MA,{className:"size-3.5"})," ",f("voice_ui.configure")]})]})]},C)})})]})}function za(e){return typeof e=="string"?e:e==null?"":String(e)}function c7({open:e,providerId:t,config:s,onClose:o,onSave:l}){const[c,u]=x.useState(!1),[p,m]=x.useState(null),[g,h]=x.useState(""),[b,_]=x.useState({});if(x.useEffect(()=>{if(!e||!t)return;m(null),h("");const R=s||{};if(t==="piper"){const M=R;_({bin:za(M.bin),model:za(M.model),speaker:za(M.speaker)})}else if(t==="elevenlabs"){const M=R;_({model:za(M.model),voice_id:za(M.voice_id),output_format:za(M.output_format)})}else if(t==="openai"){const M=R;_({model:za(M.model)||"tts-1",voice:za(M.voice)||"alloy",format:za(M.format)||"mp3"})}else if(t==="gemini"){const M=R;_({model:za(M.model),voice:za(M.voice)||"Kore",style:za(M.style)})}else _({})},[e,t,s]),!t)return null;const k=mf[t],C=`voice.tts.${t}`,y=R=>_(M=>({...M,...R})),w=t!=="piper"&&t!=="mock",S=w&&qa(s?.api_key),N=S?f("voice_ui.api_key_set",{suffix:Gl(s?.api_key)??""}):f("voice_ui.api_key_label"),E=async()=>{u(!0),m(null);try{const R={},M=[],T=(A,z)=>{z.trim()?R[`${C}.${A}`]=z.trim():M.push(`${C}.${A}`)};t==="piper"?(T("bin",b.bin),T("model",b.model),b.speaker.trim()?R[`${C}.speaker`]=b.speaker.trim():M.push(`${C}.speaker`)):t==="elevenlabs"?(T("model",b.model),T("voice_id",b.voice_id),T("output_format",b.output_format)):t==="openai"?(T("model",b.model),T("voice",b.voice),T("format",b.format)):t==="gemini"&&(T("model",b.model),T("voice",b.voice),T("style",b.style)),w&&g.trim()&&(R[`${C}.api_key`]=g.trim()),await l({set:R,unset:M}),o()}catch(R){m(R.message||f("voice_ui.err_save"))}finally{u(!1)}};return r.jsx(En,{open:e,onClose:o,title:f("voice_screen.configure_provider",{name:k?.name||t||""}),description:k?.note,size:"md",footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:o,disabled:c,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:E,loading:c,"data-testid":"voice-provider-save",children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[t==="piper"&&r.jsxs(r.Fragment,{children:[r.jsx(ue,{label:f("voice_ui.piper_bin_label"),hint:f("voice_ui.piper_bin_hint"),children:r.jsx(Ae,{value:b.bin,onChange:R=>y({bin:R.target.value}),placeholder:"piper"})}),r.jsx(ue,{label:f("voice_ui.piper_model_label"),hint:f("voice_ui.piper_model_hint"),children:r.jsx(Ae,{value:b.model,onChange:R=>y({model:R.target.value}),placeholder:"/abs/path/voice.onnx"})}),r.jsx(ue,{label:f("voice_ui.piper_speaker_label"),hint:f("voice_ui.piper_speaker_hint"),children:r.jsx(Ae,{value:b.speaker,onChange:R=>y({speaker:R.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&r.jsxs(r.Fragment,{children:[r.jsx(ue,{label:f("voice_ui.api_key_label"),hint:S?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:r.jsx(Ae,{type:"password",autoComplete:"new-password",value:g,onChange:R=>h(R.target.value),placeholder:N})}),r.jsx(ue,{label:f("voice_ui.model_label"),children:r.jsx(kt,{value:b.model||"",onChange:R=>y({model:R}),options:SD.map(R=>({value:R,label:R})),placeholder:"eleven_multilingual_v2"})}),r.jsx(ue,{label:f("voice_ui.voice_id_label"),hint:f("voice_ui.voice_id_hint"),children:r.jsx(Ae,{value:b.voice_id,onChange:R=>y({voice_id:R.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),r.jsx(ue,{label:f("voice_ui.output_format_label"),children:r.jsx(Ae,{value:b.output_format,onChange:R=>y({output_format:R.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&r.jsxs(r.Fragment,{children:[r.jsx(ue,{label:f("voice_ui.api_key_label"),hint:S?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:r.jsx(Ae,{type:"password",autoComplete:"new-password",value:g,onChange:R=>h(R.target.value),placeholder:N})}),r.jsx(ue,{label:f("voice_ui.model_label"),children:r.jsx(kt,{value:b.model||"tts-1",onChange:R=>y({model:R}),options:CD.map(R=>({value:R,label:R}))})}),r.jsx(ue,{label:f("voice_ui.voice_label"),children:r.jsx(kt,{value:b.voice||"alloy",onChange:R=>y({voice:R}),options:wD.map(R=>({value:R,label:R}))})}),r.jsx(ue,{label:f("voice_ui.format_label"),children:r.jsx(kt,{value:b.format||"mp3",onChange:R=>y({format:R}),options:["mp3","opus","aac","flac","wav"].map(R=>({value:R,label:R}))})})]}),t==="gemini"&&r.jsxs(r.Fragment,{children:[r.jsx(ue,{label:f("voice_ui.api_key_label"),hint:S?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:r.jsx(Ae,{type:"password",autoComplete:"new-password",value:g,onChange:R=>h(R.target.value),placeholder:N})}),r.jsx(ue,{label:f("voice_ui.model_label"),hint:f("voice_ui.gemini_model_hint"),children:r.jsx(Ae,{value:b.model,onChange:R=>y({model:R.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),r.jsx(ue,{label:f("voice_ui.voice_label"),children:r.jsx(kt,{value:b.voice||"Kore",onChange:R=>y({voice:R}),options:kD.map(R=>({value:R,label:R}))})}),r.jsx(ue,{label:f("voice_ui.style_label"),hint:f("voice_ui.style_hint"),children:r.jsx(Pn,{rows:2,value:b.style||"",onChange:R=>y({style:R.target.value}),placeholder:f("voice_ui.style_ph")})})]}),t==="mock"&&r.jsx("p",{className:"text-sm text-muted-fg",children:f("voice_ui.mock_desc")}),p&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p})]})})}function u7(){const e=x.useRef(null),t=x.useRef(null),[s,o]=x.useState(!1),[l,c]=x.useState(!1),u=x.useCallback(()=>{t.current&&(URL.revokeObjectURL(t.current),t.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),u()},[u]);const p=x.useCallback(async g=>{c(!0);try{u();const h=await ED(g);t.current=h,e.current||(e.current=new Audio);const b=e.current;b.src=h,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[u]),m=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:p,stop:m,playing:s,loading:l}}function d7({engines:e,defaultProvider:t,mode:s}){const o=lt(),{play:l,stop:c,playing:u,loading:p}=u7(),[m,g]=x.useState(f("voice_ui.test_default_text")),[h,b]=x.useState(""),[_,k]=x.useState(""),[C,y]=x.useState(!1),[w,S]=x.useState(null),E=[{value:"",label:s==="single"&&t&&t!=="auto"?f("voice_ui.test_default_engine",{name:mf[t]?.name||t}):f("voice_ui.test_default_chain")},...e.map(M=>({value:M.id,label:`${mf[M.id]?.name||M.id}${M.available?"":f("voice_ui.test_unavailable_suffix")}`}))],R=async()=>{const M=m.trim();if(!M){o.error(f("voice_ui.test_empty_error"));return}y(!0);try{const T=await iC.say({text:M,provider:h||void 0,style:_.trim()||void 0});S(T),await l(T.audio_path)}catch(T){o.error(T.message||f("voice_ui.test_synth_error"))}finally{y(!1)}};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(ue,{label:f("voice_ui.test_engine_label"),hint:f("voice_ui.test_engine_hint"),children:r.jsx(kt,{value:h,onChange:b,options:E})}),r.jsx(ue,{label:f("voice_ui.test_style_label"),hint:f("voice_ui.test_style_hint"),children:r.jsx(Ae,{value:_,onChange:M=>k(M.target.value),placeholder:f("voice_ui.style_ph"),"data-testid":"voice-test-style"})})]}),r.jsx(ue,{label:f("voice_ui.test_text_label"),children:r.jsx(Pn,{rows:2,value:m,onChange:M=>g(M.target.value),placeholder:f("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(de,{variant:"primary",onClick:R,loading:C,disabled:p,"data-testid":"voice-test-say",children:[r.jsx(LA,{className:"size-4"})," ",f("voice_ui.say_this")]}),u?r.jsxs(de,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(Ok,{className:"size-4"})," ",f("voice_ui.stop")]}):w?r.jsxs(de,{variant:"secondary",onClick:()=>l(w.audio_path),loading:p,"data-testid":"voice-test-replay",children:[r.jsx(Lx,{className:"size-4"})," ",f("voice_ui.replay")]}):null,w&&r.jsxs("span",{className:"text-xs text-muted-fg",children:[f("voice_ui.engine_result"),": ",r.jsx("strong",{children:w.provider}),w.duration_s?` · ${w.duration_s.toFixed(1)}s`:""]})]})]})}const f7=()=>[{value:"auto",label:f("voice_ui.stt_provider_auto")},{value:"local",label:f("voice_ui.stt_provider_local")},{value:"openai",label:f("voice_ui.stt_provider_openai")}],p7=()=>[{value:"auto",label:f("voice_ui.lang_auto")},{value:"es",label:f("voice_ui.lang_es")},{value:"en",label:f("voice_ui.lang_en")},{value:"pt",label:f("voice_ui.lang_pt")},{value:"fr",label:f("voice_ui.lang_fr")},{value:"it",label:f("voice_ui.lang_it")},{value:"de",label:f("voice_ui.lang_de")}];function m7({config:e,onPatch:t,busy:s}){const o=e.provider||"auto",l=e.local||{},c=l.model||"small",u=l.language||"auto",p=o!=="openai";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:f("voice_ui.stt_engine_label"),hint:f("voice_ui.stt_engine_hint"),children:r.jsx(kt,{value:o,onChange:m=>t({"transcription.provider":m}),options:f7(),disabled:s,className:"max-w-md"})}),p&&r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ue,{label:f("voice_ui.stt_model_label"),hint:f("voice_ui.stt_model_hint"),children:r.jsx(kt,{value:c,onChange:m=>t({"transcription.local.model":m}),options:ND.map(m=>({value:m,label:m})),disabled:s})}),r.jsx(ue,{label:f("voice_ui.stt_language_label"),hint:f("voice_ui.stt_language_hint"),children:r.jsx(kt,{value:u,onChange:m=>t({"transcription.local.language":m}),options:p7(),disabled:s})})]})]})}function g7(){const e=lt(),{config:t,isLoading:s,patch:o,mutate:l}=qr(),{data:c,isLoading:u,error:p,mutate:m}=Ze("/tts/providers",()=>iC.providers()),[g,h]=x.useState(null),[b,_]=x.useState(!1),k=t,C=k.voice?.tts||{},y=k.transcription||{},w=c?.configured_provider||C.provider||"auto",S=c?.mode||C.mode||"chain",N=c?.engines||[],E=c?.order||[],R=x.useMemo(()=>g?C[g]||{}:{},[g,C]),M=async P=>{_(!0);try{await o({"voice.tts.provider":P,"voice.tts.mode":"single"}),await m(),e.success(f("voice_ui.toast_default_engine",{id:P}))}catch(L){e.error(L.message)}finally{_(!1)}},T=async P=>{_(!0);try{const L={"voice.tts.mode":P};if(P==="single"&&(w==="auto"||!w)){const U=N.find(q=>q.available)?.id||E[0]||"mock";L["voice.tts.provider"]=U}await o(L),await m(),e.success(f(P==="chain"?"voice_ui.toast_mode_chain":"voice_ui.toast_mode_single"))}catch(L){e.error(L.message)}finally{_(!1)}},A=async(P,L)=>{_(!0);try{await o({[`voice.tts.${P}.enabled`]:L}),await m()}catch(U){e.error(U.message)}finally{_(!1)}},z=async P=>{_(!0);try{await o({"voice.tts.order":P}),await m()}catch(L){e.error(L.message)}finally{_(!1)}},I=async({set:P,unset:L})=>{await o(P,L.length?L:void 0),await m(),await l(),e.success(f("voice_ui.toast_config_saved"))},D=async(P,L)=>{try{await o(P,L),e.success(f("voice_ui.toast_transcription_updated"))}catch(U){e.error(U.message)}};return r.jsxs("div",{className:"p-6","data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx(Ke,{title:f("voice_screen.providers_title"),description:f("voice_ui.providers_desc"),children:u||s?r.jsx(ot,{}):p?r.jsx(ht,{children:f("voice_ui.providers_load_error",{msg:p.message})}):r.jsx(i7,{engines:N,order:E,mode:S,configuredProvider:w,onSetMode:T,onSetDefault:M,onToggleEnabled:A,onReorder:z,onConfigure:P=>h(P),busy:b})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ke,{title:f("voice_screen.test_title"),description:f("voice_ui.test_desc"),children:r.jsx(d7,{engines:N,defaultProvider:w,mode:S})}),r.jsx(Ke,{title:f("voice_screen.stt_title"),description:f("voice_ui.stt_desc"),children:s?r.jsx(ot,{}):r.jsx(m7,{config:y,onPatch:D})})]})]}),r.jsx(c7,{open:!!g,providerId:g,config:R,onClose:()=>h(null),onSave:I})]})}const Eh={status:()=>he.get("/desktop/status"),autostartGet:()=>he.get("/desktop/autostart"),autostartSet:e=>he.post("/desktop/autostart",{enable:e})};function h7(e=30){return he.get(`/messages/global?channel=desktop&limit=${e}`)}const Tw="CommandOrControl+G",x7=()=>[{value:"left",label:f("modules_ui.desktop_pos_left")},{value:"center",label:f("modules_ui.desktop_pos_center")},{value:"right",label:f("modules_ui.desktop_pos_right")}],b7=()=>[{value:"light",label:f("modules_ui.desktop_theme_light")},{value:"dark",label:f("modules_ui.desktop_theme_dark")}];function v7(){const e=lt(),{config:t,isLoading:s,patch:o}=qr(),l=t,c=l.desktop?.shortcut||l.overlay?.shortcut||Tw,u=l.desktop?.enabled!==!1,p=l.desktop?.theme||"light",m=l.desktop?.position||"right",{data:g,isLoading:h,mutate:b}=Ze("/desktop/status",()=>Eh.status(),{refreshInterval:5e3}),_=!!g?.running,{data:k,mutate:C}=Ze("/desktop/autostart",()=>Eh.autostartGet()),{data:y,isLoading:w,mutate:S}=Ze("/messages/global?channel=desktop",()=>h7(40),{refreshInterval:8e3}),[N,E]=x.useState(c),[R,M]=x.useState(!1),[T,A]=x.useState(!1);x.useEffect(()=>E(c),[c]);const z=async()=>{const P=N.trim();if(!(!P||P===c)){M(!0);try{await o({"desktop.shortcut":P}),e.success(f("modules_ui.desktop_shortcut_saved"))}catch(L){e.error(L.message)}finally{M(!1)}}},I=async(P,L,U)=>{M(!0);try{await o({[P]:L}),e.success(U)}catch(q){e.error(q.message)}finally{M(!1)}},D=async P=>{A(!0);try{await Eh.autostartSet(P),await C(),e.success(f(P?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(L){e.error(L.message)}finally{A(!1)}};return r.jsx("div",{className:"mx-auto max-w-6xl space-y-6 p-6","data-testid":"screen-desktop",children:r.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_1fr]",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ke,{title:f("desktop_screen.status_title"),description:f("modules_ui.desktop_status_desc"),children:[h?r.jsx(ot,{}):r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Kc,{ok:_}),r.jsx("span",{className:"font-medium",children:f(_?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),r.jsx("button",{type:"button",onClick:()=>b(),className:"ml-2 text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")})]}),r.jsxs("p",{className:"mt-3 text-xs text-muted-fg",children:[f("modules_ui.desktop_from_terminal")," ",r.jsx(kj,{children:"apx desktop start"})," · ",r.jsx(kj,{children:"apx desktop --debug"})]})]}),r.jsx(Ke,{title:f("desktop_screen.autostart_title"),description:f("modules_ui.desktop_autostart_desc"),children:k?r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Wt,{checked:k.enabled,onChange:D,disabled:T,label:k.enabled?f("common.enabled"):f("common.disabled")}),r.jsx("span",{className:"text-xs text-muted-fg",children:f("modules_ui.desktop_platform",{platform:k.platform})})]}):r.jsx(ot,{})}),r.jsx(Ke,{title:f("desktop_screen.shortcut_title"),description:f("modules_ui.desktop_shortcut_desc"),children:s?r.jsx(ot,{}):r.jsxs("div",{className:"flex items-end gap-3",children:[r.jsx("div",{className:"flex-1",children:r.jsx(ue,{label:f("modules_ui.desktop_accelerator"),hint:f("modules_ui.desktop_accelerator_hint"),children:r.jsx(Ae,{value:N,onChange:P=>E(P.target.value),onKeyDown:P=>{P.key==="Enter"&&z()},placeholder:Tw,className:"max-w-md font-mono",disabled:R})})}),r.jsx(de,{variant:"primary",onClick:z,loading:R,disabled:!N.trim()||N.trim()===c,children:f("common.save")})]})}),r.jsx(Ke,{title:f("desktop_screen.appearance_title"),description:f("modules_ui.desktop_appearance_desc"),children:s?r.jsx(ot,{}):r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ue,{label:f("modules_ui.desktop_theme"),hint:f("modules_ui.desktop_restart_apply"),children:r.jsx(kt,{value:p,onChange:P=>I("desktop.theme",P,f("modules_ui.desktop_theme_set",{value:P})),options:b7(),disabled:R})}),r.jsx(ue,{label:f("modules_ui.desktop_position"),hint:f("modules_ui.desktop_position_hint"),children:r.jsx(kt,{value:m,onChange:P=>I("desktop.position",P,f("modules_ui.desktop_position_set",{value:P})),options:x7(),disabled:R})})]})}),r.jsx(Ke,{title:f("desktop_screen.activation_title"),description:f("modules_ui.desktop_activation_desc"),children:s?r.jsx(ot,{}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Wt,{checked:u,onChange:P=>I("desktop.enabled",P,f(P?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:R,label:f(u?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),r.jsxs("p",{className:"text-xs text-muted-fg",children:[f("modules_ui.desktop_stt_engine")," ",r.jsx(Mx,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:f("nav.modules.voice")})," ",f("modules_ui.desktop_stt_engine_suffix")]})]})})]}),r.jsx("div",{children:r.jsx(Ke,{title:f("desktop_screen.last_conv_title"),description:f("modules_ui.desktop_last_conv_desc"),action:r.jsx("button",{type:"button",onClick:()=>S(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")}),children:r.jsx(_7,{messages:y||[],loading:w})})})]})})}function _7({messages:e,loading:t}){const s=x.useMemo(()=>j7(e),[e]);return t?r.jsx(ot,{}):e.length?r.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((o,l)=>r.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,u)=>r.jsx(y7,{m:c},u))},l))}):r.jsx(ht,{children:f("modules_ui.desktop_no_messages")})}function y7({m:e}){const t=e.direction==="in",s=w7(e.ts);return r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-semibold",children:f(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),r.jsx("span",{children:s})]}),r.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||r.jsx("span",{className:"italic opacity-50",children:f("modules_ui.desktop_empty_msg")})})]})}function j7(e){const t=[];for(const s of e)s.direction==="in"||!t.length?t.push([s]):t[t.length-1].push(s);return t}function w7(e){try{const t=new Date(e);return t.toDateString()===new Date().toDateString()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function k7(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function S7({manifest:e}){const t=e.daemon,s=e.safety;return r.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"font-semibold text-foreground",children:[t.name," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_daemon_active",{uptime:k7(t.uptime_s)})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),r.jsx("span",{className:"text-muted-fg",children:"·"}),r.jsxs("span",{className:"text-muted-fg",children:[f("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),r.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&r.jsx(Ye,{tone:"success",children:f("modules_ui.deck_safety_no_shell")}),s.arbitrary_commands===!1&&r.jsx(Ye,{tone:"success",children:f("modules_ui.deck_safety_no_arbitrary")}),s.dangerous_actions_require_confirmation&&r.jsx(Ye,{tone:"info",children:f("modules_ui.deck_safety_confirm")})]})]})}function C7(e){return e==="available"?"success":e==="configured"?"info":"muted"}function N7(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function E7(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function R7({widget:e,onToggle:t}){const s=e.source==="external",[o,l]=x.useState(!1),c=e.user_enabled===!0,u=async p=>{if(!(!t||o)){l(!0);try{await t(p)}finally{l(!1)}}};return r.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Oe("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",s?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[r.jsx(Je,{content:e.source==="apx"?f("deck_screen.widget_native"):f("deck_screen.widget_external"),children:r.jsx("span",{className:Oe("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium",children:e.title}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),r.jsx(Ye,{tone:E7(e.kind),children:e.kind}),r.jsx(Ye,{tone:C7(e.status),children:N7(e.status)}),s?r.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:r.jsx(Wt,{checked:c,onChange:u,disabled:o||!t})}):r.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function T7({desktop:e,widgets:t,onToggle:s}){return t.length===0?null:r.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),r.jsx("ul",{className:"space-y-1.5",children:t.map(o=>r.jsx(R7,{widget:o,onToggle:o.source==="external"?l=>s(o.id,l):void 0},o.id))})]})}function M7(){const e=lt(),{data:t,error:s,isLoading:o,mutate:l}=Ze("/deck/manifest",()=>jj.manifest(),{refreshInterval:3e4}),c=async(b,_)=>{try{await jj.setWidget(b,{enabled:_}),await l(k=>k&&{...k,deck:{...k.deck,widgets:k.deck.widgets.map(C=>C.id===b?{...C,user_enabled:_,status:_?C.daemon_status?"available":"configured":"disabled"}:C)}},{revalidate:!1}),e.success(_?f("modules_ui.deck_widget_enabled",{id:b}):f("modules_ui.deck_widget_disabled",{id:b})),setTimeout(()=>l(),800)}catch(k){const C=k instanceof Error?k.message:f("modules_ui.deck_save_error");e.error(C)}},u=t?.deck.desktops??[],p=t?.deck.widgets??[],m=u.map(b=>({desktop:b,widgets:p.filter(_=>_.desktop===b.id)})),h=p.filter(b=>b.source==="external").filter(b=>b.user_enabled===!0).length;return r.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-deck",children:[t&&r.jsx(S7,{manifest:t}),r.jsxs(Ke,{title:f("deck_screen.widgets_title"),description:o?f("modules_ui.deck_loading_manifest"):s?f("modules_ui.deck_manifest_error"):f("modules_ui.deck_widgets_summary",{count:p.length,enabled:h}),action:r.jsx(Je,{content:f("deck_screen.reload_manifest"),children:r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>l(),disabled:o,"aria-label":f("deck_screen.reload_manifest"),children:r.jsx(cs,{size:14,className:o?"animate-spin":""})})}),children:[o&&r.jsx(ot,{label:f("modules_ui.deck_loading_manifest_full")}),!o&&s&&r.jsxs(ht,{children:[f("modules_ui.deck_manifest_load_failed")," ",r.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>l(),children:f("modules_ui.deck_retry")})]}),!o&&!s&&p.length===0&&r.jsx(ht,{children:f("modules_ui.deck_no_widgets")}),!o&&!s&&p.length>0&&r.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:m.filter(b=>b.widgets.length>0).map(b=>r.jsx(T7,{desktop:b.desktop,widgets:b.widgets,onToggle:c},b.desktop.id))})]}),t?.apx&&r.jsx(Ke,{title:f("deck_screen.context_title"),description:f("modules_ui.deck_context_desc"),children:r.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_project")}),r.jsx("span",{className:"font-medium",children:t.apx.active_project?t.apx.active_project.name:f("modules_ui.deck_none")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_registered_projects")}),r.jsx("span",{className:"font-medium",children:t.apx.projects.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_plugins")}),r.jsx("span",{className:"font-medium",children:Object.keys(t.apx.plugins).join(", ")||"—"})]})]})})]})}function A7(e,t){const s=getComputedStyle(e),o=parseFloat(s.fontSize);return t*o}function O7(e,t){const s=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(s.fontSize);return t*o}function z7(e){return e/100*window.innerHeight}function D7(e){return e/100*window.innerWidth}function P7(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function bc({groupSize:e,panelElement:t,styleProp:s}){let o;const[l,c]=P7(s);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=O7(t,l);break}case"em":{o=A7(t,l);break}case"vh":{o=z7(l);break}case"vw":{o=D7(l);break}}return o}function Xn(e){return parseFloat(e.toFixed(3))}function Kl({group:e}){const{orientation:t,panels:s}=e;return s.reduce((o,l)=>(o+=t==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function vx(e){const{panels:t}=e,s=Kl({group:e});return s===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:l,panelConstraints:c}=o;let u=0;if(c.collapsedSize!==void 0){const h=bc({groupSize:s,panelElement:l,styleProp:c.collapsedSize});u=Xn(h/s*100)}let p;if(c.defaultSize!==void 0){const h=bc({groupSize:s,panelElement:l,styleProp:c.defaultSize});p=Xn(h/s*100)}let m=0;if(c.minSize!==void 0){const h=bc({groupSize:s,panelElement:l,styleProp:c.minSize});m=Xn(h/s*100)}let g=100;if(c.maxSize!==void 0){const h=bc({groupSize:s,panelElement:l,styleProp:c.maxSize});g=Xn(h/s*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:u,collapsible:c.collapsible===!0,defaultSize:p,disabled:c.disabled,minSize:m,maxSize:g,panelId:o.id}})}function Ht(e,t="Assertion error"){if(!e)throw Error(t)}function _x(e,t){return Array.from(t).sort(e==="horizontal"?L7:I7)}function L7(e,t){const s=e.element.offsetLeft-t.element.offsetLeft;return s!==0?s:e.element.offsetWidth-t.element.offsetWidth}function I7(e,t){const s=e.element.offsetTop-t.element.offsetTop;return s!==0?s:e.element.offsetHeight-t.element.offsetHeight}function SN(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function CN(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function B7({orientation:e,rects:t,targetRect:s}){const o={x:s.x+s.width/2,y:s.y+s.height/2};let l,c=Number.MAX_VALUE;for(const u of t){const{x:p,y:m}=CN(o,u),g=e==="horizontal"?p:m;g<c&&(c=g,l=u)}return Ht(l,"No rect found"),l}let Od;function U7(){return Od===void 0&&(typeof matchMedia=="function"?Od=!!matchMedia("(pointer:coarse)").matches:Od=!1),Od}function NN(e){const{element:t,orientation:s,panels:o,separators:l}=e,c=_x(s,Array.from(t.children).filter(SN).map(C=>({element:C}))).map(({element:C})=>C),u=[];let p=!1,m=!1,g=-1,h=-1,b=0,_,k=[];{let C=-1;for(const y of c)y.hasAttribute("data-panel")&&(C++,y.hasAttribute("data-disabled")||(b++,g===-1&&(g=C),h=C))}if(b>1){let C=-1;for(const y of c)if(y.hasAttribute("data-panel")){C++;const w=o.find(S=>S.element===y);if(w){if(_){const S=_.element.getBoundingClientRect(),N=y.getBoundingClientRect();let E;if(m){const R=s==="horizontal"?new DOMRect(S.right,S.top,0,S.height):new DOMRect(S.left,S.bottom,S.width,0),M=s==="horizontal"?new DOMRect(N.left,N.top,0,N.height):new DOMRect(N.left,N.top,N.width,0);switch(k.length){case 0:{E=[R,M];break}case 1:{const T=k[0],A=B7({orientation:s,rects:[S,N],targetRect:T.element.getBoundingClientRect()});E=[T,A===S?M:R];break}default:{E=k;break}}}else k.length?E=k:E=[s==="horizontal"?new DOMRect(S.right,N.top,N.left-S.right,N.height):new DOMRect(N.left,S.bottom,N.width,N.top-S.bottom)];for(const R of E){let M="width"in R?R:R.element.getBoundingClientRect();const T=U7()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(M.width<T){const z=T-M.width;M=new DOMRect(M.x-z/2,M.y,M.width+z,M.height)}if(M.height<T){const z=T-M.height;M=new DOMRect(M.x,M.y-z/2,M.width,M.height+z)}const A=C<=g||C>h;!p&&!A&&u.push({group:e,groupSize:Kl({group:e}),panels:[_,w],separator:"width"in R?void 0:R,rect:M}),p=!1}}m=!1,_=w,k=[]}}else if(y.hasAttribute("data-separator")){y.ariaDisabled!==null&&(p=!0);const w=l.find(S=>S.element===y);w?k.push(w):(_=void 0,k=[])}else m=!0}return u}class EN{#e={};addListener(t,s){const o=this.#e[t];return o===void 0?this.#e[t]=[s]:o.includes(s)||o.push(s),()=>{this.removeListener(t,s)}}emit(t,s){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,s);else{let l=!1,c=null;const u=Array.from(o);for(let p=0;p<u.length;p++){const m=u[p];try{m.call(null,s)}catch(g){c===null&&(l=!0,c=g)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(t,s){const o=this.#e[t];if(o!==void 0){const l=o.indexOf(s);l>=0&&o.splice(l,1)}}}let ss=new Map;const RN=new EN;function H7(e){ss=new Map(ss),ss.delete(e)}function Mw(e,t){for(const[s]of ss)if(s.id===e)return s}function Mr(e,t){for(const[s,o]of ss)if(s.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Oo(){return ss}function lv(e,t){return RN.addListener("groupChange",s=>{s.group.id===e&&t(s)})}function Ks(e,t){const s=ss.get(e);ss=new Map(ss),ss.set(e,t),RN.emit("groupChange",{group:e,prev:s,next:t})}function V7(e,t,s){let o,l={x:1/0,y:1/0};for(const c of t){const u=CN(s,c.rect);switch(e){case"horizontal":{u.x<=l.x&&(o=c,l=u);break}case"vertical":{u.y<=l.y&&(o=c,l=u);break}}}return o?{distance:l,hitRegion:o}:void 0}function q7(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function $7(e,t){if(e===t)throw new Error("Cannot compare node with itself");const s={a:zw(e),b:zw(t)};let o;for(;s.a.at(-1)===s.b.at(-1);)o=s.a.pop(),s.b.pop();Ht(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:Ow(Aw(s.a)),b:Ow(Aw(s.b))};if(l.a===l.b){const c=o.childNodes,u={a:s.a.at(-1),b:s.b.at(-1)};let p=c.length;for(;p--;){const m=c[p];if(m===u.a)return 1;if(m===u.b)return-1}}return Math.sign(l.a-l.b)}const F7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function G7(e){const t=getComputedStyle(TN(e)??e).display;return t==="flex"||t==="inline-flex"}function Y7(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||G7(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||F7.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Aw(e){let t=e.length;for(;t--;){const s=e[t];if(Ht(s,"Missing node"),Y7(s))return s}return null}function Ow(e){return e&&Number(getComputedStyle(e).zIndex)||0}function zw(e){const t=[];for(;e;)t.push(e),e=TN(e);return t}function TN(e){const{parentNode:t}=e;return q7(t)?t.host:t}function X7(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function K7({groupElement:e,hitRegion:t,pointerEventTarget:s}){if(!SN(s)||s.contains(e)||e.contains(s))return!0;if($7(s,e)>0){let o=s;for(;o;){if(o.contains(e))return!0;if(X7(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function iv(e,t){const s=[];return t.forEach((o,l)=>{if(l.disabled)return;const c=NN(l),u=V7(l.orientation,c,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&K7({groupElement:l.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&s.push(u.hitRegion)}),s}function Q7(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=t[s])return!1;return!0}function Vn(e,t,s=0){return Math.abs(Xn(e)-Xn(t))<=s}function es(e,t){return Vn(e,t)?0:e>t?1:-1}function Sl({overrideDisabledPanels:e,panelConstraints:t,prevSize:s,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:u,maxSize:p=100,minSize:m=0}=t;if(u&&!e)return s;if(es(o,m)<0)if(c){const g=(l+m)/2;es(o,g)<0?o=l:o=m}else o=m;return o=Math.min(p,o),o=Xn(o),o}function zc({delta:e,initialLayout:t,panelConstraints:s,pivotIndices:o,prevLayout:l,trigger:c}){if(Vn(e,0))return t;const u=c==="imperative-api",p=Object.values(t),m=Object.values(l),g=[...p],[h,b]=o;Ht(h!=null,"Invalid first pivot index"),Ht(b!=null,"Invalid second pivot index");let _=0;switch(c){case"keyboard":{{const y=e<0?b:h,w=s[y];Ht(w,`Panel constraints not found for index ${y}`);const{collapsedSize:S=0,collapsible:N,minSize:E=0}=w;if(N){const R=p[y];if(Ht(R!=null,`Previous layout not found for panel index ${y}`),Vn(R,S)){const M=E-R;es(M,Math.abs(e))>0&&(e=e<0?0-M:M)}}}{const y=e<0?h:b,w=s[y];Ht(w,`No panel constraints found for index ${y}`);const{collapsedSize:S=0,collapsible:N,minSize:E=0}=w;if(N){const R=p[y];if(Ht(R!=null,`Previous layout not found for panel index ${y}`),Vn(R,E)){const M=R-S;es(M,Math.abs(e))>0&&(e=e<0?0-M:M)}}}break}default:{const y=e<0?b:h,w=s[y];Ht(w,`Panel constraints not found for index ${y}`);const S=p[y],{collapsible:N,collapsedSize:E,minSize:R}=w;if(N&&es(S,R)<0)if(e>0){const M=R-E,T=M/2,A=S+e;es(A,R)<0&&(e=es(e,T)<=0?0:M)}else{const M=R-E,T=100-M/2,A=S-e;es(A,R)<0&&(e=es(100+e,T)>0?0:-M)}break}}{const y=e<0?1:-1;let w=e<0?b:h,S=0;for(;;){const E=p[w];Ht(E!=null,`Previous layout not found for panel index ${w}`);const R=Sl({overrideDisabledPanels:u,panelConstraints:s[w],prevSize:E,size:100})-E;if(S+=R,w+=y,w<0||w>=s.length)break}const N=Math.min(Math.abs(e),Math.abs(S));e=e<0?0-N:N}{let y=e<0?h:b;for(;y>=0&&y<s.length;){const w=Math.abs(e)-Math.abs(_),S=p[y];Ht(S!=null,`Previous layout not found for panel index ${y}`);const N=S-w,E=Sl({overrideDisabledPanels:u,panelConstraints:s[y],prevSize:S,size:N});if(!Vn(S,E)&&(_+=S-E,g[y]=E,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(Q7(m,g))return l;{const y=e<0?b:h,w=p[y];Ht(w!=null,`Previous layout not found for panel index ${y}`);const S=w+_,N=Sl({overrideDisabledPanels:u,panelConstraints:s[y],prevSize:w,size:S});if(g[y]=N,!Vn(N,S)){let E=S-N,R=e<0?b:h;for(;R>=0&&R<s.length;){const M=g[R];Ht(M!=null,`Previous layout not found for panel index ${R}`);const T=M+E,A=Sl({overrideDisabledPanels:u,panelConstraints:s[R],prevSize:M,size:T});if(Vn(M,A)||(E-=A-M,g[R]=A),Vn(E,0))break;e>0?R--:R++}}}const k=Object.values(g).reduce((y,w)=>w+y,0);if(!Vn(k,100,.1))return l;const C=Object.keys(l);return g.reduce((y,w,S)=>(y[C[S]]=w,y),{})}function So(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(t[s]===void 0||es(e[s],t[s])!==0)return!1;return!0}function Co({layout:e,panelConstraints:t}){const s=Object.values(e),o=[...s],l=o.reduce((p,m)=>p+m,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(p=>`${p}%`).join(", ")}`);if(!Vn(l,100)&&o.length>0)for(let p=0;p<t.length;p++){const m=o[p];Ht(m!=null,`No layout data found for index ${p}`);const g=100/l*m;o[p]=g}let c=0;for(let p=0;p<t.length;p++){const m=s[p];Ht(m!=null,`No layout data found for index ${p}`);const g=o[p];Ht(g!=null,`No layout data found for index ${p}`);const h=Sl({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:g});g!=h&&(c+=g-h,o[p]=h)}if(!Vn(c,0))for(let p=0;p<t.length;p++){const m=o[p];Ht(m!=null,`No layout data found for index ${p}`);const g=m+c,h=Sl({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:g});if(m!==h&&(c-=h-m,o[p]=h,Vn(c,0)))break}const u=Object.keys(e);return o.reduce((p,m,g)=>(p[u[g]]=m,p),{})}function MN({groupId:e,panelId:t}){const s=()=>{const m=Oo();for(const[g,{defaultLayoutDeferred:h,derivedPanelConstraints:b,layout:_,groupSize:k,separatorToPanels:C}]of m)if(g.id===e)return{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:g,groupSize:k,layout:_,separatorToPanels:C};throw Error(`Group ${e} not found`)},o=()=>{const m=s().derivedPanelConstraints.find(g=>g.panelId===t);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${t}`)},l=()=>{const m=s().group.panels.find(g=>g.id===t);if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},c=()=>{const m=s().layout[t];if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:m,panels:g,prevLayout:h,derivedPanelConstraints:b})=>{const _=c(),k=g.findIndex(w=>w.id===t),C=k===0,y=k===g.length-1;if(y&&m<_&&(C||g.slice(0,k).every((w,S)=>{const N=b[S];return N?.collapsible&&Vn(N.collapsedSize,h[N.panelId])}))){const w=g.slice(0,k).reduce((S,N)=>S+h[N.id],0);return{...h,[t]:Xn(100-w)}}return zc({delta:y?_-m:m-_,initialLayout:h,panelConstraints:b,pivotIndices:y?[k-1,k]:[k,k+1],prevLayout:h,trigger:"imperative-api"})},p=m=>{const g=c();if(m===g)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:_,groupSize:k,layout:C,separatorToPanels:y}=s(),w=u({nextSize:m,panels:_.panels,prevLayout:C,derivedPanelConstraints:b}),S=Co({layout:w,panelConstraints:b});So(C,S)||Ks(_,{defaultLayoutDeferred:h,derivedPanelConstraints:b,groupSize:k,layout:S,separatorToPanels:y})};return{collapse:()=>{const{collapsible:m,collapsedSize:g}=o(),{mutableValues:h}=l(),b=c();m&&b!==g&&(h.expandToSize=b,p(g))},expand:()=>{const{collapsible:m,collapsedSize:g,minSize:h}=o(),{mutableValues:b}=l(),_=c();if(m&&_===g){let k=b.expandToSize??h;k===0&&(k=1),p(k)}},getSize:()=>{const{group:m}=s(),g=c(),{element:h}=l(),b=m.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:g,inPixels:b}},isCollapsed:()=>{const{collapsible:m,collapsedSize:g}=o(),h=c();return m&&Vn(g,h)},resize:m=>{const{group:g}=s(),{element:h}=l(),b=Kl({group:g}),_=bc({groupSize:b,panelElement:h,styleProp:m}),k=Xn(_/b*100);p(k)}}}function Dw(e){if(e.defaultPrevented)return;const t=Oo();iv(e,t).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const o=s.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=MN({groupId:s.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function qd(e){const t=Oo();for(const[s]of t)if(s.separators.some(o=>o.element===e))return s;throw Error("Could not find parent Group for separator element")}function AN({groupId:e}){const t=()=>{const s=Oo();for(const[o,l]of s)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:o}=t();return s?{}:o},setLayout(s){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:u,layout:p,separatorToPanels:m}=t(),g=Co({layout:s,panelConstraints:l});return o?p:(So(p,g)||Ks(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:u,layout:g,separatorToPanels:m}),g)}}}function uo(e,t){const s=qd(e),o=Mr(s.id,!0),l=s.separators.find(h=>h.element===e);Ht(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Ht(c,"Matching panels not found");const u=c.map(h=>s.panels.indexOf(h)),p=AN({groupId:s.id}).getLayout(),m=zc({delta:t,initialLayout:p,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:p,trigger:"keyboard"}),g=Co({layout:m,panelConstraints:o.derivedPanelConstraints});So(p,g)||Ks(s,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:g,separatorToPanels:o.separatorToPanels})}function Pw(e){if(e.defaultPrevented)return;const t=e.currentTarget,s=qd(t);if(!s.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),s.orientation==="vertical"&&uo(t,5);break}case"ArrowLeft":{e.preventDefault(),s.orientation==="horizontal"&&uo(t,-5);break}case"ArrowRight":{e.preventDefault(),s.orientation==="horizontal"&&uo(t,5);break}case"ArrowUp":{e.preventDefault(),s.orientation==="vertical"&&uo(t,-5);break}case"End":{e.preventDefault(),uo(t,100);break}case"Enter":{e.preventDefault();const o=qd(t),l=Mr(o.id,!0),{derivedPanelConstraints:c,layout:u,separatorToPanels:p}=l,m=o.separators.find(_=>_.element===t);Ht(m,"Matching separator not found");const g=p.get(m);Ht(g,"Matching panels not found");const h=g[0],b=c.find(_=>_.panelId===h.id);if(Ht(b,"Panel metadata not found"),b.collapsible){const _=u[h.id],k=b.collapsedSize===_?o.mutableState.expandedPanelSizes[h.id]??b.minSize:b.collapsedSize;uo(t,k-_)}break}case"F6":{e.preventDefault();const o=qd(t).separators.map(u=>u.element),l=Array.from(o).findIndex(u=>u===e.currentTarget);Ht(l!==null,"Index not found");const c=e.shiftKey?l>0?l-1:o.length-1:l+1<o.length?l+1:0;o[c].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),uo(t,-100);break}}}let Ol={cursorFlags:0,state:"inactive"};const cv=new EN;function No(){return Ol}function Z7(e){return cv.addListener("change",e)}function W7(e){const t=Ol,s={...Ol};s.cursorFlags=e,Ol=s,cv.emit("change",{prev:t,next:s})}function zl(e){const t=Ol;Ol=e,cv.emit("change",{prev:t,next:e})}function Lw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Oo(),s=iv(e,t),o=new Map;let l=!1;s.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(c.group);u&&o.set(c.group,u.layout)}),zl({cursorFlags:0,hitRegions:s,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),s.length&&e.preventDefault()}const J7=e=>e,Rh=()=>{},ON=1,zN=2,DN=4,PN=8,Iw=3,Bw=12;let zd;function Uw(){return zd===void 0&&(zd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(zd=!0)),zd}function eB({cursorFlags:e,groups:t,state:s}){let o=0,l=0;switch(s){case"active":case"hover":t.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{l++;break}}})}if(!(o===0&&l===0)){switch(s){case"active":{if(e&&Uw()){const c=(e&ON)!==0,u=(e&zN)!==0,p=(e&DN)!==0,m=(e&PN)!==0;if(c)return p?"se-resize":m?"ne-resize":"e-resize";if(u)return p?"sw-resize":m?"nw-resize":"w-resize";if(p)return"s-resize";if(m)return"n-resize"}break}}return Uw()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const Hw=new WeakMap;function uv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:s}=Hw.get(e)??{};s===void 0&&(s=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(s):e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]));const o=No();switch(o.state){case"active":case"hover":{const l=eB({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(t===c)return;t=c,l?s.cssRules.length===0?s.insertRule(c):s.replaceSync(c):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{t=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}Hw.set(e,{prevStyle:t,styleSheet:s})}function LN({document:e,event:t,hitRegions:s,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:u}){let p=0;s.forEach(g=>{const{group:h,groupSize:b}=g,{orientation:_,panels:k}=h,{disableCursor:C}=h.mutableState;let y=0;c?_==="horizontal"?y=(t.clientX-c.x)/b*100:y=(t.clientY-c.y)/b*100:_==="horizontal"?y=t.clientX<0?-100:100:y=t.clientY<0?-100:100;const w=o.get(h),S=l.get(h);if(!w||!S)return;const{defaultLayoutDeferred:N,derivedPanelConstraints:E,groupSize:R,layout:M,separatorToPanels:T}=S;if(E&&M&&T){const A=zc({delta:y,initialLayout:w,panelConstraints:E,pivotIndices:g.panels.map(z=>k.indexOf(z)),prevLayout:M,trigger:"mouse-or-touch"});if(So(A,M)){if(y!==0&&!C)switch(_){case"horizontal":{p|=y<0?ON:zN;break}case"vertical":{p|=y<0?DN:PN;break}}}else Ks(g.group,{defaultLayoutDeferred:N,derivedPanelConstraints:E,groupSize:R,layout:A,separatorToPanels:T})}});let m=0;t.movementX===0?m|=u&Iw:m|=p&Iw,t.movementY===0?m|=u&Bw:m|=p&Bw,W7(m),uv(e)}function Vw(e){const t=Oo(),s=No();switch(s.state){case"active":LN({document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:t,prevCursorFlags:s.cursorFlags})}}function qw(e){if(e.defaultPrevented)return;const t=No(),s=Oo();switch(t.state){case"active":{if(e.buttons===0){zl({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=Mr(o.group.id,!0);Ks(o.group,l)});return}for(const o of t.hitRegions)if(o.separator){const{element:l}=o.separator;l.hasPointerCapture?.(e.pointerId)||l.setPointerCapture?.(e.pointerId)}LN({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=iv(e,s);o.length===0?t.state!=="inactive"&&zl({cursorFlags:0,state:"inactive"}):zl({cursorFlags:0,hitRegions:o,state:"hover"}),uv(e.currentTarget);break}}}function $w(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(No().state){case"hover":zl({cursorFlags:0,state:"inactive"})}}function Fw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=No();switch(t.state){case"active":zl({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(uv(e.currentTarget),t.hitRegions.forEach(s=>{const o=Mr(s.group.id,!0);Ks(s.group,o)}),e.preventDefault())}}function Gw(e){let t=0,s=0;const o={};for(const c of e)if(c.defaultSize!==void 0){t++;const u=Xn(c.defaultSize);s+=u,o[c.panelId]=u}else o[c.panelId]=void 0;const l=e.length-t;if(l!==0){const c=Xn((100-s)/l);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=c)}return o}function tB(e,t,s){if(!s[0])return;const o=e.panels.find(m=>m.element===t);if(!o||!o.onResize)return;const l=Kl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,p={asPercentage:Xn(c/l*100),inPixels:c};o.mutableValues.prevSize=p,o.onResize(p,o.id,u)}function nB(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function aB({group:e,nextGroupSize:t,prevGroupSize:s,prevLayout:o}){if(s<=0||t<=0||s===t)return o;let l=0,c=0,u=!1;const p=new Map,m=[];for(const b of e.panels){const _=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const k=_/100*s,C=Xn(k/t*100);p.set(b.id,C),l+=C;break}case"preserve-relative-size":default:{m.push(b.id),c+=_;break}}}if(!u||m.length===0)return o;const g=100-l,h={...o};if(p.forEach((b,_)=>{h[_]=b}),c>0)for(const b of m){const _=o[b]??0;h[b]=Xn(_/c*g)}else{const b=Xn(g/m.length);for(const _ of m)h[_]=b}return h}function sB(e,t){const s=e.map(l=>l.id),o=Object.keys(t);if(s.length!==o.length)return!1;for(const l of s)if(!o.includes(l))return!1;return!0}const yl=new Map;function rB(e){let t=!0;Ht(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new s(C=>{for(const y of C){const{borderBoxSize:w,target:S}=y;if(S===e.element){if(t){const N=Kl({group:e});if(N===0)return;const E=Mr(e.id);if(!E)return;const R=vx(e),M=E.defaultLayoutDeferred?Gw(R):E.layout,T=aB({group:e,nextGroupSize:N,prevGroupSize:E.groupSize,prevLayout:M}),A=Co({layout:T,panelConstraints:R});if(!E.defaultLayoutDeferred&&So(E.layout,A)&&nB(E.derivedPanelConstraints,R)&&E.groupSize===N)return;Ks(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:N,layout:A,separatorToPanels:E.separatorToPanels})}}else tB(e,S,w)}});c.observe(e.element),e.panels.forEach(C=>{Ht(!o.has(C.id),`Panel ids must be unique; id "${C.id}" was used more than once`),o.add(C.id),C.onResize&&c.observe(C.element)});const u=Kl({group:e}),p=vx(e),m=e.panels.map(({id:C})=>C).join(",");let g=e.mutableState.defaultLayout;g&&(sB(e.panels,g)||(g=void 0));const h=e.mutableState.layouts[m]??g??Gw(p),b=Co({layout:h,panelConstraints:p}),_=e.element.ownerDocument;yl.set(_,(yl.get(_)??0)+1);const k=new Map;return NN(e).forEach(C=>{C.separator&&k.set(C.separator,C.panels)}),Ks(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:p,groupSize:u,layout:b,separatorToPanels:k}),e.separators.forEach(C=>{Ht(!l.has(C.id),`Separator ids must be unique; id "${C.id}" was used more than once`),l.add(C.id),C.element.addEventListener("keydown",Pw)}),yl.get(_)===1&&(_.addEventListener("dblclick",Dw,!0),_.addEventListener("pointerdown",Lw,!0),_.addEventListener("pointerleave",Vw),_.addEventListener("pointermove",qw),_.addEventListener("pointerout",$w),_.addEventListener("pointerup",Fw,!0)),function(){t=!1,yl.set(_,Math.max(0,(yl.get(_)??0)-1)),H7(e),e.separators.forEach(C=>{C.element.removeEventListener("keydown",Pw)}),yl.get(_)||(_.removeEventListener("dblclick",Dw,!0),_.removeEventListener("pointerdown",Lw,!0),_.removeEventListener("pointerleave",Vw),_.removeEventListener("pointermove",qw),_.removeEventListener("pointerout",$w),_.removeEventListener("pointerup",Fw,!0)),c.disconnect()}}function oB(){const[e,t]=x.useState({}),s=x.useCallback(()=>t({}),[]);return[e,s]}function dv(e){const t=x.useId();return`${e??t}`}const zo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function kc(e){const t=x.useRef(e);return zo(()=>{t.current=e},[e]),x.useCallback((...s)=>t.current?.(...s),[t])}function fv(...e){return kc(t=>{e.forEach(s=>{if(s)switch(typeof s){case"function":{s(t);break}case"object":{s.current=t;break}}})})}function pv(e){const t=x.useRef({...e});return zo(()=>{for(const s in e)t.current[s]=e[s]},[e]),t.current}const IN=x.createContext(null);function lB(e,t){const s=x.useRef({getLayout:()=>({}),setLayout:J7});x.useImperativeHandle(t,()=>s.current,[]),zo(()=>{Object.assign(s.current,AN({groupId:e}))})}function yx({children:e,className:t,defaultLayout:s,disableCursor:o,disabled:l,elementRef:c,groupRef:u,id:p,onLayoutChange:m,onLayoutChanged:g,orientation:h="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:_,...k}){const C=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=kc(P=>{So(C.current.onLayoutChange,P)||(C.current.onLayoutChange=P,m?.(P))}),w=kc(P=>{So(C.current.onLayoutChanged,P)||(C.current.onLayoutChanged=P,g?.(P))}),S=dv(p),N=x.useRef(null),[E,R]=oB(),M=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),T=fv(N,c);lB(S,u);const A=kc((P,L)=>{const U=No(),q=Mw(P),$=Mr(P);if($){let V=!1;switch(U.state){case"active":{V=U.hitRegions.some(G=>G.group===q);break}}return{flexGrow:$.layout[L]??1,pointerEvents:V?"none":void 0}}if(s?.[L])return{flexGrow:s?.[L]}}),z=pv({defaultLayout:s,disableCursor:o}),I=x.useMemo(()=>({get disableCursor(){return!!z.disableCursor},getPanelStyles:A,id:S,orientation:h,registerPanel:P=>{const L=M.current;return L.panels=_x(h,[...L.panels,P]),R(),()=>{L.panels=L.panels.filter(U=>U!==P),R()}},registerSeparator:P=>{const L=M.current;return L.separators=_x(h,[...L.separators,P]),R(),()=>{L.separators=L.separators.filter(U=>U!==P),R()}},updatePanelProps:(P,{disabled:L})=>{const U=M.current.panels.find(V=>V.id===P);U&&(U.panelConstraints.disabled=L);const q=Mw(S),$=Mr(S);q&&$&&Ks(q,{...$,derivedPanelConstraints:vx(q)})},updateSeparatorProps:(P,{disabled:L,disableDoubleClick:U})=>{const q=M.current.separators.find($=>$.id===P);q&&(q.disabled=L,q.disableDoubleClick=U)}}),[A,S,R,h,z]),D=x.useRef(null);return zo(()=>{const P=N.current;if(P===null)return;const L=M.current;let U;if(z.defaultLayout!==void 0&&Object.keys(z.defaultLayout).length===L.panels.length){U={};for(const X of L.panels){const H=z.defaultLayout[X.id];H!==void 0&&(U[X.id]=H)}}const q={disabled:!!l,element:P,id:S,mutableState:{defaultLayout:U,disableCursor:!!z.disableCursor,expandedPanelSizes:M.current.lastExpandedPanelSizes,layouts:M.current.layouts},orientation:h,panels:L.panels,resizeTargetMinimumSize:L.resizeTargetMinimumSize,separators:L.separators};D.current=q;const $=rB(q),{defaultLayoutDeferred:V,derivedPanelConstraints:G,layout:K}=Mr(q.id,!0);!V&&G.length>0&&(y(K),w(K));const F=lv(S,X=>{const{defaultLayoutDeferred:H,derivedPanelConstraints:Q,layout:Y}=X.next;if(H||Q.length===0)return;const J=q.panels.map(({id:ne})=>ne).join(",");q.mutableState.layouts[J]=Y,Q.forEach(ne=>{if(ne.collapsible){const{layout:te}=X.prev??{};if(te){const le=Vn(ne.collapsedSize,Y[ne.panelId]),fe=Vn(ne.collapsedSize,te[ne.panelId]);le&&!fe&&(q.mutableState.expandedPanelSizes[ne.panelId]=te[ne.panelId])}}});const oe=No().state!=="active";y(Y),oe&&w(Y)});return()=>{D.current=null,$(),F()}},[l,S,w,y,h,E,z]),x.useEffect(()=>{const P=D.current;P&&(P.mutableState.defaultLayout=s,P.mutableState.disableCursor=!!o)}),r.jsx(IN.Provider,{value:I,children:r.jsx("div",{...k,className:t,"data-group":!0,"data-testid":S,id:S,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",..._,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:e})})}yx.displayName="Group";function mv(){const e=x.useContext(IN);return Ht(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function iB(e,t){const{id:s}=mv(),o=x.useRef({collapse:Rh,expand:Rh,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Rh});x.useImperativeHandle(t,()=>o.current,[]),zo(()=>{Object.assign(o.current,MN({groupId:s,panelId:e}))})}function fo({children:e,className:t,collapsedSize:s="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:u,groupResizeBehavior:p="preserve-relative-size",id:m,maxSize:g="100%",minSize:h="0%",onResize:b,panelRef:_,style:k,...C}){const y=!!m,w=dv(m),S=pv({disabled:c}),N=x.useRef(null),E=fv(N,u),{getPanelStyles:R,id:M,orientation:T,registerPanel:A,updatePanelProps:z}=mv(),I=b!==null,D=kc((q,$,V)=>{b?.(q,m,V)});zo(()=>{const q=N.current;if(q!==null){const $={element:q,id:w,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:I?D:void 0,panelConstraints:{groupResizeBehavior:p,collapsedSize:s,collapsible:o,defaultSize:l,disabled:S.disabled,maxSize:g,minSize:h}};return A($)}},[p,s,o,l,I,w,y,g,h,D,A,S]),x.useEffect(()=>{z(w,{disabled:c})},[c,w,z]),iB(w,_);const P=()=>{const q=R(M,w);if(q)return JSON.stringify(q)},L=x.useSyncExternalStore(q=>lv(M,q),P,P);let U;return L?U=JSON.parse(L):l!==void 0?U={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:U={flexGrow:1},r.jsx("div",{...C,"data-disabled":c||void 0,"data-panel":!0,"data-testid":w,id:w,ref:E,style:{...cB,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...U},children:r.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...k,touchAction:T==="horizontal"?"pan-y":"pan-x"},children:e})})}fo.displayName="Panel";const cB={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function uB({layout:e,panelConstraints:t,panelId:s,panelIndex:o}){let l,c;const u=e[s],p=t.find(m=>m.panelId===s);if(p){const m=p.maxSize,g=p.collapsible?p.collapsedSize:p.minSize,h=[o,o+1];c=Co({layout:zc({delta:g-u,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[s],l=Co({layout:zc({delta:m-u,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[s]}return{valueControls:s,valueMax:l,valueMin:c,valueNow:u}}function gv({children:e,className:t,disabled:s,disableDoubleClick:o,elementRef:l,id:c,style:u,...p}){const m=dv(c),g=pv({disabled:s,disableDoubleClick:o}),[h,b]=x.useState({}),[_,k]=x.useState("inactive"),[C,y]=x.useState(!1),w=x.useRef(null),S=fv(w,l),{disableCursor:N,id:E,orientation:R,registerSeparator:M,updateSeparatorProps:T}=mv(),A=R==="horizontal"?"vertical":"horizontal";zo(()=>{const D=w.current;if(D!==null){const P={disabled:g.disabled,disableDoubleClick:g.disableDoubleClick,element:D,id:m},L=M(P),U=Z7($=>{k($.next.state!=="inactive"&&$.next.hitRegions.some(V=>V.separator===P)?$.next.state:"inactive")}),q=lv(E,$=>{const{derivedPanelConstraints:V,layout:G,separatorToPanels:K}=$.next,F=K.get(P);if(F){const X=F[0],H=F.indexOf(X);b(uB({layout:G,panelConstraints:V,panelId:X.id,panelIndex:H}))}});return()=>{U(),q(),L()}}},[E,m,M,g]),x.useEffect(()=>{T(m,{disabled:s,disableDoubleClick:o})},[s,o,m,T]);let z;s&&!N&&(z="not-allowed");let I;if(s)I="disabled";else switch(_){case"active":{I="active";break}default:C?I="focus":I=_}return r.jsx("div",{...p,"aria-controls":h.valueControls,"aria-disabled":s||void 0,"aria-orientation":A,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:t,"data-separator":I,"data-testid":m,id:m,onBlur:()=>y(!1),onFocus:()=>y(!0),ref:S,role:"separator",style:{flexBasis:"auto",cursor:z,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}gv.displayName="Separator";function dB({projects:e,value:t,onChange:s,disabled:o}){const l=e.map(c=>{const u=c.path?.split("/").filter(Boolean).pop()||f("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||u,icon:dA,description:c.path}});return r.jsx("div",{className:"w-full","data-testid":"code-project-select",children:r.jsx(kt,{value:t,onChange:s,options:l,placeholder:f("modules_ui.code_pick_project_ph"),disabled:o})})}function fB({sessions:e,activeId:t,busy:s,onSelect:o,onCreate:l,onRename:c,onDelete:u}){return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:f("code_module.sessions")}),r.jsx(Je,{content:f("code_module.new_session"),children:r.jsxs("button",{type:"button",onClick:l,disabled:s,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[r.jsx(sn,{className:"size-3"})," ",f("code_module.new_session")]})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?r.jsx("div",{className:"p-2",children:r.jsx(ht,{children:f("code_module.no_sessions")})}):r.jsx("ul",{className:"space-y-0.5",children:e.map(p=>r.jsxs("li",{className:"group/item relative",children:[r.jsxs("button",{type:"button",onClick:()=>o(p.id),className:Oe("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",p.id===t?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[r.jsx(Px,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate font-medium",children:p.title}),r.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[p.mode," · ",p.messageCount," msg",p.model?` · ${p.model}`:""]})]})]}),r.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[r.jsx(Je,{content:f("code_module.rename"),children:r.jsx("button",{type:"button",onClick:()=>c(p.id,p.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:r.jsx(Eo,{className:"size-3"})})}),r.jsx(Je,{content:f("code_module.delete"),children:r.jsx("button",{type:"button",onClick:()=>u(p.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:r.jsx(ua,{className:"size-3"})})})]})]},p.id))})})]})}function pB({mode:e,onChange:t,disabled:s}){const o=(l,c,u,p)=>r.jsx(Je,{content:u,children:r.jsxs("button",{type:"button",disabled:s,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>t(l),className:Oe("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===l?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(p,{className:"size-3.5"})," ",c]})});return r.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",f("code_module.mode_build"),f("code_module.mode_build_hint"),hA),o("plan",f("code_module.mode_plan"),f("code_module.mode_plan_hint"),WM)]})}function mB({value:e,onValueChange:t,onSubmit:s,onStop:o,busy:l,disabled:c,mode:u,onModeChange:p,model:m,onModelChange:g}){return r.jsx(ev,{value:e,onValueChange:t,onSubmit:s,onStop:o,busy:l,disabled:c,placeholder:f("code_module.placeholder"),minRows:1,maxRows:6,footer:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pB,{mode:u,onChange:p,disabled:l}),r.jsx(tv,{value:m,onChange:g,disabled:l})]})})}function Th(e,t){let s=0;for(const o of e.parts||[])o.kind==="text"&&t.text&&(s+=o.text.length),o.kind==="tool"&&t.tool&&(o.args&&(s+=JSON.stringify(o.args).length),o.result!==void 0&&(s+=JSON.stringify(o.result).length));return Math.ceil(s/4)}function gB(e){let t=null,s=0,o=0;for(const u of e)u.role==="user"?s++:o++,u.role==="assistant"&&u.usage&&(t={input:u.usage.input_tokens,output:u.usage.output_tokens,model:u.model});const l=t?.input??0,c=t?.output??0;return{model:t?.model??null,input:l,output:c,total:l+c,hasUsage:!!t,messages:e.length,userMsgs:s,assistantMsgs:o}}function hB(e){let t=0,s=0,o=0;for(const u of e)u.role==="user"?t+=Th(u,{text:!0}):s+=Th(u,{text:!0}),o+=Th(u,{tool:!0});const l=t+s+o||1,c=(u,p)=>({key:u,tokens:p,percent:Math.round(p/l*100)});return[c("user",t),c("assistant",s),c("tool",o)].filter(u=>u.tokens>0)}const Yw={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Bs({label:e,value:t}){return r.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[r.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:t})]})}function Xw(e){if(!e)return"";const t=new Date(e),s=o=>String(o).padStart(2,"0");return`${s(t.getDate())} ${t.toLocaleString("es",{month:"short"})} ${t.getFullYear()}, ${s(t.getHours())}:${s(t.getMinutes())}`}function xB({turns:e,session:t}){const s=x.useMemo(()=>gB(e),[e]),o=x.useMemo(()=>hB(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(ht,{children:f("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(Bs,{label:f("code_module.ctx_model"),value:s.model||f("modules_ui.code_ctx_auto")}),t?.mode&&r.jsx(Bs,{label:f("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&r.jsx(Bs,{label:f("modules_ui.code_ctx_agent"),value:t.agentSlug}),r.jsx(Bs,{label:f("code_module.ctx_messages"),value:f("modules_ui.code_ctx_msgs_value",{user:s.userMsgs,assistant:s.assistantMsgs})}),r.jsx(Bs,{label:f("code_module.ctx_input"),value:s.input.toLocaleString()}),r.jsx(Bs,{label:f("code_module.ctx_output"),value:s.output.toLocaleString()}),r.jsx(Bs,{label:f("modules_ui.code_ctx_tokens_total"),value:(s.input+s.output).toLocaleString()}),t?.createdAt&&r.jsx(Bs,{label:f("modules_ui.code_ctx_created"),value:Xw(t.createdAt)}),t?.updatedAt&&r.jsx(Bs,{label:f("modules_ui.code_ctx_activity"),value:Xw(t.updatedAt)}),r.jsx("hr",{className:"border-border my-2"}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:f("code_module.ctx_breakdown")}),o.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>r.jsx(Je,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:r.jsx("div",{className:Yw[l.key],style:{width:`${l.percent}%`}})},l.key))}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>r.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{className:`size-2 rounded-full ${Yw[l.key]}`}),r.jsx("span",{className:"flex-1 text-foreground/80",children:f(`code_module.seg_${l.key}`)}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):r.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("code_module.ctx_none")})]})]})}function bB(e){const t=[];for(const s of(e||"").split(`
641
+ `))s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("new file")||s.startsWith("deleted file")||s.startsWith("similarity index")||s.startsWith("rename ")||(s.startsWith("@@")?t.push({kind:"hunk",text:s}):s.startsWith("+")?t.push({kind:"add",text:s.slice(1)}):s.startsWith("-")?t.push({kind:"del",text:s.slice(1)}):t.push({kind:"ctx",text:s.replace(/^ /,"")}));for(;t.length&&t[t.length-1].kind==="ctx"&&t[t.length-1].text==="";)t.pop();return t}function vB({patch:e}){const t=x.useMemo(()=>bB(e),[e]);return t.length?r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:r.jsx("code",{className:"block",children:t.map((s,o)=>r.jsxs("div",{className:Oe("px-2 whitespace-pre",s.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",s.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",s.kind==="hunk"&&"bg-muted/60 text-muted-foreground",s.kind==="ctx"&&"text-foreground/70"),children:[r.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},o))})}):null}const _B={added:oA,modified:Xd,deleted:cA},yB={added:"text-emerald-600 dark:text-emerald-400",modified:"text-amber-600 dark:text-amber-400",deleted:"text-rose-600 dark:text-rose-400"};function jB({file:e}){const[t,s]=x.useState(!1),o=_B[e.status];return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[r.jsx(Bc,{className:Oe("size-3 shrink-0 transition-transform",t&&"rotate-90")}),r.jsx(o,{className:Oe("size-3.5 shrink-0",yB[e.status])}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&r.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&r.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),t&&r.jsx("div",{className:"border-t border-border p-1.5",children:r.jsx(vB,{patch:e.patch})})]})}function wB({changes:e,loading:t,onRefresh:s}){const o=e?.files||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?f("code_module.changes_files",{n:o.length}):""}),r.jsx(Je,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?r.jsx(ja,{size:12}):r.jsx(cs,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?r.jsx(ht,{children:f("code_module.changes_no_git")}):o.length===0?r.jsx(ht,{children:f("code_module.changes_none")}):r.jsx("ul",{className:"space-y-1.5",children:o.map(l=>r.jsx(jB,{file:l},l.path))})})]})}function kB({pid:e,entry:t,onDeleted:s,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[u,p]=x.useState(!1),[m,g]=x.useState(null),h=lt(),[b,_]=x.useState(!1),[k,C]=x.useState(t.name),y=x.useRef(null),[w,S]=x.useState(!1),[N,E]=x.useState(!1),[R,M]=x.useState(!1),T=w?["artifact",e,t.name]:null,A=Ze(T,()=>Al.read(e,t.name),{revalidateOnFocus:!1}),z=!A.data?.content||A.data.content.startsWith("#!"),I=async U=>{try{await navigator.clipboard.writeText(U),h.info(f("modules_ui.code_copied"))}catch{}},D=async()=>{M(!0);try{await Al.remove(e,t.name),E(!1),s()}catch(U){h.error(U.message)}finally{M(!1)}},P=()=>{C(t.name),_(!0),requestAnimationFrame(()=>y.current?.select())},L=async()=>{const U=k.trim();if(_(!1),!(!U||U===t.name))try{await Al.rename(e,t.name,U),o()}catch(q){h.error(q.message)}};return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[r.jsx(rA,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),b?r.jsx("input",{ref:y,value:k,onChange:U=>C(U.target.value),onBlur:()=>void L(),onKeyDown:U=>{U.key==="Enter"&&L(),U.key==="Escape"&&_(!1)},autoFocus:!0,className:"min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 font-mono text-xs outline-none focus:ring-1 focus:ring-ring"}):r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:t.name}),r.jsx(Je,{content:f("code_module.artifacts_rename"),children:r.jsx("button",{type:"button",onClick:P,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Eo,{className:"size-3"})})}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.size,"b"]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:t.path}),r.jsx(Je,{content:f("code_module.artifacts_copy_path"),children:r.jsx("button",{type:"button",onClick:()=>void I(t.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Yd,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(ox,{open:w,onOpenChange:S,children:[r.jsx(Je,{content:f("code_module.artifacts_view"),children:r.jsxs("button",{type:"button",onClick:()=>S(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-blue-500/15 text-blue-700 hover:bg-blue-500/25 dark:text-blue-300",children:[r.jsx(kf,{className:"size-3"}),f("modules_ui.code_artifact_view_short")]})}),r.jsxs(lx,{className:"sm:max-w-lg",children:[r.jsx(ix,{children:r.jsx(cx,{className:"font-mono text-sm",children:t.name})}),A.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(ja,{size:16})}):r.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:A.data?.content??""}),r.jsx(Rj,{showCloseButton:!0})]})]}),r.jsx(Je,{content:f("code_module.artifacts_edit"),children:r.jsxs("button",{type:"button",onClick:()=>c?.(t.name),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-violet-500/15 text-violet-700 hover:bg-violet-500/25 dark:text-violet-300",children:[r.jsx(OA,{className:"size-3"}),f("modules_ui.code_artifact_edit_short")]})}),z&&r.jsx(Je,{content:f("code_module.artifacts_run"),children:r.jsxs("button",{type:"button",onClick:()=>l?.(`apx artifact run ${t.name}`),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[r.jsx(Lx,{className:"size-3"}),f("code_module.artifacts_run")]})}),r.jsxs(ox,{open:N,onOpenChange:E,children:[r.jsx(Je,{content:f("code_module.artifacts_delete"),children:r.jsx("button",{type:"button",onClick:()=>E(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:r.jsx(ua,{className:"size-3"})})}),r.jsxs(lx,{className:"sm:max-w-sm",children:[r.jsx(ix,{children:r.jsxs(cx,{className:"font-mono text-sm",children:[f("code_module.artifacts_delete")," — ",t.name]})}),r.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:f("code_module.artifacts_delete_confirm")}),r.jsxs(Rj,{children:[r.jsx(fP,{render:r.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:f("common.cancel")}),r.jsxs("button",{type:"button",onClick:()=>void D(),disabled:R,className:Oe("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",R?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[R&&r.jsx(ja,{size:10}),f("code_module.delete")]})]})]})]})]}),r.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[f("code_module.artifacts_run_hint")," ",r.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),m&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[r.jsx("span",{className:Oe("rounded px-1.5 py-0.5 font-mono",m.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:f("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.timedOut&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:f("modules_ui.code_artifact_timeout")}),m.truncated&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:f("modules_ui.code_artifact_truncated")}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.stderr&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-rose-500/5 p-2 text-[10px] leading-tight text-rose-700 dark:text-rose-300",children:m.stderr})]})]})]})}function SB({pid:e,onRunInTerminal:t,onEditArtifact:s}){const o=Ze(e?["artifacts",e]:null,()=>Al.list(e)),l=o.data||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?f("code_module.artifacts_count",{n:l.length}):""}),r.jsx(Je,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?r.jsx(ja,{size:12}):r.jsx(cs,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?r.jsx(ht,{children:f("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(kB,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:t,onEditArtifact:s},c.name))})})]})}const CB=[{value:"context",icon:Sf,label:"tab_context"},{value:"changes",icon:gA,label:"tab_changes"},{value:"artifacts",icon:CA,label:"tab_artifacts"}];function NB({pid:e,turns:t,changes:s,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:u,onEditArtifact:p}){const[m,g]=x.useState("context"),h=s?.files.length||0;return r.jsxs(tp,{value:m,onValueChange:g,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[r.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:r.jsx(np,{variant:"line",className:"w-full",children:CB.map(({value:b,icon:_,label:k})=>{const C=m===b,y=f(`code_module.${k}`);return r.jsx(Je,{content:y,children:r.jsxs(as,{value:b,className:C?"flex-1 min-w-0":"w-8 shrink-0",children:[r.jsx(_,{className:"size-3.5 shrink-0"}),C&&r.jsx("span",{className:"truncate text-xs",children:y}),b==="changes"&&h>0&&r.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:h})]})},b)})})}),r.jsx(Pa,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(xB,{turns:t,session:c})}),r.jsx(Pa,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(wB,{changes:s,loading:o,onRefresh:l})}),r.jsx(Pa,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(SB,{pid:e,onRunInTerminal:u,onEditArtifact:p})})]})}function EB(e){const t=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=t,u="";for(let p=0;p<l.length;p++){u=u?`${u}/${l[p]}`:l[p];const m=p===l.length-1;let g=c.find(h=>h.name===l[p]);g||(g={name:l[p],path:u,type:m?"file":"dir",children:m?void 0:[]},c.push(g)),m||(c=g.children)}}const s=o=>(o.forEach(l=>{l.children&&(l.children=s(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return s(t)}function BN({node:e,depth:t,onOpenFile:s,openDirs:o,toggleDir:l}){const c=e.type==="dir",u=c&&o.has(e.path);return r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>c?l(e.path):s(e.path),style:{paddingLeft:`${t*12+6}px`},className:Oe("flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[11px] rounded transition-colors","hover:bg-accent/40",c?"text-foreground/80":"text-foreground/70"),children:[c?r.jsxs(r.Fragment,{children:[r.jsx(Bc,{className:Oe("size-3 shrink-0 transition-transform",u&&"rotate-90")}),u?r.jsx(zx,{className:"size-3.5 shrink-0 text-amber-400"}):r.jsx(fA,{className:"size-3.5 shrink-0 text-amber-400"})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(uA,{className:"size-3.5 shrink-0 text-sky-400"})]}),r.jsx("span",{className:"truncate",children:e.name})]}),c&&u&&e.children&&e.children.length>0&&r.jsx("ul",{children:e.children.map(p=>r.jsx(BN,{node:p,depth:t+1,onOpenFile:s,openDirs:o,toggleDir:l},p.path))})]})}function RB({pid:e,projectPath:t,className:s,onOpenFile:o}){const[l,c]=x.useState([]),[u,p]=x.useState(!1),[m,g]=x.useState(!1),[h,b]=x.useState(()=>new Set),_=x.useCallback(async()=>{p(!0);try{const N=(await he.post("/run",{cmd:"find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.claude/*' | sed 's|^\\./||' | sort | head -500",project:e})).stdout.split(`
642
+ `).map(E=>E.trim()).filter(Boolean);c(N),g(!0)}catch{g(!0)}finally{p(!1)}},[e]);x.useEffect(()=>{b(new Set),_()},[_]);const k=x.useCallback(S=>{b(N=>{const E=new Set(N);return E.has(S)?E.delete(S):E.add(S),E})},[]),C=x.useCallback(()=>{b(new Set)},[]),y=EB(l),w=h.size>0;return r.jsxs("div",{className:Oe("flex h-full flex-col",s),"data-testid":"code-file-tree",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Je,{content:f("code_module.tree_collapse_all"),children:r.jsx("button",{type:"button",onClick:C,disabled:!w,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(KM,{className:"size-3"})})}),r.jsx(Je,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void _(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:u?r.jsx(ja,{size:12}):r.jsx(cs,{className:"size-3"})})})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?y.length===0?r.jsx("div",{className:"p-3",children:r.jsx(ht,{children:"Sin archivos"})}):r.jsx("ul",{children:y.map(S=>r.jsx(BN,{node:S,depth:0,onOpenFile:o??(()=>{}),openDirs:h,toggleDir:k},S.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(ja,{size:14})})})]})}function TB({path:e,content:t,loading:s,onSave:o}){const l=typeof o=="function",[c,u]=x.useState(t),[p,m]=x.useState(!1);x.useEffect(()=>{u(t)},[t]);const g=l&&c!==t,h=async()=>{if(!(!o||!g)){m(!0);try{await o(c)}finally{m(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,g&&r.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&r.jsxs(r.Fragment,{children:[r.jsx(Je,{content:f("code_module.discard_changes"),children:r.jsxs("button",{type:"button",onClick:()=>u(t),disabled:!g||p,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[r.jsx(Ix,{className:"size-3"}),"Descartar"]})}),r.jsx(Je,{content:f("code_module.save_shortcut_hint"),children:r.jsxs("button",{type:"button",onClick:()=>void h(),disabled:!g||p,className:Oe("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",g&&!p?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[p?r.jsx(ja,{size:10}):r.jsx(Nf,{className:"size-3"}),"Guardar"]})})]})]}),s?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(ja,{size:16})}):l?r.jsx("textarea",{value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),h())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:r.jsx("tbody",{children:t.split(`
643
+ `).map((b,_)=>r.jsxs("tr",{className:"hover:bg-accent/20",children:[r.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:_+1}),r.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},_))})})})]})}function MB({pid:e,className:t,initCmd:s,onClose:o}){const[l,c]=x.useState([]),[u,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState([]),[_,k]=x.useState(-1),C=x.useRef(null),y=x.useRef(null);x.useEffect(()=>{C.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{s&&(p(s),setTimeout(()=>y.current?.focus(),50))},[s]);const w=async N=>{const E=N.trim();if(E){b(R=>[E,...R.slice(0,49)]),k(-1),c(R=>[...R,{type:"cmd",text:`$ ${E}`}]),g(!0);try{const R=await he.post("/run",{cmd:E,project:e});R.stdout&&c(M=>[...M,{type:"out",text:R.stdout}]),R.stderr&&c(M=>[...M,{type:"err",text:R.stderr}])}catch(R){c(M=>[...M,{type:"err",text:String(R.message)}])}finally{g(!1)}}},S=N=>{if(N.key==="Enter")w(u),p("");else if(N.key==="ArrowUp"){N.preventDefault();const E=Math.min(_+1,h.length-1);k(E),p(h[E]??"")}else if(N.key==="ArrowDown"){N.preventDefault();const E=Math.max(_-1,-1);k(E),p(E===-1?"":h[E]??"")}};return r.jsxs("div",{className:Oe("flex h-full min-h-0 flex-col bg-card/60",t),"data-testid":"code-terminal",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[r.jsx(Ar,{className:"size-3 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),r.jsx(Je,{content:f("code_module.terminal_clear"),children:r.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(aA,{className:"size-3"})})}),r.jsx(Je,{content:f("code_module.terminal_close"),children:r.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(ps,{className:"size-3"})})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>y.current?.focus(),children:[l.map((N,E)=>r.jsx("div",{className:Oe("whitespace-pre-wrap break-all",N.type==="cmd"&&"text-emerald-400",N.type==="err"&&"text-rose-400",N.type==="out"&&"text-foreground/90"),children:N.text},E)),r.jsx("div",{ref:C})]}),r.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[r.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),r.jsx("input",{ref:y,value:u,onChange:N=>p(N.target.value),onKeyDown:S,disabled:m,placeholder:m?"ejecutando…":"comando…",className:"flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted-foreground/50 disabled:opacity-50",spellCheck:!1,autoComplete:"off"})]})]})}const cc="super-agent";function Mh(){return r.jsx(gv,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function AB(){return r.jsx(gv,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function OB(){const e=lt(),t=Ze("/projects",()=>la.list()),s=x.useMemo(()=>t.data||[],[t.data]),[o,l]=x.useState(""),[c,u]=x.useState(null),[p,m]=x.useState(cc),[g,h]=x.useState([]),[b,_]=x.useState(""),[k,C]=x.useState(!1),[y,w]=x.useState(!0),[S,N]=x.useState(!0),[E,R]=x.useState(!1),[M,T]=x.useState(""),[A,z]=x.useState(!1),I=x.useRef(null),[D,P]=x.useState([]),[L,U]=x.useState("chat"),q=x.useCallback(me=>{R(!0),T(me)},[]);x.useEffect(()=>{!o&&s.length&&l(String(s[0].id))},[o,s]);const $=Ze(o?["code-sessions",o]:null,()=>Is.sessions.list(o)),V=Ze(o?["agents",o]:null,()=>an.list(o)),G=Ze(o&&c?["code-session",o,c]:null,()=>Is.sessions.get(o,c)),K=Ze(o&&c?["code-changes",o,c]:null,()=>Is.changes(o,c));x.useEffect(()=>{const me=$.data||[];!c&&me.length&&u(me[0].id),c&&me.length&&!me.some(Me=>Me.id===c)&&u(me[0]?.id??null)},[$.data,c]),x.useEffect(()=>{G.data&&m(G.data.agentSlug||cc)},[G.data]),x.useEffect(()=>{k||(G.data?h(G.data.messages||[]):c||h([]))},[G.data,c,k]),x.useEffect(()=>()=>I.current?.abort(),[]);const F=G.data,X=F?.mode==="plan"?"plan":"build",H=F?.model||"",Q=me=>{me===o||k||(l(me),u(null),h([]))},Y=me=>{k||me===c||(u(me),h([]))},J=async()=>{if(!(!o||k))try{const me=await Is.sessions.create(o,{title:f("code_module.untitled"),agentSlug:p!==cc?p:null});await $.mutate(),u(me.id),h([])}catch(me){e.error(me.message)}},oe=async(me,Me)=>{const Pe=window.prompt(f("code_module.rename"),Me);if(!(!Pe||Pe===Me))try{await Is.sessions.update(o,me,{title:Pe}),await $.mutate(),me===c&&await G.mutate()}catch(Fe){e.error(Fe.message)}},ne=async me=>{if(!k&&window.confirm(f("code_module.delete_confirm")))try{await Is.sessions.remove(o,me),me===c&&(u(null),h([])),await $.mutate()}catch(Me){e.error(Me.message)}},te=async me=>{if(m(me),!!c)try{await Is.sessions.update(o,c,{agentSlug:me!==cc?me:null}),await Promise.all([G.mutate(),$.mutate()])}catch(Me){e.error(Me.message)}},le=x.useCallback(async me=>{if(c)try{await Is.sessions.update(o,c,me),await Promise.all([G.mutate(),$.mutate()])}catch(Me){e.error(Me.message)}},[o,c,G,$,e]),fe=()=>{I.current?.abort(),C(!1)},ze=me=>h(Me=>{const Pe=[...Me],Fe=Pe[Pe.length-1];return Fe&&Fe.role==="assistant"&&(Pe[Pe.length-1]=me(Fe)),Pe}),be=async me=>{const Me=(me??b).trim();if(!Me||k||!o||!c)return;const Pe=new Date().toISOString();h(rn=>[...rn,{role:"user",parts:[{kind:"text",text:Me}],ts:Pe},{role:"assistant",parts:[],ts:Pe,pending:!0}]),_(""),C(!0);const Fe=new AbortController;I.current=Fe;const rt=rn=>{if(rn.type==="error"){e.error(rn.error||f("modules_ui.code_stream_error"));return}ze(qt=>nv(qt,rn))};try{await Is.stream(o,c,{prompt:Me},rt,Fe.signal),ze(rn=>({...rn,pending:!1}))}catch(rn){Fe.signal.aborted?ze(qt=>({...qt,pending:!1,parts:[...qt.parts,{kind:"text",text:f("code_module.stopped")}]})):(e.error(rn.message),h(qt=>qt.filter((xt,At)=>At!==qt.length-1)))}finally{I.current===Fe&&(I.current=null),C(!1),G.mutate(),$.mutate(),K.mutate()}},pe=async me=>{try{await navigator.clipboard.writeText(me),e.info(f("modules_ui.code_copied"))}catch{}},je=x.useCallback(me=>{U(me),P(Me=>Me.some(Pe=>Pe.path===me)?Me:[...Me,{path:me,content:"",loading:!0}]),he.post("/run",{cmd:`cat "${me}"`,project:o}).then(Me=>{const Pe=Me.stdout||Me.stderr||f("modules_ui.code_file_empty");P(Fe=>Fe.map(rt=>rt.path===me?{...rt,content:Pe,loading:!1}:rt))}).catch(Me=>{P(Pe=>Pe.map(Fe=>Fe.path===me?{...Fe,content:f("modules_ui.code_file_error",{msg:Me.message}),loading:!1}:Fe))})},[o]),Ne=x.useCallback(me=>{P(Me=>Me.filter(Pe=>Pe.path!==me)),U(Me=>Me===me?"chat":Me)},[]),Be=x.useCallback(me=>{const Me=`artifacts/${me}`;U(Me),P(Pe=>Pe.some(Fe=>Fe.path===Me)?Pe:[...Pe,{path:Me,content:"",loading:!0,artifactName:me}]),Al.read(o,me).then(Pe=>{P(Fe=>Fe.map(rt=>rt.path===Me?{...rt,content:Pe.content,loading:!1}:rt))}).catch(Pe=>{P(Fe=>Fe.map(rt=>rt.path===Me?{...rt,content:f("modules_ui.code_file_error",{msg:Pe.message}),loading:!1}:rt))})},[o]),Ue=x.useCallback(async(me,Me)=>{const Pe=D.find(Fe=>Fe.path===me);if(Pe?.artifactName)try{await Al.write(o,Pe.artifactName,Me),P(Fe=>Fe.map(rt=>rt.path===me?{...rt,content:Me}:rt)),e.info(f("modules_ui.code_saved"))}catch(Fe){e.error(Fe.message)}},[D,o,e]),ye=!t.isLoading&&s.length>0,De=x.useMemo(()=>{const me=[{value:cc,label:f("modules_ui.code_super_agent"),icon:gn,description:f("modules_ui.code_super_agent_desc")}],Me=(V.data||[]).map(Pe=>({value:Pe.slug,label:Pe.slug,icon:gn,description:Pe.description||Pe.role||void 0}));return[...me,...Me]},[V.data]),ve=x.useMemo(()=>g,[g]),Re=x.useMemo(()=>$.data?.find(me=>me.id===c)?.title||"",[$.data,c]),Le=x.useMemo(()=>s.find(me=>String(me.id)===o),[s,o]);EP(Re);const[$e,He]=x.useState(null),we=k?null:fN(g),ie=we&&we.turnKey!==$e,Ce=me=>{be(me)},Ee=x.useCallback(()=>w(me=>!me),[]),Se=x.useCallback(()=>z(me=>!me),[]),qe=x.useCallback(()=>R(me=>!me),[]),st=x.useCallback(()=>N(me=>!me),[]),Nt=x.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:Mk,open:y,toggle:Ee,title:f("modules_ui.code_panel_sessions")},{Icon:Nk,open:A,toggle:Se,title:f("modules_ui.code_panel_tree")},{Icon:Ar,open:E,toggle:qe,title:f("modules_ui.code_panel_terminal")},{Icon:EA,open:S,toggle:st,title:f("modules_ui.code_panel_context")}].map(({Icon:me,open:Me,toggle:Pe,title:Fe})=>r.jsx(Je,{content:Fe,children:r.jsx("button",{type:"button",onClick:Pe,"data-active":Me,className:"rounded p-1 text-muted-fg transition-colors hover:bg-accent hover:text-accent-fg data-[active=true]:bg-accent data-[active=true]:text-accent-fg",children:r.jsx(me,{className:"size-3.5"})})},Fe))}):null,[c,y,A,E,S,Ee,Se,qe,st]);return TP(Nt),r.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?r.jsx(ot,{}):ye?r.jsxs(yx,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(fo,{id:"top",defaultSize:E?"55%":"100%",minSize:"20%",children:r.jsxs(yx,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[y&&r.jsxs(r.Fragment,{children:[r.jsx(fo,{id:"left",defaultSize:"14%",minSize:"8%",children:r.jsxs("aside",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"shrink-0 border-b border-border p-2",children:r.jsx(dB,{projects:s,value:o,onChange:Q,disabled:k})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(fB,{sessions:$.data||[],activeId:c,busy:k,onSelect:Y,onCreate:J,onRename:oe,onDelete:ne})}),r.jsx("div",{className:"shrink-0 border-t border-border p-2",children:r.jsx(kt,{value:p,onChange:te,options:De,disabled:k,showIcon:!0})})]})}),r.jsx(Mh,{})]}),A&&r.jsxs(r.Fragment,{children:[r.jsx(fo,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(RB,{pid:o,projectPath:Le?.path,onOpenFile:je})})}),r.jsx(Mh,{})]}),r.jsx(fo,{id:"main",defaultSize:"50%",minSize:"20%",children:r.jsxs("div",{className:"flex h-full flex-col",children:[D.length>0&&r.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[r.jsxs("button",{type:"button",onClick:()=>U("chat"),"data-active":L==="chat",className:"flex shrink-0 items-center gap-1.5 border-r border-border px-3 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Px,{className:"size-3 shrink-0"}),f("modules_ui.code_chat_tab")]}),D.map(me=>{const Me=me.path.split("/").pop()??me.path,Pe=L===me.path;return r.jsxs("div",{"data-active":Pe,className:"group flex shrink-0 items-center gap-1 border-r border-border px-2 py-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Je,{content:me.path,children:r.jsx("button",{type:"button",onClick:()=>U(me.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Me})}),r.jsx(Je,{content:f("code_module.close"),children:r.jsx("button",{type:"button",onClick:()=>Ne(me.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:r.jsx(ps,{className:"size-2.5"})})})]},me.path)})]}),L==="chat"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?g.length?r.jsx(av,{msgs:g,onCopy:pe}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(ht,{children:f("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(ht,{children:f("code_module.pick_project")})})}),ie&&we&&r.jsx(dN,{turnKey:we.turnKey,questions:we.questions,onSubmit:Ce,onDismiss:()=>He(we.turnKey),disabled:k})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const me=D.find(Me=>Me.path===L);return me?r.jsx(TB,{path:me.path,content:me.content,loading:me.loading,onSave:me.artifactName?Me=>Ue(me.path,Me):void 0}):null})()}),r.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:r.jsx(mB,{value:b,onValueChange:_,onSubmit:()=>void be(),onStop:fe,busy:k,disabled:!c,mode:X,onModeChange:me=>void le({mode:me}),model:H,onModelChange:me=>void le({model:me||null})})})]})}),S&&r.jsxs(r.Fragment,{children:[r.jsx(Mh,{}),r.jsx(fo,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(NB,{pid:o,turns:ve,changes:K.data,changesLoading:K.isLoading,onRefreshChanges:()=>void K.mutate(),session:G.data?{title:G.data.title,mode:G.data.mode,createdAt:G.data.createdAt,updatedAt:G.data.updatedAt,agentSlug:G.data.agentSlug??null}:null,onRunInTerminal:q,onEditArtifact:Be})})})]})]})}),E&&o&&r.jsxs(r.Fragment,{children:[r.jsx(AB,{}),r.jsx(fo,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(MB,{pid:o,initCmd:M,onClose:qe,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(ht,{children:f("code_module.no_projects")})})})}function zB({open:e,onClose:t}){const{mutate:s}=rC(),o=Zn(),l=lt(),[c,u]=x.useState(""),[p,m]=x.useState(!1),[g,h]=x.useState(""),[b,_]=x.useState([]),[k,C]=x.useState(null),[y,w]=x.useState(""),[S,N]=x.useState(!1),[E,R]=x.useState(!1),M=async(z,I=!1)=>{N(!0),w("");try{const D=await yj.dirs(z||"~");h(D.path),u(D.path),C(D.parent),_(D.entries)}catch(D){const P=D.message;w(P),I||l.error(P)}finally{N(!1)}};x.useEffect(()=>{e||(u(""),m(!1),h(""),_([]),C(null),w(""))},[e]);const T=async()=>{N(!0);try{const z=await yj.pickDir(f("add_project.picker_prompt"));if("cancelled"in z)return;u(z.path);return}catch{m(!0),await M(c||"~")}finally{N(!1)}},A=async()=>{const z=c.trim();if(!z){l.error(f("add_project.path_required"));return}R(!0);try{const I=await la.register(z);l.success(f("add_project.registered",{id:I.id})),await s("/projects"),t(),o(`/p/${I.id}`)}catch(I){l.error(I.message)}finally{R(!1)}};return r.jsx(En,{open:e,onClose:t,title:f("add_project.title"),description:f("add_project.subtitle"),footer:r.jsxs(r.Fragment,{children:[r.jsx(de,{variant:"ghost",onClick:t,disabled:E,children:f("common.cancel")}),r.jsx(de,{variant:"primary",onClick:A,loading:E,children:f("add_project.register")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ue,{label:f("add_project.path_label"),hint:f("add_project.path_hint"),children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ae,{autoFocus:!0,placeholder:f("add_project.path_placeholder"),value:c,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&A()}}),r.jsxs(de,{onClick:T,disabled:S,children:[r.jsx(Ld,{size:14})," ",f("add_project.search_btn")]})]})}),p&&r.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:g||c||"~"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>M("~"),disabled:S,children:r.jsx(bA,{size:13})}),r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>k&&M(k),disabled:!k||S,children:".."}),r.jsx(de,{size:"sm",variant:"ghost",onClick:()=>m(!1),disabled:S,children:r.jsx(ps,{size:13})})]})]}),r.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[S&&r.jsx(ot,{}),!S&&y&&r.jsx(ht,{children:f("add_project.browser_unavailable")}),!S&&!y&&b.length===0&&r.jsx(ht,{children:f("add_project.no_folders")}),!S&&!y&&b.map(z=>r.jsxs("button",{type:"button",onClick:()=>M(z),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[r.jsx(zx,{size:14,className:"text-muted-fg"}),r.jsx("span",{className:"truncate",children:z.split("/").pop()}),r.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:z})]},z))]})]})]})})}function DB({onPaired:e}){const[t,s]=x.useState(""),[o,l]=x.useState(PB()),[c,u]=x.useState(!1),[p,m]=x.useState(null);async function g(){const h=t.trim();if(!h){m(f("pairing.err_required"));return}u(!0),m(null);try{const b=await Fl.confirm({pairing_id:h,label:o.trim()||void 0});po(b.token);try{localStorage.setItem(Cn.token,b.token)}catch{}e()}catch(b){m(LB(b)),u(!1)}}return r.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:r.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[r.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:r.jsx(Dh,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-semibold",children:f("pairing.title")}),r.jsx("p",{className:"text-xs text-muted-fg",children:f("pairing.subtitle")})]})]}),r.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[r.jsx("li",{className:"font-medium text-foreground",children:f("pairing.steps_title")}),r.jsxs("li",{children:["1. ",f("pairing.step_1")]}),r.jsxs("li",{children:["2. ",f("pairing.step_2")]}),r.jsxs("li",{children:["3. ",f("pairing.step_3")]})]}),r.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),g()},children:[r.jsx(ue,{label:f("pairing.code_label"),children:r.jsx(Ae,{value:t,onChange:h=>s(h.target.value),placeholder:f("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),r.jsx(ue,{label:f("pairing.label_label"),hint:f("pairing.revoke_hint"),children:r.jsx(Ae,{value:o,onChange:h=>l(h.target.value),placeholder:f("pairing.label_ph")})}),p&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p}),r.jsx(de,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:f(c?"pairing.linking":"pairing.submit")})]})]})})}function PB(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function LB(e){if(e instanceof Yc){if(e.status===410)return f("pairing.err_expired");if(e.status===404||e.status===409)return f("pairing.err_unknown")}return f("pairing.err_generic")}function IB({...e}){return r.jsx(_C,{"data-slot":"sheet",...e})}function BB({...e}){return r.jsx(vC,{"data-slot":"sheet-portal",...e})}function UB({className:e,...t}){return r.jsx(gC,{"data-slot":"sheet-overlay",className:St("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function HB({className:e,children:t,side:s="right",showCloseButton:o=!0,...l}){return r.jsxs(BB,{children:[r.jsx(UB,{}),r.jsxs(bC,{"data-slot":"sheet-content","data-side":s,className:St("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...l,children:[t,o&&r.jsxs(ep,{"data-slot":"sheet-close",render:r.jsx(Xs,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(ps,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function VB({className:e,...t}){return r.jsx("div",{"data-slot":"sheet-header",className:St("flex flex-col gap-0.5 p-4",e),...t})}function qB({className:e,...t}){return r.jsx(yC,{"data-slot":"sheet-title",className:St("font-heading text-base font-medium text-foreground",e),...t})}function $B({className:e,...t}){return r.jsx(hC,{"data-slot":"sheet-description",className:St("text-sm text-muted-foreground",e),...t})}function FB({value:e,projectPath:t,onPick:s}){const o=GB(e),l=o?YB(e):"",{data:c}=Ze(o?["/skills",t||""]:null,()=>fc.list(t)),u=c?.skills||[],p=x.useMemo(()=>{const m=l.toLowerCase();return m?u.filter(g=>g.slug.toLowerCase().includes(m)).slice(0,8):u.slice(0,8)},[u,l]);return!o||p.length===0?null:r.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[r.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:p.map(m=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(m.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[r.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",m.slug]}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.slug))}),r.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[10px] text-muted-foreground",children:"Type a name to filter · click to insert · the skill body will be loaded for this turn."})]})}function GB(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function YB(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function XB(){try{const e=localStorage.getItem(Cn.robyChat);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(s=>s&&Array.isArray(s.parts)&&!s.pending):[]}catch{return[]}}function KB({open:e,onOpenChange:t}){const s=Bb(),o=lt(),[l,c]=x.useState(XB),[u,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(""),_=x.useRef(null);x.useEffect(()=>{const N=l.filter(E=>!E.pending);try{N.length?localStorage.setItem(Cn.robyChat,JSON.stringify(N)):localStorage.removeItem(Cn.robyChat)}catch{}},[l]);const k=()=>{if(!m){c([]),p("");try{localStorage.removeItem(Cn.robyChat)}catch{}}};x.useEffect(()=>()=>_.current?.abort(),[]);const C=()=>{_.current?.abort(),g(!1)},y=N=>c(E=>{const R=[...E],M=R[R.length-1];return M?.role==="assistant"&&(R[R.length-1]=N(M)),R}),w=async()=>{const N=u.trim();if(!N||m)return;const E=new Date().toISOString(),R=l.filter(z=>!z.pending).map(z=>({role:z.role,content:mx(z)}));c(z=>[...z,{role:"user",parts:[{kind:"text",text:N}],ts:E},{role:"assistant",parts:[],ts:E,pending:!0}]),p(""),g(!0);const M=new AbortController;_.current=M;let T=!1;const A=z=>{if(z?.type==="error"){T=!0,o.error(z.error||"error"),c(I=>{const D=[...I],P=D[D.length-1];return P?.role==="assistant"&&P.pending&&D.pop(),D});return}y(I=>nv(I,z))};try{await lC.stream(0,{prompt:N,previousMessages:R,model:h||void 0,channel:"web_sidebar"},A,M.signal),y(z=>({...z,pending:!1}))}catch(z){M.signal.aborted?y(I=>({...I,pending:!1,parts:[...I.parts,{kind:"text",text:f("project.chat.stopped_marker")}]})):T||(o.error(z.message),c(I=>{const D=[...I],P=D[D.length-1];return P?.role==="assistant"&&P.pending&&D.pop(),D}))}finally{_.current===M&&(_.current=null),g(!1)}},S=async N=>{try{await navigator.clipboard.writeText(N),o.info(f("project.chat.copied"))}catch{}};return r.jsx(IB,{open:e,onOpenChange:t,children:r.jsxs(HB,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[r.jsxs(VB,{className:"pr-12",children:[r.jsxs(qB,{className:"flex items-center gap-2",children:[r.jsx(gn,{size:18})," ",f("superagent.title",{persona:s}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:f("superagent.badge")})]}),r.jsx($B,{children:f("superagent.desc")})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?r.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:f("superagent.empty",{persona:s})}):r.jsx(av,{msgs:l,onCopy:S})}),r.jsx(uN,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(FB,{value:u,onPick:N=>p(`/${N} `)})}),r.jsx(ev,{value:u,onValueChange:p,onSubmit:()=>void w(),onStop:C,busy:m,placeholder:f("superagent.placeholder"),footer:r.jsx(tv,{value:h,onChange:b,disabled:m})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs(Xs,{size:"xs",variant:"ghost",onClick:k,disabled:m||l.length===0,children:[r.jsx(sn,{className:"size-3"})," ",f("superagent.new_chat")]})})]})]})})}function QB(){const e=navigator.userAgent;return/iPhone|iPad/.test(e)?"iPhone":/Android/.test(e)?"Android":/Mac/.test(e)?"Mac":/Windows/.test(e)?"Windows PC":/Linux/.test(e)?"Linux":"browser"}function ZB(){const[e,t]=x.useState({status:"loading"}),[s,o]=x.useState(0),l=x.useCallback(()=>{t({status:"loading"}),o(c=>c+1)},[]);return x.useEffect(()=>{let c=!1;return(async()=>{try{const h=await fetch("/health");if(!h.ok)throw new Error(`HTTP ${h.status}`)}catch(h){c||t({status:"error",reason:String(h)});return}const u=window.location.hash.replace(/^#/,""),p=new URLSearchParams(u),m=p.get("pair");if(m){history.replaceState(null,"",window.location.pathname+window.location.search);try{const h=await Fl.confirm({pairing_id:m,label:QB(),kind:"web"});po(h.token);try{localStorage.setItem(Cn.token,h.token)}catch{}c||t({status:"ok"});return}catch{}}const g=p.get("token");if(g){po(g);try{localStorage.setItem(Cn.token,g)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Cn.token);h&&po(h)}catch{}try{const h=await fetch("/admin/web-token");if(h.ok){const b=await h.json();if(b?.token){po(b.token);try{localStorage.setItem(Cn.token,b.token)}catch{}}}}catch{}if(!Db()){c||t({status:"unpaired"});return}try{await he.get("/projects"),c||t({status:"ok"})}catch(h){if(h instanceof Yc&&(h.status===401||h.status===403)){po(null);try{localStorage.removeItem(Cn.token)}catch{}c||t({status:"unpaired"})}else c||t({status:"error",reason:String(h)})}})(),()=>{c=!0}},[s]),{...e,reload:l}}function WB(){const e=ZB();return e.status==="loading"?r.jsx(Kw,{text:f("daemon.connecting")}):e.status==="error"?r.jsx(Kw,{mood:"sad",text:f("daemon.unreachable"),sub:`${f("daemon.unreachable_hint")}
644
+
645
+ ${e.reason}`}):e.status==="unpaired"?r.jsx(DB,{onPaired:e.reload}):r.jsx(vP,{children:r.jsx(A4,{delay:0,children:r.jsx(JB,{})})})}function JB(){const e=Zn(),t=Qn(),[s,o]=wf(),{theme:l,toggle:c}=Hx(),u=s.get("action")==="add-project",[p,m]=x.useState(!1),g=()=>{const b=new URLSearchParams(s);b.delete("action"),o(b,{replace:!0})},h=()=>{const b=new URLSearchParams(s);b.set("action","add-project"),o(b)};return r.jsx(kP,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(MD,{onSelect:b=>e(b),onOpenRoby:()=>m(!0),onOpenAddProject:h}),r.jsxs("main",{className:"m-2 ml-0 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[r.jsx(e9,{onToggleTheme:c,isDark:l==="dark",pathname:t.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(pk,{children:[r.jsx(Ft,{path:"/",element:r.jsx(wP,{})}),r.jsx(Ft,{path:"/settings/*",element:r.jsx(r7,{})}),r.jsx(Ft,{path:"/m/voice/*",element:r.jsx(g7,{})}),r.jsx(Ft,{path:"/m/desktop/*",element:r.jsx(v7,{})}),r.jsx(Ft,{path:"/m/deck/*",element:r.jsx(M7,{})}),r.jsx(Ft,{path:"/m/code/*",element:r.jsx(OB,{})}),r.jsx(Ft,{path:"/p/:pid/*",element:r.jsx(u8,{})}),r.jsx(Ft,{path:"*",element:r.jsx(r9,{})})]})})]}),r.jsx(zB,{open:u,onClose:g}),r.jsx(KB,{open:p,onOpenChange:m})]})})}function e9({onToggleTheme:e,isDark:t,pathname:s}){const{projects:o}=Xc(),l=NP(),c=s.split("/").filter(Boolean),u=c[0]==="p"?o.find(C=>String(C.id)===c[1]):void 0,p=c[0]==="settings"?a9(c[1]):c[0]==="p"?s9(c[2]):"",m=c[0]==="p"&&c[1]==="0",g=u?.name||u?.path?.split("/").pop()||f("nav.project"),h=s==="/"?f("topbar.breadcrumb_root"):c[0]==="settings"?[f("topbar.breadcrumb_root"),f("nav.settings"),p].filter(Boolean).join(" › "):c[0]==="m"?[f("topbar.breadcrumb_root"),n9(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?m?[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_base"),p].filter(Boolean).join(" › "):[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_projects"),g,p].filter(Boolean).join(" › "):f("topbar.breadcrumb_root"),b=s==="/"?"":c[0]==="settings"?f("settings.subtitle"):c[0]==="p"?m?f("base.subtitle"):u?`${cC(u.kind)} · ${u.path}`:"":"",_=SP(),k=RP();return r.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[_&&r.jsx($z,{collapsed:_.collapsed,onToggle:_.toggle}),r.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,b&&r.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),k,r.jsx(t9,{}),r.jsx(Je,{content:f(t?"topbar.light":"topbar.dark"),children:r.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:t?r.jsx(zA,{size:14}):r.jsx(SA,{size:14})})})]})}function t9(){const e=K2(),t=s=>{s!==e&&(Y2(s),window.location.reload())};return r.jsxs($2,{children:[r.jsxs(F2,{"data-testid":"lang-menu",title:f("topbar.lang_toggle"),className:"flex shrink-0 items-center gap-1 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:[r.jsx(_A,{size:14}),r.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),r.jsx(G2,{align:"end",children:r.jsx(Pz,{value:e,onValueChange:s=>t(s),children:X2.map(s=>r.jsx(Lz,{value:s.value,children:s.label},s.value))})})]})}function n9(e){switch(e){case"voice":return f("nav.modules.voice");case"desktop":return f("nav.modules.desktop");case"deck":return f("nav.modules.deck");case"code":return f("nav.modules.code");default:return e||""}}function a9(e){switch(e){case"super-agent":return f("settings.tabs.super_agent");case"engines":return f("settings.tabs.engines");case"telegram":return f("settings.tabs.telegram");case"devices":return f("settings.tabs.devices");case"appearance":return f("settings.appearance");case"config":case"advanced":return f("settings.tabs.advanced");case"identity":default:return e||""}}function s9(e){switch(e){case"chat":return f("project.nav.chat");case"telegram":return f("project.nav.telegram");case"agents":return f("project.nav.agents");case"routines":return f("project.nav.routines");case"tasks":return f("project.nav.tasks");case"mcps":return f("project.nav.mcps");case"config":return f("project.nav.config");case"workspaces":return f("base.workspaces_title");case"models":return f("settings.tabs.engines");case"agent-defaults":return f("base.defaults_title");case"sessions":return f("base.sessions_title");case"logs":return f("project.nav.logs");case"memories":return f("project.nav.memories");default:return""}}function Kw({text:e,sub:t,mood:s="happy"}){return r.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(zC,{mood:s,className:"mb-4 text-xs"}),r.jsx("div",{className:"text-foreground",children:e}),t&&r.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function r9(){const e=Zn();return r.jsx(DC,{testId:"screen-not-found",mood:"confused",title:f("not_found.title"),titleClassName:"text-7xl",message:f("not_found.message"),action:r.jsx(Xs,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})})}iT.createRoot(document.getElementById("root")).render(r.jsx(Pc.StrictMode,{children:r.jsx(MM,{children:r.jsx(HA,{children:r.jsx(WB,{})})})}));
646
+ //# sourceMappingURL=index-Cg-uHCex.js.map